import{h as e}from"./http-02fe43dc.js";import{a as n,X as r,Y as a,Z as s,$ as i,_ as o,I as l,r as u,R as c,G as d,H as h,J as p,K as f,M as m,O as g,a0 as y,a1 as b,S as v,a2 as A,a3 as x,U as k,a4 as w,Q as S,a5 as C,a6 as I,a7 as W,a8 as _,W as T,P as N}from"./installCanvasRenderer-9b5b120c.js";import{q as E,r as R}from"./index-1b6a7101.js";import{c as $,aV as O,k as F,F as D,i as M,c8 as L,c9 as B,_ as P,j as z,m as G,r as V,bb as U,P as H,h as j,u as q,ca as Q,H as X,aU as Z,a_ as K,l as J,g as Y,f as ee,b as te,t as ne,bc as re,aH as ae,w as se,bt as ie,b8 as oe,X as le,I as ue,aY as ce,bu as de,cb as he,cc as pe,aW as fe,$ as me,aQ as ge,a0 as ye,c2 as be,ax as ve,a1 as Ae,a2 as xe,a3 as ke,a4 as we,e as Se,cd as Ce,Y as Ie,ce as We,c5 as _e,c0 as Te,D as Ne,cf as Ee,bZ as Re,c3 as $e,bB as Oe,aR as Fe,c4 as De,c7 as Me,cg as Le,aP as Be,bo as Pe,bp as ze,ch as Ge,C as Ve,c6 as Ue,bj as He,Z as je,a5 as qe}from"./index-b8cd3494.js";import{_ as Qe,F as Xe}from"./footer-e3b4eb99.js";import{G as Ze}from"./group-qrcode-6fdd7180.js";import{_ as Ke,T as Je,a as Ye}from"./index-287ba071.js";import{u as et,r as tt}from"./RightOutlined-6c65bef5.js";import{o as nt}from"./omit-cfb7cc57.js";import"./axios-09e7ff2c.js";import"./index-60c3666d.js";import"./isPlainObject-162b6460.js";function rt(e,t){for(var n=0;n<t.length;n++){const r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(r,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function at(e){return null!=e}const st=e=>{const{itemPrefixCls:t,component:n,span:r,labelStyle:a,contentStyle:s,bordered:i,label:o,content:l,colon:u}=e,c=n;return i?$(c,{class:[{[`${t}-item-label`]:at(o),[`${t}-item-content`]:at(l)}],colSpan:r},{default:()=>[at(o)&&$("span",{style:a},[o]),at(l)&&$("span",{style:s},[l])]}):$(c,{class:[`${t}-item`],colSpan:r},{default:()=>[$("div",{class:`${t}-item-container`},[(o||0===o)&&$("span",{class:[`${t}-item-label`,{[`${t}-item-no-colon`]:!u}],style:a},[o]),(l||0===l)&&$("span",{class:`${t}-item-content`,style:s},[l])])]})},it=e=>{const t=(e,t,n)=>{let{colon:r,prefixCls:a,bordered:s}=t,{component:i,type:o,showLabel:l,showContent:u,labelStyle:c,contentStyle:d}=n;return e.map(((e,t)=>{var n,h;const p=e.props||{},{prefixCls:f=a,span:m=1,labelStyle:g=p["label-style"],contentStyle:y=p["content-style"],label:b=(null===(h=null===(n=e.children)||void 0===n?void 0:n.label)||void 0===h?void 0:h.call(n))}=p,v=M(e),A=L(e),x=B(e),{key:k}=e;return"string"==typeof i?$(st,{key:`${o}-${String(k)||t}`,class:A,style:x,labelStyle:P(P({},c),g),contentStyle:P(P({},d),y),span:m,colon:r,component:i,itemPrefixCls:f,bordered:s,label:l?b:null,content:u?v:null},null):[$(st,{key:`label-${String(k)||t}`,class:A,style:P(P(P({},c),x),g),span:1,colon:r,component:i[0],itemPrefixCls:f,bordered:s,label:b},null),$(st,{key:`content-${String(k)||t}`,class:A,style:P(P(P({},d),x),y),span:2*m-1,component:i[1],itemPrefixCls:f,bordered:s,content:v},null)]}))},{prefixCls:n,vertical:r,row:a,index:s,bordered:i}=e,{labelStyle:o,contentStyle:l}=O(pt,{labelStyle:F({}),contentStyle:F({})});return r?$(D,null,[$("tr",{key:`label-${s}`,class:`${n}-row`},[t(a,e,{component:"th",type:"label",showLabel:!0,labelStyle:o.value,contentStyle:l.value})]),$("tr",{key:`content-${s}`,class:`${n}-row`},[t(a,e,{component:"td",type:"content",showContent:!0,labelStyle:o.value,contentStyle:l.value})])]):$("tr",{key:s,class:`${n}-row`},[t(a,e,{component:i?["th","td"]:"td",type:"item",showLabel:!0,showContent:!0,labelStyle:o.value,contentStyle:l.value})])},ot=e=>{const{componentCls:t,descriptionsSmallPadding:n,descriptionsDefaultPadding:r,descriptionsMiddlePadding:a,descriptionsBg:s}=e;return{[`&${t}-bordered`]:{[`${t}-view`]:{border:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,"> table":{tableLayout:"auto",borderCollapse:"collapse"}},[`${t}-item-label, ${t}-item-content`]:{padding:r,borderInlineEnd:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderInlineEnd:"none"}},[`${t}-item-label`]:{backgroundColor:s,"&::after":{display:"none"}},[`${t}-row`]:{borderBottom:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderBottom:"none"}},[`&${t}-middle`]:{[`${t}-item-label, ${t}-item-content`]:{padding:a}},[`&${t}-small`]:{[`${t}-item-label, ${t}-item-content`]:{padding:n}}}}},lt=e=>{const{componentCls:t,descriptionsExtraColor:n,descriptionItemPaddingBottom:r,descriptionsItemLabelColonMarginRight:a,descriptionsItemLabelColonMarginLeft:s,descriptionsTitleMarginBottom:i}=e;return{[t]:P(P(P({},V(e)),ot(e)),{"&-rtl":{direction:"rtl"},[`${t}-header`]:{display:"flex",alignItems:"center",marginBottom:i},[`${t}-title`]:P(P({},U),{flex:"auto",color:e.colorText,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}),[`${t}-extra`]:{marginInlineStart:"auto",color:n,fontSize:e.fontSize},[`${t}-view`]:{width:"100%",borderRadius:e.borderRadiusLG,table:{width:"100%",tableLayout:"fixed"}},[`${t}-row`]:{"> th, > td":{paddingBottom:r},"&:last-child":{borderBottom:"none"}},[`${t}-item-label`]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"start","&::after":{content:'":"',position:"relative",top:-.5,marginInline:`${s}px ${a}px`},[`&${t}-item-no-colon::after`]:{content:'""'}},[`${t}-item-no-label`]:{"&::after":{margin:0,content:'""'}},[`${t}-item-content`]:{display:"table-cell",flex:1,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,wordBreak:"break-word",overflowWrap:"break-word"},[`${t}-item`]:{paddingBottom:0,verticalAlign:"top","&-container":{display:"flex",[`${t}-item-label`]:{display:"inline-flex",alignItems:"baseline"},[`${t}-item-content`]:{display:"inline-flex",alignItems:"baseline"}}},"&-middle":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingSM}}},"&-small":{[`${t}-row`]:{"> th, > td":{paddingBottom:e.paddingXS}}}})}},ut=z("Descriptions",(e=>{const t=e.colorFillAlter,n=e.fontSizeSM*e.lineHeightSM,r=e.colorText,a=`${e.paddingXS}px ${e.padding}px`,s=`${e.padding}px ${e.paddingLG}px`,i=`${e.paddingSM}px ${e.paddingLG}px`,o=e.padding,l=e.marginXS,u=e.marginXXS/2,c=G(e,{descriptionsBg:t,descriptionsTitleMarginBottom:n,descriptionsExtraColor:r,descriptionItemPaddingBottom:o,descriptionsSmallPadding:a,descriptionsDefaultPadding:s,descriptionsMiddlePadding:i,descriptionsItemLabelColonMarginRight:l,descriptionsItemLabelColonMarginLeft:u});return[lt(c)]}));H.any;const ct=j({compatConfig:{MODE:3},name:"ADescriptionsItem",props:{prefixCls:String,label:H.any,labelStyle:{type:Object,default:void 0},contentStyle:{type:Object,default:void 0},span:{type:Number,default:1}},setup(e,t){let{slots:n}=t;return()=>{var e;return null===(e=n.default)||void 0===e?void 0:e.call(n)}}}),dt={xxxl:3,xxl:3,xl:3,lg:3,md:3,sm:2,xs:1};function ht(e,t,n){let r=e;return(void 0===n||n>t)&&(r=te(e,{span:t}),ne()),r}const pt=Symbol("descriptionsContext"),ft=j({compatConfig:{MODE:3},name:"ADescriptions",inheritAttrs:!1,props:{prefixCls:String,bordered:{type:Boolean,default:void 0},size:{type:String,default:"default"},title:H.any,extra:H.any,column:{type:[Number,Object],default:()=>dt},layout:String,colon:{type:Boolean,default:void 0},labelStyle:{type:Object,default:void 0},contentStyle:{type:Object,default:void 0}},slots:Object,Item:ct,setup(e,t){let{slots:n,attrs:r}=t;const{prefixCls:a,direction:s}=q("descriptions",e);let i;const o=F({}),[l,u]=ut(a),c=et();Q((()=>{i=c.value.subscribe((t=>{"object"==typeof e.column&&(o.value=t)}))})),X((()=>{c.value.unsubscribe(i)})),Z(pt,{labelStyle:K(e,"labelStyle"),contentStyle:K(e,"contentStyle")});const d=J((()=>function(e,t){if("number"==typeof e)return e;if("object"==typeof e)for(let n=0;n<tt.length;n++){const r=tt[n];if(t[r]&&void 0!==e[r])return e[r]||dt[r]}return 3}(e.column,o.value)));return()=>{var t,i,o;const{size:c,bordered:h=!1,layout:p="horizontal",colon:f=!0,title:m=(null===(t=n.title)||void 0===t?void 0:t.call(n)),extra:g=(null===(i=n.extra)||void 0===i?void 0:i.call(n))}=e,y=function(e,t){const n=ee(e),r=[];let a=[],s=t;return n.forEach(((e,i)=>{var o;const l=null===(o=e.props)||void 0===o?void 0:o.span,u=l||1;if(i===n.length-1)return a.push(ht(e,s,l)),void r.push(a);u<s?(s-=u,a.push(e)):(a.push(ht(e,s,u)),r.push(a),s=t,a=[])})),r}(null===(o=n.default)||void 0===o?void 0:o.call(n),d.value);return l($("div",Y(Y({},r),{},{class:[a.value,{[`${a.value}-${c}`]:"default"!==c,[`${a.value}-bordered`]:!!h,[`${a.value}-rtl`]:"rtl"===s.value},r.class,u.value]}),[(m||g)&&$("div",{class:`${a.value}-header`},[m&&$("div",{class:`${a.value}-title`},[m]),g&&$("div",{class:`${a.value}-extra`},[g])]),$("div",{class:`${a.value}-view`},[$("table",null,[$("tbody",null,[y.map(((e,t)=>$(it,{key:t,index:t,colon:f,prefixCls:a.value,vertical:"vertical"===p,bordered:h,row:e},null)))])])])]))}}});ft.install=function(e){return e.component(ft.name,ft),e.component(ft.Item.name,ft.Item),e};const mt=ft,gt=e=>{const{componentCls:t}=e,n=`${t}-inner`;return{[t]:{[`&${t}-small`]:{minWidth:e.switchMinWidthSM,height:e.switchHeightSM,lineHeight:`${e.switchHeightSM}px`,[`${t}-inner`]:{paddingInlineStart:e.switchInnerMarginMaxSM,paddingInlineEnd:e.switchInnerMarginMinSM,[`${n}-checked`]:{marginInlineStart:`calc(-100% + ${e.switchPinSizeSM+2*e.switchPadding}px - ${2*e.switchInnerMarginMaxSM}px)`,marginInlineEnd:`calc(100% - ${e.switchPinSizeSM+2*e.switchPadding}px + ${2*e.switchInnerMarginMaxSM}px)`},[`${n}-unchecked`]:{marginTop:-e.switchHeightSM,marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:e.switchPinSizeSM,height:e.switchPinSizeSM},[`${t}-loading-icon`]:{top:(e.switchPinSizeSM-e.switchLoadingIconSize)/2,fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:e.switchInnerMarginMinSM,paddingInlineEnd:e.switchInnerMarginMaxSM,[`${n}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${n}-unchecked`]:{marginInlineStart:`calc(100% - ${e.switchPinSizeSM+2*e.switchPadding}px + ${2*e.switchInnerMarginMaxSM}px)`,marginInlineEnd:`calc(-100% + ${e.switchPinSizeSM+2*e.switchPadding}px - ${2*e.switchInnerMarginMaxSM}px)`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${e.switchPinSizeSM+e.switchPadding}px)`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${n}`]:{[`${n}-unchecked`]:{marginInlineStart:e.marginXXS/2,marginInlineEnd:-e.marginXXS/2}},[`&${t}-checked ${n}`]:{[`${n}-checked`]:{marginInlineStart:-e.marginXXS/2,marginInlineEnd:e.marginXXS/2}}}}}}},yt=e=>{const{componentCls:t}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:(e.switchPinSize-e.fontSize)/2,color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},bt=e=>{const{componentCls:t}=e,n=`${t}-handle`;return{[t]:{[n]:{position:"absolute",top:e.switchPadding,insetInlineStart:e.switchPadding,width:e.switchPinSize,height:e.switchPinSize,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:e.colorWhite,borderRadius:e.switchPinSize/2,boxShadow:e.switchHandleShadow,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${n}`]:{insetInlineStart:`calc(100% - ${e.switchPinSize+e.switchPadding}px)`},[`&:not(${t}-disabled):active`]:{[`${n}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${n}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},vt=e=>{const{componentCls:t}=e,n=`${t}-inner`;return{[t]:{[n]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:e.switchInnerMarginMax,paddingInlineEnd:e.switchInnerMarginMin,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${n}-checked, ${n}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none"},[`${n}-checked`]:{marginInlineStart:`calc(-100% + ${e.switchPinSize+2*e.switchPadding}px - ${2*e.switchInnerMarginMax}px)`,marginInlineEnd:`calc(100% - ${e.switchPinSize+2*e.switchPadding}px + ${2*e.switchInnerMarginMax}px)`},[`${n}-unchecked`]:{marginTop:-e.switchHeight,marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${n}`]:{paddingInlineStart:e.switchInnerMarginMin,paddingInlineEnd:e.switchInnerMarginMax,[`${n}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${n}-unchecked`]:{marginInlineStart:`calc(100% - ${e.switchPinSize+2*e.switchPadding}px + ${2*e.switchInnerMarginMax}px)`,marginInlineEnd:`calc(-100% + ${e.switchPinSize+2*e.switchPadding}px - ${2*e.switchInnerMarginMax}px)`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${n}`]:{[`${n}-unchecked`]:{marginInlineStart:2*e.switchPadding,marginInlineEnd:2*-e.switchPadding}},[`&${t}-checked ${n}`]:{[`${n}-checked`]:{marginInlineStart:2*-e.switchPadding,marginInlineEnd:2*e.switchPadding}}}}}},At=e=>{const{componentCls:t}=e;return{[t]:P(P(P(P({},V(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:e.switchMinWidth,height:e.switchHeight,lineHeight:`${e.switchHeight}px`,verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),ae(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},xt=z("Switch",(e=>{const t=e.fontSize*e.lineHeight,n=e.controlHeight/2,r=t-4,a=n-4,s=G(e,{switchMinWidth:2*r+8,switchHeight:t,switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchInnerMarginMin:r/2,switchInnerMarginMax:r+2+4,switchPadding:2,switchPinSize:r,switchBg:e.colorBgContainer,switchMinWidthSM:2*a+4,switchHeightSM:n,switchInnerMarginMinSM:a/2,switchInnerMarginMaxSM:a+2+4,switchPinSizeSM:a,switchHandleShadow:`0 2px 4px 0 ${new re("#00230b").setAlpha(.2).toRgbString()}`,switchLoadingIconSize:.75*e.fontSizeIcon,switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[At(s),vt(s),bt(s),yt(s),gt(s)]})),kt=ie("small","default"),wt=j({compatConfig:{MODE:3},name:"ASwitch",__ANT_SWITCH:!0,inheritAttrs:!1,props:{id:String,prefixCls:String,size:H.oneOf(kt),disabled:{type:Boolean,default:void 0},checkedChildren:H.any,unCheckedChildren:H.any,tabindex:H.oneOfType([H.string,H.number]),autofocus:{type:Boolean,default:void 0},loading:{type:Boolean,default:void 0},checked:H.oneOfType([H.string,H.number,H.looseBool]),checkedValue:H.oneOfType([H.string,H.number,H.looseBool]).def(!0),unCheckedValue:H.oneOfType([H.string,H.number,H.looseBool]).def(!1),onChange:{type:Function},onClick:{type:Function},onKeydown:{type:Function},onMouseup:{type:Function},"onUpdate:checked":{type:Function},onBlur:Function,onFocus:Function},slots:Object,setup(e,t){let{attrs:r,slots:a,expose:s,emit:i}=t;const o=n(),l=oe(),u=J((()=>{var t;return null!==(t=e.disabled)&&void 0!==t?t:l.value}));Q((()=>{ne(),ne()}));const c=F(void 0!==e.checked?e.checked:r.defaultChecked),d=J((()=>c.value===e.checkedValue));le((()=>e.checked),(()=>{c.value=e.checked}));const{prefixCls:h,direction:p,size:f}=q("switch",e),[m,g]=xt(h),y=F(),b=()=>{var e;null===(e=y.value)||void 0===e||e.focus()};s({focus:b,blur:()=>{var e;null===(e=y.value)||void 0===e||e.blur()}}),ue((()=>{ce((()=>{e.autofocus&&!u.value&&y.value.focus()}))}));const v=(e,t)=>{u.value||(i("update:checked",e),i("change",e,t),o.onFieldChange())},A=e=>{i("blur",e)},x=t=>{b();const n=d.value?e.unCheckedValue:e.checkedValue;v(n,t),i("click",n,t)},k=t=>{t.keyCode===fe.LEFT?v(e.unCheckedValue,t):t.keyCode===fe.RIGHT&&v(e.checkedValue,t),i("keydown",t)},w=e=>{var t;null===(t=y.value)||void 0===t||t.blur(),i("mouseup",e)},S=J((()=>({[`${h.value}-small`]:"small"===f.value,[`${h.value}-loading`]:e.loading,[`${h.value}-checked`]:d.value,[`${h.value}-disabled`]:u.value,[h.value]:!0,[`${h.value}-rtl`]:"rtl"===p.value,[g.value]:!0})));return()=>{var t;return m($(pe,null,{default:()=>[$("button",Y(Y(Y({},nt(e,["prefixCls","checkedChildren","unCheckedChildren","checked","autofocus","checkedValue","unCheckedValue","id","onChange","onUpdate:checked"])),r),{},{id:null!==(t=e.id)&&void 0!==t?t:o.id.value,onKeydown:k,onClick:x,onBlur:A,onMouseup:w,type:"button",role:"switch","aria-checked":c.value,disabled:u.value||e.loading,class:[r.class,S.value],ref:y}),[$("div",{class:`${h.value}-handle`},[e.loading?$(de,{class:`${h.value}-loading-icon`},null):null]),$("span",{class:`${h.value}-inner`},[$("span",{class:`${h.value}-inner-checked`},[he(a,e,"checkedChildren")]),$("span",{class:`${h.value}-inner-unchecked`},[he(a,e,"unCheckedChildren")])])])]}))}}}),St=se(wt);const Ct={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1a184.31 184.31 0 00-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9a184.31 184.31 0 00-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8a63 63 0 01-63 63H232a63 63 0 01-63-63c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5.2 13 .7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7a273 273 0 0022.7 49c24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2a281.38 281.38 0 00123.2-149.5A120 120 0 01836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7.4-6.4.7-12.8.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3C584 874.3 548.8 884 512 884s-72-9.7-102.9-27.8c-30.3-17.7-55.6-43-73.3-73.3A202.75 202.75 0 01308 680V412h408v268z"}}]},name:"bug",theme:"outlined"};function It(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Wt(e,t,n[t])}))}return e}function Wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _t=function(e,t){var n=It({},e,t.attrs);return $(me,It({},n,{icon:Ct}),null)};_t.displayName="BugOutlined",_t.inheritAttrs=!1;const Tt=_t;const Nt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM512 533c-85.5 0-155.6 67.3-160 151.6a8 8 0 008 8.4h48.1c4.2 0 7.8-3.2 8.1-7.4C420 636.1 461.5 597 512 597s92.1 39.1 95.8 88.6c.3 4.2 3.9 7.4 8.1 7.4H664a8 8 0 008-8.4C667.6 600.3 597.5 533 512 533z"}}]},name:"frown",theme:"outlined"};function Et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Rt(e,t,n[t])}))}return e}function Rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $t=function(e,t){var n=Et({},e,t.attrs);return $(me,Et({},n,{icon:Nt}),null)};$t.displayName="FrownOutlined",$t.inheritAttrs=!1;const Ot=$t;const Ft={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM664 565H360c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}}]},name:"meh",theme:"outlined"};function Dt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Mt(e,t,n[t])}))}return e}function Mt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Lt=function(e,t){var n=Dt({},e,t.attrs);return $(me,Dt({},n,{icon:Ft}),null)};Lt.displayName="MehOutlined",Lt.inheritAttrs=!1;const Bt=Lt;const Pt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 00-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 00-8-8.4z"}}]},name:"smile",theme:"outlined"};function zt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Gt(e,t,n[t])}))}return e}function Gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vt=function(e,t){var n=zt({},e,t.attrs);return $(me,zt({},n,{icon:Pt}),null)};Vt.displayName="SmileOutlined",Vt.inheritAttrs=!1;const Ut=Vt;const Ht={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M904 747H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM165.7 621.8l39.7 39.5c3.1 3.1 8.2 3.1 11.3 0l234.7-233.9 97.6 97.3a32.11 32.11 0 0045.2 0l264.2-263.2c3.1-3.1 3.1-8.2 0-11.3l-39.7-39.6a8.03 8.03 0 00-11.3 0l-235.7 235-97.7-97.3a32.11 32.11 0 00-45.2 0L165.7 610.5a7.94 7.94 0 000 11.3z"}}]},name:"stock",theme:"outlined"};function jt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){qt(e,t,n[t])}))}return e}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qt=function(e,t){var n=jt({},e,t.attrs);return $(me,jt({},n,{icon:Ht}),null)};Qt.displayName="StockOutlined",Qt.inheritAttrs=!1;const Xt=Qt;var Zt,Kt,Jt={exports:{}},Yt={exports:{}};Zt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kt={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&Kt.rotl(e,8)|4278255360&Kt.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=Kt.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var r=e[n]<<16|e[n+1]<<8|e[n+2],a=0;a<4;a++)8*n+6*a<=8*e.length?t.push(Zt.charAt(r>>>6*(3-a)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,r=0;n<e.length;r=++n%4)0!=r&&t.push((Zt.indexOf(e.charAt(n-1))&Math.pow(2,-2*r+8)-1)<<2*r|Zt.indexOf(e.charAt(n))>>>6-2*r);return t}},Yt.exports=Kt;var en,tn,nn,rn,an,sn=Yt.exports,on={utf8:{stringToBytes:function(e){return on.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(on.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},ln=on,un=function(e){return null!=e&&(cn(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&cn(e.slice(0,0))}(e)||!!e._isBuffer)};function cn(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}en=sn,tn=ln.utf8,nn=un,rn=ln.bin,(an=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?rn.stringToBytes(e):tn.stringToBytes(e):nn(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=en.bytesToWords(e),r=8*e.length,a=1732584193,s=-271733879,i=-1732584194,o=271733878,l=0;l<n.length;l++)n[l]=16711935&(n[l]<<8|n[l]>>>24)|4278255360&(n[l]<<24|n[l]>>>8);n[r>>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var u=an._ff,c=an._gg,d=an._hh,h=an._ii;for(l=0;l<n.length;l+=16){var p=a,f=s,m=i,g=o;a=u(a,s,i,o,n[l+0],7,-680876936),o=u(o,a,s,i,n[l+1],12,-389564586),i=u(i,o,a,s,n[l+2],17,606105819),s=u(s,i,o,a,n[l+3],22,-1044525330),a=u(a,s,i,o,n[l+4],7,-176418897),o=u(o,a,s,i,n[l+5],12,1200080426),i=u(i,o,a,s,n[l+6],17,-1473231341),s=u(s,i,o,a,n[l+7],22,-45705983),a=u(a,s,i,o,n[l+8],7,1770035416),o=u(o,a,s,i,n[l+9],12,-1958414417),i=u(i,o,a,s,n[l+10],17,-42063),s=u(s,i,o,a,n[l+11],22,-1990404162),a=u(a,s,i,o,n[l+12],7,1804603682),o=u(o,a,s,i,n[l+13],12,-40341101),i=u(i,o,a,s,n[l+14],17,-1502002290),a=c(a,s=u(s,i,o,a,n[l+15],22,1236535329),i,o,n[l+1],5,-165796510),o=c(o,a,s,i,n[l+6],9,-1069501632),i=c(i,o,a,s,n[l+11],14,643717713),s=c(s,i,o,a,n[l+0],20,-373897302),a=c(a,s,i,o,n[l+5],5,-701558691),o=c(o,a,s,i,n[l+10],9,38016083),i=c(i,o,a,s,n[l+15],14,-660478335),s=c(s,i,o,a,n[l+4],20,-405537848),a=c(a,s,i,o,n[l+9],5,568446438),o=c(o,a,s,i,n[l+14],9,-1019803690),i=c(i,o,a,s,n[l+3],14,-187363961),s=c(s,i,o,a,n[l+8],20,1163531501),a=c(a,s,i,o,n[l+13],5,-1444681467),o=c(o,a,s,i,n[l+2],9,-51403784),i=c(i,o,a,s,n[l+7],14,1735328473),a=d(a,s=c(s,i,o,a,n[l+12],20,-1926607734),i,o,n[l+5],4,-378558),o=d(o,a,s,i,n[l+8],11,-2022574463),i=d(i,o,a,s,n[l+11],16,1839030562),s=d(s,i,o,a,n[l+14],23,-35309556),a=d(a,s,i,o,n[l+1],4,-1530992060),o=d(o,a,s,i,n[l+4],11,1272893353),i=d(i,o,a,s,n[l+7],16,-155497632),s=d(s,i,o,a,n[l+10],23,-1094730640),a=d(a,s,i,o,n[l+13],4,681279174),o=d(o,a,s,i,n[l+0],11,-358537222),i=d(i,o,a,s,n[l+3],16,-722521979),s=d(s,i,o,a,n[l+6],23,76029189),a=d(a,s,i,o,n[l+9],4,-640364487),o=d(o,a,s,i,n[l+12],11,-421815835),i=d(i,o,a,s,n[l+15],16,530742520),a=h(a,s=d(s,i,o,a,n[l+2],23,-995338651),i,o,n[l+0],6,-198630844),o=h(o,a,s,i,n[l+7],10,1126891415),i=h(i,o,a,s,n[l+14],15,-1416354905),s=h(s,i,o,a,n[l+5],21,-57434055),a=h(a,s,i,o,n[l+12],6,1700485571),o=h(o,a,s,i,n[l+3],10,-1894986606),i=h(i,o,a,s,n[l+10],15,-1051523),s=h(s,i,o,a,n[l+1],21,-2054922799),a=h(a,s,i,o,n[l+8],6,1873313359),o=h(o,a,s,i,n[l+15],10,-30611744),i=h(i,o,a,s,n[l+6],15,-1560198380),s=h(s,i,o,a,n[l+13],21,1309151649),a=h(a,s,i,o,n[l+4],6,-145523070),o=h(o,a,s,i,n[l+11],10,-1120210379),i=h(i,o,a,s,n[l+2],15,718787259),s=h(s,i,o,a,n[l+9],21,-343485551),a=a+p>>>0,s=s+f>>>0,i=i+m>>>0,o=o+g>>>0}return en.endian([a,s,i,o])})._ff=function(e,t,n,r,a,s,i){var o=e+(t&n|~t&r)+(a>>>0)+i;return(o<<s|o>>>32-s)+t},an._gg=function(e,t,n,r,a,s,i){var o=e+(t&r|n&~r)+(a>>>0)+i;return(o<<s|o>>>32-s)+t},an._hh=function(e,t,n,r,a,s,i){var o=e+(t^n^r)+(a>>>0)+i;return(o<<s|o>>>32-s)+t},an._ii=function(e,t,n,r,a,s,i){var o=e+(n^(t|~r))+(a>>>0)+i;return(o<<s|o>>>32-s)+t},an._blocksize=16,an._digestsize=16,Jt.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=en.wordsToBytes(an(e,t));return t&&t.asBytes?n:t&&t.asString?rn.bytesToString(n):en.bytesToHex(n)};const dn=ge(Jt.exports),hn=async e=>{const t=await fn();if(a(t.version,"1.1.1")){const t=r();window.postMessage({type:"uploadImageTo1688",url:e,uuid:t});return await new Promise((e=>{window.addEventListener("message",(function(n){"uploadImageTo1688Success"===n.data.type&&n.data.uuid===t&&e(n.data)})),setTimeout((()=>{e({error_code:3,error_msg:"请求超时"})}),3e4)}))}const n=await gn(e,200);let s=[];const i=await bn({url:"https://www.1688.com"});i.error_code||s.push(...i);let o=await bn({domain:"1688.com",partitionKey:{topLevelSite:"https://1688.com"}});o.error_code||s.push(...o);let l=await bn({domain:"1688.com"});l.error_code||s.push(...l),s=s.reduce(((e,t)=>e.find((e=>e.name===t.name))?e:[...e,t]),[]);const u=s.map((e=>`${e.name}=${e.value}`)).join(";"),c=(await yn({removeRuleIds:[1688],addRules:[{action:{requestHeaders:[{header:"Cookie",operation:"set",value:u}],type:"modifyHeaders"},condition:{regexFilter:"(h5api.m).1688.com/.*(imageservice|shop.data|moduleasyncservice|querydsrratedatav2)",resourceTypes:["xmlhttprequest"]},id:1688}]}),s.find((e=>"_m_h5_tk"===e.name)));if(!c)return{data:{error_code:1,error_message:"没有登录1688"}};const d=c.value.split("_")[0],h=(new Date).getTime(),p=JSON.stringify({imageBase64:n.split(",").pop(),appName:"searchImageUpload",appKey:"pvvljh1grxcmaay2vgpe9nb68gg9ueg2"}),f={method:"POST",url:"https://h5api.m.1688.com/h5/mtop.1688.imageservice.putimage/1.0/",params:{jsv:"2.7.2",appKey:"12574478",t:h,sign:"",api:"mtop.1688.imageService.putImage",ecode:"0",v:"1.0",type:"originaljson",dataType:"jsonp"},credentials:"include",body:`data=${encodeURIComponent(p)}`,mode:"cors",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}},m=dn(`${d}&${h}&${f.params.appKey}&${p}`);return f.params.sign=m.trim(),{data:await mn(f)}},pn=async(e,t,n,a)=>await(async e=>{const t=r();return window.postMessage({type:"temuRequest",uuid:t,params:e}),await new Promise((e=>{window.addEventListener("message",(function(n){"temuRequestSuccess"===n.data.type&&n.data.uuid===t&&e(n.data)})),setTimeout((()=>{e({error_code:3,error_msg:"请求超时"})}),3e4)}))})({url:"https://www.temu.com/api/poppy/v1/search?scene=search",method:"post",cached:!1,body:JSON.stringify({scene:"search",pageSn:10009,listId:a,offset:t,filterItems:"0:1",pageSize:n,query:e,searchMethod:"",sprefix:""}),headers:{"content-type":"application/json"}}),fn=async()=>{const e=r();window.postMessage({type:"getPluginInfo",uuid:e});return await new Promise((t=>{window.addEventListener("message",(function(n){"getPluginInfoSuccess"===n.data.type&&n.data.uuid===e&&t(n.data.data)})),setTimeout((()=>{t({error_code:1,error_msg:"请求超时"})}),3e3)}))},mn=async e=>{const t=r();window.postMessage({type:"httpRequest",uuid:t,params:e});return await new Promise((n=>{window.addEventListener("message",(function(e){"httpRequestSuccess"===e.data.type&&e.data.uuid===t&&n(e.data.data)})),setTimeout((()=>{n({error_code:1,error_msg:"请求超时"})}),e.timeout||1e4)}))},gn=async(e,t)=>{const n=r();window.postMessage({type:"getImageBase64",uuid:n,url:e,maxSize:t});return await new Promise((e=>{window.addEventListener("message",(function(t){"getImageBase64Success"===t.data.type&&t.data.uuid===n&&e(t.data.data)})),setTimeout((()=>{e({error_code:1,error_msg:"请求超时"})}),1e4)}))},yn=async e=>{const t=r();window.postMessage({type:"updateDynamicRules",uuid:t,params:e});return await new Promise((e=>{window.addEventListener("message",(function(n){"updateDynamicRulesSuccess"===n.data.type&&n.data.uuid===t&&e(n.data)})),setTimeout((()=>{e({error_code:1,error_msg:"请求超时"})}),1e4)}))},bn=async e=>{const t=r();window.postMessage({type:"getAllCookie",uuid:t,params:e});return await new Promise((e=>{window.addEventListener("message",(function(n){"getAllCookieSuccess"===n.data.type&&n.data.uuid===t&&e(n.data.data)})),setTimeout((()=>{e({error_code:1,error_msg:"请求超时"})}),1e4)}))},vn={class:"1688-search"},An={class:"filter-wrap"},xn={class:"filter-item"},kn={class:"filter-item"},wn={class:"list-wrap"},Sn=["href"],Cn={class:"info-wrap"},In=["src"],Wn={class:"title"},_n=["innerHTML"],Tn={class:"price-wrap"},Nn={class:"price"},En={class:"prefix"},Rn={key:0,class:"sold"},$n={key:0,class:"mall-wrap"},On=["innerHTML"],Fn=["innerHTML"],Dn={key:0,class:"error-tip"},Mn={class:"left"},Ln={class:"center"},Bn={class:"sub-title"},Pn={class:"right"},zn={href:"https://www.1688.com",target:"_blank"},Gn={key:1,class:"error-tip"},Vn={class:"left"},Un={class:"center"},Hn={class:"sub-title"},jn={class:"right"},qn={key:2,class:"loading-wrap"},Qn={class:"text"},Xn={key:3,style:{padding:"20px"}},Zn={key:4,class:"bottom-tip"},Kn=ye({__name:"ali1688",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading","search"],setup(t,{emit:n}){let a=be();const d=t,h=n,p=F(""),f=F(""),m=F(""),g=F([]),y=F(""),b=F("正在图搜同款"),v=J((()=>m.value?g.value.filter((e=>e.title&&e.title.includes(m.value)||e.location&&e.location.includes(m.value)||e.mall&&e.mall.includes(m.value))):g.value)),A=F(""),x=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),k=e=>{g.value=x([...g.value],e)},w=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)};let S="",C="",I="",W=1;const _=async()=>{S="",C="",I="",W=1,g.value=[],p.value="",await N()&&await E()};let T=!1;const N=async()=>{var e;if("loading"==p.value||"finish"==p.value)return;if(h("update:loading",!0),p.value="loading",b.value="正在图搜同款",S)return!0;let t=await hn(d.imgUrl);if(t.error_code||(null==(e=null==t?void 0:t.data)?void 0:e.error_code))return T?(p.value="error",f.value="1.点击右侧[打开1688],确保可以正常访问1688并已登录1688账号。\n2.VPN会导致图搜功能无法使用,请尝试关闭VPN\n3.请尝试搜索其他图搜渠道(例如1688寻源通)",h("update:loading",!1),!1):(T=!0,await(async()=>{b.value="正在登录1688";const e=document.createElement("iframe");e.sandbox="allow-same-origin allow-scripts allow-popups allow-forms",e.style.display="none",document.body.appendChild(e);const t=["https://www.1688.com/"];for(const n of t)await new Promise((t=>{e.onload=()=>{t()},e.onerror=()=>{t()},setTimeout((()=>{t()}),5e3),e.src=n}));await new Promise((e=>{setTimeout((()=>{e()}),3e3)})),e.parentElement.removeChild(e),p.value="",await N()&&await E()})(),!1);if("FAIL_SYS_TOKEN_EXOIRED::令牌过期"===t.data.ret[0]){if(t=await hn(d.imgUrl),t.data.error_code||"SUCCESS::调用成功"!==t.data.ret[0])return p.value="error",f.value="1.点击右侧[打开1688],确保可以正常访问1688并已登录1688账号。\n2.VPN会导致图搜功能无法使用,请尝试关闭VPN\n3.请尝试搜索其他图搜渠道(例如1688寻源通)",h("update:loading",!1),!1}else if("SUCCESS::调用成功"!==t.data.ret[0])return p.value="error",f.value="1.点击右侧[打开1688],确保可以正常访问1688并已登录1688账号。\n2.VPN会导致图搜功能无法使用,请尝试关闭VPN\n3.请尝试搜索其他图搜渠道(例如1688寻源通)",h("update:loading",!1),!1;return S=t.data.data.imageId,C=t.data.data.requestId,I=t.data.data.sessionId,!0},E=async()=>{let t;if(h("update:loading",!0),p.value="loading",b.value="正在图搜同款",t=await(async(e,t,n,a,s)=>{const i=r();return window.postMessage({type:"searchImageIn1688",imageId:e,requestId:t,sessionId:n,page:a,size:s,uuid:i}),await new Promise((e=>{window.addEventListener("message",(function(t){"searchImageIn1688Success"===t.data.type&&t.data.uuid===i&&e(t.data)})),setTimeout((()=>{e({error_code:3,error_msg:"请求超时"})}),3e4)}))})(S,C,I,W,40),t.error_code&&0!==t.error_code)return p.value="error",f.value="1.点击右侧[打开1688],确保可以正常访问1688并已登录1688账号。\n2.VPN会导致图搜功能无法使用,请尝试关闭VPN\n3.请尝试搜索其他图搜渠道(例如1688寻源通)",void h("update:loading",!1);if(!t.data.data)return p.value="error",f.value="搜索频繁,请稍后再试",void h("update:loading",!1);if(!t.data.data.data.offerList||0===t.data.data.data.offerList.length)return p.value="finish",void h("update:loading",!1);let n=t.data.data.data.offerList.map((e=>({id:e.id,currency:"¥",title:e.information.subject,price:e.tradePrice.offerPrice.priceInfo.price,sold:e.tradeQuantity.saleQuantity,thumb:e.image.imgUrl,url:e.information.detailUrl,mall:e.company.name,tag:null,location:e.company.province+e.company.city.replace(/市$/,"")}))),i=[...n];h("search",{page:W,list:i}),n=x(n,A.value);try{const t=await e.post("/api/v1/union/search-image/1688",n.map((e=>e.id)));for(const e of t.data.data){const t=n.find((t=>t.id.toString()===e.id));t.url=e.url,t.tag="精选货源",n.unshift(t)}}catch(o){}n=n.map((e=>(e.url.includes("kj_agent_plugin")||(e.url=e.url+(e.url.includes("?")?"&":"?")+"kj_agent_plugin=geekbi"),e))),n=n.map(((e,t)=>(e.index=100*W+t,e))),g.value=g.value.concat(n),p.value="success",h("update:loading",!1),a.query.goodsId&&s({trackId:6,type:"search-image-1688",data:{goodsId:a.query.goodsId,page:W,list:i},localInfo:{region:a.query.region||"211"}})},R=async()=>{"visible"===document.visibilityState&&"error"===p.value&&await N()&&await E()},O=()=>{if("loading"==p.value||"finish"==p.value||"error"==p.value)return;const e=document.documentElement.scrollTop||document.body.scrollTop,t=document.documentElement.scrollHeight||document.body.scrollHeight;if(e+(document.documentElement.clientHeight||document.body.clientHeight)>=t-600){W++;try{E()}catch(gQ){p.value="error",f.value="请重新尝试搜索,或稍后再试",h("update:loading",!1)}}};return ue((async()=>{const e=await fn();if(e.error_code)return p.value="install-error",void(f.value="您还没有安装插件,请点击'下载插件'进行安装");y.value=e.version,document.addEventListener("visibilitychange",R),window.addEventListener("scroll",O),await N()&&await E()})),ve((()=>{document.removeEventListener("visibilitychange",R),window.removeEventListener("scroll",O)})),(e,t)=>{const n=i,r=o,a=l,s=Oe,d=Ne,h=Ke,g=Ee("router-link"),y=u,x=Re;return Ae(),xe("div",vn,[ke("div",An,[ke("span",xn,[t[7]||(t[7]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:A.value,"onUpdate:value":t[0]||(t[0]=e=>A.value=e),style:{width:"130px"},onChange:k},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"sold-max-min"},{default:we((()=>t[4]||(t[4]=[Se("销量从高到低")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[5]||(t[5]=[Se("价格从高到低")]))),_:1}),$(n,{value:"sold-min-max"},{default:we((()=>t[6]||(t[6]=[Se("销量从低到高")]))),_:1})])),_:1},8,["value"])]),ke("span",kn,[t[8]||(t[8]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:m.value,"onUpdate:value":t[1]||(t[1]=e=>m.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),ke("div",wn,[(Ae(!0),xe(D,null,Ce(v.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",Cn,[ke("img",{src:e.thumb,class:"thumb"},null,8,In),ke("div",Wn,[e.tag?(Ae(),$e(s,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:w(e.title,m.value)},null,8,_n)]),ke("div",Tn,[ke("span",Nn,[ke("span",En,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",Rn,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",$n,[ke("span",{class:"mall",innerHTML:w(e.mall,m.value)},null,8,On),ke("span",{class:"location",innerHTML:w(e.location,m.value)},null,8,Fn)])):Te("",!0)],8,Sn)))),128))]),"error"===p.value?(Ae(),xe("div",Dn,[ke("div",Mn,[$(Ie(We),{class:"icon"})]),ke("div",Ln,[t[9]||(t[9]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Bn,_e(f.value),1)]),ke("div",Pn,[$(h,null,{default:we((()=>[ke("a",zn,[$(d,{type:"primary"},{default:we((()=>t[10]||(t[10]=[Se(" 打开1688 ")]))),_:1})]),$(d,{onClick:_},{default:we((()=>t[11]||(t[11]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===p.value?(Ae(),xe("div",Gn,[ke("div",Vn,[$(Ie(We),{class:"icon"})]),ke("div",Un,[t[12]||(t[12]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Hn,_e(f.value),1)]),ke("div",jn,[$(h,null,{default:we((()=>[$(g,{target:"_blank",to:"/download"},{default:we((()=>[$(d,{type:"primary"},{default:we((()=>t[13]||(t[13]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===p.value||""===p.value?(Ae(),xe("div",qn,[$(y,{size:"large"}),ke("span",Qn,_e(b.value),1)])):Te("",!0),"success"!==p.value&&"finish"!==p.value||0!==v.value.length?Te("",!0):(Ae(),xe("div",Xn,[$(x,{description:"没有搜索到商品"})])),"finish"===p.value&&v.value.length>0?(Ae(),xe("div",Zn,t[14]||(t[14]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-ee557608"]]);d([h,p,f,m,g]);let Jn=null;const Yn={key:1,class:"empty-tip"};const er=ye({components:{StockOutlined:Xt},props:{offerId:{type:Number,default:0}},data:()=>({emptyTip:!1}),watch:{id(){this.loadData()}},async mounted(){this.loadData()},methods:{async loadData(){const t=await e.get("/api/v1/union/search-image/1688-kuajing/sales-trend",{params:{offerId:this.offerId}});if(0!==t.data.code)return void(this.emptyTip=!0);const n=t.data.data.list;n.length<=1?this.emptyTip=!0:(Jn=y(this.$refs.chart),Jn.setOption({xAxis:{type:"category",data:n.map((e=>Fe(e.date).format("MM-DD")))},grid:{top:20,left:50,right:30,bottom:50},yAxis:{type:"value"},tooltip:{trigger:"axis"},series:[{data:n.map((e=>parseFloat(e.value))),type:"line",smooth:!0,itemStyle:{color:"#fb7701"},areaStyle:{color:new b(0,0,0,1,[{offset:0,color:"rgba(251,119,1,0.8)"},{offset:1,color:"rgba(251,119,1,0.2)"}])}}]}))}}},[["render",function(e,t,n,r,a,s){const i=Ee("stock-outlined");return a.emptyTip?(Ae(),xe("div",Yn,[$(i,{class:"icon"}),t[0]||(t[0]=ke("span",null,"收录中",-1))])):(Ae(),xe("div",{ref:"chart",key:n.offerId,class:"sold-line-chart-wrap"}))}],["__scopeId","data-v-23b065e7"]]),tr={class:"icon-wrap"},nr=ye({__name:"face",props:{value:{type:Number,default:0}},setup(e){const t=e;return(e,n)=>(Ae(),xe("span",tr,[t.value?t.value>=4?(Ae(),$e(Ie(Ut),{key:1,class:"icon green"})):t.value>=3?(Ae(),$e(Ie(Bt),{key:2,class:"icon yellow"})):t.value<3?(Ae(),$e(Ie(Ot),{key:3,class:"icon red"})):Te("",!0):(Ae(),$e(Ie(Bt),{key:0,class:"icon gray"}))]))}},[["__scopeId","data-v-913dac04"]]),rr={class:"1688xunyuantong-search"},ar={class:"filter-wrap"},sr={class:"filter-item"},ir={class:"filter-item"},or={class:"filter-item"},lr={class:"filter-item"},ur={class:"filter-item"},cr={class:"list-wrap"},dr=["href"],hr={class:"info-wrap"},pr=["src"],fr={class:"title"},mr=["innerHTML"],gr={class:"price-wrap"},yr={class:"price"},br={class:"prefix"},vr={key:0,class:"sold"},Ar={key:0,class:"mall-wrap"},xr=["innerHTML"],kr={class:"location"},wr=["innerHTML"],Sr={key:0,class:"error-tip"},Cr={class:"left"},Ir={class:"center"},Wr={class:"sub-title"},_r={class:"right"},Tr={key:1,class:"error-tip"},Nr={class:"left"},Er={class:"center"},Rr={class:"sub-title"},$r={class:"right"},Or={key:2,class:"loading-wrap"},Fr={class:"text"},Dr={key:3,style:{padding:"20px"}},Mr={key:4,class:"bottom-tip"},Lr=ye({__name:"xunyuantong1688",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["search","update:loading"],setup(t,{emit:n}){let r=be();const a=t,l=n,c=F(""),d=F(""),h=F([]),p=F("正在图搜同款"),f=F(0),m=F([{label:"默认排序",sort:{}},{label:"销量从高到低",sort:{monthSold:"desc"}},{label:"复购率从高到低",sort:{rePurchaseRate:"desc"}},{label:"价格从低到高",sort:{price:"asc"}},{label:"销量从低到高",sort:{monthSold:"asc"}},{label:"复购率从低到高",sort:{rePurchaseRate:"asc"}},{label:"价格从高到低",sort:{price:"desc"}}]),g=F(""),y=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)},b=F(null),k=F(null),w=F([]);let S="",C=1;const I=async()=>{C=1,h.value=[],c.value="",await _()},W=async()=>{let t=await gn(a.imgUrl,200);t=t.split(",")[1];const n=await e.post("/api/v1/union/search-image/1688-kuajing/upload-image",E.stringify({base64:t}));return S=n.data.data.imageId,!0},_=async()=>{let t;c.value="loading",p.value="正在图搜同款",l("update:loading",!0);for(let r=0;r<3;r++)try{let n=[];if(b.value&&n.push(b.value),k.value&&n.push(k.value),n=n.concat(w.value),t=await e.post("/api/v1/union/search-image/1688-kuajing",E.stringify({imageId:S,page:C,size:50,sort:JSON.stringify(m.value[f.value].sort),filter:n.join(),keyword:g.value})),t.data.data.list.length>0)break}catch(i){}if(!t)return c.value="error",d.value="请重新尝试搜索,或稍后再试",void l("update:loading",!1);let n=t.data.data.list.map(((e,t)=>({index:t+20*(C-1),id:e.offerId,currency:"¥",title:e.subject,price:e.priceInfo.price,sold:e.monthSold,thumb:e.imageUrl,url:`https://detail.1688.com/offer/${e.offerId}.html`,mall:"1688",tag:null,location:`复购率:${e.repurchaseRate}`,data:e})));l("search",{page:C,list:n});let a=[...n];if(0===n.length)return c.value="finish",void l("update:loading",!1);try{const t=await e.post("/api/v1/union/search-image/1688",n.map((e=>e.id)));for(const e of t.data.data){const t=n.find((t=>t.id.toString()===e.id));t.url=e.url,t.isUnion=!0,n.unshift(t)}}catch(i){}n=n.map((e=>{var t;if(e.url.includes("kj_agent_plugin"))return e;const n=new URLSearchParams;return n.append("kj_agent_plugin","geekbi"),(null==(t=null==e?void 0:e.data)?void 0:t.token)&&n.append("token",e.data.token),e.url=e.url+(e.url.includes("?")?"&":"?")+n.toString(),e})),h.value=h.value.concat(n),c.value="success",l("update:loading",!1),r.query.goodsId&&s({trackId:6,type:"search-image-1688",data:{goodsId:r.query.goodsId,page:C,list:a},localInfo:{region:r.query.region||"211"}})},T=async()=>{"visible"===document.visibilityState&&"error"===c.value&&await W()&&await _()},N=()=>{if("loading"==c.value||"finish"==c.value||"error"==c.value)return;const e=document.documentElement.scrollTop||document.body.scrollTop,t=document.documentElement.scrollHeight||document.body.scrollHeight;if(e+(document.documentElement.clientHeight||document.body.clientHeight)>=t-600){C++;try{_()}catch(gQ){c.value="error",d.value="请重新尝试搜索,或稍后再试",l("update:loading",!1)}}};return ue((async()=>{if((await fn()).error_code)return c.value="install-error",void(d.value="您还没有安装插件,请点击'下载插件'进行安装");document.addEventListener("visibilitychange",T),window.addEventListener("scroll",N),await W()&&await _()})),ve((()=>{document.removeEventListener("visibilitychange",T),window.removeEventListener("scroll",N)})),(e,t)=>{const n=i,r=o,a=A,s=Me,l=Ne,S=Oe,C=ct,W=mt,_=Qe,T=Ke,N=Ee("router-link"),E=u,R=Re;return Ae(),xe("div",rr,[ke("div",ar,[ke("span",sr,[t[5]||(t[5]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:f.value,"onUpdate:value":t[0]||(t[0]=e=>f.value=e),"dropdown-match-select-width":140,onChange:I},{default:we((()=>[(Ae(!0),xe(D,null,Ce(m.value,((e,t)=>(Ae(),$e(n,{key:t,value:t},{default:we((()=>[Se(_e(e.label),1)])),_:2},1032,["value"])))),128))])),_:1},8,["value"])]),ke("span",ir,[t[6]||(t[6]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:g.value,"onUpdate:value":t[1]||(t[1]=e=>g.value=e),placeholder:"在结果中筛选关键词",style:{width:"200px"},onSearch:I},null,8,["value"])]),$(s,{type:"vertical",style:{"margin-left":"20px"}}),ke("span",or,[$(r,{value:b.value,"onUpdate:value":t[2]||(t[2]=e=>b.value=e),"dropdown-match-select-width":150,placeholder:"综合体验分","allow-clear":!0},{default:we((()=>[$(n,{value:"totalEpScoreLv1"},{default:we((()=>t[7]||(t[7]=[Se("综合体验分:5分")]))),_:1}),$(n,{value:"totalEpScoreLv2"},{default:we((()=>t[8]||(t[8]=[Se("综合体验分:≥4.5分")]))),_:1}),$(n,{value:"totalEpScoreLv3"},{default:we((()=>t[9]||(t[9]=[Se("综合体验分:≥4分")]))),_:1}),$(n,{value:"totalEpScoreLv4"},{default:we((()=>t[10]||(t[10]=[Se("综合体验分:>4分")]))),_:1})])),_:1},8,["value"])]),ke("span",lr,[$(r,{value:k.value,"onUpdate:value":t[3]||(t[3]=e=>k.value=e),"dropdown-match-select-width":165,placeholder:"24/48小时揽收率","allow-clear":!0},{default:we((()=>[$(n,{value:"getRate24HLv3"},{default:we((()=>t[11]||(t[11]=[Se("24小时揽收率:≥99%")]))),_:1}),$(n,{value:"getRate24HLv2"},{default:we((()=>t[12]||(t[12]=[Se("24小时揽收率:≥95%")]))),_:1}),$(n,{value:"getRate24HLv1"},{default:we((()=>t[13]||(t[13]=[Se("24小时揽收率:<95%")]))),_:1}),$(n,{value:"getRate48HLv3"},{default:we((()=>t[14]||(t[14]=[Se("48小时揽收率:≥99%")]))),_:1}),$(n,{value:"getRate48HLv2"},{default:we((()=>t[15]||(t[15]=[Se("48小时揽收率:≥95%")]))),_:1}),$(n,{value:"getRate48HLv1"},{default:we((()=>t[16]||(t[16]=[Se("48小时揽收率:<95%")]))),_:1})])),_:1},8,["value"])]),ke("span",ur,[$(r,{value:w.value,"onUpdate:value":t[4]||(t[4]=e=>w.value=e),mode:"multiple","dropdown-match-select-width":140,style:{"min-width":"120px","max-width":"300px"},placeholder:"包邮/发货时效","max-tag-count":2,"allow-clear":!0},{default:we((()=>[$(n,{value:"certifiedFactory"},{default:we((()=>t[17]||(t[17]=[Se("认证工厂")]))),_:1}),$(n,{value:"shipInToday"},{default:we((()=>t[18]||(t[18]=[Se("当日发货")]))),_:1}),$(n,{value:"shipIn24Hours"},{default:we((()=>t[19]||(t[19]=[Se("24小时发货")]))),_:1}),$(n,{value:"shipIn48Hours"},{default:we((()=>t[20]||(t[20]=[Se("48小时发货")]))),_:1}),$(n,{value:"noReason7DReturn"},{default:we((()=>t[21]||(t[21]=[Se("7天无理由")]))),_:1}),$(n,{value:"isOnePsale"},{default:we((()=>t[22]||(t[22]=[Se("支持一件代发")]))),_:1}),$(n,{value:"isOnePsaleFreePost"},{default:we((()=>t[23]||(t[23]=[Se("支持包邮")]))),_:1})])),_:1},8,["value"])]),$(s,{type:"vertical",style:{"margin-left":"10px"}}),$(l,{icon:De(Ie(v)),onClick:I},{default:we((()=>t[24]||(t[24]=[Se(" 搜索 ")]))),_:1},8,["icon"])]),ke("div",cr,[(Ae(!0),xe(D,null,Ce(h.value,((e,n)=>(Ae(),xe("a",{key:e.url+n,target:"_blank",href:e.url,class:"list-item"},[ke("div",hr,[ke("img",{src:e.thumb,class:"thumb"},null,8,pr),ke("div",fr,[e.isUnion?(Ae(),$e(S,{key:0,color:"orange"},{default:we((()=>t[25]||(t[25]=[Se("精选货源")]))),_:1})):e.data.isJxhy?(Ae(),$e(S,{key:1,color:"orange"},{default:we((()=>t[26]||(t[26]=[Se("精选货源")]))),_:1})):Te("",!0),ke("span",{innerHTML:y(e.title,g.value)},null,8,mr)]),ke("div",gr,[ke("span",yr,[ke("span",br,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",vr,"已售出 "+_e(Ie(x)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",Ar,[ke("span",{class:"mall",innerHTML:y(e.mall,g.value)},null,8,xr),ke("span",kr,[$(_,{placement:"right",title:"日销量走势 / 店铺评价"},{content:we((()=>[$(er,{"offer-id":e.id},null,8,["offer-id"]),$(W,{size:"small",bordered:""},{default:we((()=>[$(C,{label:"综合服务",style:{"font-weight":"bold"}},{default:we((()=>[$(nr,{value:parseFloat(e.data.sellerDataInfo.compositeServiceScore)},null,8,["value"]),ke("span",null,_e(e.data.sellerDataInfo.compositeServiceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"客服评价"},{default:we((()=>[$(nr,{value:parseFloat(e.data.sellerDataInfo.consultingExperienceScore)},null,8,["value"]),ke("span",null,_e(e.data.sellerDataInfo.consultingExperienceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"售后体验"},{default:we((()=>[$(nr,{value:parseFloat(e.data.sellerDataInfo.afterSalesExperienceScore)},null,8,["value"]),ke("span",null,_e(e.data.sellerDataInfo.afterSalesExperienceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"商品品质"},{default:we((()=>[$(nr,{value:parseFloat(e.data.sellerDataInfo.offerExperienceScore)},null,8,["value"]),ke("span",null,_e(e.data.sellerDataInfo.offerExperienceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"纠纷处理"},{default:we((()=>[$(nr,{value:parseFloat(e.data.sellerDataInfo.disputeComplaintScore)},null,8,["value"]),ke("span",null,_e(e.data.sellerDataInfo.disputeComplaintScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"物流时效"},{default:we((()=>[$(nr,{value:parseFloat(e.data.sellerDataInfo.logisticsExperienceScore)},null,8,["value"]),ke("span",null,_e(e.data.sellerDataInfo.logisticsExperienceScore||"-")+" 分",1)])),_:2},1024)])),_:2},1024)])),default:we((()=>[ke("span",null,[ke("span",{innerHTML:y(e.location,g.value)},null,8,wr),$(Ie(Le),{class:"icon"})])])),_:2},1024)])])):Te("",!0)],8,dr)))),128))]),"error"===c.value?(Ae(),xe("div",Sr,[ke("div",Cr,[$(Ie(We),{class:"icon"})]),ke("div",Ir,[t[27]||(t[27]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Wr,_e(d.value),1)]),ke("div",_r,[$(T,null,{default:we((()=>[$(l,{onClick:I},{default:we((()=>t[28]||(t[28]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===c.value?(Ae(),xe("div",Tr,[ke("div",Nr,[$(Ie(We),{class:"icon"})]),ke("div",Er,[t[29]||(t[29]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Rr,_e(d.value),1)]),ke("div",$r,[$(T,null,{default:we((()=>[$(N,{target:"_blank",to:"/download"},{default:we((()=>[$(l,{type:"primary"},{default:we((()=>t[30]||(t[30]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===c.value||""===c.value?(Ae(),xe("div",Or,[$(E,{size:"large"}),ke("span",Fr,_e(p.value),1)])):Te("",!0),"success"!==c.value&&"finish"!==c.value||0!==h.value.length?Te("",!0):(Ae(),xe("div",Dr,[$(R,{description:"没有搜索到商品"})])),"finish"===c.value&&h.value.length>0?(Ae(),xe("div",Mr,t[31]||(t[31]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-32c7583c"]]),Br={class:"1688xunyuantong-search"},Pr={class:"filter-wrap"},zr={class:"filter-item"},Gr={class:"filter-item"},Vr={class:"list-wrap"},Ur=["href"],Hr={class:"info-wrap"},jr=["src"],qr={class:"title"},Qr=["innerHTML"],Xr={class:"price-wrap"},Zr={class:"price"},Kr={class:"prefix"},Jr={key:0,class:"sold"},Yr={key:0,class:"mall-wrap"},ea=["innerHTML"],ta=["innerHTML"],na={key:0,class:"error-tip"},ra={class:"left"},aa={class:"center"},sa={class:"sub-title"},ia={class:"right"},oa={key:1,class:"error-tip"},la={class:"left"},ua={class:"center"},ca={class:"sub-title"},da={class:"right"},ha={key:2,class:"loading-wrap"},pa={class:"text"},fa={key:3,style:{padding:"20px"}},ma={key:4,class:"bottom-tip"},ga=ye({__name:"fenxiao1688",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(t,{emit:n}){let r=be();const a=t,s=n,d=F(""),h=F(""),p=F(""),f=F([]),m=F("正在图搜同款"),g=J((()=>p.value?f.value.filter((e=>e.title&&e.title.includes(p.value)||e.location&&e.location.includes(p.value)||e.mall&&e.mall.includes(p.value))):f.value)),y=F(""),b=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),v=e=>{f.value=b([...f.value],e)},A=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)};let x="";const w=async()=>{x=1,f.value=[],d.value="",await S()&&await C()},S=async()=>{if("loading"==d.value||"finish"==d.value)return;s("update:loading",!0),d.value="loading",m.value="正在图搜同款";const t=await fetch(a.imgUrl).then((e=>e.blob())).then((e=>new File([e],"image.jpg",{type:"image/jpeg"}))),n=new FormData;n.append("file",await k(t));const r=await e.post("/api/v1/goods/upload-image",n);return x=r.data.data.url,!0},C=async()=>{s("update:loading",!0),d.value="loading",m.value="正在图搜同款";const t=new FormData;t.append("url",x),r.query.goodsId&&t.append("goodsId",r.query.goodsId);let n=(await e.post("/api/v1/union/search-image/1688-image",t)).data.data.map(((e,t)=>({index:t,id:e.offerId,currency:"¥",title:e.subject,price:e.oldPrice/100,sold:null,thumb:e.imageUrl,url:e.detailUrl,mall:"1688",tag:null,location:e.province+e.city.replace(/市$/,"")})));if(0===n.length)return d.value="finish",void s("update:loading",!1);try{const t=await e.post("/api/v1/union/search-image/1688",n.map((e=>e.id)));for(const e of t.data.data){const t=n.find((t=>t.id.toString()===e.id));t.url=e.url,t.tag="精选货源",n.unshift(t)}}catch(a){}n=n.map((e=>(e.url.includes("kj_agent_plugin")||(e.url=e.url+(e.url.includes("?")?"&":"?")+"kj_agent_plugin=geekbi"),e))),n=b(n,y.value),f.value=f.value.concat(n),d.value="finish",s("update:loading",!1)},I=async()=>{"visible"===document.visibilityState&&"error"===d.value&&await S()&&await C()};return ue((async()=>{document.addEventListener("visibilitychange",I),await S()&&await C()})),ve((()=>{document.removeEventListener("visibilitychange",I)})),(e,t)=>{const n=i,r=o,a=l,s=Oe,f=Ne,b=Ke,x=Ee("router-link"),k=u,S=Re;return Ae(),xe("div",Br,[ke("div",Pr,[ke("span",zr,[t[5]||(t[5]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:y.value,"onUpdate:value":t[0]||(t[0]=e=>y.value=e),style:{width:"130px"},onChange:v},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[4]||(t[4]=[Se("价格从高到低")]))),_:1})])),_:1},8,["value"])]),ke("span",Gr,[t[6]||(t[6]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:p.value,"onUpdate:value":t[1]||(t[1]=e=>p.value=e),placeholder:"商品标题 / 发货地",style:{width:"200px"}},null,8,["value"])])]),ke("div",Vr,[(Ae(!0),xe(D,null,Ce(g.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",Hr,[ke("img",{src:e.thumb,class:"thumb"},null,8,jr),ke("div",qr,[e.tag?(Ae(),$e(s,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:A(e.title,p.value)},null,8,Qr)]),ke("div",Xr,[ke("span",Zr,[ke("span",Kr,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",Jr,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",Yr,[ke("span",{class:"mall",innerHTML:A(e.mall,p.value)},null,8,ea),ke("span",{class:"location",innerHTML:A(e.location,p.value)},null,8,ta)])):Te("",!0)],8,Ur)))),128))]),"error"===d.value?(Ae(),xe("div",na,[ke("div",ra,[$(Ie(We),{class:"icon"})]),ke("div",aa,[t[7]||(t[7]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",sa,_e(h.value),1)]),ke("div",ia,[$(b,null,{default:we((()=>[$(f,{onClick:w},{default:we((()=>t[8]||(t[8]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===d.value?(Ae(),xe("div",oa,[ke("div",la,[$(Ie(We),{class:"icon"})]),ke("div",ua,[t[9]||(t[9]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",ca,_e(h.value),1)]),ke("div",da,[$(b,null,{default:we((()=>[$(x,{target:"_blank",to:"/download"},{default:we((()=>[$(f,{type:"primary"},{default:we((()=>t[10]||(t[10]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===d.value||""===d.value?(Ae(),xe("div",ha,[$(k,{size:"large"}),ke("span",pa,_e(m.value),1)])):Te("",!0),"success"!==d.value&&"finish"!==d.value||0!==g.value.length?Te("",!0):(Ae(),xe("div",fa,[$(S,{description:"没有搜索到商品"})])),"finish"===d.value&&g.value.length>0?(Ae(),xe("div",ma,t[11]||(t[11]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-b60df303"]]),ya={class:"1688-search"},ba={class:"filter-wrap"},va={class:"filter-item"},Aa={class:"filter-item"},xa={class:"list-wrap"},ka=["href"],wa={class:"info-wrap"},Sa=["src"],Ca={class:"title"},Ia=["innerHTML"],Wa={class:"price-wrap"},_a={class:"price"},Ta={class:"prefix"},Na={key:0,class:"sold"},Ea={key:0,class:"mall-wrap"},Ra=["innerHTML"],$a=["innerHTML"],Oa={key:0,class:"error-tip"},Fa={class:"left"},Da={class:"center"},Ma={class:"sub-title"},La={class:"right"},Ba={href:"https://www.1688.com",target:"_blank"},Pa={key:1,class:"error-tip"},za={class:"left"},Ga={class:"center"},Va={class:"sub-title"},Ua={class:"right"},Ha={key:2,class:"loading-wrap"},ja={class:"text"},qa={key:3,style:{padding:"20px"}},Qa={key:4,class:"bottom-tip"},Xa=ye({__name:"kuajing1688",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(t,{emit:n}){be();const r=t,a=n,s=F(""),d=F(""),h=F(""),p=F([]),f=F(""),m=F("正在图搜同款"),g=J((()=>h.value?p.value.filter((e=>e.title&&e.title.includes(h.value)||e.location&&e.location.includes(h.value)||e.mall&&e.mall.includes(h.value))):p.value)),y=F(""),b=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),v=e=>{p.value=b([...p.value],e)},A=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)},x=async()=>{p.value=[],s.value="",await C()&&await I()};let k="",S=1;const C=async()=>{if("loading"==s.value||"finish"==s.value)return;s.value="loading",m.value="正在图搜同款",a("update:loading",!0);const e=await gn(r.imgUrl,200),t=await mn({method:"GET",url:"https://overseas.1688.com/api/pdt/oss-token",timeout:6e4});if(t.error_code)return s.value="error",a("update:loading",!1),d.value="请重新尝试搜索,或稍后再试",!1;let n=`uploads/${w(32)}`;await mn({method:"POST",credentials:"same-origin",url:"https://overseas.1688.com/pdtimg",contentType:"text",form:{key:n,success_action_status:200,OSSAccessKeyId:t.data.accessId,policy:t.data.policy,signature:t.data.signature,file:{base64:e,filename:"image.png"}}});return k=`https://cbu-pdtimg-fx.1688.com/${n}`,!0},I=async()=>{s.value="loading",m.value="正在图搜同款",a("update:loading",!0);const t=await mn({method:"GET",credentials:"same-origin",url:"https://overseas.1688.com/api/pdt/search-offers",headers:{accept:"application/json, text/plain, */*","content-type":"application/json;charset=UTF-8"},params:{imgUrl:k,region:"",keyword:"",categoryId:"-1",location:"",tags:"",pageNo:S}});if(t.error_code||!1===t.success)return s.value="error",a("update:loading",!1),void("require login"===t.error?d.value="您还没有登录1688,请登录后再试":d.value="请重新尝试搜索,或稍后再试");if(!t.data.offerList||0===t.data.offerList.length)return s.value="finish",void a("update:loading",!1);let n=t.data.offerList.map((e=>({id:e.offerId,currency:"¥",title:e.subject,price:e.price,sold:null,thumb:e.image,url:e.detail,mall:e.companyName,tag:null,location:e.companyAddress})));n=b(n,y.value);try{const t=await e.post("/api/v1/union/search-image/1688",n.map((e=>e.id)));for(const e of t.data.data){const t=n.find((t=>t.id.toString()===e.id));t.url=e.url,t.tag="精选货源",n.unshift(t)}}catch(r){}n=n.map((e=>(e.url.includes("kj_agent_plugin")||(e.url=e.url+(e.url.includes("?")?"&":"?")+"kj_agent_plugin=geekbi"),e))),n=n.map(((e,t)=>(e.index=100*S+t,e))),p.value=p.value.concat(n),s.value="success",a("update:loading",!1)},W=async()=>{"visible"===document.visibilityState&&"error"===s.value&&await C()&&await I()},_=()=>{if("loading"==s.value||"finish"==s.value||"error"==s.value)return;const e=document.documentElement.scrollTop||document.body.scrollTop,t=document.documentElement.scrollHeight||document.body.scrollHeight;if(e+(document.documentElement.clientHeight||document.body.clientHeight)>=t-600){S++;try{I()}catch(gQ){s.value="error",d.value="请重新尝试搜索,或稍后再试",a("update:loading",!1)}}};return ue((async()=>{const e=await fn();if(e.error_code)return s.value="install-error",void(d.value="您还没有安装插件,请点击'下载插件'进行安装");f.value=e.version;const t=await bn({domain:"1688.com"});let n=[];try{let e=await bn({domain:"1688.com",partitionKey:{topLevelSite:"https://1688.com"}});e.error_code||(n=e)}catch(o){}const r=await bn({url:"https://overseas.1688.com",name:"EGG_SESS"});let a=[...t,...n,...r];a=a.reduce(((e,t)=>e.find((e=>e.name===t.name))?e:[...e,t]),[]);const i=a.map((e=>`${e.name}=${e.value}`)).join(";");await yn({removeRuleIds:[1689],addRules:[{action:{requestHeaders:[{header:"Cookie",operation:"set",value:i},{header:"Referer",operation:"set",value:"https://overseas.1688.com/"},{header:"Origin",operation:"set",value:"https://overseas.1688.com"}],type:"modifyHeaders"},condition:{regexFilter:"overseas.1688.com",resourceTypes:["xmlhttprequest"]},id:1689}]}),await C()&&await I(),document.addEventListener("visibilitychange",W),window.addEventListener("scroll",_)})),ve((()=>{document.removeEventListener("visibilitychange",W),window.removeEventListener("scroll",_)})),(e,t)=>{const n=i,r=o,a=l,p=Oe,f=Ne,b=Ke,k=Ee("router-link"),w=u,S=Re;return Ae(),xe("div",ya,[ke("div",ba,[ke("span",va,[t[5]||(t[5]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:y.value,"onUpdate:value":t[0]||(t[0]=e=>y.value=e),style:{width:"130px"},onChange:v},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[4]||(t[4]=[Se("价格从高到低")]))),_:1})])),_:1},8,["value"])]),ke("span",Aa,[t[6]||(t[6]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),ke("div",xa,[(Ae(!0),xe(D,null,Ce(g.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",wa,[ke("img",{src:e.thumb,class:"thumb"},null,8,Sa),ke("div",Ca,[e.tag?(Ae(),$e(p,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:A(e.title,h.value)},null,8,Ia)]),ke("div",Wa,[ke("span",_a,[ke("span",Ta,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",Na,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",Ea,[ke("span",{class:"mall",innerHTML:A(e.mall,h.value)},null,8,Ra),ke("span",{class:"location",innerHTML:A(e.location,h.value)},null,8,$a)])):Te("",!0)],8,ka)))),128))]),"error"===s.value?(Ae(),xe("div",Oa,[ke("div",Fa,[$(Ie(We),{class:"icon"})]),ke("div",Da,[t[7]||(t[7]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Ma,_e(d.value),1)]),ke("div",La,[$(b,null,{default:we((()=>[ke("a",Ba,[$(f,{type:"primary"},{default:we((()=>t[8]||(t[8]=[Se(" 打开1688 ")]))),_:1})]),$(f,{onClick:x},{default:we((()=>t[9]||(t[9]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===s.value?(Ae(),xe("div",Pa,[ke("div",za,[$(Ie(We),{class:"icon"})]),ke("div",Ga,[t[10]||(t[10]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Va,_e(d.value),1)]),ke("div",Ua,[$(b,null,{default:we((()=>[$(k,{target:"_blank",to:"/download"},{default:we((()=>[$(f,{type:"primary"},{default:we((()=>t[11]||(t[11]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===s.value||""===s.value?(Ae(),xe("div",Ha,[$(w,{size:"large"}),ke("span",ja,_e(m.value),1)])):Te("",!0),"success"!==s.value&&"finish"!==s.value||0!==g.value.length?Te("",!0):(Ae(),xe("div",qa,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&g.value.length>0?(Ae(),xe("div",Qa,t[12]||(t[12]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-2489faf1"]]);!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",window.nz=n}([function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==(void 0===n?"undefined":r(n)))throw new TypeError(n+"must be non-object");for(var a in n)s(n,a)&&(e[a]=n[a])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,r,a){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),a);else for(var s=0;s<r;s++)e[a+s]=t[n+s]},flattenChunks:function(e){var t,n,r,a,s,i;for(r=0,t=0,n=e.length;t<n;t++)r+=e[t].length;for(i=new Uint8Array(r),a=0,t=0,n=e.length;t<n;t++)s=e[t],i.set(s,a),a+=s.length;return i}},o={arraySet:function(e,t,n,r,a){for(var s=0;s<r;s++)e[a+s]=t[n+s]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(a)},function(e,t,n){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,n){(function(e){var t,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=n(12),i=n(13).crc32,o=["fSohrCk0cG==","W4FdMmotWRve","W7bJWQ1CW6C=","W5K6bCooW6i=","dSkjW7tdRSoB","jtxcUfRcRq==","ALj2WQRdQG==","W5BdSSkqWOKH","lK07WPDy","f8oSW6VcNrq=","eSowCSkoaa==","d8oGW7BcPIO=","m0FcRCkEtq==","qv3cOuJdVq==","iMG5W5BcVa==","W73dVCo6WPD2","W6VdKmkOWO8w","zueIB8oz","CmkhWP0nW5W=","W7ldLmkSWOfh","W5FdIqdcJSkO","aCkBpmoPyG==","l27dICkgWRK=","s05AWR7cTa==","bttcNhdcUW==","gJldK8kHFW==","W5Sso8oXW4i=","FgC0W7hcNmoqwa==","xmkPhdDl","e14kWRzQ","BNFcVxpdPq==","z1vadK0=","W7yOiCk2WQ0=","qLb7lg0=","t8o6BwhcOq==","gmk6lYD9WPdcHSoQqG==","oqldGmkiCq==","rmo+uKlcSW==","dSoIWOVdQ8kC","iXSUsNu=","W5ipW4S7WRS=","WPtcTvOCtG==","A3CcAmoS","lCotW6lcMba=","iuGzWPLz","WQVdPmoKeSkR","W4ydoCkqWQ4=","jCobW47cNXC=","W4tdJCkNWOCJ","hCo/W7ZcSJ8=","BNuZW6NcMG==","b8kFW6hdN8oN","W4SpoCkXWQK=","cXddOmkDFa==","W63dHSoyWQft","W6ldSmk0WRj4","A2bHWOtcHeeMyq==","f3VcSSk/xG==","qg1u","ftyivga=","DCkhpsfe","WR3cKmo3oMWEw8kK","yev3","W4xdMKSejbm=","W797WOL7W4m=","W6xdOCkKWQXw","gcCUye0=","W7WXkmomb8kT","c8kIesD0","WOTpEW==","ySo3E8oVWPy=","iNyhW5lcNLNcG8kYWQu=","W7JdMSkfWRnD","FfijW5tcHW==","xCokW54Zzq==","W77dUsi=","W5FdHfa6eq==","E1FcQvVdSG==","eZ/dNCo4AG==","CgPmWQZdKa==","A8oLECoJWPS=","oCoSW7VcTJC=","mCoADa==","W7DXuSouDq==","ic3dQCo8ua==","rN3cIa==","W6/dJ8kPWRGQ","W4xdLYlcPmkc","F3JcPvZdLa==","xCk8iHn4","qg15","W5/dL8oOWPr4","hW41C3C=","sSoZzwxcPW==","ywdcUvNdUW==","t0TzWQpdIG==","lv7dJSoIjq==","W5Tzxq==","W6DnWQK=","W5mGaCkFWRC=","W6LmWO5+W6C=","WR7dQmoJa8k+","emkFW4ddOmob","imk8imoNEa==","W4ZdP8kaWPvc","F8k4WO40W4e=","cSoHE8k9cG==","jw4TW5dcSW==","wuJcOKRdTa==","swNcQx/dGG==","aCkSiCoMEq==","W6pdS8owWQTH","WRFdQmonjmkT","cKBdGCkpWOm=","oCoWW4VcPIa=","WQddSSoUjmks","c8kdW5JdM8oE","W7b0AGvl","sCk4WOylW60=","nXNdSmkXvW==","W67dRSkjWOqj","W44EcCohW6O=","W6ddPmkpWRHN","W7tdVIVcOSkR","qg3dVG==","W7Ofcmofda==","WRDmW5VcLq==","CSoRW4W4Aq==","mmo0WP3dVmkj","i8omW6ZcPd8=","CSkaWQyvW4m=","ACkMWQCLW4q=","W5pdOCk0WRv3","W7yDW44SWP8=","WRP8W5dcNmkd","ymkNaID5","cfeTWRT6","W6WdbmkmWO0=","eSo3WQldVCkU","W5flwZrl","WPVcTe4tWQu=","DuCPumok","hLpcKCksqXe=","g3hdUCkoWRu=","sL0sW6JcPW==","lf7dL8oOpG==","w8k4WPWJW7u=","i08mW5dcUW==","kb/dU8klsW==","WOhcMSoW","W5LnfG==","F8kJWQmxW6m=","W5ldU0CDca==","eKRdKmkoWPG=","tmouW60=","gSkrW7JdVSor","WPNcP8oc","DhLAmLW=","sSo0EfdcQq==","W6ygW689WQq=","W6CPimkIWQa=","WRJdLmoynSkY","W5iimCkDWRa=","oMhdN8kPWRHV","eNqQWQHn","bmkakSoHW4u=","W4PxEbvN","WQhcQxSWyW==","xCoKEW==","guBcISk2yG==","nviRW4BcSq==","m3tcVmkXCJ9YWQyXd8kuWQfJW71fWPmnWRj+WR1tW6WbW4PDdCkrkLbDs8ozWR4gySoyv20rWO3dJJpdIh9DWPhcGCoctKFcN8kTW6nHvbLRkg9MeKhdHCoP","W7iZfmolW4q=","p1JdGSk4WPW=","ns3cTuhcMSk6u8kj","q8kmhr5p","lWCxtKW=","pmk+hSoYFG==","bdFdKmkIwa==","WR/cMSoL","csCy","W7BdKCkmWPfO","tCkeWPyXW70=","smkVWRK=","dNFdQSokiq==","W5OyoCoLW5O=","W4RcIZ0xW5hdPCkaWPddO0aoE8oCwXVcSgbVtWbqW6u=","iKNdK8khWRa=","WQtdQCommSkg","W6ddU8k1WQ94","ASoXAMRcHG==","gMhdKCoBna==","eCk5mSoEW6K2v8octbK=","pmo+Fmkfea==","f3y8WPL0Ex4=","oSkmm8oczq==","W7ldK8oWWRnrW6WtqMG0W7/cMxbU","W7uwdmofbG==","A8oqyudcPG==","s8oHt3FcTq==","a8okBCkAdq==","W7mvg3OI","E8kLWR0dW7i=","W78qhKSF","W6XMWRHsW6K=","hCoyzSk7fa==","WQNcKSoHp1S=","oCkaiCocW6i=","bSoEW5ZcVXq=","W5pdVCkHWRj3","eehdNSoGhG==","W4VdTmkhWRO=","W73dMte=","bqBcJelcTG==","WOpcKLXWBa==","W7uRa0OKnwpdRmoq","WO3cKSoHW7C4","WPRcOCofl0i=","BxvOWPhcSa==","hwK0W7tcJq==","BMOjW5lcGq==","cmouWONdUmk8","E8k9WQyjW7NdNa==","WRNcQSoFi0S=","zLTHWPpcUW==","WRPjW7BcLCkB","BLRcLMddLW==","s8kzWOiiW5m=","W40mW4uqWP8=","i13cMCk7Ea==","WQBcLMupWOu=","x8o2xmoD","hCkBcCoLvW==","FmkEWRShW5q=","W58ikmo+W7K=","W4KehmkSWOG=","WQZcLCod","WQtcHgXHCa==","W4ldRbpcSmkY","r8oKW5ukr0e+gW==","dSkjW4FdLCoY","cGa6Ee4=","W69pymoVuW==","WQRcSCo7i0i=","W5RdICoWWQPaW70ode4=","cfiNWODs","W7rzWPr/W4u=","ySkuecz+","W4qsW70WWOq=","W5VdS8kmWPXz","W44jW7W=","pxRcGW==","ye5hngpdUa==","WRRcQfT0va==","WQxcImouW7CY","qLRcJKddTa==","p8o6q8kUdW==","W4nlWRLvW6W=","p3hdQ8kzWOe=","W4eFeCojW5W=","W43dNCoMWRG=","nNCqW7lcQW==","FCoqw3dcUq==","W4BdGSkKWQ8+","rmo8q1/cKW==","D0assmov","f0eQWODU","nJXVfCo5W6VcVIniWPKKcCkpWO0fW63dNI4fWPziiSkWEmowWO12AKqNWQvPyCkMmb8aCConW7ddQCkmxs3cG3xdJuuMW7FdJCoqWQndsmk9WQzzW5mgWP/cUHmx","pCoRymkabCoqta==","i2xdImk+","owFdVSkkWOm=","WPNcK1H+Ca==","W4FdKJxcICkP","W4hdNSkuWO4=","W7Gol8oAW6O=","W61RWRrOW4y=","W7qAn8ksWQK=","WPVcRvWNWOG=","xmoyrwFcQW==","WOz7W4hcRSkB","l1yQW5RcSW==","zvJcQvZdNa==","W4hdPSobWPvy","nWldKCoIvG==","CeTyh3K=","pa/cVexcLG==","cmk0W6JdUSoK","AwSxW5ZcHq==","jIpcKfdcOW==","W5r5WQXpW74=","n8k1mmoHW4G=","xe4JW7FcMW==","hmolw8kViW==","gfutW6hcSG==","hflcVSkzrW==","jZpcRN/cRq==","W7tdV8kF","ig0UW7VcLW==","b03dGCkBWP0=","nYFcPW==","W4ueW6StWP0=","W4BdN8ogWR9D","qe89qCo3","W68dgmkSWR4=","Ae0FsmoD","pSoVECkojG==","W6aplSoBfG==","mq/dR8omya==","amkMiCojW40=","xN5GWPVcJa==","W67dJmk4WQji","fxRcVCk7yG==","fSkLoSoLW7a=","a8oCWPJdP8kt","e8o0WRxdI8kv","ChO3W6NcMa==","awVdPmkGWO0=","nCk0W6pdMCod","W4xdP8kOWO5J","lSowxSk0fW==","js/cPwVcTW==","WOJdRmo9amkt","nsRcULdcUmkH","gCkIW4FdLmoF","DmovW7erzG==","cSoFD8kfeq==","WRVcH8ouW7aC","WPvCW6xcKSkr","W4qRW4arWQW=","WPpcPgjfFW=="];t=o,r=280,function(e){for(;--e;)t.push(t.shift())}(++r);var l=function e(t,n){var r=o[t-=0];void 0===e.dkfVxK&&(e.jRRxCS=function(e,t){for(var n=[],r=0,a=void 0,s="",i="",o=0,l=(e=function(e){for(var t,n,r=String(e).replace(/=+$/,""),a="",s=0,i=0;n=r.charAt(i++);~n&&(t=s%4?64*t+n:n,s++%4)?a+=String.fromCharCode(255&t>>(-2*s&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);return a}(e)).length;o<l;o++)i+="%"+("00"+e.charCodeAt(o).toString(16)).slice(-2);e=decodeURIComponent(i);var u=void 0;for(u=0;u<256;u++)n[u]=u;for(u=0;u<256;u++)r=(r+n[u]+t.charCodeAt(u%t.length))%256,a=n[u],n[u]=n[r],n[r]=a;u=0,r=0;for(var c=0;c<e.length;c++)r=(r+n[u=(u+1)%256])%256,a=n[u],n[u]=n[r],n[r]=a,s+=String.fromCharCode(e.charCodeAt(c)^n[(n[u]+n[r])%256]);return s},e.vDRBih={},e.dkfVxK=!0);var a=e.vDRBih[t];return void 0===a?(void 0===e.EOELbZ&&(e.EOELbZ=!0),r=e.jRRxCS(r,n),e.vDRBih[t]=r):r=a,r},u=l("0x105","T5dY"),c=l("0x143","tnRV"),d=l("0xf3","r6cx"),h=l("0x13e","r6cx"),p=l("0xfc","YD9J"),f=l("0xce","0JIq"),m=l("0xf4","HaX["),g=l("0x6a","bNd#"),y=l("0x121","0]JJ"),b=l("0x126","w(Dq"),v=l("0xf2","iF%V"),A=l("0xc0","86I$"),x=l("0x2a","D@GR"),k=l("0x119","(k)G"),w=l("0xdd","86I$")[d](""),S={"+":"-","/":"_","=":""};function C(e){return e[h](/[+\/=]/g,(function(e){return S[e]}))}var I=("undefined"==typeof window?"undefined":a(window))!==l("0x79","Hof]")&&window[y]?window[y]:parseInt,W={base64:function(e){var t=l,n={};n[t("0x83","4j9@")]=function(e,t){return e*t},n[t("0x18","[wyj")]=function(e,t){return e(t)},n[t("0xb","v7]k")]=function(e,t){return e/t},n[t("0x22","xY%o")]=function(e,t){return e<t},n[t("0x76","j&er")]=function(e,t){return e+t},n[t("0x88","tnRV")]=function(e,t){return e+t},n[t("0xba","HaX[")]=function(e,t){return e>>>t},n[t("0xfd","FlMG")]=function(e,t){return e&t},n[t("0xc3","49kG")]=function(e,t){return e|t},n[t("0x9f","&Wvj")]=function(e,t){return e<<t},n[t("0x3d","4j9@")]=function(e,t){return e<<t},n[t("0x2f","y@5u")]=function(e,t){return e>>>t},n[t("0x140","1YRP")]=function(e,t){return e-t},n[t("0x59","wWU6")]=function(e,t){return e===t},n[t("0x10b","pRbw")]=function(e,t){return e+t},n[t("0x21","xY%o")]=function(e,t){return e&t},n[t("0x33","w(Dq")]=function(e,t){return e<<t},n[t("0x35","EX&9")]=function(e,t){return e+t},n[t("0xea","49kG")]=function(e,t){return e+t},n[t("0x130","0JIq")]=function(e,t){return e(t)};for(var r=n,a=void 0,s=void 0,i=void 0,o="",u=e[A],c=0,d=r[t("0x146","FVER")](r[t("0x30","uDrd")](I,r[t("0x2d","r6cx")](u,3)),3);r[t("0x102","4j9@")](c,d);)a=e[c++],s=e[c++],i=e[c++],o+=r[t("0x62","tnRV")](r[t("0x78","(k)G")](r[t("0x88","tnRV")](w[r[t("0xed","1YRP")](a,2)],w[r[t("0xb4","YD9J")](r[t("0xd1","uDrd")](r[t("0x108","VdBX")](a,4),r[t("0xfe","vqpk")](s,4)),63)]),w[r[t("0xbf","[wyj")](r[t("0x148","Buip")](r[t("0x27","r6cx")](s,2),r[t("0x53","zrWU")](i,6)),63)]),w[r[t("0x29","rib%")](i,63)]);var h=r[t("0x5a","uDrd")](u,d);return r[t("0x124","CCDE")](h,1)?(a=e[c],o+=r[t("0xb3","4j9@")](r[t("0xad","NZM&")](w[r[t("0xa8","YD9J")](a,2)],w[r[t("0x44","YD9J")](r[t("0x116","uDrd")](a,4),63)]),"==")):r[t("0x65","bWtw")](h,2)&&(a=e[c++],s=e[c],o+=r[t("0xe3","Poq&")](r[t("0x107","D@GR")](r[t("0x2b","bWtw")](w[r[t("0x1d","bNd#")](a,2)],w[r[t("0x0","Hof]")](r[t("0xb1","0]JJ")](r[t("0xe","86I$")](a,4),r[t("0x3e","86I$")](s,4)),63)]),w[r[t("0x13b","[wyj")](r[t("0x113","y@5u")](s,2),63)]),"=")),r[t("0x7f","&Wvj")](C,o)},charCode:function(e){var t=l,n={};n[t("0x117","86I$")]=function(e,t){return e<t},n[t("0xd4","FVER")]=function(e,t){return e>=t},n[t("0x81","&NG^")]=function(e,t){return e<=t},n[t("0xa0","Poq&")]=function(e,t){return e|t},n[t("0x6e","Zd5Z")]=function(e,t){return e&t},n[t("0xc6","uzab")]=function(e,t){return e>>t},n[t("0xac","5W0R")]=function(e,t){return e|t},n[t("0x5b","g#sj")]=function(e,t){return e&t},n[t("0x34","vqpk")]=function(e,t){return e>=t},n[t("0x1","&Wvj")]=function(e,t){return e<=t},n[t("0x10d","Hof]")]=function(e,t){return e>>t},n[t("0x127","HaX[")]=function(e,t){return e|t},n[t("0xd6","HaX[")]=function(e,t){return e&t},n[t("0x38","&NG^")]=function(e,t){return e>>t};for(var r=n,a=[],s=0,i=0;r[t("0x117","86I$")](i,e[A]);i+=1){var o=e[v](i);r[t("0x4f","HaX[")](o,0)&&r[t("0xbb","FVER")](o,127)?(a[k](o),s+=1):r[t("0xd","Hof]")](128,80)&&r[t("0x12","1YRP")](o,2047)?(s+=2,a[k](r[t("0xb8","y@5u")](192,r[t("0xdc","Hof]")](31,r[t("0x1f","86I$")](o,6)))),a[k](r[t("0x61","4j9@")](128,r[t("0x2c","0]JJ")](63,o)))):(r[t("0xfb","FlMG")](o,2048)&&r[t("0x2e","0JIq")](o,55295)||r[t("0xd9","g#sj")](o,57344)&&r[t("0x99","Poq&")](o,65535))&&(s+=3,a[k](r[t("0x90","&Wvj")](224,r[t("0x5e","HaX[")](15,r[t("0xd3","rib%")](o,12)))),a[k](r[t("0x11d","FVER")](128,r[t("0x115","YD9J")](63,r[t("0x8b","Zd5Z")](o,6)))),a[k](r[t("0x5","D@GR")](128,r[t("0x91","&NG^")](63,o))))}for(var u=0;r[t("0x4c","EX&9")](u,a[A]);u+=1)a[u]&=255;return r[t("0x16","[wyj")](s,255)?[0,s][x](a):[r[t("0xb7","uDrd")](s,8),r[t("0x36","bWtw")](s,255)][x](a)},es:function(e){var t=l;e||(e="");var n=e[b](0,255),r=[],a=W[t("0x6f","pRbw")](n)[p](2);return r[k](a[A]),r[x](a)},en:function(e){var t=l,n={};n[t("0xbc","xY%o")]=function(e,t){return e(t)},n[t("0x66","FVER")]=function(e,t){return e>t},n[t("0xe2","wWU6")]=function(e,t){return e!==t},n[t("0xf7","Dtn]")]=function(e,t){return e%t},n[t("0xcf","zrWU")]=function(e,t){return e/t},n[t("0x3f","&Wvj")]=function(e,t){return e<t},n[t("0x41","w(Dq")]=function(e,t){return e*t},n[t("0x10f","xY%o")]=function(e,t){return e+t},n[t("0x63","4j9@")]=function(e,t,n){return e(t,n)};var r=n;e||(e=0);var a=r[t("0x23","v7]k")](I,e),s=[];r[t("0xaf","Dtn]")](a,0)?s[k](0):s[k](1);for(var i=Math[t("0x13","D@GR")](a)[g](2)[d](""),o=0;r[t("0xa6","bWtw")](r[t("0x111","pRbw")](i[A],8),0);o+=1)i[m]("0");i=i[u]("");for(var h=Math[c](r[t("0xdf","1YRP")](i[A],8)),p=0;r[t("0x145","vqpk")](p,h);p+=1){var f=i[b](r[t("0xe1","Zd5Z")](p,8),r[t("0x49","bNd#")](r[t("0x31","VdBX")](p,1),8));s[k](r[t("0xf0","Buip")](I,f,2))}var y=s[A];return s[m](y),s},sc:function(e){var t=l,n={};n[t("0x101","iF%V")]=function(e,t){return e>t},e||(e="");var r=n[t("0x25","bWtw")](e[A],255)?e[b](0,255):e;return W[t("0xe0","D@GR")](r)[p](2)},nc:function(e){var t=l,n={};n[t("0xf5","Poq&")]=function(e,t){return e(t)},n[t("0x74","wWU6")]=function(e,t){return e/t},n[t("0x8","D@GR")]=function(e,t,n,r){return e(t,n,r)},n[t("0x24","1YRP")]=function(e,t){return e*t},n[t("0xb6","T5dY")]=function(e,t){return e<t},n[t("0xc4","YD9J")]=function(e,t){return e*t},n[t("0x67","uzab")]=function(e,t){return e+t},n[t("0x9a","5W0R")]=function(e,t,n){return e(t,n)};var r=n;e||(e=0);var a=Math[t("0x93","tM!n")](r[t("0x11c","EX&9")](I,e))[g](2),i=Math[c](r[t("0xa3","1YRP")](a[A],8));a=r[t("0x1b","0I]C")](s,a,r[t("0x42","tnRV")](i,8),"0");for(var o=[],u=0;r[t("0x10c","bNd#")](u,i);u+=1){var d=a[b](r[t("0xc1","1YRP")](u,8),r[t("0x4a","D@GR")](r[t("0x114","&Wvj")](u,1),8));o[k](r[t("0x12a","uDrd")](I,d,2))}return o},va:function(e){var t=l,n={};n[t("0x95","FVER")]=function(e,t){return e(t)},n[t("0x26","5W0R")]=function(e,t,n,r){return e(t,n,r)},n[t("0x13a","Naa&")]=function(e,t){return e*t},n[t("0xa5","rib%")]=function(e,t){return e/t},n[t("0x4e","Zd5Z")]=function(e,t){return e>=t},n[t("0x9e","&Wvj")]=function(e,t){return e-t},n[t("0xa2","rib%")]=function(e,t){return e===t},n[t("0xeb","EX&9")]=function(e,t){return e&t},n[t("0xf8","Buip")]=function(e,t){return e+t},n[t("0x50","&Wvj")]=function(e,t){return e>>>t};var r=n;e||(e=0);for(var a=Math[t("0x94","vqpk")](r[t("0x12b","5W0R")](I,e)),i=a[g](2),o=[],u=(i=r[t("0x98","bWtw")](s,i,r[t("0xe7","T5dY")](Math[c](r[t("0xf9","Buip")](i[A],7)),7),"0"))[A];r[t("0xe4","uzab")](u,0);u-=7){var d=i[b](r[t("0xf1","49kG")](u,7),u);if(r[t("0xe8","YD9J")](r[t("0x123","wWU6")](a,-128),0)){o[k](r[t("0x103","T5dY")]("0",d));break}o[k](r[t("0x11a","Poq&")]("1",d)),a=r[t("0x92","49kG")](a,7)}return o[f]((function(e){return I(e,2)}))},ek:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=l,r={};r[n("0x2","w(Dq")]=function(e,t){return e!==t},r[n("0xca","Zu]D")]=function(e,t){return e===t},r[n("0x57","Naa&")]=n("0xf6","w(Dq"),r[n("0x7e","Zu]D")]=n("0x110","YD9J"),r[n("0x7a","T5dY")]=n("0x75","Dtn]"),r[n("0x128","vqpk")]=function(e,t){return e>t},r[n("0x4","zrWU")]=function(e,t){return e<=t},r[n("0x56","uzab")]=function(e,t){return e+t},r[n("0x141","VdBX")]=function(e,t,n,r){return e(t,n,r)},r[n("0xd2","FVER")]=n("0xda","j&er"),r[n("0x17","FVER")]=function(e,t,n){return e(t,n)},r[n("0x96","vqpk")]=function(e,t){return e-t},r[n("0x11f","VdBX")]=function(e,t){return e>t};var i=r;if(!e)return[];var o=[],u=0;i[n("0x147","WmWP")](t,"")&&(i[n("0x125","pRbw")](Object[n("0x109","FlMG")][g][n("0xb0","y@5u")](t),i[n("0xa4","4j9@")])&&(u=t[A]),i[n("0x39","tnRV")](void 0===t?"undefined":a(t),i[n("0xf","D@GR")])&&(u=(o=W.sc(t))[A]),i[n("0x39","tnRV")](void 0===t?"undefined":a(t),i[n("0x5f","rib%")])&&(u=(o=W.nc(t))[A]));var c=Math[n("0xe5","pRbw")](e)[g](2),d="";d=i[n("0x9d","Hof]")](u,0)&&i[n("0x28","D@GR")](u,7)?i[n("0x6","bWtw")](c,i[n("0x104","49kG")](s,u[g](2),3,"0")):i[n("0xd7","iF%V")](c,i[n("0xab","EX&9")]);var h=[i[n("0x97","rib%")](I,d[p](Math[n("0x12c","uDrd")](i[n("0x15","w(Dq")](d[A],8),0)),2)];return i[n("0x82","(k)G")](u,7)?h[x](W.va(u),o):h[x](o)},ecl:function(e){var t=l,n={};n[t("0x122","bWtw")]=function(e,t){return e<t},n[t("0x131","&Wvj")]=function(e,t,n){return e(t,n)};for(var r=n,a=[],s=e[g](2)[d](""),i=0;r[t("0xd8","tM!n")](s[A],16);i+=1)s[m](0);return s=s[u](""),a[k](r[t("0x19","UcbW")](I,s[b](0,8),2),r[t("0xbe","WmWP")](I,s[b](8,16),2)),a},pbc:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=l,n={};n[t("0x7c","0]JJ")]=function(e,t){return e(t)},n[t("0x20","iF%V")]=function(e,t){return e<t},n[t("0xaa","tnRV")]=function(e,t){return e-t};var r=n,a=[],s=W.nc(r[t("0x43","[wyj")](i,e[h](/\s/g,"")));if(r[t("0xcd","bWtw")](s[A],4))for(var o=0;r[t("0x51","zrWU")](o,r[t("0x3a","HaX[")](4,s[A]));o++)a[k](0);return a[x](s)},gos:function(e,t){var n=l,r={};r[n("0x135","EX&9")]=function(e,t){return e===t},r[n("0x8e","wWU6")]=n("0x136","w(Dq"),r[n("0x85","CCDE")]=n("0x13f","1YRP");var a=r,s=Object[a[n("0x86","0I]C")]](e)[f]((function(t){var r=n;return a[r("0xef","5W0R")](t,a[r("0x9c","r6cx")])||a[r("0xb2","xY%o")](t,"c")?"":t+":"+e[t][g]()+","}))[u]("");return n("0x12e","zrWU")+t+"={"+s+"}"},budget:function(e,t){var n=l,r={};r[n("0x133","vqpk")]=function(e,t){return e===t},r[n("0xd0","Buip")]=function(e,t){return e===t},r[n("0x48","1YRP")]=function(e,t){return e>=t},r[n("0x13c","HaX[")]=function(e,t){return e+t};var a=r;return a[n("0xa","iF%V")](e,64)?64:a[n("0xc2","v7]k")](e,63)?t:a[n("0x46","NZM&")](e,t)?a[n("0x129","Zd5Z")](e,1):e},encode:function(e,t){var n=l,r={};r[n("0x3","0I]C")]=function(e,t){return e<t},r[n("0x132","r6cx")]=n("0x13d","[wyj"),r[n("0x10e","v7]k")]=function(e,t){return e<t},r[n("0x11b","YD9J")]=n("0x71","Zu]D"),r[n("0x4b","uzab")]=function(e,t){return e!==t},r[n("0x7b","v7]k")]=n("0x55","j&er"),r[n("0x137","Hof]")]=n("0x14","uDrd"),r[n("0xc","r6cx")]=function(e,t){return e*t},r[n("0xdb","86I$")]=n("0xd5","1YRP"),r[n("0x45","5W0R")]=n("0xec","WmWP"),r[n("0xa9","uzab")]=function(e,t){return e|t},r[n("0xcb","1YRP")]=function(e,t){return e<<t},r[n("0x1a","Dtn]")]=function(e,t){return e&t},r[n("0x69","T5dY")]=function(e,t){return e-t},r[n("0x5c","[wyj")]=function(e,t){return e>>t},r[n("0x138","Naa&")]=function(e,t){return e-t},r[n("0x40","Hof]")]=function(e,t){return e&t},r[n("0x52","FVER")]=function(e,t){return e>>t},r[n("0x100","pRbw")]=function(e,t){return e-t},r[n("0x68","w(Dq")]=function(e,t){return e(t)},r[n("0x54","Buip")]=function(e,t,n){return e(t,n)},r[n("0x80","0I]C")]=function(e,t,n){return e(t,n)},r[n("0x1c","iF%V")]=function(e,t){return e|t},r[n("0xa1","w(Dq")]=function(e,t){return e<<t},r[n("0x9b","YD9J")]=function(e,t){return e+t},r[n("0x72","vqpk")]=function(e,t){return e+t},r[n("0x6d","wWU6")]=function(e,t){return e+t};for(var s,i,o,u,c=r,d={"_bÇ":e,_bK:0,_bf:function(){var t=n;return e[v](d[t("0x8c","bNd#")]++)}},p={"_ê":[],"_bÌ":-1,"_á":function(e){var t=n;p[t("0x7d","T5dY")]++,p["_ê"][p[t("0xc8","vqpk")]]=e},"_bÝ":function(){var e=n;return _bÝ[e("0x11e","WmWP")]--,c[e("0x8d","w(Dq")](_bÝ[e("0xcc","Naa&")],0)&&(_bÝ[e("0x106","tnRV")]=0),_bÝ["_ê"][_bÝ[e("0xae","bNd#")]]}},f="",m=c[n("0x7","v7]k")],g=0;c[n("0x142","NZM&")](g,m[A]);g++)p["_á"](m[c[n("0xc5","Hof]")]](g));p["_á"]("=");var y=c[n("0x118","WmWP")](void 0===t?"undefined":a(t),c[n("0x6b","86I$")])?Math[c[n("0xb5","YD9J")]](c[n("0x8f","Buip")](Math[c[n("0xbd","tM!n")]](),64)):-1;for(g=0;c[n("0x11","Hof]")](g,e[A]);g=d[n("0x70","&NG^")])for(var b=c[n("0x32","r6cx")][n("0x37","D@GR")]("|"),x=0;;){switch(b[x++]){case"0":i=c[n("0xde","EX&9")](c[n("0x12f","VdBX")](c[n("0x120","NZM&")](p["_ê"][c[n("0x5d","4j9@")](p[n("0x7d","T5dY")],2)],3),4),c[n("0x139","tnRV")](p["_ê"][c[n("0x47","Poq&")](p[n("0x87","v7]k")],1)],4));continue;case"1":u=c[n("0x89","NZM&")](p["_ê"][p[n("0x84","4j9@")]],63);continue;case"2":p["_á"](d[n("0x10","5W0R")]());continue;case"3":s=c[n("0x52","FVER")](p["_ê"][c[n("0xc9","YD9J")](p[n("0xe9","Zd5Z")],2)],2);continue;case"4":c[n("0x3c","UcbW")](isNaN,p["_ê"][c[n("0x64","v7]k")](p[n("0x12d","HaX[")],1)])?o=u=64:c[n("0x73","T5dY")](isNaN,p["_ê"][p[n("0x77","y@5u")]])&&(u=64);continue;case"5":p["_á"](d[n("0xc7","pRbw")]());continue;case"6":c[n("0x8a","&Wvj")](void 0===t?"undefined":a(t),c[n("0x60","FVER")])&&(s=c[n("0xee","rib%")](t,s,y),i=c[n("0x149","y@5u")](t,i,y),o=c[n("0x9","vqpk")](t,o,y),u=c[n("0xff","r6cx")](t,u,y));continue;case"7":o=c[n("0x144","EX&9")](c[n("0xa7","tM!n")](c[n("0x58","xY%o")](p["_ê"][c[n("0xb9","Zd5Z")](p[n("0xe6","D@GR")],1)],15),2),c[n("0xfa","UcbW")](p["_ê"][p[n("0x7d","T5dY")]],6));continue;case"8":f=c[n("0x134","1YRP")](c[n("0x10a","0JIq")](c[n("0x112","bNd#")](c[n("0x3b","4j9@")](f,p["_ê"][s]),p["_ê"][i]),p["_ê"][o]),p["_ê"][u]);continue;case"9":p["_á"](d[n("0x6c","bNd#")]());continue;case"10":p[n("0x87","v7]k")]-=3;continue}break}return c[n("0x1e","T5dY")](f[h](/=/g,""),m[y]||"")}};e[l("0x4d","v7]k")]=W}).call(this,n(1)(e))},function(e,n,r){(function(e){var n,a,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(5),o=r(3),l=r(14),u=["kmkRjCkHyG==","tSkzhCooda==","W5HyfwldN8oaq8kZWRj+fCkwCColW6pdVG==","oNjak8o1","W7ijFCk/zq==","WQeJn8kMW54=","W5TZqxn7W4NcJSo1WR4=","WQfrW7JcOSocW5vs","W74jevDO","WO3dQSkcgJu=","hKrxomoO","jhBcNIrJ","Emo/W53dGq==","rMaLc3i=","hmkKWPXWWQddJmkmWQC3","W75cASo9WRKndmkl","vConW4uZjq==","gmkOnSkozG==","EmkgWP/cMCkJWOib","W6uKbffk","wCkyWRhcR8km","nNFcRYC=","rv0Qd0C3FNlcGSk+WQy=","WQdcObtdVSoVg8oHWPddNW==","W4yRqSkPqq==","WPGeb8kHW50=","mcdcOmomW5xdLGBdQ2lcVeJdMmkWhmkD","eSkQnSkz","WPquomo0sq==","wtVcRmkpW6m=","A8klWPxcL8kd","WP1qWP95WO0=","WRNdQ2zLW7K=","W4CcWOjBWRHvCG==","WR1iW63cOCoBW5LnW7zVxh9r","wLpdO8kqW4JcG8oG","rCoGW7pdJmoW","f8kHmCkkEuq=","cmoJdmoUW7q=","W5XDW6q=","WQpdRKvKW7TRW6eYW7e=","WPFdK8k9cdNcQKeSsa==","WRLKW7/cHmoL","w1mHpNi=","DhyQhuq=","W53dIrP1qa==","W44Zz8k/","W6BdPszHCG==","WQz3W4/cPCoV","CSkOWQngECkPWRNcPmkCW6ZcGCk3W6y=","W5v+wmokWR8=","xNqggwy=","qCorzgxdQCoeW5ZcM1W=","jmkYWObWWQe=","jCovWQq0W5pcVa==","tCoyW6pdKv0=","xv4N","nHO9WOyQW6G=","aCk1WP1aWPC=","W4uVjffacG==","wSoGW5BdGMa=","rCkShCoJ","W5nMr8ojWQ4=","uSk8WOFcQSkK","W4TaW7ldUcW1l8kMWQZcL8ouW5S=","WQ7cQe/dMCoWtbb5qSk3zeKbW5JcS8kL","W6ldGZvkvSk3fx7cJG==","lLb2lCoroGG=","W7CJWOvkWOy=","lfxcNSkJ","s8k6WOhcU8kC","W6VcKmo2hry=","ymozW7q7Aa==","CIX7rdK=","W44RqCk5W5C=","W558rN1t","lHBcOmorW50=","q8oZW5Kf","BaNcUSkzW6v9AcRdKdWe","W4HrW6xdGYK0hSkAWQG=","D1WrcfK=","W5VdRIrhWQtdG2K=","W618C3XL","W5eRjv1xpmoVWQ3dMq==","mwtdISoNW6XgoCoVsa==","W71Yx1PY","W7uLv8k4W5q=","W71QFurt","WORcH3JdUmoj","WRldO3r8W7u=","pf3cJbfW","FCodW5xdT1W=","FmoFy2VdLq==","WRJdRfLVW7TIW7aRW6qdW5O=","WQG/nG==","yCoJW5VdGCohW5qDA8oW","bCoGWQCSwG==","CCoWW7pdPsKhW4ZdG1ZcP8kjuvrd","W5VdSd5uWQldMwpdV8oM","emoNgmoiW5m=","amkKWPf8WPS=","W6OWzSkNEW==","WRKTmmkYW50=","W7SmwSkqW6q=","F8oFzMhdQCod","j1xcTmkGgq==","W6RdNZzBsW==","W4SVp3vao8o+WRZdGW==","W4C3W7JcMdK=","D8oMW6S7qa==","y8olDgxdQCo9W5ZcHvRcRa==","W4qEke5i","gCkRWPTJ","WOOogmk7W4NdIG==","WRJdICkUhtNcVa==","ySoFDMNdVmolW4hcHa==","WP7cGfZdMCoe","wvuPdLGMwMNcLW==","W5vnp1tdSW==","bLzAeCoK","WRFdK8k9cdNcIKeSsmkjWP3dIWhdNmoNx8oeWQW=","WRuKdSkmW4O=","xSkHWQxcMmkc","BqZdSmopW64=","W7uoACk+W7jbW6ijWPu=","mxFdHSo4W40=","W5ailLzq","d2ZcR8kalG==","W7ddRtnkWQJdJM7cR8oqALldNcxdSb8xlmoTW5efDCkdW68kW7NcVgtdKmkhrGWTWPq=","fmk1WRfvWQ8=","nJOjWQqu","DqpcT8kY","WQrbWP1hWOu=","W7hdPGTsWOa=","xv0Nagu=","WO7dK8k9gdtcVvO6vmk4","evxdV8ocW48=","bmoWWPabW7W=","W7LaW77dJsT4gSkuWQ3cMG==","W5vxW4hdJY4=","u8oQW483hG==","W7a5nw1s","W51AhNFdHmorACkMWQu=","cmkXpCkEEv7dLSo6pq==","WQBcVHZdSSo9","WOSueSk/W43dIG==","qCosW67dPmoK","W5GwWPrJWRrwCfHj","W7/dNIvTwSk+h1RcLfGvCq==","W4RdNJjwqq==","sui0oM8=","y8kkWQriCq==","W7z2W43dJXe=","vcFdHSo6W5S=","dLbMkmotkYiCg8o8yCojW61FWQhcKYC1WPJcMSoxBq==","jmotWRa+W43cOSkJaW==","W5uTnvzjoConWQFdMW==","WPiGkmozzCodDmoRva==","AGddJmoPW4S=","W4qqASk2ta==","FxSNcgO=","B8osAwxdTCoEW60=","WRzjW7tcJ8oBW45kW6H6swrkW7m=","WQlcQvJdR8oNtHTDB8k9Fa==","WPO0oCkRW6u=","lvRcMCkZf29ZW5O2WQBcUq==","W5qUW7tcKdRcGmkCs8oZ","WOSXgCkVW4u=","W4SHmKPaomo2WR7dJG==","FGZcVCkT","qh0VkKqwmxRcIW==","bmo7WPu+W44=","W69sogldKq==","WPSGjmo0","awJcJSk8pG==","zmkhpmoojG==","W53dOqnCqG==","xG7cQCkIW4C=","x8k5WO/cL8ki","umohW6hdHSo9","W6VcK8o2","etWLWQGJ","W5/dRsrdWQxdNM7dRSoXFW==","nxdcTdv1","W5eHW7pcNHi=","xIJcTSkqW4K=","WQxcRXpdSmoh","BqxcImkbW6q=","WQmGj8kWW5tdOgeFWR5gW5BdNa==","WQFdQfvVW6vUW4m4W7m=","hmkOlCkSra==","s8kHAcSz","iSo1WOeABmoLW705","WQBcRqldVSoSha==","xCo6W7BdG8oT","DCklWPJcK8ksWPu3W47dKCklW4DWW4Ty","vh0TifW=","CXJcQSkJW6jgAdhdQd0u","jrmSWOij","WO7cRw3dPCod","WQf1W6RcOmoh","WQVcHwhdTmoC","gmkOoSkmF2/dNSo3mHO=","WPOrgSkXW5W=","W5qbWO1gWR1VFKHvfG==","rCo9W5KBzSkoWR3cOvuGW4CUW5TCgq==","v8oRW5ZdN8oh","fCoKWOCFBSo0W5CIW5NcI8kI","W6RcT8owpqK=","p8oyWR8V","W4DBbhNdMq==","q8kLWPbMBG==","beZcTdzw","b2KYtea=","uSktWQ/cNCkz","tmkKWQBcLSk+","nSojiSoFW6BcSsa+W4C=","W7SMzCkOW68=","BmocW4K9CG==","m3SYrMi=","i3/dI8o3","WQxcVb/dR8oMbSo2WOxdNG==","z8oEW6elkG==","W47dSsDcWRu=","W5TUggZdNG==","pe4VsW==","lLP9amofoGide8oTzSosW6jOWQFcKJ0cWOhcK8ovFmkK","W4qNFSk8W4eV","kcVcOmoxW53dLXC=","W5aAWOvB","WObbWRjYWRm=","qCkmWOXaAa==","WRRdOL5L","seOHbv8=","mCozWQu=","WQvoW4KqW4u=","WP8ieSkRW7q=","W55yhwRdNW==","zKeYega=","w2xdOmksW4a=","W5WzWOvB","W7OBrmk6W7O=","eSoWWP0ECmozW7C9W5VcJCkI","u8kgWRbJtG==","vZH7AcG=","auaS","h8oRWQOmya==","W63cT8o8gs0=","WOiClCksW7m=","vmktWQn9vW==","omoxWOCkyW==","W7r6gvhdJW==","W5SfW4hcTY0=","W7yMFCk5zNi=","fmkQWPfIWRJdImkfWRy=","wLFdVCkyW4BcJq==","WQBcOKldQa==","b3NcMYPe","wSkpwGmD","WPjMWQ98","cmkmhCkFqa==","WPzhW63cQW==","mNFcQdbPv8oOF1y=","WQf+W7WqW4O=","tSkTemoU","WRPuW7ZcQa==","yCoZW5C=","uCo6W7xdT2WLW4xdK2O=","W4n8xvP4W47cH8oKWRi=","tmocW48S","aulcNCkufa==","feeT","W4hcLCopbbu=","W6VdPqPrAq==","rSoaW487amolp2FcHCkejmkkucW=","W5ONwmkUW70=","e2D4e8ou","xhOhihO=","W7dcU8o2gZ0=","WPZcGw7dKmov","W5TTqxDPW4xcS8o1WQJdTuNdH8oXWOvNW6m=","h8kLk8km","W5VdTYjiWOpdGM7dPSoLyLFdNcpdSciC","WQKUmSkSW57dPhSeWOe=","WO3cIsBdTCoe","W7yfESkYFa==","smk+AsG/","W6mfW7JcOWu=","uYnUwsm=","CmkGWPxcKCkO","keZdGCohW6e=","W6JcPmoAbru=","ofb+jCovpaGC","W71VeMddQG==","WPNdM0zDW74=","WPflW47cHCok","W7LtDxXU","W7ehW7pcLH0=","W79Pu2bw","efK6sLNdTrfJWRZdPum=","gNGFr34=","W5DPySo9WO8=","WO8LnmokDSojya==","k8kwg8kIEa==","sLKWlKC3vMhcICkKWPddVwuY","WOpcP2NdQSod","qvJdUSki","W6WHWPzRWRu=","nmo8WRaAvG==","W4uIwSkjwG==","j2tdISo+W4bAiCoTBHC1lq==","ba/cTmoUW4e=","W4qMzCk0AMxdR8opu1LXEdlcGSokgSkV","tmkch8o+iG==","nhJdGCo2W6vBlSo6sq==","iSkcWQvLWRm=","tmo0W6pdR0C=","W73dJcnUWOy=","qI5Fqs04uCkyW44=","tSoDW6OgCG==","WOODq8kmWOS=","W4JdQInpWQddIa==","qwOXj14=","nmoyWPuSW50=","umoFW4mQkSoPlgZcNW==","WOxcJ2JdImoh","WPyinSonqq==","W73cOCo6pI4=","D8obW5VdVCoE","WR/dRSkMcJ0=","cSo0aSo2W7dcQsq+W5ldVfO=","W4ThW6tdHa==","mrZcH8o4W5G=","WOzMWRH2WOG=","W5SjF8k0W61k","CJddLSo+W6DgESk0gmkK","W7/cRvO=","ACoqy2/dV8op","DSo9W4BdTmoH","AdVdJCo8","W7uHpxvk","WPxdICk8hI7cMuC/uSkK","W5/dPYju","b1LGi8oi","nCkDWPr5WOq=","cSkqWRDcWOm=","uSovW7hdOCoG","WPWkg8ktW78=","W4ObW7BcKra=","WPnnW5aSW5DrWRO=","W6VcG8o6aJDYWOL+CG==","qCovW7q/ga==","msRcSmoEW4ddMaZdLuRcSuxdPa==","nHmJWOuxW6u3CCkoWPpdPW==","s1NdVmkxW4dcHq==","W6iQW5pcNtm=","W4KAvCktW7C=","qg4Jnwu=","bee/rLpdLbPVWR8=","aSkUWRHEWQy=","WQddUhX7W44=","W4vbaNFdHmoxAq==","s1a3ceW=","pINcUSoCW58=","WOiJemksW6m=","ir06WOOVW54IFSkiWOJdJXhcNCoLFSo3W7yrW6W=","qCoUC1pdOG==","W4tdJqfiWRq=","WOpdUM9zW5K=","nLdcSJLc","WPDhW5dcMSo9","W4mrWPz1WR8=","WPbxWRrvWRa=","W5XyhLtdQq==","W7mMwSkkW4y=","ltFcTSoRW53dNaBdQhFcVK7dUW==","W4Heq8ovWPG=","gCoKWP0A","m3pcSbHw","WQFdQfv4W6nOW4C4","W6zbsSoTWOK=","s17dSSksW47cHCoHqXWin1yTDG==","qg4Ylu4RjN4=","WPqKkCoM","l3BcTcC=","wCkjWOhcMmkA","W7DPBej/","WOixiSkRW6G=","W7ycavnq","WOzpWRr3WOu=","W64wF8kpW7C=","WQfjW7tcQW==","WQeGnSkaW5JdPMC=","W6HLW67dHde=","kCozgCoFW4i=","WRRcOK/dUCoGqbbOAG==","W4eGzmkqW7C=","zZZdImo8W6Dg","WOxcM3pdI8ot","W5uIlLPa","W7PQv3fP","nSkulmk+Da==","WQhcO1W=","WQjhW7RcPCoG","W6WOE8k0W4S=","gMvNbSoH","WQW2eSkGW44=","xCkOrGyi","W4KZF8kY","WQScaCk8W78=","W4WoEmk4W6HcW6qfWOi=","xLmPdG==","W6BdGILn","W6y6WQLJWOi=","WRVcQYBdUmoI","W4ldPaboWQm=","A8kCtbaK","zCoCW5aVBW==","bGy2WOuIW4aZE8ktWP0=","fmoWWQWsW6W=","y1G5nL8=","ighcUcrI","cmkLoCkmF0u=","cCoPWQOkrG==","yCkHWQLbuW==","WOtcPZtdL8o5","mH08","WRTNW7GdW6G=","ifFcKSk6hMrcW6u3","smkZhmoOdW==","qs9o","gmojbCoZW6a=","jxFdKCoY","WRPKWPfnWPi=","EmkUWQ5pzCk5WQ8=","W50zFCk0W7jBW7G=","W5ZdLbTbWQq=","WQ8jj8kSW6a=","WQfZW6OCW616WPS=","mNFcJIDZu8oPBG==","W6y6DSkQAG==","zCkfa8otpq==","WOZcHbFdISo8","F8oWW5RdMSo3W5mqDmoNW7mrttWsFq==","lmoJWPmoW6K=","eSoUWOGsoSkxW6pcQsq=","vheWd28=","WPi8WQlcIwJcLCoduSkIW4NcMW==","W5P8v3f4W5q=","b8o2pCoZW4y=","W4DZtgi=","i0ZcN8k6hG==","WRhcVJpdMCoZ","lCkWdSk4rG==","W7NdIJPJxq==","WQD5W6uHW6O=","i8ogWRi6W4VcTCkvfdv3W4CqiCoNWRtdPa==","c8kLpmkgqW==","ECkCrdG/WQH8","smo8W5mA","W4PAW4hdQZe=","W5VdOZjlWOm=","hSkKWOz+WQpdImolWQeRWPtdPa==","cfFcH8k1aW==","EmkAWQ5+FW==","A8kTWQBcLSki","WPNdLmk6fdhcQW==","l8obn8o2W5dcQYyNW58=","sCkGwIii","sGVcL8kwW74=","CmoEW4qQmG==","W488zq==","WOarfCkkW43dKgRdHSoGsKK=","lhFdLq==","kCktWOHtWRe=","rv0TguC7vwe=","nx/dImo2W5bgiCoYxq==","W4f3W4BdRJq=","WRRcP0BdL8or","n1ddJmo8W7y=","WQnRW7RcM8o6","W4pcTSodgbu=","sCoZW5qkz8koWPBcO3uIW5y=","v8kXfSoUaqDtgSoW","WRGimSkuW5G=","pSoxWQuuW4JcVSkwaYHXW4CqaCo3","hfnzeCoE"];n=u,a=458,function(e){for(;--e;)n.push(n.shift())}(++a);var c=function e(t,n){var r=u[t-=0];void 0===e.GMJOxm&&(e.CPxjpy=function(e,t){for(var n=[],r=0,a=void 0,s="",i="",o=0,l=(e=function(e){for(var t,n,r=String(e).replace(/=+$/,""),a="",s=0,i=0;n=r.charAt(i++);~n&&(t=s%4?64*t+n:n,s++%4)?a+=String.fromCharCode(255&t>>(-2*s&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);return a}(e)).length;o<l;o++)i+="%"+("00"+e.charCodeAt(o).toString(16)).slice(-2);e=decodeURIComponent(i);var u=void 0;for(u=0;u<256;u++)n[u]=u;for(u=0;u<256;u++)r=(r+n[u]+t.charCodeAt(u%t.length))%256,a=n[u],n[u]=n[r],n[r]=a;u=0,r=0;for(var c=0;c<e.length;c++)r=(r+n[u=(u+1)%256])%256,a=n[u],n[u]=n[r],n[r]=a,s+=String.fromCharCode(e.charCodeAt(c)^n[(n[u]+n[r])%256]);return s},e.hpBrye={},e.GMJOxm=!0);var a=e.hpBrye[t];return void 0===a?(void 0===e.HWFFId&&(e.HWFFId=!0),r=e.CPxjpy(r,n),e.hpBrye[t]=r):r=a,r},d=c,h=d("0x19c","TkVw"),p=d("0x1cf","L!wU"),f=d("0xf9","z5r#"),m=d("0xd4","@4!d"),g=d("0x105","tthD"),y=d("0xe8","BF2a"),b=d("0x40","DaKR"),v=d("0x1ac","C93m"),A=d("0xf","z5r#"),x=d("0x1d4","@4!d"),k=d("0x19b","6jvF"),w=d("0x1af","MYA]"),S=d("0xec","q3qv"),C=d("0x153","z5r#"),I=d("0xac","LFuB"),W=d("0x161","BvA1"),_=d("0x112","o(KS"),T=d("0x11c","DaKR"),N=d("0x16c","Etl("),E=d("0x17f","DaKR"),R=d("0x5e","MYA]"),$=d("0x11b","e]q("),O=d("0x148","o(KS"),F=d("0xe9","6Sk%"),D=d("0xde","A3e0"),M=d("0x32","@4!d"),L=d("0x126","LZ%H"),B=d("0x2c","K93i"),P=d("0x92","doJ^"),z=d("0x2f","o6kc"),G=d("0xbe","(*ez"),V=d("0x1c9","G0v!"),U=d("0x42","LFuB"),H=d("0x8e","BF2a"),j=d("0x1a5","LG(*"),q=d("0x168","UGf2"),Q=d("0x1df","O3]W"),X=d("0x4b","Msik"),Z=0,K=void 0,J=void 0,Y=0,ee=[],te=function(){},ne=void 0,re=void 0,ae=void 0,se=void 0,ie=void 0,oe=("undefined"==typeof t?"undefined":s(t))===d("0x34","A3e0")?null:t;if(("undefined"==typeof window?"undefined":s(window))!==d("0x1a8","MYA]"))for(var le=d("0x1dc","kBw(")[d("0xad","A3e0")]("|"),ue=0;;){switch(le[ue++]){case"0":ie=d("0x3f","LZ%H")in ne[$];continue;case"1":ne[d("0xfe","o(KS")];continue;case"2":re=ne[d("0x138","LG(*")];continue;case"3":ne=window;continue;case"4":ae=ne[d("0x122","LZ%H")];continue;case"5":se=ne[d("0x186","@0Zy")];continue}break}var ce=function(){var e=d,t={};t[e("0x1ba","6Sk%")]=function(e,t){return e!==t},t[e("0x6","L!wU")]=e("0x100","Msik"),t[e("0x84","&CF7")]=function(e,t){return e<t},t[e("0x1d7","A3e0")]=function(e,t){return e<t},t[e("0x17","(Vx1")]=function(e,t){return e!==t},t[e("0xf2","o(KS")]=e("0x157","z5r#"),t[e("0xcd","&GiH")]=function(e,t){return e===t},t[e("0x132","doJ^")]=function(e,t){return e===t},t[e("0x1b6","BF2a")]=function(e,t){return e===t},t[e("0x28","@4!d")]=function(e,t){return e===t},t[e("0x9e","e]q(")]=e("0xb2","&GiH"),t[e("0xe1","doJ^")]=function(e,t){return e!==t},t[e("0x179","kBw(")]=e("0xa7","UGf2"),t[e("0xfb","BvA1")]=e("0x7e","KFe4"),t[e("0x184","e]q(")]=function(e,t){return e===t},t[e("0x52","e]q(")]=function(e,t){return e in t},t[e("0x1d","LFuB")]=e("0xda","tthD"),t[e("0x18e","@4!d")]=e("0x1b","ie&M"),t[e("0xbc","(v(m")]=function(e,t){return e>t},t[e("0xcc","#PAT")]=e("0xe","BF2a"),t[e("0x67","Msik")]=function(e,t){return e(t)},t[e("0x93","@0Zy")]=e("0x4e","L!wU"),t[e("0xa","28nx")]=e("0x4","e]q(");var n=t,a=[];n[e("0x134","MYA]")](s(ne[e("0x10f","q3qv")]),n[e("0x1e","#PAT")])||n[e("0xdc","28nx")](s(ne[e("0x8b","(*ez")]),n[e("0x13f","z5r#")])?a[0]=1:a[0]=n[e("0x144","LZ%H")](ne[e("0xe2","XJ3i")],1)||n[e("0x154","^yZA")](ne[e("0x172","Flt$")],1)?1:0,a[1]=n[e("0x139","A3e0")](s(ne[e("0x17e","7)&L")]),n[e("0xa9","BvA1")])||n[e("0x25","C93m")](s(ne[e("0xdd","q3qv")]),n[e("0x9b","C93m")])?1:0,a[2]=n[e("0xc8","ie&M")](s(ne[e("0x8f","Flt$")]),n[e("0x13a","(v(m")])?0:1,a[3]=n[e("0xed","(Vx1")](s(ne[e("0x102","6Sk%")]),n[e("0x9b","C93m")])?0:1,a[4]=n[e("0x11f","28nx")](s(ne[e("0x1bd","28nx")]),n[e("0x114","(Vx1")])?0:1,a[5]=n[e("0x19e","o6kc")](re[e("0x70","C93m")],!0)?1:0,a[6]=n[e("0xce","XJ3i")](s(ne[e("0xbf","LZ%H")]),n[e("0xfd","@0Zy")])&&n[e("0x86","G0v!")](s(ne[e("0xff","#&!l")]),n[e("0x15","z5r#")])?0:1;try{n[e("0x76","tthD")](s(Function[e("0x17b","(Vx1")][f]),n[e("0x103","1PuG")])&&(a[7]=1),n[e("0x109","LG(*")](Function[e("0x71","z5r#")][f][x]()[b](/bind/g,n[e("0x9e","e]q(")]),Error[x]())&&(a[7]=1),n[e("0x1a9","&CF7")](Function[e("0xab","@0Zy")][x][x]()[b](/toString/g,n[e("0x1e1","A3e0")]),Error[x]())&&(a[7]=1)}catch(i){a[7]=0}a[8]=re[e("0x6e","!9fm")]&&n[e("0x113","q3qv")](re[e("0x1d3","iocQ")][U],0)?1:0,a[9]=n[e("0x160","ie&M")](re[e("0x2b","e]q(")],"")?1:0,a[10]=n[e("0x13d","[FuJ")](ne[e("0x11a","(v(m")],n[e("0x156","#PAT")])&&n[e("0x13d","[FuJ")](ne[e("0x141","#&!l")],n[e("0x31","o6kc")])?1:0,a[11]=ne[e("0x99","&CF7")]&&!ne[e("0x51","(*ez")][e("0x11","doJ^")]?1:0,a[12]=n[e("0x96","LG(*")](ne[e("0x8","Flt$")],void 0)?1:0,a[13]=n[e("0x1ad","O3]W")](n[e("0x72","O3]W")],re)?1:0,a[14]=re[n[e("0x1a2","1PuG")]](n[e("0x171","C93m")])?1:0,a[15]=se[e("0x6a","S]Zj")]&&n[e("0xcf","o6kc")](se[e("0xc6","XJ3i")][x]()[p](n[e("0x177","w$A0")]),-1)?1:0;try{a[16]=n[e("0x17c","BvA1")](r(17),n[e("0x7d","q3qv")])?1:0}catch(i){a[16]=0}try{a[17]=n[e("0xcb","G0v!")](ne[$][e("0x14d","doJ^")][x]()[p](n[e("0x91","MYA]")]),-1)?0:1}catch(i){a[17]=0}return a};function de(e,t,n){var r=d,a={};a[r("0x130","Msik")]=function(e,t){return e>t},a[r("0x22","LG(*")]=function(e,t){return e<t},a[r("0x18b","(*ez")]=function(e,t){return e-t},a[r("0x145","O3]W")]=r("0x1dd","O3]W"),a[r("0x5","G0v!")]=function(e,t){return e!==t},a[r("0x111","[FuJ")]=r("0x23","O3]W"),a[r("0xe5","LZ%H")]=function(e,t){return e>t};var i=a,o=t||ne[r("0x106","doJ^")];if(i[r("0x185","tthD")](o[r("0x12","z5r#")],0)){if(e[r("0xb1","&GiH")]&&i[r("0x187","doJ^")](i[r("0xf7","S]Zj")](o[r("0xf5","%ncP")],e[r("0x5d","UGf2")]),15))return;e[r("0x194","^yZA")]=o[r("0x12","z5r#")]}var l={};l[V]=o[i[r("0xf4","o6kc")]].id||"",l[P]=i[r("0x1ae","LFuB")](ae[w](),Z);var u=o[r("0x19a","DaKR")];u&&u[U]?(l[G]=u[0][G],l[z]=u[0][z]):(l[G]=o[G],l[z]=o[z]),i[r("0x174","#&!l")](void 0===n?"undefined":s(n),i[r("0x59","KFe4")])?(e[X][n][q](l),i[r("0x69","^yZA")](e[X][n][U],e[r("0xb0","6Sk%")])&&e[X][n][m]()):(e[X][q](l),i[r("0x10c","DaKR")](e[X][U],e[r("0xba","TkVw")])&&e[X][m]())}function he(e){var t=d,n={};n[t("0x1a3","&CF7")]=function(e,t){return e===t};var r=n,a={};return(ne[$][E]?ne[$][E][y]("; "):[])[t("0x1b8","doJ^")]((function(n){var s=t,i=n[y]("="),o=i[v](1)[g]("="),l=i[0][b](/(%[0-9A-Z]{2})+/g,decodeURIComponent);return o=o[b](/(%[0-9A-Z]{2})+/g,decodeURIComponent),a[l]=o,r[s("0xaa","C93m")](e,l)})),e?a[e]||"":a}function pe(e){if(!e||!e[U])return[];var t=[];return e[j]((function(e){var n=o.sc(e[V]);t=t[H](o.va(e[G]),o.va(e[z]),o.va(e[P]),o.va(n[U]),n)})),t}var fe={};fe[d("0x136","LFuB")]=[],fe[d("0xba","TkVw")]=1,fe[d("0x12a","BvA1")]=function(){var e=d,t={};t[e("0x193","Msik")]=e("0x12f","BvA1"),t[e("0x140","(Vx1")]=e("0x18a","7)&L"),t[e("0x1d2","BF2a")]=e("0x95","Flt$"),t[e("0x1c6","A3e0")]=function(e,t){return e+t};var n=t,r=o[e("0x44","UGf2")](this,n[e("0x19f","O3]W")]),a=o[e("0x1c7","7)&L")](ye,ie?n[e("0xc1","BF2a")]:n[e("0x35","(v(m")]);this.c=o[e("0x1cb","[FuJ")](n[e("0x1a","BF2a")](r,a))},fe[d("0x18","S]Zj")]=function(e){var t=d,n={};n[t("0xb6","Etl(")]=function(e,t,n){return e(t,n)},n[t("0xc","BvA1")](de,this,e)},fe[d("0x3b","o6kc")]=function(){var e=d,t={};t[e("0x75","MYA]")]=function(e,t){return e===t},t[e("0x27","#&!l")]=function(e,t){return e(t)};var n=t;return n[e("0x97","o6kc")](this[X][U],0)?[]:[][H](o.ek(4,this[X]),n[e("0x41","w$A0")](pe,this[X]))[H](this.c)};var me=fe,ge={};ge[d("0xca","TkVw")]=[],ge[d("0xb0","6Sk%")]=1,ge[d("0xc2","G0v!")]=function(e){var t=d,n={};n[t("0x143","tthD")]=function(e,t,n){return e(t,n)},Y++,n[t("0x5c","o6kc")](de,this,e)},ge[d("0xa3","doJ^")]=function(){var e=d,t={};t[e("0x89","kBw(")]=function(e,t){return e===t},t[e("0xf6","Msik")]=function(e,t){return e(t)};var n=t;return n[e("0x1e0","G0v!")](this[X][U],0)?[]:[][H](o.ek(ie?1:2,this[X]),n[e("0x147","O3]W")](pe,this[X]))};var ye=ge,be={};be[d("0x120","1PuG")]=[],be[d("0x88","C93m")]=30,be[d("0x33","doJ^")]=function(e){var t=d,n={};n[t("0x10b","6jvF")]=function(e,t,n,r){return e(t,n,r)},n[t("0x82","(v(m")]=function(e,t,n){return e(t,n)};var r=n;ie?(!this[X][Y]&&(this[X][Y]=[]),r[t("0x15a","!9fm")](de,this,e,Y)):r[t("0xef","@0Zy")](de,this,e)},be[d("0x3","!9fm")]=function(){var e=d,t={};t[e("0xfc","!9fm")]=function(e,t){return e(t)},t[e("0x116","L!wU")]=function(e,t){return e-t},t[e("0x14","MYA]")]=function(e,t){return e>=t},t[e("0x13e","o6kc")]=function(e,t){return e-t},t[e("0x192","@0Zy")]=function(e,t){return e>t},t[e("0x4d","LZ%H")]=function(e,t){return e===t},t[e("0x12b","G0v!")]=function(e,t){return e(t)};var n=t,r=[];if(ie){r=this[X][e("0x1aa","Etl(")]((function(e){return e&&e[U]>0}));for(var a=0,s=n[e("0x115","LG(*")](r[U],1);n[e("0x197","@4!d")](s,0);s--){a+=r[s][U];var i=n[e("0x133","(Vx1")](a,this[e("0x9","%ncP")]);if(n[e("0x57","e]q(")](i,0)&&(r[s]=r[s][v](i)),n[e("0x178","BF2a")](i,0)){r=r[v](s);break}}}else r=this[X];if(n[e("0x108","iocQ")](r[U],0))return[];var l=[][H](o.ek(ie?24:25,r));return ie?r[j]((function(t){var r=e;l=(l=l[H](o.va(t[U])))[H](n[r("0x87","&GiH")](pe,t))})):l=l[H](n[e("0x49","6jvF")](pe,this[X])),l};var ve=be,Ae={};Ae[d("0x1cd","z5r#")]=[],Ae[d("0xb0","6Sk%")]=3,Ae[d("0x7a","tthD")]=function(){var e=d,t={};t[e("0x110","L!wU")]=function(e,t){return e>t},t[e("0x16f","w$A0")]=function(e,t){return e-t};var n=t,r={},a=ne[$][e("0xea","S]Zj")][e("0xb9","C93m")]||ne[$][e("0x5a","#PAT")][e("0x6c","UGf2")];n[e("0x1c0","ie&M")](a,0)&&(r[e("0x45","tthD")]=a,r[P]=n[e("0xdb","LFuB")](ae[w](),Z),this[X][q](r),n[e("0x1d6","#PAT")](this[X][U],this[e("0x129","O3]W")])&&this[X][m]())},Ae[d("0x81","e]q(")]=function(){if(ie&&this[S](),!this[X][U])return[];var e=[][H](o.ek(3,this[X]));return this[X][j]((function(t){var n=c;e=e[H](o.va(t[n("0x15b","[FuJ")]),o.va(t[P]))})),e};var xe=Ae,ke={};ke[d("0x11d","MYA]")]=function(){var e=d,t={};t[e("0xf3","o6kc")]=e("0x17d","^yZA");var n=t;this[X]={},this[X][L]=ne[B][L],this[X][M]=ne[B][M],this.c=o[e("0xd1","(Vx1")](o[e("0x107","ie&M")](this,n[e("0x151","q3qv")]))},ke[d("0x64","(Vx1")]=function(){var e=d,t={};t[e("0x9c","G0v!")]=function(e,t){return e&&t},t[e("0x1cc","%ncP")]=function(e,t){return e>t},t[e("0xf0","L!wU")]=function(e,t){return e===t};var n=t,r=o.ek(7),a=this[X],s=a.href,i=void 0===s?"":s,l=a.port,u=void 0===l?"":l;if(n[e("0x1ab","MYA]")](!i,!u))return[][H](r,this.c);var c=n[e("0x195","K93i")](i[U],128)?i[v](0,128):i,h=o.sc(c);return[][H](r,o.va(h[U]),h,o.va(u[U]),n[e("0x4a","&GiH")](u[U],0)?[]:o.sc(this[X][M]),this.c)};var we=ke,Se={};Se[d("0x125","#PAT")]=function(){this[X]={},this[X][F]=ne[D][F],this[X][O]=ne[D][O]},Se[d("0x1e6","LFuB")]=function(){return[][H](o.ek(8),o.va(this[X][F]),o.va(this[X][O]))};var Ce=Se,Ie={};Ie[d("0x170","Etl(")]=function(){var e=d,t={};t[e("0x142","@0Zy")]=function(e,t){return e+t},t[e("0x190","6Sk%")]=function(e,t){return e*t},t[e("0x1b3","LG(*")]=function(e,t){return e+t};var n=t,r=Math;this[X]=n[e("0x146","kBw(")](ne[k](n[e("0x1e4","iocQ")](r[T](),n[e("0xbd","doJ^")](r[_](2,52),1)[x]()),10),ne[k](n[e("0x1e3","&GiH")](r[T](),n[e("0x1a7","%ncP")](r[_](2,30),1)[x]()),10))+"-"+K},Ie[d("0x64","(Vx1")]=function(){return this[Q](),[][H](o.ek(9,this[X]))};var We=Ie,_e={};_e[d("0x1cd","z5r#")]=[],_e[d("0x19d","@4!d")]=function(){var e=d,t={};t[e("0x30","C93m")]=function(e){return e()};var n=t;this[X]=n[e("0x180","kBw(")](ce)},_e[d("0x2d","BvA1")]=function(){var e=d,t={};t[e("0x131","#&!l")]=function(e,t){return e<t},t[e("0x14a","K93i")]=function(e,t){return e<<t};var n=t;try{this[X][18]=Object[h](ne[$])[e("0x1a4","LZ%H")]((function(t){return ne[$][t]&&ne[$][t][e("0x58","C93m")]}))?1:0}catch(s){this[X][18]=0}for(var r=0,a=0;n[e("0x118","@0Zy")](a,this[X][U]);a++)r+=n[e("0x1b4","28nx")](this[X][a],a);return[][H](o.ek(10),o.va(r))};var Te=_e,Ne={};Ne[d("0x11d","MYA]")]=function(){var e=d;this[X]=o[e("0x55","doJ^")](ne[B][L]?ne[B][L]:"")},Ne[d("0x9a","z5r#")]=function(){return this[X][x]()[U]?[][H](o.ek(11),this[X]):[]};var Ee=Ne,Re={};Re[d("0x62","G0v!")]=function(){var e=d,t={};t[e("0xc9","@0Zy")]=e("0xb7","#&!l");var n=t;this[X]=ne[n[e("0x10e","&CF7")]]?"y":"n"},Re[d("0xd5","kBw(")]=function(){return[][H](o.ek(12,this[X]))};var $e=Re,Oe={};Oe[d("0xee","ie&M")]=function(){var e=d,t={};t[e("0xb3","6jvF")]=e("0x155","(v(m");var n=t;this[X]=ne[n[e("0x1db","doJ^")]]?"y":"n"},Oe[d("0xd7","A3e0")]=function(){return[][H](o.ek(13,this[X]))};var Fe=Oe,De={};De[d("0x1b9","&GiH")]=function(){var e=d,t={};t[e("0x169","^yZA")]=function(e,t){return e-t};var n=t;this[X]=n[e("0x98","Etl(")](ae[w](),J)},De[d("0xe3","7)&L")]=function(){return this[Q](),[][H](o.ek(14,this[X]))};var Me=De,Le={};Le[d("0x1","S]Zj")]=function(){this[X]=re[W]},Le[d("0x159","KFe4")]=function(){return this[X][U]?[][H](o.ek(15,this[X])):[]};var Be=Le,Pe={};Pe[d("0x8d","e]q(")]=function(){var e=d,t={};t[e("0x16","LZ%H")]=function(e){return e()};var n=t;this[X]=n[e("0x54","KFe4")](l)},Pe[d("0x3b","o6kc")]=function(){var e=this,t=d,n={};n[t("0x1a6","UGf2")]=t("0xe0","o6kc"),n[t("0x14c","LFuB")]=t("0x1d8","w$A0");var r=n,a=[],s={};return s[r[t("0x1c1","6jvF")]]=16,s[r[t("0x13b","28nx")]]=17,Object[h](this[X])[j]((function(t){var n=[][H](e[X][t]?o.ek(s[t],e[X][t]):[]);a[q](n)})),a};var ze=Pe,Ge={};Ge[d("0x14f","DaKR")]=function(){var e=d,t={};t[e("0x21","(v(m")]=function(e,t){return e>t};var n=t,r=ne[$][e("0xb8","ie&M")]||"",a=r[p]("?");this[X]=r[v](0,n[e("0xb4","L!wU")](a,-1)?a:r[U])},Ge[d("0x124","iocQ")]=function(){return this[X][U]?[][H](o.ek(18,this[X])):[]};var Ve=Ge,Ue={};Ue[d("0x29","w$A0")]=function(){var e=d,t={};t[e("0x48","doJ^")]=function(e,t){return e(t)},t[e("0x80","%ncP")]=e("0x6b","XJ3i");var n=t;this[X]=n[e("0x2a","6jvF")](he,n[e("0x158","e]q(")])},Ue[d("0x64","(Vx1")]=function(){return this[X][U]?[][H](o.ek(19,this[X])):[]};var He=Ue,je={};je[d("0x1","S]Zj")]=function(){var e=d,t={};t[e("0x149","o(KS")]=function(e,t){return e(t)},t[e("0x166","Flt$")]=e("0x0","28nx");var n=t;this[X]=n[e("0x3c","1PuG")](he,n[e("0x117","q3qv")])},je[d("0x1b0","LZ%H")]=function(){return this[X][U]?[][H](o.ek(20,this[X])):[]};var qe=je,Qe={};Qe[d("0x196","q3qv")]=0,Qe[d("0x16a","1PuG")]=function(){return[][H](o.ek(21,this[X]))};var Xe=Qe,Ze={};Ze[d("0x38","LFuB")]=function(e){this[X]=e},Ze[d("0x182","6jvF")]=function(){return[][H](o.ek(22,this[X]))};var Ke=Ze,Je={};Je[d("0x10d","6Sk%")]=function(){var e=d,t={};t[e("0x36","BF2a")]=function(e,t){return e(t)},t[e("0x1c","#&!l")]=e("0x14b","TkVw");var n=t;this[X]=n[e("0x15f","6jvF")](he,n[e("0xb","XJ3i")])},Je[d("0x79","(*ez")]=function(){return this[X][U]?[][H](o.ek(23,this[X])):[]};var Ye=Je,et={};et[d("0xa0","XJ3i")]=function(){var e=d,t={};t[e("0xeb","w$A0")]=function(e,t){return e>t},t[e("0x1bc","!9fm")]=e("0x15d","Msik"),t[e("0x4f","K93i")]=function(e,t){return e!==t},t[e("0x1c2","@4!d")]=e("0x183","o(KS"),t[e("0x1c4","q3qv")]=function(e,t){return e===t},t[e("0x18d","tthD")]=e("0x9d","!9fm"),t[e("0x94","#&!l")]=function(e,t){return e<t},t[e("0x78","KFe4")]=function(e,t){return e<<t};for(var n=t,r=[ne[e("0x7b","LG(*")]||ne[e("0x1ca","#PAT")]||re[W]&&n[e("0x1b1","Msik")](re[W][p](n[e("0x3d","tthD")]),-1)?1:0,n[e("0x6d","6jvF")]("undefined"==typeof InstallTrigger?"undefined":s(InstallTrigger),n[e("0x1d5","(v(m")])?1:0,/constructor/i[e("0x173","!9fm")](ne[e("0x167","%ncP")])||n[e("0x199","K93i")]((ne[e("0x85","(*ez")]&&ne[e("0x1c3","LFuB")][e("0x137","!9fm")]||"")[x](),n[e("0x74","O3]W")])?1:0,ne[$]&&ne[$][e("0xd9","LG(*")]||ne[e("0x1bf","7)&L")]||ne[e("0x90","(*ez")]?1:0,ne[e("0x15e","!9fm")]&&(ne[e("0x16b","&CF7")][e("0x198","tthD")]||ne[e("0x56","7)&L")][e("0x3e","6Sk%")])?1:0],a=0,i=0;n[e("0x1ce","1PuG")](i,r[U]);i++)a+=n[e("0xd0","w$A0")](r[i],i);this[X]=a},et[d("0x1c5","L!wU")]=function(){return[][H](o.ek(26),o.va(this[X]))};var tt=et;function nt(e){[Ce,Te,Ee,$e,Fe,Be,ze,Ve,He,qe,Ke,Ye,we,tt,me][j]((function(t){t[Q](e)}))}function rt(){var e=d,t={};t[e("0xa1","1PuG")]=e("0x46","Flt$"),t[e("0x73","&CF7")]=e("0xc5","C93m"),t[e("0x1c8","iocQ")]=e("0xd3","!9fm"),t[e("0x20","#&!l")]=e("0x1b7","&CF7"),t[e("0x4c","&GiH")]=e("0x2e","LFuB"),t[e("0x2","UGf2")]=e("0x53","ie&M");var n=t,r=n[e("0xa6","ie&M")],a=n[e("0xb5","UGf2")];ie&&(r=n[e("0x1c8","iocQ")],a=n[e("0x7","o6kc")]),ne[$][R](r,ye,!0),ne[$][R](a,ve,!0),ne[$][R](n[e("0x163","TkVw")],me,!0),!ie&&ne[$][R](n[e("0xd8","XJ3i")],xe,!0)}function at(){Y=0,[ye,ve,me,xe][j]((function(e){e[X]=[]}))}function st(){var e=d,t={};t[e("0x13c","kBw(")]=function(e,t){return e+t};var n=t,r=o[e("0x127","w$A0")](n[e("0xd6","XJ3i")](ce[x](),it[x]()));ee=r[A]((function(e){return String[C](e)}))}function it(){var e,t=d,n={};n[t("0x1d9","ie&M")]=function(e){return e()},n[t("0x1b2","#&!l")]=t("0x68","O3]W"),n[t("0xa2","!9fm")]=function(e,t,n){return e(t,n)},n[t("0x26","Flt$")]=function(e,t){return e<t},n[t("0x43","%ncP")]=t("0x101","^yZA"),n[t("0x6f","O3]W")]=function(e,t){return e===t},n[t("0x13","UGf2")]=function(e,t){return e>t},n[t("0x47","LZ%H")]=function(e,t){return e<=t},n[t("0x104","L!wU")]=function(e,t){return e-t},n[t("0x165","w$A0")]=function(e,t){return e<<t},n[t("0x152","(v(m")]=t("0x60","#&!l"),n[t("0xf8","o(KS")]=function(e,t){return e+t},n[t("0x12e","&GiH")]=t("0x16d","MYA]"),n[t("0x11e","@4!d")]=t("0x16e","(*ez");var r=n;if(!ne)return"";var a=r[t("0x63","o6kc")],s=(e=[])[H].apply(e,[ye[a](),ve[a](),me[a](),xe[a](),we[a](),Ce[a](),We[a](),Te[a](),Ee[a](),$e[a](),Fe[a](),Me[a](),Be[a]()].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(ze[a]()),[Ve[a](),He[a](),qe[a](),Xe[a](),Ke[a](),Ye[a](),tt[a]()]));r[t("0x12d","(Vx1")](setTimeout,(function(){r[t("0x176","e]q(")](at)}),0);for(var l=s[U][x](2)[y](""),u=0;r[t("0x1d1","!9fm")](l[U],16);u+=1)l[r[t("0x162","MYA]")]]("0");l=l[g]("");var c=[];r[t("0x66","[FuJ")](s[U],0)?c[q](0,0):r[t("0x119","kBw(")](s[U],0)&&r[t("0x189","BF2a")](s[U],r[t("0x1a1","C93m")](r[t("0x164","(Vx1")](1,8),1))?c[q](0,s[U]):r[t("0x77","@4!d")](s[U],r[t("0x83","BF2a")](r[t("0x191","1PuG")](1,8),1))&&c[q](ne[k](l[I](0,8),2),ne[k](l[I](8,16),2)),s=[][H]([3],[1,0,0],c,s);var h=i[r[t("0x18f","LZ%H")]](s),p=[][A][t("0x1b5","Msik")](h,(function(e){return String[C](e)}));return r[t("0xf1","@4!d")](r[t("0xe6","MYA]")],o[r[t("0xe4","MYA]")]](r[t("0x61","6Sk%")](p[g](""),ee[g]("")),o[t("0xae","BF2a")]))}function ot(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d,n={};n[t("0x1de","%ncP")]=function(e,t){return e!==t},n[t("0x181","Msik")]=t("0xc3","kBw("),n[t("0x1be","S]Zj")]=t("0x1da","S]Zj"),n[t("0x50","doJ^")]=function(e){return e()},n[t("0x150","6Sk%")]=function(e,t,n){return e(t,n)},n[t("0x5b","K93i")]=function(e){return e()};var r=n;if(r[t("0x3a","XJ3i")](void 0===ne?"undefined":s(ne),r[t("0x9f","7)&L")]))for(var a=r[t("0xd2","7)&L")][t("0x10a","@0Zy")]("|"),i=0;;){switch(a[i++]){case"0":r[t("0x121","LFuB")](rt);continue;case"1":r[t("0x10","e]q(")](nt,Z,ne);continue;case"2":Z=ae[w]();continue;case"3":this[t("0x135","O3]W")](e[N]||879609302220);continue;case"4":r[t("0x65","S]Zj")](st);continue}break}}ot[d("0x19","#PAT")][d("0x1e5","ie&M")]=function(e){J=ae[w](),K=e},ot[d("0xfa","A3e0")][Q]=te,ot[d("0x7c","w$A0")][d("0xe7","LFuB")]=te,ot[d("0xc7","6jvF")][d("0xc0","MYA]")]=function(){var e=d,t={};t[e("0x1e2","LFuB")]=function(e){return e()};var n=t;return Xe[X]++,n[e("0x8a","S]Zj")](it)},ot[d("0x7f","!9fm")][d("0x37","^yZA")]=function(){var e=d,t={};t[e("0x18c","!9fm")]=function(e,t){return e(t)},t[e("0xa8","UGf2")]=function(e){return e()};var n=t;return new Promise((function(t){var r=e;Xe[X]++,n[r("0x15c","S]Zj")](t,n[r("0x1bb","A3e0")](it))}))},oe&&oe[d("0x12c","o(KS")]&&oe[d("0xd","Msik")][d("0x17a","iocQ")]&&(ot[d("0xab","@0Zy")][d("0x24","LZ%H")]=function(e){var t=d,n={};n[t("0xbb","Etl(")]=t("0x188","^yZA"),n[t("0xdf","w$A0")]=t("0xa4","Flt$"),n[t("0xaf","w$A0")]=t("0x5f","&GiH"),n[t("0xc4","BF2a")]=t("0x123","@4!d"),n[t("0x175","e]q(")]=t("0x128","KFe4");var r=n;switch(e.type){case r[t("0x39","TkVw")]:me[S](e);break;case r[t("0x14e","MYA]")]:case r[t("0xa5","z5r#")]:ye[S](e);break;case r[t("0x8c","C93m")]:case r[t("0x1a0","LG(*")]:ve[S](e)}});var lt=new ot;e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e[N]&&ne&&lt.updateServerTime(e[N]),lt}}).call(this,r(1)(e))},function(e,t,n){var r=n(6),a=n(0),s=n(10),i=n(2),o=n(11),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=a.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(i[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(i[n]);this._dict_set=!0}}function c(e,t){var n=new u(t);if(n.push(e,!0),n.err)throw n.msg||i[n.err];return n.result}u.prototype.push=function(e,t){var n,i,o=this.strm,u=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?o.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new a.Buf8(u),o.next_out=0,o.avail_out=u),1!==(n=r.deflate(o,i))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==o.avail_out&&(0!==o.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(s.buf2binstring(a.shrinkBuf(o.output,o.next_out))):this.onData(a.shrinkBuf(o.output,o.next_out)))}while((o.avail_in>0||0===o.avail_out)&&1!==n);return 4===i?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==i||(this.onEnd(0),o.avail_out=0,!0)},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=u,t.deflate=c,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},function(e,t,n){var r,a=n(0),s=n(7),i=n(8),o=n(9),l=n(2),u=-2,c=258,d=262,h=103,p=113,f=666;function m(e,t){return e.msg=l[t],t}function g(e){return(e<<1)-(e>4?9:0)}function y(e){for(var t=e.length;--t>=0;)e[t]=0}function b(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(a.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function v(e,t){s._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,b(e.strm)}function A(e,t){e.pending_buf[e.pending++]=t}function x(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function k(e,t){var n,r,a=e.max_chain_length,s=e.strstart,i=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,u=e.window,h=e.w_mask,p=e.prev,f=e.strstart+c,m=u[s+i-1],g=u[s+i];e.prev_length>=e.good_match&&(a>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(n=t)+i]===g&&u[n+i-1]===m&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do{}while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<f);if(r=c-(f-s),s=f-c,r>i){if(e.match_start=t,i=r,r>=o)break;m=u[s+i-1],g=u[s+i]}}}while((t=p[t&h])>l&&0!=--a);return i<=e.lookahead?i:e.lookahead}function w(e){var t,n,r,s,l,u,c,h,p,f,m=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-d)){a.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=m?r-m:0}while(--n);t=n=m;do{r=e.prev[--t],e.prev[t]=r>=m?r-m:0}while(--n);s+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,h=e.strstart+e.lookahead,p=s,f=void 0,(f=u.avail_in)>p&&(f=p),n=0===f?0:(u.avail_in-=f,a.arraySet(c,u.input,u.next_in,f,h),1===u.state.wrap?u.adler=i(u.adler,c,f,h):2===u.state.wrap&&(u.adler=o(u.adler,c,f,h)),u.next_in+=f,u.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<d&&0!==e.strm.avail_in)}function S(e,t){for(var n,r;;){if(e.lookahead<d){if(w(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-d&&(e.match_length=k(e,n)),e.match_length>=3)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function C(e,t){for(var n,r,a;;){if(e.lookahead<d){if(w(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-d&&(e.match_length=k(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(v(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=s._tr_tally(e,0,e.window[e.strstart-1]))&&v(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function I(e,t,n,r,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=a}function W(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:p,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):m(e,u)}function _(e){var t,n=W(e);return 0===n&&((t=e.state).window_size=2*t.w_size,y(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n}function T(e,t,n,r,s,i){if(!e)return u;var o=1;if(-1===t&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),s<1||s>9||8!==n||r<8||r>15||t<0||t>9||i<0||i>4)return m(e,u);8===r&&(r=9);var l=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(1146),this.dyn_dtree=new a.Buf16(122),this.bl_tree=new a.Buf16(78),y(this.dyn_ltree),y(this.dyn_dtree),y(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(16),this.heap=new a.Buf16(573),y(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(573),y(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return e.state=l,l.strm=e,l.wrap=o,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new a.Buf8(2*l.w_size),l.head=new a.Buf16(l.hash_size),l.prev=new a.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new a.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=i,l.method=n,_(e)}r=[new I(0,0,0,0,(function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(w(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,v(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(v(e,!1),e.strm.avail_out),1)})),new I(4,4,8,4,S),new I(4,5,16,8,S),new I(4,6,32,32,S),new I(4,4,16,16,C),new I(8,16,32,32,C),new I(8,16,128,128,C),new I(8,32,128,256,C),new I(32,128,258,1024,C),new I(32,258,258,4096,C)],t.deflateInit=function(e,t){return T(e,t,8,15,8,0)},t.deflateInit2=T,t.deflateReset=_,t.deflateResetKeep=W,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},t.deflate=function(e,t){var n,a,i,l;if(!e||!e.state||t>5||t<0)return e?m(e,u):u;if(a=e.state,!e.output||!e.input&&0!==e.avail_in||a.status===f&&4!==t)return m(e,0===e.avail_out?-5:u);if(a.strm=e,n=a.last_flush,a.last_flush=t,42===a.status)if(2===a.wrap)e.adler=0,A(a,31),A(a,139),A(a,8),a.gzhead?(A(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),A(a,255&a.gzhead.time),A(a,a.gzhead.time>>8&255),A(a,a.gzhead.time>>16&255),A(a,a.gzhead.time>>24&255),A(a,9===a.level?2:a.strategy>=2||a.level<2?4:0),A(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(A(a,255&a.gzhead.extra.length),A(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=o(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69):(A(a,0),A(a,0),A(a,0),A(a,0),A(a,0),A(a,9===a.level?2:a.strategy>=2||a.level<2?4:0),A(a,3),a.status=p);else{var d=8+(a.w_bits-8<<4)<<8;d|=(a.strategy>=2||a.level<2?0:a.level<6?1:6===a.level?2:3)<<6,0!==a.strstart&&(d|=32),d+=31-d%31,a.status=p,x(a,d),0!==a.strstart&&(x(a,e.adler>>>16),x(a,65535&e.adler)),e.adler=1}if(69===a.status)if(a.gzhead.extra){for(i=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),b(e),i=a.pending,a.pending!==a.pending_buf_size));)A(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=73)}else a.status=73;if(73===a.status)if(a.gzhead.name){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),b(e),i=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,A(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),0===l&&(a.gzindex=0,a.status=91)}else a.status=91;if(91===a.status)if(a.gzhead.comment){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),b(e),i=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,A(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),0===l&&(a.status=h)}else a.status=h;if(a.status===h&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&b(e),a.pending+2<=a.pending_buf_size&&(A(a,255&e.adler),A(a,e.adler>>8&255),e.adler=0,a.status=p)):a.status=p),0!==a.pending){if(b(e),0===e.avail_out)return a.last_flush=-1,0}else if(0===e.avail_in&&g(t)<=g(n)&&4!==t)return m(e,-5);if(a.status===f&&0!==e.avail_in)return m(e,-5);if(0!==e.avail_in||0!==a.lookahead||0!==t&&a.status!==f){var k=2===a.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(w(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(a,t):3===a.strategy?function(e,t){for(var n,r,a,i,o=e.window;;){if(e.lookahead<=c){if(w(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=o[a=e.strstart-1])===o[++a]&&r===o[++a]&&r===o[++a]){i=e.strstart+c;do{}while(r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&a<i);e.match_length=c-(i-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(a,t):r[a.level].func(a,t);if(3!==k&&4!==k||(a.status=f),1===k||3===k)return 0===e.avail_out&&(a.last_flush=-1),0;if(2===k&&(1===t?s._tr_align(a):5!==t&&(s._tr_stored_block(a,0,0,!1),3===t&&(y(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),b(e),0===e.avail_out))return a.last_flush=-1,0}return 4!==t?0:a.wrap<=0?1:(2===a.wrap?(A(a,255&e.adler),A(a,e.adler>>8&255),A(a,e.adler>>16&255),A(a,e.adler>>24&255),A(a,255&e.total_in),A(a,e.total_in>>8&255),A(a,e.total_in>>16&255),A(a,e.total_in>>24&255)):(x(a,e.adler>>>16),x(a,65535&e.adler)),b(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?0:1)},t.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==h&&t!==p&&t!==f?m(e,u):(e.state=null,t===p?m(e,-3):0):u},t.deflateSetDictionary=function(e,t){var n,r,s,o,l,c,d,h,p=t.length;if(!e||!e.state)return u;if(2===(o=(n=e.state).wrap)||1===o&&42!==n.status||n.lookahead)return u;for(1===o&&(e.adler=i(e.adler,t,p,0)),n.wrap=0,p>=n.w_size&&(0===o&&(y(n.head),n.strstart=0,n.block_start=0,n.insert=0),h=new a.Buf8(n.w_size),a.arraySet(h,t,p-n.w_size,n.w_size,0),t=h,p=n.w_size),l=e.avail_in,c=e.next_in,d=e.input,e.avail_in=p,e.next_in=0,e.input=t,w(n);n.lookahead>=3;){r=n.strstart,s=n.lookahead-2;do{n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+3-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++}while(--s);n.strstart=r,n.lookahead=2,w(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=c,e.input=d,e.avail_in=l,n.wrap=o,0},t.deflateInfo="pako deflate (from Nodeca project)"},function(e,t,n){var r=n(0);function a(e){for(var t=e.length;--t>=0;)e[t]=0}var s=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],i=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],l=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],u=new Array(576);a(u);var c=new Array(60);a(c);var d=new Array(512);a(d);var h=new Array(256);a(h);var p=new Array(29);a(p);var f,m,g,y=new Array(30);function b(e,t,n,r,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=a,this.has_stree=e&&e.length}function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function A(e){return e<256?d[e]:d[256+(e>>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,x(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function w(e,t,n){k(e,n[2*t],n[2*t+1])}function S(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function C(e,t,n){var r,a,s=new Array(16),i=0;for(r=1;r<=15;r++)s[r]=i=i+n[r-1]<<1;for(a=0;a<=t;a++){var o=e[2*a+1];0!==o&&(e[2*a]=S(s[o]++,o))}}function I(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function W(e){e.bi_valid>8?x(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function _(e,t,n,r){var a=2*t,s=2*n;return e[a]<e[s]||e[a]===e[s]&&r[t]<=r[n]}function T(e,t,n){for(var r=e.heap[n],a=n<<1;a<=e.heap_len&&(a<e.heap_len&&_(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!_(t,r,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=r}function N(e,t,n){var r,a,o,l,u=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*u]<<8|e.pending_buf[e.d_buf+2*u+1],a=e.pending_buf[e.l_buf+u],u++,0===r?w(e,a,t):(w(e,(o=h[a])+256+1,t),0!==(l=s[o])&&k(e,a-=p[o],l),w(e,o=A(--r),n),0!==(l=i[o])&&k(e,r-=y[o],l))}while(u<e.last_lit);w(e,256,t)}function E(e,t){var n,r,a,s=t.dyn_tree,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,l=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<l;n++)0!==s[2*n]?(e.heap[++e.heap_len]=u=n,e.depth[n]=0):s[2*n+1]=0;for(;e.heap_len<2;)s[2*(a=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[a]=0,e.opt_len--,o&&(e.static_len-=i[2*a+1]);for(t.max_code=u,n=e.heap_len>>1;n>=1;n--)T(e,s,n);a=l;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],T(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,s[2*a]=s[2*n]+s[2*r],e.depth[a]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,s[2*n+1]=s[2*r+1]=a,e.heap[1]=a++,T(e,s,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,a,s,i,o,l=t.dyn_tree,u=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,m=0;for(s=0;s<=15;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(s=l[2*l[2*(r=e.heap[n])+1]+1]+1)>f&&(s=f,m++),l[2*r+1]=s,r>u||(e.bl_count[s]++,i=0,r>=p&&(i=h[r-p]),o=l[2*r],e.opt_len+=o*(s+i),d&&(e.static_len+=o*(c[2*r+1]+i)));if(0!==m){do{for(s=f-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[f]--,m-=2}while(m>0);for(s=f;0!==s;s--)for(r=e.bl_count[s];0!==r;)(a=e.heap[--n])>u||(l[2*a+1]!==s&&(e.opt_len+=(s-l[2*a+1])*l[2*a],l[2*a+1]=s),r--)}}(e,t),C(s,u,e.bl_count)}function R(e,t,n){var r,a,s=-1,i=t[1],o=0,l=7,u=4;for(0===i&&(l=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)a=i,i=t[2*(r+1)+1],++o<l&&a===i||(o<u?e.bl_tree[2*a]+=o:0!==a?(a!==s&&e.bl_tree[2*a]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,s=a,0===i?(l=138,u=3):a===i?(l=6,u=3):(l=7,u=4))}function $(e,t,n){var r,a,s=-1,i=t[1],o=0,l=7,u=4;for(0===i&&(l=138,u=3),r=0;r<=n;r++)if(a=i,i=t[2*(r+1)+1],!(++o<l&&a===i)){if(o<u)do{w(e,a,e.bl_tree)}while(0!=--o);else 0!==a?(a!==s&&(w(e,a,e.bl_tree),o--),w(e,16,e.bl_tree),k(e,o-3,2)):o<=10?(w(e,17,e.bl_tree),k(e,o-3,3)):(w(e,18,e.bl_tree),k(e,o-11,7));o=0,s=a,0===i?(l=138,u=3):a===i?(l=6,u=3):(l=7,u=4)}}a(y);var O=!1;function F(e,t,n,a){var s,i,o;k(e,0+(a?1:0),3),i=t,o=n,W(s=e),x(s,o),x(s,~o),r.arraySet(s.pending_buf,s.window,i,o,s.pending),s.pending+=o}t._tr_init=function(e){O||(function(){var e,t,n,r,a,l=new Array(16);for(n=0,r=0;r<28;r++)for(p[r]=n,e=0;e<1<<s[r];e++)h[n++]=r;for(h[n-1]=r,a=0,r=0;r<16;r++)for(y[r]=a,e=0;e<1<<i[r];e++)d[a++]=r;for(a>>=7;r<30;r++)for(y[r]=a<<7,e=0;e<1<<i[r]-7;e++)d[256+a++]=r;for(t=0;t<=15;t++)l[t]=0;for(e=0;e<=143;)u[2*e+1]=8,e++,l[8]++;for(;e<=255;)u[2*e+1]=9,e++,l[9]++;for(;e<=279;)u[2*e+1]=7,e++,l[7]++;for(;e<=287;)u[2*e+1]=8,e++,l[8]++;for(C(u,287,l),e=0;e<30;e++)c[2*e+1]=5,c[2*e]=S(e,5);f=new b(u,s,257,286,15),m=new b(c,i,0,30,15),g=new b(new Array(0),o,0,19,7)}(),O=!0),e.l_desc=new v(e.dyn_ltree,f),e.d_desc=new v(e.dyn_dtree,m),e.bl_desc=new v(e.bl_tree,g),e.bi_buf=0,e.bi_valid=0,I(e)},t._tr_stored_block=F,t._tr_flush_block=function(e,t,n,r){var a,s,i=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),E(e,e.l_desc),E(e,e.d_desc),i=function(e){var t;for(R(e,e.dyn_ltree,e.l_desc.max_code),R(e,e.dyn_dtree,e.d_desc.max_code),E(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*l[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),a=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=a&&(a=s)):a=s=n+5,n+4<=a&&-1!==t?F(e,t,n,r):4===e.strategy||s===a?(k(e,2+(r?1:0),3),N(e,u,c)):(k(e,4+(r?1:0),3),function(e,t,n,r){var a;for(k(e,t-257,5),k(e,n-1,5),k(e,r-4,4),a=0;a<r;a++)k(e,e.bl_tree[2*l[a]+1],3);$(e,e.dyn_ltree,t-1),$(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,i+1),N(e,e.dyn_ltree,e.dyn_dtree)),I(e),r&&W(e)},t._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(h[n]+256+1)]++,e.dyn_dtree[2*A(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){var t;k(e,2,3),w(e,256,u),16===(t=e).bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},function(e,t,n){e.exports=function(e,t,n,r){for(var a=65535&e,s=e>>>16&65535,i=0;0!==n;){n-=i=n>2e3?2e3:n;do{s=s+(a=a+t[r++]|0)|0}while(--i);a%=65521,s%=65521}return a|s<<16}},function(e,t,n){var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,a){var s=r,i=a+n;e^=-1;for(var o=a;o<i;o++)e=e>>>8^s[255&(e^t[o])];return~e}},function(e,t,n){var r=n(0),a=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(u){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(u){s=!1}for(var i=new r.Buf8(256),o=0;o<256;o++)i[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&a))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}i[254]=i[254]=1,t.string2buf=function(e){var t,n,a,s,i,o=e.length,l=0;for(s=0;s<o;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<o&&56320==(64512&(a=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(a-56320),s++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new r.Buf8(l),i=0,s=0;i<l;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<o&&56320==(64512&(a=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(a-56320),s++),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|63&n):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|63&n):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|63&n);return t},t.buf2binstring=function(e){return l(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,a=t.length;n<a;n++)t[n]=e.charCodeAt(n);return t},t.buf2string=function(e,t){var n,r,a,s,o=t||e.length,u=new Array(2*o);for(r=0,n=0;n<o;)if((a=e[n++])<128)u[r++]=a;else if((s=i[a])>4)u[r++]=65533,n+=s-1;else{for(a&=2===s?31:3===s?15:7;s>1&&n<o;)a=a<<6|63&e[n++],s--;s>1?u[r++]=65533:a<65536?u[r++]=a:(a-=65536,u[r++]=55296|a>>10&1023,u[r++]=56320|1023&a)}return l(u,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+i[e[n]]>t?n:t}},function(e,t,n){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,n){e.exports=function(e,t,n){if((t-=(e+="").length)<=0)return e;if(n||0===n||(n=" ")," "==(n+="")&&t<10)return r[t]+e;for(var a="";1&t&&(a+=n),t>>=1;)n+=n;return a+e};var r=[""," ","  ","   ","    ","     ","      ","       ","        ","         "]},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.crc32=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e=function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r<2048?t+=String.fromCharCode(192|r>>6)+String.fromCharCode(128|63&r):r<55296||r>=57344?t+=String.fromCharCode(224|r>>12)+String.fromCharCode(128|r>>6&63)+String.fromCharCode(128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++n)),t+=String.fromCharCode(240|r>>18)+String.fromCharCode(128|r>>12&63)+String.fromCharCode(128|r>>6&63)+String.fromCharCode(128|63&r))}return t}(e),t^=-1;for(var n=0;n<e.length;n++)t=t>>>8^r[255&(t^e.charCodeAt(n))];return~t>>>0};var r=function(){for(var e=[],t=void 0,n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}()},function(e,t,n){(function(e){var t,r,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=n(3),i=n(15),o=n(16),l=["cmoWWQLNWOLiWQq=","BuDyWQxcQW==","kSkZWPbKfSo0na==","CmkdWP0HW5zBW43cSuW=","W45fW4zRW7e=","WPqEW6VdO0G=","W6lcMmoUumo2fmkXw8oj","E8kaWOtdP3OyDwRdHSkEvG==","AmkkWQxdLgusBeddGG==","WRhcKxaJW5LvbCod","lmk7kmoKxW==","W6z6sCoqWOxcLCky","zmoJDeddKZu=","aHNcLuTtWRGo","WOStW5zoea==","W6uMwNldLq==","WOT6WQJcPca=","WRBdV3ifW5y=","WOFdTLWdW7O=","DSk7w8kdu18=","WPVdVxfeWOC=","hrGlw08=","WQrxW5BdJSo8","pYmEBM/dGG==","WPbCWQG=","W5TLW5D7W7u=","W4tcHSoECSop","BSo7dqxdIq==","k8keWRhcK3u=","WQT4e1DC","WQhdGmkvxSoG","ACoNxNldSa==","tIFcQ0Xe","W7KCkG4P","pmoMDbeF","uCk1BCkNFq==","WOGVWQhdUIVcISk5","WPbjWRdcTXi=","lYeXrh8=","WQ4WWOv/WQ3cLq==","WQddKu7cImkT","DSk7t8kAuvLN","dmkRnmk7WRS=","W4qIcsKi","WRyKW6vMbmkXea==","y8oKW6rWkq==","WQ3cLCk3xWa=","WQXrd8kHW7q=","rSkSWRKJW7a=","w8oxoXRdRG==","W4zZA8oZWOu=","W68VqgFdRa==","l8orWQ8fWR4=","WRzUWONcMry=","WQv1WPiJEW==","WOylW4bobG==","omkEW7JcMmkH","nJKkC1K=","ASooadNdQG==","WOS4WORdTIi=","g8kJiCo+zq==","WP8eW5hdPNu=","WRmCW6xdSeO=","gCkcW5ZcTCkUW5y=","WPnWWQJcPcS=","eZxdRSkHrW==","W64/oq==","W4tcV8kug3y=","ienYnMS=","nmopWRtdR3OuDuZdLmoq","WRbqWPBcHda=","W6nRW411W7K=","WOWmWP5tWQu=","WO/cUSkt","WO3cLmkfsai=","tCo3W41qfW==","a8o4rc0f","WQ1YahP5","xf10WOZcJG==","WPpdKCkUBSoYW7a5W7FdGmoh","WQDlnCkKW4K=","ymkjWOyjW5br","s3b+WOBcM8kOWO4=","WQldQ3W/W4dcMwmEW4ig","WP4jWQFdHqC=","w8kIWQpdNxO=","W5iOEmkBgG==","mIOrC3e=","W6vBv8oGWQe=","t8oQtfddJG==","y8k7s8k/rf9V","n8kVhW==","d8kjW4VcJSkJW57cGa==","WPSkW51fgq==","qmkSEmk0wW==","aSovWQuCWOldKa9rpCoVEvW=","WRbCWP4dBIy9WQyeW4C=","W6jEW71CW6m=","kW8fux8=","oG7cQ2X6","WQhcKuycW7DJh8oftmk+WOC=","W6XmW7ldNdq=","uSoZhCktWQDFq8o8","W5eWsCkbdW==","prqJWP8T","WOa1W59tia==","WOFdVCk1uCoG","W41cW5XoW5S=","ESkbWRxdSMWuAuZdGW=="];t=l,r=310,function(e){for(;--e;)t.push(t.shift())}(++r);var u=function e(t,n){var r=l[t-=0];void 0===e.tUkVyK&&(e.SyLkTR=function(e,t){for(var n=[],r=0,a=void 0,s="",i="",o=0,l=(e=function(e){for(var t,n,r=String(e).replace(/=+$/,""),a="",s=0,i=0;n=r.charAt(i++);~n&&(t=s%4?64*t+n:n,s++%4)?a+=String.fromCharCode(255&t>>(-2*s&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);return a}(e)).length;o<l;o++)i+="%"+("00"+e.charCodeAt(o).toString(16)).slice(-2);e=decodeURIComponent(i);var u=void 0;for(u=0;u<256;u++)n[u]=u;for(u=0;u<256;u++)r=(r+n[u]+t.charCodeAt(u%t.length))%256,a=n[u],n[u]=n[r],n[r]=a;u=0,r=0;for(var c=0;c<e.length;c++)r=(r+n[u=(u+1)%256])%256,a=n[u],n[u]=n[r],n[r]=a,s+=String.fromCharCode(e.charCodeAt(c)^n[(n[u]+n[r])%256]);return s},e.JhCSdo={},e.tUkVyK=!0);var a=e.JhCSdo[t];return void 0===a?(void 0===e.TXInmU&&(e.TXInmU=!0),r=e.SyLkTR(r,n),e.JhCSdo[t]=r):r=a,r},c=u("0x28","*KkM"),d=u("0x36","oWqr"),h=u("0x2a","d@60"),p=u("0x17","kD*R"),f=u("0x3","vAE3"),m=u("0x62","H5IR"),g=u("0x1a","oJ@J"),y=u("0x1d","upP9"),b=void 0;("undefined"==typeof window?"undefined":a(window))!==u("0x10","c#3e")&&(b=window);var v={};v[u("0x14","H5IR")]=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9999,r=u,a={};a[r("0x20","LZ7[")]=function(e,t){return e+t},a[r("0x5e","Zg$y")]=function(e,t){return e+t},a[r("0x44","LZ7[")]=r("0x1c","R[Qg"),a[r("0x5b","1IMn")]=function(e,t){return e*t},a[r("0x57","oWqr")]=function(e,t){return e*t},a[r("0x4a","*KkM")]=function(e,t){return e*t},a[r("0x5c","HG2n")]=function(e,t){return e*t},a[r("0x4e","^XGH")]=r("0x56","c#3e"),a[r("0x43","R[Qg")]=function(e,t){return e+t},a[r("0x46","oWqr")]=function(e,t){return e||t},a[r("0x9","woOD")]=r("0xa","KtS*");var s=a;e=s[r("0x45","vAE3")]("_",e);var i="";if(n){var o=new Date;o[r("0x0","FnT9")](s[r("0x49","FnT9")](o[s[r("0x58","d@60")]](),s[r("0xf","d@60")](s[r("0xd","HY]&")](s[r("0x52","7y%^")](s[r("0x5","d@60")](n,24),60),60),1e3))),i=s[r("0x27","Ky!n")](s[r("0x61","1V&b")],o[r("0x8","oJ@J")]())}b[g][m]=s[r("0x2","ny]r")](s[r("0x1b","ve3x")](s[r("0x3c","JOHM")](s[r("0x6a","upP9")](e,"="),s[r("0x48","HY]&")](t,"")),i),s[r("0x21","oWqr")])},v[u("0x19","c#3e")]=function(e){var t=u,n={};n[t("0x65","p8sD")]=function(e,t){return e+t},n[t("0x32","JOHM")]=function(e,t){return e+t},n[t("0x2c","x]@s")]=function(e,t){return e<t},n[t("0x37","*KkM")]=function(e,t){return e===t},n[t("0xb","S!Ft")]=function(e,t){return e===t},n[t("0x2f","6NX^")]=t("0x1e","I(B^");var r=n;e=r[t("0x51","oWqr")]("_",e);for(var a=r[t("0x5f","2Z1D")](e,"="),s=b[g][m][d](";"),i=0;r[t("0x30","upP9")](i,s[y]);i++){for(var o=s[i];r[t("0x4d","ve3x")](o[c](0)," ");)o=o[p](1,o[y]);if(r[t("0x4b","x]@s")](o[r[t("0x7","I(B^")]](a),0))return o[p](a[y],o[y])}return null},v[u("0x4",")vJB")]=function(e,t){var n=u,r={};r[n("0x66","c#3e")]=function(e,t){return e+t},e=r[n("0x42","x]@s")]("_",e),b[f][n("0x11","J3d$")](e,t)},v[u("0x64","JHVq")]=function(e){var t=u,n={};return n[t("0x2b","kD*R")]=function(e,t){return e+t},e=n[t("0x34","ny]r")]("_",e),b[f][t("0x6b","ny]r")](e)};var A=v;function x(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date[u("0x53","JOHM")](),t=u,n={};n[t("0x67","S!Ft")]=function(e,t){return e(t)},n[t("0xc","Fq&Z")]=function(e){return e()},n[t("0x31","^R*1")]=function(e,t){return e%t},n[t("0x33","w&#4")]=function(e,t,n,r){return e(t,n,r)},n[t("0x3f","1IMn")]=t("0x50","FnT9"),n[t("0xe","6NX^")]=t("0x3a","ny]r");var r=n,a=r[t("0x15","d@60")](String,e)[h](0,10),l=r[t("0x54","#koT")](i),c=r[t("0x4f","^XGH")]((a+"_"+l)[d]("")[t("0x24","ny]r")]((function(e,n){return e+n[t("0x60","6NX^")](0)}),0),1e3),p=r[t("0x39","x^aA")](o,r[t("0x47",")vJB")](String,c),3,"0");return s[r[t("0x41","H5IR")]](""+a+p)[r[t("0x6","*KkM")]](/=/g,"")+"_"+l}function k(e){var t=u,n={};n[t("0x2d",")vaK")]=function(e,t){return e+t},n[t("0x12","2Z1D")]=t("0x18","c#3e");var r=n;return r[t("0x55","QHJK")](e[c](0)[r[t("0x1","HY]&")]](),e[h](1))}e[u("0x3d","HY]&")]=function(){var e=u,t={};t[e("0x69","R[Qg")]=function(e,t){return e(t)},t[e("0x59","xXnT")]=function(e,t){return e(t)},t[e("0x5d","w&#4")]=e("0x63","2Z1D"),t[e("0x40","1V&b")]=function(e){return e()},t[e("0x3b","KtS*")]=e("0x38","xXnT"),t[e("0x1f","HY]&")]=e("0x13","jbVU"),t[e("0x23","JHVq")]=e("0x35","p8sD");var n=t,r=n[e("0x22","JHVq")],a={},s=n[e("0x16","^XGH")](x);return[n[e("0x4c","p8sD")],n[e("0x25","fVDB")]][n[e("0x2e","Zg$y")]]((function(t){var i=e;try{var o=i("0x68","*KkM")+t+i("0x6c","ve3x");a[o]=A[i("0x5a","1IMn")+n[i("0x3e","HG2n")](k,t)](r),!a[o]&&(A[i("0x29","oWqr")+n[i("0x26","*KkM")](k,t)](r,s),a[o]=s)}catch(l){}})),a}}).call(this,n(1)(e))},function(e,t,n){e.exports=function(e){e=e||21;for(var t="";0<e--;)t+="_~varfunctio0125634789bdegjhklmpqswxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[64*Math.random()|0];return t}},function(e,t,n){e.exports=function(e,t,n){if("string"!=typeof e)throw new Error("The string parameter must be a string.");if(e.length<1)throw new Error("The string parameter must be 1 character or longer.");if("number"!=typeof t)throw new Error("The length parameter must be a number.");if("string"!=typeof n&&n)throw new Error("The character parameter must be a string.");var r=-1;for(t-=e.length,n||0===n||(n=" ");++r<t;)e+=n;return e}},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=17}]),window.pddSign=()=>window.nz(4)({serverTime:Date.now()}).messagePack();const Za={class:"1688xunyuantong-search"},Ka={class:"filter-wrap"},Ja={class:"filter-item"},Ya={class:"filter-item"},es={class:"list-wrap"},ts=["href"],ns={class:"info-wrap"},rs=["src"],as={class:"title"},ss=["innerHTML"],is={class:"price-wrap"},os={class:"price"},ls={class:"prefix"},us={key:0,class:"sold"},cs={key:0,class:"mall-wrap"},ds=["innerHTML"],hs=["innerHTML"],ps={key:0,class:"error-tip"},fs={class:"left"},ms={class:"center"},gs={class:"sub-title"},ys={class:"right"},bs={target:"_blank",href:"https://mobile.yangkeduo.com"},vs={key:1,class:"error-tip"},As={class:"left"},xs={class:"center"},ks={class:"sub-title"},ws={class:"right"},Ss={key:2,class:"loading-wrap"},Cs={class:"text"},Is={key:3,style:{padding:"20px"}},Ws={key:4,class:"bottom-tip"},_s=ye({__name:"pinduoduo",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["search","update:loading"],setup(e,{emit:t}){let n=be();const r=e,a=F(""),d=F(""),h=F(""),p=F([]),f=F(""),m=t,g=F("正在图搜同款"),y=J((()=>h.value?p.value.filter((e=>e.title&&e.title.includes(h.value)||e.location&&e.location.includes(h.value)||e.mall&&e.mall.includes(h.value))):p.value)),b=F(""),v=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),A=e=>{p.value=v([...p.value],e)},x=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)};let k="",w="",S=1;const C=async()=>{k=1,S=1,w="",p.value=[],a.value="",await I()&&await W()},I=async()=>{if(k)return!0;const e=await bn({url:"https://mobile.yangkeduo.com"});if(!e.find((e=>"pdd_user_id"===e.name))||!e.find((e=>"PDDAccessToken"===e.name)))return a.value="error",m("update:loading",!1),d.value="没有登录拼多多",!1;const t=e.find((e=>"pdd_user_id"===e.name)).value;w=e.find((e=>"PDDAccessToken"===e.name)).value;const n=await mn({method:"POST",url:`https://api.pinduoduo.com/file/signature?pdduid=${t}&xcx=20161201&xcx_version=v7.7.3.1`,credentials:"same-origin",body:JSON.stringify({bucket_tag:"search-img-extractor-app",anti_content:window.pddSign(),xcx_version:"v7.7.3.1"}),headers:{AccessToken:w}}),s=await mn({method:"POST",url:`https://file.pinduoduo.com/general_file?sign=${n.signature}`,credentials:"same-origin",timeout:6e4,form:{upload_sign:n.signature,file:{url:r.imgUrl,filename:"image.png"}}});return s.error_code?(a.value="error",m("update:loading",!1),d.value="上传图片失败,"+s.error_msg,!1):(k=s.url,!0)},W=async()=>{a.value="loading",g.value="正在图搜同款",m("update:loading",!0);const e=await mn({method:"POST",credentials:"same-origin",url:"https://api.yangkeduo.com/api/search/img?pdduid=4933034120&xcx=20161201&xcx_version=v6.6.8",body:JSON.stringify({url:k,anti_content:window.pddSign(),xcx_version:"v6.6.8"}),headers:{AccessToken:w}});if(e.error_code)return a.value="error",m("update:loading",!1),void(d.value="搜索失败,请稍后再试");let t=e.items.map(((e,t)=>{const n=`https://mobile.yangkeduo.com/goods.html?goods_id=${e.goods_id}`;let r=e.sales_tip;const a=r.match(/(\d+)\.(\d+)万/),s=r.match(/(\d+)万/),i=r.match(/(\d+)/g);return r=a?1e4*a[1]+1e3*a[2]:s?1e4*s[1]:i?i[0]:0,{index:100*S+t,currency:"¥",id:e.goods_id,title:e.goods_name,price:e.price/100,sold:r,thumb:e.hd_thumb_url,url:n,mall:null,location:null}}));m("search",{page:1,list:t}),t=v(t,b.value),p.value=p.value.concat(t),a.value="finish",m("update:loading",!1),n.query.goodsId&&s({trackId:7,type:"search-image-pdd",data:{goodsId:n.query.goodsId,page:S,list:t},localInfo:{region:n.query.region||"211"}})},_=async()=>{"visible"===document.visibilityState&&"error"===a.value&&await I()&&await W()};return ue((async()=>{const e=await fn();if(e.error_code)return a.value="install-error",void(d.value="您还没有安装插件,请点击'下载插件'进行安装");f.value=e.version,document.addEventListener("visibilitychange",_),await I()&&await W()})),ve((()=>{document.removeEventListener("visibilitychange",_)})),(e,t)=>{const n=i,r=o,s=l,p=Oe,f=Ne,m=Ke,v=Ee("router-link"),k=u,w=Re;return Ae(),xe("div",Za,[ke("div",Ka,[ke("span",Ja,[t[7]||(t[7]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:b.value,"onUpdate:value":t[0]||(t[0]=e=>b.value=e),style:{width:"130px"},onChange:A},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"sold-max-min"},{default:we((()=>t[4]||(t[4]=[Se("销量从高到低")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[5]||(t[5]=[Se("价格从高到低")]))),_:1}),$(n,{value:"sold-min-max"},{default:we((()=>t[6]||(t[6]=[Se("销量从低到高")]))),_:1})])),_:1},8,["value"])]),ke("span",Ya,[t[8]||(t[8]=ke("span",{class:"label"},"筛选:",-1)),$(s,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题",style:{width:"200px"}},null,8,["value"])])]),ke("div",es,[(Ae(!0),xe(D,null,Ce(y.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",ns,[ke("img",{src:e.thumb,class:"thumb"},null,8,rs),ke("div",as,[e.tag?(Ae(),$e(p,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:x(e.title,h.value)},null,8,ss)]),ke("div",is,[ke("span",os,[ke("span",ls,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",us,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",cs,[ke("span",{class:"mall",innerHTML:x(e.mall,h.value)},null,8,ds),ke("span",{class:"location",innerHTML:x(e.location,h.value)},null,8,hs)])):Te("",!0)],8,ts)))),128))]),"error"===a.value?(Ae(),xe("div",ps,[ke("div",fs,[$(Ie(We),{class:"icon"})]),ke("div",ms,[t[9]||(t[9]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",gs,_e(d.value),1)]),ke("div",ys,[$(m,null,{default:we((()=>[ke("a",bs,[$(f,{type:"primary"},{default:we((()=>t[10]||(t[10]=[Se(" 登录拼多多 ")]))),_:1})]),$(f,{onClick:C},{default:we((()=>t[11]||(t[11]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===a.value?(Ae(),xe("div",vs,[ke("div",As,[$(Ie(We),{class:"icon"})]),ke("div",xs,[t[12]||(t[12]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",ks,_e(d.value),1)]),ke("div",ws,[$(m,null,{default:we((()=>[$(v,{target:"_blank",to:"/download"},{default:we((()=>[$(f,{type:"primary"},{default:we((()=>t[13]||(t[13]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===a.value||""===a.value?(Ae(),xe("div",Ss,[$(k,{size:"large"}),ke("span",Cs,_e(g.value),1)])):Te("",!0),"success"!==a.value&&"finish"!==a.value||0!==y.value.length?Te("",!0):(Ae(),xe("div",Is,[$(w,{description:"没有搜索到商品"})])),"finish"===a.value&&y.value.length>0?(Ae(),xe("div",Ws,t[14]||(t[14]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-4ebdb38b"]]);let Ts;!function(e){function t(t){for(var r,a,o=t[0],l=t[1],u=t[2],c=0,h=[];c<o.length;c++)a=o[c],Object.prototype.hasOwnProperty.call(s,a)&&s[a]&&h.push(s[a][0]),s[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(d&&d(t);h.length;)h.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],r=!0,a=1;a<n.length;a++){var l=n[a];0!==s[l]&&(r=!1)}r&&(i.splice(t--,1),e=o(o.s=n[0]))}return e}var r={},a={21:0},s={21:0},i=[];function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(e){var t=[];a[e]?t.push(a[e]):0!==a[e]&&{1:1,10:1,11:1,12:1,14:1,15:1,17:1}[e]&&t.push(a[e]=new Promise((function(t,n){for(var r="static/css/"+({7:"AccountCenter",8:"Activity",9:"BestGoods",10:"Cart",11:"GoodsDetail",12:"GoodsDropShipping",13:"Home",14:"Mall",15:"MallSearch",16:"NotFound",17:"Order",18:"Payment",19:"Search"}[e]||e)+"."+{0:"31d6cfe0d",1:"1bb732cb7",2:"31d6cfe0d",3:"31d6cfe0d",4:"31d6cfe0d",5:"31d6cfe0d",6:"31d6cfe0d",7:"31d6cfe0d",8:"31d6cfe0d",9:"31d6cfe0d",10:"86909bf59",11:"1405928aa",12:"9eff41d5d",13:"31d6cfe0d",14:"941e90c52",15:"86909bf59",16:"31d6cfe0d",17:"07dca30ce",18:"31d6cfe0d",19:"31d6cfe0d",23:"31d6cfe0d",24:"31d6cfe0d",25:"31d6cfe0d",26:"31d6cfe0d",27:"31d6cfe0d",28:"31d6cfe0d",29:"31d6cfe0d",30:"31d6cfe0d"}[e]+".chunk.css",a=o.p+r,s=document.getElementsByTagName("link"),i=0;i<s.length;i++){var l=(c=s[i]).getAttribute("data-href")||c.getAttribute("href");if("stylesheet"===c.rel&&(l===r||l===a))return t()}var u=document.getElementsByTagName("style");for(i=0;i<u.length;i++){var c;if((l=(c=u[i]).getAttribute("data-href"))===r||l===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var r=t&&t.target&&t.target.src||a,s=new Error("Loading CSS chunk "+e+" failed.\n("+r+")");s.request=r,n(s)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){a[e]=0})));var n,r=s[e];if(0!==r)if(r)t.push(r[2]);else{var i=new Promise((function(t,n){r=s[e]=[t,n]}));t.push(r[2]=i);var l,u=document.createElement("script");u.charset="utf-8",u.timeout=120,o.nc&&u.setAttribute("nonce",o.nc),u.src=(n=e,o.p+"static/js/"+({7:"AccountCenter",8:"Activity",9:"BestGoods",10:"Cart",11:"GoodsDetail",12:"GoodsDropShipping",13:"Home",14:"Mall",15:"MallSearch",16:"NotFound",17:"Order",18:"Payment",19:"Search"}[n]||n)+"."+{0:"f10cbb13",1:"1f11793f",2:"377e6d6e",3:"35ce66b2",4:"067dc63d",5:"faf75b50",6:"c87ff2b9",7:"5a36fa8d",8:"3e335bc4",9:"419b7116",10:"3088d3ab",11:"39a585d4",12:"d07a6c4a",13:"20c6d848",14:"30a72180",15:"53f0e801",16:"bd04a08e",17:"319b16be",18:"135c3c2b",19:"66b54e82",23:"c46b72b3",24:"bcfa92ac",25:"dbb47e8b",26:"8b9ca1c3",27:"1e9746e3",28:"73b775ab",29:"c13c09f3",30:"ca572efb"}[n]+".chunk.js");var c=new Error;l=function(t){u.onerror=u.onload=null,clearTimeout(d);var n=s[e];if(0!==n){if(n){var r=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+r+": "+a+")",c.name="ChunkLoadError",c.type=r,c.request=a,n[1](c)}s[e]=void 0}};var d=setTimeout((function(){l({type:"timeout",target:u})}),12e4);u.onerror=u.onload=l,document.head.appendChild(u)}return Promise.all(t)},o.m=e,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="https://mms-static.pddpic.com/wholesale/",o.oe=function(e){throw e};var l=window.webpackJsonp=window.webpackJsonp||[],u=l.push.bind(l);l.push=t,l=l.slice();for(var c=0;c<l.length;c++)t(l[c]);var d=u;n(),Ts=o}({291:function(e,t,n){(function(t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==(void 0===n?"undefined":r(n)))throw new TypeError(n+"must be non-object");for(var a in n)s(n,a)&&(e[a]=n[a])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,r,a){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),a);else for(var s=0;s<r;s++)e[a+s]=t[n+s]},flattenChunks:function(e){var t,n,r,a,s,i;for(r=0,t=0,n=e.length;t<n;t++)r+=e[t].length;for(i=new Uint8Array(r),a=0,t=0,n=e.length;t<n;t++)s=e[t],i.set(s,a),a+=s.length;return i}},o={arraySet:function(e,t,n,r,a){for(var s=0;s<r;s++)e[a+s]=t[n+s]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(a)},function(e,t,n){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,n){(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){var e=h();function t(e,t){return o(e- -416,t)}function n(e,t){return o(t- -209,e)}for(;;)try{if(-parseInt(n("@b)w",489))/1*(-parseInt(n("iU!(",188))/2)+parseInt(n("ea1u",389))/3*(parseInt(n("(5h(",478))/4)+-parseInt(t(258,"IUs7"))/5*(parseInt(n("K)F[",473))/6)+-parseInt(n("#FdB",477))/7*(parseInt(n("M#pd",336))/8)+-parseInt(n("ea1u",227))/9*(-parseInt(n("iSBn",363))/10)+-parseInt(t(305,"d2&5"))/11*(-parseInt(n("bmAe",361))/12)+parseInt(n("hAY8",375))/13==763712)break;e.push(e.shift())}catch(r){e.push(e.shift())}}();var r=n(12),a=n(13)[l(1454,"2)u3")],s=(l(1452,"lqr!")+c(-361,"lxO1")+l(1369,"wReF")+l(1387,"(5h(")+c(-172,"1F4e")+l(1516,"l3WP")+l(1554,"qy3r"))[c(-207,"eyzX")](""),i={};function o(e,t){var n=h();return(o=function(t,r){var a=n[t-=393];void 0===o.AVPLwW&&(o.jhmVoH=function(e,t){var n=[],r=0,a=void 0,s="";e=function(e){for(var t,n,r="",a="",s=0,i=0;n=e.charAt(i++);~n&&(t=s%4?64*t+n:n,s++%4)?r+=String.fromCharCode(255&t>>(-2*s&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);for(var o=0,l=r.length;o<l;o++)a+="%"+("00"+r.charCodeAt(o).toString(16)).slice(-2);return decodeURIComponent(a)}(e);var i=void 0;for(i=0;i<256;i++)n[i]=i;for(i=0;i<256;i++)r=(r+n[i]+t.charCodeAt(i%t.length))%256,a=n[i],n[i]=n[r],n[r]=a;i=0,r=0;for(var o=0;o<e.length;o++)r=(r+n[i=(i+1)%256])%256,a=n[i],n[i]=n[r],n[r]=a,s+=String.fromCharCode(e.charCodeAt(o)^n[(n[i]+n[r])%256]);return s},e=arguments,o.AVPLwW=!0);var s=t+n[0],i=e[s];return i?a=i:(void 0===o.QkLBNM&&(o.QkLBNM=!0),a=o.jhmVoH(a,r),e[s]=a),a})(e,t)}function l(e,t){return o(e-966,t)}i["+"]="-",i["/"]="_",i["="]="";var u=i;function c(e,t){return o(e- -820,t)}function d(e){return e[l(1470,"pKX5")](/[+\/=]/g,(function(e){return u[e]}))}function h(){var e=["vqJcNKCb","D8oDW54","W41HW4ldJXu","o8ovuJbn","a8o+lbpdUCkWuCk6W54","hCkdWRTfW4G","WQXoz8oCEmkZFJKVWPZcMmo7","w8ocAxe","FmkkW5/cL21c","W6PAW67dTJ0Yj8oRWQ3dHW","W4GyW77cOqa","W7pcOCkMWQZcKW","kmoFW6xcTvnMeHq","WR5fqmk4ja","W4JcMmkpWQOR","W7FcMGe","WRRdHmotWRRcLvddTcG","W6LmWPVdKCoB","WQrUq8ksW4O","qSouqNX6","W7BcTmk/WO0","WOdcJmkJWQyj","v8k0W6VdLSoY","aSodvtbEW4dcKCk9","WPb8A8ksW4K","WQ7dK8oBW77cTxZdSrJdGCoz","W4GlWRSvW6O","W6ZcJqJcThm","WPRdT8k5jmky","WQTrW4m","dMeAW7flW4K","pCk8WQ5RW6JdH8kZWPm","ySoHsev6","W4FcIbBcLNFdONRdQmolW7y","W7VdRCoeWOpcUxhdQG","hCkJWQrTW7S","x8o0WQJdLe8","WP7cK8oDgLldKrOb","xCkHW68uW48","jGzyWPFdG1NcPSkLEG","WRNcJSkxWOe","hCkpWQzzW5i","WOVdOSkRbSkm","WQvqrmk4W6ZcLSowW5C4cq","WRFcTmoXa8k+","t8k9W7NdJSoR","oSo0pJ/dLq","vf9rW5ng","W5RdGXCKW5i","BXRcRMaH","hmodBYO","WQddVCoeWOTm","FCotsv5t","xK/cN8kEWQq","rCoTx0Pw","xwVcNCkJWObB","W4maW5tcNJi","W7FdRSkVvmkuW6ZcGcpdPCkT","WODkW6tcP8kl","EmoMW44QW7tdN8k1WPNcTCkj","WPqbWRBdH8oH","dSkQWRv3W65vWPjIWRtdJa","dCoZemkRWOO","WRDhWOSYhq","FSowW5yzmq","omojv8kFBfuaiSoWrmk7WPy","WPBcMsG","rmoVW583WRqjWPTpW4ddTtG","WQhdGmoyWRO","rmkeW7in","s1Ccrvi","WRldSCo4W5XXW6n0i8kzWRqeb8kX","AWTvW40lwmkDW5G","BMW/","WPddKSoOWRb+","fSkXWPS","WRJdQmoNsSkP","W6VdSXWVW6a","W7pdKSk1","uSoBWRW","lSoFoWldMG","WQVdH8os","W6ZcNIm7W7q","W4ZcS8oziLJdLG4","rSojW5eVlq","W5ldTZ3dSwK","W6FcLWJcQK0","qWFcPwKe","W7yChCkJlq","CHNcPSk6W6hdSZ3dVq","AmkbW7hdPCoR","iSkKWR5pW5u","WPn8ACkQeG","WRRcSSosmxy","WRLgW5lcOmkEECoRW6ddJW","iSoCxZzn","W4DOW4pdHXnV","DmkoWRtdMCk8","WRBdTSoDW7RcQ8oegNCbW5y","WQD8DCks","W7NdI8ou","WOhdQmoNWOT+","W5BdSse3W5C","nCouWO7cUmkXlu4SW5RdNcLhgG","z8kvamojkqK","WQJcVCo2b8kVW7C","WQPlACoEbSoZCs0cWRm","WRnDs8kkca","n1bEW7yw","WO3dKSkleG","WQn/W7BcKCkR","W5JcJrtcJa","W67dTruPW5O","WOFdKmoT","xWiM","aZ/dHSo3W4CaWPBdTdW2tgRcVa","W47cTmkPWOdcGW","W5T/W4ldLaHZc8oDW6u","uMhcNCkNWPvh","dSkAWPngW70","eCk/WQLWW4W","vtBcVxymWOldM3alWOK","WQW9WOJdG8o0","FCoCuSkzvbtdV8onW6vGWQBdS8ob","wx3cUCkRWOe","mCk2WO1yW6y","W7uWoCkIdW","vmkdW4JdKSoc","Fmo8W64Fl8k2","qCkfW7aTW7C","eSo9iZtdRa","rCoyAgiL","WO7dUCk3mmkW","W5VcIaVcJxa","WRvnr8k5W5VcI8oBW5WE","WPldK8krpCk7EGa","qSkoW7ueW4Gc","WOrRW6JcUSkD","oCkMWO53","p1TqW6Gwu8kmW60MWQS","gSo1jHhdQ8kX","W43dUbZdQLW","W6/cQCkpWOdcLG","WQbhuCkkcq","nCkzlmoBfa","x8o4W5iSkW","WRRdPmoaWP9J","jmkZWO50W60","WQBdM2q0tG","W6XeW4pdUqa","WQfrsmkEba","rCkCW4KZW7q","WR3dN8osWOvk","WR7dNmohWOLw","W7ubhmo7WP7dJCodW5CHeGi1","zmknWRpdMCk4WO8","W4yvWQaqW74","W6CXqCksfq","W5L8W67dRGW","EmoPWOZdPuC","WQ3cICo3bmkS","o8kkWOPuW6S","rCklW4pcU0G","sCoDyq","btbSWPZdSG","WRhcTSoRcmkYW7NcUG","WQxcNSkkWO47lW","xSoyWRC","sSolCv5ZWPG","bKuUW65j","emkpWQS","WPhdHCoHWOHa","CbxcMuy","vJdcU3KJ","B2H6W5i","W4ziW4pdQq4","g8k6WPW","cgpcICk5W5RdGHBdTSoIW7e","W4JcLSkSWQpcIa","kCoYWOq","W6GuWRetW7NcUGO9","W5ypWRqLW40","WOFdS8ojxCkx","WRFcRCo6e8kVW63cPXVdHq","dCodemkdWQ8","W7n2WPVdR8ol","WPhdGSkwhwlcNW","eguAW7jqW4W","W5WIBCkieq","CCkrW4NdQq","vfRcGCk8WR0","DCk7WQRdSCkO","W67dSqKvW4i","W5tcJ8kbWP0H","wmokyv8","WOxcICo2gCk4","BmoBaW","eCojkYZdLG","W4W9W7FcStddSW","lCk8WOroW78","f8ogAGDb","W6RcK8kbWQKN","kCoFf8kE","W7SHW4/cVXu","n8oscZldMSkFEmkxW7pcRG","W6j+W5JdSre","WPSHWPJcUmkW","WQ9DBSkUW4a","WOL+WOa9mG","pSoqW6NcISk+WOHXW63cOSow","W6WoWPep","DSobDG","iNZcGmkhW78","WOHhW4dcKCkh","W68pWPaoW6xcTa","eH5BWRldLq","s8o1DNrx","W6CgySk5aSkL","W4HqWQhdGSooW4u","wuZcMG","W5vfWQZdICos","wSoXE2u","WPhdM8oXWR96WQpcLW","WOZdGSo/WRvN","i8oiDa99","sCouW6ymha","WRJdL8kMe8kQ","W7Gtymk3aG","bSozDsW","WP1xr8kGW4RcMSogWPi4dW","W43dOrC6W5O","w8kmW50UW70","W4dcSJeGW4C","BmkOW7Xbj8oQW4PWec4","CSooWQxdT3S","W5lcQ8kAWQBcKq","xComq1HaWOuIW48","W50imCk6pG","W4tdSaBdJ2q+","WPLAW6K","mKdcO8kJW50","zCkfa8omobm","e8k2WPHmW4G","WRtdKKGcxGS","ASkEW7qZW4S","pCo7pmk6WOe","jSoFemkvWPNdVq","gCk1WODaW48","WRjCW7xcICkK","WRzzv8k5W4RcSmoCW4y","WPL4WOhcMSkIrmoHW6BdH8kH","WR3cLmk3WP09lHf6","wCowy0q","AKS4vKDj","WQNdISopWQRcKw0","WQvDtmkM","x8o3WOddUM0","W64EWPilW6RcSae","xmo4sLKiig/dMmkQWRO","W4ZcMrpcHq","A8kgW68VW44","WQFdRCoNWPXA","F8k1pCoSlG","W6ZdLSokySkjWORdGa","ESkgW6JcTNO","W7CNe8k7gq","W7msn8ke","EcRcHhqC","WR3cOSkOuCoPWQZdUKdcLmoE","vmkSW7dcMu4","iCkyWQPrW5W","W7uymmknpCoO","W7fDWRVdJmoU","rwhcOmkWWOzAW4ddOG","oSkkiCoNjG","WO7dN8oX","msD3WPtdMG","W5O8W6RcUJJdOre","n8kciSoWkq","WQlcMCo3","W5akgCkLdW","bv/dUW","W4BcKJqZW4K","WQ5EW5VcKCkz","WPddI8oJWQbVWRlcM8kkW78","WPhcNSosd2xdLG","bSoLoX4","nCowW67cG8oPWP9WWPtcTCofra","r8kzmNWCW6xcU8kXW5ZcTJu","uMBcKSk2WRDCW4RdObqX","W685uSk/l8orWOFcHG","sCoBWPRdHxa","WOddN8oTWR8","WO9CW4lcP8kq","W6yeDSklnW","zmkaW6lcHgTdkJq","dmkvamoela","WRtcRCoRca","jSkGWRPVW4K","WO1xWQWspG","WOddLSoGWQfyWQ/cLSkb","W6BcJr9qd0BdKLFdRbRdHau","E8kkr8odW53cRmkPW6SoW7GUW7e","lSo9FWn+","W73cUrazW7i","WQhdImomsCkRWQBdPsZdJW","WPWmW6tcIG","W7pcR8k/WO0TWRe5","cHhdTG","W6NdSrCWW4q","WOxdJSkrpSkOBry","W4X+WPJdQ8o8","WRFdICogx8k5W68","WOpcTCo5nSk5","W48VW4pdT8kZWQdcPK/dHs4","W5/cR8k6WQdcKW","W7mlhmo8WP7dISoZW7atfIuD","WRb1W4JcPCk7","FM/cOCkqWOq","W5bAWPZdKCoiW4r1oG","W7NdLaSjW4q","qWNcGvq7","kuHvW7mls8koW68S","he0i","m0GsW6Xf","W4aJWPNdHCogW5xcKq","W7ddPWhdVwi","lSkvbSoseW","FmolzevM","WOpcUSkcWQai","W4Svpmkqia","DmksWRhdK8kT","fCo/jHxdVSkT"];return(h=function(){return e})()}var p=("undefined"==typeof window?"undefined":t(window))!==l(1585,"lqr!")&&window[c(-189,"LPAx")]?window[l(1497,"ea1u")]:parseInt,f={base64:function(e){var t={ztKqs:function(e,t){return e*t},xJnZI:function(e,t){return e(t)},PCVxE:function(e,t){return e/t},JAfIG:function(e,t){return e<t},OUBlM:function(e,t){return e+t},UdrKQ:function(e,t){return e+t},DuoPw:function(e,t){return e>>>t},kwCPO:function(e,t){return e&t},xObLJ:function(e,t){return e|t},MyTta:function(e,t){return e<<t},JtVBF:function(e,t){return e&t},kwRPH:function(e,t){return e|t},UhtiT:function(e,t){return e&t},CxgnK:function(e,t){return e-t},kTJWV:function(e,t){return e===t},aSDpj:function(e,t){return e+t},ugFMA:function(e,t){return e+t},nZMQP:function(e,t){return e>>>t},QLfzz:function(e,t){return e(t)}},n=void 0,r=void 0,a=void 0,i="";function o(e,t){return l(t- -1114,e)}var u=e[h(854,"ehxd")];function h(e,t){return c(e-1226,t)}for(var f=0,m=t[o("5m^J",278)](t[h(955,"wReF")](p,t[o("QQD8",298)](u,3)),3);t[h(1017,"ehxd")](f,m);)n=e[f++],r=e[f++],a=e[f++],i+=t[h(866,"7s0V")](t[o("Wfi4",438)](t[o("FYnO",296)](s[t[h(932,"qa*a")](n,2)],s[t[o("IUs7",558)](t[h(1072,"8Oiv")](t[o("eoa[",537)](n,4),t[h(1113,"iSBn")](r,4)),63)]),s[t[o("icaT",315)](t[h(839,"qa*a")](t[o("bmAe",470)](r,2),t[o("iSBn",559)](a,6)),63)]),s[t[o("wReF",467)](a,63)]);var g=t[h(984,"5m^J")](u,m);return t[o("K)F[",508)](g,1)?(n=e[f],i+=t[h(912,"bmAe")](t[h(1008,"!&EH")](s[t[o("d2&5",371)](n,2)],s[t[o("7s0V",369)](t[o("v6]c",525)](n,4),63)]),"==")):t[h(1063,"b!D8")](g,2)&&(n=e[f++],r=e[f],i+=t[o("lxO1",346)](t[h(919,"qa*a")](t[o("5m^J",408)](s[t[o("1F4e",494)](n,2)],s[t[h(1016,")goq")](t[h(1040,")goq")](t[o("qy3r",484)](n,4),t[o("d2&5",399)](r,4)),63)]),s[t[h(960,"qy3r")](t[o("qy3r",484)](r,2),63)]),"=")),t[h(1012,"Wbwc")](d,i)},charCode:function(e){var t={};function n(e,t){return c(t-1189,e)}t[n("(X98",1031)]=function(e,t){return e<t},t[u(1437,"Wfi4")]=function(e,t){return e>=t},t[n("8Oiv",797)]=function(e,t){return e<=t},t[u(1544,")FA3")]=function(e,t){return e|t},t[n("eyzX",842)]=function(e,t){return e&t},t[n("icaT",1010)]=function(e,t){return e>>t},t[n("ehxd",1005)]=function(e,t){return e&t},t[u(1274,"IUs7")]=function(e,t){return e<=t},t[u(1431,"QQD8")]=function(e,t){return e>=t},t[u(1296,"Pi4q")]=function(e,t){return e|t},t[u(1286,"HmRp")]=function(e,t){return e<t},t[n("5m^J",929)]=function(e,t){return e&t};for(var r=t,a=[],s=0,i=0;r[n(")goq",1016)](i,e[n("&QZ4",868)]);i+=1){var o=e[u(1444,"iU!(")](i);r[u(1552,"k([F")](o,0)&&r[n(")goq",867)](o,127)?(a[n("iSBn",1083)](o),s+=1):r[u(1589,"pKX5")](128,80)&&r[u(1506,"ea1u")](o,2047)?(s+=2,a[n("l3WP",948)](r[n("2)u3",1044)](192,r[n("IUs7",812)](31,r[n("bmAe",1079)](o,6)))),a[u(1349,"HmRp")](r[n("#FdB",852)](128,r[u(1435,"d2&5")](63,o)))):(r[n("b!D8",783)](o,2048)&&r[u(1581,"@b)w")](o,55295)||r[n("iSBn",1091)](o,57344)&&r[u(1304,"5**I")](o,65535))&&(s+=3,a[u(1293,"IUs7")](r[n("&QZ4",808)](224,r[u(1271,"7s0V")](15,r[u(1523,"IUs7")](o,12)))),a[u(1383,"bmAe")](r[n("K)F[",893)](128,r[n("8Oiv",822)](63,r[n(")goq",1036)](o,6)))),a[u(1528,"ehxd")](r[u(1307,"8Oiv")](128,r[n("7s0V",767)](63,o))))}function u(e,t){return l(e- -93,t)}for(var d=0;r[u(1449,"&QZ4")](d,a[n("iU!(",1039)]);d+=1)a[d]&=255;return r[u(1550,"hAY8")](s,255)?[0,s][n("lqr!",983)](a):[r[n("8Oiv",874)](s,8),r[n("v6]c",899)](s,255)][u(1310,"eyzX")](a)},es:function(e){function t(e,t){return c(t-601,e)}function n(e,t){return c(t-1307,e)}e||(e="");var r=e[t("pKX5",347)](0,255),a=[],s=f[t("pKX5",363)](r)[t("l3WP",440)](2);return a[t("(X98",237)](s[n("FYnO",1110)]),a[n("b$p#",1012)](s)},en:function(e){var t={qfBUq:function(e,t){return e(t)},dAZxv:function(e,t){return e>t},Awjkr:function(e,t){return e!==t},iQodw:function(e,t){return e%t},osGpS:function(e,t){return e/t},WAaVg:function(e,t){return e<t},zAXuB:function(e,t){return e*t},ajlCm:function(e,t){return e+t},rqCNk:function(e,t,n){return e(t,n)}};e||(e=0);var n=t[f("b$p#",-357)](p,e),r=[];t[i("Wbwc",-544)](n,0)?r[f("1F4e",-394)](0):r[f("icaT",-295)](1);for(var a=Math[f("v6]c",-143)](n)[i(")goq",-477)](2)[i("1F4e",-580)](""),s=0;t[i("S$EH",-479)](t[i("l3WP",-553)](a[f("eoa[",-252)],8),0);s+=1)a[i("#FdB",-406)]("0");function i(e,t){return c(t- -175,e)}a=a[f("bmAe",-122)]("");for(var o=Math[f("ea1u",-250)](t[i("IUs7",-415)](a[f("@b)w",-220)],8)),u=0;t[i("&QZ4",-525)](u,o);u+=1){var d=a[i("ea1u",-579)](t[i("!&EH",-278)](u,8),t[i("b!D8",-352)](t[i("bmAe",-513)](u,1),8));r[f(")goq",-253)](t[i("5**I",-555)](p,d,2))}var h=r[f("qy3r",-287)];function f(e,t){return l(t- -1753,e)}return r[i("l3WP",-548)](h),r},sc:function(e){var t={};t[r("qa*a",981)]=function(e,t){return e>t},e||(e="");var n=t[r("K)F[",1099)](e[a(561,"hAY8")],255)?e[a(498,"l3WP")](0,255):e;function r(e,t){return c(t-1390,e)}function a(e,t){return l(e- -933,t)}return f[r("@b)w",1222)](n)[a(722,"pKX5")](2)},nc:function(e){var t={DSfOA:function(e,t){return e(t)},lQiuF:function(e,t){return e/t},wABHl:function(e,t,n,r){return e(t,n,r)},hKWNF:function(e,t){return e*t},TPFZR:function(e,t){return e<t},gYcZI:function(e,t){return e*t},BApWW:function(e,t){return e+t},jiYFc:function(e,t,n){return e(t,n)}};e||(e=0);var n=Math[s(1165,"LPAx")](t[s(1012,"pKX5")](p,e))[s(931,"icaT")](2),a=Math[s(1006,"ea1u")](t[s(1147,"tCmq")](n[o(1052,"iU!(")],8));function s(e,t){return c(e-1289,t)}n=t[s(996,"hAY8")](r,n,t[o(975,"qy3r")](a,8),"0");var i=[];function o(e,t){return l(e- -584,t)}for(var u=0;t[s(1089,"IUs7")](u,a);u+=1){var d=n[s(1178,"v6]c")](t[s(1021,"IUs7")](u,8),t[s(948,"lqr!")](t[s(943,"!&EH")](u,1),8));i[s(1037,"lqr!")](t[o(928,"FYnO")](p,d,2))}return i},va:function(e){var t={ozDNt:function(e,t){return e(t)},qogTH:function(e,t,n,r){return e(t,n,r)},oAlZP:function(e,t){return e*t},XQyGR:function(e,t){return e/t},oaCId:function(e,t){return e>=t},tESBs:function(e,t){return e-t},LdvIJ:function(e,t){return e===t},tbHcV:function(e,t){return e&t},OooNI:function(e,t){return e+t},BtpBm:function(e,t){return e+t},RNMxe:function(e,t){return e>>>t}};e||(e=0);var n=Math[i(1395,"S$EH")](t[i(1365,"wReF")](p,e));function a(e,t){return c(e-276,t)}var s=n[i(1339,"bmAe")](2);function i(e,t){return l(e- -265,t)}for(var o=[],u=(s=t[a(-22,"lxO1")](r,s,t[i(1369,"iU!(")](Math[i(1185,"hAY8")](t[a(41,"bmAe")](s[i(1169,"(1SR")],7)),7),"0"))[i(1221,"Pi4q")];t[a(159,"d2&5")](u,0);u-=7){var d=s[a(60,"(5h(")](t[i(1245,"HyKD")](u,7),u);if(t[a(117,"lqr!")](t[a(82,"7s0V")](n,-128),0)){o[a(-90,"wReF")](t[a(157,"1F4e")]("0",d));break}o[a(-73,"FH!j")](t[a(-49,"v6]c")]("1",d)),n=t[i(1176,"#FdB")](n,7)}return o[i(1258,"pKX5")]((function(e){return p(e,2)}))},ek:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a={doyQe:function(e,t){return e!==t},ZnBwu:function(e,t){return e===t},wNWpl:u("ea1u",232)+u(")goq",343),DCAiW:function(e,t){return e===t},CgOGQ:u("icaT",217),XriUr:h("HyKD",858),UgrSF:function(e,t){return e>t},AQnyc:function(e,t){return e<=t},EmtLr:function(e,t){return e+t},GynqB:function(e,t,n,r){return e(t,n,r)},IsuQv:function(e,t){return e+t},hoSrd:u("ehxd",436),TnsHv:function(e,t,n){return e(t,n)},zFxvQ:function(e,t){return e-t},qpclh:function(e,t){return e>t}};if(!e)return[];var s=[],i=0;a[u("IUs7",202)](n,"")&&(a[u("icaT",159)](Object[h("5**I",734)][h("iU!(",890)][h("pKX5",909)](n),a[h("iSBn",760)])&&(i=n[h("5**I",1046)]),a[u("Wfi4",418)](void 0===n?"undefined":t(n),a[h("wReF",1037)])&&(i=(s=f.sc(n))[u("Wbwc",366)]),a[h("FYnO",886)](void 0===n?"undefined":t(n),a[h("Pi4q",943)])&&(i=(s=f.nc(n))[h("lqr!",757)]));var o=Math[u("HmRp",166)](e)[h("IUs7",981)](2),l="";function u(e,t){return c(t-541,e)}l=a[u("FH!j",130)](i,0)&&a[u("l3WP",198)](i,7)?a[h("qa*a",877)](o,a[h("hAY8",801)](r,i[h("ehxd",868)](2),3,"0")):a[h("5**I",822)](o,a[h("Wfi4",849)]);var d=[a[h("2)u3",739)](p,l[u("eyzX",433)](Math[h("S$EH",784)](a[h("v6]c",934)](l[u("HyKD",440)],8),0)),2)];if(a[h("qy3r",837)](i,7))return d[h(")FA3",815)](f.va(i),s);function h(e,t){return c(t-1155,e)}return d[u("iU!(",121)](s)},ecl:function(e){function t(e,t){return c(t-681,e)}var n={XaGBp:function(e,t){return e<t},YMftG:function(e,t,n){return e(t,n)},VANUe:function(e,t,n){return e(t,n)}},r=[],a=e[t("FYnO",438)](2)[t("&QZ4",370)]("");function s(e,t){return l(t- -117,e)}for(var i=0;n[t("b!D8",369)](a[t("l3WP",581)],16);i+=1)a[t(")FA3",420)](0);return a=a[s("d2&5",1397)](""),r[s("(1SR",1573)](n[t("k([F",368)](p,a[t("v6]c",570)](0,8),2),n[t("tCmq",442)](p,a[s("QQD8",1503)](8,16),2)),r},pbc:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t={aQnxO:function(e,t){return e(t)},NXXiw:function(e,t){return e<t},axaxt:function(e,t){return e<t},BElkO:function(e,t){return e-t}};function n(e,t){return c(e- -1,t)}var r=[],s=f.nc(t[n(-309,"!&EH")](a,e[i(-294,"b!D8")](/\s/g,"")));function i(e,t){return l(e- -1677,t)}if(t[n(-402,"v6]c")](s[n(-403,"qa*a")],4))for(var o=0;t[i(-102,"5m^J")](o,t[n(-427,"!&EH")](4,s[n(-268,"d2&5")]));o++)r[i(-76,"#FdB")](0);return r[i(-175,"LPAx")](s)},gos:function(e,t){function n(e,t){return l(e- -688,t)}var r={};function a(e,t){return l(t- -1821,e)}r[a("wReF",-400)]=function(e,t){return e===t},r[n(978,"Pi4q")]=a("1F4e",-314);var s=r,i=Object[n(961,"LPAx")](e)[n(736,"K)F[")]((function(t){function r(e,t){return n(t- -25,e)}function i(e,t){return a(t,e-1533)}return s[i(1315,"FH!j")](t,s[r("S$EH",826)])||s[i(1377,"k([F")](t,"c")?"":t+":"+e[t][r("qy3r",854)]()+","}))[n(962,"qa*a")]("");return a("M#pd",-261)+t+"={"+i+"}"},budget:function(e,t){function n(e,t){return c(t-1801,e)}var r={};function a(e,t){return c(t- -18,e)}r[a("K)F[",-409)]=function(e,t){return e===t},r[a("v6]c",-273)]=function(e,t){return e>=t},r[a("S$EH",-187)]=function(e,t){return e+t};var s=r;return s[n("d2&5",1593)](e,64)?64:s[n("tCmq",1471)](e,63)?t:s[n("lqr!",1393)](e,t)?s[a("d2&5",-430)](e,1):e},encode:function(e,n){var r={EAnrQ:function(e,t){return e<t},sJtws:u(-298,"eyzX")+u(-249,"HmRp")+u(-149,"LPAx")+u(-165,"5**I")+s(537,"v6]c")+u(-113,"K)F[")+u(-286,"HmRp"),ieKdo:function(e,t){return e<t},mmivi:function(e,t){return e!==t},OaRTp:u(-202,"M#pd"),hjaOS:function(e,t){return e*t},GCemu:s(601,"2)u3")+s(520,"k([F")+"|2",GmaVb:function(e,t){return e>>t},NYCOo:function(e,t){return e-t},eTrxI:function(e,t){return e|t},XOstE:function(e,t){return e<<t},mEnIi:function(e,t){return e&t},gJgsQ:function(e,t){return e+t},KPCyN:function(e,t){return e+t},vsnfG:function(e,t){return e+t},XlToV:function(e,t){return e+t},VDNXf:function(e,t){return e|t},fnaNP:function(e,t){return e<<t},WCTJq:function(e,t){return e&t},lNOfd:function(e,t){return e-t},SUaqZ:function(e,t){return e(t)},Eortz:function(e,t){return e(t)},TsVmD:function(e,t){return e!==t},vXNda:function(e,t,n){return e(t,n)},hsJou:function(e,t,n){return e(t,n)},iLFBA:function(e,t,n){return e(t,n)},Cikzn:function(e,t){return e&t}},a={"_bÇ":e,_bK:0,_bf:function(){function t(e,t){return u(e-505,t)}return e[t(374,"ea1u")](a[t(277,"@b)w")]++)}};function s(e,t){return c(e-825,t)}var i={"_ê":[],"_bÌ":-1,"_á":function(e){i[s(457,"5m^J")]++,i["_ê"][i[s(483,"S$EH")]]=e},"_bÝ":function(){function e(e,t){return u(t-1628,e)}return _bÝ[e("ea1u",1360)]--,r[e("!&EH",1430)](_bÝ[e("lxO1",1444)],0)&&(_bÝ[u(-328,"lqr!")]=0),_bÝ["_ê"][_bÝ[e("QQD8",1429)]]}},o="";function u(e,t){return l(e- -1755,t)}for(var d,h,p,f,m=r[u(-136,"qa*a")],g=0;r[s(710,"FH!j")](g,m[u(-379,"k([F")]);g++)i["_á"](m[s(455,")goq")](g));i["_á"]("=");var y=r[s(728,"(5h(")](void 0===n?"undefined":t(n),r[s(432,"k([F")])?Math[u(-172,"5**I")](r[u(-365,"7s0V")](Math[s(474,"Wbwc")](),64)):-1;for(g=0;r[s(494,"ea1u")](g,e[u(-70,"HyKD")]);g=a[u(-394,"8Oiv")])for(var b=r[s(697,"!&EH")][u(-374,"1F4e")]("|"),v=0;;){switch(b[v++]){case"0":d=r[s(412,"K)F[")](i["_ê"][r[s(665,"FH!j")](i[u(-288,"eoa[")],2)],2);continue;case"1":p=r[u(-317,"iU!(")](r[s(700,"lqr!")](r[u(-332,"5**I")](i["_ê"][r[s(634,"#FdB")](i[s(568,"(5h(")],1)],15),2),r[u(-292,"QQD8")](i["_ê"][i[s(698,"!&EH")]],6));continue;case"2":o=r[u(-164,")FA3")](r[s(446,"S$EH")](r[u(-126,"!&EH")](r[u(-387,"IUs7")](o,i["_ê"][d]),i["_ê"][h]),i["_ê"][p]),i["_ê"][f]);continue;case"3":h=r[u(-150,"ea1u")](r[s(440,"8Oiv")](r[u(-322,"qy3r")](i["_ê"][r[u(-120,")goq")](i[s(686,"ehxd")],2)],3),4),r[u(-194,"l3WP")](i["_ê"][r[s(696,"M#pd")](i[u(-101,"iU!(")],1)],4));continue;case"4":r[s(469,"M#pd")](isNaN,i["_ê"][r[s(543,"S$EH")](i[u(-328,"lqr!")],1)])?p=f=64:r[s(580,"v6]c")](isNaN,i["_ê"][i[s(621,"HmRp")]])&&(f=64);continue;case"5":i[u(-393,"wReF")]-=3;continue;case"6":r[s(490,")FA3")](void 0===n?"undefined":t(n),r[s(605,"iU!(")])&&(d=r[s(437,"iSBn")](n,d,y),h=r[s(411,"iU!(")](n,h,y),p=r[u(-161,"iSBn")](n,p,y),f=r[u(-64,"v6]c")](n,f,y));continue;case"7":i["_á"](a[s(635,"1F4e")]());continue;case"8":i["_á"](a[u(-296,")goq")]());continue;case"9":f=r[s(608,"wReF")](i["_ê"][i[u(-184,"lxO1")]],63);continue;case"10":i["_á"](a[s(695,"IUs7")]());continue}break}return r[s(602,"7s0V")](o[s(544,"icaT")](/=/g,""),m[y]||"")}};e[c(-228,"b!D8")]=f}).call(this,n(1)(e))},function(e,n,r){(function(e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(){function e(e,t){return ee(t-107,e)}function t(e,t){return ee(t-903,e)}for(var n=ae();;)try{if(parseInt(e("S@lO",757))/1+parseInt(t("QovG",1661))/2*(parseInt(t("(meS",1154))/3)+-parseInt(t("hIzm",1453))/4*(parseInt(t("3(AN",1761))/5)+parseInt(t("C6fO",1444))/6*(-parseInt(t("$nFE",1498))/7)+-parseInt(t("Y]ar",1819))/8*(-parseInt(t("Pt@f",1181))/9)+parseInt(e("3(AN",770))/10+-parseInt(t("N)xu",1303))/11*(parseInt(t("AcT^",1284))/12)==866438)break;n.push(n.shift())}catch(r){n.push(n.shift())}}();var s=r(5),i=r(3),o=r(14),l=0,u=void 0,c=void 0,d=0,h=[],p=function(){},f=void 0,m=void 0,g=void 0,y=void 0,b=void 0,v=void 0,A=(void 0===t?"undefined":n(t))===M("S@lO",-557)?null:t;if(("undefined"==typeof window?"undefined":n(window))!==ie(647,"griD"))for(var x=(ie(947,"q]CY")+"0")[M("YYv%",-348)]("|"),k=0;;){switch(x[k++]){case"0":v=M("ChZ!",-21)+"rt"in f[M("q]CY",-287)];continue;case"1":m=f[ie(518,"AcT^")];continue;case"2":f=window;continue;case"3":y=f[ie(897,"@xF@")];continue;case"4":b=f[ie(834,"Imsz")];continue;case"5":g=f[M("54^6",-428)];continue}break}var w=function(){var e={};function t(e,t){return M(t,e-136)}function a(e,t){return ie(t- -397,e)}e[a("dE%z",652)]=function(e,t){return e!==t},e[t(131,"Q2Sc")]=t(-330,"wAHi"),e[a("l!WU",308)]=function(e,t){return e<t},e[t(-123,"Imsz")]=a(")8Bu",303),e[a("SYaz",199)]=function(e,t){return e!==t},e[t(-160,"N)xu")]=function(e,t){return e===t},e[a("l!WU",-53)]=function(e,t){return e!==t},e[a("jU*K",458)]=t(32,"hIzm"),e[a("(f2U",163)]=function(e,t){return e!==t},e[t(-286,"36]w")]=function(e,t){return e===t},e[a("PZV1",442)]=function(e,t){return e===t},e[t(90,"Pt@f")]=t(-183,"]HJo"),e[a("WWJ$",463)]=function(e,t){return e===t},e[t(-8,"AcT^")]=t(81,"tt&(")+a("ChZ!",234),e[a("(meS",11)]=function(e,t){return e===t},e[a("Uj2C",2)]=function(e,t){return e in t},e[a("wAHi",176)]=t(-328,"l1Y6"),e[a("DKL#",396)]=function(e,t){return e>t},e[a("(f2U",323)]=a("36]w",455)+"r",e[a(")8Bu",406)]=function(e,t){return e>t},e[t(5,"Acl^")]=a("l!WU",425)+"e";var s=e,i=[];s[a("QYdW",95)](n(f[a("3(AN",218)+"t"]),s[t(171,"QYdW")])||s[a("7hxe",445)](n(f[a("Q2Sc",135)]),s[a("8RnY",646)])?i[0]=1:i[0]=s[t(-248,"tt&(")](f[a("k&f(",181)+"t"],1)||s[a("(8!5",539)](f[a("Q2Sc",135)],1)?1:0,i[1]=s[a("jU*K",599)](n(f[t(-59,"(8!5")+"m"]),s[a("Q2Sc",630)])||s[a("(8!5",-52)](n(f[t(-335,"Imsz")]),s[a("SlDP",555)])?1:0,i[2]=s[t(-478,"3(AN")](n(f[a("U02M",221)]),s[a("l!WU",360)])?0:1,i[3]=s[a("griD",148)](n(f[a("PZV1",226)]),s[a("Imsz",356)])?0:1,i[4]=s[a("(9D4",260)](n(f[t(-398,"DKL#")]),s[t(-246,"U02M")])?0:1,i[5]=s[a("Q2Sc",654)](m[t(-423,"54^6")],!0)?1:0,i[6]=s[t(-148,"wAHi")](n(f[a("hIzm",41)+t(-373,"wAHi")]),s[a("wAHi",392)])&&s[a("WWJ$",381)](n(f[a("SYaz",363)+t(-104,"k&f(")+t(123,"PZV1")]),s[t(116,"PZV1")])?0:1;try{s[a("WWJ$",381)](n(Function[t(-383,"(f2U")][a("C6fO",289)]),s[t(-476,"l1Y6")])&&(i[7]=1),s[a(")8Bu",345)](Function[a("wAHi",642)][a("l1Y6",113)][t(-339,"36]w")]()[a("griD",169)](/bind/g,s[t(-69,"ChZ!")]),Error[t(-92,"PZV1")]())&&(i[7]=1),s[a("U02M",491)](Function[a("1*rM",567)][a("YxiJ",431)][a("YYv%",549)]()[t(-270,"Acl^")](/toString/g,s[t(-320,"Q2Sc")]),Error[t(-418,"Acl^")]())&&(i[7]=1)}catch(o){i[7]=0}i[8]=m[t(-266,"dE%z")]&&s[t(-415,"SlDP")](m[a("S@lO",-39)][t(-465,"C6fO")],0)?1:0,i[9]=s[t(-77,"DKL#")](m[a("C6fO",398)],"")?1:0,i[10]=s[t(114,"7hxe")](f[t(-453,"Acl^")],s[t(-407,"(9D4")])&&s[t(-16,"WWJ$")](f[a("QovG",613)],s[t(104,"SlDP")])?1:0,i[11]=f[t(-486,"QYdW")]&&!f[t(-179,"S@lO")][a("54^6",32)]?1:0,i[12]=s[t(-174,"YYv%")](f[a("q]CY",472)],void 0)?1:0,i[13]=s[t(-50,"YYv%")](s[t(-434,"EGti")],m)?1:0,i[14]=m[a("1*rM",590)+t(-79,"%4m!")](s[a("AcT^",-16)])?1:0,i[15]=b[a("(meS",629)]&&s[a("(9D4",71)](b[a("3(AN",399)][a("U02M",93)]()[a("q]CY",553)](s[t(-199,"36]w")]),-1)?1:0;try{i[16]=r(!function(){var e=new Error("Cannot find module 'child_process'");throw e.code="MODULE_NOT_FOUND",e}())?1:0}catch(o){i[16]=0}try{i[17]=s[t(-527,"dE%z")](f[t(-337,"(9D4")][a("griD",123)+t(82,"k&f(")][a("ChZ!",521)]()[a("54^6",288)](s[t(-223,"7hxe")]),-1)?0:1}catch(o){i[17]=0}return i};function S(e){var t={fvzIs:function(e,t){return e(t)},mblsy:r("54^6",1202)},n=function(e){var t;return a(t={},i(834,"N)xu")+e+(i(884,"Y]ar")+i(1054,"Uj2C")),!0),a(t,r("WWJ$",1276)+r("QovG",1774)+e+(i(894,"U02M")+r("Uj2C",1538)),!0),a(t,i(1226,"(8!5")+r(")8Bu",1770)+i(1074,"YxiJ"),!0),a(t,i(970,"@xF@")+e+(i(1375,"YxiJ")+r("36]w",1208)+r("PZV1",1773)),!0),a(t,i(1243,"54^6")+i(866,"Uj2C")+e+(i(951,"Pt@f")+r("aDkK",1702)+i(1008,"N)xu")),!0),a(t,r("Pt@f",1338)+r("tt&(",1581)+r("jU*K",1504)+r("k&f(",1379),!0),t};function r(e,t){return M(e,t-1866)}var s=Function[i(849,"SlDP")][i(907,"36]w")][i(920,"U02M")](e);function i(e,t){return M(t,e-1382)}var o=Function[r("SYaz",1215)][i(718,"54^6")][r("N)xu",1752)](e[i(905,"Uj2C")]),l=e[i(865,")8Bu")][r("l!WU",1615)](/get\s/,"");return t[r("%4m!",1335)](n,l)[s]&&t[i(1103,"l1Y6")](n,t[i(1314,"hIzm")])[o]||!1}function C(e,t,r){var a={};a[i(170,"Pt@f")]=function(e,t){return e>t},a[c("]HJo",1169)]=function(e,t){return e<t},a[i(558,"YxiJ")]=function(e,t){return e-t},a[i(440,"SYaz")]=function(e,t){return e-t},a[i(256,"jU*K")]=function(e,t){return e!==t},a[c("QYdW",1198)]=i(178,"Acl^"),a[i(416,"N)xu")]=function(e,t){return e>t},a[c("Q2Sc",827)]=function(e,t){return e>t};var s=a;function i(e,t){return M(t,e-757)}var o=t||f[i(194,"Imsz")];if(s[c("YYv%",704)](o[i(651,"$nFE")],0)){if(e[i(211,"YYv%")+"mp"]&&s[i(458,"U02M")](s[c("griD",1360)](o[i(247,"l1Y6")],e[c("Y]ar",730)+"mp"]),15))return;e[c("griD",877)+"mp"]=o[c("YxiJ",1225)]}var u={};function c(e,t){return ie(t-315,e)}u[c("ChZ!",1343)]=o[i(140,"griD")].id||"",u[c("C6fO",919)]=s[c(")8Bu",797)](g[i(312,"(9D4")](),l);var d=o[c("griD",868)+i(365,"dE%z")];d&&d[c(")8Bu",1299)]?(u[c("AcT^",923)]=d[0][c("1*rM",822)],u[c("%4m!",1199)]=d[0][c("YxiJ",830)]):(u[i(659,"aDkK")]=o[c("U02M",1096)],u[c("Q2Sc",1353)]=o[c("wAHi",957)]),s[i(761,"EGti")](void 0===r?"undefined":n(r),s[i(682,"griD")])?(e[i(706,"Uj2C")][r][c("wAHi",1321)](u),s[c("Y]ar",1133)](e[c("(8!5",750)][r][c("l!WU",685)],e[c("jU*K",1079)])&&e[i(471,"1*rM")][r][c("C6fO",1029)]()):(e[c("WWJ$",798)][c("1*rM",885)](u),s[c("7hxe",1142)](e[i(162,"7hxe")][c("N)xu",1271)],e[c("%4m!",1148)])&&e[i(304,"SYaz")][c("hIzm",1254)]())}function I(e){var t={};function n(e,t){return M(t,e-943)}t[n(298,"U02M")]=function(e,t){return e===t};var r=t,a={};function s(e,t){return M(t,e-1062)}return(f[s(995,"k&f(")][s(724,"PZV1")]?f[n(523,"(meS")][n(725,"hIzm")][n(662,"Imsz")]("; "):[])[s(900,"k&f(")]((function(t){var i=t[u("YxiJ",-653)]("="),o=i[c("jU*K",1076)](1)[u("griD",-243)]("="),l=i[0][c("ChZ!",1119)](/(%[0-9A-Z]{2})+/g,decodeURIComponent);function u(e,t){return n(t- -975,e)}function c(e,t){return s(t-156,e)}return o=o[c("aDkK",994)](/(%[0-9A-Z]{2})+/g,decodeURIComponent),a[l]=o,r[c("3(AN",630)](e,l)})),e?a[e]||"":a}function W(e){function t(e,t){return ie(t-480,e)}if(!e||!e[n("q]CY",-387)])return[];function n(e,t){return ie(t- -986,e)}var r=[];return e[t("C6fO",1491)]((function(e){function a(e,t){return n(t,e-1662)}function s(e,n){return t(n,e- -564)}var o=i.sc(e[s(596,"1[03")]);r=r[a(1365,"Pt@f")](i.va(e[a(1205,"Uj2C")]),i.va(e[a(1548,"Uj2C")]),i.va(e[a(1269,"k&f(")]),i.va(o[s(793,"Acl^")]),o)})),r}var _={data:[],maxLength:1,init:function(){var e={};function t(e,t){return ie(e-519,t)}e[a("8RnY",-76)]=a("griD",502)+a("(meS",456),e[a("1[03",-24)]=t(1073,"Uj2C")+a("DKL#",259),e[t(1226,"hIzm")]=a("F[!2",474)+t(1536,"tt&("),e[a("S@lO",205)]=function(e,t){return e+t};var n=e,r=i[a("dE%z",60)](this,n[t(964,"AcT^")]);function a(e,t){return ie(t- -512,e)}var s=i[t(1328,"l!WU")](T,v?n[t(975,"YYv%")]:n[t(862,"Uj2C")]);this.c=i[a("YYv%",144)](n[t(1057,"QovG")](r,s))},handleEvent:function(e){({vIhoK:function(e,t,n){return e(t,n)}})[M("l!WU",-301)](C,this,e)},packN:function(){var e={uzOqT:function(e,t){return e===t},pDSzS:function(e,t){return e(t)}};if(e[t("(8!5",1357)](this[t("jU*K",883)][t("N)xu",1339)],0))return[];function t(e,t){return ie(t-383,e)}function n(e,t){return M(t,e-1877)}return[][t("S@lO",790)](i.ek(4,this[t("Y]ar",826)]),e[n(1866,"]HJo")](W,this[t("QYdW",1113)]))[n(1295,"N)xu")](this.c)}},T={data:[],maxLength:1,handleEvent:function(e){d++,{KvmCh:function(e,t,n){return e(t,n)}}[ie(851,"Imsz")](C,this,e)},packN:function(){var e={lsbtf:function(e,t){return e===t},BtfTk:function(e,t){return e(t)}};function t(e,t){return M(t,e-1552)}function n(e,t){return ie(t-489,e)}return e[t(1014,"q]CY")](this[n("dE%z",1493)][n("]HJo",1531)],0)?[]:[][n("ChZ!",1449)](i.ek(v?1:2,this[t(1418,"l1Y6")]),e[t(1363,"3(AN")](W,this[n("@xF@",893)]))}},N={data:[],maxLength:30,handleEvent:function(e){function t(e,t){return ie(t- -256,e)}var n={WJglf:function(e,t,n,r){return e(t,n,r)},Zssyc:function(e,t,n){return e(t,n)}};v?(!this[t("YxiJ",252)][d]&&(this[ie(820,"Acl^")][d]=[]),n[t("@xF@",329)](C,this,e,d)):n[t("l!WU",534)](C,this,e)},packN:function(){function e(e,t){return M(e,t-1566)}var t={XHUBd:function(e,t){return e(t)},GaTmm:function(e,t){return e-t},pBLVb:function(e,t){return e>=t},tKBtH:function(e,t){return e>t},isYjN:function(e,t){return e>=t},XeHnc:function(e,t){return e===t},JJTky:function(e,t){return e(t)}},n=[];if(v){n=this[e("griD",1594)][l(1155,"WWJ$")]((function(e){return e&&e[l(1734,")8Bu")]>0}));for(var r=0,a=t[l(1369,"DKL#")](n[l(1152,"EGti")],1);t[e("54^6",1223)](a,0);a--){r+=n[a][e("$nFE",1600)];var s=t[l(1391,"U02M")](r,this[e("jU*K",1318)]);if(t[l(1351,"Q2Sc")](s,0)&&(n[a]=n[a][l(1363,")8Bu")](s)),t[l(1431,"AcT^")](s,0)){n=n[e("3(AN",1397)](a);break}}}else n=this[l(1494,"k&f(")];if(t[l(1273,"WWJ$")](n[e("jU*K",1336)],0))return[];var o=[][e("1[03",1002)](i.ek(v?24:25,n));function l(e,t){return ie(e-750,t)}return v?n[e("1*rM",1163)]((function(n){function r(e,t){return l(t- -280,e)}o=(o=o[r("N)xu",900)](i.va(n[e("36]w",1345)])))[r("griD",1518)](t[r("l!WU",1045)](W,n))})):o=o[l(1579,"3(AN")](t[e("@xF@",1352)](W,this[l(1529,"8RnY")])),o}},E={data:[],maxLength:3,handleEvent:function(){var e={};function t(e,t){return ie(e-362,t)}e[t(1296,"q]CY")]=function(e,t){return e>t},e[s("Uj2C",300)]=function(e,t){return e-t},e[s("]HJo",333)]=function(e,t){return e>t};var n=e,r={},a=f[s("SlDP",395)][t(1284,"dE%z")+t(1357,"YxiJ")][s("WWJ$",250)]||f[t(1350,"Uj2C")][s("U02M",-50)][t(763,"QYdW")];function s(e,t){return M(e,t-597)}n[t(1341,"8RnY")](a,0)&&(r[t(989,"QovG")]=a,r[s("Acl^",272)]=n[t(988,"54^6")](g[t(837,")8Bu")](),l),this[s("8RnY",364)][t(1193,"@xF@")](r),n[s("U02M",116)](this[s("S@lO",321)][t(1177,"@xF@")],this[s("AcT^",306)])&&this[s("(f2U",492)][s("]HJo",474)]())},packN:function(){function e(e,t){return M(e,t-1364)}if(v&&this[e("YYv%",850)+"t"](),!this[e("YYv%",822)][e("jU*K",1134)])return[];var t=[][n(205,")8Bu")](i.ek(3,this[n(-50,"1[03")]));function n(e,t){return ie(e- -675,t)}return this[n(-298,"l!WU")][n(28,"QovG")]((function(n){function r(t,n){return e(n,t- -1364)}t=t[e("3(AN",1181)](i.va(n[r(-673,"wAHi")]),i.va(n[r(38,"aDkK")]))})),t}},R={init:function(){var e={};e[r("(8!5",1382)]=n("dE%z",75)+"fo";var t=e;function n(e,t){return M(e,t-90)}function r(e,t){return M(e,t-1501)}this[n("l!WU",-545)]={},this[r("Q2Sc",990)][n("EGti",-575)]=f[n("griD",-75)][r("Pt@f",1354)],this[n("QYdW",-192)][n("EGti",45)]=f[n("@xF@",-544)][r("1[03",1523)],this.c=i[n("(8!5",-560)](i[n("EGti",-212)](this,t[r("Imsz",886)]))},packN:function(){var e={};function t(e,t){return M(t,e-342)}e[t(70,"C6fO")]=function(e,t){return e&&t},e[d("griD",437)]=function(e,t){return e>t},e[d("EGti",419)]=function(e,t){return e===t};var n=e,r=i.ek(7),a=this[d("l1Y6",410)],s=a.href,o=void 0===s?"":s,l=a.port,u=void 0===l?"":l;if(n[d("l!WU",283)](!o,!u))return[][t(-208,"8RnY")](r,this.c);var c=n[d("YxiJ",109)](o[t(-251,"3(AN")],128)?o[t(339,"C6fO")](0,128):o;function d(e,t){return ie(t- -468,e)}var h=i.sc(c);return[][t(-24,"k&f(")](r,i.va(h[d("DKL#",300)]),h,i.va(u[t(314,")8Bu")]),n[d("Acl^",547)](u[t(286,"N)xu")],0)?[]:i.sc(this[t(-111,"SYaz")][t(-258,"YxiJ")]),this.c)}},$={init:function(){function e(e,t){return M(e,t-22)}function t(e,t){return M(e,t-1827)}this[e("U02M",35)]={},this[t("QYdW",1545)][e("54^6",-346)]=f[e("1*rM",-447)][e("EGti",-633)],this[t("F[!2",1470)][t("54^6",1341)+"t"]=f[e("Uj2C",-533)][e("8RnY",-356)+"t"]},packN:function(){function e(e,t){return M(e,t-450)}return[][e("Uj2C",339)](i.ek(8),i.va(this[e("l1Y6",316)][e("SYaz",6)]),i.va(this[ie(819,"N)xu")][e("SlDP",-112)+"t"]))}},O={init:function(){var e={};function t(e,t){return ie(t- -1059,e)}function n(e,t){return M(e,t-398)}e[n("3(AN",132)]=function(e,t){return e+t},e[t("(8!5",-316)]=function(e,t){return e*t},e[n("Y]ar",223)]=function(e,t){return e+t};var r=e;this[t("U02M",-34)]=r[n("F[!2",261)](f[n("]HJo",131)](r[t("54^6",-206)](y[t("Acl^",-625)](),r[n("k&f(",-78)](y[n("tt&(",-229)](2,52),1)[n("1*rM",-201)]()),10),f[n("N)xu",0)](r[n("jU*K",351)](y[t("Y]ar",-286)](),r[t("Q2Sc",-367)](y[n("ChZ!",-196)](2,30),1)[t("3(AN",-86)]()),10))+"-"+u},packN:function(){function e(e,t){return ie(t-517,e)}return this[e("QYdW",1275)](),[][e("8RnY",979)](i.ek(9,this[M("(8!5",-577)]))}},F={data:[],init:function(){function e(e,t){return M(e,t-1644)}this[e("N)xu",1451)]={PqHow:function(e){return e()}}[e("YYv%",1591)](w)},packN:function(){var e={crWSj:t(775,"Acl^")+n(1394,"tt&(")+n(1068,"@xF@")+"ay",mCtYb:n(1081,"$nFE")+t(585,"Imsz")+n(973,"S@lO")+n(1633,")8Bu"),PwKCs:t(600,"(8!5")+n(1372,"(8!5")+t(779,"wAHi")+n(1638,"]HJo"),Xrlbt:function(e,t){return e(t)},aONGn:function(e,t){return e<t},IHMQg:function(e,t){return e<<t}};try{this[n(1353,"k&f(")][18]=Object[n(1423,"AcT^")](f[t(773,"C6fO")])[t(356,"l!WU")]((function(e){return f[n(1029,"PZV1")][e]&&f[n(1136,"]HJo")][e][t(292,"WWJ$")]}))?1:0}catch(s){this[n(1570,"Uj2C")][18]=0}function t(e,t){return ie(e- -202,t)}function n(e,t){return M(t,e-1621)}try{this[t(306,"YxiJ")][19]=[e[t(554,"hIzm")],e[n(975,"Uj2C")],e[t(776,"Imsz")]][t(409,"YYv%")]((function(e){return!!f[e]}))?1:0}catch(s){this[t(235,"(meS")][19]=0}if(Element[n(1368,"]HJo")][n(1612,"36]w")+"ow"])try{this[n(1622,"]HJo")][20]=e[n(1558,"N)xu")](S,Element[t(606,"hIzm")][n(1480,"YYv%")+"ow"])?0:1}catch(s){this[n(1421,"DKL#")][20]=1}else this[t(688,"%4m!")][20]=0;for(var r=0,a=0;e[t(470,"36]w")](a,this[t(542,"k&f(")][t(258,"ChZ!")]);a++)r+=e[n(1333,"%4m!")](this[t(811,"]HJo")][a],a);return[][n(1255,"k&f(")](i.ek(10),i.va(r))}},D={init:function(){function e(e,t){return M(e,t- -58)}this[e("Imsz",-235)]=i[e("1*rM",-34)](f[e("AcT^",-599)][ie(521,")8Bu")]?f[e("hIzm",-720)][e("Pt@f",-205)]:"")},packN:function(){function e(e,t){return M(e,t-654)}if(!this[t(1134,"SlDP")][e("]HJo",325)]()[t(1042,"Pt@f")])return[];function t(e,t){return M(t,e-1497)}return[][t(1101,"(f2U")](i.ek(11),this[e("54^6",237)])}};function M(e,t){return ee(t- -908,e)}var L={init:function(){function e(e,t){return ie(t-801,e)}this[e("PZV1",1406)]=f[e("Acl^",1281)+e("QovG",1718)+"nt"]?"y":"n"},packN:function(){function e(e,t){return ie(e- -1054,t)}return[][e(-60,"U02M")](i.ek(12,this[e(-637,"7hxe")]))}},B={init:function(){function e(e,t){return ie(e- -1097,t)}this[e(-492,"PZV1")]=f[e(-238,"(9D4")+M("1*rM",-346)]?"y":"n"},packN:function(){function e(e,t){return ie(t-798,e)}return[][e("k&f(",1444)](i.ek(13,this[e("(f2U",1705)]))}},P={init:function(){function e(e,t){return ie(e-748,t)}var t={};t[e(1215,"54^6")]=function(e,t){return e-t};var n=t;this[M("aDkK",-81)]=n[e(1254,"%4m!")](g[e(1360,"QYdW")](),c)},packN:function(){function e(e,t){return ie(t-878,e)}return this[e("tt&(",1616)](),[][e("aDkK",1355)](i.ek(14,this[M("hIzm",-572)]))}},z={init:function(){this[ie(770,"Pt@f")]=m[ie(1037,"(f2U")]},packN:function(){function e(e,t){return M(e,t-1467)}if(!this[e("1[03",1080)][t("36]w",1395)])return[];function t(e,t){return ie(t-604,e)}return[][t("(f2U",1220)](i.ek(15,this[e("wAHi",818)]))}},G={init:function(){function e(e,t){return M(e,t-669)}this[e("36]w",640)]={LmvHQ:function(e){return e()}}[e("3(AN",30)](o)},packN:function(){var e=this,t={};t[r(-106,"(meS")]=o("aDkK",1231)+r(540,"WWJ$"),t[o("dE%z",1526)]=o("U02M",1162)+r(-95,"]HJo");var n=t;function r(e,t){return ie(e- -478,t)}var a=[],s={};function o(e,t){return ie(t-588,e)}return s[n[o("N)xu",1077)]]=16,s[n[o("l1Y6",1168)]]=17,Object[r(104,"S@lO")](this[o("1[03",1213)])[r(234,"Uj2C")]((function(t){function n(e,t){return r(e-805,t)}var l=[][n(730,"(meS")](e[n(1106,"8RnY")][t]?i.ek(s[t],e[o("1[03",1213)][t]):[]);a[n(1299,"1[03")](l)})),a}},V={init:function(){var e={};function t(e,t){return ie(t- -961,e)}e[r("54^6",1179)]=function(e,t){return e>t};var n=e;function r(e,t){return ie(t-826,e)}var a=f[t("QYdW",-609)][t("1*rM",-592)]||"",s=a[t("hIzm",-400)]("?");this[r("YxiJ",1334)]=a[t("jU*K",-91)](0,n[r("ChZ!",1609)](s,-1)?s:a[r("l1Y6",1414)])},packN:function(){if(!this[e("l!WU",-320)][e("Uj2C",235)])return[];function e(e,t){return ie(t- -697,e)}return[][e("DKL#",238)](i.ek(18,this[ie(931,"aDkK")]))}},U={init:function(){var e={bExfy:function(e,t){return e(t)},uGOfA:t("Uj2C",820)+"d"};function t(e,t){return M(e,t-987)}function n(e,t){return M(e,t-769)}this[n("(9D4",739)]=e[n("S@lO",624)](I,e[t("SlDP",403)])},packN:function(){if(!this[e(1683,"DKL#")][e(1682,"7hxe")])return[];function e(e,t){return M(t,e-1883)}function t(e,t){return ie(e- -575,t)}return[][t(160,"F[!2")](i.ek(19,this[t(-158,"7hxe")]))}},H={init:function(){var e={QrEON:function(e,t){return e(t)},RnUlE:t("1*rM",-217)};function t(e,t){return ie(t- -841,e)}this[t("Y]ar",-398)]=e[t("l!WU",-16)](I,e[t("Pt@f",16)])},packN:function(){if(!this[e(1557,"DKL#")][ie(460,"ChZ!")])return[];function e(e,t){return ie(e-745,t)}return[][e(1242,"1*rM")](i.ek(20,this[e(1749,"dE%z")]))}},j={data:0,packN:function(){return[][M("(f2U",-396)](i.ek(21,this[ie(437,"(meS")]))}},q={init:function(e){this[M("U02M",13)]=e},packN:function(){return[][ie(830,"SlDP")](i.ek(22,this[ie(835,"Imsz")]))}},Q={init:function(){function e(e,t){return ie(e-839,t)}var t={GmmJd:function(e,t){return e(t)},ztZTD:n(1164,"(meS")};function n(e,t){return M(t,e-1318)}this[n(1267,"Uj2C")]=t[e(1219,"%4m!")](I,t[e(1537,"1[03")])},packN:function(){if(!this[e(-234,")8Bu")][e(-191,"EGti")])return[];function e(e,t){return M(t,e-419)}function t(e,t){return ie(e- -608,t)}return[][t(-160,"1[03")](i.ek(23,this[t(-3,"PZV1")]))}},X={init:function(){var e={};function t(e,t){return ie(t- -515,e)}function r(e,t){return ie(e-95,t)}e[t("1*rM",155)]=function(e,t){return e>t},e[r(571,"3(AN")]=t("YYv%",414),e[r(991,"EGti")]=function(e,t){return e!==t},e[r(817,"QYdW")]=t("7hxe",433),e[r(1050,")8Bu")]=function(e,t){return e===t},e[r(451,"tt&(")]=t("Pt@f",179)+r(568,"36]w")+t("8RnY",474)+r(716,"(f2U"),e[r(549,"l1Y6")]=function(e,t){return e<t},e[t("DKL#",321)]=function(e,t){return e<<t};for(var a=e,s=[f[r(437,"PZV1")]||f[r(959,"l!WU")]||m[t("Q2Sc",7)]&&a[r(1118,"SYaz")](m[r(1006,"(8!5")][r(674,"SlDP")](a[r(470,"S@lO")]),-1)?1:0,a[r(608,"(9D4")]("undefined"==typeof InstallTrigger?"undefined":n(InstallTrigger),a[r(689,")8Bu")])?1:0,/constructor/i[r(469,"aDkK")](f[t("QovG",428)+"t"])||a[t("EGti",526)]((f[r(436,"1[03")]&&f[t("8RnY",232)][r(756,"C6fO")+t("7hxe",61)]||"")[t("Uj2C",20)](),a[t("YxiJ",334)])?1:0,f[r(727,"S@lO")]&&f[r(773,"Acl^")][t("q]CY",18)+"de"]||f[t("Imsz",478)]||f[r(1080,"3(AN")]?1:0,f[r(832,"(8!5")]&&(f[r(1019,"1[03")][t("aDkK",361)]||f[t("griD",40)][t("(f2U",-76)])?1:0],i=0,o=0;a[t("aDkK",461)](o,s[r(1128,"WWJ$")]);o++)i+=a[r(1095,"Q2Sc")](s[o],o);this[r(658,"EGti")]=i},packN:function(){function e(e,t){return M(t,e-1136)}return[][e(800,"Y]ar")](i.ek(26),i.va(this[e(773,"SlDP")]))}},Z={packN:function(){var e={};function t(e,t){return ie(t- -483,e)}e[t("hIzm",-62)]=function(e,t){return e===t},e[t("N)xu",176)]=t(")8Bu",-77);var n=e;function r(e,t){return ie(e- -1037,t)}return this[r(-54,"36]w")]=n[r(-213,"Imsz")](f[t("WWJ$",266)][r(-401,"8RnY")+r(-107,"SYaz")],n[r(-610,"jU*K")])?1:0,[][t("F[!2",252)](i.ek(27),i.va(this[r(-611,"q]CY")]))}},K={init:function(){var e={vCBGn:function(e,t){return e===t},tQicC:t("hIzm",385),fkJEI:function(e,t){return e===t},UHWex:t("aDkK",315),Ouhaj:n("8RnY",1124),EZGjD:function(e,t){return e(t)},yBBXE:n("U02M",1445),hKIUR:function(e,t){return e(t)},eLoGi:n("Imsz",975)+n("%4m!",1300)+n("dE%z",1464)+n("Y]ar",1169)+'2"'};function t(e,t){return M(e,t-631)}function n(e,t){return M(e,t-1594)}try{var r=f[t("36]w",545)][n("AcT^",1456)+t("(9D4",256)](e[n("7hxe",1422)]),a=function(a){function s(e,n){return t(n,e-918)}function i(e,t){return n(t,e- -107)}try{var o=r[s(1166,"AcT^")+"e"](a);return e[s(1002,"Imsz")](o,e[s(1128,"]HJo")])?1:e[s(1134,"(8!5")](o,e[i(1181,"YYv%")])?2:MediaSource[i(843,"(8!5")+i(1092,")8Bu")](a)?3:0}catch(l){return 0}};this[n("@xF@",986)]={mp3:e[t("YYv%",651)](a,e[t("l!WU",573)]),mp4:e[t("S@lO",546)](a,e[t("Acl^",480)])}}catch(i){var s={};s[n("SlDP",1101)]=0,s[n("]HJo",1116)]=0,this[t("]HJo",632)]=s}},packN:function(){function e(e,t){return ie(t- -215,e)}return[][ie(602,"q]CY")](i.ek(28),i.va(this[e("54^6",380)][e("AcT^",806)]),i.va(this[e("EGti",348)][e("EGti",145)]))}};function J(e){function t(e,t){return M(t,e- -25)}[$,F,D,L,B,z,G,V,U,H,q,Q,R,X,_,K][t(-96,")8Bu")]((function(n){n[t(-355,"3(AN")](e)}))}function Y(){var e={};function t(e,t){return ie(t- -635,e)}e[s("PZV1",1343)]=s("QovG",1659),e[t("dE%z",-241)]=s("aDkK",1273),e[t("C6fO",141)]=s("]HJo",1144),e[t("Pt@f",-126)]=s("(9D4",1657),e[t("jU*K",269)]=t("8RnY",157),e[t("dE%z",-184)]=t("Acl^",-144);var n=e,r=n[s("C6fO",1103)],a=n[t("SlDP",53)];function s(e,t){return ie(t-757,e)}v&&(r=n[t("54^6",251)],a=n[t("7hxe",88)]),f[t("8RnY",335)][s("dE%z",1355)+t("hIzm",-66)](r,T,!0),f[s("PZV1",1177)][s("YYv%",1601)+t("hIzm",-66)](a,N,!0),f[s("YxiJ",1262)][s("YYv%",1601)+s(")8Bu",1328)](n[t("l!WU",387)],_,!0),!v&&f[s("S@lO",1389)][s("QovG",1209)+s("PZV1",1573)](n[t("EGti",328)],E,!0)}function ee(e,t){var n=ae();return(ee=function(t,r){var a=n[t-=235];void 0===ee.zBlqyY&&(ee.AroTHC=function(e,t){var n=[],r=0,a=void 0,s="";e=function(e){for(var t,n,r="",a="",s=0,i=0;n=e.charAt(i++);~n&&(t=s%4?64*t+n:n,s++%4)?r+=String.fromCharCode(255&t>>(-2*s&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);for(var o=0,l=r.length;o<l;o++)a+="%"+("00"+r.charCodeAt(o).toString(16)).slice(-2);return decodeURIComponent(a)}(e);var i=void 0;for(i=0;i<256;i++)n[i]=i;for(i=0;i<256;i++)r=(r+n[i]+t.charCodeAt(i%t.length))%256,a=n[i],n[i]=n[r],n[r]=a;i=0,r=0;for(var o=0;o<e.length;o++)r=(r+n[i=(i+1)%256])%256,a=n[i],n[i]=n[r],n[r]=a,s+=String.fromCharCode(e.charCodeAt(o)^n[(n[i]+n[r])%256]);return s},e=arguments,ee.zBlqyY=!0);var s=t+n[0],i=e[s];return i?a=i:(void 0===ee.IXvKws&&(ee.IXvKws=!0),a=ee.AroTHC(a,r),e[s]=a),a})(e,t)}function te(){function e(e,t){return M(t,e-1344)}d=0,[T,N,_,E][e(711,"QYdW")]((function(t){t[e(1198,"tt&(")]=[]}))}function ne(){var e={};e[M("(meS",-429)]=function(e,t){return e+t};var t=e;function n(e,t){return M(e,t- -33)}var r=i[n("(f2U",-366)](t[n("YxiJ",-397)](w[n("Q2Sc",-270)](),re[n("YYv%",-99)]()));h=r[n("q]CY",-423)]((function(e){return String[n("(f2U",-117)+"de"](e)}))}function re(){var e,t={JSeyi:function(e){return e()},CTxCC:p(1349,"QYdW"),npRBP:function(e,t,n){return e(t,n)},iSDtI:function(e,t){return e<t},hNmVQ:function(e,t){return e===t},xfDub:function(e,t){return e>t},HvucD:function(e,t){return e<=t},kbnzE:function(e,t){return e-t},YrazO:function(e,t){return e<<t},fBcAN:function(e,t){return e>t},dhItA:function(e,t){return e+t},yQQNR:n(743,"PZV1")};if(!f)return"";function n(e,t){return M(t,e-1064)}var r=t[n(884,"1*rM")],a=(e=[])[p(1188,"(meS")].apply(e,[T[r](),N[r](),_[r](),E[r](),R[r](),$[r](),O[r](),F[r](),D[r](),L[r](),B[r](),P[r](),z[r]()].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(G[r]()),[V[r](),U[r](),H[r](),j[r](),q[r](),Q[r](),X[r](),Z[r](),K[r]()]));t[n(975,"@xF@")](setTimeout,(function(){t[n(719,"QovG")](te)}),0);for(var o=a[p(1155,"l!WU")][p(1569,"PZV1")](2)[p(1336,"]HJo")](""),l=0;t[n(498,"$nFE")](o[n(1036,")8Bu")],16);l+=1)o[p(1169,"jU*K")]("0");o=o[p(1374,"YYv%")]("");var u=[];t[p(1475,"YYv%")](a[n(873,"k&f(")],0)?u[p(1226,"YxiJ")](0,0):t[p(1437,"U02M")](a[n(512,"ChZ!")],0)&&t[n(448,"(f2U")](a[n(592,"U02M")],t[n(893,"ChZ!")](t[p(1313,"54^6")](1,8),1))?u[p(1517,"PZV1")](0,a[n(640,"l1Y6")]):t[n(898,"k&f(")](a[n(826,"(f2U")],t[n(604,"QovG")](t[n(802,"%4m!")](1,8),1))&&u[p(1125,"%4m!")](f[p(1718,"@xF@")](o[n(617,"jU*K")](0,8),2),f[n(771,"$nFE")](o[n(551,"AcT^")](8,16),2)),a=[][n(692,"dE%z")]([1],[1,0,0],u,a);var c=s[p(1664,"ChZ!")](a),d=[][n(599,"aDkK")][n(793,"F[!2")](c,(function(e){return String[n(438,"Pt@f")+"de"](e)}));function p(e,t){return M(t,e-1797)}return t[n(484,"WWJ$")](t[n(496,"SlDP")],i[p(1436,"jU*K")](t[p(1445,"36]w")](d[n(715,"l!WU")](""),h[p(1571,"@xF@")]("")),i[n(856,"ChZ!")]))}function ae(){var e=["abXDW7myW6aBfSofoa","lxjMWPddTCoLCmoGm8kP","W4dcPG7cJx4","sZyjWRlcL8ogis0","WRNdM8ocW4j3WRZcKHNdKW","W5qXmSoBW7m","DmoAWRtdRColWR/dQWz5lCkq","qConqg/cOmkwetmQ","uaS3WQTZ","ySokW77dImk1","WPfSWR3dLCkZWQtdVq","WRddG2rhW4aDFmo5FW","n8kKW4WSWOK","vmodW4ZdNSkz","hCkSgtZcVq","tSkpbCkEW6SRWQZcO17cKW","WP/cTmooWPqTW4i+CSkmW4y","wZ/dHG","gmkeW6mwWO8","WQxcO3ipW5pdN00","AtyQWQBcUa","W7ddSZCaW4W","WOVcUKenW5W","WPtcOCkgWPbY","WOxdH8oCW6fO","WR5/m1TFbItcLCk+vq","nCkoW7BcRSkFWPhdSGS","ubK3WP9J","bhBdICkNigi/nCoG","i8o4W57cJYC","uSkkdmk+W5C","W5Duew5D","WRagW53dOsRdRmovgq","W6bGkXu","WPvaWQq/WRRcHWCdW5/dUq","WPCxASk9W7a","iX7cNmoTEHlcVSoobCo0W6NcRq","i8oGW5/cJq","W4O+Afu2","CflcQSkz","WPOEr0JcLG","W691tfSWmSo+WRiJ","EexdISk+i14","WPddLCosW4y","W5pcPCo/W6v7W4C","W5uoWRzb","W4WxChyT","W5pdMdaFW7u","EeVdImkX","xSoOD0dcPW","W7xcLCoFW4HV","W4ZdP8kiW4i","mG9gW6etWOKLaW","WQ7dRmk5kSk8","WOOoW6xdJSozfG","cab7W6mC","W7zkoI7dSCk3W5JcIG","W4DUpuv1","pSkoW6uaWOK","WQmxAw3dUSk4W7dcU8opWOa","W4mmvwqA","W4xcGmkxWP89W6BdJG7dMX/dTbKr","W7DMtuSZi8ocWRqJxG","jSkFbJZcUa","fmkpW5OHWPW","lSoVW4lcMa","mHXBW6yzWRqYb8ov","W7ZcPalcIe7dN157gxu","hmkOW7SvWQxdICki","W7vFdrFdIW","W5hcVSoJW6X3WPvuW6tcOdK","dCkHoSoQWPWTpsjC","WR55W4ayqsZcVwddL8km","kmkmka3cTW","W4lcG8oODSo7WQtdMSoEacz9WOJdQW","d8kVmmkKW6KB","hKHMWO3dOW","eNXWWPS","jSk8o8kTW6K3C8ohvW","W4hdQCksW6auW40eECkcW40","t8kEcCkRySkJ","BHqxWP9HEa","w3RcM8kOWPddSCoZWRC","W4JdQcyaW5y","WQVcMmkwWOHZ","W4bRmrNdTa","WP0oW7FdJG","xContx4","zbiMWPhcRSodBG","dmkLlmobWO0R","W5lcGmk9wf4","DeJcISkfgSkHtga","W50tWRftW7VcKbftW6ldTa","bSkTWRq3","W5G9ALOJW4qaWRaKW6q","ssewWRZcL8ohka","WR8Bu8kNW4a","nmk+W7GaWQC","FCoPW4GjySoN","WPOdW6RdJmoa","bCkngSkLW4u","jSkcpGtcUXq","W6/dUJabW43dTCkaymki","WPBdLmkZka","W7TUkey","jSkiWOKYWPG","nCkNnSkXW78","WRZdSSoLW5nn","WQBdNSogW7q","W5pcQCoUW5v3W4ynW4xcTJu","uCo0BM/cNG","W7RcRCkjDKL0","r3tcPSk4WO7dVCoyWQzmqq","W7NcHmkFWQJcImkkbmotvYVcSW","W43cTmkLzum","nCkFpHVcVquSWPT0","cCkIW7G","E8kIu8kcW5/dRxRcRa","v8kAd8kyW6SM","b8kRkSkI","WOFcJurTW6a","aNldImky","amkNWRm+WPxcSa","C1pcVmkFdCk6","W5pcRmoHW6zgW4OdW7RcSJu","AmkjnSkLsG","WQlcJSkAWRm","pepcHmo8","W4tdO8ksW4qpW4S","amkSW78qWRldJ8onWPTCyG","WRBdGCk2f8kG","W443B1Sy","p8k/W442WOO","wCokW5NdTmko","ESk+iSkqW5C","WQhcJfrCW5yrt8k+","WPFdMSk+imkQW6K","FmkIxSkuW5pdVa","hmk3WQ4X","W4DvjZCG","W7n9jhnFcZddNmo0","W5eND0GTWOfp","W50VCf0","jmkVnSkAW5O","w8kgfmkdxq","tmoHW78zW7hdQeldPsm","rKxcVSkBpq","DmkkcCkEW7u","W7pcUSkdA2K","v8kSamktW6y","WOFdMCk5imkU","ymoVW7/dVSkxWOBcObxdTNS","WRpcQgqvW4FdJ0dcQSkECW","W47dHmkFW6i1","WQddNSomW7VdHmknaSo6","vsusWRNcGmobBtFcPMS","WOpcGgrVW7C","W5VdQCkrW4y","W7i4Ax8Q","Emo8W4u8C8oHBX0MWOq","W5PFCw0M","lczrW4ao","nCkScSosWPy","W5BcUmoJW6LIW4SnW7RdPNi","jhnrWPBdLq","smoQW64LW6/dOv4","W4WQWOvdCYxcP0ldUCkQ","W4b3fXZdTa","pw7cN8oAga","W4i1W7ZcQmkIWQNdRrXDWQe","zGSRWP3cR8kyw8oQW54","aCk9W64lWQu","hM9HWPW","W5GbWQTu","WPBdSCoEW4f8","lxhdTmkfmG","WRCbW4ZdUYRdRa","e8kSk8ofWPW","ymo/W6/dMSkcWOVcNqNdM3y","WQdcOgKVW5ZdIhW","W7LYtuWRl8oOWQXMvW","cMxdLmkkmwKDlCoTWPy","qxpdJCk0nq","tceeWQpcGSolpZe","neFcNSo6bwW","WPGjswa","W7ZcVCklFu10WRi","v8omsMNcP8kl","guJcNmo+ea","W4iGx8k8W6xcMs49WQJcSG","hCoiW63cQIa","W71WnvPueq4","WReWW5/dHbe","W5r0w0KX","BsddOCktW4u","vdSRWOdcKG","mqzDW7qc","W7P9kf4","WPNdM8otW5rGWR/cLbxdHa","jCkzf8oTWQK","W5JcMSo/W751","fmkVn8ofWPeWlJDgdq","w8oeW4/dMCky","EIJdMmkcW60","iCkJWQKX","WQxcJSkcWR4","zWmTWPf4Dq","W7WGWOzjEc3cHvVdQa","WQdcO24PW5pdIa","WPPSWRRdO8k3WQpdUIvY","WPP0WRFdISk7","iCknemoZWP4","WR7dS8oyW7hdUa","mCkgW6NcUmkPWQZdVrjr","zHanWPK","amkFiWdcOa","FKtdKG","WQhcIMPnW7Cmqmk0CG","W4xcVSoOW7HxW4uhW7RcSG","utxdHSkhW6jCWPWBpmk2","W6RcVCkDFu1JWRi","wcGpWRxcMmoqfq","W543b8o7W5HQW7ZcUgS","hCkdxYRcNCkrhIiNwW","WPL3WQ7dPmk7WQJdUXDQWPm","W6ZcT8k+zv5PWRK3","zxRdK8km","WPj3W68","W6Xupqmq","W5aSdCoNWRZdJGv5W5ZcMW","aSkYWO8BWRe","W40TgSoGW5P7","DmkEsCkzW5e","DCoJW4uBE8oQzqW","WPZdV8oVW7jx","zamwWPvwEmkXW4ePyq","iCoeW4VdQCoo","W4VcVW7cVv4","xYusWRe","WQ/cQw4TW4BdLa","hmkJWQ8QWOtcKv7cNq","WPSZW4/dVWm","amkLmmkGW7Wh","W6NcPmokW59B","WPBdUmoPW5ZdHq","W74Ld8oqWP8","nSkfoaNcPG","W47cGmkpDhy","uSomvK/cP8kCfW","WPWbW7u","WR9xWOldNmkxWQVdSd95WPG","kmkpprZcQW","W4ZdQCkFW5ywW4yEFW","DCoKW4JdJ8ktWORcOay","W6yvWO/dQhldTCkieCooba","tSkrbCkAW7KNWPhcO0G","WP7cNCkcWRbU","WR0hW5RdSt/dHSoD","WPNcQ248W7y","zCkpyCkVW6O","W4BdQCkl","f8kpW4KHWOe","r8oSs2hcTa","WQRcISkaWRvUiq","W7efWQXuWRRdQeffW5FdTa","W6RdV8k1W4C","uCo6W5pdLmkw","W7VcT8kdCK10","WQFcRxqR","W4FcJmoLeSktW5ZcG8ozkG","CXRdTmkxW5K","W7rZmaamW4DXzrW","jCkyemoKWOa","b1DnWRNdGa","td/dH8ka","FmoVW74B","WRldP2OAWOVdQmovECol","WP0aW6ddMSoggHOH","WRBcOMqVW5tdLuVcVCkL","W54Wg8oN","WOddMSkdn8k5W7tcHmoC","W4xcT8ocW7Tc","W6FdTd0tW5xdSCkjCq","uG43WQdcSG","o0BcK8ocegbCag3cQW","W6K5t38X","WRy1W7ldHmoV","w8kRDCkzW4u","WP8vB8kCW77cHfNcOZLU","W6WUWODl","DCoTW5ip","wmogsM3cSSkx","WPRdLmkMkSkSW7ZcNSoE","vKxdKCkUj27cVCoBkSoi","W6XGldSuW51yzXBcVG","WQFcO2m/W5/dMuVcRa","WRCaW7FdHSonfHC0ymkr","FCkDbSkvW4O","W7FcTSkzFLLJWR8JDSkx","EMxcImkPma","W6O6FvaNWR5tWQqRW6y","zbeHWPFcOCod","WRdcJMjgW5a","dmkti8okWOa","W5GSdCoZWQxdGGrJW5dcMq","WP9IWQhdTmk+WQldKcr5WPG","BelcQW","AhdcOmkfWQu","mIPNW6GL","WQqBW5hdOcJdVCochCkF","Cmo4W5ipDCoNwba1WOu","W5aIgSoZ","W73dIIDtWQ5yaCo5iIi","WRuSCCkx","sfBcI8kSWO8","WQ4YeX9UiCoWWRSExSoZ","W7ddTZCfW50","WOvMWQhdTmk3WRxdSca","W6xdTcWJW5NdT8kp","WR/dLmoDW6ZdLCkwoCo9AaC","jG9aW7m","WQ/dNCogW7NdM8kHg8oXAXy","cvlcPmo6nW","zdtdOCkcW5y","W4OfWRfbW57dHLnc","W7D6pYS","W4bFfWJdUG","c8ojvmo9xmkIxvxdVx8","bgFcGG","l8kaW5KSWQm","W5lcJapcSve","wCokv28","yX87WPu","wSoVW6Kr","vvFcMCkeWRO","W73cTmkiFeLUWQmzzG","iafy","nSkkW7BcQ8kFWQRdIbzmjG","smkiamktW7mHWOG","rmorW5ZdKCkL","W75anZZdQmk6","W54QgSo7","e8kLmmoqWPWXdJ9zha","W7rJpa","DWiCWOPuD8k1W50E","thNcOCk5WOZdRmoe","WRuRBCklW7FcNh/cGcu","WQJdKmoBW7S","tX/dMSkFW7e","lGTAW7ucWQG","WP4SW4ddN8og","taS/WP9/","WP7dN8oSW5/dTa","kCkkW6RcUSkoWRa","imocW6JcNdG","WQ/dNSobW7NdKCkq","W5Gqd8o+WQG","tY0lWRxcHCoqldNcUq","FvVcOmkEWOO","WRy6CmkqW7tcHflcNZa","W65Pl1C","W50KdSoUW4v3","B1FcQW","WPVcJuGzW50","bmkgW5GZWQu","W7NcJmo1W61D","W6FdJWWXW4S","vcldKmks","W6TOCfSTl8oPWQu","W5eujmo3WOK","kCkcmG7cPHG6WOu","W6jxnI/dS8kMW4/cJSoz","i8oUW4JcMtJcH1y5","W5vFC2yT","F8oTW5ihymoQkXS7WOu","dCk2WR8oW7hdNhxdOGG","W6OdWRXYW4K","xsBdLmkDW69SWPaVkCk9","WOtdMmotW4bSWRZcIa","umocugS","usdcGq","W6JcUqdcVvtdN0HMhq","W4dcR8oU","WQe4DSkE","WQ7dUmolW4rJWR7cPdpdKYu","zreRWO0","WQ7cJ3qtW5a","xHW8WRpcPa","W5NcVSozW7nMW4CXW6hcTIO","W7zKorerW4fTzW","aSkOW6uEWRddGG","BK7dRSkNeG","xmoiW70UW4W","WRJdMmkMc8kA","tYevWQq","WRFdV8oGW7zM","W5dcLSkHzM0","cSkSW78y","amkTWR44WPxcSv/cHW","iCoUW5NcQttcGva","W5LXmxvE","m2FdMCkeia","qs82W43dHSoNsSk5aCkV","jqTRW7qg","fCkUmCooWPaLlG","W4WpWQG","eg9RWPFdK8oUzCkYi8kN","nGfbW7eEWRm/fSocia","jmoTW47cJsFcOvKUpIa","A8oYW7ZdTCkI","cSoUW4/cIsFcJfe3ja","WQBcK2TbW5a","DSk1WPJcLbBcGu0fgq","W48NyfKTW5XBWRb2WRW","W5yzc8o9WOi","WRJdKmoDW73dLCkq","sGCmWPTr","W5ezDKGH","WQBdU8k4aCkJ","WPVcJuifW50","WOyQBfNcVq","nmoIW5NcGZNcJMWIjG","udxdM8ktW7Dt","w8oHW6qzW7JdSq","cmkJWQK4","W7rmns/dUCkG","qSokv2pcPmktgG","WPFdM8oiW4rKWQy","w8opW68jW40","WQCzW5ldVtm","W7DxdtldSCk3","W6/dVJabW4ZdVa","WQxcJhvC","W7bUdaarW5PMCG","WRpcVM8+W53dIfZcQmkK","tCknaSkBzmkJB0VdK1e","W63cUWVcQe/dJMjZcNC","x8kEfCkE","W6JcT8kA","WPJdKmk+jmk/W7u","zeJcUSkebCkTthm","mSkuoGJcIa","W7rqnZJdQmk7W5NcKmkCWQa","lKFcNSo5hNy","WQ3dL8kJbmkV","hgrJWRtdKW","WRaiW4RdTq","lmkNdCoSWQ4","ASkkF8krW7m","W7DMsL0Zl8oPWQC","WQxcGmkaWRf7pq","WRpcN8kkWRnUlebxW6hdGq","W7znec/dNq","luZcLmo4f21DnhK","kKpcNSo5hMK","W5tcRmo5W6S","WOeSW5xdQSob","xmoVW74B","iCkcpc7cPWu6WOzWbG","CaqxWOX8FCk1","iCkmjq4","WQxcLNra","zIddNCkBW6y","wCkEe8kU","zSkCyCk5W6a","evtdP8kUlW","lmk8W4dcQCkZ","vSoHW70","W40QbSoSW5zQ","W5W4yvi2","FSk7uCkEW57dGhhcStOk","W7Sjl8oXWOS","WPzNWQVdLCkKWQldUYzqWP8","W6HIquSTl8oXWQC0","WPuIBhhcOq","WOhdMSocW4jJWRVcLqBdHq","vCofW5FdLSkW","WRdcR3iVW5FdKG","le3cO8oPa21DnG","nSkoWRa6WOFcTg/cQmkWWQe","W7tcVCkdDLHO","sCkGwmkfW5a","WPOaW63dJmokcW","W7SLhmoGWPy","WQdcMSkaWRfUihXCWRm","W48nrNSS","CCo5W77dR8kiWO7cQZldJNm","W7zbDKWi","W64iWRDmsa","W7KfWRPPqa","zCoQW6/dMG","bxJdKSkkmwu3lW","jSklW6FcGSkBWRZdSY5rla","D8oTW5qhrmoQzHCGWOq","WRGAW5ZdOce","wSomuW","WRFdVSkweSkO","wcSiWRpcL8oq","emk6p8k0W7m","B8k/x8kdW53dVg3cQdG","heFcHSo0eMf8i3tcOq","W7HQjNzj","Bmooru7cGW","W7zeltO","egHQWPNdPmoVA8kUqmoG","uspcICoBFtq0i8ojWOi1W6S","W7D8oaVdIG","CmoByLFcOH8TWQvqjq","W7OljmoIW6y","WQlcQCkzWOzp","CXeCWOdcSSoEwmo9","k0hcGSoYhwG","k8osW4RcGcW","CGmwWOX6zmkPW4mp","W7feoJpdUCkn","wSocsw8","WQBcUca","W6DUmrCcW4C","ACoQW7xdN8knWOBcIXFdN3W","gMldK8kymx4Xl8oV","bmkHnSoh","s3tcVmk9","WOGbugtcTSkoWR8IfW","WQW2Ba","W7FdM8oDWQPzkMz6W5W","WRhcJgrDW4KDt8kT","W7DAcvXT","W6DTnHenW4Dq","WRhcGNnj","h2HPWRVdMa","WP4bu2u","omkKfSoqWQW","BLtcI8kZWQO","W443WP5CFG","fCowr8k0lCkvzhNdK1K","WRBcJ25nW4OmEa","vIStWQpcK8ojiIlcRa","WRBcJ25lW48","b3BdH8kciM0SlSo6","CSk9aW","WQVdLmoBW5/dNmkbamoXAXy","xmorqwW","wMBcRCkUWQpdV8o4WR5D","W4PaetxdVW","l1DVWO/dOmoSwmo7WPNcTa","W7xcJmkb","W75XqKyZdSoIWQSHwa","jGfxW6CBWQuLaW","W4z1qLuq","WQdcOgKVW5ZdIh0","lHlcKCkPkNpcISoDcG","traaWOxcQG","qgdcVmk5WPddJ8o0WRrDrW","WRagW53dOsRdRmovgCk3fW","lX4a","WRFcO1m+W4ddLuVcVW","W47dV8kpW68R","zCoJW7uAzmoMzr8","WOzWWRxdLSk/","W6WGWPbFFsxcHfK","AXSHWPpcTmoF","W6y+Bf0SWODzWQ0","WO8gW6FdISoe","W7DIlregW50","bSkYlSkSW68hyq","WP7dV8ohW5JdMa","WQSSB8kDW73cMG","vIuw","WOSnx2xcL8ktWQGQfq","W7pcS8k4DKS","zb8JWPG","mr5yW7Sc","WPXHWQhdQSkx","WQ/dMCooW7tdL8kbcCoaAHC","WRFcO3uPW5RdR1hcUCkZBG","WQ/dMCoDW7xdNCkb","ENNcGmkOWO0","gNHQWP3dPmoU","hCkIW6yC","W7ZcQHVcQa","utqDWOXh","lmkdnqRcQJ4Z","WRZdG8okW47dMCkjcmohCqm","wdhdGCkv","n8oGW4JcHXS","e8k1imovWO0XmZHt","WR7dLmoFW7BdKCkhca","W6yGWOq","W7NcVq7cOfFdVfHYdgK","nSkznahcTWm","W7r0lbW","r8oxqwtcO8kn","W5mShq","WP8PASkqW70","Ar8HWPVcN8oeqSo1WP/cVa","nSkfW547WQa","wmkEfCkwW7aG","WQFcOxbdW6W","W4FdS8kiW4yjW6SvySkkW4K","DSkJvmksW4RdH3i","WRyoxepcQW","xJqKWOhcMSkMjmoGqmkt","WP/dKCoFW5q","wSoCW78sW7u","W5TMv0O","o8kiWRO1WOC","zhpcI8kMgW","eCoFcSk/oCkVjcZcLX4","WPanu2BcKCks","A8oKW7ldLq","r8oHW44CDa","nJ9DW7e1","xmoHW6KpW7tdOepdPW","W5ZdR8krW4yiW5CrzSkD","umoAuwNcTa","W7TMv04","W5hcIHFcRNa","W5BcPSohW49F","W5uNcSoxWQFdJGv5W5xcNG","WRGmW5ddSZpdOq","cSk3WRm6WPxcSv/cH8oI","w17cISkOWQO","WRCgW5ddTYBdVq","uGe8WP9s","W7FdSJmdW4VdOmkgAmkl","zeBcRCkq","kKFcGmoXegDw","WPxcLgiVW6G","cNVdMmkok3Ga","W6jUltecW5bG","W4qVg8o1WRJdHrG","CSoKW7BdNG","kCoUW5W","r8optwNcOW","WRBcJSkCWQf/ah1g","WPVdGmkKjSk5W5xcJ8oscWC","yr4xWPT0za","w8orug/cOG","rqSPWPlcPCof","jmkRcSkUW7a","W5CRc8oH","Br8K","WRKiW44","zuRcSmkf","W6vXnISwW5PS","W4OKhmoU","W5DXyMGX","WOrGWR3dV8k+WQVdGt1S","W6ujWPHGW5C","cNBdN8k7kw0HfCoXWOS","FtWEWQZcMa","W6RcVCkiFW","WPddM8ofW5jOWRFcLrC","WPHZumk6WOCNWRxcRwjnC0/cVW","WPGzW6ldHSohnXe8C8kq","kmkiiHZcSXyWWRTWeq","WO8gW7ddHSojfHG8ymkb","W60HWOC","WQpcSSoKWQ8","W5KsWOTCW7FdGG","W5CSamoXWRddNW","qb8BWPNcRq","WQy1A8kAW7BcNf8","vsuiWR/cQCohiJVcOMy","W75XqKyZeCoUWQyYwa","WRlcQw5qW57dVSkHqmkibW","W4VdQCksW4aAW5C","WRNdN8olW7/dLSkna8oXyq","WRFcSxjaW4G","E8kSrmkw","aCk0k8oqWPXJotLqha","bCkUiCojWP0M","FXGlWOhcOG","ESkvdCkCW74","Cmoyyv3dQH88WQXdoWO","F0VdKmk8","CCoPW7G","W5ObWPTOEa","n8oZW4tcMdRcLKe9mW","WORcImkHWPHn","DCoKW68AvW","W7pdRI0oW7BdU8ktBmkDkq","WOCltCkOW4VcRvq","bmkIW6ix","CSo7W7FdKSkv","W6fgkZtdSmk+W6lcKCom","W6TVgGigW518","WR1qWQRdQCk7","CSkIrCkeW5FdRhVcRZm","W69fB3K9","W45gmWWj","WPpcMCk/WRHD","CmodW6GPEa","W6vDWO/cRh/cVCkoamkalCoVW4O5","y0JcTSkAaCkT","C8oHy2tcGG","xSkqcCkSBmk6","q8oKW6Gjya","pe3cK8oOhgfDjq","CHmA","W4SPdCoIW5jWW7hcGwO","agtdQmkbcW","WP3dM8k5nW","nGfNW6yeWQKLea","WRxcQsaPW53dMedcHCoHzW","W7zPr0ONcCoH","W6hdSJac","leVcNCo4aNbspg0","FCkxvCkyW6e","fxjQWPNdSCoY","ACofW7BdRCkW","meBcQW","swZcU8kqWRi"];return(ae=function(){return e})()}function se(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};function t(e,t){return M(e,t-250)}var r={GBGnD:function(e,t){return e!==t},udJzP:a(309,"Uj2C"),ZgnvD:t("C6fO",207),OfrrG:function(e){return e()},kkUgg:function(e,t){return e+t},HFCtH:function(e,t){return e+t},HNLwA:function(e,t){return e*t},EYUKP:function(e,t){return e*t},gzTLW:function(e){return e()},uYtJo:function(e,t,n){return e(t,n)}};function a(e,t){return ie(e- -662,t)}if(r[t(")8Bu",-87)](void 0===f?"undefined":n(f),r[a(-291,"F[!2")]))for(var s=r[a(289,"Uj2C")][a(-253,"q]CY")]("|"),i=0;;){switch(s[i++]){case"0":r[a(-199,"dE%z")](ne);continue;case"1":this[t("7hxe",-54)+t("(f2U",137)](e[a(373,"jU*K")]||r[a(-113,"ChZ!")](r[a(138,"S@lO")](695905265254,r[t("ChZ!",-386)](472578152857,-1)),r[a(230,"jU*K")](-3,-218760729941)));continue;case"2":r[t("WWJ$",0)](Y);continue;case"3":r[t("Imsz",-23)](J,l,f);continue;case"4":l=g[a(-215,"(meS")]();continue}break}}function ie(e,t){return ee(e-104,t)}se[M("54^6",-278)][M("N)xu",-581)+ie(639,"tt&(")]=function(e){c=g[M("k&f(",-59)](),u=e},se[M("1[03",-97)][M(")8Bu",-232)]=p,se[M("WWJ$",-661)][ie(388,"QYdW")]=p,se[ie(658,"QYdW")][ie(912,"EGti")+"k"]=function(){return j[M("l1Y6",-134)]++,{PpEgG:function(e){return e()}}[ie(603,"(f2U")](re)},se[M("q]CY",-10)][M("hIzm",-377)+M("SlDP",-87)]=function(){var e={NzFgj:function(e,t){return e(t)},ZOTby:function(e){return e()}};return new Promise((function(t){function n(e,t){return ee(e- -585,t)}j[ee(708,"DKL#")]++,e[n(355,"(f2U")](t,e[n(206,"YYv%")](re))}))},A&&A[M("8RnY",-70)]&&A[ie(909,"F[!2")][ie(662,"wAHi")]&&(se[M("Uj2C",-598)][M("7hxe",19)]=function(e){var t={};function n(e,t){return ie(e- -862,t)}function r(e,t){return ie(t- -1053,e)}t[n(157,"WWJ$")]=n(-345,"YxiJ"),t[r("N)xu",-276)]=r("jU*K",-159),t[r("Uj2C",-446)]=r("SlDP",-385),t[r("WWJ$",-567)]=n(-24,"(meS"),t[n(59,"1*rM")]=n(29,"S@lO");var a=t;switch(e.type){case a[n(-161,"(f2U")]:_[r("QovG",-55)+"t"](e);break;case a[n(41,"QovG")]:case a[r("ChZ!",-113)]:T[n(-57,"Q2Sc")+"t"](e);break;case a[r("q]CY",-168)]:case a[r("Pt@f",-284)]:N[r("54^6",-298)+"t"](e)}});var oe=new se;e[ie(544,"DKL#")]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};function t(e,t){return ie(e- -110,t)}return e[t(920,"$nFE")]&&f&&oe[t(306,"SYaz")+t(300,"WWJ$")](e[t(902,"griD")]),oe}}).call(this,r(1)(e))},function(e,t,n){var r=n(6),a=n(0),s=n(10),i=n(2),o=n(11),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=a.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(i[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(i[n]);this._dict_set=!0}}function c(e,t){var n=new u(t);if(n.push(e,!0),n.err)throw n.msg||i[n.err];return n.result}u.prototype.push=function(e,t){var n,i,o=this.strm,u=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?o.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new a.Buf8(u),o.next_out=0,o.avail_out=u),1!==(n=r.deflate(o,i))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==o.avail_out&&(0!==o.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(s.buf2binstring(a.shrinkBuf(o.output,o.next_out))):this.onData(a.shrinkBuf(o.output,o.next_out)))}while((o.avail_in>0||0===o.avail_out)&&1!==n);return 4===i?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==i||(this.onEnd(0),o.avail_out=0,!0)},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=u,t.deflate=c,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},function(e,t,n){var r,a=n(0),s=n(7),i=n(8),o=n(9),l=n(2),u=-2,c=258,d=262,h=103,p=113,f=666;function m(e,t){return e.msg=l[t],t}function g(e){return(e<<1)-(e>4?9:0)}function y(e){for(var t=e.length;--t>=0;)e[t]=0}function b(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(a.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function v(e,t){s._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,b(e.strm)}function A(e,t){e.pending_buf[e.pending++]=t}function x(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function k(e,t){var n,r,a=e.max_chain_length,s=e.strstart,i=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,u=e.window,h=e.w_mask,p=e.prev,f=e.strstart+c,m=u[s+i-1],g=u[s+i];e.prev_length>=e.good_match&&(a>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(n=t)+i]===g&&u[n+i-1]===m&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do{}while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<f);if(r=c-(f-s),s=f-c,r>i){if(e.match_start=t,i=r,r>=o)break;m=u[s+i-1],g=u[s+i]}}}while((t=p[t&h])>l&&0!=--a);return i<=e.lookahead?i:e.lookahead}function w(e){var t,n,r,s,l,u,c,h,p,f,m=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-d)){a.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=m?r-m:0}while(--n);t=n=m;do{r=e.prev[--t],e.prev[t]=r>=m?r-m:0}while(--n);s+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,h=e.strstart+e.lookahead,p=s,f=void 0,(f=u.avail_in)>p&&(f=p),n=0===f?0:(u.avail_in-=f,a.arraySet(c,u.input,u.next_in,f,h),1===u.state.wrap?u.adler=i(u.adler,c,f,h):2===u.state.wrap&&(u.adler=o(u.adler,c,f,h)),u.next_in+=f,u.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<d&&0!==e.strm.avail_in)}function S(e,t){for(var n,r;;){if(e.lookahead<d){if(w(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-d&&(e.match_length=k(e,n)),e.match_length>=3)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function C(e,t){for(var n,r,a;;){if(e.lookahead<d){if(w(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-d&&(e.match_length=k(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(v(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=s._tr_tally(e,0,e.window[e.strstart-1]))&&v(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function I(e,t,n,r,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=a}function W(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:p,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):m(e,u)}function _(e){var t,n=W(e);return 0===n&&((t=e.state).window_size=2*t.w_size,y(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n}function T(e,t,n,r,s,i){if(!e)return u;var o=1;if(-1===t&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),s<1||s>9||8!==n||r<8||r>15||t<0||t>9||i<0||i>4)return m(e,u);8===r&&(r=9);var l=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(1146),this.dyn_dtree=new a.Buf16(122),this.bl_tree=new a.Buf16(78),y(this.dyn_ltree),y(this.dyn_dtree),y(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(16),this.heap=new a.Buf16(573),y(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(573),y(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return e.state=l,l.strm=e,l.wrap=o,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new a.Buf8(2*l.w_size),l.head=new a.Buf16(l.hash_size),l.prev=new a.Buf16(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new a.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=i,l.method=n,_(e)}r=[new I(0,0,0,0,(function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(w(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,v(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(v(e,!1),e.strm.avail_out),1)})),new I(4,4,8,4,S),new I(4,5,16,8,S),new I(4,6,32,32,S),new I(4,4,16,16,C),new I(8,16,32,32,C),new I(8,16,128,128,C),new I(8,32,128,256,C),new I(32,128,258,1024,C),new I(32,258,258,4096,C)],t.deflateInit=function(e,t){return T(e,t,8,15,8,0)},t.deflateInit2=T,t.deflateReset=_,t.deflateResetKeep=W,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},t.deflate=function(e,t){var n,a,i,l;if(!e||!e.state||t>5||t<0)return e?m(e,u):u;if(a=e.state,!e.output||!e.input&&0!==e.avail_in||a.status===f&&4!==t)return m(e,0===e.avail_out?-5:u);if(a.strm=e,n=a.last_flush,a.last_flush=t,42===a.status)if(2===a.wrap)e.adler=0,A(a,31),A(a,139),A(a,8),a.gzhead?(A(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),A(a,255&a.gzhead.time),A(a,a.gzhead.time>>8&255),A(a,a.gzhead.time>>16&255),A(a,a.gzhead.time>>24&255),A(a,9===a.level?2:a.strategy>=2||a.level<2?4:0),A(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(A(a,255&a.gzhead.extra.length),A(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=o(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69):(A(a,0),A(a,0),A(a,0),A(a,0),A(a,0),A(a,9===a.level?2:a.strategy>=2||a.level<2?4:0),A(a,3),a.status=p);else{var d=8+(a.w_bits-8<<4)<<8;d|=(a.strategy>=2||a.level<2?0:a.level<6?1:6===a.level?2:3)<<6,0!==a.strstart&&(d|=32),d+=31-d%31,a.status=p,x(a,d),0!==a.strstart&&(x(a,e.adler>>>16),x(a,65535&e.adler)),e.adler=1}if(69===a.status)if(a.gzhead.extra){for(i=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),b(e),i=a.pending,a.pending!==a.pending_buf_size));)A(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=73)}else a.status=73;if(73===a.status)if(a.gzhead.name){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),b(e),i=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,A(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),0===l&&(a.gzindex=0,a.status=91)}else a.status=91;if(91===a.status)if(a.gzhead.comment){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),b(e),i=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,A(a,l)}while(0!==l);a.gzhead.hcrc&&a.pending>i&&(e.adler=o(e.adler,a.pending_buf,a.pending-i,i)),0===l&&(a.status=h)}else a.status=h;if(a.status===h&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&b(e),a.pending+2<=a.pending_buf_size&&(A(a,255&e.adler),A(a,e.adler>>8&255),e.adler=0,a.status=p)):a.status=p),0!==a.pending){if(b(e),0===e.avail_out)return a.last_flush=-1,0}else if(0===e.avail_in&&g(t)<=g(n)&&4!==t)return m(e,-5);if(a.status===f&&0!==e.avail_in)return m(e,-5);if(0!==e.avail_in||0!==a.lookahead||0!==t&&a.status!==f){var k=2===a.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(w(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(a,t):3===a.strategy?function(e,t){for(var n,r,a,i,o=e.window;;){if(e.lookahead<=c){if(w(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=o[a=e.strstart-1])===o[++a]&&r===o[++a]&&r===o[++a]){i=e.strstart+c;do{}while(r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&a<i);e.match_length=c-(i-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(a,t):r[a.level].func(a,t);if(3!==k&&4!==k||(a.status=f),1===k||3===k)return 0===e.avail_out&&(a.last_flush=-1),0;if(2===k&&(1===t?s._tr_align(a):5!==t&&(s._tr_stored_block(a,0,0,!1),3===t&&(y(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),b(e),0===e.avail_out))return a.last_flush=-1,0}return 4!==t?0:a.wrap<=0?1:(2===a.wrap?(A(a,255&e.adler),A(a,e.adler>>8&255),A(a,e.adler>>16&255),A(a,e.adler>>24&255),A(a,255&e.total_in),A(a,e.total_in>>8&255),A(a,e.total_in>>16&255),A(a,e.total_in>>24&255)):(x(a,e.adler>>>16),x(a,65535&e.adler)),b(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?0:1)},t.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==h&&t!==p&&t!==f?m(e,u):(e.state=null,t===p?m(e,-3):0):u},t.deflateSetDictionary=function(e,t){var n,r,s,o,l,c,d,h,p=t.length;if(!e||!e.state)return u;if(2===(o=(n=e.state).wrap)||1===o&&42!==n.status||n.lookahead)return u;for(1===o&&(e.adler=i(e.adler,t,p,0)),n.wrap=0,p>=n.w_size&&(0===o&&(y(n.head),n.strstart=0,n.block_start=0,n.insert=0),h=new a.Buf8(n.w_size),a.arraySet(h,t,p-n.w_size,n.w_size,0),t=h,p=n.w_size),l=e.avail_in,c=e.next_in,d=e.input,e.avail_in=p,e.next_in=0,e.input=t,w(n);n.lookahead>=3;){r=n.strstart,s=n.lookahead-2;do{n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+3-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++}while(--s);n.strstart=r,n.lookahead=2,w(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=c,e.input=d,e.avail_in=l,n.wrap=o,0},t.deflateInfo="pako deflate (from Nodeca project)"},function(e,t,n){var r=n(0);function a(e){for(var t=e.length;--t>=0;)e[t]=0}var s=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],i=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],l=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],u=new Array(576);a(u);var c=new Array(60);a(c);var d=new Array(512);a(d);var h=new Array(256);a(h);var p=new Array(29);a(p);var f,m,g,y=new Array(30);function b(e,t,n,r,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=a,this.has_stree=e&&e.length}function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function A(e){return e<256?d[e]:d[256+(e>>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,x(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function w(e,t,n){k(e,n[2*t],n[2*t+1])}function S(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function C(e,t,n){var r,a,s=new Array(16),i=0;for(r=1;r<=15;r++)s[r]=i=i+n[r-1]<<1;for(a=0;a<=t;a++){var o=e[2*a+1];0!==o&&(e[2*a]=S(s[o]++,o))}}function I(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function W(e){e.bi_valid>8?x(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function _(e,t,n,r){var a=2*t,s=2*n;return e[a]<e[s]||e[a]===e[s]&&r[t]<=r[n]}function T(e,t,n){for(var r=e.heap[n],a=n<<1;a<=e.heap_len&&(a<e.heap_len&&_(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!_(t,r,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=r}function N(e,t,n){var r,a,o,l,u=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*u]<<8|e.pending_buf[e.d_buf+2*u+1],a=e.pending_buf[e.l_buf+u],u++,0===r?w(e,a,t):(w(e,(o=h[a])+256+1,t),0!==(l=s[o])&&k(e,a-=p[o],l),w(e,o=A(--r),n),0!==(l=i[o])&&k(e,r-=y[o],l))}while(u<e.last_lit);w(e,256,t)}function E(e,t){var n,r,a,s=t.dyn_tree,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,l=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<l;n++)0!==s[2*n]?(e.heap[++e.heap_len]=u=n,e.depth[n]=0):s[2*n+1]=0;for(;e.heap_len<2;)s[2*(a=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[a]=0,e.opt_len--,o&&(e.static_len-=i[2*a+1]);for(t.max_code=u,n=e.heap_len>>1;n>=1;n--)T(e,s,n);a=l;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],T(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,s[2*a]=s[2*n]+s[2*r],e.depth[a]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,s[2*n+1]=s[2*r+1]=a,e.heap[1]=a++,T(e,s,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,a,s,i,o,l=t.dyn_tree,u=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,m=0;for(s=0;s<=15;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(s=l[2*l[2*(r=e.heap[n])+1]+1]+1)>f&&(s=f,m++),l[2*r+1]=s,r>u||(e.bl_count[s]++,i=0,r>=p&&(i=h[r-p]),o=l[2*r],e.opt_len+=o*(s+i),d&&(e.static_len+=o*(c[2*r+1]+i)));if(0!==m){do{for(s=f-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[f]--,m-=2}while(m>0);for(s=f;0!==s;s--)for(r=e.bl_count[s];0!==r;)(a=e.heap[--n])>u||(l[2*a+1]!==s&&(e.opt_len+=(s-l[2*a+1])*l[2*a],l[2*a+1]=s),r--)}}(e,t),C(s,u,e.bl_count)}function R(e,t,n){var r,a,s=-1,i=t[1],o=0,l=7,u=4;for(0===i&&(l=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)a=i,i=t[2*(r+1)+1],++o<l&&a===i||(o<u?e.bl_tree[2*a]+=o:0!==a?(a!==s&&e.bl_tree[2*a]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,s=a,0===i?(l=138,u=3):a===i?(l=6,u=3):(l=7,u=4))}function $(e,t,n){var r,a,s=-1,i=t[1],o=0,l=7,u=4;for(0===i&&(l=138,u=3),r=0;r<=n;r++)if(a=i,i=t[2*(r+1)+1],!(++o<l&&a===i)){if(o<u)do{w(e,a,e.bl_tree)}while(0!=--o);else 0!==a?(a!==s&&(w(e,a,e.bl_tree),o--),w(e,16,e.bl_tree),k(e,o-3,2)):o<=10?(w(e,17,e.bl_tree),k(e,o-3,3)):(w(e,18,e.bl_tree),k(e,o-11,7));o=0,s=a,0===i?(l=138,u=3):a===i?(l=6,u=3):(l=7,u=4)}}a(y);var O=!1;function F(e,t,n,a){var s,i,o;k(e,0+(a?1:0),3),i=t,o=n,W(s=e),x(s,o),x(s,~o),r.arraySet(s.pending_buf,s.window,i,o,s.pending),s.pending+=o}t._tr_init=function(e){O||(function(){var e,t,n,r,a,l=new Array(16);for(n=0,r=0;r<28;r++)for(p[r]=n,e=0;e<1<<s[r];e++)h[n++]=r;for(h[n-1]=r,a=0,r=0;r<16;r++)for(y[r]=a,e=0;e<1<<i[r];e++)d[a++]=r;for(a>>=7;r<30;r++)for(y[r]=a<<7,e=0;e<1<<i[r]-7;e++)d[256+a++]=r;for(t=0;t<=15;t++)l[t]=0;for(e=0;e<=143;)u[2*e+1]=8,e++,l[8]++;for(;e<=255;)u[2*e+1]=9,e++,l[9]++;for(;e<=279;)u[2*e+1]=7,e++,l[7]++;for(;e<=287;)u[2*e+1]=8,e++,l[8]++;for(C(u,287,l),e=0;e<30;e++)c[2*e+1]=5,c[2*e]=S(e,5);f=new b(u,s,257,286,15),m=new b(c,i,0,30,15),g=new b(new Array(0),o,0,19,7)}(),O=!0),e.l_desc=new v(e.dyn_ltree,f),e.d_desc=new v(e.dyn_dtree,m),e.bl_desc=new v(e.bl_tree,g),e.bi_buf=0,e.bi_valid=0,I(e)},t._tr_stored_block=F,t._tr_flush_block=function(e,t,n,r){var a,s,i=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),E(e,e.l_desc),E(e,e.d_desc),i=function(e){var t;for(R(e,e.dyn_ltree,e.l_desc.max_code),R(e,e.dyn_dtree,e.d_desc.max_code),E(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*l[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),a=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=a&&(a=s)):a=s=n+5,n+4<=a&&-1!==t?F(e,t,n,r):4===e.strategy||s===a?(k(e,2+(r?1:0),3),N(e,u,c)):(k(e,4+(r?1:0),3),function(e,t,n,r){var a;for(k(e,t-257,5),k(e,n-1,5),k(e,r-4,4),a=0;a<r;a++)k(e,e.bl_tree[2*l[a]+1],3);$(e,e.dyn_ltree,t-1),$(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,i+1),N(e,e.dyn_ltree,e.dyn_dtree)),I(e),r&&W(e)},t._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(h[n]+256+1)]++,e.dyn_dtree[2*A(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){var t;k(e,2,3),w(e,256,u),16===(t=e).bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},function(e,t,n){e.exports=function(e,t,n,r){for(var a=65535&e,s=e>>>16&65535,i=0;0!==n;){n-=i=n>2e3?2e3:n;do{s=s+(a=a+t[r++]|0)|0}while(--i);a%=65521,s%=65521}return a|s<<16}},function(e,t,n){var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,a){var s=r,i=a+n;e^=-1;for(var o=a;o<i;o++)e=e>>>8^s[255&(e^t[o])];return~e}},function(e,t,n){var r=n(0),a=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(u){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(u){s=!1}for(var i=new r.Buf8(256),o=0;o<256;o++)i[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&a))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n}i[254]=i[254]=1,t.string2buf=function(e){var t,n,a,s,i,o=e.length,l=0;for(s=0;s<o;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<o&&56320==(64512&(a=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(a-56320),s++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new r.Buf8(l),i=0,s=0;i<l;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<o&&56320==(64512&(a=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(a-56320),s++),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|63&n):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|63&n):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|63&n);return t},t.buf2binstring=function(e){return l(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,a=t.length;n<a;n++)t[n]=e.charCodeAt(n);return t},t.buf2string=function(e,t){var n,r,a,s,o=t||e.length,u=new Array(2*o);for(r=0,n=0;n<o;)if((a=e[n++])<128)u[r++]=a;else if((s=i[a])>4)u[r++]=65533,n+=s-1;else{for(a&=2===s?31:3===s?15:7;s>1&&n<o;)a=a<<6|63&e[n++],s--;s>1?u[r++]=65533:a<65536?u[r++]=a:(a-=65536,u[r++]=55296|a>>10&1023,u[r++]=56320|1023&a)}return l(u,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+i[e[n]]>t?n:t}},function(e,t,n){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,n){e.exports=function(e,t,n){if((t-=(e+="").length)<=0)return e;if(n||0===n||(n=" ")," "==(n+="")&&t<10)return r[t]+e;for(var a="";1&t&&(a+=n),t>>=1;)n+=n;return a+e};var r=[""," ","  ","   ","    ","     ","      ","       ","        ","         "]},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.crc32=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e=function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r<2048?t+=String.fromCharCode(192|r>>6)+String.fromCharCode(128|63&r):r<55296||r>=57344?t+=String.fromCharCode(224|r>>12)+String.fromCharCode(128|r>>6&63)+String.fromCharCode(128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++n)),t+=String.fromCharCode(240|r>>18)+String.fromCharCode(128|r>>12&63)+String.fromCharCode(128|r>>6&63)+String.fromCharCode(128|63&r))}return t}(e),t^=-1;for(var n=0;n<e.length;n++)t=t>>>8^r[255&(t^e.charCodeAt(n))];return~t>>>0};var r=function(){for(var e=[],t=void 0,n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}()},function(e,t,n){(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){function e(e,t){return s(t-903,e)}var t=u();function n(e,t){return s(e-322,t)}for(;;)try{if(parseInt(e("o#BD",1357))/1+parseInt(n(736,"o#BD"))/2+parseInt(n(725,"iRCa"))/3*(parseInt(n(720,"v&9t"))/4)+-parseInt(n(731,"CYra"))/5+-parseInt(n(726,"6BJ9"))/6*(parseInt(n(786,"ZGHp"))/7)+parseInt(n(745,"w@1k"))/8*(-parseInt(e("ZGHp",1337))/9)+parseInt(e("$i(c",1360))/10*(parseInt(n(733,"7@@f"))/11)==891082)break;t.push(t.shift())}catch(r){t.push(t.shift())}}();var r=n(3),a=n(15);function s(e,t){var n=u();return(s=function(t,r){var a=n[t-=394];void 0===s.EeeRFy&&(s.EsJeQI=function(e,t){var n=[],r=0,a=void 0,s="";e=function(e){for(var t,n,r="",a="",s=0,i=0;n=e.charAt(i++);~n&&(t=s%4?64*t+n:n,s++%4)?r+=String.fromCharCode(255&t>>(-2*s&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);for(var o=0,l=r.length;o<l;o++)a+="%"+("00"+r.charCodeAt(o).toString(16)).slice(-2);return decodeURIComponent(a)}(e);var i=void 0;for(i=0;i<256;i++)n[i]=i;for(i=0;i<256;i++)r=(r+n[i]+t.charCodeAt(i%t.length))%256,a=n[i],n[i]=n[r],n[r]=a;i=0,r=0;for(var o=0;o<e.length;o++)r=(r+n[i=(i+1)%256])%256,a=n[i],n[i]=n[r],n[r]=a,s+=String.fromCharCode(e.charCodeAt(o)^n[(n[i]+n[r])%256]);return s},e=arguments,s.EeeRFy=!0);var i=t+n[0],o=e[i];return o?a=o:(void 0===s.PjxVvf&&(s.PjxVvf=!0),a=s.EsJeQI(a,r),e[i]=a),a})(e,t)}function i(e,t){return s(e- -227,t)}var o=n(16),l=void 0;function u(){var e=["CCoIWRaSnW","B1ldNd4mWOu","W6jCxW","WO/dJmo+q8kf","W53cHMxcR8oVW5/cMmkMvCkq","WPKCW7m","WQdcUmkQCCkPoCkVW7RdUCkIWRhcVhG","W48SW5pcGgpdSmkR","pvPlxW8","lvDCxcCz","dSkVWQhdUaG","d0XaBrq","hSo8WPBcUSkK","WOJdTSkCW5vk","mmomW7XpBG","t3BdQGWL","fHmfemoubq","mK0qhhu","FKCAd8om","W4PZodFdQIhdMq","W4RdJ8onW5/dVZCD","WQJdTSkGWPjrWRm","W54hW5a","kLe+jvhdN8oqda4","W60oW4nxW4xcSCkGW5rAAa","gfLywZC","dSkHW4neBSkKsmonbCoFEa","yCoAWRugga","W7i9W6RdR8kN","ldqEWRdcICky","W4BdJCkEW5H3","yCoMWP8ipW","zeZdHHmdzWpcStC","W5tcMwxcNHO","WPhcJv4Uwq","WQBcUCkIDCkUomkRW6/dVSkQWO3cHh8","qtX+caNcHH8","quPAsmkljSkUWQWVW4aU","WPiay8kjDG","aJCwWRhcOW","WO/cNCobWRKE","W5lcQ0ldV8kwhCovd1ddGh9wxG","W7NdQJC6qmkvmCkkFa","eWpcUYKLhxJdKsW","W6ldQmotW4FdQW","W7hdPmoPaCo9ACo3","W5iGW5z0W7K","oCohWQhcNmkAWPrtW6Hv","WP9LyW7dL05NW4RcNSoSWQpcQx8","EGFdNcTpWQldMq","WQBcU8kVCCoYsCoiW53dSSkT","WOtcH8k6cHRcGemroW8","l8kXWPZdSSk5WQ3cNG","fY5GmCoIW5TDWQ5SzmkCW4BcPa","sSoHWPyvlq","W4veWR3dPGLVk8kGqW","u2/dPISr","fWZcRSkPW7hcMmob","fSkJWPNdUYW8W6a","W6RcJNxcVWhcLW9sW4OG","W7JdMmorW5yVWPdcMq8","WQeKbe1S","W7BdJmkqWOeZWRpdH1aYza","W4HUpbhdRdddHW","oCooWQVdT8oS","WRFdImo6rSkp","W4hdQSoWkmoL","W5BdLYi","hg1GDby","W7xdQGpcMSk1","qNm6DCk9WOWhWP0","WQdcV3xcRCkHW6tdHWX1","d1qJk8kY","WOdcGM9PWOZcQSkbgaDrWOW","vCo0WPqBlCkO","hgqQxKFcJZ4MWRzcW7u","ybNdPWT4","W6lcGGr+ra","CmoPW4tcR8ouW7VcQ8kqWO05W4BdRW","pqRcHh57WPtdK8oBp8odxq","y3xdQGK6","WQpcRSoQWOCb","WRCAz8kDya","smoLWRWrpq","eYHOnSk4WQikWPLHxW","WQjCs8kcia","rmoJwCoyW7q","EmoJzmoUW4BcIW","naZcICkSW54","W4hdGaJcSmkm","W6hcS8kHWP9cWR/cIKuTta","W7ePW4xdVCkJ","zWrFjqa","fY1HomoHW59DWQXJtCk2W6BcIq","WQ7dTCoey8k4","W7JcIMtdJdy","W6Tkh8oRkN/cNJqJWRz0W5K","WRNdVmkRWOXBWRm","fKiefeG","vK3dLZOT","emo1WQpdTSoA","dsZcOSkPW44","rJn0aI4","WOBcGM9JWO3cQ8k5pcj7WRu","pSolW5nQwJe","WO/dVXtcOmotqW","fYSAWRBcRG","etaXw3Cjve4gtG","gr0Uk8of","WR4CsSkSDsRcTri","W6RcJNxcMZlcOqLJW4i9","W6SCW5hdGmkb"];return(u=function(){return e})()}("undefined"==typeof window?"undefined":t(window))!==i(181,"nr7e")&&(l=window);var c={setCookie:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9999,r={};function a(e,t){return i(t- -175,e)}function s(e,t){return i(e- -730,t)}r[a("YYIM",15)]=function(e,t){return e+t},r[a("7@@f",25)]=function(e,t){return e*t},r[s(-467,"n0#9")]=function(e,t){return e*t},r[s(-510,"2K@$")]=function(e,t){return e+t},r[a("YYIM",58)]=a("#0dY",49),r[s(-490,"v*Co")]=function(e,t){return e+t},r[s(-501,"sLNE")]=function(e,t){return e+t},r[s(-535,"V$Xd")]=function(e,t){return e+t},r[a("P@!o",98)]=function(e,t){return e||t},r[s(-527,"ji2B")]=a("w@1k",19);var o=r;e=o[a("gLJv",101)]("_",e);var u="";if(n){var c=new Date;c[a("kO^J",16)](o[s(-511,"YB3^")](c[a("NW9H",78)](),o[s(-459,"295h")](o[a("6JT5",85)](o[a("N6Wx",31)](o[a("VWEi",81)](n,24),60),60),1e3))),u=o[s(-508,"kO^J")](o[a("295h",82)],c[s(-486,"4)[B")+"g"]())}l[a("o#BD",29)][s(-468,"v&9t")]=o[s(-453,"P@!o")](o[s(-466,"pGSi")](o[a("295h",79)](o[s(-557,"v*Co")](e,"="),o[a("ji2B",48)](t,"")),u),o[a("v&9t",67)])},getCookie:function(e){var t={};function n(e,t){return i(t-752,e)}t[n("nr7e",1010)]=function(e,t){return e+t},t[a(197,"xvVC")]=function(e,t){return e<t},t[a(188,"xde7")]=function(e,t){return e===t};var r=t;function a(e,t){return i(e- -37,t)}e=r[a(165,"295h")]("_",e);for(var s=r[n("%J@R",1001)](e,"="),o=l[n("$i(c",995)][n("#0dY",983)][n("xde7",997)](";"),u=0;r[a(224,"YYIM")](u,o[n("[*([",991)]);u++){for(var c=o[u];r[a(137,"(UiB")](c[a(238,"v*Co")](0)," ");)c=c[n("YYIM",1030)](1,c[n("2K@$",973)]);if(r[n("kO^J",987)](c[n("wtDD",922)](s),0))return c[n("n0#9",1021)](s[n("2K@$",973)],c[n("P@!o",960)])}return null},setStorage:function(e,t){function n(e,t){return i(t- -556,e)}var r={};function a(e,t){return i(t-20,e)}r[a("xvVC",218)]=function(e,t){return e+t},e=r[n("P@!o",-339)]("_",e),l[a("D&YH",290)+"ge"][n("VWEi",-364)](e,t)},getStorage:function(e){var t={};function n(e,t){return i(e-982,t)}return t[n(1256,"xde7")]=function(e,t){return e+t},e=t[n(1181,"%J@R")]("_",e),l[i(241,"Ql%4")+"ge"][n(1179,"ACM^")](e)}};function d(e,t){return s(t-135,e)}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date[i(251,"k6jB")](),t={EvSjI:function(e,t){return e(t)},ZPPMU:function(e){return e()},OVEHq:function(e,t){return e%t},XKmds:function(e,t,n,r){return e(t,n,r)},OfXBm:function(e,t){return e(t)}},n=t[l(-287,"(UiB")](String,e)[h("%J@R",642)](0,10),s=t[h("iRCa",582)](a);function l(e,t){return d(t,e- -864)}var u=t[h("wtDD",640)]((n+"_"+s)[l(-314,"P@!o")]("")[h("#0dY",681)]((function(e,t){return e+t[h("6bD!",599)](0)}),0),1e3),c=t[l(-243,"zRjX")](o,t[l(-270,"n0#9")](String,u),3,"0");function h(e,t){return d(e,t-52)}return r[l(-264,"6JT5")](""+n+c)[h("IxPg",680)](/=/g,"")+"_"+s}function p(e){var t={};function n(e,t){return i(t-678,e)}function r(e,t){return d(t,e- -720)}return t[r(-186,"$i(c")]=function(e,t){return e+t},t[r(-112,"P@!o")](e[n("tJ0$",925)](0)[n("4)[B",871)+"e"](),e[n("O4hK",889)](1))}e[d("ACM^",627)]=function(){var e={oOWEw:function(e,t){return e(t)},ZBntu:function(e,t){return e(t)},ijTRV:r("L*(*",851),SAvBP:function(e){return e()},JxEQk:s(156,"295h"),miNDx:r("$h^o",848)},t=e[s(111,"$h^o")],n={};function r(e,t){return d(e,t-303)}var a=e[r("D&YH",845)](h);function s(e,t){return i(e- -99,t)}return[e[r("4)[B",832)],e[s(117,"$i(c")]][s(80,"7@@f")]((function(i){function o(e,t){return r(e,t-283)}function l(e,t){return s(t- -326,e)}try{var u=o("wtDD",1184)+i+l("D&YH",-157);n[u]=c[l("ZGHp",-224)+e[l("tJ0$",-211)](p,i)](t),!n[u]&&(c[o(")pXx",1196)+e[l("IxPg",-247)](p,i)](t,a),n[u]=a)}catch(d){}})),n}}).call(this,n(1)(e))},function(e,t,n){e.exports=function(e){e=e||21;for(var t="";0<e--;)t+="_~varfunctio0125634789bdegjhklmpqswxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[64*Math.random()|0];return t}},function(e,t,n){e.exports=function(e,t,n){if("string"!=typeof e)throw new Error("The string parameter must be a string.");if(e.length<1)throw new Error("The string parameter must be 1 character or longer.");if("number"!=typeof t)throw new Error("The length parameter must be a number.");if("string"!=typeof n&&n)throw new Error("The character parameter must be a string.");var r=-1;for(t-=e.length,n||0===n||(n=" ");++r<t;)e+=n;return e}}])}).call(this,n(88))},88:function(e,t){var n,r,a=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(r){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l,u=[],c=!1,d=-1;function h(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&p())}function p(){if(!c){var e=o(h);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d<t;)l&&l[d].run();d=-1,t=u.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(n){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new f(e,t)),1!==u.length||c||o(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=m,a.addListener=m,a.once=m,a.off=m,a.removeListener=m,a.removeAllListeners=m,a.emit=m,a.prependListener=m,a.prependOnceListener=m,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}}}),window.pddPifaSign=()=>new(Ts(291))({serverTime:Date.now()}).messagePack();const Ns={class:"pdd-pifa-search"},Es={class:"filter-wrap"},Rs={class:"filter-item"},$s={class:"filter-item"},Os={class:"list-wrap"},Fs=["href"],Ds={class:"info-wrap"},Ms=["src"],Ls={class:"title"},Bs=["innerHTML"],Ps={class:"price-wrap"},zs={class:"price"},Gs={class:"prefix"},Vs={key:0,class:"sold"},Us={key:0,class:"mall-wrap"},Hs=["innerHTML"],js=["innerHTML"],qs={key:0,class:"error-tip"},Qs={class:"left"},Xs={class:"center"},Zs={class:"sub-title"},Ks={class:"right"},Js={href:"https://pifa.pinduoduo.com",target:"_blank"},Ys={key:1,class:"error-tip"},ei={class:"left"},ti={class:"center"},ni={class:"sub-title"},ri={class:"right"},ai={key:2,class:"loading-wrap"},si={class:"text"},ii={key:3,style:{padding:"20px"}},oi={key:4,class:"bottom-tip"},li=ye({__name:"pinduoduo-pifa",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(e,{emit:t}){be();const n=e,r=t,s=F(""),d=F(""),h=F(""),p=F([]),f=F(""),m=F("正在图搜同款"),g=J((()=>h.value?p.value.filter((e=>e.title&&e.title.includes(h.value)||e.location&&e.location.includes(h.value)||e.mall&&e.mall.includes(h.value))):p.value)),y=F(""),b=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):e.sort(((e,t)=>e.index-t.index)),e),v=e=>{p.value=b([...p.value],e)},A=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)},x=async()=>{p.value=[],s.value="",await C()&&await I()};let k,w="",S=1;const C=async()=>{if("loading"==s.value||"finish"==s.value)return;s.value="loading",m.value="正在图搜同款",r("update:loading",!0);const e=await mn({method:"POST",credentials:"same-origin",url:"https://pifa.pinduoduo.com/mille/slow/upload/uploadSearchImage",form:{file:{url:n.imgUrl,filename:"image.png"}},headers:{"Anti-Content":window.pddPifaSign()}});return e.success?(w=e.result.imageUrl,!0):(s.value="error",r("update:loading",!1),d.value="请尝试登录拼多多批发,或稍后再试",!1)},I=async()=>{s.value="loading",m.value="正在图搜同款",r("update:loading",!0);const e=await mn({method:"POST",credentials:"same-origin",url:"https://pifa.pinduoduo.com/pifa/search/searchImageGoods",body:JSON.stringify({level:1,optId:0,page:S,rn:k,propertyItems:[],size:20,sort:0,url:w}),headers:{"Anti-Content":window.pddPifaSign(),"content-type":"application/json"}});if(e.error_code||!1===e.success)return s.value="error",r("update:loading",!1),void(d.value="请尝试登录拼多多批发,或稍后再试");if(!e.result)return s.value="finish",void r("update:loading",!1);k=e.result.rn;let t=e.result.goodsList.map(((e,t)=>{let n=e.salesTipAmount;return n=n.replace("万","0000"),n=n.replace("+",""),n=parseInt(n),{index:t+20*S,id:e.goodsId,currency:"¥",title:e.goodsName,price:e.goodsWholeSalePrice/100,sold:n,thumb:e.goodsImgUrl,url:`https://pifa.pinduoduo.com/goods/detail/?gid=${e.goodsId}`,mall:e.mallName,tag:null,location:e.mallGoodsRegion}}));t=b(t,y.value),p.value=p.value.concat(t),s.value="success",r("update:loading",!1)},W=async()=>{"visible"===document.visibilityState&&"error"===s.value&&await C()&&await I()},_=()=>{if("loading"==s.value||"finish"==s.value||"error"==s.value)return;const e=document.documentElement.scrollTop||document.body.scrollTop,t=document.documentElement.scrollHeight||document.body.scrollHeight;if(e+(document.documentElement.clientHeight||document.body.clientHeight)>=t-600){S++;try{I()}catch(gQ){s.value="error",d.value="请尝试登录拼多多批发,或稍后再试",r("update:loading",!1)}}};return ue((async()=>{const e=await fn();return e.error_code?(s.value="install-error",void(d.value="您还没有安装插件,请点击'下载插件'进行安装")):(f.value=e.version,a(f.value,"1.0.9")?(s.value="install-error",void(d.value="您的插件版本过低,请点击'下载插件'进行更新")):(await C()&&await I(),document.addEventListener("visibilitychange",W),void window.addEventListener("scroll",_)))})),ve((()=>{document.removeEventListener("visibilitychange",W),window.removeEventListener("scroll",_)})),(e,t)=>{const n=i,r=o,a=l,p=Oe,f=Ne,b=Ke,k=Ee("router-link"),w=u,S=Re;return Ae(),xe("div",Ns,[ke("div",Es,[ke("span",Rs,[t[7]||(t[7]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:y.value,"onUpdate:value":t[0]||(t[0]=e=>y.value=e),style:{width:"130px"},onChange:v},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"sold-max-min"},{default:we((()=>t[4]||(t[4]=[Se("销量从高到低")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[5]||(t[5]=[Se("价格从高到低")]))),_:1}),$(n,{value:"sold-min-max"},{default:we((()=>t[6]||(t[6]=[Se("销量从低到高")]))),_:1})])),_:1},8,["value"])]),ke("span",$s,[t[8]||(t[8]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),ke("div",Os,[(Ae(!0),xe(D,null,Ce(g.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",Ds,[ke("img",{src:e.thumb,class:"thumb"},null,8,Ms),ke("div",Ls,[e.tag?(Ae(),$e(p,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:A(e.title,h.value)},null,8,Bs)]),ke("div",Ps,[ke("span",zs,[ke("span",Gs,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",Vs,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",Us,[ke("span",{class:"mall",innerHTML:A(e.mall,h.value)},null,8,Hs),ke("span",{class:"location",innerHTML:A(e.location,h.value)},null,8,js)])):Te("",!0)],8,Fs)))),128))]),"error"===s.value?(Ae(),xe("div",qs,[ke("div",Qs,[$(Ie(We),{class:"icon"})]),ke("div",Xs,[t[9]||(t[9]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Zs,_e(d.value),1)]),ke("div",Ks,[$(b,null,{default:we((()=>[ke("a",Js,[$(f,{type:"primary"},{default:we((()=>t[10]||(t[10]=[Se(" 打开拼多多批发 ")]))),_:1})]),$(f,{onClick:x},{default:we((()=>t[11]||(t[11]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===s.value?(Ae(),xe("div",Ys,[ke("div",ei,[$(Ie(We),{class:"icon"})]),ke("div",ti,[t[12]||(t[12]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",ni,_e(d.value),1)]),ke("div",ri,[$(b,null,{default:we((()=>[$(k,{target:"_blank",to:"/download"},{default:we((()=>[$(f,{type:"primary"},{default:we((()=>t[13]||(t[13]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===s.value||""===s.value?(Ae(),xe("div",ai,[$(w,{size:"large"}),ke("span",si,_e(m.value),1)])):Te("",!0),"success"!==s.value&&"finish"!==s.value||0!==g.value.length?Te("",!0):(Ae(),xe("div",ii,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&g.value.length>0?(Ae(),xe("div",oi,t[14]||(t[14]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-f5262ae2"]]),ui={class:"1688xunyuantong-search"},ci={class:"filter-wrap"},di={class:"filter-item"},hi={class:"filter-item"},pi={class:"list-wrap"},fi=["href"],mi={class:"info-wrap"},gi=["src"],yi={class:"title"},bi=["innerHTML"],vi={class:"price-wrap"},Ai={class:"price"},xi={class:"prefix"},ki={key:0,class:"sold"},wi={key:0,class:"mall-wrap"},Si=["innerHTML"],Ci=["innerHTML"],Ii={key:0,class:"error-tip"},Wi={class:"left"},_i={class:"center"},Ti={class:"sub-title"},Ni={class:"right"},Ei={key:1,class:"error-tip"},Ri={class:"left"},$i={class:"center"},Oi={class:"sub-title"},Fi={class:"right"},Di={key:2,class:"loading-wrap"},Mi={class:"text"},Li={key:3,style:{padding:"20px"}},Bi={key:4,class:"bottom-tip"},Pi=ye({__name:"taobao",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(t,{emit:n}){be();const r=t,a=n,s=F(""),d=F(""),h=F(""),p=F([]),f=F("正在图搜同款"),m=J((()=>h.value?p.value.filter((e=>e.title&&e.title.includes(h.value)||e.location&&e.location.includes(h.value)||e.mall&&e.mall.includes(h.value))):p.value)),g=F(""),y=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),b=e=>{p.value=y([...p.value],e)},v=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)};let A="",x=1;const k=async()=>{A="",x=1,p.value=[],s.value="",await w()&&await S()},w=async()=>{if(A)return!0;const e=document.createElement("canvas"),t=e.getContext("2d"),n=new Image;return n.crossOrigin="Anonymous",n.src=r.imgUrl,await new Promise((r=>{n.onload=function(){e.width=n.width,e.height=n.height,t.drawImage(n,0,0,n.width,n.height),A=e.toDataURL("image/jpeg").replace(/^data:image\/(png|jpg|jpeg);base64,/,""),r()}})),!0},S=async()=>{s.value="loading",f.value="正在图搜同款",a("update:loading",!0);const t=await(async(t,n,r)=>(await e.post("/api/v1/union/search-image/taobao",E.stringify({base64:t,page:n,size:r}))).data)(A,x,20);if(0!==t.code)return a("update:loading",!1),s.value="error",void(d.value=t.msg);if(0===t.data.length)return a("update:loading",!1),void(s.value="finish");let n=t.data.map(((e,t)=>({index:100*x+t,currency:"¥",title:e.title,price:e.price,sold:e.sold,thumb:e.thumb,url:e.url,mall:e.shopTitle,location:e.location})));n=y(n,g.value),p.value=p.value.concat(n),s.value="success",a("update:loading",!1)},C=async()=>{"visible"===document.visibilityState&&"error"===s.value&&await w()&&await S()},I=()=>{if("loading"==s.value||"finish"==s.value||"error"==s.value)return;const e=document.documentElement.scrollTop||document.body.scrollTop,t=document.documentElement.scrollHeight||document.body.scrollHeight;if(e+(document.documentElement.clientHeight||document.body.clientHeight)>=t-600){x++;try{S()}catch(gQ){s.value="error",d.value="请重新尝试搜索,或稍后再试",a("update:loading",!1)}}};return ue((async()=>{document.addEventListener("visibilitychange",C),window.addEventListener("scroll",I),await w()&&await S()})),ve((()=>{document.removeEventListener("visibilitychange",C),window.removeEventListener("scroll",I)})),(e,t)=>{const n=i,r=o,a=l,p=Oe,y=Ne,A=Ke,x=Ee("router-link"),w=u,S=Re;return Ae(),xe("div",ui,[ke("div",ci,[ke("span",di,[t[7]||(t[7]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:g.value,"onUpdate:value":t[0]||(t[0]=e=>g.value=e),style:{width:"130px"},onChange:b},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"sold-max-min"},{default:we((()=>t[4]||(t[4]=[Se("销量从高到低")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[5]||(t[5]=[Se("价格从高到低")]))),_:1}),$(n,{value:"sold-min-max"},{default:we((()=>t[6]||(t[6]=[Se("销量从低到高")]))),_:1})])),_:1},8,["value"])]),ke("span",hi,[t[8]||(t[8]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 /店铺名 / 发货地",style:{width:"200px"}},null,8,["value"])])]),ke("div",pi,[(Ae(!0),xe(D,null,Ce(m.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",mi,[ke("img",{src:e.thumb,class:"thumb"},null,8,gi),ke("div",yi,[e.tag?(Ae(),$e(p,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:v(e.title,h.value)},null,8,bi)]),ke("div",vi,[ke("span",Ai,[ke("span",xi,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",ki,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",wi,[ke("span",{class:"mall",innerHTML:v(e.mall,h.value)},null,8,Si),ke("span",{class:"location",innerHTML:v(e.location,h.value)},null,8,Ci)])):Te("",!0)],8,fi)))),128))]),"error"===s.value?(Ae(),xe("div",Ii,[ke("div",Wi,[$(Ie(We),{class:"icon"})]),ke("div",_i,[t[9]||(t[9]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Ti,_e(d.value),1)]),ke("div",Ni,[$(A,null,{default:we((()=>[$(y,{onClick:k},{default:we((()=>t[10]||(t[10]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===s.value?(Ae(),xe("div",Ei,[ke("div",Ri,[$(Ie(We),{class:"icon"})]),ke("div",$i,[t[11]||(t[11]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",Oi,_e(d.value),1)]),ke("div",Fi,[$(A,null,{default:we((()=>[$(x,{target:"_blank",to:"/download"},{default:we((()=>[$(y,{type:"primary"},{default:we((()=>t[12]||(t[12]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===s.value||""===s.value?(Ae(),xe("div",Di,[$(w,{size:"large"}),ke("span",Mi,_e(f.value),1)])):Te("",!0),"success"!==s.value&&"finish"!==s.value||0!==m.value.length?Te("",!0):(Ae(),xe("div",Li,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&m.value.length>0?(Ae(),xe("div",Bi,t[13]||(t[13]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-eec6ade3"]]);class zi{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class Gi{refCount(e){return Vi("refCount")}incRef(e){return Vi("incRef")}timerAvailable(){return!0}time(e){return Vi("time")}read(e){return Vi("read")}readSync(e){return Vi("readSync")}readToGPU(e,t){return Vi("readToGPU")}numDataIds(){return Vi("numDataIds")}disposeData(e,t){return Vi("disposeData")}write(e,t,n){return Vi("write")}move(e,t,n,r,a){return Vi("move")}createTensorFromGPUData(e,t,n){return Vi("createTensorFromGPUData")}memory(){return Vi("memory")}floatPrecision(){return Vi("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return Vi("dispose")}}function Vi(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Ui(e){let t=e.length,n=0;for(;t>0;)n=Math.random()*t|0,t--,qi(e,t,n)}function Hi(e,t,n){return Math.max(e,Math.min(t,n))}function ji(e){return e%2==0?e:e+1}function qi(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Qi(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t}function Xi(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function Zi(e,t,n=""){Xi(eo(e,t),(()=>n+` Shapes ${e} and ${t} must match`))}function Ki(e){Xi(null!=e,(()=>"The input to the tensor constructor must be a non-null value."))}function Ji(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function Yi(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(null!==e[n]&&null!==t[n]&&e[n]!==t[n])return!1;return!0}function eo(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function to(e){return e%1==0}function no(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function ro(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function ao(e,t=e=>0,n,r){return new Promise(((a,s)=>{let i=0;const o=()=>{if(e())return void a();i++;const l=t(i);null!=n&&i>=n?s():null!=r?r(o,l):setTimeout(o,l)};o()}))}function so(e,t){let n=1,r=-1;for(let s=0;s<e.length;++s)if(e[s]>=0)n*=e[s];else if(-1===e[s]){if(-1!==r)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${s}`);r=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(-1===r){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(0===n)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!=0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);const a=e.slice();return a[r]=t/n,a}function io(e,t){const n=t.length;return Xi((e=null==e?t.map(((e,t)=>t)):[].concat(e)).every((e=>e>=-n&&e<n)),(()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`)),Xi(e.every((e=>to(e))),(()=>`All values in axis param must be integers but got axis ${e}`)),e.map((e=>e<0?n+e:e))}function oo(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||a?null:io(t,e).sort();let i=0;for(let o=0;o<e.length;++o){if(null!=s){if(s[i]===o&&1!==e[o])throw new Error(`Can't squeeze axis ${o} since its dim '${e[o]}' is not 1`);(null==s[i]||s[i]>o)&&1===e[o]&&(n.push(e[o]),r.push(o)),s[i]<=o&&i++}1!==e[o]&&(n.push(e[o]),r.push(o))}return{newShape:n,keptDims:r}}function lo(e,t){return uo(e,t)}function uo(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}function co(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(isNaN(r)||!isFinite(r))throw Error(`A tensor of type ${t} being uploaded contains ${r}.`)}}function ho(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e}function po(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function fo(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function mo(e){if(null==e)return 0;let t=0;return e.forEach((e=>t+=e.length)),t}function go(e){return"string"==typeof e||e instanceof String}function yo(e){return"boolean"==typeof e}function bo(e){return"number"==typeof e}function vo(e){return Array.isArray(e)?vo(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":bo(e)?"float32":go(e)?"string":yo(e)?"bool":"float32"}function Ao(e){return!!(e&&e.constructor&&e.call&&e.apply)}function xo(e,t){for(let n=t;n<e;++n)if(e%n==0)return n;return e}function ko(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n}function wo(e,t,n,r=!1){const a=new Array;if(1===t.length){const s=t[0]*(r?2:1);for(let t=0;t<s;t++)a[t]=n[e+t]}else{const s=t[0],i=t.slice(1),o=i.reduce(((e,t)=>e*t))*(r?2:1);for(let t=0;t<s;t++)a[t]=wo(e+t*o,i,n,r)}return a}function So(e,t,n=!1){if(0===e.length)return t[0];const r=e.reduce(((e,t)=>e*t))*(n?2:1);if(0===r)return[];if(r!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return wo(0,e,t,n)}function Co(e,t){if(Array.isArray(e))return e;if("float32"===t)return e instanceof Float32Array?e:new Float32Array(e);if("int32"===t)return e instanceof Int32Array?e:new Int32Array(e);if("bool"===t||"string"===t)return Uint8Array.from(new Int32Array(e));throw new Error(`Unknown dtype ${t}`)}function Io(e,t){const n=Wo(e,t);for(let r=0;r<n.length;r++)n[r]=1;return n}function Wo(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function _o(e,t){const n=e.reduce(((e,t)=>e*t),1);if(null==t||"float32"===t)return So(e,new Float32Array(n));if("int32"===t)return So(e,new Int32Array(n));if("bool"===t)return So(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function To(e){e.forEach((t=>{Xi(Number.isInteger(t)&&t>=0,(()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`))}))}function No(e,t,n){if(0===t)return 0;if(1===t)return e[0];let r=e[e.length-1];for(let a=0;a<e.length-1;++a)r+=n[a]*e[a];return r}function Eo(e,t,n){if(0===t)return[];if(1===t)return[e];const r=new Array(t);for(let a=0;a<r.length-1;++a)r[a]=Math.floor(e/n[a]),e-=r[a]*n[a];return r[r.length-1]=e,r}function Ro(e){return e&&e.then&&"function"==typeof e.then}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $o="tfjsflags";class Oo{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=Fo,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&!Do().getBool("IS_TEST")&&Do().getBool("PROD"),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){const t=this.urlFlags[e];!Do().getBool("IS_TEST")&&Do().getBool("PROD"),this.set(e,t)}}async getAsync(e){return e in this.flags||(this.flags[e]=await this.evaluateFlag(e)),this.flags[e]}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if(Ro(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(null==this.flagRegistry[e])throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(null==this.flagRegistry[e])throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(void 0===this.global||void 0===this.global.location||void 0===this.global.location.search)return;const e=this.getQueryParams(this.global.location.search);if($o in e){e[$o].split(",").forEach((e=>{const[t,n]=e.split(":");this.urlFlags[t]=function(e,t){const n=t.toLowerCase();return"true"===n||"false"===n?"true"===n:""+ +n===n?+n:t}(0,n)}))}}}function Fo(e){const t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,((e,...n)=>(function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("=")))),t}function Do(){return Lo}let Mo,Lo=null;function Bo(){if(null==Mo){let e;if("undefined"!=typeof window)e=window;else if("undefined"!=typeof global)e=global;else if("undefined"!=typeof process)e=process;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}Mo=e}return Mo}function Po(e,t){const n=function(){const e=Bo();return null==e._tfGlobals&&(e._tfGlobals=new Map),e._tfGlobals}();if(n.has(e))return n.get(e);{const r=t();return n.set(e,r),n.get(e)}}const zo="Abs",Go="Acos",Vo="Acosh",Uo="Add",Ho="AddN",jo="All",qo="Any",Qo="ArgMax",Xo="ArgMin",Zo="Asin",Ko="Asinh",Jo="Atan",Yo="Atanh",el="Atan2",tl="AvgPool",nl="AvgPoolGrad",rl="AvgPool3D",al="AvgPool3DGrad",sl="BatchMatMul",il="BatchToSpaceND",ol="Bincount",ll="BitwiseAnd",ul="BroadcastTo",cl="BroadcastArgs",dl="Cast",hl="Ceil",pl="ClipByValue",fl="Complex",ml="ComplexAbs",gl="Concat",yl="Conv2D",bl="Conv2DBackpropFilter",vl="Conv2DBackpropInput",Al="Conv3D",xl="Conv3DBackpropFilterV2",kl="Conv3DBackpropInputV2",wl="Cos",Sl="Cosh",Cl="Cumprod",Il="Cumsum",Wl="CropAndResize",_l="DenseBincount",Tl="DepthToSpace",Nl="DepthwiseConv2dNative",El="DepthwiseConv2dNativeBackpropFilter",Rl="DepthwiseConv2dNativeBackpropInput",$l="Diag",Ol="Dilation2D",Fl="Dilation2DBackpropInput",Dl="Dilation2DBackpropFilter",Ml="Draw",Ll="RealDiv",Bl="Einsum",Pl="Elu",zl="EluGrad",Gl="Erf",Vl="Equal",Ul="Exp",Hl="ExpandDims",jl="Expm1",ql="FFT",Ql="Fill",Xl="FlipLeftRight",Zl="Floor",Kl="FloorDiv",Jl="FusedBatchNorm",Yl="GatherV2",eu="GatherNd",tu="Greater",nu="GreaterEqual",ru="Identity",au="IFFT",su="Imag",iu="IsFinite",ou="IsInf",lu="IsNan",uu="LeakyRelu",cu="Less",du="LessEqual",hu="LinSpace",pu="Log",fu="Log1p",mu="LogicalAnd",gu="LogicalNot",yu="LogicalOr",bu="LogSoftmax",vu="LRN",Au="LRNGrad",xu="Max",ku="Maximum",wu="MaxPool",Su="MaxPoolGrad",Cu="MaxPool3D",Iu="MaxPool3DGrad",Wu="MaxPoolWithArgmax",_u="Mean",Tu="Min",Nu="Minimum",Eu="MirrorPad",Ru="Mod",$u="Multinomial",Ou="Multiply",Fu="Neg",Du="NotEqual",Mu="NonMaxSuppressionV3",Lu="NonMaxSuppressionV4",Bu="NonMaxSuppressionV5",Pu="OnesLike",zu="OneHot",Gu="Pack",Vu="PadV2",Uu="Pow",Hu="Prelu",ju="Prod",qu="RaggedGather",Qu="RaggedRange",Xu="RaggedTensorToTensor",Zu="Range",Ku="Real",Ju="Reciprocal",Yu="Relu",ec="Reshape",tc="ResizeNearestNeighbor",nc="ResizeNearestNeighborGrad",rc="ResizeBilinear",ac="ResizeBilinearGrad",sc="Relu6",ic="Reverse",oc="Round",lc="Rsqrt",uc="ScatterNd",cc="TensorScatterUpdate",dc="SearchSorted",hc="Select",pc="Selu",fc="Slice",mc="Sin",gc="Sinh",yc="Sign",bc="Sigmoid",vc="Softplus",Ac="Sqrt",xc="Sum",kc="SpaceToBatchND",wc="SplitV",Sc="Softmax",Cc="SparseFillEmptyRows",Ic="SparseReshape",Wc="SparseSegmentMean",_c="SparseSegmentSum",Tc="SparseToDense",Nc="SquaredDifference",Ec="Square",Rc="StaticRegexReplace",$c="StridedSlice",Oc="StringNGrams",Fc="StringSplit",Dc="StringToHashBucketFast",Mc="Sub",Lc="Tan",Bc="Tanh",Pc="Tile",zc="TopK",Gc="Transform",Vc="Transpose",Uc="Unique",Hc="Unpack",jc="UnsortedSegmentSum",qc="ZerosLike",Qc="Step",Xc="FromPixels",Zc="RotateWithOffset",Kc="_FusedMatMul",Jc="FusedConv2D",Yc="FusedDepthwiseConv2D";
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function ed(...e){!Do().getBool("IS_TEST")&&Do().getBool("PROD")}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const td=Po("kernelRegistry",(()=>new Map)),nd=Po("gradRegistry",(()=>new Map));function rd(e,t){const n=ld(e,t);return td.get(n)}function ad(e){return nd.get(e)}function sd(e){const t=td.entries(),n=[];for(;;){const{done:r,value:a}=t.next();if(r)break;const[s,i]=a,[o]=s.split("_");o===e&&n.push(i)}return n}function id(e){const{kernelName:t,backendName:n}=e,r=ld(t,n);td.has(r)&&ed(),td.set(r,e)}function od(e){const{kernelName:t}=e;nd.has(t)&&Do().getBool("DEBUG")&&ed(),nd.set(t,e)}function ld(e,t){return`${t}_${e}`}
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ud(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}var cd=hd,dd=null;try{dd=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(gQ){}function hd(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function pd(e){return!0===(e&&e.__isLong__)}hd.prototype.__isLong__,Object.defineProperty(hd.prototype,"__isLong__",{value:!0}),hd.isLong=pd;var fd={},md={};function gd(e,t){var n,r,a;return t?(a=0<=(e>>>=0)&&e<256)&&(r=md[e])?r:(n=bd(e,(0|e)<0?-1:0,!0),a&&(md[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(r=fd[e])?r:(n=bd(e,e<0?-1:0,!1),a&&(fd[e]=n),n)}function yd(e,t){if(isNaN(e))return t?Wd:Id;if(t){if(e<0)return Wd;if(e>=wd)return Rd}else{if(e<=-Sd)return $d;if(e+1>=Sd)return Ed}return e<0?yd(-e,t).neg():bd(e%kd|0,e/kd|0,t)}function bd(e,t,n){return new hd(e,t,n)}hd.fromInt=gd,hd.fromNumber=yd,hd.fromBits=bd;var vd=Math.pow;function Ad(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return Id;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return Ad(e.substring(1),t,n).neg();for(var a=yd(vd(n,8)),s=Id,i=0;i<e.length;i+=8){var o=Math.min(8,e.length-i),l=parseInt(e.substring(i,i+o),n);if(o<8){var u=yd(vd(n,o));s=s.mul(u).add(yd(l))}else s=(s=s.mul(a)).add(yd(l))}return s.unsigned=t,s}function xd(e,t){return"number"==typeof e?yd(e,t):"string"==typeof e?Ad(e,t):bd(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}hd.fromString=Ad,hd.fromValue=xd;var kd=4294967296,wd=kd*kd,Sd=wd/2,Cd=gd(1<<24),Id=gd(0);hd.ZERO=Id;var Wd=gd(0,!0);hd.UZERO=Wd;var _d=gd(1);hd.ONE=_d;var Td=gd(1,!0);hd.UONE=Td;var Nd=gd(-1);hd.NEG_ONE=Nd;var Ed=bd(-1,2147483647,!1);hd.MAX_VALUE=Ed;var Rd=bd(-1,-1,!0);hd.MAX_UNSIGNED_VALUE=Rd;var $d=bd(0,-2147483648,!1);hd.MIN_VALUE=$d;var Od=hd.prototype;Od.toInt=function(){return this.unsigned?this.low>>>0:this.low},Od.toNumber=function(){return this.unsigned?(this.high>>>0)*kd+(this.low>>>0):this.high*kd+(this.low>>>0)},Od.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq($d)){var t=yd(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var a=yd(vd(e,6),this.unsigned),s=this,i="";;){var o=s.div(a),l=(s.sub(o.mul(a)).toInt()>>>0).toString(e);if((s=o).isZero())return l+i;for(;l.length<6;)l="0"+l;i=""+l+i}},Od.getHighBits=function(){return this.high},Od.getHighBitsUnsigned=function(){return this.high>>>0},Od.getLowBits=function(){return this.low},Od.getLowBitsUnsigned=function(){return this.low>>>0},Od.getNumBitsAbs=function(){if(this.isNegative())return this.eq($d)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},Od.isZero=function(){return 0===this.high&&0===this.low},Od.eqz=Od.isZero,Od.isNegative=function(){return!this.unsigned&&this.high<0},Od.isPositive=function(){return this.unsigned||this.high>=0},Od.isOdd=function(){return!(1&~this.low)},Od.isEven=function(){return!(1&this.low)},Od.equals=function(e){return pd(e)||(e=xd(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},Od.eq=Od.equals,Od.notEquals=function(e){return!this.eq(e)},Od.neq=Od.notEquals,Od.ne=Od.notEquals,Od.lessThan=function(e){return this.comp(e)<0},Od.lt=Od.lessThan,Od.lessThanOrEqual=function(e){return this.comp(e)<=0},Od.lte=Od.lessThanOrEqual,Od.le=Od.lessThanOrEqual,Od.greaterThan=function(e){return this.comp(e)>0},Od.gt=Od.greaterThan,Od.greaterThanOrEqual=function(e){return this.comp(e)>=0},Od.gte=Od.greaterThanOrEqual,Od.ge=Od.greaterThanOrEqual,Od.compare=function(e){if(pd(e)||(e=xd(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},Od.comp=Od.compare,Od.negate=function(){return!this.unsigned&&this.eq($d)?$d:this.not().add(_d)},Od.neg=Od.negate,Od.add=function(e){pd(e)||(e=xd(e));var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,s=e.high>>>16,i=65535&e.high,o=e.low>>>16,l=0,u=0,c=0,d=0;return c+=(d+=a+(65535&e.low))>>>16,u+=(c+=r+o)>>>16,l+=(u+=n+i)>>>16,l+=t+s,bd((c&=65535)<<16|(d&=65535),(l&=65535)<<16|(u&=65535),this.unsigned)},Od.subtract=function(e){return pd(e)||(e=xd(e)),this.add(e.neg())},Od.sub=Od.subtract,Od.multiply=function(e){if(this.isZero())return Id;if(pd(e)||(e=xd(e)),dd)return bd(dd.mul(this.low,this.high,e.low,e.high),dd.get_high(),this.unsigned);if(e.isZero())return Id;if(this.eq($d))return e.isOdd()?$d:Id;if(e.eq($d))return this.isOdd()?$d:Id;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Cd)&&e.lt(Cd))return yd(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,s=e.high>>>16,i=65535&e.high,o=e.low>>>16,l=65535&e.low,u=0,c=0,d=0,h=0;return d+=(h+=a*l)>>>16,c+=(d+=r*l)>>>16,d&=65535,c+=(d+=a*o)>>>16,u+=(c+=n*l)>>>16,c&=65535,u+=(c+=r*o)>>>16,c&=65535,u+=(c+=a*i)>>>16,u+=t*l+n*o+r*i+a*s,bd((d&=65535)<<16|(h&=65535),(u&=65535)<<16|(c&=65535),this.unsigned)},Od.mul=Od.multiply,Od.divide=function(e){if(pd(e)||(e=xd(e)),e.isZero())throw Error("division by zero");var t,n,r;if(dd)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?bd((this.unsigned?dd.div_u:dd.div_s)(this.low,this.high,e.low,e.high),dd.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Wd:Id;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Wd;if(e.gt(this.shru(1)))return Td;r=Wd}else{if(this.eq($d))return e.eq(_d)||e.eq(Nd)?$d:e.eq($d)?_d:(t=this.shr(1).div(e).shl(1)).eq(Id)?e.isNegative()?_d:Nd:(n=this.sub(e.mul(t)),r=t.add(n.div(e)));if(e.eq($d))return this.unsigned?Wd:Id;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=Id}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),s=a<=48?1:vd(2,a-48),i=yd(t),o=i.mul(e);o.isNegative()||o.gt(n);)o=(i=yd(t-=s,this.unsigned)).mul(e);i.isZero()&&(i=_d),r=r.add(i),n=n.sub(o)}return r},Od.div=Od.divide,Od.modulo=function(e){return pd(e)||(e=xd(e)),dd?bd((this.unsigned?dd.rem_u:dd.rem_s)(this.low,this.high,e.low,e.high),dd.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},Od.mod=Od.modulo,Od.rem=Od.modulo,Od.not=function(){return bd(~this.low,~this.high,this.unsigned)},Od.and=function(e){return pd(e)||(e=xd(e)),bd(this.low&e.low,this.high&e.high,this.unsigned)},Od.or=function(e){return pd(e)||(e=xd(e)),bd(this.low|e.low,this.high|e.high,this.unsigned)},Od.xor=function(e){return pd(e)||(e=xd(e)),bd(this.low^e.low,this.high^e.high,this.unsigned)},Od.shiftLeft=function(e){return pd(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?bd(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):bd(0,this.low<<e-32,this.unsigned)},Od.shl=Od.shiftLeft,Od.shiftRight=function(e){return pd(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?bd(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):bd(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},Od.shr=Od.shiftRight,Od.shiftRightUnsigned=function(e){if(pd(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?bd(this.low>>>e|t<<32-e,t>>>e,this.unsigned):bd(32===e?t:t>>>e-32,0,this.unsigned)},Od.shru=Od.shiftRightUnsigned,Od.shr_u=Od.shiftRightUnsigned,Od.toSigned=function(){return this.unsigned?bd(this.low,this.high,!1):this},Od.toUnsigned=function(){return this.unsigned?this:bd(this.low,this.high,!0)},Od.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},Od.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},Od.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},hd.fromBytes=function(e,t,n){return n?hd.fromBytesLE(e,t):hd.fromBytesBE(e,t)},hd.fromBytesLE=function(e,t){return new hd(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},hd.fromBytesBE=function(e,t){return new hd(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};const Fd=ge(cd),Dd=Fd||rt({__proto__:null,default:Fd},[cd]);function Md(e){return Dd.fromString(e,!0,16)}const Ld=Md("c3a5c85c97cb3127"),Bd=Md("b492b66fbe98f273"),Pd=Md("9ae16a3b2f90404f");function zd(e){return e.xor(e.shru(47))}function Gd(e,t,n){const r=e.slice(t,t+n);return Dd.fromBytes(Array.from(r),!0,!0)}function Vd(e,t){return Gd(e,t,8)}function Ud(e,t){return Gd(e,t,4)}function Hd(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function jd(e,t,n=Md("9ddfea08eb382d69")){let r=e.xor(t).mul(n);r=r.xor(r.shru(47));let a=t.xor(r).mul(n);return a=a.xor(a.shru(47)),a=a.mul(n),a}function qd(e,t,n,r){return function(e,t,n,r,a,s){a=a.add(e),s=Hd(s.add(a).add(r),21);const i=a;return a=(a=a.add(t)).add(n),s=s.add(Hd(a,44)),[a.add(r),s.add(i)]}(Vd(e,t),Vd(e,t+8),Vd(e,t+16),Vd(e,t+24),n,r)}function Qd(e,t=e.length){const n=Dd.fromNumber(81,!0);if(t<=32)return t<=16?function(e,t=e.length){if(t>=8){const n=Pd.add(2*t),r=Vd(e,0).add(Pd),a=Vd(e,t-8);return jd(Hd(a,37).mul(n).add(r),Hd(r,25).add(a).mul(n),n)}if(t>=4){const n=Pd.add(2*t);return jd(Ud(e,0).shl(3).add(t),Ud(e,t-4),n)}if(t>0){const n=e[0]+(e[t>>1]<<8),r=t+(e[t-1]<<2);return zd(Pd.mul(n).xor(Ld.mul(r))).mul(Pd)}return Pd}(e,t):function(e,t=e.length){const n=Pd.add(2*t),r=Vd(e,0).mul(Bd),a=Vd(e,8),s=Vd(e,t-8).mul(n),i=Vd(e,t-16).mul(Pd);return jd(Hd(r.add(a),43).add(Hd(s,30)).add(i),r.add(Hd(a.add(Pd),18)).add(s),n)}(e,t);if(t<=64)return function(e,t=e.length){const n=Pd.add(2*t),r=Vd(e,0).mul(Pd),a=Vd(e,8),s=Vd(e,t-8).mul(n),i=Vd(e,t-16).mul(Pd),o=Hd(r.add(a),43).add(Hd(s,30)).add(i),l=jd(o,r.add(Hd(a.add(Pd),18)).add(s),n),u=Vd(e,16).mul(n),c=Vd(e,24),d=o.add(Vd(e,t-32)).mul(n),h=l.add(Vd(e,t-24)).mul(n);return jd(Hd(u.add(c),43).add(Hd(d,30)).add(h),u.add(Hd(c.add(r),18)).add(d),n)}(e,t);let r=n,a=n.mul(Bd).add(113),s=zd(a.mul(Pd).add(113)).mul(Pd),i=[Dd.UZERO,Dd.UZERO],o=[Dd.UZERO,Dd.UZERO];r=r.mul(Pd).add(Vd(e,0));let l=0;const u=64*(t-1>>6),c=u+(t-1&63)-63;do{r=Hd(r.add(a).add(i[0]).add(Vd(e,l+8)),37).mul(Bd),a=Hd(a.add(i[1]).add(Vd(e,l+48)),42).mul(Bd),r=r.xor(o[1]),a=a.add(i[0]).add(Vd(e,l+40)),s=Hd(s.add(o[0]),33).mul(Bd),i=qd(e,l,i[1].mul(Bd),r.add(o[0])),o=qd(e,l+32,s.add(o[1]),a.add(Vd(e,l+16))),[s,r]=[r,s],l+=64}while(l!==u);const d=Bd.add(s.and(255).shl(1));return l=c,o[0]=o[0].add(t-1&63),i[0]=i[0].add(o[0]),o[0]=o[0].add(i[0]),r=Hd(r.add(a).add(i[0]).add(Vd(e,l+8)),37).mul(d),a=Hd(a.add(i[1]).add(Vd(e,l+48)),42).mul(d),r=r.xor(o[1].mul(9)),a=a.add(i[0].mul(9).add(Vd(e,l+40))),s=Hd(s.add(o[0]),33).mul(d),i=qd(e,l,i[1].mul(d),r.add(o[0])),o=qd(e,l+32,s.add(o[1]),a.add(Vd(e,l+16))),[s,r]=[r,s],jd(jd(i[0],o[0],d).add(zd(a).mul(Ld)).add(s),jd(i[1],o[1],d).add(r),d)}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Xd(e,t){return"string"===t?Jd(e):Zd([e],t)}function Zd(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=th(e)),Do().getBool("DEBUG")&&co(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){const t=new Uint8Array(e.length);for(let n=0;n<t.length;++n)0!==Math.round(e[n])&&(t[n]=1);return t}throw new Error(`Unknown data type ${t}`)}function Kd(){return Do().platform.now()}function Jd(e,t="utf-8"){return t=t||"utf-8",Do().platform.encode(e,t)}function Yd(e,t="utf-8"){return t=t||"utf-8",Do().platform.decode(e,t)}function eh(e){return null!=Do().platform.isTypedArray?Do().platform.isTypedArray(e):ud(e)}function th(e,t=[],n=!1){if(null==t&&(t=[]),"boolean"==typeof e||"number"==typeof e||"string"==typeof e||Ro(e)||null==e||eh(e)&&n)t.push(e);else if(Array.isArray(e)||eh(e))for(let r=0;r<e.length;++r)th(e[r],t,n);else{let r=-1;for(const t of Object.keys(e))/^([1-9]+[0-9]*|0)$/.test(t)&&(r=Math.max(r,Number(t)));for(let a=0;a<=r;a++)th(e[a],t,n)}return t}const nh=Object.freeze(Object.defineProperty({__proto__:null,arraysEqual:eo,arraysEqualWithNull:Yi,assert:Xi,assertNonNegativeIntegerDimensions:To,assertNonNull:Ki,assertShapesMatch:Zi,bytesFromStringArray:mo,bytesPerElement:fo,checkConversionForErrors:co,clamp:Hi,computeStrides:ko,convertBackendValuesAndArrayBuffer:Co,createScalarValue:Xd,createShuffledIndices:function(e){const t=new Uint32Array(e);for(let n=0;n<e;++n)t[n]=n;return Ui(t),t},decodeString:Yd,distSquared:function(e,t){let n=0;for(let r=0;r<e.length;r++){const a=Number(e[r])-Number(t[r]);n+=a*a}return n},encodeString:Jd,fetch:function(e,t){return Do().platform.fetch(e,t)},fingerPrint64:Qd,flatten:th,getArrayFromDType:uo,getTypedArrayFromDType:lo,hasEncodingLoss:po,hexToLong:Md,indexToLoc:Eo,inferDtype:vo,inferFromImplicitShape:so,isBoolean:yo,isFunction:Ao,isInt:to,isNumber:bo,isPromise:Ro,isScalarShape:function(e){return 0===e.length},isString:go,isTypedArray:eh,isValidDtype:ho,locToIndex:No,makeOnesTypedArray:Io,makeZerosNestedTypedArray:_o,makeZerosTypedArray:Wo,nearestDivisor:xo,nearestLargerEven:ji,now:Kd,parseAxisParam:io,randUniform:function(e,t){const n=Math.random();return t*n+(1-n)*e},repeatedTry:ao,rightPad:ro,shuffle:Ui,shuffleCombo:function(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let n=e.length,r=0;for(;n>0;)r=Math.random()*n|0,n--,qi(e,n,r),qi(t,n,r)},sizeFromShape:Ji,sizeToSquarishShape:no,squeezeShape:oo,sum:Qi,swap:qi,tanh:function(e){if(null!=Math.tanh)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;{const t=Math.exp(2*e);return(t-1)/(t+1)}},toNestedArray:So,toTypedArray:Zd},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class rh{constructor(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new sh)}profileKernel(e,t,n){let r;const a=()=>{r=n()};let s;const i=Kd();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(a);else{a();for(const e of r)e.dataSync();s=Promise.resolve({kernelMs:Kd()-i})}if(Do().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o<r.length;o++){const t=r[o];t.data().then((n=>{ah(n,t.dtype,e)}))}return{kernelName:e,outputs:r,inputs:t,timeMs:s.then((e=>e.kernelMs)),extraInfo:s.then((e=>null!=e.getExtraProfileInfo?e.getExtraProfileInfo():""))}}logKernelProfile(e){const{kernelName:t,outputs:n,timeMs:r,inputs:a,extraInfo:s}=e;n.forEach((e=>{Promise.all([e.data(),r,s]).then((n=>{this.logger.logKernelProfile(t,e,n[0],n[1],a,n[2])}))}))}}function ah(e,t,n){if("float32"!==t)return!1;for(let r=0;r<e.length;r++){const t=e[r];if(isNaN(t)||!isFinite(t))return!0}return!1}class sh{logKernelProfile(e,t,n,r,a,s){"number"==typeof r?ro(`${r}ms`,9):r.error,ro(e,25),t.rank,t.size,ro(t.shape.toString(),14);let i="";for(const o in a){const e=a[o];if(null!=e){const n=e.shape||t.shape,r=n.length;i+=`${o}: ${r}D ${r>0?n:""} `}}}}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ih(e,t,n,r){const a=ko(t),s=function(e,t,n,r){const a=Ji(t),s=r[r.length-1],i=new Array(s).fill(0),o=t.length,l="complex64"===n?ch(e):e;if(o>1)for(let u=0;u<a/s;u++){const e=u*s;for(let t=0;t<s;t++)i[t]=Math.max(i[t],oh(l[e+t],0,n).length)}return i}(e,t,n,a),i=t.length,o=uh(e,t,n,a,s),l=["Tensor"];return r&&(l.push(`  dtype: ${n}`),l.push(`  rank: ${i}`),l.push(`  shape: [${t}]`),l.push("  values:")),l.push(o.map((e=>"    "+e)).join("\n")),l.join("\n")}function oh(e,t,n){let r;return r=Array.isArray(e)?`${parseFloat(e[0].toFixed(7))} + ${parseFloat(e[1].toFixed(7))}j`:go(e)?`'${e}'`:"bool"===n?lh(e):parseFloat(e.toFixed(7)).toString(),ro(r,t)}function lh(e){return 0===e?"false":"true"}function uh(e,t,n,r,a,s=!0){const i="complex64"===n?2:1,o=t[0],l=t.length;if(0===l){if("complex64"===n){return[oh(ch(e)[0],0,n)]}return"bool"===n?[lh(e[0])]:[e[0].toString()]}if(1===l){if(o>20){const t=3*i;let r=Array.from(e.slice(0,t)),s=Array.from(e.slice((o-3)*i,o*i));return"complex64"===n&&(r=ch(r),s=ch(s)),["["+r.map(((e,t)=>oh(e,a[t],n))).join(", ")+", ..., "+s.map(((e,t)=>oh(e,a[o-3+t],n))).join(", ")+"]"]}return["["+("complex64"===n?ch(e):Array.from(e)).map(((e,t)=>oh(e,a[t],n))).join(", ")+"]"]}const u=t.slice(1),c=r.slice(1),d=r[0]*i,h=[];if(o>20){for(let t=0;t<3;t++){const r=t*d,s=r+d;h.push(...uh(e.slice(r,s),u,n,c,a,!1))}h.push("...");for(let t=o-3;t<o;t++){const r=t*d,s=r+d;h.push(...uh(e.slice(r,s),u,n,c,a,t===o-1))}}else for(let m=0;m<o;m++){const t=m*d,r=t+d;h.push(...uh(e.slice(t,r),u,n,c,a,m===o-1))}const p=2===l?",":"";h[0]="["+(o>0?h[0]+p:"");for(let m=1;m<h.length-1;m++)h[m]=" "+h[m]+p;let f=",\n";for(let m=2;m<l;m++)f+="\n";return h[h.length-1]=" "+h[h.length-1]+"]"+(s?"":f),h}function ch(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class dh{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=Ji(e),null!=n){const e=n.length;Xi(e===this.size,(()=>`Length of values '${e}' does not match the size inferred by the shape '${this.size}'.`))}if("complex64"===t)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||uo(t,this.size),this.strides=ko(e)}set(e,...t){0===t.length&&(t=[0]),Xi(t.length===this.rank,(()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`));const n=this.locToIndex(t);this.values[n]=e}get(...e){0===e.length&&(e=[0]);let t=0;for(const r of e){if(r<0||r>=this.shape[t]){const t=`Requested out of range element at ${e}.   Buffer shape=${this.shape}`;throw new Error(t)}t++}let n=e[e.length-1];for(let r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return this.values[n]}locToIndex(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(0===this.rank)return[];if(1===this.rank)return[e];const t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return hh().makeTensor(this.values,this.shape,this.dtype)}}let hh=null,ph=null;class fh{constructor(e,t,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=Ji(e),this.strides=ko(e),this.dataId=n,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return ph.buffer(this.shape,this.dtype,e)}bufferSync(){return ph.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return So(this.shape,e,"complex64"===this.dtype)}arraySync(){return So(this.shape,this.dataSync(),"complex64"===this.dtype)}async data(){this.throwIfDisposed();const e=hh().read(this.dataId);if("string"===this.dtype){const n=await e;try{return n.map((e=>Yd(e)))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),hh().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=hh().readSync(this.dataId);if("string"===this.dtype)try{return e.map((e=>Yd(e)))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await hh().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),hh().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return ph.print(this,e)}clone(){return this.throwIfDisposed(),ph.clone(this)}toString(e=!1){return ih(this.dataSync(),this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),ph.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),hh().makeVariable(this,e,t,n)}}function mh(){return Po("Tensor",(()=>fh))}Object.defineProperty(fh,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}),mh();class gh extends fh{constructor(e,t,n,r){super(e.shape,e.dtype,e.dataId,r),this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!eo(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);hh().disposeTensor(this),this.dataId=e.dataId,hh().incRef(this,null)}dispose(){hh().disposeVariable(this),this.isDisposedInternal=!0}}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
var yh,bh,vh,Ah,xh,kh,wh,Sh,Ch,Ih;Object.defineProperty(gh,Symbol.hasInstance,{value:e=>e instanceof fh&&null!=e.assign&&e.assign instanceof Function}),(bh=yh||(yh={})).R0="R0",bh.R1="R1",bh.R2="R2",bh.R3="R3",bh.R4="R4",bh.R5="R5",bh.R6="R6",(Ah=vh||(vh={})).float32="float32",Ah.int32="int32",Ah.bool="int32",Ah.complex64="complex64",(kh=xh||(xh={})).float32="float32",kh.int32="int32",kh.bool="bool",kh.complex64="complex64",(Sh=wh||(wh={})).float32="float32",Sh.int32="float32",Sh.bool="float32",Sh.complex64="complex64",(Ih=Ch||(Ch={})).float32="complex64",Ih.int32="complex64",Ih.bool="complex64",Ih.complex64="complex64";const Wh={float32:wh,int32:vh,bool:xh,complex64:Ch};function _h(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return Wh[e][t]}function Th(e){return _h(e,"int32")}function Nh(e){return null!=e&&"object"==typeof e&&"texture"in e&&e.texture instanceof WebGLTexture}function Eh(e){return"undefined"!=typeof GPUBuffer&&null!=e&&"object"==typeof e&&"buffer"in e&&e.buffer instanceof GPUBuffer}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Rh(e,t){if(e.dtype===t.dtype)return[e,t];const n=_h(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function $h(e,t){Xi(e.dtype===t.dtype,(()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`))}function Oh(e){const t=[];return Fh(e,t,new Set),t}function Fh(e,t,n){if(null==e)return;if(e instanceof fh)return void t.push(e);if(r=e,!Array.isArray(r)&&"object"!=typeof r)return;var r;const a=e;for(const s in a){const e=a[s];n.has(e)||(n.add(e),Fh(e,t,n))}}const Dh=Object.freeze(Object.defineProperty({__proto__:null,assertTypesMatch:$h,getTensorsInContainer:Oh,isTensorInList:function(e,t){return t.some((t=>t.id===e.id))},makeTypesMatch:Rh},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Mh(e){return null!=e.kernelName}class Lh{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map((e=>e.name))))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class Bh{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Lh}async ready(){if(null!=this.pendingBackendInit)return this.pendingBackendInit.then((()=>{}));if(null!=this.backendInstance)return;const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t];if(await this.initializeBackend(n).success)return void(await this.setBackend(n))}throw new Error("Could not initialize any backends, all backend initializations failed.")}get backend(){if(null!=this.pendingBackendInit)throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);if(null==this.backendInstance){const{name:e,asyncInit:t}=this.initializeBackendsAndReturnBest();if(t)throw new Error(`The highest priority backend '${e}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry)){if(!(e in this.registryFactory))return null;{const{asyncInit:t}=this.initializeBackend(e);if(t)return null}}return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,t,n=1){return e in this.registryFactory?(ed(),!1):(this.registryFactory[e]={factory:t,priority:n},!0)}async setBackend(e){if(null==this.registryFactory[e])throw new Error(`Backend name '${e}' not found in registry`);if(this.backendName=e,null==this.registry[e]){this.backendInstance=null;const{success:t,asyncInit:n}=this.initializeBackend(e);if(!(n?await t:t))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new rh(this.backendInstance),!0}setupRegisteredKernels(){sd(this.backendName).forEach((e=>{null!=e.setupFunc&&e.setupFunc(this.backendInstance)}))}disposeRegisteredKernels(e){sd(e).forEach((t=>{null!=t.disposeFunc&&t.disposeFunc(this.registry[e])}))}initializeBackend(e){const t=this.registryFactory[e];if(null==t)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const n=t.factory();if(!n||n instanceof Gi||"function"!=typeof n.then)return this.registry[e]=n,{success:!0,asyncInit:!1};{const t=++this.pendingBackendInitId,r=n.then((n=>!(t<this.pendingBackendInitId)&&(this.registry[e]=n,this.pendingBackendInit=null,!0))).catch((e=>(t<this.pendingBackendInitId||(this.pendingBackendInit=null,ed(),ed(e.stack||e.message)),!1)));return this.pendingBackendInit=r,{success:r,asyncInit:!0}}}catch(n){return ed(),ed(n.stack||n.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error(`${e} backend not found in registry`);this.backendName===e&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(((e,t)=>this.registryFactory[t].priority-this.registryFactory[e].priority))}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t],{success:r,asyncInit:a}=this.initializeBackend(n);if(a||r)return{name:n,asyncInit:a}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,t){const n=this.state.tensorInfo.get(t),r=n.backend,a=this.readSync(t),s=r.refCount(t);r.disposeData(t,!0),n.backend=e,e.move(t,a,n.shape,n.dtype,s),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,t){let n,r=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");r=e}return this.scopedRun((()=>this.startScope(r)),(()=>this.endScope(n)),(()=>(n=t(),n)))}scopedRun(e,t,n){e();try{const e=n();return t(),e}catch(r){throw t(),r}}nextTensorId(){return Bh.nextTensorId++}nextVariableId(){return Bh.nextVariableId++}clone(e){const t=zh.runKernel(ru,{x:e}),n={x:e};return this.addTapeNode(this.state.activeScope.name,n,[t],(e=>({x:()=>{const t={x:e},n={dtype:"float32"};return zh.runKernel(dl,t,n)}})),[],{}),t}runKernel(e,t,n){null==this.backendName&&this.backend;if(!(null!=rd(e,this.backendName)))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){const r=this.backend.numDataIds();let a=0;n.forEach((e=>{a+="complex64"===e.dtype?3:1}));const s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],i=r-t-a-s;if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[];const r=this.isTapeOn(),a=this.state.numBytes,s=this.state.numTensors;let i,o;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0),null==this.backendName&&this.backend;const l=Mh(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(Mh(e)){const{kernelName:t,inputs:a,attrs:s}=e;null==this.backendName&&this.backend;const l=rd(t,this.backendName);Xi(null!=l,(()=>`Cannot find registered kernel '${t}' for backend '${this.backendName}'`)),i=()=>{const e=this.backend.numDataIds();o=l.kernelFunc({inputs:a,attrs:s,backend:this.backend});const i=Array.isArray(o)?o:[o];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(t,e,i);const u=i.map((e=>null!=e.rank?e:this.makeTensorFromTensorInfo(e)));if(r){const e=this.getTensorsForGradient(t,a,u);n=this.saveTensorsForBackwardMode(e)}return u}}else{const{forwardFunc:t}=e,a=e=>{r&&(n=e.map((e=>this.keep(this.clone(e)))))};i=()=>{const e=this.backend.numDataIds();o=this.tidy((()=>t(this.backend,a)));const n=Array.isArray(o)?o:[o];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,e,n),n}}const{inputs:u,attrs:c}=e,d=Mh(e)?null:e.backwardsFunc;let h;return this.scopedRun((()=>this.state.kernelDepth++),(()=>this.state.kernelDepth--),(()=>{this.ENV.getBool("DEBUG")||this.state.profiling?(h=this.profiler.profileKernel(l,u,(()=>i())),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(h),t=h.outputs):t=i()})),r&&this.addTapeNode(l,u,t,d,n,c),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-a,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map((e=>null!=u[e]?u[e].shape:null)),outputShapes:t.map((e=>e.shape)),kernelTimeMs:h.timeMs,extraInfo:h.extraInfo}),Array.isArray(o)?t:t[0]}saveTensorsForBackwardMode(e){return e.map((e=>this.keep(this.clone(e))))}getTensorsForGradient(e,t,n){const r=ad(e);if(null!=r){const e=r.inputsToSave||[],a=r.outputsToSave||[];let s;r.saveAllInputs?(Xi(Array.isArray(t),(()=>"saveAllInputs is true, expected inputs to be an array.")),s=Object.keys(t).map((e=>t[e]))):s=e.map((e=>t[e]));const i=n.filter(((e,t)=>a[t]));return s.concat(i)}return[]}makeTensor(e,t,n,r){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;let a=e;"string"===n&&go(e[0])&&(a=e.map((e=>Jd(e))));const s=r.write(a,t,n),i=new fh(t,n,s,this.nextTensorId());if(this.trackTensor(i,r),"string"===n){const e=this.state.tensorInfo.get(s),t=mo(a);this.state.numBytes+=t-e.bytes,e.bytes=t}return i}makeTensorFromDataId(e,t,n,r){const a={dataId:e,shape:t,dtype:n=n||"float32"};return this.makeTensorFromTensorInfo(a,r)}makeTensorFromTensorInfo(e,t){const{dataId:n,shape:r,dtype:a}=e,s=new fh(r,a,n,this.nextTensorId());return this.trackTensor(s,t),s}makeVariable(e,t=!0,n,r){n=n||this.nextVariableId().toString(),null!=r&&r!==e.dtype&&(e=e.cast(r));const a=new gh(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[a.name])throw new Error(`Variable with name ${a.name} was already registered`);return this.state.registeredVariables[a.name]=a,this.incRef(a,this.backend),a}trackTensor(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;let n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*fo(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof gh||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){const t=e.size*fo(e.dtype);this.state.numBytes-=t}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map((e=>e.totalBytesSnapshot))),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(const r of this.state.activeProfile.kernels)r.kernelTimeMs=await r.kernelTimeMs,r.extraInfo=await r.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}addTapeNode(e,t,n,r,a,s){const i={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:a},o=ad(e);null!=o&&(r=o.gradFunc),null!=r&&(i.gradient=e=>(e=e.map(((e,t)=>{if(null==e){const e=n[t],r=Wo(e.size,e.dtype);return this.makeTensor(r,e.shape,e.dtype)}return e})),r(e.length>1?e:e[0],a,s))),this.state.activeTape.push(i)}keep(e){return e.kept=!0,e}startTape(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=Oh(e),n=new Set(t.map((e=>e.id)));for(let a=0;a<this.state.activeScope.track.length;a++){const e=this.state.activeScope.track[a];e.kept||n.has(e.id)||e.dispose()}const r=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach((e=>{e.kept||e.scopeId!==r.id||this.track(e)}))}gradients(e,t,n,r=!1){if(Xi(t.length>0,(()=>"gradients() received an empty list of xs.")),null!=n&&"float32"!==n.dtype)throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);const a=this.scopedRun((()=>this.startTape()),(()=>this.endTape()),(()=>this.tidy("forward",e)));Xi(a instanceof fh,(()=>"The result y returned by f() must be a tensor."));const s=function(e,t,n){const r={},a={};for(let l=0;l<t.length;l++)r[t[l].id]=!0;for(let l=0;l<e.length;l++){const n=e[l],s=n.inputs;for(const e in s){const i=s[e];let o=!1;for(let e=0;e<t.length;e++)if(r[i.id]){n.outputs.forEach((e=>r[e.id]=!0)),o=!0,a[n.id]=!0;break}if(o)break}}const s={};s[n.id]=!0;const i={};for(let l=e.length-1;l>=0;l--){const t=e[l],n=t.inputs;for(let e=0;e<t.outputs.length;e++)if(s[t.outputs[e].id]){for(const e in n)s[n[e].id]=!0,i[t.id]=!0;break}}const o=[];for(let l=0;l<e.length;l++){const t=e[l];if(a[t.id]&&i[t.id]){const e={};for(const a in t.inputs){const n=t.inputs[a];r[n.id]&&(e[a]=n)}const n=Object.assign({},t);n.inputs=e,n.outputs=t.outputs,o.push(n)}}return o}(this.state.activeTape,t,a);if(!r&&0===s.length&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",(()=>{const e={};e[a.id]=null==n?function(e){const t=Io(Ji(e),"float32");return zh.makeTensor(t,e,"float32")}(a.shape):n,function(e,t,n,r){for(let a=t.length-1;a>=0;a--){const s=t[a],i=[];if(s.outputs.forEach((t=>{const n=e[t.id];null!=n?i.push(n):i.push(null)})),null==s.gradient)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);const o=s.gradient(i);for(const t in s.inputs){if(!(t in o))throw new Error(`Cannot backprop through input ${t}. Available gradients found: ${Object.keys(o)}.`);const a=n((()=>o[t]()));if("float32"!==a.dtype)throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${t} must have 'float32' dtype, but has '${a.dtype}'`);const i=s.inputs[t];if(!eo(a.shape,i.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${t}' has shape '${a.shape}', which does not match the shape of the input '${i.shape}'`);if(null==e[i.id])e[i.id]=a;else{const t=e[i.id];e[i.id]=r(t,a),t.dispose()}}}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(e,s,(e=>this.tidy(e)),Gh);const r=t.map((t=>e[t.id]));return 0===this.state.gradientDepth&&(this.state.activeTape.forEach((e=>{for(const t of e.saved)t.dispose()})),this.state.activeTape=null),{value:a,grads:r}}))}customGrad(e){return Xi(Ao(e),(()=>"The f passed in customGrad(f) must be a function.")),(...t)=>{let n;Xi(t.every((e=>e instanceof fh)),(()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors"));const r={};t.forEach(((e,t)=>{r[t]=e}));return this.runKernelFunc({forwardFunc:(r,a)=>(n=e(...t,a),Xi(n.value instanceof fh,(()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor")),Xi(Ao(n.gradFunc),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.")),n.value),backwardsFunc:(e,r)=>{const a=n.gradFunc(e,r),s=Array.isArray(a)?a:[a];Xi(s.length===t.length,(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).")),Xi(s.every((e=>e instanceof fh)),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."));const i={};return s.forEach(((e,t)=>{i[t]=()=>e})),i},inputs:r})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=Kd(),n=await this.backend.time(e);return n.wallMs=Kd()-t,n}track(e){return null!=this.state.activeScope&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Lh;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}function Ph(){const e=Bo();if(null==e._tfengine){const t=new Oo(e);e._tfengine=new Bh(t)}var t;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */return t=e._tfengine.ENV,Lo=t,hh=()=>e._tfengine,e._tfengine}Bh.nextTensorId=0,Bh.nextVariableId=0;const zh=Ph();function Gh(e,t){const n={a:e,b:t};return zh.runKernel(Uo,n)}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */let Vh;function Uh(e){if(void 0!==Vh)return Vh;if(e||"undefined"!=typeof navigator&&null!=navigator){if(e||(e=navigator),"ReactNative"===e.product)return!0;const t=e.userAgent||e.vendor||("undefined"!=typeof window?window.opera:"");if(!t){const t=e;return t.userAgentData&&t.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function Hh(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}const jh=Object.freeze(Object.defineProperty({__proto__:null,isBrowser:Hh,isMobile:Uh,mockIsMobile:function(e){Vh=e}},Symbol.toStringTag,{value:"Module"})),qh=Do();
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function Qh(e,t){let n=e;if(eh(e))return"string"===t?[]:[e.length];if(Nh(e)){const t=e.channels||"RGBA";return[e.height,e.width*t.length]}if(Eh(e))return[e.buffer.size/(null==t?4:fo(t))];if(!Array.isArray(e))return[];const r=[];for(;Array.isArray(n)||eh(n)&&"string"!==t;)r.push(n.length),n=n[0];return Array.isArray(e)&&Do().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Xh(e,r,[]),r}function Xh(e,t,n){if(n=n||[],!Array.isArray(e)&&!eh(e))return void Xi(0===t.length,(()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`));Xi(t.length>0,(()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`)),Xi(e.length===t[0],(()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`));const r=t.slice(1);for(let a=0;a<e.length;++a)Xh(e[a],r,n.concat(a))}function Zh(e,t,n,r){if("string_or_numeric"!==e){if(null==e)throw new Error("Expected dtype cannot be null.");if("numeric"!==e&&e!==t||"numeric"===e&&"string"===t)throw new Error(`Argument '${n}' passed to '${r}' must be ${e} tensor, but got ${t} tensor`)}}function Kh(e,t,n,r="numeric"){if(e instanceof mh())return Zh(r,e.dtype,t,n),e;let a=vo(e);if("string"!==a&&["bool","int32","float32"].indexOf(r)>=0&&(a=r),Zh(r,a,t,n),null==e||!eh(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){const r=null==e?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${r}'`)}const s=Qh(e,a);eh(e)||Array.isArray(e)||(e=[e]);const i="string"!==a?Zd(e,a):th(e,[],!0);return zh.makeTensor(i,s,a)}function Jh(e,t,n,r="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${n} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map(((e,a)=>Kh(e,`${t}[${a}]`,n,r)))}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */qh.registerFlag("DEBUG",(()=>!1),(e=>{})),qh.registerFlag("IS_BROWSER",(()=>Hh())),qh.registerFlag("IS_NODE",(()=>"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node)),qh.registerFlag("IS_CHROME",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))),qh.registerFlag("IS_SAFARI",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor))),qh.registerFlag("PROD",(()=>!1)),qh.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(()=>qh.getBool("DEBUG"))),qh.registerFlag("DEPRECATION_WARNINGS_ENABLED",(()=>!0)),qh.registerFlag("IS_TEST",(()=>!1)),qh.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(()=>qh.getBool("DEBUG"))),qh.registerFlag("WRAP_TO_IMAGEBITMAP",(()=>!1)),qh.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",(()=>!1)),qh.registerFlag("USE_SETTIMEOUTCUSTOM",(()=>!1));const Yh="__op";function ep(e){const t=Object.keys(e);if(1!==t.length)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0];const r=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n+=Yh;const a=(...e)=>{zh.startScope(n);try{const t=r(...e);return Ro(t),zh.endScope(t),t}catch(t){throw zh.endScope(null),t}};return Object.defineProperty(a,"name",{value:n,configurable:!0}),a}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tp=ep({complex_:function(e,t){const n=Kh(e,"real","complex"),r=Kh(t,"imag","complex");Zi(n.shape,r.shape,`real and imag shapes, ${n.shape} and ${r.shape}, must match in call to tf.complex().`);const a={real:n,imag:r};return zh.runKernel(fl,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function np(e,t,n,r){if(null==r)r=vo(e);else if("complex64"===r)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(Eh(e)||Nh(e)){if("float32"!==r&&"int32"!==r)throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${r}.`);return zh.backend.createTensorFromGPUData(e,t||n,r)}if(!eh(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=t){To(t);const e=Ji(t),r=Ji(n);Xi(e===r,(()=>`Based on the provided shape, [${t}], the tensor should have ${e} values but has ${r}`));for(let a=0;a<n.length;++a){const e=n[a],r=a!==n.length-1||e!==Ji(t.slice(a));Xi(n[a]===t[a]||!r,(()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `))}}return eh(e)||Array.isArray(e)||(e=[e]),t=t||n,e="string"!==r?Zd(e,r):th(e,[],!0),zh.makeTensor(e,t,r)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function rp(e,t,n){return np(e,t,Qh(e,n),n)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ap={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};class sp{static join(e){return new sp(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,null==e)return;if(e instanceof Array||(e=[e]),0===(e=e.map((e=>eh(e)?e.buffer:e))).length)return;this.bufferUniformSize=e[0].byteLength;let t=0;for(let n=0;n<e.length;n++){const r=e[n];n!==e.length-1&&r.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);const a=t+r.byteLength;this.shards.push({buffer:r,start:t,end:a}),t=a}0===this.shards.length&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(e=0,t=this.byteLength){if(0===this.shards.length)return new ArrayBuffer(0);if(e=isNaN(Number(e))?0:e,t=isNaN(Number(t))?0:t,e=Math.max(0,e),(t=Math.min(this.byteLength,t))<=e)return new ArrayBuffer(0);const n=this.findShardForByte(e);if(-1===n)throw new Error(`Could not find start shard for byte ${e}`);const r=new ArrayBuffer(t-e),a=new Uint8Array(r);let s=0;for(let i=n;i<this.shards.length;i++){const n=this.shards[i],r=e+s-n.start,o=s,l=Math.min(t,n.end)-n.start,u=new Uint8Array(n.buffer,r,l-r);if(a.set(u,o),s+=u.length,t<n.end)break}return r}findShardForByte(e){if(0===this.shards.length||e<0||e>=this.byteLength)return-1;if(null!=this.bufferUniformSize)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(t){return e<t.start?-1:e>=t.end?1:0}if(0===t(this.shards[this.previousShardIndex]))return this.previousShardIndex;const n=function(e,t){let n=0,r=e.length;for(;n<=r;){const a=Math.floor((r-n)/2)+n,s=t(e[a]);if(0===s)return a;s<0?r=a:n=a+1}return-1}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(this.shards,t);return-1===n?-1:(this.previousShardIndex=n,this.previousShardIndex)}}function ip(){return zh}function op(){return zh.memory()}function lp(e,t){return zh.tidy(e,t)}function up(e){Oh(e).forEach((e=>e.dispose()))}function cp(e){return zh.keep(e)}function dp(){return zh.backendName}function hp(e,t,n=1){return zh.registerBackend(e,t,n)}function pp(){return zh.backend}async function fp(e,t){const n=[],r=[],a=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);for(let s=0;s<a.length;++s){const i=a[s],o=Array.isArray(e)?e[s].tensor:e[i];if("float32"!==o.dtype&&"int32"!==o.dtype&&"bool"!==o.dtype&&"string"!==o.dtype&&"complex64"!==o.dtype)throw new Error(`Unsupported dtype in weight '${i}': ${o.dtype}`);const l={name:i,shape:o.shape,dtype:o.dtype};if("string"===o.dtype){const e=new Promise((async e=>{const t=await o.bytes(),n=t.reduce(((e,t)=>e+t.length),0)+4*t.length,r=new Uint8Array(n);let a=0;for(let s=0;s<t.length;s++){const e=t[s],n=new Uint8Array(new Uint32Array([e.length]).buffer);r.set(n,a),a+=4,r.set(e,a),a+=e.length}e(r)}));r.push(e)}else r.push(o.data());null!=t&&(l.group=t),n.push(l)}return{data:xp(await Promise.all(r)),specs:n}}function mp(e,t){const n=new sp(e),r={};let a=0;for(const s of t){const e=gp(s,((e,t)=>n.slice(a+e,a+t)));r[s.name]=bp(s,n.slice(a,a+e)),a+=e}return r}function gp(e,t){const n=Ji(e.shape);let r;if("quantization"in e){const t=e.quantization;r=ap[t.dtype]}else{if("string"===e.dtype){let e=0;for(let r=0;r<n;r++)e+=4+new Uint32Array(t(e,e+4))[0];return e}r=ap[e.dtype]}return n*r}async function yp(e,t){const n=Ji(e.shape);let r;if("quantization"in e){const t=e.quantization;r=ap[t.dtype]}else{if("string"===e.dtype){let e=0;for(let r=0;r<n;r++)e+=4+new Uint32Array(await t(e,e+4))[0];return e}r=ap[e.dtype]}return n*r}function bp(e,t){const n=e.name,r=e.dtype,a=e.shape,s=Ji(a);let i,o=0;if("quantization"in e){const a=e.quantization;if("uint8"===a.dtype||"uint16"===a.dtype){if(!("min"in a)||!("scale"in a))throw new Error(`Weight ${e.name} with quantization ${a.dtype} doesn't have corresponding metadata min and scale.`)}else{if("float16"!==a.dtype)throw new Error(`Weight ${e.name} has unknown quantization dtype ${a.dtype}. Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.`);if("float32"!==r)throw new Error(`Weight ${e.name} is quantized with ${a.dtype} which only supports weights of type float32 not ${r}.`)}const l=ap[a.dtype],u="uint8"===a.dtype?new Uint8Array(t):new Uint16Array(t);if("float32"===r)if("uint8"===a.dtype||"uint16"===a.dtype){i=new Float32Array(u.length);for(let e=0;e<u.length;e++){const t=u[e];i[e]=t*a.scale+a.min}}else{if("float16"!==a.dtype)throw new Error(`Unsupported quantization type ${a.dtype} for weight type float32.`);{const e=function(){const e=function(){const e=e=>{let t=e<<13,n=0;for(;!(8388608&t);)n-=8388608,t<<=1;return t&=-8388609,n+=947912704,t|n},t=new Uint32Array(2048);t[0]=0;for(let n=1;n<1024;n++)t[n]=e(n);for(let n=1024;n<2048;n++)t[n]=939524096+(n-1024<<13);return t}(),t=function(){const e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}(),n=function(){const e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}();return r=>{const a=new ArrayBuffer(4*r.length),s=new Uint32Array(a);for(let i=0;i<r.length;i++){const a=r[i],o=e[n[a>>10]+(1023&a)]+t[a>>10];s[i]=o}return new Float32Array(a)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */();i=e(u)}}else{if("int32"!==r)throw new Error(`Unsupported dtype in weight '${n}': ${r}`);if("uint8"!==a.dtype&&"uint16"!==a.dtype)throw new Error(`Unsupported quantization type ${a.dtype} for weight type int32.`);i=new Int32Array(u.length);for(let e=0;e<u.length;e++){const t=u[e];i[e]=Math.round(t*a.scale+a.min)}}o+=s*l}else if("string"===r){const n=Ji(e.shape);i=[];for(let e=0;e<n;e++){const e=new Uint32Array(t.slice(o,o+4))[0];o+=4;const n=new Uint8Array(t.slice(o,o+e));i.push(n),o+=e}}else{const e=ap[r];if("float32"===r)i=new Float32Array(t);else if("int32"===r)i=new Int32Array(t);else{if("bool"!==r){if("complex64"===r){i=new Float32Array(t);const e=new Float32Array(i.length/2),n=new Float32Array(i.length/2);for(let t=0;t<e.length;t++)e[t]=i[2*t],n[t]=i[2*t+1];const r=rp(e,a,"float32"),s=rp(n,a,"float32"),o=tp(r,s);return r.dispose(),s.dispose(),o}throw new Error(`Unsupported dtype in weight '${n}': ${r}`)}i=new Uint8Array(t)}o+=s*e}return rp(i,a,r)}async function vp(e,t,n){let r=new Uint8Array(t);for(;r.byteLength<n;){const{done:t,value:a}=await e.read();if(t&&null==a){const e=n-r.byteLength;throw new Error(`Reader is done but ${e} bytes are still expected`)}const s=new Uint8Array(r.length+a.byteLength);s.set(r,0),s.set(new Uint8Array(a),r.length),r=s}return r.buffer}async function Ap(e,t){const n={},r=e.getReader();let a=new ArrayBuffer(0);for(const s of t){const e=await yp(s,(async(e,t)=>(a=await vp(r,a,t),a.slice(e,t))));a=await vp(r,a,e);const t=a.slice(0,e);a=a.slice(e);const i=bp(s,t);if(n[s.name]=i,"webgpu"===dp()){const e=pp();"uploadToGPU"in e&&Ji(i.shape)>=Do().get("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD")&&e.uploadToGPU(i.dataId)}}return n}function xp(e){if(null===e)throw new Error(`Invalid input value: ${JSON.stringify(e)}`);let t=0;const n=[];e.forEach((e=>{if(t+=e.byteLength,n.push(e.byteLength===e.buffer.byteLength?e:new e.constructor(e)),!(e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${e.constructor.name}`)}));const r=new Uint8Array(t);let a=0;return n.forEach((e=>{r.set(new Uint8Array(e.buffer),a),a+=e.byteLength})),r.buffer}const kp="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function wp(e){return kp?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function Sp(e){return sp.join(e)}function Cp(e){for(e=e.trim();e.endsWith("/");)e=e.slice(0,e.length-1);const t=e.split("/");return t[t.length-1]}function Ip(e,t){const n={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};return null!=e.signature&&(n.signature=e.signature),null!=e.userDefinedMetadata&&(n.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(n.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(n.initializerSignature=e.initializerSignature),null!=e.trainingConfig&&(n.trainingConfig=e.trainingConfig),n}function Wp(e,t,n){const r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};if(null!=e.trainingConfig&&(r.trainingConfig=e.trainingConfig),null!=e.weightsManifest){if(!t)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!n)throw new Error("modelJSON has weightsManifest but weightData is null");r.weightSpecs=t,r.weightData=n}return null!=e.signature&&(r.signature=e.signature),null!=e.userDefinedMetadata&&(r.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(r.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(r.initializerSignature=e.initializerSignature),r}async function _p(e,t){let n,r;return null!=e.weightsManifest&&([n,r]=await t(e.weightsManifest)),Wp(e,n,r)}function Tp(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:wp(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:wp(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:new sp(e.weightData).byteLength}}function Np(e){const t=[];for(const n of e)t.push(...n.weights);return t}class Ep{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==Ep.instance&&(Ep.instance=new Ep),Ep.instance}static registerSaveRouter(e){Ep.getInstance().saveRouters.push(e)}static registerLoadRouter(e){Ep.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return Ep.getHandlers(e,"save")}static getLoadHandlers(e,t){return Ep.getHandlers(e,"load",t)}static getHandlers(e,t,n){const r=[];return("load"===t?Ep.getInstance().loadRouters:Ep.getInstance().saveRouters).forEach((t=>{const a=t(e,n);null!==a&&r.push(a)})),r}}const Rp=e=>Ep.getSaveHandlers(e),$p="tensorflowjs",Op="models_store",Fp="model_info_store";function Dp(){if(!Do().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const e="undefined"==typeof window?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function Mp(e){const t=e.result;t.createObjectStore(Op,{keyPath:"modelPath"}),t.createObjectStore(Fp,{keyPath:"modelPath"})}class Lp{constructor(e){if(this.indexedDB=Dp(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise(((e,n)=>{const r=this.indexedDB.open($p,1);r.onupgradeneeded=()=>Mp(r),r.onsuccess=()=>{const a=r.result;if(null==t){const t=a.transaction(Op,"readonly"),r=t.objectStore(Op).get(this.modelPath);r.onsuccess=()=>{if(null==r.result)return a.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));e(r.result.modelArtifacts)},r.onerror=e=>(a.close(),n(r.error)),t.oncomplete=()=>a.close()}else{t.weightData=sp.join(t.weightData);const r=Tp(t),i=a.transaction(Fp,"readwrite");let o,l,u=i.objectStore(Fp);try{o=u.put({modelPath:this.modelPath,modelArtifactsInfo:r})}catch(s){return n(s)}o.onsuccess=()=>{l=a.transaction(Op,"readwrite");const o=l.objectStore(Op);let c;try{c=o.put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:r})}catch(s){return n(s)}c.onsuccess=()=>e({modelArtifactsInfo:r}),c.onerror=e=>{u=i.objectStore(Fp);const t=u.delete(this.modelPath);t.onsuccess=()=>(a.close(),n(c.error)),t.onerror=e=>(a.close(),n(c.error))}},o.onerror=e=>(a.close(),n(o.error)),i.oncomplete=()=>{null==l?a.close():l.oncomplete=()=>a.close()}}},r.onerror=e=>n(r.error)}))}}Lp.URL_SCHEME="indexeddb://";const Bp=e=>{return Do().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Lp.URL_SCHEME)?(t=e.slice(Lp.URL_SCHEME.length),new Lp(t)):null;var t};Ep.registerSaveRouter(Bp),Ep.registerLoadRouter(Bp);class Pp{constructor(){this.indexedDB=Dp()}async listModels(){return new Promise(((e,t)=>{const n=this.indexedDB.open($p,1);n.onupgradeneeded=()=>Mp(n),n.onsuccess=()=>{const r=n.result,a=r.transaction(Fp,"readonly"),s=a.objectStore(Fp).getAll();s.onsuccess=()=>{const t={};for(const e of s.result)t[e.modelPath]=e.modelArtifactsInfo;e(t)},s.onerror=e=>(r.close(),t(s.error)),a.oncomplete=()=>r.close()},n.onerror=e=>t(n.error)}))}async removeModel(e){var t;return e=(t=e).startsWith(Lp.URL_SCHEME)?t.slice(Lp.URL_SCHEME.length):t,new Promise(((t,n)=>{const r=this.indexedDB.open($p,1);r.onupgradeneeded=()=>Mp(r),r.onsuccess=()=>{const a=r.result,s=a.transaction(Fp,"readwrite"),i=s.objectStore(Fp),o=i.get(e);let l;o.onsuccess=()=>{if(null==o.result)return a.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const r=i.delete(e),s=()=>{l=a.transaction(Op,"readwrite");const r=l.objectStore(Op).delete(e);r.onsuccess=()=>t(o.result.modelArtifactsInfo),r.onerror=e=>n(o.error)};r.onsuccess=s,r.onerror=e=>(s(),a.close(),n(o.error))}},o.onerror=e=>(a.close(),n(o.error)),s.oncomplete=()=>{null==l?a.close():l.oncomplete=()=>a.close()}},r.onerror=e=>n(r.error)}))}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zp="/",Gp="tensorflowjs_models",Vp="info",Up="model_topology",Hp="weight_specs",jp="weight_data",qp="model_metadata";function Qp(e){return{info:[Gp,e,Vp].join(zp),topology:[Gp,e,Up].join(zp),weightSpecs:[Gp,e,Hp].join(zp),weightData:[Gp,e,jp].join(zp),modelMetadata:[Gp,e,qp].join(zp)}}function Xp(e){for(const t of Object.values(e))window.localStorage.removeItem(t)}function Zp(e){const t=e.split(zp);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(zp)}class Kp{constructor(e){if(!Do().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=Qp(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const n=JSON.stringify(e.modelTopology),r=JSON.stringify(e.weightSpecs),a=Tp(e),s=sp.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,n),this.LS.setItem(this.keys.weightSpecs,r),this.LS.setItem(this.keys.weightData,function(e){if(kp)return Buffer.from(e).toString("base64");const t=new Uint8Array(e);let n="";for(let r=0,a=t.length;r<a;r++)n+=String.fromCharCode(t[r]);return btoa(n)}(s));const t={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:null!=e.signature?e.signature:void 0,userDefinedMetadata:null!=e.userDefinedMetadata?e.userDefinedMetadata:void 0,modelInitializer:null!=e.modelInitializer?e.modelInitializer:void 0,initializerSignature:null!=e.initializerSignature?e.initializerSignature:void 0,trainingConfig:null!=e.trainingConfig?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(t)),{modelArtifactsInfo:a}}catch(t){throw Xp(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(null==e)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(null==n)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;const r=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(null==r)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=r;const a=this.LS.getItem(this.keys.modelMetadata);if(null!=a){const e=JSON.parse(a);t.format=e.format,t.generatedBy=e.generatedBy,t.convertedBy=e.convertedBy,null!=e.signature&&(t.signature=e.signature),null!=e.userDefinedMetadata&&(t.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(t.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(t.initializerSignature=e.initializerSignature),null!=e.trainingConfig&&(t.trainingConfig=e.trainingConfig)}const s=this.LS.getItem(this.keys.weightData);if(null==s)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=function(e){if(kp){const t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;++r)n.set([t.charCodeAt(r)],r);return n.buffer}(s),t}}Kp.URL_SCHEME="localstorage://";const Jp=e=>{return Do().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Kp.URL_SCHEME)?(t=e.slice(Kp.URL_SCHEME.length),new Kp(t)):null;var t};Ep.registerSaveRouter(Jp),Ep.registerLoadRouter(Jp);class Yp{constructor(){Xi(Do().getBool("IS_BROWSER"),(()=>"Current environment is not a web browser")),Xi("undefined"==typeof window||void 0!==window.localStorage,(()=>"Current browser does not appear to support localStorage")),this.LS=window.localStorage}async listModels(){const e={},t=Gp+zp,n=zp+Vp;for(let r=0;r<this.LS.length;++r){const a=this.LS.key(r);if(a.startsWith(t)&&a.endsWith(n)){e[Zp(a)]=JSON.parse(this.LS.getItem(a))}}return e}async removeModel(e){var t;const n=Qp(e=(t=e).startsWith(Kp.URL_SCHEME)?t.slice(Kp.URL_SCHEME.length):t);if(null==this.LS.getItem(n.info))throw new Error(`Cannot find model at path '${e}'`);const r=JSON.parse(this.LS.getItem(n.info));return Xp(n),r}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ef="://";class tf{constructor(){this.managers={}}static getInstance(){return null==tf.instance&&(tf.instance=new tf),tf.instance}static registerManager(e,t){Xi(null!=e,(()=>"scheme must not be undefined or null.")),e.endsWith(ef)&&(e=e.slice(0,e.indexOf(ef))),Xi(e.length>0,(()=>"scheme must not be an empty string."));const n=tf.getInstance();Xi(null==n.managers[e],(()=>`A model store manager is already registered for scheme '${e}'.`)),n.managers[e]=t}static getManager(e){const t=tf.getInstance().managers[e];if(null==t)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(tf.getInstance().managers)}}function nf(e){if(-1===e.indexOf(ef))throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${tf.getSchemes().join(",")}`);return{scheme:e.split(ef)[0],path:e.split(ef)[1]}}async function rf(e,t,n=!1){Xi(e!==t,(()=>`Old path and new path are the same: '${e}'`));const r=Ep.getLoadHandlers(e);Xi(r.length>0,(()=>`Copying failed because no load handler is found for source URL ${e}.`)),Xi(r.length<2,(()=>`Copying failed because more than one (${r.length}) load handlers for source URL ${e}.`));const a=r[0],s=Ep.getSaveHandlers(t);Xi(s.length>0,(()=>`Copying failed because no save handler is found for destination URL ${t}.`)),Xi(s.length<2,(()=>`Copying failed because more than one (${r.length}) save handlers for destination URL ${t}.`));const i=s[0],o=nf(e).scheme,l=nf(e).path,u=o===nf(e).scheme,c=await a.load();n&&u&&await tf.getManager(o).removeModel(l);const d=await i.save(c);return n&&!u&&await tf.getManager(o).removeModel(l),d.modelArtifactsInfo}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class af{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){"undefined"!=typeof window&&Do().getBool("USE_SETTIMEOUTCUSTOM")?(this.functionRefs.push(e),setTimeout((()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")}),t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",(e=>{if(e.source===window&&e.data.name===this.messageName){e.stopPropagation();(0,this.functionRefs[e.data.index])(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}}),!0))):setTimeout(e,t)}isTypedArray(e){return ud(e)}}if(Do().get("IS_BROWSER")){Do().setPlatform("browser",new af);try{tf.registerManager(Kp.URL_SCHEME,new Yp)}catch(RZ){}try{tf.registerManager(Lp.URL_SCHEME,new Pp)}catch(RZ){}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sf=()=>require("node-fetch");let of;class lf{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return null!=Do().global.fetch?Do().global.fetch(e,t):(null==of&&(of=sf()),of(e,t))}now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function uf(e,t="float32",n){return t=t||"float32",To(e),new dh(e,t,n)}
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */Do().get("IS_NODE")&&!Do().get("IS_BROWSER")&&Do().setPlatform("node",new lf);const cf=ep({cast_:function(e,t){const n=Kh(e,"x","cast");if(!ho(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");const r={x:n},a={dtype:t};return zh.runKernel(dl,r,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const df=ep({clone_:function(e){const t={x:Kh(e,"x","clone","string_or_numeric")};return zh.runKernel(ru,t)}});
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function hf(e,t=!1){}
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */Ph();ph={buffer:uf,cast:cf,clone:df,print:hf};const pf=ep({add_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t){let n=Kh(e,"a","add"),r=Kh(t,"b","add");[n,r]=Rh(n,r);const a={a:n,b:r};return zh.runKernel(Uo,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ff=ep({floorDiv_:function(e,t){let n=Kh(e,"a","floorDiv"),r=Kh(t,"b","floorDiv");[n,r]=Rh(n,r);const a={a:n,b:r};return zh.runKernel(Kl,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const mf=ep({div_:function(e,t){let n=Kh(e,"a","div"),r=Kh(t,"b","div");if([n,r]=Rh(n,r),"int32"===n.dtype&&"int32"===r.dtype)return ff(n,r);const a={a:n,b:r};return zh.runKernel(Ll,a,{})}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gf=ep({mul_:function(e,t){let n=Kh(e,"a","mul"),r=Kh(t,"b","mul");[n,r]=Rh(n,r);const a={a:n,b:r};return zh.runKernel(Ou,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yf=ep({abs_:function(e){const t=Kh(e,"x","abs");if("complex64"===t.dtype){const e={x:t};return zh.runKernel(ml,e)}{const e={x:t};return zh.runKernel(zo,e)}}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bf=ep({acos_:function(e){const t={x:Kh(e,"x","acos")};return zh.runKernel(Go,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vf=ep({acosh_:function(e){const t={x:Kh(e,"x","acosh")};return zh.runKernel(Vo,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Af=ep({addN_:function(e){Xi(Array.isArray(e),(()=>"The argument passed to tf.addN() must be a list of tensors")),Xi(e.length>=1,(()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`));const t=e.map(((e,t)=>Kh(e,`tensors${t}`,"addN"))),n=t[0];t.forEach((e=>{if(e.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")})),t.forEach((e=>{if(!eo(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));const r=t;return zh.runKernel(Ho,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xf=ep({all_:function(e,t=null,n=!1){const r={x:Kh(e,"x","all","bool")},a={axis:t,keepDims:n};return zh.runKernel(jo,r,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kf=ep({any_:function(e,t=null,n=!1){const r={x:Kh(e,"x","any","bool")},a={axis:t,keepDims:n};return zh.runKernel(qo,r,a)}});
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wf=ep({argMax_:function(e,t=0){const n={x:Kh(e,"x","argMax")},r={axis:t};return zh.runKernel(Qo,n,r)}});
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Sf=ep({argMin_:function(e,t=0){const n={x:Kh(e,"x","argMin")},r={axis:t};return zh.runKernel(Xo,n,r)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Cf=ep({asin_:function(e){const t={x:Kh(e,"x","asin")};return zh.runKernel(Zo,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const If=ep({asinh_:function(e){const t={x:Kh(e,"x","asinh")};return zh.runKernel(Ko,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Wf=ep({atan_:function(e){const t={x:Kh(e,"x","atan")};return zh.runKernel(Jo,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _f=ep({atan2_:function(e,t){let n=Kh(e,"a","atan2"),r=Kh(t,"b","atan2");[n,r]=Rh(n,r);const a={a:n,b:r};return zh.runKernel(el,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Tf=ep({atanh_:function(e){const t={x:Kh(e,"x","atanh")};return zh.runKernel(Yo,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Nf(e,t,n,r,a="NHWC",s){return $f(e,[...t,e[3]],n,s,r,null,null,Vf(a))}function Ef(e,t,n,r,a,s,i="channelsLast"){const[o,l]=Df(t);let u;if("channelsLast"===i)u=[o,l,e[3],e[3]];else{if("channelsFirst"!==i)throw new Error(`Unknown dataFormat ${i}`);u=[o,l,e[1],e[1]]}return $f(e,u,n,r,a,s,!1,i)}function Rf(e,t,n,r,a,s,i="NDHWC"){const[o,l,u]=Mf(t);let c,d;if("NDHWC"===i)d="channelsLast",c=[o,l,u,e[4],e[4]];else{if("NCDHW"!==i)throw new Error(`Unknown dataFormat ${i}`);d="channelsFirst",c=[o,l,u,e[1],e[1]]}return Of(e,c,n,r,a,!1,d,s)}function $f(e,t,n,r,a,s,i=!1,o="channelsLast"){let[l,u,c,d]=[-1,-1,-1,-1];if("channelsLast"===o)[l,u,c,d]=e;else{if("channelsFirst"!==o)throw new Error(`Unknown dataFormat ${o}`);[l,d,u,c]=e}const[h,p,,f]=t,[m,g]=Df(n),[y,b]=Df(r),v=Lf(h,y),A=Lf(p,b),{padInfo:x,outHeight:k,outWidth:w}=function(e,t,n,r,a,s,i,o,l){let u,c,d;if("number"==typeof e){u={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};const a=function(e,t,n,r,a){null==r&&(r=Ff(e,t,n));const s=e[0],i=e[1],o=Bf((s-t+2*r)/n+1,a),l=Bf((i-t+2*r)/n+1,a);return[o,l]}([t,n],s,r,e,o);c=a[0],d=a[1]}else if("same"===e){c=Math.ceil(t/r),d=Math.ceil(n/a);const e=Math.max(0,(c-1)*r+s-t),o=Math.max(0,(d-1)*a+i-n),l=Math.floor(e/2),h=e-l,p=Math.floor(o/2);u={top:l,bottom:h,left:p,right:o-p,type:"SAME"}}else if("valid"===e)u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((t-s+1)/r),d=Math.ceil((n-i+1)/a);else{if("object"!=typeof e)throw Error(`Unknown padding parameter: ${e}`);{const h="channelsLast"===l?e[1][0]:e[2][0],p="channelsLast"===l?e[1][1]:e[2][1],f="channelsLast"===l?e[2][0]:e[3][0],m="channelsLast"===l?e[2][1]:e[3][1];u={top:h,bottom:p,left:f,right:m,type:0===h&&0===p&&0===f&&0===m?"VALID":"EXPLICIT"},c=Bf((t-s+h+p)/r+1,o),d=Bf((n-i+f+m)/a+1,o)}}return{padInfo:u,outHeight:c,outWidth:d}}(a,u,c,m,g,v,A,s,o),S=i?f*d:f;let C;return"channelsFirst"===o?C=[l,S,k,w]:"channelsLast"===o&&(C=[l,k,w,S]),{batchSize:l,dataFormat:o,inHeight:u,inWidth:c,inChannels:d,outHeight:k,outWidth:w,outChannels:S,padInfo:x,strideHeight:m,strideWidth:g,filterHeight:h,filterWidth:p,effectiveFilterHeight:v,effectiveFilterWidth:A,dilationHeight:y,dilationWidth:b,inShape:e,outShape:C,filterShape:t}}function Of(e,t,n,r,a,s=!1,i="channelsLast",o){let[l,u,c,d,h]=[-1,-1,-1,-1,-1];if("channelsLast"===i)[l,u,c,d,h]=e;else{if("channelsFirst"!==i)throw new Error(`Unknown dataFormat ${i}`);[l,h,u,c,d]=e}const[p,f,m,,g]=t,[y,b,v]=Mf(n),[A,x,k]=Mf(r),w=Lf(p,A),S=Lf(f,x),C=Lf(m,k),{padInfo:I,outDepth:W,outHeight:_,outWidth:T}=function(e,t,n,r,a,s,i,o,l,u,c){let d,h,p,f;"valid"===e&&(e=0);if("number"==typeof e){d={top:e,bottom:e,left:e,right:e,front:e,back:e,type:0===e?"VALID":"NUMBER"};const m=function(e,t,n,r,a,s){null==a&&(a=Ff(e,t[0],r[0]));const i=[0,0,0,n];for(let o=0;o<3;o++)e[o]+2*a>=t[o]&&(i[o]=Bf((e[o]-t[o]+2*a)/r[o]+1,s));return i}([t,n,r,1],[o,l,u],1,[a,s,i],e,c);h=m[0],p=m[1],f=m[2]}else{if("same"!==e)throw Error(`Unknown padding parameter: ${e}`);{h=Math.ceil(t/a),p=Math.ceil(n/s),f=Math.ceil(r/i);const e=(h-1)*a+o-t,c=(p-1)*s+l-n,m=(f-1)*i+u-r,g=Math.floor(e/2),y=e-g,b=Math.floor(c/2),v=c-b,A=Math.floor(m/2);d={top:b,bottom:v,left:A,right:m-A,front:g,back:y,type:"SAME"}}}return{padInfo:d,outDepth:h,outHeight:p,outWidth:f}}(a,u,c,d,y,b,v,w,S,C,o),N=s?g*h:g;let E;return"channelsFirst"===i?E=[l,N,W,_,T]:"channelsLast"===i&&(E=[l,W,_,T,N]),{batchSize:l,dataFormat:i,inDepth:u,inHeight:c,inWidth:d,inChannels:h,outDepth:W,outHeight:_,outWidth:T,outChannels:N,padInfo:I,strideDepth:y,strideHeight:b,strideWidth:v,filterDepth:p,filterHeight:f,filterWidth:m,effectiveFilterDepth:w,effectiveFilterHeight:S,effectiveFilterWidth:C,dilationDepth:A,dilationHeight:x,dilationWidth:k,inShape:e,outShape:E,filterShape:t}}function Ff(e,t,n,r=1){const a=Lf(t,r);return Math.floor((e[0]*(n-1)-n+a)/2)}function Df(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function Mf(e){return"number"==typeof e?[e,e,e]:e}function Lf(e,t){return t<=1?e:e+(e-1)*(t-1)}function Bf(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function Pf(e){const[t,n,r]=Df(e);return 1===t&&1===n&&1===r}function zf(e,t){return Pf(e)||Pf(t)}function Gf(e){return Df(e).every((e=>e>0))}function Vf(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function Uf(e,t,n){if(null!=n){if("string"==typeof t)throw Error(`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);if("number"==typeof t)Xi(to(t),(()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`));else{if("object"!=typeof t)throw Error(`Error in ${e}: Unknown padding parameter: ${t}`);t.forEach((t=>{t.forEach((t=>{Xi(to(t),(()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`))}))}))}}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Hf=ep({reshape_:function(e,t){const n={x:Kh(e,"x","reshape","string_or_numeric")},r={shape:t};return zh.runKernel(ec,n,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jf=ep({avgPool_:function(e,t,n,r,a){const s=Kh(e,"x","avgPool","float32");Xi(zf(n,1),(()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`));let i=s,o=!1;3===s.rank&&(o=!0,i=Hf(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Xi(4===i.rank,(()=>`Error in avgPool: x must be rank 4 but got rank ${i.rank}.`)),Uf("avgPool",r,a);const l={x:i},u={filterSize:t,strides:n,pad:r,dimRoundingMode:a};let c=zh.runKernel(tl,l,u);return c=cf(c,s.dtype),o?Hf(c,[c.shape[1],c.shape[2],c.shape[3]]):c}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const qf=ep({avgPool3d_:function(e,t,n,r,a,s="NDHWC"){const i=Kh(e,"x","avgPool3d","float32");let o=i,l=!1;4===i.rank&&(l=!0,o=Hf(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Xi(5===o.rank,(()=>`Error in avgPool3d: x must be rank 5 but got rank ${o.rank}.`)),Xi("NDHWC"===s,(()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`)),Xi("number"==typeof n&&n>0||Array.isArray(n)&&n[0]>0&&n[1]>0&&n[2]>0,(()=>`Error in avgPool3d: Stride must be > 0, but got '${n}'`)),Uf("avgPool3d",r,a);const u={x:o},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:s};let d=zh.runKernel(rl,u,c);return d=cf(d,o.dtype),l?Hf(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Qf=ep({concat_:function(e,t=0){Xi(e.length>=1,(()=>"Pass at least one tensor to concat"));const n=Jh(e,"tensors","concat","string_or_numeric");if("complex64"===n[0].dtype&&n.forEach((e=>{if("complex64"!==e.dtype)throw new Error(`Cannot concatenate complex64 tensors with a tensor\n          with dtype ${e.dtype}. `)})),1===n.length)return df(n[0]);const r=n,a={axis:t};return zh.runKernel(gl,r,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Xf=ep({matMul_:function(e,t,n=!1,r=!1){let a=Kh(e,"a","matMul"),s=Kh(t,"b","matMul");[a,s]=Rh(a,s);const i={a:a,b:s},o={transposeA:n,transposeB:r};return zh.runKernel(sl,i,o)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Zf=ep({sigmoid_:function(e){const t={x:Kh(e,"x","sigmoid","float32")};return zh.runKernel(bc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Kf=ep({slice_:function(e,t,n){const r=Kh(e,"x","slice","string_or_numeric");if(0===r.rank)throw new Error("Slicing scalar is not possible");const a={x:r},s={begin:t,size:n};return zh.runKernel(fc,a,s)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Jf=ep({tanh_:function(e){const t={x:Kh(e,"x","tanh","float32")};return zh.runKernel(Bc,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Yf=ep({basicLSTMCell_:function(e,t,n,r,a,s){const i=Kh(e,"forgetBias","basicLSTMCell"),o=Kh(t,"lstmKernel","basicLSTMCell"),l=Kh(n,"lstmBias","basicLSTMCell"),u=Kh(r,"data","basicLSTMCell"),c=Kh(a,"c","basicLSTMCell"),d=Kh(s,"h","basicLSTMCell"),h=Qf([u,d],1),p=Xf(h,o),f=pf(p,l),m=f.shape[0],g=f.shape[1]/4,y=[m,g],b=Kf(f,[0,0],y),v=Kf(f,[0,g],y),A=Kf(f,[0,2*g],y),x=Kf(f,[0,3*g],y),k=pf(gf(Zf(b),Jf(v)),gf(c,Zf(pf(i,A))));return[k,gf(Jf(k),Zf(x))]}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const em=ep({batchToSpaceND_:function(e,t,n){const r=Kh(e,"x","batchToSpaceND"),a=t.reduce(((e,t)=>e*t));Xi(r.rank>=1+t.length,(()=>`input rank is ${r.rank} but should be > than blockShape.length ${t.length}`)),Xi(n.length===t.length,(()=>`crops.length is ${n.length} but should be equal to blockShape.length  ${t.length}`)),Xi(r.shape[0]%a==0,(()=>`input tensor batch is ${r.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${a}`));const s={x:r},i={blockShape:t,crops:n};return zh.runKernel(il,s,i)}});const tm=ep({batchNorm_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r,a,s){null==s&&(s=.001);const i=Kh(e,"x","batchNorm"),o=Kh(t,"mean","batchNorm"),l=Kh(n,"variance","batchNorm");let u,c;null!=a&&(u=Kh(a,"scale","batchNorm")),null!=r&&(c=Kh(r,"offset","batchNorm")),Xi(o.rank===l.rank,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),Xi(null==c||o.rank===c.rank,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),Xi(null==u||o.rank===u.rank,(()=>"Batch normalization gradient requires mean and scale to have equal ranks."));const d={x:function(e){let t;return t=0===e.rank||1===e.rank?Hf(e,[1,1,1,e.size]):2===e.rank?Hf(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?Hf(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e,t}(i),scale:u,offset:c,mean:o,variance:l},h={varianceEpsilon:s},p=zh.runKernel(Jl,d,h);return Hf(p,i.shape)}});const nm=ep({batchNorm2d_:function(e,t,n,r,a,s){const i=Kh(e,"x","batchNorm"),o=Kh(t,"mean","batchNorm"),l=Kh(n,"variance","batchNorm");let u,c;return null!=a&&(u=Kh(a,"scale","batchNorm")),null!=r&&(c=Kh(r,"offset","batchNorm")),Xi(2===i.rank,(()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`)),Xi(2===o.rank||1===o.rank,(()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${o.rank}.`)),Xi(2===l.rank||1===l.rank,(()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`)),null!=u&&Xi(2===u.rank||1===u.rank,(()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`)),null!=c&&Xi(2===c.rank||1===c.rank,(()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`)),tm(i,o,l,c,u,s)}});const rm=ep({batchNorm3d_:function(e,t,n,r,a,s){const i=Kh(e,"x","batchNorm"),o=Kh(t,"mean","batchNorm"),l=Kh(n,"variance","batchNorm");let u,c;return null!=a&&(u=Kh(a,"scale","batchNorm")),null!=r&&(c=Kh(r,"offset","batchNorm")),Xi(3===i.rank,(()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`)),Xi(3===o.rank||1===o.rank,(()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${o.rank}.`)),Xi(3===l.rank||1===l.rank,(()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`)),null!=u&&Xi(3===u.rank||1===u.rank,(()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`)),null!=c&&Xi(3===c.rank||1===c.rank,(()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`)),tm(i,o,l,c,u,s)}});const am=ep({batchNorm4d_:function(e,t,n,r,a,s){const i=Kh(e,"x","batchNorm"),o=Kh(t,"mean","batchNorm"),l=Kh(n,"variance","batchNorm");let u,c;return null!=a&&(u=Kh(a,"scale","batchNorm")),null!=r&&(c=Kh(r,"offset","batchNorm")),Xi(4===i.rank,(()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`)),Xi(4===o.rank||1===o.rank,(()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${o.rank}.`)),Xi(4===l.rank||1===l.rank,(()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`)),null!=u&&Xi(4===u.rank||1===u.rank,(()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`)),null!=c&&Xi(4===c.rank||1===c.rank,(()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`)),tm(i,o,l,c,u,s)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sm=ep({bincount_:function(e,t,n){const r=Kh(e,"x","bincount"),a=Kh(t,"weights","bincount");Xi("int32"===r.dtype,(()=>`Error in bincount: input dtype must be int32, but got ${r.dtype}`)),Xi(n>=0,(()=>`size must be non-negative, but got ${n}.`)),Xi(a.size===r.size||0===a.size,(()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${r.shape}, weights shape: ${a.shape}.`));const s={x:r,weights:a},i={size:n};return zh.runKernel(ol,s,i)}});
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const im=ep({bitwiseAnd_:function(e,t){const n=Kh(e,"x","bitwiseAnd"),r=Kh(t,"y","bitwiseAnd");if(!eo(n.shape,r.shape))throw new Error(`BitwiseAnd: Tensors must have the same shape. x: ${n.shape}, y: ${r.shape}`);if("int32"!==n.dtype||"int32"!==r.dtype)throw new Error(`BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ${n.dtype} and type of y: ${r.dtype}`);const a={a:n,b:r};return zh.runKernel(ll,a)}});
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const om=ep({broadcastArgs_:function(e,t){const n=Kh(e,"s0","broadcastArgs","int32"),r=Kh(t,"s1","broadcastArgs","int32");if(1!==n.rank)throw new Error(`broadcastArgs(): first input must be a vector (rank=1). Has rank ${n.rank}`);if(1!==r.rank)throw new Error(`broadcastArgs(): second input must be a vector (rank=1). Has rank ${r.rank}`);const a={s0:n,s1:r};return zh.runKernel(cl,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lm=ep({broadcastTo_:function(e,t){let n=Kh(e,"broadcastTo","x");const r=n.shape;if(To(t),t.length<n.rank)throw new Error(`broadcastTo(): shape.length=${t.length} < input.rank=${n.rank}.`);if(t.length>n.rank){const e=n.shape.slice();for(;e.length<t.length;)e.unshift(1);n=Hf(n,e)}const a=n.shape,s=Array.from(t);for(let l=t.length-1;l>=0;l--)if(a[l]===t[l])s[l]=1;else if(1!==n.shape[l])throw new Error(`broadcastTo(): [${r}] cannot be broadcast to [${t}].`);if(0===s.map(((e,t)=>e>1?t:-1)).filter((e=>e>=0)).length)return df(n);const i={x:n},o={reps:s};return zh.runKernel(Pc,i,o)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const um=ep({ceil_:function(e){const t={x:Kh(e,"x","ceil","float32")};return zh.runKernel(hl,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function cm(e,t,n){To(e);const r={shape:e,value:t,dtype:n=n||vo(t)};return zh.runKernel(Ql,{},r)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dm=ep({clipByValue_:function(e,t,n){const r=Kh(e,"x","clipByValue");if(Xi(t<=n,(()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`)),t===n)return cm(r.shape,t,r.dtype);const a={x:r},s={clipValueMin:t,clipValueMax:n};return zh.runKernel(pl,a,s)}});const hm=ep({concat1d_:function(e){return Qf(e,0)}});const pm=ep({concat2d_:function(e,t){return Qf(e,t)}});const fm=ep({concat3d_:function(e,t){return Qf(e,t)}});const mm=ep({concat4d_:function(e,t){return Qf(e,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gm=ep({conv2d_:function(e,t,n,r,a="NHWC",s=[1,1],i){const o=Kh(e,"x","conv2d","float32"),l=Kh(t,"filter","conv2d","float32");let u=o,c=!1;3===o.rank&&(c=!0,u=Hf(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Xi(4===u.rank,(()=>`Error in conv2d: input must be rank 4, but got rank ${u.rank}.`)),Xi(4===l.rank,(()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`)),Uf("conv2d",r,i);const d="NHWC"===a?u.shape[3]:u.shape[1];Xi(d===l.shape[2],(()=>`Error in conv2d: depth of input (${d}) must match input depth for filter ${l.shape[2]}.`)),Xi(zf(n,s),(()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`)),Xi(Gf(s),(()=>"Error in conv2D: Dilated rates should be larger than 0.")),Xi(Gf(n),(()=>"Error in conv2D: Strides should be larger than 0."));const h={x:u,filter:l},p={strides:n,pad:r,dataFormat:a,dilations:s,dimRoundingMode:i},f=zh.runKernel(yl,h,p);return c?Hf(f,[f.shape[1],f.shape[2],f.shape[3]]):f}});const ym=ep({conv1d_:function(e,t,n,r,a="NWC",s=1,i){const o=Kh(e,"x","conv1d"),l=Kh(t,"filter","conv1d");let u=o,c=!1;2===o.rank&&(c=!0,u=Hf(o,[1,o.shape[0],o.shape[1]])),Xi(3===u.rank,(()=>`Error in conv1d: input must be rank 3, but got rank ${u.rank}.`)),Xi(3===l.rank,(()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`)),Uf("conv1d",r,i),Xi(u.shape[2]===l.shape[1],(()=>`Error in conv1d: depth of input (${u.shape[2]}) must match input depth for filter ${l.shape[1]}.`)),Xi(zf(n,s),(()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`)),Xi(Gf(s),(()=>"Error in conv1D: Dilated rates should be larger than 0.")),Xi(Gf(n),(()=>"Error in conv1D: Stride should be larger than 0.")),Xi("NWC"===a,(()=>`Error in conv1d: got dataFormat of ${a} but only NWC is currently supported.`));const d=Hf(l,[1,l.shape[0],l.shape[1],l.shape[2]]),h=Hf(u,[u.shape[0],1,u.shape[1],u.shape[2]]),p=gm(h,d,[1,n],r,"NHWC",[1,s],i);return Hf(p,c?[p.shape[2],p.shape[3]]:[p.shape[0],p.shape[2],p.shape[3]])}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bm=ep({conv2DBackpropInput_:function(e,t,n,r,a,s="NHWC",i){Xi(e.length===t.rank,(()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`));let o=e,l=t,u=!1;3===t.rank&&(u=!0,l=Hf(t,[1,t.shape[0],t.shape[1],t.shape[2]]),o=[1,e[0],e[1],e[2]]),Xi(4===o.length,(()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${o.length}.`)),Xi(4===l.rank,(()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`)),Xi(4===n.rank,(()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`));const c="NHWC"===s?o[3]:o[1],d="NHWC"===s?l.shape[3]:l.shape[1];Xi(c===n.shape[2],(()=>`Error in conv2dDerInput: depth of input (${c}) must match input depth for filter ${n.shape[2]}.`)),Xi(d===n.shape[3],(()=>`Error in conv2dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[3]}.`)),Uf("conv2dDerInput",a,i);const h={dy:l,filter:n},p={strides:r,pad:a,dataFormat:s,dimRoundingMode:i,inputShape:o},f=zh.runKernel(vl,h,p);return u?Hf(f,[f.shape[1],f.shape[2],f.shape[3]]):f}});const vm=ep({conv2dTranspose_:function(e,t,n,r,a,s){const i=Kh(e,"x","conv2dTranspose"),o=Kh(t,"filter","conv2dTranspose");return bm(n,i,o,r,a,"NHWC",s)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Am=ep({conv3d_:function(e,t,n,r,a="NDHWC",s=[1,1,1]){const i=Kh(e,"x","conv3d"),o=Kh(t,"filter","conv3d");let l=i,u=!1;4===i.rank&&(u=!0,l=Hf(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Xi(5===l.rank,(()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`)),Xi(5===o.rank,(()=>`Error in conv3d: filter must be rank 5, but got rank ${o.rank}.`)),Xi(l.shape[4]===o.shape[3],(()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${o.shape[3]}.`)),Xi(zf(n,s),(()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`)),Xi("NDHWC"===a,(()=>`Error in conv3d: got dataFormat of ${a} but only NDHWC is currently supported.`)),Xi(Gf(s),(()=>"Error in conv3D: Dilated rates should be larger than 0.")),Xi(Gf(n),(()=>"Error in conv3D: Strides should be larger than 0."));const c={x:l,filter:o},d={strides:n,pad:r,dataFormat:a,dilations:s},h=zh.runKernel(Al,c,d);return u?Hf(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xm=ep({conv3DBackpropInput_:function(e,t,n,r,a){Xi(e.length===t.rank,(()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`));let s=e,i=t,o=!1;4===t.rank&&(o=!0,i=Hf(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),s=[1,e[0],e[1],e[2],e[3]]);const l=s[4],u=i.shape[4];Xi(5===s.length,(()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`)),Xi(5===i.rank,(()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`)),Xi(5===n.rank,(()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`)),Xi(l===n.shape[3],(()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`)),Xi(u===n.shape[4],(()=>`Error in conv3dDerInput: depth of output (${u}) must match output depth for filter ${n.shape[4]}.`));const c={dy:i,filter:n},d={pad:a,strides:r,inputShape:s},h=zh.runKernel(kl,c,d);return o?Hf(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}});const km=ep({conv3dTranspose_:function(e,t,n,r,a){const s=Kh(e,"x","conv3dTranspose"),i=Kh(t,"filter","conv3dTranspose");return xm(n,s,i,r,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wm=ep({cos_:function(e){const t={x:Kh(e,"x","cos","float32")};return zh.runKernel(wl,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Sm=ep({cosh_:function(e){const t={x:Kh(e,"x","cosh","float32")};return zh.runKernel(Sl,t)}});
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Cm=ep({cumprod_:function(e,t=0,n=!1,r=!1){const a={x:Kh(e,"x","cumprod")},s={axis:t,exclusive:n,reverse:r};return zh.runKernel(Cl,a,s)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Im=ep({cumsum_:function(e,t=0,n=!1,r=!1){const a={x:Kh(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:r};return zh.runKernel(Il,a,s)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Wm=ep({denseBincount_:function(e,t,n,r=!1){const a=Kh(e,"x","denseBincount"),s=Kh(t,"weights","denseBincount");Xi("int32"===a.dtype,(()=>`Error in denseBincount: input dtype must be int32, but got ${a.dtype}`)),Xi(a.rank<=2,(()=>`Error in denseBincount: input must be at most rank 2, but got rank ${a.rank}.`)),Xi(n>=0,(()=>`size must be non-negative, but got ${n}.`)),Xi(s.size===a.size||0===s.size,(()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${a.shape}, weights shape: ${s.shape}.`));const i={x:a,weights:s},o={size:n,binaryOutput:r};return zh.runKernel(_l,i,o)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _m=ep({depthToSpace_:function(e,t,n="NHWC"){const r=Kh(e,"x","depthToSpace","float32"),a="NHWC"===n?r.shape[1]:r.shape[2],s="NHWC"===n?r.shape[2]:r.shape[3],i="NHWC"===n?r.shape[3]:r.shape[1];Xi(t>1,(()=>`blockSize should be > 1 for depthToSpace, but was: ${t}`)),Xi(a*t>=0,(()=>`Negative dimension size caused by overflow when multiplying\n    ${a} and ${t}  for depthToSpace with input shape\n    ${r.shape}`)),Xi(s*t>=0,(()=>`Negative dimension size caused by overflow when multiplying\n    ${s} and ${t} for depthToSpace with input shape\n        ${r.shape}`)),Xi(i%(t*t)==0,(()=>`Dimension size must be evenly divisible by ${t*t} but is ${i} for depthToSpace with input shape ${r.shape}`));const o={x:r},l={blockSize:t,dataFormat:n};return zh.runKernel(Tl,o,l)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Tm=ep({depthwiseConv2d_:function(e,t,n,r,a="NHWC",s=[1,1],i){const o=Kh(e,"x","depthwiseConv2d","float32"),l=Kh(t,"filter","depthwiseConv2d","float32");let u=o,c=!1;3===o.rank&&(c=!0,u=Hf(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Xi(4===u.rank,(()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${u.rank}.`)),Xi(4===l.rank,(()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`));const d="NHWC"===a?u.shape[3]:u.shape[1];Xi(d===l.shape[2],(()=>`Error in depthwiseConv2d: number of input channels (${d}) must match the inChannels dimension in filter ${l.shape[2]}.`)),Uf("depthwiseConv2d",r,i);const h={x:u,filter:l},p={strides:n,pad:r,dataFormat:a,dilations:s,dimRoundingMode:i},f=zh.runKernel(Nl,h,p);return c?Hf(f,[f.shape[1],f.shape[2],f.shape[3]]):f}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Nm=ep({diag_:function(e){const t={x:Kh(e,"x","diag")};return zh.runKernel($l,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Em=ep({dilation2d_:function(e,t,n,r,a=[1,1],s="NHWC"){const i=Kh(e,"x","dilation2d"),o=Kh(t,"filter","dilation2d");Xi(3===i.rank||4===i.rank,(()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`)),Xi(3===o.rank,(()=>`Error in dilation2d: filter must be rank 3, but got rank ${o.rank}.`)),Xi("NHWC"===s,(()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`));let l=i,u=!1;3===i.rank&&(l=Hf(i,[1,i.shape[0],i.shape[1],i.shape[2]]),u=!0),Xi(l.shape[3]===o.shape[2],(()=>`Error in dilation2d:  input and filter must have the same depth: ${l.shape[3]} vs ${o.shape[2]}`));const c={x:l,filter:o},d={strides:n,pad:r,dilations:a},h=zh.runKernel(Ol,c,d);return u?Hf(h,[h.shape[1],h.shape[2],h.shape[3]]):h}});
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Rm(e,t){const n=e.length,r=[];for(let a=0;a<n;a++){const s=n-1-a,i=e[s]||1;(t[t.length-1-a]||1)>1&&1===i&&r.unshift(s)}return r}function $m(e,t){const n=[];for(let r=0;r<t.length;r++){const a=e[e.length-r-1],s=t.length-r-1,i=t[s];(null==a||1===a&&i>1)&&n.unshift(s)}return n}function Om(e,t){const n=Math.max(e.length,t.length),r=new Array(n);for(let a=0;a<n;a++){let s=e[e.length-a-1];null==s&&(s=1);let i=t[t.length-a-1];if(null==i&&(i=1),1===s)r[n-a-1]=i;else if(1===i)r[n-a-1]=s;else{if(s!==i){throw Error(`Operands could not be broadcast together with shapes ${e} and ${t}.`)}r[n-a-1]=s}}return r}const Fm=Object.freeze(Object.defineProperty({__proto__:null,assertAndGetBroadcastShape:Om,getBroadcastDims:Rm,getReductionAxes:$m},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Dm=ep({equal_:function(e,t){let n=Kh(e,"a","equal","string_or_numeric"),r=Kh(t,"b","equal","string_or_numeric");[n,r]=Rh(n,r),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(Vl,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Mm=ep({where_:function(e,t,n){const r=Kh(t,"a","where"),a=Kh(n,"b","where"),s=Kh(e,"condition","where","bool"),i=Om(Om(s.shape,r.shape),a.shape),o={condition:lm(s,i),t:lm(r,i),e:lm(a,i)};return zh.runKernel(hc,o)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Lm=ep({zerosLike_:function(e){const t={x:Kh(e,"x","zerosLike")};return zh.runKernel(qc,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Bm=ep({divNoNan_:function(e,t){let n=Kh(e,"a","div"),r=Kh(t,"b","div");[n,r]=Rh(n,r);const a=mf(n,r),s=Lm(a),i=Dm(r,s);return Mm(i,s,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Pm=ep({dot_:function(e,t){const n=Kh(e,"t1","dot"),r=Kh(t,"t2","dot");Xi(!(1!==n.rank&&2!==n.rank||1!==r.rank&&2!==r.rank),(()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${r.rank}.`));const a=1===n.rank?n.size:n.shape[1],s=1===r.rank?r.size:r.shape[0];if(Xi(a===s,(()=>`Error in dot: inner dimensions of inputs must match, but got ${a} and ${s}.`)),1===n.rank&&1===r.rank){const e=Hf(n,[1,-1]),t=Hf(r,[-1,1]),a=Xf(e,t);return Hf(a,[])}if(1===n.rank&&2===r.rank){const e=Hf(n,[1,-1]),t=Hf(r,[r.shape[0],r.shape[1]]),a=Xf(e,t);return Hf(a,[a.size])}if(2===n.rank&&1===r.rank){const e=Hf(r,[-1,1]),t=Xf(n,e);return Hf(t,[t.size])}{const e=Hf(r,[r.shape[0],r.shape[1]]);return Xf(n,e)}}});
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zm=ep({einsum_:function(e,...t){const n=t.map(((e,t)=>Kh(e,`tensors${t}`,"einsum"))),r={equation:e};return zh.runKernel(Bl,n,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Gm=ep({elu_:function(e){const t={x:Kh(e,"x","elu","float32")};return zh.runKernel(Pl,t)}});
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Vm=ep({ensureShape_:function(e,t){const n=Kh(e,"x","ensureShape","string_or_numeric");if(!Yi(n.shape,t))throw new Error(`EnsureShape: Shape of tensor ${n.shape} is not compatible with expected shape ${t}`);return e}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Um=ep({erf_:function(e){let t=Kh(e,"x","erf");Xi("int32"===t.dtype||"float32"===t.dtype,(()=>"Input dtype must be `int32` or `float32`.")),"int32"===t.dtype&&(t=cf(t,"float32"));const n={x:t};return zh.runKernel(Gl,n)}});
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Hm(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function jm(e,t,n){const r=e.length+t.length,a=[];let s=0,i=0;for(let o=0;o<r;o++)-1===n.indexOf(o)?a.push(e[s++]):a.push(t[i++]);return a}function qm(e,t){const n=[],r=e.length;for(let a=0;a<r;a++)-1===t.indexOf(a)&&n.push(e[a]);return[n,t.map((t=>e[t]))]}function Qm(e,t){return jm(e,t.map((e=>1)),t)}function Xm(e,t,n){Xi(Hm(t,n),(()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`))}function Zm(e,t){if(Hm(e,t))return null;const n=[];for(let r=0;r<t;++r)-1===e.indexOf(r)&&n.push(r);return e.forEach((e=>n.push(e))),n}function Km(e){return e.map(((e,t)=>[t,e])).sort(((e,t)=>e[1]-t[1])).map((e=>e[0]))}function Jm(e,t){const n=[];for(let r=t-e;r<t;++r)n.push(r);return n}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ym=ep({max_:function(e,t=null,n=!1){const r={x:Kh(e,"x","max")},a={reductionIndices:t,keepDims:n};return zh.runKernel(xu,r,a)}});
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const eg=ep({min_:function(e,t=null,n=!1){const r={x:Kh(e,"x","min")},a={axis:t,keepDims:n};return zh.runKernel(Tu,r,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tg=ep({pow_:function(e,t){let n=Kh(e,"base","pow"),r=Kh(t,"exp","pow");[n,r]=Rh(n,r);const a={a:n,b:r};return zh.runKernel(Uu,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ng(e,t){if((eh(e)&&"string"!==t||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===t&&eh(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return np(e,[],[],t)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const rg=ep({sqrt_:function(e){const t={x:Kh(e,"x","sqrt","float32")};return zh.runKernel(Ac,t)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ag=ep({square_:function(e){const t=Kh(e,"x","square");return zh.runKernel("Square",{x:t},{})}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sg=ep({sum_:function(e,t=null,n=!1){let r=Kh(e,"x","sum");"bool"===r.dtype&&(r=cf(r,"int32"));const a={x:r},s={axis:t,keepDims:n};return zh.runKernel(xc,a,s)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ig(e,t,n=null){if(0===e.rank)return yf(e);if(1!==e.rank&&null===n)return ig(Hf(e,[-1]),t,n);if(1===e.rank||"number"==typeof n||Array.isArray(n)&&1===n.length){if(1===t)return sg(yf(e),n);if(t===1/0)return Ym(yf(e),n);if(t===-1/0)return eg(yf(e),n);if("euclidean"===t||2===t)return rg(sg(tg(yf(e),ng(2,"int32")),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}if(Array.isArray(n)&&2===n.length){if(1===t)return Ym(sg(yf(e),n[0]),n[1]-1);if(t===1/0)return Ym(sg(yf(e),n[1]),n[0]);if(t===-1/0)return eg(sg(yf(e),n[1]),n[0]);if("fro"===t||"euclidean"===t)return rg(sg(ag(e),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}throw new Error(`Error in norm: invalid axis: ${n}`)}const og=ep({norm_:function(e,t="euclidean",n=null,r=!1){const a=ig(e=Kh(e,"x","norm"),t,n);let s=a.shape;if(r){const t=io(n,e.shape);s=Qm(a.shape,t)}return Hf(a,s)}});
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lg=ep({euclideanNorm_:function(e,t=null,n=!1){return og(e,"euclidean",t,n)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ug=ep({exp_:function(e){const t={x:Kh(e,"x","exp")};return zh.runKernel(Ul,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const cg=ep({expandDims_:function(e,t=0){const n=Kh(e,"x","expandDims","string_or_numeric");Xi(t<=n.rank,(()=>"Axis must be <= rank of the tensor"));const r={input:n},a={dim:t};return zh.runKernel(Hl,r,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dg=ep({expm1_:function(e){const t={x:Kh(e,"x","expm1")};return zh.runKernel(jl,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const hg=ep({tile_:function(e,t){const n=Kh(e,"x","tile","string_or_numeric");Xi(n.rank===t.length,(()=>`Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`));const r={x:n},a={reps:t};return zh.runKernel(Pc,r,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const pg=ep({eye_:function(e,t,n,r="float32"){null==t&&(t=e);const a=uf([e,t],r),s=e<=t?e:t;for(let o=0;o<s;++o)a.set(1,o,o);const i=Hf(a.toTensor(),[e,t]);if(null==n)return i;if(1===n.length)return hg(cg(i,0),[n[0],1,1]);if(2===n.length)return hg(cg(cg(i,0),0),[n[0],n[1],1,1]);if(3===n.length)return hg(cg(cg(cg(i,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${n.length}D.`)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const fg=ep({floor_:function(e){const t={x:Kh(e,"x","floor","float32")};return zh.runKernel(Zl,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const mg=ep({gather_:function(e,t,n=0,r=0){const a={x:Kh(e,"x","gather"),indices:Kh(t,"indices","gather","int32")},s={axis:n,batchDims:r};return zh.runKernel(Yl,a,s)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gg=ep({greater_:function(e,t){let n=Kh(e,"a","greater","string_or_numeric"),r=Kh(t,"b","greater","string_or_numeric");[n,r]=Rh(n,r),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(tu,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yg=ep({greaterEqual_:function(e,t){let n=Kh(e,"a","greaterEqual","string_or_numeric"),r=Kh(t,"b","greaterEqual","string_or_numeric");[n,r]=Rh(n,r),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(nu,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bg=ep({imag_:function(e){const t={input:Kh(e,"input","imag")};return zh.runKernel(su,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vg=ep({isFinite_:function(e){const t={x:Kh(e,"x","isFinite")};return zh.runKernel(iu,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ag=ep({isInf_:function(e){const t={x:Kh(e,"x","isInf")};return zh.runKernel(ou,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xg=ep({isNaN_:function(e){const t={x:Kh(e,"x","isNaN")};return zh.runKernel(lu,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kg=ep({leakyRelu_:function(e,t=.2){const n={x:Kh(e,"x","leakyRelu")},r={alpha:t};return zh.runKernel(uu,n,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wg=ep({less_:function(e,t){let n=Kh(e,"a","less","string_or_numeric"),r=Kh(t,"b","less","string_or_numeric");[n,r]=Rh(n,r),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(cu,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Sg=ep({lessEqual_:function(e,t){let n=Kh(e,"a","lessEqual","string_or_numeric"),r=Kh(t,"b","lessEqual","string_or_numeric");[n,r]=Rh(n,r),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(du,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Cg(e,t,n){if(n<=0)throw new Error("The number of values should be positive.");const r={start:e,stop:t,num:n};return zh.runKernel(hu,{},r)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ig=ep({localResponseNormalization_:function(e,t=5,n=1,r=1,a=.5){const s=Kh(e,"x","localResponseNormalization");Xi(4===s.rank||3===s.rank,(()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got\n               rank ${s.rank}.`)),Xi(to(t),(()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`));let i=s,o=!1;3===s.rank&&(o=!0,i=Hf(s,[1,s.shape[0],s.shape[1],s.shape[2]]));const l={x:i},u={depthRadius:t,bias:n,alpha:r,beta:a},c=zh.runKernel(vu,l,u);return o?Hf(c,[c.shape[1],c.shape[2],c.shape[3]]):c}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Wg=ep({log_:function(e){const t={x:Kh(e,"x","log","float32")};return zh.runKernel(pu,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _g=ep({log1p_:function(e){const t={x:Kh(e,"x","log1p")};return zh.runKernel(fu,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Tg(e,t){Xi(Ao(e),(()=>"The f passed in variableGrads(f) must be a function")),Xi(null==t||Array.isArray(t)&&t.every((e=>e instanceof gh)),(()=>"The varList passed in variableGrads(f, varList) must be an array of variables"));const n=null!=t;if(!n){t=[];for(const e in zh.registeredVariables)t.push(zh.registeredVariables[e])}const r=n?t.filter((e=>!e.trainable)):null,a=t.length;Xi((t=t.filter((e=>e.trainable))).length>0,(()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${a} variables is trainable.`));const{value:s,grads:i}=zh.gradients(e,t,null,!0);Xi(i.some((e=>null!=e)),(()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize().")),Xi(0===s.rank,(()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${s.rank} tensor`));const o={};return t.forEach(((e,t)=>{null!=i[t]&&(o[e.name]=i[t])})),null!=r&&r.forEach((e=>o[e.name]=null)),{value:s,grads:o}}function Ng(e){return zh.customGrad(e)}function Eg(e){if(e.filter((e=>null==e)).length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that\n    the f you passed encloses all operations that lead from x to y.")}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Rg=ep({neg_:function(e){const t={x:Kh(e,"x","neg")};return zh.runKernel(Fu,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $g=ep({softplus_:function(e){const t={x:Kh(e,"x","softplus")};return zh.runKernel(vc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Og=ep({logSigmoid_:function(e){const t=Kh(e,"x","logSigmoid");return Ng((e=>({value:Rg($g(Rg(e))),gradFunc:t=>gf(t,Zf(Rg(e)))})))(t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Fg=ep({sub_:function(e,t){let n=Kh(e,"a","sub"),r=Kh(t,"b","sub");[n,r]=Rh(n,r);const a={a:n,b:r};return zh.runKernel(Mc,a)}});
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Dg=ep({logSoftmax_:function(e,t=-1){const n=Kh(e,"logits","logSoftmax");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);return Ng(((e,n)=>{const r=Ym(e,t,!0),a=Fg(e,r),s=Fg(cf(a,"float32"),Wg(sg(ug(a),t,!0)));n([s]);return{value:s,gradFunc:(e,n)=>{const[r]=n,a=ug(r);return Fg(e,gf(sg(e,t,!0),a))}}}))(n)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Mg=ep({logSumExp_:function(e,t=null,n=!1){const r=Kh(e,"x","logSumExp"),a=io(t,r.shape),s=Ym(r,a,!0),i=Fg(r,s),o=ug(i),l=sg(o,a),u=Wg(l),c=pf(Hf(s,u.shape),u);if(n){const e=Qm(c.shape,a);return Hf(c,e)}return c}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Lg=ep({logicalAnd_:function(e,t){const n=Kh(e,"a","logicalAnd","bool"),r=Kh(t,"b","logicalAnd","bool");Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(mu,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Bg=ep({logicalNot_:function(e){const t={x:Kh(e,"x","logicalNot","bool")};return zh.runKernel(gu,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Pg=ep({logicalOr_:function(e,t){const n=Kh(e,"a","logicalOr","bool"),r=Kh(t,"b","logicalOr","bool");Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(yu,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zg=ep({logicalXor_:function(e,t){const n=Kh(e,"a","logicalXor","bool"),r=Kh(t,"b","logicalXor","bool");return Om(n.shape,r.shape),Lg(Pg(e,t),Bg(Lg(e,t)))}}),Gg=2147483648;
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Vg=ep({searchSorted_:function(e,t,n="left"){const r=Kh(e,"sortedSequence","searchSorted"),a=Kh(t,"values","searchSorted"),s=r.shape[r.shape.length-1],i=a.shape[a.shape.length-1],o=Hf(r,[-1,s]),l=Hf(a,[-1,i]);if(o.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(o.shape[0]!==l.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(Ji(l.shape)>=Gg)throw new Error("values tensor size must less than 2147483648");if(o.shape[1]>=Gg)throw new Error(`trailing dim_size must less than 2147483648 for int32 output type, was ${o.shape[1]}`);const u={sortedSequence:o,values:l},c={side:n};return zh.runKernel(dc,u,c)}});
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Ug(e,t){return Vg(e,t,"left")}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Hg=ep({maxPool_:function(e,t,n,r,a){const s=Kh(e,"x","maxPool");let i=s,o=!1;3===s.rank&&(o=!0,i=Hf(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Xi(4===i.rank,(()=>`Error in maxPool: input must be rank 4 but got rank ${i.rank}.`)),Xi(zf(n,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`)),Uf("maxPool",r,a);const l={x:i},u={filterSize:t,strides:n,pad:r,dimRoundingMode:a},c=zh.runKernel(wu,l,u);return o?Hf(c,[c.shape[1],c.shape[2],c.shape[3]]):c}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jg=ep({maxPool3d_:function(e,t=[1,1,1],n,r,a,s="NDHWC"){const i=Kh(e,"x","maxPool3d");let o=i,l=!1;4===i.rank&&(l=!0,o=Hf(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Xi(5===o.rank,(()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`)),Xi("NDHWC"===s,(()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`)),Uf("maxPool3d",r,a);const u={x:o},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:s},d=zh.runKernel(Cu,u,c);return l?Hf(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const qg=ep({maxPoolWithArgmax_:function(e,t,n,r,a=!1){const s={x:Kh(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:r,includeBatchInIndex:a},o=zh.runKernel(Wu,s,i);return{result:o[0],indexes:o[1]}}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Qg=ep({maximum_:function(e,t){let n=Kh(e,"a","maximum"),r=Kh(t,"b","maximum");[n,r]=Rh(n,r),"bool"===n.dtype&&(n=cf(n,"int32"),r=cf(r,"int32")),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(ku,a)}});
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Xg=ep({mean_:function(e,t=null,n=!1){const r={x:Kh(e,"x","mean")},a={axis:t,keepDims:n};return zh.runKernel(_u,r,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Zg(e,t="float32"){if(To(e),"complex64"===t){const t=Zg(e,"float32"),n=Zg(e,"float32");return tp(t,n)}const n=Wo(Ji(e),t);return zh.makeTensor(n,e,t)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Kg(e,t="float32"){if(To(e),"complex64"===t){const t=Kg(e,"float32"),n=Zg(e,"float32");return tp(t,n)}const n=Io(Ji(e),t);return zh.makeTensor(n,e,t)}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Jg(e,t,{indexing:n="xy"}={}){if("xy"!==n&&"ij"!==n)throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(void 0===e)return[];let r=Kh(e,"x","meshgrid",e instanceof fh?e.dtype:"float32");if(void 0===t)return[r];let a=Kh(t,"y","meshgrid",t instanceof fh?t.dtype:"float32");const s=Ji(r.shape),i=Ji(a.shape);return"xy"===n?(r=Hf(r,[1,-1]),a=Hf(a,[-1,1]),[Xf(Kg([i,1],r.dtype),r),Xf(a,Kg([1,s],a.dtype))]):(r=Hf(r,[-1,1]),a=Hf(a,[1,-1]),[Xf(r,Kg([1,i],r.dtype)),Xf(Kg([s,1],a.dtype),a)])}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Yg=ep({minimum_:function(e,t){let n=Kh(e,"a","minimum"),r=Kh(t,"b","minimum");[n,r]=Rh(n,r),"bool"===n.dtype&&(n=cf(n,"int32"),r=cf(r,"int32")),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(Nu,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ey=ep({mirrorPad_:function(e,t,n){Xi("reflect"===n||"symmetric"===n,(()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`));const r=Kh(e,"x","mirrorPad");if(0===r.rank)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");Xi(t.length===r.rank,(()=>`Padding doesn't match input. Must be ${r.rank}. Got ${t.length}.`));const a="reflect"===n?1:0;for(let o=0;o<r.rank;o++)Xi(2===t[o].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),Xi(t[o][0]>=0&&t[o][0]<=r.shape[o]-a&&t[o][1]>=0&&t[o][1]<=r.shape[o]-a,(()=>`Padding in dimension ${o} cannot be greater than or equal to ${r.shape[o]-a} or less than 0 for input of shape ${r.shape}`));const s={paddings:t,mode:n},i={x:r};return zh.runKernel(Eu,i,s)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ty=ep({mod_:function(e,t){let n=Kh(e,"a","mod"),r=Kh(t,"b","mod");[n,r]=Rh(n,r);const a={a:n,b:r};return zh.runKernel(Ru,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ny=ep({moments_:function(e,t=null,n=!1){const r=io(t,(e=Kh(e,"x","moments")).shape),a=Xg(e,r,n);let s=a.shape;n||(s=Qm(a.shape,r));const i=ag(Fg(cf(e,"float32"),Hf(a,s)));return{mean:a,variance:Xg(i,r,n)}}});const ry=ep({multiRNNCell_:function(e,t,n,r){const a=Kh(t,"data","multiRNNCell"),s=Jh(n,"c","multiRNNCell"),i=Jh(r,"h","multiRNNCell");let o=a;const l=[];for(let d=0;d<e.length;d++){const t=e[d](o,s[d],i[d]);l.push(t[0]),l.push(t[1]),o=t[1]}const u=[],c=[];for(let d=0;d<l.length;d+=2)u.push(l[d]),c.push(l[d+1]);return[u,c]}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ay=ep({multinomial_:function(e,t,n,r=!1){const a=Kh(e,"logits","multinomial"),s=a.size,i=a.rank;if(s<2)throw new Error(`Error in multinomial: you need at least 2 outcomes, but got ${s}.`);if(i>2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${i}`);n=n||Math.random();const o={logits:1===i?Hf(a,[1,-1]):a},l={numSamples:t,seed:n,normalized:r},u=zh.runKernel($u,o,l);return 1===i?Hf(u,[u.size]):u}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sy=ep({notEqual_:function(e,t){let n=Kh(e,"a","notEqual","string_or_numeric"),r=Kh(t,"b","notEqual","string_or_numeric");[n,r]=Rh(n,r),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(Du,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const iy=ep({oneHot_:function(e,t,n=1,r=0,a="int32"){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);const s={indices:Kh(e,"indices","oneHot","int32")},i={dtype:a,depth:t,onValue:n,offValue:r};return zh.runKernel(zu,s,i)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const oy=ep({onesLike_:function(e){const t={x:Kh(e,"x","onesLike")};return zh.runKernel(Pu,t)}});const ly=ep({outerProduct_:function(e,t){const n=Kh(e,"v1","outerProduct"),r=Kh(t,"v2","outerProduct");Xi(1===n.rank&&1===r.rank,(()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${r.rank}.`));const a=Hf(n,[-1,1]),s=Hf(r,[1,-1]);return Xf(a,s)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uy=ep({pad_:function(e,t,n=0){const r=Kh(e,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const a={paddings:t,constantValue:n},s={x:r};return zh.runKernel(Vu,s,a)}});const cy=ep({pad1d_:function(e,t,n=0){return Xi(2===t.length,(()=>"Invalid number of paddings. Must be length of 2.")),uy(e,[t],n)}});const dy=ep({pad2d_:function(e,t,n=0){return Xi(2===t.length&&2===t[0].length&&2===t[1].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),uy(e,t,n)}});const hy=ep({pad3d_:function(e,t,n=0){return Xi(3===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),uy(e,t,n)}});const py=ep({pad4d_:function(e,t,n=0){return Xi(4===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length&&2===t[3].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),uy(e,t,n)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const fy=ep({spaceToBatchND_:function(e,t,n){const r=Kh(e,"x","spaceToBatchND");Xi(r.rank>=1+t.length,(()=>`input rank ${r.rank} should be > than [blockShape] ${t.length}`)),Xi(n.length===t.length,(()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`)),Xi(r.shape.reduce(((e,r,a)=>a>0&&a<=t.length?e&&(r+n[a-1][0]+n[a-1][1])%t[a-1]==0:e),!0),(()=>`input spatial dimensions ${r.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`));const a={x:r},s={blockShape:t,paddings:n};return zh.runKernel(kc,a,s)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const my=ep({pool_:function(e,t,n,r,a,s,i){null==a&&(a=[1,1]),null==s&&(s=1),0===r&&(r="valid");const o=Kh(e,"x","maxPool");let l=o,u=!1;3===o.rank&&(u=!0,l=Hf(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Xi(zf(s,a),(()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${a}'`));const c=Ef(l.shape,t,s,a,r),d=[c.dilationHeight,c.dilationWidth];let h;h="same"===r?function(e,t){const n=e.map(((e,n)=>e+(e-1)*(t[n]-1))),r=n.map((e=>e-1)),a=r.map((e=>Math.floor(e/2))),s=r.map(((e,t)=>e-a[t]));return r.map(((e,t)=>[a[t],s[t]]))}([c.filterHeight,c.filterWidth],d):[[0,0],[0,0]];const p=1===d[0]&&1===d[1],[f,m]=function(e,t,n){const r=n.map((e=>e[0])),a=n.map((e=>e[1])),s=e.concat(r,a),i=t.map(((e,t)=>(e-s[t]%e)%e)),o=a.map(((e,t)=>e+i[t])),l=t.map(((e,t)=>[r[t],o[t]])),u=t.map(((e,t)=>[0,i[t]]));return[l,u]}([c.inHeight,c.inWidth],d,h),g=p?r:"valid",y=p?l:fy(l,d,f),b=("avg"===n?()=>jf(y,t,s,g,i):()=>Hg(y,t,s,g,i))(),v=p?b:em(b,d,m);return u?Hf(v,[v.shape[1],v.shape[2],v.shape[3]]):v}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gy=ep({prelu_:function(e,t){const n={x:Kh(e,"x","prelu"),alpha:Kh(t,"alpha","prelu")};return zh.runKernel(Hu,n)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yy=ep({prod_:function(e,t=null,n=!1){let r=Kh(e,"x","prod");"bool"===r.dtype&&(r=cf(r,"int32"));const a={x:r},s={axis:t,keepDims:n};return zh.runKernel(ju,a,s)}});
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const by=ep({raggedGather_:function(e,t,n,r){const a={paramsNestedSplits:e.map(((e,t)=>Kh(e,`tensors${t}`,"raggedGather","int32"))),paramsDenseValues:Kh(t,"paramsDenseValues","raggedGather"),indices:Kh(n,"indices","raggedGather","int32")},s={outputRaggedRank:r},i=zh.runKernel(qu,a,s);return{outputNestedSplits:i.slice(0,i.length-1),outputDenseValues:i[i.length-1]}}});
/**
 * @license
 * Copyright 2022 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vy=ep({raggedRange_:function(e,t,n){const r=Kh(e,"starts","raggedRange"),a={starts:r,limits:Kh(t,"limits","raggedRange",r.dtype),deltas:Kh(n,"deltas","raggedRange",r.dtype)},s=zh.runKernel(Qu,a);return{rtNestedSplits:s[0],rtDenseValues:s[1]}}});
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ay=ep({raggedTensorToTensor_:function(e,t,n,r,a){const s=Kh(e,"shape","raggedTensorToTensor","int32"),i=Kh(t,"values","raggedTensorToTensor"),o={shape:s,values:i,defaultValue:Kh(n,"defaultValue","raggedTensorToTensor",i.dtype),rowPartitionTensors:r.map(((e,t)=>Kh(e,`tensors${t}`,"raggedTensorToTensor","int32")))},l={rowPartitionTypes:a};return zh.runKernel(Xu,o,l)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xy=ep({rand_:function(e,t,n){To(e);const r=Ji(e);let a=null;if(null==n||"float32"===n)a=new Float32Array(r);else if("int32"===n)a=new Int32Array(r);else{if("bool"!==n)throw new Error(`Unknown data type ${n}`);a=new Uint8Array(r)}for(let s=0;s<r;s++)a[s]=t();return zh.makeTensor(a,e,n)}});var ky={exports:{}};!function(e,t){function n(e){var t=this,n=function(){var e=4022871197,t=function(t){t=String(t);for(var n=0;n<t.length;n++){var r=.02519603282416938*(e+=t.charCodeAt(n));r-=e=r>>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)};return t}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function r(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function a(e,t){var a=new n(e),s=t&&t.state,i=a.next;return i.int32=function(){return 4294967296*a.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,s&&("object"==typeof s&&r(s,a),i.state=function(){return r(a,{})}),i}t&&t.exports?t.exports=a:this.alea=a}(0,ky);var wy=ky.exports,Sy={exports:{}};!function(e,t){function n(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),t.next()}function r(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function a(e,t){var a=new n(e),s=t&&t.state,i=function(){return(a.next()>>>0)/4294967296};return i.double=function(){do{var e=((a.next()>>>11)+(a.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=a.next,i.quick=i,s&&("object"==typeof s&&r(s,a),i.state=function(){return r(a,{})}),i}t&&t.exports?t.exports=a:this.xor128=a}(0,Sy);var Cy=Sy.exports,Iy={exports:{}};!function(e,t){function n(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function r(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function a(e,t){var a=new n(e),s=t&&t.state,i=function(){return(a.next()>>>0)/4294967296};return i.double=function(){do{var e=((a.next()>>>11)+(a.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=a.next,i.quick=i,s&&("object"==typeof s&&r(s,a),i.state=function(){return r(a,{})}),i}t&&t.exports?t.exports=a:this.xorwow=a}(0,Iy);var Wy=Iy.exports,_y={exports:{}};!function(e,t){function n(e){var t=this;t.next=function(){var e,n,r=t.x,a=t.i;return e=r[a],n=(e^=e>>>7)^e<<24,n^=(e=r[a+1&7])^e>>>10,n^=(e=r[a+3&7])^e>>>3,n^=(e=r[a+4&7])^e<<7,e=r[a+7&7],n^=(e^=e<<13)^e<<9,r[a]=n,t.i=a+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n<t.length;++n)r[7&n]=r[7&n]<<15^t.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],e.x=r,e.i=0,n=256;n>0;--n)e.next()}(t,e)}function r(e,t){return t.x=e.x.slice(),t.i=e.i,t}function a(e,t){null==e&&(e=+new Date);var a=new n(e),s=t&&t.state,i=function(){return(a.next()>>>0)/4294967296};return i.double=function(){do{var e=((a.next()>>>11)+(a.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=a.next,i.quick=i,s&&(s.x&&r(s,a),i.state=function(){return r(a,{})}),i}t&&t.exports?t.exports=a:this.xorshift7=a}(0,_y);var Ty=_y.exports,Ny={exports:{}};!function(e,t){function n(e){var t=this;t.next=function(){var e,n,r=t.w,a=t.X,s=t.i;return t.w=r=r+1640531527|0,n=a[s+34&127],e=a[s=s+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[s]=n^e,t.i=s,n+(r^r>>>16)|0},function(e,t){var n,r,a,s,i,o=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),a=0,s=-32;s<l;++s)t&&(r^=t.charCodeAt((s+32)%t.length)),0===s&&(i=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,s>=0&&(i=i+1640531527|0,a=0==(n=o[127&s]^=r+i)?a+1:0);for(a>=128&&(o[127&(t&&t.length||0)]=-1),a=127,s=512;s>0;--s)r=o[a+34&127],n=o[a=a+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,o[a]=r^n;e.w=i,e.X=o,e.i=a}(t,e)}function r(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function a(e,t){null==e&&(e=+new Date);var a=new n(e),s=t&&t.state,i=function(){return(a.next()>>>0)/4294967296};return i.double=function(){do{var e=((a.next()>>>11)+(a.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=a.next,i.quick=i,s&&(s.X&&r(s,a),i.state=function(){return r(a,{})}),i}t&&t.exports?t.exports=a:this.xor4096=a}(0,Ny);var Ey=Ny.exports,Ry={exports:{}};!function(e,t){function n(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r<n.length+20;r++)t.b^=0|n.charCodeAt(r),t.next()}function r(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function a(e,t){var a=new n(e),s=t&&t.state,i=function(){return(a.next()>>>0)/4294967296};return i.double=function(){do{var e=((a.next()>>>11)+(a.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=a.next,i.quick=i,s&&("object"==typeof s&&r(s,a),i.state=function(){return r(a,{})}),i}t&&t.exports?t.exports=a:this.tychei=a}(0,Ry);var $y,Oy=Ry.exports,Fy={exports:{}};$y=Fy,function(e,t,n){var r,a=256,s="random",i=n.pow(a,6),o=n.pow(2,52),l=2*o,u=255;function c(u,c,g){var y=[],b=f(p((c=1==c?{entropy:!0}:c||{}).entropy?[u,m(t)]:null==u?function(){try{var n;return r&&(n=r.randomBytes)?n=n(a):(n=new Uint8Array(a),(e.crypto||e.msCrypto).getRandomValues(n)),m(n)}catch(gQ){var s=e.navigator,i=s&&s.plugins;return[+new Date,e,i,e.screen,m(t)]}}():u,3),y),v=new d(y),A=function(){for(var e=v.g(6),t=i,n=0;e<o;)e=(e+n)*a,t*=a,n=v.g(1);for(;e>=l;)e/=2,t/=2,n>>>=1;return(e+n)/t};return A.int32=function(){return 0|v.g(4)},A.quick=function(){return v.g(4)/4294967296},A.double=A,f(m(v.S),t),(c.pass||g||function(e,t,r,a){return a&&(a.S&&h(a,v),e.state=function(){return h(v,{})}),r?(n[s]=e,t):e})(A,b,"global"in c?c.global:this==n,c.state)}function d(e){var t,n=e.length,r=this,s=0,i=r.i=r.j=0,o=r.S=[];for(n||(e=[n++]);s<a;)o[s]=s++;for(s=0;s<a;s++)o[s]=o[i=u&i+e[s%n]+(t=o[s])],o[i]=t;(r.g=function(e){for(var t,n=0,s=r.i,i=r.j,o=r.S;e--;)t=o[s=u&s+1],n=n*a+o[u&(o[s]=o[i=u&i+t])+(o[i]=t)];return r.i=s,r.j=i,n})(a)}function h(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function p(e,t){var n,r=[],a=typeof e;if(t&&"object"==a)for(n in e)try{r.push(p(e[n],t-1))}catch(gQ){}return r.length?r:"string"==a?e:e+"\0"}function f(e,t){for(var n,r=e+"",a=0;a<r.length;)t[u&a]=u&(n^=19*t[u&a])+r.charCodeAt(a++);return m(t)}function m(e){return String.fromCharCode.apply(0,e)}if(f(n.random(),t),$y.exports){$y.exports=c;try{r=R}catch(g){}}else n["seed"+s]=c}("undefined"!=typeof self?self:Be,[],Math);var Dy=wy,My=Cy,Ly=Wy,By=Ty,Py=Ey,zy=Oy,Gy=Fy.exports;Gy.alea=Dy,Gy.xor128=My,Gy.xorwow=Ly,Gy.xorshift7=By,Gy.xor4096=Py,Gy.tychei=zy;var Vy=Gy;
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Uy(){return 32===zh.backend.floatPrecision()?.001:.1}function Hy(e,t,n){let r=!0;if((eh(e)||eh(t))&&(r=!1),eh(e)&&eh(t)&&(r=!0),r){const n=e.constructor.name,r=t.constructor.name;if(n!==r)throw new Error(`Arrays are of different type. Actual: ${n}. Expected: ${r}`)}if(Array.isArray(e)&&Array.isArray(t)){const n=Qh(e),r=Qh(t);if(!eo(n,r))throw new Error(`Arrays have different shapes. Actual: [${n}]. Expected: [${r}]`)}const a=eh(e)?e:th(e),s=eh(t)?t:th(t);if(a.length!==s.length)throw new Error(`Arrays have different lengths actual: ${a.length} vs expected: ${s.length}.\nActual:   ${a}.\nExpected: ${s}.`);for(let i=0;i<s.length;++i){const e=a[i],t=s[i];if(!n(e,t))throw new Error(`Arrays differ: actual[${i}] = ${e}, expected[${i}] = ${t}.\nActual:   ${a}.\nExpected: ${s}.`)}"undefined"!=typeof expect&&expect().nothing()}function jy(e,t,n){return!isFinite(e)&&!isFinite(t)||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}const qy=Object.freeze(Object.defineProperty({__proto__:null,TEST_EPSILON_FLOAT16:.1,createVideoElement:function(e){const t=document.createElement("video");return"playsInline"in t&&(t.playsInline=!0),t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0px",t.style.top="0px",t.preload="auto",t.appendChild(e),new Promise((e=>{t.addEventListener("loadeddata",(n=>e(t))),t.load()}))},encodeStrings:function e(t){for(let n=0;n<t.length;n++){const r=t[n];Array.isArray(r)?e(r):t[n]=Jd(r)}return t},expectArrayBuffersEqual:function(e,t){const n=new Float32Array(e),r=new Float32Array(t);if(n.length!==r.length)throw new Error(`Expected ArrayBuffer to be of length ${r.length}, but it was ${n.length}`);for(let a=0;a<r.length;a++)if(n[a]!==r[a])throw new Error(`Expected ArrayBuffer value at ${a} to be ${r[a]} but got ${n[a]} instead`)},expectArraysClose:function(e,t,n){return null==n&&(n=Uy()),Hy(e,t,((e,t)=>jy(e,t,n)))},expectArraysEqual:function(e,t){const n="string"==typeof t||"number"==typeof t||"boolean"==typeof t?[t]:t;return go(e)||go(e[0])||go(t)||go(t[0])?Hy(e,n,((e,t)=>e==t)):Hy(e,t,((e,t)=>jy(e,t,0)))},expectNumbersClose:function(e,t,n){if(null==n&&(n=Uy()),!jy(e,t,n))throw new Error(`Numbers differ: actual === ${e}, expected === ${t}`);"undefined"!=typeof expect&&expect().nothing()},expectPromiseToFail:function(e,t){e().then((()=>t.fail()),(()=>t())),"undefined"!=typeof expect&&expect().nothing()},expectValuesInRange:function(e,t,n){for(let r=0;r<e.length;r++)if(e[r]<t||e[r]>n)throw new Error(`Value out of range:${e[r]} low: ${t}, high: ${n}`)},play:async function(e){await e.play(),"requestVideoFrameCallback"in e&&await new Promise((t=>{e.requestVideoFrameCallback(t)}))},testEpsilon:Uy},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class Qy{constructor(e,t,n,r,a){this.mean=e,this.stdDev=t,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);const s=a||Math.random();this.random=Vy.alea(s.toString())}nextValue(){if(!isNaN(this.nextVal)){const e=this.nextVal;return this.nextVal=NaN,e}let e,t,n=!1;for(;!n;){let r,a,s;do{r=2*this.random()-1,a=2*this.random()-1,s=r*r+a*a}while(s>=1||0===s);const i=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*r*i,t=this.mean+this.stdDev*a*i,this.truncated&&!this.isValidTruncated(e)||(n=!0)}return this.truncated&&!this.isValidTruncated(t)||(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class Xy{constructor(e,t,n,r){this.alpha=e,this.beta=1/t,this.dtype=n;const a=r||Math.random();this.randu=Vy.alea(a.toString()),this.randn=new Qy(0,1,n,!1,this.randu()),this.d=e<1?e+2/3:e-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let e,t,n,r,a,s;for(;;){do{r=this.randn.nextValue(),s=1+this.c*r}while(s<=0);if(s*=s*s,e=r*r,t=1-.331*e*e,n=.5*e+this.d*(1-s+Math.log(s)),a=this.randu(),a<t||Math.log(a)<n)break}return s=1/this.beta*this.d*s,this.alpha<1&&(s*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(s)}convertValue(e){return"float32"===this.dtype?e:Math.round(e)}}class Zy{constructor(e=0,t=1,n,r){if(this.canReturnFloat=()=>null==this.dtype||"float32"===this.dtype,this.min=e,this.range=t-e,this.dtype=n,null==r&&(r=Math.random()),"number"==typeof r&&(r=r.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=Vy.alea(r)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ky=ep({randomGamma_:function(e,t,n=1,r="float32",a){if(To(e),null==n&&(n=1),null==r&&(r="float32"),"float32"!==r&&"int32"!==r)throw new Error(`Unsupported data type ${r}`);const s=new Xy(t,n,r,a),i=uf(e,r);for(let o=0;o<i.values.length;o++)i.values[o]=s.nextValue();return i.toTensor()}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Jy=ep({randomNormal_:function(e,t=0,n=1,r,a){if(To(e),null!=r&&"bool"===r)throw new Error(`Unsupported data type ${r}`);const s=new Qy(t,n,r,!1,a),i=uf(e,r);for(let o=0;o<i.values.length;o++)i.values[o]=s.nextValue();return i.toTensor()}});
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Yy=ep({randomStandardNormal_:function(e,t,n){if(null!=t&&"bool"===t)throw new Error(`Unsupported data type ${t}`);return Jy(e,0,1,t,n)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const eb=ep({randomUniform_:function(e,t=0,n=1,r="float32",a){To(e);const s=uf(e,r),i=new Zy(t,n,null,a);for(let o=0;o<s.values.length;o++)s.values[o]=i.nextValue();return s.toTensor()}});
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tb=ep({randomUniformInt_:function(e,t,n,r){return eb(e,t,n,"int32",r)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function nb(e,t,n=1,r="float32"){if(0===n)throw new Error("Cannot have a step of zero");const a={start:e,stop:t,step:n,dtype:r};return zh.runKernel(Zu,{},a)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const rb=ep({real_:function(e){const t={input:Kh(e,"input","real")};return zh.runKernel(Ku,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ab=ep({reciprocal_:function(e){const t={x:Kh(e,"x","reciprocal")};return zh.runKernel(Ju,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sb=ep({relu_:function(e){const t={x:Kh(e,"x","relu")};return zh.runKernel(Yu,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ib=ep({relu6_:function(e){const t={x:Kh(e,"x","relu6")};return zh.runKernel(sc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ob=ep({reverse_:function(e,t){const n={x:Kh(e,"x","reverse")},r={dims:t};return zh.runKernel(ic,n,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lb=ep({reverse1d_:function(e){const t=Kh(e,"x","reverse");return Xi(1===t.rank,(()=>`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`)),ob(t,0)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ub=ep({reverse2d_:function(e,t){const n=Kh(e,"x","reverse");return Xi(2===n.rank,(()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`)),ob(n,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const cb=ep({reverse3d_:function(e,t){const n=Kh(e,"x","reverse");return Xi(3===n.rank,(()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`)),ob(n,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const db=ep({reverse4d_:function(e,t){const n=Kh(e,"x","reverse");return Xi(4===n.rank,(()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`)),ob(n,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const hb=ep({round_:function(e){const t={x:Kh(e,"x","round")};return zh.runKernel(oc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const pb=ep({rsqrt_:function(e){const t={x:Kh(e,"x","rsqrt","float32")};return zh.runKernel(lc,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const fb=ep({selu_:function(e){const t={x:Kh(e,"x","selu")};return zh.runKernel(pc,t)}});const mb=ep({separableConv2d_:function(e,t,n,r,a,s=[1,1],i="NHWC"){const o=Kh(e,"x","separableConv2d"),l=Kh(t,"depthwiseFilter","separableConv2d"),u=Kh(n,"pointwiseFilter","separableConv2d");let c=o,d=!1;if(3===o.rank&&(d=!0,c=Hf(o,[1,o.shape[0],o.shape[1],o.shape[2]])),"NCHW"===i)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");Xi(4===c.rank,(()=>`Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`)),Xi(4===l.rank,(()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`)),Xi(4===u.rank,(()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`)),Xi(1===u.shape[0],(()=>`Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got ${u.shape[0]}.`)),Xi(1===u.shape[1],(()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${u.shape[1]}.`));const h=l.shape[2],p=l.shape[3];Xi(u.shape[2]===h*p,(()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${h*p}, but got ${u.shape[2]}.`));const f=Tm(c,l,r,a,i,s),m=gm(f,u,1,"valid",i);return d?Hf(m,[m.shape[1],m.shape[2],m.shape[3]]):m}});
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gb=async function(e,t){const n=Kh(e,"x","setdiff1d"),r=Kh(t,"y","setdiff1d");Xi(n.dtype===r.dtype,(()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${r.dtype}).`)),Xi(1===n.rank,(()=>`x should be 1D tensor, but got x (${n.shape}).`)),Xi(1===r.rank,(()=>`y should be 1D tensor, but got y (${r.shape}).`));const a=await n.data(),s=await r.data(),i=new Set(s);let o=0;for(let c=0;c<a.length;c++)i.has(a[c])||o++;const l=new dh([o],n.dtype),u=new dh([o],"int32");for(let c=0,d=0;c<a.length;c++)i.has(a[c])||(l.values[d]=a[c],u.values[d]=c,d++);return[l.toTensor(),u.toTensor()]};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yb=ep({sign_:function(e){const t={x:Kh(e,"x","sign")};return zh.runKernel(yc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bb=ep({sin_:function(e){const t={x:Kh(e,"x","sin","float32")};return zh.runKernel(mc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vb=ep({sinh_:function(e){const t={x:Kh(e,"x","sinh")};return zh.runKernel(gc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ab=ep({slice1d_:function(e,t,n){const r=Kh(e,"x","slice1d");return Xi(1===r.rank,(()=>`slice1d expects a rank-1 tensor, but got a rank-${r.rank} tensor`)),Kf(r,[t],[n])}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xb=ep({slice2d_:function(e,t,n){const r=Kh(e,"x","slice2d");return Xi(2===r.rank,(()=>`slice2d expects a rank-2 tensor, but got a rank-${r.rank} tensor`)),Kf(r,t,n)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kb=ep({slice3d_:function(e,t,n){const r=Kh(e,"x","slice3d");return Xi(3===r.rank,(()=>`slice3d expects a rank-3 tensor, but got a rank-${r.rank} tensor`)),Kf(r,t,n)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wb=ep({slice4d_:function(e,t,n){const r=Kh(e,"x","slice4d");return Xi(4===r.rank,(()=>`slice4d expects a rank-4 tensor, but got a rank-${r.rank} tensor`)),Kf(r,t,n)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Sb=ep({softmax_:function(e,t=-1){const n=Kh(e,"logits","softmax","float32");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and dim was ${t}`);const r={logits:n},a={dim:t};return zh.runKernel(Sc,r,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Cb=ep({fft_:function(e){Xi("complex64"===e.dtype,(()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`));const t={input:e};return zh.runKernel(ql,t)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ib=ep({ifft_:function(e){Xi("complex64"===e.dtype,(()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`));const t={input:e};return zh.runKernel(au,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Wb=ep({irfft_:function(e){const t=e.shape[e.shape.length-1],n=e.size/t;let r;if(t<=2){const a=Hf(e,[n,t]);r=Ib(a)}else{const a=[n,2*(t-1)],s=Hf(rb(e),[n,t]),i=Hf(bg(e),[n,t]),o=ob(Kf(s,[0,1],[n,t-2]),1),l=gf(ob(Kf(i,[0,1],[n,t-2]),1),ng(-1)),u=Qf([s,o],1),c=Qf([i,l],1),d=Hf(tp(u,c),[a[0],a[1]]);r=Ib(d)}if(r=rb(r),3===e.rank&&0!==e.shape[0]){const t=r,n=e.shape[0];r=Hf(r,[n,r.shape[0]/n,r.shape[1]]),t.dispose()}return r}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _b=ep({split_:function(e,t,n=0){const r={x:Kh(e,"x","split")},a={numOrSizeSplits:t,axis:n};return zh.runKernel(wc,r,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Tb=ep({rfft_:function(e,t){Xi("float32"===e.dtype,(()=>`The dtype for rfft() must be real value but got ${e.dtype}`));let n=e.shape[e.shape.length-1];const r=e.size/n;let a;if(null!=t&&t<n){const r=e.shape.map((e=>0)),s=e.shape.map((e=>e));s[e.shape.length-1]=t,a=Kf(e,r,s),n=t}else if(null!=t&&t>n){const r=e.shape.map((e=>e));r[e.shape.length-1]=t-n,a=Qf([e,Zg(r)],e.shape.length-1),n=t}else a=e;const s=Lm(a),i=Hf(tp(a,s),[r,n]),o=Cb(i),l=Math.floor(n/2)+1,u=rb(o),c=bg(o),d=_b(u,[l,n-l],u.shape.length-1),h=_b(c,[l,n-l],c.shape.length-1),p=a.shape.slice();return p[a.shape.length-1]=l,Hf(tp(d[0],h[0]),p)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Nb=ep({squaredDifference_:function(e,t){let n=Kh(e,"a","squaredDifference"),r=Kh(t,"b","squaredDifference");[n,r]=Rh(n,r),Om(n.shape,r.shape);const a={a:n,b:r};return zh.runKernel(Nc,a,{})}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Eb=ep({squeeze_:function(e,t){const n=Kh(e,"x","squeeze","string_or_numeric");return Hf(n,oo(n.shape,t).newShape)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Rb=ep({stack_:function(e,t=0){const n=Jh(e,"tensors","stack","string_or_numeric");Xi(n.length>=1,(()=>"Pass at least one tensor to tf.stack")),n.length>0&&Xi(t<=n[0].rank,(()=>"Axis must be <= rank of the tensor"));const r=n,a={axis:t};return zh.runKernel(Gu,r,a)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $b=ep({step_:function(e,t=0){const n={x:Kh(e,"x","step")},r={alpha:t};return zh.runKernel(Qc,n,r)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ob=ep({stridedSlice_:function(e,t,n,r,a=0,s=0,i=0,o=0,l=0){const u={x:Kh(e,"x","stridedSlice","string_or_numeric")},c={begin:t,end:n,strides:r,beginMask:a,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};return zh.runKernel($c,u,c)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Fb=ep({tan_:function(e){const t={x:Kh(e,"x","tan","float32")};return zh.runKernel(Lc,t)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Db(e,t){Ki(e);const n=Qh(e,t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return np(e,null,n,t)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Mb(e,t,n){if(Ki(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");const r=Qh(e,n);if(2!==r.length&&1!==r.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return np(e,t,r,n)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Lb(e,t,n){if(Ki(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");const r=Qh(e,n);if(3!==r.length&&1!==r.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return np(e,t,r,n)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Bb(e,t,n){if(Ki(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");const r=Qh(e,n);if(4!==r.length&&1!==r.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return np(e,t,r,n)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Pb(e,t,n){if(Ki(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");const r=Qh(e,n);if(5!==r.length&&1!==r.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return np(e,t,r,n)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function zb(e,t,n){if(Ki(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");const r=Qh(e,n);if(6!==r.length&&1!==r.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return np(e,t=t||r,r,n)}function Gb(e,t,n){const r=t.rank>1?t.shape[t.rank-1]:1,a=t.rank>1?t.rank-1:1,s=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${r}, and batchDim: ${a}.`;if(n.rank<a)throw new Error(s+` update.rank < ${a}. `);if(e.length<r+(n.rank-a))throw new Error(s+` Output shape length < ${r+(n.rank-a)}`);if(n.rank!==a+e.length-r)throw new Error(s+" update.rank != "+(a+e.length-r));for(let i=0;i<a;++i)if(n.shape[i]!==t.shape[i])throw new Error(s+` updates.shape[${i}] (${n.shape[i]}) != indices.shape[${i}] (${t.shape[i]}).`);for(let i=0;i<n.rank-a;++i)if(n.shape[i+a]!==e[i+r])throw new Error(s+` updates.shape[${i+a}] (${n.shape[i+a]}) != shape[${i+a}] (${e[i+a]})`)}function Vb(e,t,n){if(t.rank<1)throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);if(e.rank<1)throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);if("int32"!==t.dtype)throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);if(n.length<1)throw new Error(`Output rank must be greater or equal to 1, but got shape: ${n}`);if(0===n.length){if(0===t.size)throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);if(0===e.size)throw new Error(`Updates specified for empty output. updates shape: ${e.shape}`)}Gb(n,t,e)}function Ub(e,t,n){const r=t.shape.length,a=r>1?t.shape[r-1]:1,s=n.length;let i=1;for(let l=a;l<s;++l)i*=n[l];const o=a<1?1:a;return{sliceRank:a,numUpdates:Ji(t.shape)/o,sliceSize:i,strides:[...ko(n.slice(0,a)),1],outputSize:Ji(n)}}const Hb=Object.freeze(Object.defineProperty({__proto__:null,calculateShapes:Ub,validateInput:Vb,validateUpdateShape:Gb},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jb=ep({tensorScatterUpdate_:function(e,t,n){const r=Kh(e,"tensor","tensorScatterupdate"),a=Kh(t,"indices","tensorScatterupdate","int32"),s=Kh(n,"updates","tensorScatterupdate");if(Vb(s,a,r.shape),r.dtype!==s.dtype)throw new Error(`tensor and updates must have the same dtype, instead they are ${r.dtype} and ${s.dtype}.`);const i={tensor:r,indices:a,updates:s};return zh.runKernel(cc,i,{})}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const qb=ep({topk_:function(e,t=1,n=!0){const r=Kh(e,"x","topk");if(0===r.rank)throw new Error("topk() expects the input to be of rank 1 or higher");const a=r.shape[r.shape.length-1];if(t<0)throw new Error(`'k' passed to topk() must be >= 0 but got ${t}`);if(t>a)throw new Error(`'k' passed to topk() must be <= the last dimension (${a}) but got ${t}`);const s={x:r},i={k:t,sorted:n},[o,l]=zh.runKernel(zc,s,i);return{values:o,indices:l}}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Qb=ep({truncatedNormal_:function(e,t=0,n=1,r,a){if(To(e),null!=r&&"bool"===r)throw new Error("Unsupported data type $ { dtype }");const s=new Qy(t,n,r,!0,a),i=uf(e,r);for(let o=0;o<i.values.length;o++)i.values[o]=s.nextValue();return i.toTensor()}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Xb=ep({unique_:function(e,t=0){const n=Kh(e,"x","unique","string_or_numeric");Xi(n.rank>0,(()=>"The input tensor must be at least 1D"));const r={x:n},a={axis:t},[s,i]=zh.runKernel(Uc,r,a);return{values:s,indices:i}}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Zb=ep({unsortedSegmentSum_:function(e,t,n){const r=Kh(e,"x","unsortedSegmentSum"),a=Kh(t,"segmentIds","unsortedSegmentSum","int32");Xi(to(n),(()=>"numSegments must be of dtype int"));const s={x:r,segmentIds:a},i={numSegments:n};return zh.runKernel(jc,s,i)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Kb=ep({unstack_:function(e,t=0){const n=Kh(e,"x","unstack","string_or_numeric");Xi(t>=-n.shape.length&&t<n.shape.length,(()=>`Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`));const r={value:n},a={axis:t};return zh.runKernel(Hc,r,a)}});
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Jb(e,t){return Vg(e,t,"right")}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Yb(e,t=!0,n,r){return zh.makeVariable(e,t,n,r)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ev(e,t){const n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(s);const r=uf(e,"int32"),a=uf([n.length,e.length],"int32");for(let s=0;s<n.length;s++){const t=r.indexToLoc(n[s]),i=s*e.length;a.values.set(t,i)}return a.toTensor()}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tv=async function(e){const t=Kh(e,"condition","whereAsync","bool"),n=await t.data(),r=ev(t.shape,n);return e!==t&&t.dispose(),r};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const nv=async function(e,t,n){const r=Kh(e,"tensor","boolMask"),a=Kh(t,"mask","boolMask","bool"),s=null==n?0:n,i=a.rank,o=r.shape;Xi(i>0,(()=>"mask cannot be scalar")),Zi(o.slice(s,s+i),a.shape,"mask's shape must match the first K dimensions of tensor's shape,");let l=1;for(let m=s;m<s+i;m++)l*=o[m];const u=o.slice(0,s).concat([l],o.slice(s+i)),c=Hf(r,u),d=Hf(a,[-1]),h=await tv(d),p=Eb(h,[1]),f=mg(c,p,s);return e!==r&&r.dispose(),t!==a&&a.dispose(),p.dispose(),c.dispose(),d.dispose(),h.dispose(),f};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const rv=ep({transpose_:function(e,t,n){const r=Kh(e,"x","transpose");if(null==t&&(t=r.shape.map(((e,t)=>t)).reverse()),Xi(r.rank===t.length,(()=>`Error in transpose: rank of input ${r.rank} must match length of perm ${t}.`)),t.forEach((e=>{Xi(e>=0&&e<r.rank,(()=>`All entries in 'perm' must be between 0 and ${r.rank-1} but got ${t}`))})),r.rank<=1)return r.clone();const a={x:r},s={perm:t};return"complex64"===r.dtype?lp((()=>{let e=rb(r),t=bg(r);return e=zh.runKernel(Vc,{x:e},s),t=zh.runKernel(Vc,{x:t},s),n&&(t=Rg(t)),tp(e,t)})):zh.runKernel(Vc,a,s)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const av=ep({movingAverage_:function(e,t,n,r,a=!0){const s=Kh(e,"v","movingAverage"),i=Kh(t,"x","movingAverage"),o=Kh(n,"decay","movingAverage");$h(s,i),Xi(eo(s.shape,i.shape),(()=>"Shape mismatch in v and x"));const l=ng(1),u=Fg(l,o);let c=gf(Fg(i,s),u);if(a){Xi(null!=r,(()=>"When using zeroDebias: true, step is required."));const e=Kh(r,"step","movingAverage");c=mf(c,Fg(l,tg(o,e)))}return pf(s,c)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sv=ep({scatterND_:function(e,t,n){To(n);const r=Kh(e,"indices","scatterND","int32"),a=Kh(t,"updates","scatterND");Vb(a,r,n);const s={indices:r,updates:a},i={shape:n};return zh.runKernel(uc,s,i)}});const iv=ep({sparseToDense_:
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r=0){To(n);const a=Kh(e,"sparseIndices","sparseToDense","int32"),s=Kh(t,"sparseValues","sparseToDense","string_or_numeric"),i=Kh(r,"defaultValue","sparseToDense",s.dtype);!function(e,t,n,r){if("int32"!==e.dtype)throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);const a=e.rank>0?e.shape[0]:1,s=e.rank>1?e.shape[1]:1;if(n.length!==s)throw new Error(`outputShape has incorrect number of elements:, ${n.length}, should be: ${s}.`);const i=t.size;if(0!==t.rank&&(1!==t.rank||i!==a))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${a}]`);if(t.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(a,s,n,i);const o={sparseIndices:a,sparseValues:s,defaultValue:i},l={outputShape:n};return zh.runKernel(Tc,o,l)}});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ov=ep({gatherND_:function(e,t){const n=Kh(t,"indices","gatherND","int32"),r={params:Kh(e,"x","gatherND","string_or_numeric"),indices:n};return zh.runKernel(eu,r)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lv=ep({dropout_:
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r){const a=Kh(e,"x","dropout");if(Xi("float32"===a.dtype,(()=>`x has to be a floating point tensor since it's going to be scaled, but got a ${a.dtype} tensor instead.`)),Xi(t>=0&&t<1,(()=>`rate must be a float in the range [0, 1), but got ${t}.`)),0===t)return e instanceof fh?a.clone():a;const s=function(e,t){if(null==t)return e.shape.slice();if(eo(e.shape,t))return t;if(e.shape.length===t.length){const n=[];for(let r=0;r<e.shape.length;r++)null==t[r]&&null!=e.shape[r]?n.push(e.shape[r]):n.push(t[r]);return n}return t}(a,n),i=1-t,o=mf(fg(pf(eb(s,0,1,"float32",r),i)),i);return gf(a,o)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function uv(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function cv(e,t,n){const r=1-e%2,a=new Float32Array(e);for(let s=0;s<e;++s){const i=2*Math.PI*s/(e+r-1);a[s]=t-n*Math.cos(i)}return Db(a,"float32")}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dv=async function(e,t,n=1){const r=Kh(e,"predictions","inTopK"),a=Kh(t,"targets","inTopK");Xi(r.rank>1,(()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${r.rank}`)),Xi(r.rank-1===a.rank,(()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${r.rank} and targets rank ${a.rank}`)),Zi(r.shape.slice(0,r.shape.length-1),a.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");const s=r.shape[r.shape.length-1];Xi(n>0&&n<=s,(()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${s}), but got ${n}`));const i=await r.data(),o=await a.data(),[l,u]=[i.length/s,s],c=lo("bool",l);for(let d=0;d<l;d++){const e=d*u,t=i.subarray(e,e+u),r=[];for(let n=0;n<t.length;n++)r.push({value:t[n],index:n});r.sort(((e,t)=>t.value-e.value)),c[d]=0;for(let a=0;a<n;a++)if(r[a].index===o[d]){c[d]=1;break}}return e!==r&&r.dispose(),t!==a&&a.dispose(),rp(c,a.shape,"bool")};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const hv=ep({conv2DBackpropFilter_:function(e,t,n,r,a,s="NHWC",i){let o=e;3===e.rank&&(o=Hf(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;3===l.rank&&(l=Hf(t,[1,t.shape[0],t.shape[1],t.shape[2]])),Xi(4===o.rank,(()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${o.shape}.`)),Xi(4===l.rank,(()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`)),Xi(4===n.length,(()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${n}.`));const u="NHWC"===s?o.shape[3]:o.shape[1],c="NHWC"===s?l.shape[3]:l.shape[1];Xi(u===n[2],(()=>`Error in conv2dDerFilter: depth of input ${u}) must match input depth in filter (${n[2]}.`)),Xi(c===n[3],(()=>`Error in conv2dDerFilter: depth of dy (${c}) must match output depth for filter (${n[3]}).`)),Uf("conv2dDerFilter",a,i);const d={x:o,dy:l},h={strides:r,pad:a,dataFormat:s,dimRoundingMode:i,filterShape:n};return zh.runKernel(bl,d,h)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function pv(e,t,n){if(null==n||"linear"===n)return e;if("relu"===n)return gf(e,$b(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function fv(e,t){let n=t;const r=$m(e.shape,t.shape);return r.length>0&&(n=sg(n,r)),Hf(n,e.shape)}function mv(e,t,n,r){if("linear"===t)return e;if("relu"===t)return sb(e);if("elu"===t)return Gm(e);if("relu6"===t)return ib(e);if("prelu"===t)return gy(e,n);if("leakyrelu"===t)return kg(e,r);if("sigmoid"===t)return Zf(e);throw new Error(`Unknown fused activation ${t}.`)}const gv=(e,t)=>!(e>0)||"linear"===t;
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yv=ep({fusedConv2d_:function({x:e,filter:t,strides:n,pad:r,dataFormat:a="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(l=l||"linear",!1===gv(zh.state.gradientDepth,l)){Xi("NHWC"===a,(()=>`Error in fused conv2d: got dataFormat of ${a} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`));let d=gm(e,t,n,r,a,s,i);return null!=o&&(d=pf(d,o)),mv(d,l,u,c)}const d=Kh(e,"x","conv2d","float32"),h=Kh(t,"filter","conv2d","float32");let p=d,f=!1;3===d.rank&&(f=!0,p=Hf(d,[1,d.shape[0],d.shape[1],d.shape[2]])),Xi(4===p.rank,(()=>`Error in fused conv2d: input must be rank 4, but got rank ${p.rank}.`)),Xi(4===h.rank,(()=>`Error in fused conv2d: filter must be rank 4, but got rank ${h.rank}.`)),Uf("fused conv2d",r,i);const m="NHWC"===a?p.shape[3]:p.shape[1];Xi(h.shape[2]===m,(()=>`Error in conv2d: depth of input (${m}) must match input depth for filter ${h.shape[2]}.`)),Xi(zf(n,s),(()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`));const g=$f(p.shape,h.shape,n,s,r,i);let y,b;if(null!=o&&(y=Kh(o,"bias","fused conv2d"),[y]=Rh(y,d),"NHWC"===a?Om(g.outShape,y.shape):(Xi(y.shape.length<=1,(()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${y.shape.length}.`)),Xi(0===y.shape.length||y.shape[0]===g.outChannels||1===y.shape[0],(()=>`Error in fused conv2d: bias shape (${y.shape}) is not compatible with the number of output channels (${g.outChannels})`)))),null!=u){const e=u.shape;if(Xi(e.length<=1||3===e.length,(()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${e.length}.`)),1===e.length)Xi(1===e[0]||e[0]===g.outChannels,(()=>`Error in fused conv2d: PReLU activation weights (${e}) is not compatible with the number of output channels (${g.outChannels}).`));else if(3===e.length)try{Om(e,g.outShape)}catch(gQ){const n=`Error in fused conv2d: PReLU activation weights (${e}) is not compatible with the output shape of the conv2d (${g.outShape}).`;throw Error(n)}b=Kh(u,"prelu weights","fused conv2d")}const v=(e,t)=>{Xi("NHWC"===a,(()=>`Error in gradient of fused conv2D: got dataFormat of ${a} but only NHWC is currently supported.`));const[i,o,u,c]=t,d=pv(e,u,l);Xi(Pf(s),(()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`));const h=[bm(o.shape,d,i,n,r),hv(o,d,i.shape,n,r)];if(null!=c){const e=fv(c,d);h.push(e)}return h},A={x:p,filter:h,bias:y,preluActivationWeights:b},x={strides:n,pad:r,dataFormat:a,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:c};if(null==o){return Ng(((e,t,n)=>{let r=zh.runKernel(Jc,A,x);return n([t,e,r]),f&&(r=Hf(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:v}}))(p,h)}return Ng(((e,t,n,r)=>{let a=zh.runKernel(Jc,A,x);return r([t,e,a,n]),f&&(a=Hf(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:v}}))(p,h,y)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bv=ep({depthwiseConv2dNativeBackpropFilter_:function(e,t,n,r,a,s=[1,1],i){let o=e;3===e.rank&&(o=Hf(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;3===l.rank&&(l=Hf(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const u={x:o,dy:l},c={strides:r,pad:a,dimRoundingMode:i,dilations:s,filterShape:n};return zh.runKernel(El,u,c)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vv=ep({depthwiseConv2dNativeBackpropInput_:function(e,t,n,r,a,s=[1,1],i){let o=t,l=!1;3===t.rank&&(l=!0,o=Hf(t,[1,t.shape[0],t.shape[1],t.shape[2]]));const u={dy:o,filter:n},c={strides:r,pad:a,dimRoundingMode:i,dilations:s,inputShape:e},d=zh.runKernel(Rl,u,c);return l?Hf(d,[d.shape[1],d.shape[2],d.shape[3]]):d}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Av=ep({fusedDepthwiseConv2d_:function({x:e,filter:t,strides:n,pad:r,dataFormat:a="NHWC",dilations:s=[1,1],dimRoundingMode:i,bias:o,activation:l="linear",preluActivationWeights:u,leakyreluAlpha:c}){if(!1===gv(zh.state.gradientDepth,l)){let d=Tm(e,t,n,r,a,s,i);return null!=o&&(d=pf(d,o)),mv(d,l,u,c)}const d=Kh(e,"x","depthwiseConv2d","float32"),h=Kh(t,"filter","depthwiseConv2d","float32");let p=d,f=!1;3===d.rank&&(f=!0,p=Hf(d,[1,d.shape[0],d.shape[1],d.shape[2]])),Xi(4===p.rank,(()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${p.rank}.`)),Xi(4===h.rank,(()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${h.rank}.`)),Xi(p.shape[3]===h.shape[2],(()=>`Error in fused depthwiseConv2d: number of input channels (${p.shape[3]}) must match the inChannels dimension in filter ${h.shape[2]}.`)),null==s&&(s=[1,1]),Xi(zf(n,s),(()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`)),Uf("fused depthwiseConv2d",r,i);const m=$f(p.shape,h.shape,n,s,r,i,!0);let g,y;null!=o&&(g=Kh(o,"bias","fused conv2d"),[g]=Rh(g,d),Om(m.outShape,g.shape)),null!=u&&(y=Kh(u,"prelu weights","fused depthwiseConv2d"));const b=(e,t)=>{Xi(Pf(s),(()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${s}'`));const[a,o,u,c]=t,d=pv(e,u,l),h=vv(o.shape,d,a,n,r,s,i),p=bv(o,d,a.shape,n,r,s,i);if(null!=c){return[h,p,fv(g,d)]}return[h,p]},v={x:p,filter:h,bias:g,preluActivationWeights:y},A={strides:n,pad:r,dataFormat:a,dilations:s,dimRoundingMode:i,activation:l,leakyreluAlpha:c};if(null==o){return Ng(((e,t,n)=>{let r=zh.runKernel(Yc,v,A);return n([t,e,r]),f&&(r=Hf(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:b}}))(p,h)}return Ng(((e,t,n,r)=>{let a=zh.runKernel(Yc,v,A);return r([t,e,a,n]),f&&(a=Hf(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:b}}))(p,h,g)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xv=ep({fusedMatMul_:function({a:e,b:t,transposeA:n=!1,transposeB:r=!1,bias:a,activation:s="linear",preluActivationWeights:i,leakyreluAlpha:o=.2}){if(!1===gv(zh.state.gradientDepth,s)){let l=Xf(e,t,n,r);return null!=a&&(l=pf(l,a)),mv(l,s,i,o)}let l=Kh(e,"a","fused matMul"),u=Kh(t,"b","fused matMul");[l,u]=Rh(l,u);const c=n?l.shape[l.rank-2]:l.shape[l.rank-1],d=r?u.shape[u.rank-1]:u.shape[u.rank-2],h=n?l.shape[l.rank-1]:l.shape[l.rank-2],p=r?u.shape[u.rank-2]:u.shape[u.rank-1],f=l.shape.slice(0,-2),m=u.shape.slice(0,-2),g=Ji(f),y=Ji(m);Xi(c===d,(()=>`Error in fused matMul: inner shapes (${c}) and (${d}) of Tensors with shapes ${l.shape} and ${u.shape} and transposeA=${n} and transposeB=${r} must match.`));const b=Om(l.shape.slice(0,-2),u.shape.slice(0,-2)).concat([h,p]),v=Hf(l,n?[g,c,h]:[g,h,c]),A=Hf(u,r?[y,p,d]:[y,d,p]);let x,k;null!=a&&(x=Kh(a,"bias","fused matMul"),[x]=Rh(x,l),Om(b,x.shape)),null!=i&&(k=Kh(i,"prelu weights","fused matMul"));const w=(e,t)=>{const[i,o,l,u]=t,c=pv(Hf(e,l.shape),l,s);let d,h;if(n||r?!n&&r?(d=Xf(c,o,!1,!1),h=Xf(c,i,!0,!1)):n&&!r?(d=Xf(o,c,!1,!0),h=Xf(i,c,!1,!1)):(d=Xf(o,c,!0,!0),h=Xf(c,i,!0,!0)):(d=Xf(c,o,!1,!0),h=Xf(i,c,!0,!1)),null!=a){return[d,h,fv(u,c)]}return[d,h]},S={a:v,b:A,bias:x,preluActivationWeights:k},C={transposeA:n,transposeB:r,activation:s,leakyreluAlpha:o};if(null==a){return Ng(((e,t,n)=>{const r=zh.runKernel(Kc,S,C);return n([e,t,r]),{value:Hf(r,b),gradFunc:w}}))(v,A)}return Ng(((e,t,n,r)=>{const a=zh.runKernel(Kc,S,C);return r([e,t,a,n]),{value:Hf(a,b),gradFunc:w}}))(v,A,x)}}),kv=Object.freeze(Object.defineProperty({__proto__:null,conv2d:yv,depthwiseConv2d:Av,matMul:xv},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wv=ep({hammingWindow_:
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){return cv(e,.54,.46)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Sv=ep({hannWindow_:function(e){return cv(e,.5,.5)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Cv=ep({frame_:function(e,t,n,r=!1,a=0){let s=0;const i=[];for(;s+t<=e.size;)i.push(Kf(e,s,t)),s+=n;if(r)for(;s<e.size;){const r=s+t-e.size,o=Qf([Kf(e,s,t-r),cm([r],a)]);i.push(o),s+=n}return 0===i.length?Mb([],[0,t]):Hf(Qf(i),[i.length,t])}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Iv=ep({stft_:function(e,t,n,r,a=Sv){null==r&&(r=uv(t));const s=Cv(e,t,n),i=gf(s,a(t));return Tb(i,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Wv=ep({cropAndResize_:function(e,t,n,r,a="bilinear",s=0){const i=Kh(e,"image","cropAndResize"),o=Kh(t,"boxes","cropAndResize","float32"),l=Kh(n,"boxInd","cropAndResize","int32"),u=o.shape[0];Xi(4===i.rank,(()=>`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`)),Xi(2===o.rank&&4===o.shape[1],(()=>`Error in cropAndResize: boxes must be have size [${u},4] but had shape ${o.shape}.`)),Xi(1===l.rank&&l.shape[0]===u,(()=>`Error in cropAndResize: boxInd must be have size [${u}] but had shape ${o.shape}.`)),Xi(2===r.length,(()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`)),Xi(r[0]>=1&&r[1]>=1,(()=>`cropSize must be atleast [1,1], but was ${r}`)),Xi("bilinear"===a||"nearest"===a,(()=>`method must be bilinear or nearest, but was ${a}`));const c={image:i,boxes:o,boxInd:l},d={method:a,extrapolationValue:s,cropSize:r};return zh.runKernel(Wl,c,d)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _v=ep({flipLeftRight_:function(e){const t=Kh(e,"image","flipLeftRight","float32");Xi(4===t.rank,(()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`));const n={image:t};return zh.runKernel(Xl,n,{})}});
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Tv=ep({grayscaleToRGB_:function(e){const t=Kh(e,"image","grayscaleToRGB"),n=t.rank-1,r=t.shape[n];Xi(t.rank>=2,(()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${t.rank}.`)),Xi(1===r,(()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${r}.`));const a=new Array(t.rank);return a.fill(1,0,n),a[n]=3,hg(t,a)}});
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Nv=ep({rgbToGrayscale_:function(e){const t=Kh(e,"image","RGBToGrayscale"),n=t.rank-1,r=t.shape[n];Xi(t.rank>=2,(()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${t.rank}.`)),Xi(3===r,(()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${r}.`));const a=t.dtype,s=cf(t,"float32"),i=Db([.2989,.587,.114]);let o;switch(t.rank){case 2:o=zm("ij,j->i",s,i);break;case 3:o=zm("ijk,k->ij",s,i);break;case 4:o=zm("ijkl,l->ijk",s,i);break;case 5:o=zm("ijklm,m->ijkl",s,i);break;case 6:o=zm("ijklmn,n->ijklm",s,i);break;default:throw new Error("Not a valid tensor rank.")}return o=cg(o,-1),cf(o,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ev=ep({rotateWithOffset_:function(e,t,n=0,r=.5){const a=Kh(e,"image","rotateWithOffset","float32");Xi(4===a.rank,(()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${a.rank}.`));const s={image:a},i={radians:t,fillValue:n,center:r};return zh.runKernel(Zc,s,i)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Rv(e,t,n,r,a,s){null==r&&(r=.5),null==a&&(a=Number.NEGATIVE_INFINITY),null==s&&(s=0);const i=e.shape[0];return n=Math.min(n,i),Xi(0<=r&&r<=1,(()=>`iouThreshold must be in [0, 1], but was '${r}'`)),Xi(2===e.rank,(()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`)),Xi(4===e.shape[1],(()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`)),Xi(1===t.rank,(()=>"scores must be a 1D tensor")),Xi(t.shape[0]===i,(()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`)),Xi(0<=s&&s<=1,(()=>`softNmsSigma must be in [0, 1], but was '${s}'`)),{maxOutputSize:n,iouThreshold:r,scoreThreshold:a,softNmsSigma:s}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $v=ep({nonMaxSuppression_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY){const s=Kh(e,"boxes","nonMaxSuppression","float32"),i=Kh(t,"scores","nonMaxSuppression","float32"),o=Rv(s,i,n,r,a),l={maxOutputSize:n=o.maxOutputSize,iouThreshold:r=o.iouThreshold,scoreThreshold:a=o.scoreThreshold};return zh.runKernel(Mu,{boxes:s,scores:i},l)}});
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Ov(e,t,n){const r=function(e,t,n){return function(e,t,n){let r=0,a=e.length,s=0,i=!1;for(;r<a;){s=r+(a-r>>>1);const o=n(t,e[s]);o>0?r=s+1:(a=s,i=!o)}return i?r:-r-1}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(e,t,n||Fv)}(e,t,n),a=r<0?-(r+1):r;e.splice(a,0,t)}function Fv(e,t){return e>t?1:e<t?-1:0}function Dv(e,t,n,r,a){return Bv(e,t,n,r,a,0)}function Mv(e,t,n,r,a,s){return Bv(e,t,n,r,a,0,!1,s,!0)}function Lv(e,t,n,r,a,s){return Bv(e,t,n,r,a,s,!0)}function Bv(e,t,n,r,a,s,i=!1,o=!1,l=!1){const u=[];for(let g=0;g<t.length;g++)t[g]>a&&u.push({score:t[g],boxIndex:g,suppressBeginIndex:0});u.sort(Gv);const c=s>0?-.5/s:0,d=[],h=[];for(;d.length<n&&u.length>0;){const t=u.pop(),{score:n,boxIndex:s,suppressBeginIndex:i}=t;if(n<a)break;let o=!1;for(let l=d.length-1;l>=i;--l){const n=Pv(e,s,d[l]);if(n>=r){o=!0;break}if(t.score=t.score*zv(r,c,n),t.score<=a)break}t.suppressBeginIndex=d.length,o||(t.score===n?(d.push(s),h.push(t.score)):t.score>a&&Ov(u,t,Gv))}const p=d.length,f=n-p;o&&f>0&&(d.push(...new Array(f).fill(0)),h.push(...new Array(f).fill(0)));const m={selectedIndices:d};return i&&(m.selectedScores=h),l&&(m.validOutputs=p),m}function Pv(e,t,n){const r=e.subarray(4*t,4*t+4),a=e.subarray(4*n,4*n+4),s=Math.min(r[0],r[2]),i=Math.min(r[1],r[3]),o=Math.max(r[0],r[2]),l=Math.max(r[1],r[3]),u=Math.min(a[0],a[2]),c=Math.min(a[1],a[3]),d=Math.max(a[0],a[2]),h=Math.max(a[1],a[3]),p=(o-s)*(l-i),f=(d-u)*(h-c);if(p<=0||f<=0)return 0;const m=Math.max(s,u),g=Math.max(i,c),y=Math.min(o,d),b=Math.min(l,h),v=Math.max(y-m,0)*Math.max(b-g,0);return v/(p+f-v)}function zv(e,t,n){const r=Math.exp(t*n*n);return n<=e?r:0}function Gv(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Vv=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY){const s=Kh(e,"boxes","nonMaxSuppressionAsync"),i=Kh(t,"scores","nonMaxSuppressionAsync"),o=Rv(s,i,n,r,a);n=o.maxOutputSize,r=o.iouThreshold,a=o.scoreThreshold;const l=await Promise.all([s.data(),i.data()]),u=l[0],c=l[1],{selectedIndices:d}=Dv(u,c,n,r,a);return s!==e&&s.dispose(),i!==t&&i.dispose(),Db(d,"int32")};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Uv=ep({nonMaxSuppressionWithScore_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=0){const i=Kh(e,"boxes","nonMaxSuppression"),o=Kh(t,"scores","nonMaxSuppression"),l=Rv(i,o,n,r,a,s),u={boxes:i,scores:o},c={maxOutputSize:n=l.maxOutputSize,iouThreshold:r=l.iouThreshold,scoreThreshold:a=l.scoreThreshold,softNmsSigma:s=l.softNmsSigma},d=zh.runKernel(Bu,u,c);return{selectedIndices:d[0],selectedScores:d[1]}}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Hv=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=0){const i=Kh(e,"boxes","nonMaxSuppressionAsync"),o=Kh(t,"scores","nonMaxSuppressionAsync"),l=Rv(i,o,n,r,a,s);n=l.maxOutputSize,r=l.iouThreshold,a=l.scoreThreshold,s=l.softNmsSigma;const u=await Promise.all([i.data(),o.data()]),c=u[0],d=u[1],{selectedIndices:h,selectedScores:p}=Lv(c,d,n,r,a,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Db(h,"int32"),selectedScores:Db(p)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jv=ep({nonMaxSuppressionPadded_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=!1){const i=Kh(e,"boxes","nonMaxSuppression"),o=Kh(t,"scores","nonMaxSuppression"),l=Rv(i,o,n,r,a,null),u={boxes:i,scores:o},c={maxOutputSize:l.maxOutputSize,iouThreshold:l.iouThreshold,scoreThreshold:l.scoreThreshold,padToMaxOutputSize:s},d=zh.runKernel(Lu,u,c);return{selectedIndices:d[0],validOutputs:d[1]}}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const qv=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=!1){const i=Kh(e,"boxes","nonMaxSuppressionAsync"),o=Kh(t,"scores","nonMaxSuppressionAsync"),l=Rv(i,o,n,r,a,null),u=l.maxOutputSize,c=l.iouThreshold,d=l.scoreThreshold,[h,p]=await Promise.all([i.data(),o.data()]),{selectedIndices:f,validOutputs:m}=Mv(h,p,u,c,d,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Db(f,"int32"),validOutputs:ng(m,"int32")}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Qv=ep({resizeBilinear_:function(e,t,n=!1,r=!1){const a=Kh(e,"images","resizeBilinear");Xi(3===a.rank||4===a.rank,(()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`)),Xi(2===t.length,(()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`)),Xi(!1===r||!1===n,(()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false."));let s=a,i=!1;3===a.rank&&(i=!0,s=Hf(a,[1,a.shape[0],a.shape[1],a.shape[2]]));const o={images:s},l={alignCorners:n,halfPixelCenters:r,size:t},u=zh.runKernel(rc,o,l);return i?Hf(u,[u.shape[1],u.shape[2],u.shape[3]]):u}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Xv=ep({resizeNearestNeighbor_:function(e,t,n=!1,r=!1){const a=Kh(e,"images","resizeNearestNeighbor");Xi(3===a.rank||4===a.rank,(()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${a.rank}.`)),Xi(2===t.length,(()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`)),Xi("float32"===a.dtype||"int32"===a.dtype,(()=>"`images` must have `int32` or `float32` as dtype")),Xi(!1===r||!1===n,(()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false."));let s=a,i=!1;3===a.rank&&(i=!0,s=Hf(a,[1,a.shape[0],a.shape[1],a.shape[2]]));const o={images:s},l={alignCorners:n,halfPixelCenters:r,size:t},u=zh.runKernel(tc,o,l);return i?Hf(u,[u.shape[1],u.shape[2],u.shape[3]]):u}});
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Zv=ep({threshold_:function(e,t="binary",n=!1,r=.5){const a=Kh(e,"image","threshold"),s=a.shape[0]*a.shape[1];let i,o,l,u,c=gf(Db([r]),255);if(Xi(3===a.rank,(()=>`Error in threshold: image must be rank 3,but got rank ${a.rank}.`)),Xi(3===a.shape[2]||1===a.shape[2],(()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${a.shape[2]}.`)),Xi("int32"===a.dtype||"float32"===a.dtype,(()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${a.dtype}.`)),Xi("otsu"===t||"binary"===t,(()=>`Method must be binary or otsu, but was ${t}`)),3===a.shape[2]){[i,o,l]=_b(a,[1,1,1],-1);const e=gf(i,.2989),t=gf(o,.587),n=gf(l,.114);u=pf(pf(e,t),n)}else u=e;if("otsu"===t){c=function(e,t){let n,r,a,s,i,o,l=Db([-1]),u=Db([0]),c=Db([0]);for(let d=0;d<e.size-1;d++){n=Kf(e,0,d+1),r=Kf(e,d+1),i=mf(sg(n),t),o=mf(sg(r),t);const h=sg(gf(n,nb(0,n.size)));a=mf(h,sg(n));const p=cm(r.shape,n.size),f=pf(nb(0,r.size),p),m=gf(r,f);s=mf(sg(m),sg(r));const g=Fg(a,s),y=Fg(a,s),b=gf(i,o);c=gf(gf(b,g),y);const v=gg(c,u);u=Mm(v,c,u),l=Mm(v,Db([d]),l)}return l}(sm(cf(hb(u),"int32"),rp([]),256),s)}const d=n?Sg(u,c):gg(u,c);return cf(gf(d,255),"int32")}});
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Kv=ep({transform_:function(e,t,n="nearest",r="constant",a=0,s){const i=Kh(e,"image","transform","float32"),o=Kh(t,"transforms","transform","float32");Xi(4===i.rank,(()=>`Error in transform: image must be rank 4,but got rank ${i.rank}.`)),Xi(2===o.rank&&(o.shape[0]===i.shape[0]||1===o.shape[0])&&8===o.shape[1],(()=>"Error in transform: Input transform should be batch x 8 or 1 x 8")),Xi(null==s||2===s.length,(()=>`Error in transform: outputShape must be [height, width] or null, but got ${s}.`));const l={image:i,transforms:o},u={interpolation:n,fillMode:r,fillValue:a,outputShape:s};return zh.runKernel(Gc,l,u)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Jv=ep({bandPart_:function(e,t,n){const r=Kh(e,"a","bandPart");Xi(r.rank>=2,(()=>`bandPart(): Rank must be at least 2, got ${r.rank}.`));const a=r.shape,[s,i]=r.shape.slice(-2);let o,l;"number"==typeof t?(Xi(t%1==0,(()=>`bandPart(): numLower must be an integer, got ${t}.`)),Xi(t<=s,(()=>`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`)),o=Kh(t<0?s:t,"numLower","bandPart")):(Xi("int32"===t.dtype,(()=>"bandPart(): numLower's dtype must be an int32.")),o=Mm(wg(t,0),s,Yg(t,s))),"number"==typeof n?(Xi(n%1==0,(()=>`bandPart(): numUpper must be an integer, got ${n}.`)),Xi(n<=i,(()=>`bandPart(): numUpper (${n}) must not be greater than the number of columns (${i}).`)),l=Kh(n<0?i:n,"numUpper","bandPart")):(Xi("int32"===n.dtype,(()=>"bandPart(): numUpper's dtype must be an int32.")),l=Mm(wg(n,0),i,Yg(n,i)));const u=Hf(nb(0,s,1,"int32"),[-1,1]),c=nb(0,i,1,"int32"),d=Fg(u,c),h=Lg(Sg(d,o),yg(d,Rg(l))),p=Zg([s,i],r.dtype);return Hf(Rb(Kb(Hf(r,[-1,s,i])).map((e=>Mm(h,e,p)))),a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Yv=ep({gramSchmidt_:function(e){let t;if(Array.isArray(e)){t=!1,Xi(null!=e&&e.length>0,(()=>"Gram-Schmidt process: input must not be null, undefined, or empty"));const n=e[0].shape[0];for(let t=1;t<e.length;++t)Xi(e[t].shape[0]===n,(()=>`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[t].shape[0]} vs. ${n})`))}else t=!0,e=_b(e,e.shape[0],0).map((e=>Eb(e,[0])));Xi(e.length<=e[0].shape[0],(()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`));const n=[],r=e;for(let a=0;a<e.length;++a)n.push(zh.tidy((()=>{let e=r[a];if(a>0)for(let t=0;t<a;++t){const r=gf(sg(gf(n[t],e)),n[t]);e=Fg(e,r)}return mf(e,og(e,"euclidean"))})));return t?Rb(n,0):n}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function eA(e,t=!1){return zh.tidy((()=>{Xi(2===e.shape.length,(()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`));const n=e.shape[0],r=e.shape[1];let a=pg(n),s=df(e);const i=Mb([[1]],[1,1]);let o=df(i);const l=n>=r?r:n;for(let e=0;e<l;++e){const t=s,l=o,u=a;[o,s,a]=zh.tidy((()=>{const t=Kf(s,[e,e],[n-e,1]),l=og(t),u=Kf(s,[e,e],[1,1]),c=Mm(gg(u,0),Mb([[-1]]),Mb([[1]])),d=Fg(u,gf(c,l)),h=mf(t,d);o=1===h.shape[0]?df(i):Qf([i,Kf(h,[1,0],[h.shape[0]-1,h.shape[1]])],0);const p=Rg(mf(Xf(c,d),l)),f=Kf(s,[e,0],[n-e,r]),m=gf(p,o),g=rv(o);if(0===e)s=Fg(f,Xf(m,Xf(g,f)));else{const t=Fg(f,Xf(m,Xf(g,f)));s=Qf([Kf(s,[0,0],[e,r]),t],0)}const y=rv(m),b=Kf(a,[0,e],[n,a.shape[1]-e]);if(0===e)a=Fg(b,Xf(Xf(b,o),y));else{const t=Fg(b,Xf(Xf(b,o),y));a=Qf([Kf(a,[0,0],[n,e]),t],1)}return[o,s,a]})),up([t,l,u])}return!t&&n>r&&(a=Kf(a,[0,0],[n,r]),s=Kf(s,[0,0],[r,r])),[a,s]}))}const tA=ep({qr_:function(e,t=!1){if(Xi(e.rank>=2,(()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`)),2===e.rank)return eA(e,t);{const n=e.shape.slice(0,e.shape.length-2).reduce(((e,t)=>e*t)),r=Kb(Hf(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),a=[],s=[];r.forEach((e=>{const[n,r]=eA(e,t);a.push(n),s.push(r)}));return[Hf(Rb(a,0),e.shape),Hf(Rb(s,0),e.shape)]}}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */var nA,rA;(rA=nA||(nA={}))[rA.NONE=0]="NONE",rA[rA.MEAN=1]="MEAN",rA[rA.SUM=2]="SUM",rA[rA.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS";const aA=ep({computeWeightedLoss_:function(e,t,n=nA.SUM_BY_NONZERO_WEIGHTS){const r=Kh(e,"losses","computeWeightedLoss");let a=null;null!=t&&(a=Kh(t,"weights","computeWeightedLoss"));const s=null==a?r:gf(r,a);if(n===nA.NONE)return s;if(n===nA.SUM)return sg(s);if(n===nA.MEAN){if(null==a)return Xg(s);{const e=r.size/a.size,t=mf(sg(s),sg(a));return e>1?mf(t,ng(e)):t}}if(n===nA.SUM_BY_NONZERO_WEIGHTS){if(null==a)return mf(sg(s),ng(r.size));{const e=gf(a,Kg(r.shape)),t=cf(sg(sy(e,ng(0))),"float32");return mf(sg(s),t)}}throw Error(`Unknown reduction: ${n}`)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sA=ep({absoluteDifference_:function(e,t,n,r=nA.SUM_BY_NONZERO_WEIGHTS){const a=Kh(e,"labels","absoluteDifference"),s=Kh(t,"predictions","absoluteDifference");let i=null;null!=n&&(i=Kh(n,"weights","absoluteDifference")),Zi(a.shape,s.shape,"Error in absoluteDifference: ");const o=yf(Fg(a,s));return aA(o,i,r)}});const iA=ep({cosineDistance_:function(e,t,n,r,a=nA.SUM_BY_NONZERO_WEIGHTS){const s=Kh(e,"labels","cosineDistance"),i=Kh(t,"predictions","cosineDistance");let o=null;null!=r&&(o=Kh(r,"weights","cosineDistance")),Zi(s.shape,i.shape,"Error in cosineDistance: ");const l=ng(1),u=Fg(l,sg(gf(s,i),n,!0));return aA(u,o,a)}});const oA=ep({hingeLoss_:function(e,t,n,r=nA.SUM_BY_NONZERO_WEIGHTS){let a=Kh(e,"labels","hingeLoss");const s=Kh(t,"predictions","hingeLoss");let i=null;null!=n&&(i=Kh(n,"weights","hingeLoss")),Zi(a.shape,s.shape,"Error in hingeLoss: ");const o=ng(1);a=Fg(gf(ng(2),a),o);const l=sb(Fg(o,gf(a,s)));return aA(l,i,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lA=ep({huberLoss_:function(e,t,n,r=1,a=nA.SUM_BY_NONZERO_WEIGHTS){const s=Kh(e,"labels","huberLoss"),i=Kh(t,"predictions","huberLoss");let o=null;null!=n&&(o=Kh(n,"weights","huberLoss")),Zi(s.shape,i.shape,"Error in huberLoss: ");const l=ng(r),u=yf(Fg(i,s)),c=Yg(u,l),d=Fg(u,c),h=pf(gf(ng(.5),ag(c)),gf(l,d));return aA(h,o,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uA=ep({logLoss_:function(e,t,n,r=1e-7,a=nA.SUM_BY_NONZERO_WEIGHTS){const s=Kh(e,"labels","logLoss"),i=Kh(t,"predictions","logLoss");let o=null;null!=n&&(o=Kh(n,"weights","logLoss")),Zi(s.shape,i.shape,"Error in logLoss: ");const l=ng(1),u=ng(r),c=Rg(gf(s,Wg(pf(i,u)))),d=gf(Fg(l,s),Wg(pf(Fg(l,i),u))),h=Fg(c,d);return aA(h,o,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const cA=ep({meanSquaredError_:function(e,t,n,r=nA.SUM_BY_NONZERO_WEIGHTS){const a=Kh(e,"labels","meanSquaredError"),s=Kh(t,"predictions","meanSquaredError");let i=null;null!=n&&(i=Kh(n,"weights","meanSquaredError")),Zi(a.shape,s.shape,"Error in meanSquaredError: ");const o=Nb(a,s);return aA(o,i,r)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dA=ep({sigmoidCrossEntropy_:function(e,t,n,r=0,a=nA.SUM_BY_NONZERO_WEIGHTS){let s=Kh(e,"multiClassLabels","sigmoidCrossEntropy");const i=Kh(t,"logits","sigmoidCrossEntropy");let o=null;if(null!=n&&(o=Kh(n,"weights","sigmoidCrossEntropy")),Zi(s.shape,i.shape,"Error in sigmoidCrossEntropy: "),r>0){const e=ng(r),t=ng(1),n=ng(.5);s=pf(gf(s,Fg(t,e)),gf(n,e))}const l=function(e,t){const n=Kh(e,"labels","sigmoidCrossEntropyWithLogits"),r=Kh(t,"logits","sigmoidCrossEntropyWithLogits");Zi(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");const a=sb(r),s=gf(r,n),i=_g(ug(Rg(yf(r))));return pf(Fg(a,s),i)}(s,i);return aA(l,o,a)}});
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const hA=ep({softmaxCrossEntropy_:function(e,t,n,r=0,a=nA.SUM_BY_NONZERO_WEIGHTS){let s=Kh(e,"onehotLabels","softmaxCrossEntropy");const i=Kh(t,"logits","softmaxCrossEntropy");let o=null;if(null!=n&&(o=Kh(n,"weights","softmaxCrossEntropy")),Zi(s.shape,i.shape,"Error in softmaxCrossEntropy: "),r>0){const e=ng(r),t=ng(1),n=ng(s.shape[1]);s=pf(gf(s,Fg(t,e)),mf(e,n))}const l=function(e,t,n=-1){if(-1===n&&(n=t.rank-1),n!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${n}`);return Ng(((e,t,r)=>{const a=Mg(t,[n],!0),s=Fg(cf(t,"float32"),a);r([e,s]);const i=Rg(gf(s,e));return{value:sg(i,[n]),gradFunc:(e,t)=>{const[r,a]=t,s=Qm(e.shape,[n]);return[gf(Hf(e,s),Fg(cf(r,"float32"),ug(a))),gf(Hf(e,s),Fg(ug(a),cf(r,"float32")))]}}}))(e,t)}(s,i);return aA(l,o,a)}});
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const pA={fft:Cb,ifft:Ib,rfft:Tb,irfft:Wb},fA={hammingWindow:wv,hannWindow:Sv,frame:Cv,stft:Iv},mA={flipLeftRight:_v,grayscaleToRGB:Tv,resizeNearestNeighbor:Xv,resizeBilinear:Qv,rgbToGrayscale:Nv,rotateWithOffset:Ev,cropAndResize:Wv,nonMaxSuppression:$v,nonMaxSuppressionAsync:Vv,nonMaxSuppressionWithScore:Uv,nonMaxSuppressionWithScoreAsync:Hv,nonMaxSuppressionPadded:jv,nonMaxSuppressionPaddedAsync:qv,threshold:Zv,transform:Kv},gA={bandPart:Jv,gramSchmidt:Yv,qr:tA},yA={absoluteDifference:sA,computeWeightedLoss:aA,cosineDistance:iA,hingeLoss:oA,huberLoss:lA,logLoss:uA,meanSquaredError:cA,sigmoidCrossEntropy:dA,softmaxCrossEntropy:hA},bA={sparseFillEmptyRows:ep({sparseFillEmptyRows_:function(e,t,n,r){const a=Kh(e,"indices","sparseFillEmptyRows","int32"),s=Kh(t,"values","sparseFillEmptyRows"),i=Kh(n,"denseShape","sparseFillEmptyRows","int32"),o=Kh(r,"defaultValue","sparseFillEmptyRows",s.dtype);if(2!==a.rank)throw new Error(`Indices should be Tensor2D but received shape\n        ${a.shape}`);if(1!==s.rank)throw new Error(`Values should be Tensor1D but received shape ${s.shape}`);if(1!==i.rank)throw new Error(`Dense shape should be Tensor1D but received shape ${i.shape}`);if(0!==o.rank)throw new Error(`Default value should be a scalar but received shape ${o.shape}`);const l={indices:a,values:s,denseShape:i,defaultValue:o},u=zh.runKernel(Cc,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}}),sparseReshape:ep({sparseReshape_:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n){const r=Kh(e,"inputIndices","sparseReshape","int32"),a=Kh(t,"inputShape","sparseReshape","int32"),s=Kh(n,"newShape","sparseReshape","int32");if(2!==r.rank)throw new Error(`Input indices should be Tensor2D but received shape\n        ${r.shape}`);if(1!==a.rank)throw new Error(`Input shape should be Tensor1D but received shape ${a.shape}`);if(1!==s.rank)throw new Error(`New shape should be Tensor1D but received shape ${s.shape}`);const i={inputIndices:r,inputShape:a,newShape:s},o=zh.runKernel(Ic,i);return{outputIndices:o[0],outputShape:o[1]}}}),sparseSegmentMean:ep({sparseSegmentMean_:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n){const r=Kh(e,"data","sparseSegmentMean"),a=Kh(t,"indices","sparseSegmentMean","int32"),s=Kh(n,"segmentIds","sparseSegmentMean","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error(`Indices should be Tensor1D but received shape\n          ${a.shape}`);if(1!==s.rank)throw new Error(`Segment ids should be Tensor1D but received shape\n          ${s.shape}`);const i={data:r,indices:a,segmentIds:s};return zh.runKernel(Wc,i)}}),sparseSegmentSum:ep({sparseSegmentSum_:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n){const r=Kh(e,"data","sparseSegmentSum"),a=Kh(t,"indices","sparseSegmentSum","int32"),s=Kh(n,"segmentIds","sparseSegmentSum","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error(`Indices should be Tensor1D but received shape\n         ${a.shape}`);if(1!==s.rank)throw new Error(`Segment ids should be Tensor1D but received shape\n         ${s.shape}`);const i={data:r,indices:a,segmentIds:s};return zh.runKernel(_c,i)}})},vA={stringNGrams:ep({stringNGrams_:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r,a,s,i,o){const l=Kh(e,"data","stringNGrams","string");if("string"!==l.dtype)throw new Error("Data must be of datatype string");if(1!==l.shape.length)throw new Error(`Data must be a vector, saw: ${l.shape}`);const u=Kh(t,"dataSplits","stringNGrams");if("int32"!==u.dtype)throw new Error("Data splits must be of datatype int32");const c={separator:n,nGramWidths:r,leftPad:a,rightPad:s,padWidth:i,preserveShortSequences:o},d={data:l,dataSplits:u},h=zh.runKernel(Oc,d,c);return{nGrams:h[0],nGramsSplits:h[1]}}}),stringSplit:ep({stringSplit_:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n=!0){const r=Kh(e,"input","stringSplit","string"),a=Kh(t,"delimiter","stringSplit","string");if(1!==r.rank)throw new Error(`Input should be Tensor1D but received shape ${r.shape}`);if(0!==a.rank)throw new Error(`Delimiter should be a scalar but received shape ${a.shape}`);const s={skipEmpty:n},i={input:r,delimiter:a},o=zh.runKernel(Fc,i,s);return{indices:o[0],values:o[1],shape:o[2]}}}),stringToHashBucketFast:ep({stringToHashBucketFast_:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t){const n=Kh(e,"input","stringToHashBucketFast","string"),r={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");const a={input:n};return zh.runKernel(Dc,a,r)}}),staticRegexReplace:ep({staticRegexReplace_:
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r=!0){const a=Kh(e,"input","staticRegexReplace","string"),s={pattern:t,rewrite:n,replaceGlobal:r};return zh.runKernel(Rc,{x:a},s)}})},AA=new Map,xA=new Map;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class kA{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class wA{constructor(){this.classNameMap={}}static getMap(){return null==wA.instance&&(wA.instance=new wA),wA.instance}static register(e){wA.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function SA(e,t,n){Xi(null!=e.className,(()=>"Class being registered does not have the static className property defined.")),Xi("string"==typeof e.className,(()=>"className is required to be a string, but got type "+typeof e.className)),Xi(e.className.length>0,(()=>"Class being registered has an empty-string as its className, which is disallowed.")),void 0===t&&(t="Custom"),void 0===n&&(n=e.className);const r=t+">"+n;return wA.register(e),AA.set(r,e),xA.set(e,r),e}const CA=Object.freeze(Object.defineProperty({__proto__:null,Serializable:kA,SerializationMap:wA,getRegisteredName:function(e){return xA.has(e)?xA.get(e):e.className},registerClass:SA},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class IA extends kA{minimize(e,t=!1,n){const{value:r,grads:a}=this.computeGradients(e,n);if(null!=n){const e=n.map((e=>({name:e.name,tensor:a[e.name]})));this.applyGradients(e)}else this.applyGradients(a);return up(a),t?r:(r.dispose(),null)}get iterations(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return Tg(e,t)}dispose(){null!=this.iterations_&&up(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:ng(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(IA,Symbol.hasInstance,{value:e=>null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients});
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class WA extends IA{static get className(){return"Adadelta"}constructor(e,t,n=null){super(),this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],null==n&&(this.epsilon=zh.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=zh.registeredVariables[t],a=!1;null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:lp((()=>Lm(r).variable(a)))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:lp((()=>Lm(r).variable(a)))});const s=Array.isArray(e)?e[n].tensor:e[t];if(null==s)return;const i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;lp((()=>{const e=pf(gf(i,this.rho),gf(ag(s),1-this.rho)),t=gf(mf(rg(pf(o,this.epsilon)),rg(pf(i,this.epsilon))),s),n=pf(gf(o,this.rho),gf(ag(t),1-this.rho));i.assign(e),o.assign(n);const a=pf(gf(t,-this.learningRate),r);r.assign(a)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&(up(this.accumulatedGrads.map((e=>e.variable))),up(this.accumulatedUpdates.map((e=>e.variable))))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){const t=(e=await this.extractIterations(e)).length/2,n=!1;this.accumulatedGrads=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedUpdates=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class _A extends IA{static get className(){return"Adagrad"}constructor(e,t=.1){super(),this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=zh.registeredVariables[t];if(null==this.accumulatedGrads[n]){const e=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:lp((()=>cm(r.shape,this.initialAccumulatorValue).variable(e)))}}const a=Array.isArray(e)?e[n].tensor:e[t];if(null==a)return;const s=this.accumulatedGrads[n].variable;lp((()=>{const e=pf(s,ag(a));s.assign(e);const t=pf(gf(mf(a,rg(pf(e,zh.backend.epsilon()))),-this.learningRate),r);r.assign(t)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&up(this.accumulatedGrads.map((e=>e.variable)))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulatedGrads=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class TA extends IA{static get className(){return"Adam"}constructor(e,t,n,r=null){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],lp((()=>{this.accBeta1=ng(t).variable(),this.accBeta2=ng(n).variable()})),null==r&&(this.epsilon=zh.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);lp((()=>{const n=Fg(1,this.accBeta1),r=Fg(1,this.accBeta2);t.forEach(((t,a)=>{const s=zh.registeredVariables[t],i=!1;null==this.accumulatedFirstMoment[a]&&(this.accumulatedFirstMoment[a]={originalName:`${t}/m`,variable:lp((()=>Lm(s).variable(i)))}),null==this.accumulatedSecondMoment[a]&&(this.accumulatedSecondMoment[a]={originalName:`${t}/v`,variable:lp((()=>Lm(s).variable(i)))});const o=Array.isArray(e)?e[a].tensor:e[t];if(null==o)return;const l=this.accumulatedFirstMoment[a].variable,u=this.accumulatedSecondMoment[a].variable,c=pf(gf(l,this.beta1),gf(o,1-this.beta1)),d=pf(gf(u,this.beta2),gf(ag(o),1-this.beta2)),h=mf(c,n),p=mf(d,r);l.assign(c),u.assign(d);const f=pf(gf(mf(h,pf(rg(p),this.epsilon)),-this.learningRate),s);s.assign(f)})),this.accBeta1.assign(gf(this.accBeta1,this.beta1)),this.accBeta2.assign(gf(this.accBeta2,this.beta2))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&up(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedSecondMoment&&up(this.accumulatedSecondMoment.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e),lp((()=>{this.accBeta1.assign(tg(this.beta1,this.iterations_+1)),this.accBeta2.assign(tg(this.beta2,this.iterations_+1))}));const t=e.length/2,n=!1;this.accumulatedFirstMoment=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedSecondMoment=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)})))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class NA extends IA{static get className(){return"Adamax"}constructor(e,t,n,r=null,a=0){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=r,this.decay=a,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],lp((()=>{this.iteration=ng(0).variable(),this.accBeta1=ng(t).variable()})),null==r&&(this.epsilon=zh.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);lp((()=>{const n=Fg(1,this.accBeta1),r=mf(-this.learningRate,pf(gf(this.iteration,this.decay),1));t.forEach(((t,a)=>{const s=zh.registeredVariables[t],i=!1;null==this.accumulatedFirstMoment[a]&&(this.accumulatedFirstMoment[a]={originalName:`${t}/m`,variable:Lm(s).variable(i)}),null==this.accumulatedWeightedInfNorm[a]&&(this.accumulatedWeightedInfNorm[a]={originalName:`${t}/v`,variable:Lm(s).variable(i)});const o=Array.isArray(e)?e[a].tensor:e[t];if(null==o)return;const l=this.accumulatedFirstMoment[a].variable,u=this.accumulatedWeightedInfNorm[a].variable,c=pf(gf(l,this.beta1),gf(o,1-this.beta1)),d=gf(u,this.beta2),h=yf(o),p=Qg(d,h);l.assign(c),u.assign(p);const f=pf(gf(mf(r,n),mf(c,pf(p,this.epsilon))),s);s.assign(f)})),this.iteration.assign(pf(this.iteration,1)),this.accBeta1.assign(gf(this.accBeta1,this.beta1))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&up(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedWeightedInfNorm&&up(this.accumulatedWeightedInfNorm.map((e=>e.variable)))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class EA extends IA{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=Array.isArray(e)?e[n].tensor:e[t];if(null==r)return;const a=zh.registeredVariables[t];lp((()=>{const e=pf(gf(this.c,r),a);a.assign(e)}))})),this.incrementIterations()}setLearningRate(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=cp(ng(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(0!==(e=await this.extractIterations(e)).length)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class RA extends EA{static get className(){return"Momentum"}constructor(e,t,n=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=ng(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=zh.registeredVariables[t];if(null==this.accumulations[n]){const e=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:lp((()=>Lm(r).variable(e)))}}const a=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];null!=s&&lp((()=>{let e;const t=pf(gf(this.m,a),s);e=this.useNesterov?pf(gf(this.c,pf(s,gf(t,this.m))),r):pf(gf(this.c,t),r),a.assign(t),r.assign(e)}))})),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&up(this.accumulations.map((e=>e.variable)))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulations=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class $A extends IA{static get className(){return"RMSProp"}constructor(e,t=.9,n=0,r=null,a=!1){if(super(),this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=r,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=a,null==r&&(this.epsilon=zh.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=zh.registeredVariables[t],a=!1;null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:lp((()=>Lm(r).variable(a)))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:lp((()=>Lm(r).variable(a)))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:lp((()=>Lm(r).variable(a)))});const s=Array.isArray(e)?e[n].tensor:e[t];if(null==s)return;const i=this.accumulatedMeanSquares[n].variable,o=this.accumulatedMoments[n].variable;lp((()=>{const e=pf(gf(i,this.decay),gf(ag(s),1-this.decay));if(this.centered){const t=this.accumulatedMeanGrads[n].variable,a=pf(gf(t,this.decay),gf(s,1-this.decay)),l=mf(gf(s,this.learningRate),rg(Fg(e,pf(ag(a),this.epsilon)))),u=pf(gf(o,this.momentum),l);i.assign(e),t.assign(a),o.assign(u);const c=Fg(r,u);r.assign(c)}else{const e=pf(gf(i,this.decay),gf(ag(s),1-this.decay)),t=pf(gf(o,this.momentum),mf(gf(s,this.learningRate),rg(pf(e,this.epsilon))));i.assign(e),o.assign(t);const n=Fg(r,t);r.assign(n)}}))})),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&up(this.accumulatedMeanSquares.map((e=>e.variable))),null!=this.accumulatedMeanGrads&&this.centered&&up(this.accumulatedMeanGrads.map((e=>e.variable))),null!=this.accumulatedMoments&&up(this.accumulatedMoments.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);const t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedMoments=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}}
/**
 * @license
 * Copyright 2022 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const OA=[WA,_A,TA,NA,RA,$A,EA];function FA(e){return new Promise((e=>setTimeout(e))).then(e)}class DA{constructor(e){if(!Do().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(DA.URL_SCHEME)&&(e=e.slice(DA.URL_SCHEME.length)),null!=e&&0!==e.length||(e="model"),this.modelJsonFileName=e+".json",this.weightDataFileName=e+".weights.bin"}async save(e){if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");const t=sp.join(e.weightData),n=window.URL.createObjectURL(new Blob([t],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{const t=Ip(e,[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}]),r=window.URL.createObjectURL(new Blob([JSON.stringify(t)],{type:"application/json"})),a=null==this.modelJsonAnchor?document.createElement("a"):this.modelJsonAnchor;if(a.download=this.modelJsonFileName,a.href=r,await FA((()=>a.dispatchEvent(new MouseEvent("click")))),null!=e.weightData){const e=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor;e.download=this.weightDataFileName,e.href=n,await FA((()=>e.dispatchEvent(new MouseEvent("click"))))}return{modelArtifactsInfo:Tp(e)}}}}DA.URL_SCHEME="downloads://";class MA{constructor(e){if(null==e||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.jsonFile=e[0],this.weightsFiles=e.slice(1)}async load(){return new Promise(((e,t)=>{const n=new FileReader;n.onload=n=>{const r=JSON.parse(n.target.result),a=r.modelTopology;if(null==a)return void t(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));if(null==r.weightsManifest)return void t(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));if(0===this.weightsFiles.length)return void e({modelTopology:a});const s=_p(r,(e=>this.loadWeights(e)));e(s)},n.onerror=e=>t(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),n.readAsText(this.jsonFile)}))}loadWeights(e){const t=[],n=[];for(const s of e)t.push(...s.weights),n.push(...s.paths);const r=this.checkManifestAndWeightFiles(e),a=n.map((e=>this.loadWeightsFile(e,r[e])));return Promise.all(a).then((e=>[t,e]))}loadWeightsFile(e,t){return new Promise(((n,r)=>{const a=new FileReader;a.onload=e=>{const t=e.target.result;n(t)},a.onerror=t=>r(`Failed to weights data from file of path '${e}'.`),a.readAsArrayBuffer(t)}))}checkManifestAndWeightFiles(e){const t=[],n=this.weightsFiles.map((e=>Cp(e.name))),r={};for(const a of e)a.paths.forEach((e=>{const a=Cp(e);if(-1!==t.indexOf(a))throw new Error(`Duplicate file basename found in weights manifest: '${a}'`);if(t.push(a),-1===n.indexOf(a))throw new Error(`Weight file with basename '${a}' is not provided.`);r[e]=this.weightsFiles[n.indexOf(a)]}));if(t.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${t.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return r}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function LA(e,t,n,r){var a,s,i;Xi(null!=(a=e)&&Array.isArray(a)&&a.length>0,(()=>"promises must be a none empty array")),i=r=null==r?1:r,Xi((s=n=null==n?0:n)>=0&&s<=1,(()=>`Progress fraction must be in range [0, 1], but got startFraction ${s}`)),Xi(i>=0&&i<=1,(()=>`Progress fraction must be in range [0, 1], but got endFraction ${i}`)),Xi(i>=s,(()=>`startFraction must be no more than endFraction, but got startFraction ${s} and endFraction ${i}`));let o=0;return Promise.all(e.map((a=>(a.then((a=>{const s=n+ ++o/e.length*(r-n);return t(s),a})),a))))}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */async function BA(e,t){null==t&&(t={});const n=null==t.fetchFunc?Do().platform.fetch:t.fetchFunc,r=e.map((e=>n(e,t.requestInit,{isBinary:!0}))),a=(null==t.onProgress?await Promise.all(r):await LA(r,t.onProgress,0,.5)).map((e=>e.arrayBuffer()));return null==t.onProgress?await Promise.all(a):await LA(a,t.onProgress,.5,1)}function PA(e){return async(t,n="",r)=>{const a=t.map((()=>!1)),s={},i=null!=r?r.map((()=>!1)):[],o=[];if(t.forEach(((e,t)=>{let n=0;e.weights.forEach((e=>{const l="quantization"in e?e.quantization.dtype:e.dtype,u=ap[l]*Ji(e.shape),c=()=>{a[t]=!0,null==s[t]&&(s[t]=[]),s[t].push({manifestEntry:e,groupOffset:n,sizeBytes:u})};null!=r?r.forEach(((t,n)=>{t===e.name&&(c(),i[n]=!0)})):c(),o.push(e.name),n+=u}))})),!i.every((e=>e))){const e=r.filter(((e,t)=>!i[t]));throw new Error(`Could not find weights in manifest with names: ${e.join(", ")}. \nManifest JSON has weights with names: ${o.join(", ")}.`)}const l=a.reduce(((e,t,n)=>(t&&e.push(n),e)),[]),u=[];l.forEach((e=>{t[e].paths.forEach((e=>{const t=n+(n.endsWith("/")?"":"/")+e;u.push(t)}))}));const c=await e(u),d={};let h=0;return l.forEach((e=>{const n=t[e].paths.length,r=new sp(c.slice(h,h+n));s[e].forEach((e=>{const t=mp(r.slice(e.groupOffset,e.groupOffset+e.sizeBytes),[e.manifestEntry]);for(const n in t)d[n]=t[n]})),h+=n})),d}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */Ep.registerSaveRouter((e=>Do().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(DA.URL_SCHEME)?function(e="model"){return new DA(e)}(e.slice(DA.URL_SCHEME.length)):null));class zA{constructor(e,t){if(this.DEFAULT_METHOD="POST",null==t&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.weightUrlConverter=t.weightUrlConverter,null!=t.fetchFunc?(Xi("function"==typeof t.fetchFunc,(()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)")),this.fetch=t.fetchFunc):this.fetch=Do().platform.fetch,Xi(null!=e&&e.length>0,(()=>"URL path for http must not be null, undefined or empty.")),Array.isArray(e)&&Xi(2===e.length,(()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`)),this.path=e,null!=t.requestInit&&null!=t.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{},this.loadOptions=t}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;const n=Ip(e,[{paths:["./model.weights.bin"],weights:e.weightSpecs}]);if(t.body.append("model.json",new Blob([JSON.stringify(n)],{type:"application/json"}),"model.json"),null!=e.weightData){const n=sp.join(e.weightData);t.body.append("model.weights.bin",new Blob([n],{type:"application/octet-stream"}),"model.weights.bin")}const r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:Tp(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async loadModelJSON(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(gQ){let t=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?t+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":t+=" Please make sure the server is serving valid JSON for this request.",new Error(t)}const n=t.modelTopology,r=t.weightsManifest;if(null==n&&null==r)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return t}async load(){if(this.loadOptions.streamWeights)return this.loadStream();return _p(await this.loadModelJSON(),(e=>this.loadWeights(e)))}async loadStream(){const e=await this.loadModelJSON(),t=await this.getWeightUrls(e.weightsManifest),n=Np(e.weightsManifest);return Object.assign(Object.assign({},e),{weightSpecs:n,getWeightStream:()=>function(e,t){var n;const r=null==t.fetchFunc?Do().platform.fetch:t.fetchFunc;let a,s=0;return null===(n=t.onProgress)||void 0===n||n.call(t,0),new ReadableStream({pull:async n=>{for(var i;s<e.length;){if(!a){const n=(await r(e[s],t.requestInit,{isBinary:!0})).body;a=n.getReader()}const{done:o,value:l}=await a.read();if(!o)return void n.enqueue(l);s++,a=void 0,null===(i=t.onProgress)||void 0===i||i.call(t,s/e.length)}n.close()}})}(t,this.loadOptions)})}async getWeightUrls(e){const t=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=function(e){const t=e.lastIndexOf("/"),n=e.lastIndexOf("?"),r=e.substring(0,t),a=n>t?e.substring(n):"";return[r+"/",a]}(t),a=this.weightPathPrefix||n,s=[],i=[];for(const o of e)for(const e of o.paths)null!=this.weightUrlConverter?i.push(this.weightUrlConverter(e)):s.push(a+e+r);return this.weightUrlConverter&&s.push(...await Promise.all(i)),s}async loadWeights(e){const t=await this.getWeightUrls(e);return[Np(e),await BA(t,this.loadOptions)]}}function GA(e){return null!=e.match(zA.URL_SCHEME_REGEX)}zA.URL_SCHEME_REGEX=/^https?:\/\//;const VA=(e,t)=>{if("undefined"==typeof fetch&&(null==t||null==t.fetchFunc))return null;{let n=!0;if(n=Array.isArray(e)?e.every((e=>GA(e))):GA(e),n)return UA(e,t)}return null};function UA(e,t){return new zA(e,t)}Ep.registerSaveRouter(VA),Ep.registerLoadRouter(VA);
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class HA{constructor(e){this.modelArtifacts=e}load(){return this.modelArtifacts}}class jA{constructor(e){this.saveHandler=e}save(e){return this.saveHandler(e)}}class qA{constructor(e){e.load&&(this.load=()=>Promise.resolve(e.load())),e.save&&(this.save=t=>Promise.resolve(e.save(t)))}}function QA(e,t,n,r){if(1===arguments.length){const t=null!=e.modelTopology||null!=e.weightSpecs;return new HA(t?e:{modelTopology:e})}return new HA({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:r})}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const XA=Object.freeze(Object.defineProperty({__proto__:null,CompositeArrayBuffer:sp,browserFiles:function(e){return new MA(e)},browserHTTPRequest:function(e,t){return UA(e,t)},concatenateArrayBuffers:Sp,copyModel:async function(e,t){return rf(e,t,!1)},decodeWeights:mp,decodeWeightsStream:Ap,encodeWeights:fp,fromMemory:function(e,t,n,r){return new qA(QA(...arguments))},fromMemorySync:QA,getLoadHandlers:(e,t)=>Ep.getLoadHandlers(e,t)
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */,getModelArtifactsForJSON:_p,getModelArtifactsForJSONSync:Wp,getModelArtifactsInfoForJSON:Tp,getSaveHandlers:Rp,getWeightSpecs:Np,http:UA,isHTTPScheme:GA,listModels:async function(){const e=tf.getSchemes(),t={};for(const n of e){const e=await tf.getManager(n).listModels();for(const r in e){t[n+ef+r]=e[r]}}return t},loadWeights:async function(e,t="",n,r){return PA((e=>BA(e,{requestInit:r})))(e,t,n)},moveModel:async function(e,t){return rf(e,t,!0)},registerLoadRouter:e=>Ep.registerLoadRouter(e),registerSaveRouter:e=>Ep.registerSaveRouter(e),removeModel:async function(e){const t=nf(e);return tf.getManager(t.scheme).removeModel(t.path)},weightsLoaderFactory:PA,withSaveHandler:function(e){return new jA(e)},withSaveHandlerSync:function(e){return new jA(e)}},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ZA=ep({confusionMatrix_:function(e,t,n){const r=Kh(e,"labels","confusionMatrix"),a=Kh(t,"predictions","confusionMatrix");Xi(null==n||n>0&&Number.isInteger(n),(()=>`If provided, numClasses must be a positive integer, but got ${n}`)),Xi(1===r.rank,(()=>`Expected the rank of labels to be 1, but got ${r.rank}`)),Xi(1===a.rank,(()=>`Expected the rank of predictions to be 1, but got ${a.rank}`)),Xi(r.shape[0]===a.shape[0],(()=>`Mismatch in the number of examples: ${r.shape[0]} vs. ${a.shape[0]}. Labels and predictions should have the same number of elements.`)),Xi(n>0&&Number.isInteger(n),(()=>`numClasses is required to be a positive integer, but got ${n}`));const s=iy(cf(r,"int32"),n),i=iy(cf(a,"int32"),n),o=rv(s),l=Xf(o,i);return cf(l,"int32")}}),KA=Object.freeze(Object.defineProperty({__proto__:null,confusionMatrix:ZA},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
let JA,YA=!1;function ex(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==e)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,r=!1,a=!1,s=!1,i=!1,o=!1;if(e.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&e instanceof ImageData)r=!0;else if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)a=!0;else if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)s=!0;else if(null!=e.getContext)i=!0;else{if(!("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap))throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);o=!0}if(null!=rd(Xc,zh.backendName)){const n={pixels:e},r={numChannels:t};return zh.runKernel(Xc,n,r)}const[l,u]=a?[e.videoWidth,e.videoHeight]:[e.width,e.height];let c,d;if(i)c=e.getContext("2d").getImageData(0,0,l,u).data;else if(r||n)c=e.data;else if(s||a||o){if(null==JA)if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas||"undefined"==typeof OffscreenCanvasRenderingContext2D)throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");JA=new OffscreenCanvas(1,1).getContext("2d")}else JA=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});JA.canvas.width=l,JA.canvas.height=u,JA.drawImage(e,0,0,l,u),c=JA.getImageData(0,0,l,u).data}if(4===t)d=new Int32Array(c);else{const e=l*u;d=new Int32Array(e*t);for(let n=0;n<e;n++)for(let e=0;e<t;++e)d[n*t+e]=c[4*n+e]}return Lb(d,[u,l,t],"int32")}function tx(e){return"undefined"!=typeof window&&"undefined"!=typeof ImageBitmap&&window.hasOwnProperty("createImageBitmap")&&!(e instanceof ImageBitmap)&&function(e){return null!=e&&0!==e.width&&0!==e.height}(e)&&!function(e){return null!=e&&e.data instanceof Uint8Array}(e)}function nx(e){if(2!==e.rank&&3!==e.rank)throw new Error(`toPixels only supports rank 2 or 3 tensors, got rank ${e.rank}.`);const t=2===e.rank?1:e.shape[2];if(t>4||2===t)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${t}`);if("float32"!==e.dtype&&"int32"!==e.dtype)throw new Error(`Unsupported type for toPixels: ${e.dtype}. Please use float32 or int32 tensors.`)}const rx=ep({fromPixels_:ex}),ax=Object.freeze(Object.defineProperty({__proto__:null,draw:function(e,t,n){let r=Kh(e,"img","draw");if(!(e instanceof fh)){const e=r;r=cf(e,"int32"),e.dispose()}nx(r),function(e){const t=(null==e?void 0:e.alpha)||1;if(t>1||t<0)throw new Error(`Alpha value ${t} is suppoed to be in range [0 - 1].`)}(null==n?void 0:n.imageOptions);const a={image:r},s={canvas:t,options:n};zh.runKernel(Ml,a,s)},fromPixels:rx,fromPixelsAsync:async function(e,t=3){let n=null;if(Do().getBool("WRAP_TO_IMAGEBITMAP")&&tx(e)){let t;try{t=await createImageBitmap(e,{premultiplyAlpha:"none"})}catch(gQ){t=null}n=null!=t&&t.width===e.width&&t.height===e.height?t:e}else n=e;return ex(n,t)},toPixels:async function(e,t){let n=Kh(e,"img","toPixels");if(!(e instanceof fh)){const e=n;n=cf(e,"int32"),e.dispose()}nx(n);const[r,a]=n.shape.slice(0,2),s=2===n.rank?1:n.shape[2],i=await n.data(),o="float32"===n.dtype?255:1,l=new Uint8ClampedArray(a*r*4);for(let u=0;u<r*a;++u){const e=[0,0,0,255];for(let r=0;r<s;r++){const t=i[u*s+r];if("float32"===n.dtype){if(t<0||t>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${t}.`)}else if("int32"===n.dtype&&(t<0||t>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${t}.`);1===s?(e[0]=t*o,e[1]=t*o,e[2]=t*o):e[r]=t*o}const t=4*u;l[t+0]=Math.round(e[0]),l[t+1]=Math.round(e[1]),l[t+2]=Math.round(e[2]),l[t+3]=Math.round(e[3])}if(null!=t){if(!YA){null!=rd(Ml,zh.backendName)&&(YA=!0)}t.width=a,t.height=r;const e=t.getContext("2d"),n=new ImageData(l,a,r);e.putImageData(n,0,0)}return n!==e&&n.dispose(),l}},Symbol.toStringTag,{value:"Module"}));function sx(e,t){const n=e.shape.length,r=t.shape.length;if(n<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);if(r<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${r}.`);if("int32"!==t.dtype)throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[r-1]>n)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[r-1]} vs. ${n}`);if(0===Ji(e.shape))throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);const a=t.shape,s=a[a.length-1];let i=1;for(let d=0;d<a.length-1;++d)i*=a[d];const o=e.shape,l=a.slice();l.pop();let u=1;for(let d=s;d<n;++d)u*=o[d],l.push(o[d]);const c=[...ko(e.shape).map((e=>e/u)),1].slice(0,s);return[l,i,u,c]}const ix=Object.freeze(Object.defineProperty({__proto__:null,prepareAndValidate:sx},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ox(e,t,n){const r=e.shape.length;Xi(r===t.length,(()=>`Error in slice${r}D: Length of begin ${t} must match the rank of the array (${r}).`)),Xi(r===n.length,(()=>`Error in slice${r}D: Length of size ${n} must match the rank of the array (${r}).`));for(let a=0;a<r;++a)Xi(t[a]+n[a]<=e.shape[a],(()=>`Error in slice${r}D: begin[${a}] + size[${a}] (${t[a]+n[a]}) would overflow input.shape[${a}] (${e.shape[a]})`))}function lx(e,t,n){const r=[];for(let a=0;a<e.length;a++)r[a]=Math.ceil((t[a]-e[a])/n[a]);return r}function ux(e,t,n,r){const a=[...e];for(let s=a.length;s<r.length;s++)a.push(1);for(let s=0;s<n;s++)0===s?a[t]=1:(a.splice(t,0,1),a.pop());return a}function cx(e,t,n){return n<=e?n:n-(t-1)}function dx(e,t){const n=[];for(let r=0;r<e;r++)n.push(t+r);return n}function hx(e,t,n,r,a){const s=[...a],i=dx(n,t);for(let o=0;o<s.length;o++)if(i.indexOf(o)>-1)s[o]=0;else{const a=cx(t,n,o);let i=r[a];e&1<<a&&(i=0),s[o]=i}return s}function px(e,t,n,r,a){const s=[...a],i=dx(n,t);for(let o=0;o<s.length;o++)if(i.indexOf(o)>-1)s[o]=Number.MAX_SAFE_INTEGER;else{const a=cx(t,n,o);let i=r[a];e&1<<a&&(i=Number.MAX_SAFE_INTEGER),s[o]=i}for(let o=0;o<s.length;o++){const e=a[o];s[o]<0&&(s[o]+=e),s[o]=Hi(0,s[o],a[o])}return s}function fx(e,t,n){let r=e[t];return(n&1<<t||null==r)&&(r=1),r}function mx(e,t,n,r,a,s){let i=t[a];const o=n[a]||1;(e&1<<a||s&1<<a||null==i)&&(i=o>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);const l=r[a];return i<0&&(i+=l),i=Hi(0,i,l-1),i}function gx(e,t,n,r,a,s){let i=t[a];const o=n[a]||1;(e&1<<a||s&1<<a||null==i)&&(i=o>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);const l=r[a];return i<0&&(i+=l),i=o>0?Hi(0,i,l):Hi(-1,i,l-1),i}function yx(e,t,n){let r=n.length;for(let a=0;a<n.length;a++)if(n[a]>1){r=a;break}for(let a=r+1;a<n.length;a++)if(t[a]>0||n[a]!==e[a])return!1;return!0}function bx(e,t){let n=e.length>0?e[e.length-1]:1;for(let r=0;r<e.length-1;r++)n+=e[r]*t[r];return n}function vx(e,t,n){let r;const a=e.shape.length;let s;return r="number"==typeof t?[t,...new Array(a-1).fill(0)]:t.length<a?t.concat(new Array(a-t.length).fill(0)):t.slice(),r.forEach((e=>{Xi(-1!==e,(()=>"slice() does not support negative begin indexing."))})),s=null==n?new Array(a).fill(-1):"number"==typeof n?[n,...new Array(a-1).fill(-1)]:n.length<a?n.concat(new Array(a-n.length).fill(-1)):n,s=s.map(((t,n)=>t>=0?t:(Xi(-1===t,(()=>`Negative size values should be exactly -1 but got ${t} for the slice() size at index ${n}.`)),e.shape[n]-r[n]))),[r,s]}function Ax(e,t,n,r,a,s,i,o,l){let u;if(null==r?(u=new Array(t.length),u.fill(1)):u=r,null!=i&&i&i-1)throw new Error("Multiple ellipses in slice is not allowed.");let c=!1;const d={dims:u.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:n.slice(),strides:u.slice(),beginMask:a,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};for(let b=0;b<d.dims;b++)c&&1<<b&o&&d.numAddAxisAfterEllipsis++,1<<b&i&&(c=!0);c||(d.ellipsisMask|=1<<d.dims,d.dims++);const h={dims:e.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};!function(e,t){t.beginMask=0,t.endMask=0,t.shrinkAxisMask=0;let n=0;t.beginValid=null!=e.begin,t.endValid=null!=e.end,t.begin=new Array(t.dims),t.end=new Array(t.dims),t.strides=new Array(t.dims),t.finalShapeGatherIndices=[],t.finalShapeGatherIndicesSparse=[],t.inputShapeGatherIndicesSparse=new Array(t.dims);for(let r=0;r<e.dims;r++)if(1<<r&e.ellipsisMask){const a=Math.min(t.dims-(e.dims-r)+1+e.numAddAxisAfterEllipsis,t.dims);for(;n<a;n++)t.begin[n]=0,t.end[n]=0,t.strides[n]=1,t.beginMask|=1<<n,t.endMask|=1<<n,t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(-1),t.inputShapeGatherIndicesSparse[n]=r}else if(1<<r&e.newAxisMask)t.finalShapeGatherIndices.push(-2),t.finalShapeGatherIndicesSparse.push(-1);else{if(n===t.begin.length)throw Error(`Index out of range using input dim ${n}; input has only ${t.dims} dims, ${t.begin.length}.`);null!=e.begin&&(t.begin[n]=e.begin[r]),null!=e.end&&(t.end[n]=e.end[r]),t.strides[n]=e.strides[r],e.beginMask&1<<r&&(t.beginMask|=1<<n),e.endMask&1<<r&&(t.endMask|=1<<n),e.shrinkAxisMask&1<<r?(t.finalShapeGatherIndices.push(-1),t.finalShapeGatherIndicesSparse.push(-1),t.shrinkAxisMask|=1<<n):(t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(r)),t.inputShapeGatherIndicesSparse[n]=r,n++}}(d,h);let p=!0,f=!0,m=!0;const g=[],y=[];for(let b=0;b<e.length;++b){if(0===h.strides[b])throw Error(`strides[${b}] must be non-zero`);const t=!!(h.shrinkAxisMask&1<<b),n=e[b];if(-1===n){g.push(t?1:-1);continue}const r=[h.beginMask&1<<b,h.endMask&1<<b],a=[h.strides[b]>0?0:-1,h.strides[b]>0?n:n-1];if(t&&h.strides[b]<=0)throw Error("only stride 1 allowed on non-range indexing.");m=m&&1===h.strides[b];const s=!!(h.beginMask&1<<b&&h.endMask&1<<b);if(h.beginValid&&h.endValid){if(t){const e=h.begin[b]<0?n+h.begin[b]:h.begin[b];if(h.begin[b]=e,h.end[b]=h.begin[b]+1,e<0||e>=n)throw Error(`slice index ${h.begin[b]} of dimension ${b} out of bounds.`)}else h.begin[b]=xx(h.begin[b],0,h.strides[b],n,r,a),h.end[b]=xx(h.end[b],1,h.strides[b],n,r,a);const e=1===h.strides[b]&&0===h.begin[b]&&h.end[b]===n;p=p&&e,f=f&&(0===b&&1===h.strides[b]||e)}else p=p&&1===h.strides[b]&&s,f=f&&(0===b&&1===h.strides[b]||s);let i,o=!1;if(h.beginValid&&h.endValid?(i=h.end[b]-h.begin[b],o=!0):t?(i=1,o=!0):s&&n>=0&&(i=h.strides[b]<0?-n:n,o=!0),o){let e;e=0===i||i<0!=h.strides[b]<0?0:Math.trunc(i/h.strides[b])+(i%h.strides[b]!=0?1:0),g.push(e)}else g.push(-1)}for(let b=0;b<h.finalShapeGatherIndices.length;++b){const e=h.finalShapeGatherIndices[b];e>=0?y.push(g[e]):-2===e&&y.push(1)}return{finalShapeSparse:y.filter(((e,t)=>-2!==h.finalShapeGatherIndices[t])),finalShape:y,isIdentity:p,sliceDim0:f,isSimpleSlice:m,begin:h.begin,end:h.end,strides:h.strides}}function xx(e,t,n,r,a,s){if(a[t])return n>0?s[t]:s[t+1&1];{const t=e<0?r+e:e;return t<s[0]?s[0]:t>s[1]?s[1]:t}}const kx=Object.freeze(Object.defineProperty({__proto__:null,assertParamsValid:ox,computeFlatOffset:bx,computeOutShape:lx,getNormalizedAxes:function(e,t,n,r,a,s,i,o,l){const u=e.length;let c=new Array(u),d=new Array(u),h=new Array(u);if(t.length&&n>0){const l=t[0],u=n+1;c=hx(i,l,u,r,e),d=px(o,l,u,a,e),h=ux(s,l,u,e)}else for(let p=0;p<u;p++)c[p]=mx(i,r,s,e,p,l),d[p]=gx(o,a,s,e,p,l),h[p]=fx(s,p,l);return{begin:c,end:d,strides:h}},isSliceContinous:yx,maskToAxes:function(e){const t=[];let n=0;for(;e>0;)1&e&&t.push(n),e/=2,n++;return t},parseSliceParams:vx,sliceInfo:Ax,startForAxis:mx,startIndicesWithElidedDims:hx,stopForAxis:gx,stopIndicesWithElidedDims:px,stridesForAxis:fx,stridesWithElidedDims:ux},Symbol.toStringTag,{value:"Module"}));
/** @license See the LICENSE file. */
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class wx{static sgd(e){return new EA(e)}static momentum(e,t,n=!1){return new RA(e,t,n)}static rmsprop(e,t=.9,n=0,r=null,a=!1){return new $A(e,t,n,r,a)}static adam(e=.001,t=.9,n=.999,r=null){return new TA(e,t,n,r)}static adadelta(e=.001,t=.95,n=null){return new WA(e,t,n)}static adamax(e=.002,t=.9,n=.999,r=null,a=0){return new NA(e,t,n,r,a)}static adagrad(e,t=.1){return new _A(e,t)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Sx=wx,Cx="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate?setImmediate:e=>e();
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Ix(){return new Promise((e=>Cx((()=>e()))))}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Wx(e,t){const n=e[0].length;e.forEach(((e,t)=>{Xi(e.length===n,(()=>`Error in concat${n}D: rank of tensors[${t}] must be the same as the rank of the rest (${n})`))})),Xi(t>=0&&t<n,(()=>`Error in concat${n}D: axis must be between 0 and ${n-1}.`));const r=e[0];e.forEach(((e,a)=>{for(let s=0;s<n;s++)Xi(s===t||e[s]===r[s],(()=>`Error in concat${n}D: Shape of tensors[${a}] (${e}) does not match the shape of the rest (${r}) along the non-concatenated axis ${a}.`))}))}function _x(e,t){const n=e[0].slice();for(let r=1;r<e.length;r++)n[t]+=e[r][t];return n}
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */var Tx,Nx;function Ex(e,t,n){let r=new Array;if(null==n&&null==t)return r;if(null==t)for(;r.length<e+n.length;)r.push(-1);else r=t.slice();if(null==n)return r;if(e+n.length!==r.length)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.rank = ${e+n.length}, but shape.rank = ${r.length}`);for(let a=1;a<n.length;++a){const s=n[a],i=r[r.length-n.length+a],o=r[i];if(s>=0)if(o>=0){if(o!==s)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.shape[${a+e}] = ${s} but shape[${a+e}] = ${o}`)}else r[i]=s}return r}function Rx(e){const t={FIRST_DIM_SIZE:Tx.FIRST_DIM_SIZE,VALUE_ROWIDS:Tx.VALUE_ROWIDS,ROW_LENGTHS:Tx.ROW_LENGTHS,ROW_SPLITS:Tx.ROW_SPLITS,ROW_LIMITS:Tx.ROW_LIMITS,ROW_STARTS:Tx.ROW_STARTS},n=[];for(const r of e){if(!(r in t))break;n.push(t[r])}return n}function $x(e){return 0===e.length?0:e[0]===Tx.FIRST_DIM_SIZE?e.length-1:e.length}function Ox(e,t){if(null==e||null==t)return;const n=e.length,r=t.length;if(n>=r)throw new Error(`defaultValue.shape=${e} and ragged tensor flatValues.shape=${t}, are incompatible: defaultValue.rank = ${n} must be less than ragged tensor input flatValues.rank = ${r})`);for(let a=0;a<Math.min(n,r-1);++a){const n=e[a],r=t[a+1];if(n>=0&&r>=0&&1!==n&&n!==r)throw new Error(`defaultValue.shape=${e}, and ragged tensor input flatValues.shape=${t} are incompatible: defaultValue.shape[${a-e.length}] = ${n} but ragged tensor input.flatValues.shape[${a-e.length}] = ${r}`)}}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(Nx=Tx||(Tx={}))[Nx.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",Nx[Nx.VALUE_ROWIDS=1]="VALUE_ROWIDS",Nx[Nx.ROW_LENGTHS=2]="ROW_LENGTHS",Nx[Nx.ROW_SPLITS=3]="ROW_SPLITS",Nx[Nx.ROW_LIMITS=4]="ROW_LIMITS",Nx[Nx.ROW_STARTS=5]="ROW_STARTS";function Fx(e){return e<=30?e:xo(e,Math.floor(Math.sqrt(e)))}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Dx(e,t,n){return[n*("number"==typeof e?e:e[0]),t*("number"==typeof e?e:e[1])]}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Mx(e,t,n,r=!0){let a=[];if(r)a=a.concat(t.slice(0)),a.push(e[0]/n),a=a.concat(e.slice(1));else{a=a.concat(e[0]);const n=t.length;for(let r=0;r<n;++r)a=a.concat([e[r+1]/t[r],t[r]]);a=a.concat(e.slice(n+1))}return a}function Lx(e,t,n=!0){const r=[];if(n){r.push(t);for(let n=t+1;n<e;++n)n<=2*t?(r.push(n),r.push(n-(t+1))):r.push(n)}else{const n=[],a=[];for(let r=1;r<e;++r)r>=2*t+1||r%2==1?a.push(r):n.push(r);r.push(...n),r.push(0),r.push(...a)}return r}function Bx(e,t,n,r=!0){const a=[];r?a.push(e[0]/n):a.push(e[0]*n);for(let s=1;s<e.length;++s)s<=t.length?r?a.push(t[s-1]*e[s]):a.push(e[s]/t[s-1]):a.push(e[s]);return a}function Px(e,t){const n=[0];for(let r=0;r<t;++r)n.push(e[r][0]);return n}function zx(e,t,n){const r=e.slice(0,1);for(let a=0;a<n;++a)r.push(e[a+1]-t[a][0]-t[a][1]);return r}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Gx=1.7580993408473768,Vx=1.0507009873554805,Ux=.3275911,Hx=.254829592,jx=-.284496736,qx=1.421413741,Qx=-1.453152027,Xx=1.061405429;
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function Zx(e,t){if(e.length!==t.length)throw new Error(`Cannot merge real and imag arrays of different lengths. real:${e.length}, imag: ${t.length}.`);const n=new Float32Array(2*e.length);for(let r=0;r<n.length;r+=2)n[r]=e[r/2],n[r+1]=t[r/2];return n}function Kx(e){const t=new Float32Array(e.length/2),n=new Float32Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=e[r],n[r/2]=e[r+1];return{real:t,imag:n}}function Jx(e){const t=Math.ceil(e.length/4),n=new Float32Array(t),r=new Float32Array(t);for(let a=0;a<e.length;a+=4)n[Math.floor(a/4)]=e[a],r[Math.floor(a/4)]=e[a+1];return{real:n,imag:r}}function Yx(e){const t=Math.floor(e.length/4),n=new Float32Array(t),r=new Float32Array(t);for(let a=2;a<e.length;a+=4)n[Math.floor(a/4)]=e[a],r[Math.floor(a/4)]=e[a+1];return{real:n,imag:r}}function ek(e,t){return{real:e[2*t],imag:e[2*t+1]}}function tk(e,t,n,r){e[2*r]=t,e[2*r+1]=n}function nk(e,t){const n=new Float32Array(e/2),r=new Float32Array(e/2);for(let a=0;a<Math.ceil(e/2);a++){const s=(t?2:-2)*Math.PI*(a/e);n[a]=Math.cos(s),r[a]=Math.sin(s)}return{real:n,imag:r}}function rk(e,t,n){const r=(n?2:-2)*Math.PI*(e/t);return{real:Math.cos(r),imag:Math.sin(r)}}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ak="->",sk=/->/g;function ik(e,t){const n=((e=e.replace(/\s/g,"")).length-e.replace(sk,"").length)/2;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${ak}").`);const[r,a]=e.split(ak);Xi(-1===r.indexOf("..."),(()=>'The ellipsis notation ("...") is not supported yet.'));const s=r.split(","),i=s.length;if(t!==i)throw new Error(`Expected ${i} input tensors, received ${t}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const o=[];for(let d=0;d<a.length;++d){const e=a[d];if(!s.some((t=>-1!==t.indexOf(e))))throw new Error(`Output subscripts contain the label ${e} not present in the input subscripts.`);-1===o.indexOf(e)&&o.push(e)}for(let d=0;d<r.length;++d){const e=r[d];-1===o.indexOf(e)&&","!==e&&o.push(e)}const l=new Array(s.length);for(let d=0;d<i;++d){if(new Set(s[d].split("")).size!==s[d].length)throw new Error(`Found duplicate axes in input component ${s[d]}. Support for duplicate axes in input is not implemented yet.`);l[d]=[];for(let e=0;e<s[d].length;++e)l[d].push(o.indexOf(s[d][e]))}const u=o.length,c=[];for(let d=a.length;d<u;++d)c.push(d);return{allDims:o,summedDims:c,idDims:l}}function ok(e,t){let n=new Array(e);n.fill(-1);for(let a=0;a<t.length;++a)n[t[a]]=a;const r=[];for(let a=0;a<e;++a)-1===n[a]&&r.push(a);return n=n.filter((e=>-1!==e)),{permutationIndices:n,expandDims:r}}function lk(e,t,n){const r=new Array(e);for(let a=0;a<n.length;++a){const e=n[a].shape;for(let n=0;n<t[a].length;++n)void 0===r[t[a][n]]?r[t[a][n]]=e[n]:Xi(r[t[a][n]]===e[n],(()=>`Expected dimension ${r[t[a][n]]} at axis ${n} of input shaped ${JSON.stringify(e)}, but got dimension ${e[n]}`))}}function uk(e,t){const n=e,r=[];let a=0;0===e.length&&n.push(-1),a=e.length+1;for(let i=0;i<a;++i)r.push([]);const s=[];for(let i=0;i<n.length;++i){const e=dk(t,n[i]);for(const t of e)-1===s.indexOf(t)&&(r[i].push(t),s.push(t))}return{path:n,steps:r}}function ck(e){return e.every(((e,t)=>e===t))}function dk(e,t){const n=[];for(let r=0;r<e.length;++r)0!==e[r].length&&-1===e[r].indexOf(t)&&-1!==t||n.push(r);return n}function hk(e,t,n=0){let r=[];if("number"==typeof t)Xi(e.shape[n]%t==0,(()=>"Number of splits must evenly divide the axis.")),r=new Array(t).fill(e.shape[n]/t);else{Xi(t.reduce(((e,t)=>(-1===t&&(e+=1),e)),0)<=1,(()=>"There should be only one negative value in split array."));const a=t.indexOf(-1);if(-1!==a){const r=t.reduce(((e,t)=>t>0?e+t:e));t[a]=e.shape[n]-r}Xi(e.shape[n]===t.reduce(((e,t)=>e+t)),(()=>"The sum of sizes must match the size of the axis dimension.")),r=t}return r}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function pk(e){return`Received SparseTensor with denseShape[0] = 0 but\n  indices.shape[0] = ${e}`}function fk(e,t){return`indices(${e}, 0) is invalid: ${t} < 0`}function mk(e,t,n){return`indices(${e}, 0) is invalid: ${t} >= ${n}`}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function gk(e,t){return`only one output dimension may be -1, not both ${e} and ${t}`}function yk(e,t){return`size ${e} must be non-negative, not ${t}`}function bk(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function vk(e,t){return`Input to reshape is a SparseTensor with ${Ji(e)}\n  dense values, but the requested shape requires a multiple of ${Ji(t)}. inputShape=${e} outputShape= ${t}`}function Ak(e,t){return`Input to reshape is a tensor with ${Ji(e)} dense values, but the requested shape has ${Ji(t)}. inputShape=${e} outputShape=${t}`}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function xk(){return"segment ids must be >= 0"}function kk(){return"segment ids are not increasing"}function wk(e,t){return`Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`}function Sk(e,t,n){return`Bad: indices[${e}] == ${t} out of range [0, ${n})`}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Ck(e,t){let n,r=!1;for(e<=30?(n=e,r=!0):n=xo(e,Math.floor(Math.sqrt(e)));!r;)n>t||n===e?r=!0:n=xo(e,n+1);return n}function Ik(e,t,n){const r=[],a=e.length;for(let s=0;s<a;s++)s!==t?r.push(e[s]):r.push(n);return r}function Wk(e,t,n,r){const a=t.shape.length,s=e.shape.length;if(0!==r&&(r<-a||r>a))throw new Error(`Expect batchDims in the range of [-${a}, ${a}], but got ${r}`);if(r<0&&(r+=a),r>s)throw new Error(`batchDims (${r}) must be less than rank(x) (\n    ${s}).`);if(n<r)throw new Error(`batchDims (${r}) must be less than or equal to axis (${n}).`);for(let d=0;d<r;++d)if(e.shape[d]!==t.shape[d])throw new Error(`x.shape[${d}]: ${e.shape[d]} should be equal to indices.shape[${d}]: ${t.shape[d]}.`);const i=e.shape[n],o=[];let l=1,u=1,c=1;for(let d=0;d<r;++d)o.push(e.shape[d]),l*=e.shape[d];for(let d=r;d<n;d++)o.push(e.shape[d]),u*=e.shape[d];for(let d=r;d<a;d++)o.push(t.shape[d]);for(let d=n+1;d<s;d++)o.push(e.shape[d]),c*=e.shape[d];return{batchSize:l,sliceSize:c,outerSize:u,dimSize:i,outputShape:o}}const _k=Object.freeze(Object.defineProperty({__proto__:null,collectGatherOpShapeInfo:Wk,computeOutShape:Ik,segOpComputeOptimalWindowSize:Ck},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Tk(e){try{return e.map((e=>Yd(e)))}catch(RZ){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${RZ}`)}}function Nk(e){return e.map((e=>Jd(e)))}const Ek=Object.freeze(Object.defineProperty({__proto__:null,ERF_A1:Hx,ERF_A2:jx,ERF_A3:qx,ERF_A4:Qx,ERF_A5:Xx,ERF_P:Ux,PARALLELIZE_THRESHOLD:30,get RowPartitionType(){return Tx},SELU_SCALE:Vx,SELU_SCALEALPHA:Gx,applyActivation:mv,assertAndGetBroadcastShape:Om,assertAxesAreInnerMostDims:Xm,assertParamsConsistent:Wx,assignToTypedArray:tk,axesAreInnerMostDims:Hm,calculateShapes:Ub,checkEinsumDimSizes:lk,checkPadOnDimRoundingMode:Uf,combineLocations:jm,combineRaggedTensorToTensorShapes:Ex,complexWithEvenIndex:Jx,complexWithOddIndex:Yx,computeConv2DInfo:$f,computeConv3DInfo:Of,computeDefaultPad:Ff,computeDilation2DInfo:Nf,computeOptimalWindowSize:Fx,computeOutAndReduceShapes:qm,computeOutShape:_x,computePool2DInfo:Ef,computePool3DInfo:Rf,convertConv2DDataFormat:Vf,decodeEinsumEquation:ik,eitherStridesOrDilationsAreOne:zf,expandShapeToKeepDim:Qm,exponent:rk,exponents:nk,fromStringArrayToUint8:Nk,fromUint8ToStringArray:Tk,getAxesPermutation:Zm,getBroadcastDims:Rm,getComplexWithIndex:ek,getEinsumComputePath:uk,getEinsumPermutation:ok,getFusedBiasGradient:fv,getFusedDyActivation:pv,getImageCenter:Dx,getInnerMostAxes:Jm,getPermuted:Lx,getRaggedRank:$x,getReductionAxes:$m,getReshaped:Mx,getReshapedPermuted:Bx,getRowPartitionTypesHelper:Rx,getSliceBeginCoords:Px,getSliceSize:zx,getSparseFillEmptyRowsIndicesDenseShapeMismatch:pk,getSparseFillEmptyRowsNegativeIndexErrorMessage:fk,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:mk,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:bk,getSparseReshapeInputOutputMismatchErrorMessage:Ak,getSparseReshapeInputOutputMultipleErrorMessage:vk,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:gk,getSparseReshapeNegativeOutputDimErrorMessage:yk,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:Sk,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:xk,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:kk,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:wk,getUndoAxesPermutation:Km,isIdentityPermutation:ck,log:function(...e){!Do().getBool("IS_TEST")&&Do().getBool("PROD")},mergeRealAndImagArrays:Zx,prepareAndValidate:sx,prepareSplitSize:hk,segment_util:_k,shouldFuse:gv,slice_util:kx,splitRealAndImagArrays:Kx,stridesOrDilationsArePositive:Gf,tupleValuesAreOne:Pf,upcastType:_h,validateDefaultValueShape:Ox,validateInput:Vb,validateUpdateShape:Gb,warn:ed},Symbol.toStringTag,{value:"Module"})),Rk=Object.freeze(Object.defineProperty({__proto__:null,nonMaxSuppressionV3Impl:Dv,nonMaxSuppressionV4Impl:Mv,nonMaxSuppressionV5Impl:Lv,whereImpl:ev},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
!function(){for(const e of OA)SA(e)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */();const $k=Object.freeze(Object.defineProperty({__proto__:null,Abs:zo,Acos:Go,Acosh:Vo,AdadeltaOptimizer:WA,AdagradOptimizer:_A,AdamOptimizer:TA,AdamaxOptimizer:NA,Add:Uo,AddN:Ho,All:jo,Any:qo,ArgMax:Qo,ArgMin:Xo,Asin:Zo,Asinh:Ko,Atan:Jo,Atan2:el,Atanh:Yo,AvgPool:tl,AvgPool3D:rl,AvgPool3DGrad:al,AvgPoolGrad:nl,BatchMatMul:sl,BatchToSpaceND:il,Bincount:ol,BitwiseAnd:ll,BroadcastArgs:cl,BroadcastTo:ul,Cast:dl,Ceil:hl,ClipByValue:pl,Complex:fl,ComplexAbs:ml,Concat:gl,Conv2D:yl,Conv2DBackpropFilter:bl,Conv2DBackpropInput:vl,Conv3D:Al,Conv3DBackpropFilterV2:xl,Conv3DBackpropInputV2:kl,Cos:wl,Cosh:Sl,CropAndResize:Wl,Cumprod:Cl,Cumsum:Il,DataStorage:zi,DenseBincount:_l,DepthToSpace:Tl,DepthwiseConv2dNative:Nl,DepthwiseConv2dNativeBackpropFilter:El,DepthwiseConv2dNativeBackpropInput:Rl,Diag:$l,Dilation2D:Ol,Dilation2DBackpropFilter:Dl,Dilation2DBackpropInput:Fl,Draw:Ml,get ENV(){return Lo},Einsum:Bl,Elu:Pl,EluGrad:zl,Environment:Oo,Equal:Vl,Erf:Gl,Exp:Ul,ExpandDims:Hl,Expm1:jl,FFT:ql,Fill:Ql,FlipLeftRight:Xl,Floor:Zl,FloorDiv:Kl,FromPixels:Xc,FusedBatchNorm:Jl,FusedConv2D:Jc,FusedDepthwiseConv2D:Yc,GatherNd:eu,GatherV2:Yl,Greater:tu,GreaterEqual:nu,IFFT:au,Identity:ru,Imag:su,IsFinite:iu,IsInf:ou,IsNan:lu,KernelBackend:Gi,LRN:vu,LRNGrad:Au,LeakyRelu:uu,Less:cu,LessEqual:du,LinSpace:hu,Log:pu,Log1p:fu,LogSoftmax:bu,LogicalAnd:mu,LogicalNot:gu,LogicalOr:yu,LogicalXor:"LogicalXor",LowerBound:"LowerBound",MatrixBandPart:"MatrixBandPart",Max:xu,MaxPool:wu,MaxPool3D:Cu,MaxPool3DGrad:Iu,MaxPoolGrad:Su,MaxPoolWithArgmax:Wu,Maximum:ku,Mean:_u,Min:Tu,Minimum:Nu,MirrorPad:Eu,Mod:Ru,MomentumOptimizer:RA,Multinomial:$u,Multiply:Ou,Neg:Fu,NonMaxSuppressionV3:Mu,NonMaxSuppressionV4:Lu,NonMaxSuppressionV5:Bu,NotEqual:Du,OP_SCOPE_SUFFIX:Yh,OneHot:zu,OnesLike:Pu,Optimizer:IA,OptimizerConstructors:wx,Pack:Gu,PadV2:Vu,Pool:"Pool",Pow:Uu,Prelu:Hu,Prod:ju,RMSPropOptimizer:$A,RaggedGather:qu,RaggedRange:Qu,RaggedTensorToTensor:Xu,Range:Zu,get Rank(){return yh},Real:Ku,RealDiv:Ll,Reciprocal:Ju,get Reduction(){return nA},Relu:Yu,Relu6:sc,Reshape:ec,ResizeBilinear:rc,ResizeBilinearGrad:ac,ResizeNearestNeighbor:tc,ResizeNearestNeighborGrad:nc,Reverse:ic,RotateWithOffset:Zc,Round:oc,Rsqrt:lc,SGDOptimizer:EA,ScatterNd:uc,SearchSorted:dc,Select:hc,Selu:pc,Sigmoid:bc,Sign:yc,Sin:mc,Sinh:gc,Slice:fc,Softmax:Sc,Softplus:vc,SpaceToBatchND:kc,SparseFillEmptyRows:Cc,SparseReshape:Ic,SparseSegmentMean:Wc,SparseSegmentSum:_c,SparseToDense:Tc,SplitV:wc,Sqrt:Ac,Square:Ec,SquaredDifference:Nc,StaticRegexReplace:Rc,Step:Qc,StridedSlice:$c,StringNGrams:Oc,StringSplit:Fc,StringToHashBucketFast:Dc,Sub:Mc,Sum:xc,Tan:Lc,Tanh:Bc,Tensor:fh,TensorBuffer:dh,TensorScatterUpdate:cc,Tile:Pc,TopK:zc,Transform:Gc,Transpose:Vc,Unique:Uc,Unpack:Hc,UnsortedSegmentSum:jc,UpperBound:"UpperBound",Variable:gh,ZerosLike:qc,_FusedMatMul:Kc,abs:yf,acos:bf,acosh:vf,add:pf,addN:Af,all:xf,any:kf,argMax:wf,argMin:Sf,asin:Cf,asinh:If,atan:Wf,atan2:_f,atanh:Tf,avgPool:jf,avgPool3d:qf,backend:pp,backend_util:Ek,basicLSTMCell:Yf,batchNorm:tm,batchNorm2d:nm,batchNorm3d:rm,batchNorm4d:am,batchToSpaceND:em,bincount:sm,bitwiseAnd:im,booleanMaskAsync:nv,broadcastArgs:om,broadcastTo:lm,broadcast_util:Fm,browser:ax,buffer:uf,cast:cf,ceil:um,clipByValue:dm,clone:df,complex:tp,concat:Qf,concat1d:hm,concat2d:pm,concat3d:fm,concat4d:mm,conv1d:ym,conv2d:gm,conv2dTranspose:vm,conv3d:Am,conv3dTranspose:km,copyRegisteredKernels:function(e,t){sd(e).forEach((e=>{id(Object.assign({},e,{backendName:t}))}))},cos:wm,cosh:Sm,cosineWindow:cv,cumprod:Cm,cumsum:Im,customGrad:Ng,denseBincount:Wm,deprecationWarn:function(e){Do().getBool("DEPRECATION_WARNINGS_ENABLED")},depthToSpace:_m,depthwiseConv2d:Tm,device_util:jh,diag:Nm,dilation2d:Em,disableDeprecationWarnings:function(){Do().set("DEPRECATION_WARNINGS_ENABLED",!1)},dispose:up,disposeVariables:function(){zh.disposeVariables()},div:mf,divNoNan:Bm,dot:Pm,dropout:lv,einsum:zm,elu:Gm,enableDebugMode:function(){Do().set("DEBUG",!0)},enableProdMode:function(){Do().set("PROD",!0)},enclosingPowerOfTwo:uv,engine:ip,ensureShape:Vm,env:Do,equal:Dm,erf:Um,euclideanNorm:lg,exp:ug,expandDims:cg,expm1:dg,eye:pg,fft:Cb,fill:cm,findBackend:function(e){return zh.findBackend(e)},findBackendFactory:function(e){return zh.findBackendFactory(e)},floor:fg,floorDiv:ff,fused:kv,gather:mg,gatherND:ov,gather_util:ix,getBackend:dp,getGradient:ad,getKernel:rd,getKernelsForBackend:sd,grad:function(e){return Xi(Ao(e),(()=>"The f passed in grad(f) must be a function")),(t,n)=>{const r=Kh(t,"x","tf.grad","string_or_numeric"),a=null!=n?Kh(n,"dy","tf.grad"):null;return zh.tidy((()=>{const{value:t,grads:n}=zh.gradients((()=>e(r)),[r],a);return null!=a&&Zi(t.shape,a.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Eg(n),n[0]}))}},grads:function(e){return Xi(Ao(e),(()=>"The f passed in grads(f) must be a function")),(t,n)=>{Xi(Array.isArray(t),(()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"));const r=Jh(t,"args","tf.grads","string_or_numeric"),a=null!=n?Kh(n,"dy","tf.grads"):null;return zh.tidy((()=>{const{value:t,grads:n}=zh.gradients((()=>e(...r)),r,a);return null!=a&&Zi(t.shape,a.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Eg(n),n}))}},greater:gg,greaterEqual:yg,ifft:Ib,imag:bg,image:mA,inTopKAsync:dv,io:XA,irfft:Wb,isFinite:vg,isInf:Ag,isNaN:xg,keep:cp,kernel_impls:Rk,leakyRelu:kg,less:wg,lessEqual:Sg,linalg:gA,linspace:Cg,localResponseNormalization:Ig,log:Wg,log1p:_g,logSigmoid:Og,logSoftmax:Dg,logSumExp:Mg,logicalAnd:Lg,logicalNot:Bg,logicalOr:Pg,logicalXor:zg,losses:yA,lowerBound:Ug,matMul:Xf,math:KA,max:Ym,maxPool:Hg,maxPool3d:jg,maxPoolWithArgmax:qg,maximum:Qg,mean:Xg,memory:op,meshgrid:Jg,min:eg,minimum:Yg,mirrorPad:ey,mod:ty,moments:ny,movingAverage:av,mul:gf,multiRNNCell:ry,multinomial:ay,neg:Rg,nextFrame:Ix,norm:og,notEqual:sy,oneHot:iy,ones:Kg,onesLike:oy,op:ep,outerProduct:ly,pad:uy,pad1d:cy,pad2d:dy,pad3d:hy,pad4d:py,pool:my,pow:tg,prelu:gy,print:hf,prod:yy,profile:function(e){return zh.profile(e)},raggedGather:by,raggedRange:vy,raggedTensorToTensor:Ay,rand:xy,randomGamma:Ky,randomNormal:Jy,randomStandardNormal:Yy,randomUniform:eb,randomUniformInt:tb,range:nb,ready:function(){return zh.ready()},real:rb,reciprocal:ab,registerBackend:hp,registerGradient:od,registerKernel:id,relu:sb,relu6:ib,removeBackend:function(e){zh.removeBackend(e)},reshape:Hf,reverse:ob,reverse1d:lb,reverse2d:ub,reverse3d:cb,reverse4d:db,rfft:Tb,round:hb,rsqrt:pb,scalar:ng,scatterND:sv,scatter_util:Hb,searchSorted:Vg,selu:fb,separableConv2d:mb,serialization:CA,setBackend:function(e){return zh.setBackend(e)},setPlatform:function(e,t){Do().setPlatform(e,t)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */,setdiff1dAsync:gb,sigmoid:Zf,sign:yb,signal:fA,sin:bb,sinh:vb,slice:Kf,slice1d:Ab,slice2d:xb,slice3d:kb,slice4d:wb,slice_util:kx,softmax:Sb,softplus:$g,spaceToBatchND:fy,sparse:bA,sparseToDense:iv,spectral:pA,split:_b,sqrt:rg,square:ag,squaredDifference:Nb,squeeze:Eb,stack:Rb,step:$b,stridedSlice:Ob,string:vA,sub:Fg,sum:sg,sumOutType:Th,tan:Fb,tanh:Jf,tensor:rp,tensor1d:Db,tensor2d:Mb,tensor3d:Lb,tensor4d:Bb,tensor5d:Pb,tensor6d:zb,tensorScatterUpdate:jb,tensor_util:Dh,test_util:qy,tidy:lp,tile:hg,time:function(e){return zh.time(e)},topk:qb,train:Sx,transpose:rv,truncatedNormal:Qb,unique:Xb,unregisterGradient:function(e){if(!nd.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);nd.delete(e)},unregisterKernel:function(e,t){const n=ld(e,t);if(!td.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);td.delete(n)},unsortedSegmentSum:Zb,unstack:Kb,upcastType:_h,upperBound:Jb,util:nh,valueAndGrad:function(e){return Xi(Ao(e),(()=>"The f passed in valueAndGrad(f) must be a function")),(t,n)=>{Xi(t instanceof fh,(()=>"The x passed in valueAndGrad(f)(x) must be a tensor")),Xi(null==n||n instanceof fh,(()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"));const{grads:r,value:a}=zh.gradients((()=>e(t)),[t],n);return Eg(r),{grad:r[0],value:a}}},valueAndGrads:function(e){return Xi(Ao(e),(()=>"The f passed in valueAndGrads(f) must be a function")),(t,n)=>{Xi(Array.isArray(t)&&t.every((e=>e instanceof fh)),(()=>"The args passed in valueAndGrads(f)(args) must be array of tensors")),Xi(null==n||n instanceof fh,(()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"));const r=zh.gradients((()=>e(...t)),t,n);return null!=n&&Zi(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Eg(r.grads),r}},variable:Yb,variableGrads:Tg,version_core:"4.22.0",where:Mm,whereAsync:tv,zeros:Zg,zerosLike:Lm},Symbol.toStringTag,{value:"Module"})),Ok={kernelName:zo,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(e,$b(cf(n,"float32"),-1))}}},Fk={kernelName:Go,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=ag(cf(n,"float32")),r=rg(Fg(ng(1),t));return Rg(mf(e,r))}}}},Dk={kernelName:Vo,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=rg(Fg(ag(cf(n,"float32")),1));return mf(e,t)}}}},Mk={kernelName:Uo,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Om(n.shape,r.shape);return{a:()=>{let t=e;const r=$m(n.shape,a);return r.length>0&&(t=sg(t,r)),Hf(t,n.shape)},b:()=>{let t=e;const n=$m(r.shape,a);return n.length>0&&(t=sg(t,n)),Hf(t,r.shape)}}}},Lk={kernelName:Ho,saveAllInputs:!0,gradFunc:(e,t)=>{const n={};return t.forEach(((t,r)=>{n[r]=()=>e.clone()})),n}},Bk={kernelName:Qo,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>Lm(n)}}},Pk={kernelName:Xo,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>Lm(n)}}},zk={kernelName:Zo,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,rg(Fg(ng(1),ag(cf(n,"float32")))))}}},Gk={kernelName:Ko,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=rg(pf(ng(1),ag(cf(n,"float32"))));return mf(e,t)}}}},Vk={kernelName:el,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Om(n.shape,r.shape);return{a:()=>{const t=pf(ag(n),ag(r));let s=gf(e,mf(r,t));const i=$m(n.shape,a);return i.length>0&&(s=sg(s,i)),Hf(s,n.shape)},b:()=>{const t=pf(ag(n),ag(r));let s=Rg(gf(e,mf(n,t)));const i=$m(r.shape,a);return i.length>0&&(s=sg(s,i)),Hf(s,r.shape)}}}},Uk={kernelName:Jo,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,pf(ag(cf(n,"float32")),1))}}},Hk={kernelName:Yo,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,Fg(ng(1),ag(cf(n,"float32"))))}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jk=ep({avgPool3dGrad_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r,a,s){const i=Kh(e,"dy","avgPool3dGrad"),o=Kh(t,"input","avgPool3dGrad");let l=i,u=o,c=!1;4===o.rank&&(c=!0,l=Hf(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),u=Hf(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),Xi(5===l.rank,(()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`)),Xi(5===u.rank,(()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${u.rank}.`)),Uf("avgPool3dGrad",a,s);const d={dy:l,input:u},h={filterSize:n,strides:r,pad:a,dimRoundingMode:s},p=zh.runKernel(al,d,h);return c?Hf(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}}),qk={kernelName:rl,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{filterSize:a,strides:s,pad:i,dimRoundingMode:o}=n;return{x:()=>jk(e,r,a,s,i,o)}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Qk=ep({avgPoolGrad_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r,a){const s=Kh(e,"dy","avgPoolGrad"),i=Kh(t,"input","avgPoolGrad");Xi(i.rank===s.rank,(()=>`Rank of input (${i.rank}) does not match rank of dy (${s.rank})`));let o=i,l=s,u=!1;3===i.rank&&(u=!0,o=Hf(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=Hf(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Xi(4===l.rank,(()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`)),Xi(4===o.rank,(()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${o.rank}.`));const c={dy:l,input:o},d={filterSize:n,strides:r,pad:a},h=zh.runKernel(nl,c,d);return u?Hf(h,[h.shape[1],h.shape[2],h.shape[3]]):h}}),Xk={kernelName:tl,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{filterSize:a,strides:s,pad:i}=n;return{x:()=>Qk(e,r,a,s,i)}}},Zk={kernelName:sl,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{const[r,a]=t,{transposeA:s,transposeB:i}=n;return s||i?!s&&i?{a:()=>Xf(e,a,!1,!1),b:()=>Xf(e,r,!0,!1)}:s&&!i?{a:()=>Xf(a,e,!1,!0),b:()=>Xf(r,e,!1,!1)}:{a:()=>Xf(a,e,!0,!0),b:()=>Xf(e,r,!0,!0)}:{a:()=>Xf(e,a,!1,!0),b:()=>Xf(r,e,!0,!1)}}},Kk={kernelName:il,gradFunc:(e,t,n)=>{const{blockShape:r,crops:a}=n;return{x:()=>fy(e,r,a)}}},Jk={kernelName:ul,gradFunc:(e,t,n)=>{const r=n,a=r.inputShape,s=r.shape,i=Array.from(s);for(let l=a.length-1;l>=0;l--)if(a[l]===s[l])i[l]=1;else if(1!==a[l])throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${s}].`);const o=[];for(let l=0;l<i.length;l++)i[l]>1&&o.push(l);return{x:()=>sg(e,o,!0)}}},Yk={kernelName:dl,gradFunc:e=>({x:()=>e.clone()})},ew={kernelName:hl,gradFunc:e=>({x:()=>Lm(e)})},tw={kernelName:pl,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{clipValueMin:a,clipValueMax:s}=n;return{x:()=>Mm(Lg(yg(r,a),Sg(r,s)),e,Lm(e))}}},nw={kernelName:ml,inputsToSave:["x"],gradFunc:Ok.gradFunc},rw={kernelName:gl,saveAllInputs:!0,gradFunc:(e,t,n)=>{const r=t.map((e=>e.shape)),{axis:a}=n,s=io(a,t[0].shape)[0],i=r.map((e=>e[s]));return _b(e,i,s).map((e=>()=>e))}},aw={kernelName:yl,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const[r,a]=t,{dilations:s,strides:i,pad:o,dataFormat:l}=n;return Xi(Pf(s),(()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`)),{x:()=>bm(r.shape,e,a,i,o,l),filter:()=>hv(r,e,a.shape,i,o,l)}}},sw={kernelName:vl,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{const[r,a]=t,{strides:s,pad:i,dataFormat:o,dimRoundingMode:l}=n;return{dy:()=>gm(e,a,s,i,o,1,l),filter:()=>hv(e,r,a.shape,s,i,o,l)}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const iw=ep({conv3DBackpropFilter_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r,a){let s=e;4===e.rank&&(s=Hf(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let i=t;4===i.rank&&(i=Hf(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),Xi(5===s.rank,(()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${s.shape}.`)),Xi(5===i.rank,(()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`)),Xi(5===n.length,(()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`)),Xi(s.shape[4]===n[3],(()=>`Error in conv3dDerFilter: depth of input ${s.shape[4]}) must match input depth in filter (${n[3]}.`)),Xi(i.shape[4]===n[4],(()=>`Error in conv3dDerFilter: depth of dy (${i.shape[4]}) must match output depth for filter (${n[4]}).`));const o={x:s,dy:i},l={strides:r,pad:a,filterShape:n};return zh.runKernel(xl,o,l)}}),ow={kernelName:Al,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:r,strides:a,pad:s}=n;Xi(Pf(r),(()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${r}'`));const[i,o]=t;return{x:()=>xm(i.shape,e,o,a,s),filter:()=>iw(i,e,o.shape,a,s)}}},lw={kernelName:wl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(Rg(bb(cf(n,"float32"))),e)}}},uw={kernelName:Sl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(vb(cf(n,"float32")),e)}}},cw={kernelName:Il,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{axis:a,exclusive:s,reverse:i}=n;return{x:()=>{const t=Zm([a],r.rank);let n=Im(e,a,s,!i);return null!=t&&(n=rv(n,t)),n}}}},dw={kernelName:Nl,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:r,strides:a,pad:s,dimRoundingMode:i}=n,o=null==r?[1,1]:r;Xi(Pf(o),(()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${o}'`));const[l,u]=t;return Xi(4===l.rank,(()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`)),Xi(4===u.rank,(()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${u.rank}.`)),Xi(l.shape[3]===u.shape[2],(()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${u.shape[2]}.`)),Xi(zf(a,o),(()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be  1. Got strides ${a} and dilations '${o}'.`)),Uf("depthwiseConv2d",s,i),{x:()=>vv(l.shape,e,u,a,s,o,i),filter:()=>bv(l,e,u.shape,a,s,o,i)}}},hw={kernelName:Ol,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const[r,a]=t,s={x:r,filter:a,dy:e},i={x:r,filter:a,dy:e};return{x:()=>zh.runKernel(Fl,s,n),filter:()=>zh.runKernel(Dl,i,n)}}},pw={kernelName:Pl,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t,r={dy:e,y:n};return{x:()=>zh.runKernel(zl,r)}}},fw={kernelName:Gl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,r=gf(ug(Rg(ag(n))),2/Math.sqrt(Math.PI));return{x:()=>gf(e,r)}}},mw={kernelName:Ul,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(e,n)}}},gw={kernelName:Hl,inputsToSave:["input"],gradFunc:(e,t)=>{const[n]=t;return{input:()=>Hf(e,n.shape)}}},yw={kernelName:jl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(e,ug(n))}}},bw={kernelName:Zl,gradFunc:e=>({x:()=>Lm(e)})},vw={kernelName:Kl,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Om(n.shape,r.shape);return{a:()=>{const t=mf(e,cf(r,"float32")),s=$m(n.shape,a);return s.length>0?Hf(sg(t,s),n.shape):t},b:()=>{let t=gf(e,cf(n,"float32"));const s=$m(r.shape,a);s.length>0&&(t=Hf(sg(t,s),r.shape));const i=ag(r);return Rg(mf(t,cf(i,"float32")))}}}},Aw={kernelName:Jl,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{const{varianceEpsilon:r}=n,[a,s,i,o]=t,l=null==o?ng(1):o,u=$m(s.shape,a.shape),c=[];if(1===s.rank){for(let e=0;e<a.shape.length-1;++e)c.push(a.shape[e]);c.push(1)}const d=Fg(a,s),h=gf(e,l),p=pb(pf(i,ng(r))),f=gf(gf(gf(p,p),p),ng(-.5));return{x:()=>1===s.rank?Hf(gf(gf(e,hg(Hf(p,[1,1,1,s.shape[0]]),c)),l),a.shape):Hf(gf(gf(e,p),l),a.shape),mean:()=>{let e=gf(gf(p,ng(-1)),h);return 1===s.rank&&(e=sg(e,u)),Hf(e,s.shape)},variance:()=>{let e=gf(gf(f,d),h);return 1===s.rank&&(e=sg(e,u)),Hf(e,s.shape)},scale:()=>{const t=gf(d,p);let n=gf(e,t);return 1===s.rank&&(n=sg(n,u)),Hf(n,s.shape)},offset:()=>{let t=e;return 1===s.rank&&(t=sg(t,u)),Hf(t,s.shape)}}}},xw={kernelName:Yl,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{const[r,a]=t,{axis:s,batchDims:i}=n,o=io(s,r.shape)[0],l=(e,t,n)=>()=>{const r=e.shape,a=t.size,i=r.slice(0,o),l=i.length,u=r.slice(s,r.length).slice(1),c=u.length,d=kw(0,l),h=kw(l+1,l+1+c),p=ww([i,[a],u]),f=Hf(n,p),m=Hf(t,[a]),g=ww([[l],d,h]),y=rv(f,g);let b=Zb(y,m,e.shape[o]);const v=Km(g);return b=rv(b,v),b};if(1===i){const t=r.shape[0],n=r.split(t,0);return{x:()=>Rb(n.map(((t,n)=>l(t,a.slice(n,1),e.slice(n,1))()))).reshape(r.shape),indices:()=>a}}return{x:l(r,a,e),indices:()=>a}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function kw(e,t){const n=[];for(let r=e;r<t;++r)n.push(r);return n}function ww(e){const t=[];for(let n=0;n<e.length;++n)for(let r=0;r<e[n].length;++r)t.push(e[n][r]);return t}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Sw={kernelName:nu,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>Lm(n),b:()=>Lm(r)}}},Cw={kernelName:ru,gradFunc:e=>({x:()=>cf(e,"float32")})},Iw={kernelName:iu,gradFunc:e=>({x:()=>Lm(e)})},Ww={kernelName:ou,gradFunc:e=>({x:()=>Lm(e)})},_w={kernelName:lu,gradFunc:e=>({x:()=>Lm(e)})},Tw={kernelName:uu,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{alpha:a}=n,s=gg(r,0);return{x:()=>Mm(s,e,gf(e,a))}}},Nw={kernelName:fu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,pf(n,1))}}},Ew={kernelName:pu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,cf(n,"float32"))}}},Rw={kernelName:bu,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r]=t,{axis:a}=n;return{logits:()=>{const t=ug(r);return Fg(e,gf(sg(e,a,!0),t))}}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $w=ep({localResponseNormalizationBackprop_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r=5,a=1,s=1,i=.5){const o={x:e,y:t,dy:n},l={depthRadius:r,bias:a,alpha:s,beta:i};return zh.runKernel(Au,o,l)}}),Ow={kernelName:vu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,a]=t,{depthRadius:s,bias:i,alpha:o,beta:l}=n;return{x:()=>$w(r,a,e,s,i,o,l)}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function Fw(e,t,n,r){return t.rank<n.rank&&(t=Hf(t,Qm(t.shape,r))),e.rank<n.rank&&(e=Hf(e,Qm(e.shape,r))),{x:()=>gf(e,cf(Dm(n,t),e.dtype))}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Dw={kernelName:xu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const r=n,{reductionIndices:a}=r,s=t[0],i=Fw(e,t[1],s,io(a,s.shape));return{x:()=>i.x()}}},Mw={kernelName:ku,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>gf(e,cf(yg(n,r),"float32")),b:()=>gf(e,cf(wg(n,r),"float32"))}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Lw=ep({maxPool3dGrad_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r,a,s,i){const o=Kh(e,"dy","maxPool3dGrad"),l=Kh(t,"input","maxPool3dGrad"),u=Kh(n,"output","maxPool3dGrad");let c=o,d=l,h=u,p=!1;4===l.rank&&(p=!0,c=Hf(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),d=Hf(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),h=Hf(u,[1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]])),Xi(5===c.rank,(()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${c.rank}.`)),Xi(5===d.rank,(()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${d.rank}.`)),Xi(5===h.rank,(()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${h.rank}.`)),Uf("maxPool3dGrad",s,i);const f={dy:c,input:d,output:h},m={filterSize:r,strides:a,pad:s,dimRoundingMode:i},g=zh.runKernel(Iu,f,m);return p?Hf(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}}),Bw={kernelName:Cu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,a]=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=n;return{x:()=>Lw(e,r,a,s,i,o,l)}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Pw=ep({maxPoolGrad_:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r,a,s,i){const o=Kh(e,"dy","maxPoolGrad"),l=Kh(t,"input","maxPoolGrad"),u=Kh(n,"output","maxPoolGrad");Xi(l.rank===o.rank,(()=>`Rank of input (${l.rank}) does not match rank of dy (${o.rank})`)),Xi(4===o.rank,(()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${o.rank}.`)),Xi(4===l.rank,(()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`)),Uf("maxPoolGrad",s,i);const c={dy:o,input:l,output:u},d={filterSize:r,strides:a,pad:s,dimRoundingMode:i};return zh.runKernel(Su,c,d)}}),zw={kernelName:Gu,saveAllInputs:!0,gradFunc:(e,t,n)=>{const{axis:r}=n;return Kb(e,r).map((e=>()=>e))}},Gw={kernelName:Vu,inputsToSave:["x"],gradFunc:(e,t,n)=>{const r=t[0],{paddings:a}=n,s=a.map((e=>e[0]));return{x:()=>Kf(e,s,r.shape)}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Vw(e,t,n){const r=e.shape.length,a=r-n.length,s=Zm(n,r);let i=e;null!=s&&(i=rv(e,s));const o=i.shape.slice(),l=o.splice(r-n.length,n.length).reduce(((e,t)=>e*t),1);o.push(l);let u=
/**
 * @license
 * Copyright 2022 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n){const r=e.shape.slice();r[n]=1;const a=Hf(t,r),s=Cm(e,n,!0,!1),i=Cm(e,n,!0,!0),o=gf(s,i);return gf(a,o)}(i.reshape(o),t,a);if(u=u.reshape(i.shape),null!=s){const e=Km(s);u=rv(u,e)}return u}const Uw={kernelName:kc,gradFunc:(e,t,n)=>{const{blockShape:r,paddings:a}=n;return{x:()=>em(e,r,a)}}},Hw={kernelName:wc,gradFunc:(e,t,n)=>{const{axis:r}=n;return{x:()=>Qf(e,r)}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const jw=[Ok,Fk,Dk,Mk,Lk,Bk,Pk,zk,Gk,Vk,Uk,Hk,qk,Xk,Zk,Kk,Jk,Yk,ew,tw,nw,rw,sw,aw,ow,lw,uw,cw,dw,hw,{kernelName:Ll,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Om(n.shape,r.shape);return{a:()=>{const t=mf(e,cf(r,"float32")),s=$m(n.shape,a);return s.length>0?Hf(sg(t,s),n.shape):t},b:()=>{let t=gf(e,cf(n,"float32"));const s=$m(r.shape,a);s.length>0&&(t=Hf(sg(t,s),r.shape));const i=ag(r);return Rg(mf(t,cf(i,"float32")))}}}},pw,fw,mw,gw,yw,vw,bw,Aw,xw,Sw,Cw,Iw,Ww,_w,Tw,Nw,Ew,Rw,Ow,Dw,Dw,Mw,Bw,{kernelName:wu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,a]=t,{filterSize:s,strides:i,pad:o}=n;return{x:()=>Pw(e,r,a,s,i,o)}}},{kernelName:_u,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{axis:a}=n,s=io(a,r.shape),i=Ji(qm(r.shape,s)[1]);return{x:()=>{const t=r.shape.slice();s.forEach((e=>{t[e]=1}));const n=Hf(e,t);return mf(gf(n,Kg(r.shape,"float32")),i)}}}},{kernelName:Tu,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const r=n,{axis:a}=r,[s,i]=t,o=Fw(e,i,s,io(a,s.shape));return{x:()=>o.x()}}},{kernelName:Nu,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>gf(e,cf(Sg(n,r),"float32")),b:()=>gf(e,cf(gg(n,r),"float32"))}}},{kernelName:Eu,inputsToSave:["x"],gradFunc:(e,t,n)=>{const r=t[0],{paddings:a}=n,s=a.map((e=>e[0]));return{x:()=>Kf(e,s,r.shape)}}},{kernelName:Ru,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Om(n.shape,r.shape);return{a:()=>{const t=$m(n.shape,a);return t.length>0?Hf(sg(e,t),n.shape):e},b:()=>{const t=gf(e,Rg(fg(mf(n,r)))),s=$m(r.shape,a);return s.length>0?Hf(sg(t,s),r.shape):t}}}},{kernelName:Ou,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Om(n.shape,r.shape);return{a:()=>{const t=gf(e,cf(r,"float32")),s=$m(n.shape,a);return s.length>0?Hf(sg(t,s),n.shape):t},b:()=>{const t=gf(e,cf(n,"float32")),s=$m(r.shape,a);return s.length>0?Hf(sg(t,s),r.shape):t}}}},{kernelName:Fu,gradFunc:e=>({x:()=>Rg(e)})},{kernelName:zu,inputsToSave:["indices"],gradFunc:(e,t)=>{const n=t[0];return{indices:()=>Zg(n.shape,"float32")}}},{kernelName:Pu,gradFunc:e=>({x:()=>Lm(e)})},zw,Gw,Gw,{kernelName:Uu,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{const[n,r,a]=t,s=n,i=r,o=Om(s.shape,i.shape);return{a:()=>{const t=cf(i,"float32");let n=gf(e,gf(t,tg(s,Fg(t,ng(1)))));const r=$m(s.shape,o);return r.length>0&&(n=sg(n,r)),Hf(n,s.shape)},b:()=>{const t=gg(s,0),n=Mm(t,Wg(s),Lm(s));let r=gf(e,gf(a,n));const l=$m(i.shape,o);return l.length>0&&(r=sg(r,l)),Hf(r,i.shape)}}}},{kernelName:Hu,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{const[n,r]=t,a=gg(n,0);return{x:()=>Mm(a,e,gf(e,r)),alpha:()=>{let t=Mm(a,Lm(e),gf(e,n));const s=$m(r.shape,e.shape);return s.length>0&&(t=sg(t,s)),Hf(t,r.shape)}}}},{kernelName:ju,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{axis:a}=n;let s=[];return s=null==a?r.shape.map(((e,t)=>t)):"number"==typeof a?[a]:a,{x:()=>Vw(r,e,s)}}},{kernelName:Ju,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,Rg(ag(n)))}}},{kernelName:sc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,r=gf(Sg(n,6),$b(n));return{x:()=>gf(e,cf(r,"float32"))}}},{kernelName:Yu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(e,cf($b(n),"float32"))}}},{kernelName:ec,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>Hf(e,n.shape)}}},{kernelName:rc,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[r]=t,a={dy:e,images:r};return{images:()=>zh.runKernel(ac,a,n)}}},{kernelName:tc,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[r]=t,a={dy:e,images:r};return{images:()=>zh.runKernel(nc,a,n)}}},{kernelName:ic,gradFunc:(e,t,n)=>{const{dims:r}=n,a=io(r,e.shape);return{x:()=>ob(e,a)}}},{kernelName:oc,gradFunc:e=>({x:()=>Lm(e)})},{kernelName:lc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>Rg(mf(e,gf(tg(n,1.5),2)))}}},{kernelName:hc,inputsToSave:["condition"],gradFunc:(e,t)=>{const[n]=t;return{condition:()=>cf(Lm(n),"float32"),t:()=>gf(e,cf(n,e.dtype)),e:()=>gf(e,cf(Bg(n),e.dtype))}}},{kernelName:pc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=gg(n,ng(0)),r=ng(Gx),a=ng(Vx),s=gf(e,a),i=gf(gf(e,r),ug(cf(n,"float32")));return Mm(t,s,i)}}}},{kernelName:bc,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(e,gf(n,Fg(ng(1),n)))}}},{kernelName:yc,gradFunc:e=>({x:()=>Lm(e)})},{kernelName:mc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(wm(cf(n,"float32")),e)}}},{kernelName:gc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(Sm(cf(n,"float32")),e)}}},{kernelName:fc,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{begin:a,size:s}=n,i=r.shape,[o,l]=vx(r,a,s),u=[];for(let c=0;c<e.rank;c++)u.push([o[c],i[c]-o[c]-l[c]]);return{x:()=>uy(e,u)}}},{kernelName:Sc,outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r]=t,{dim:a}=n,s=gf(e,r);return{logits:()=>Fg(s,gf(sg(s,[a],true),r))}}},{kernelName:vc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(e,Zf(n))}}},Uw,Uw,Hw,Hw,{kernelName:Ac,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,gf(rg(cf(n,"float32")),2))}}},{kernelName:Nc,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=ng(2);return{a:()=>gf(e,gf(a,Fg(n,r))),b:()=>gf(e,gf(a,Fg(r,n)))}}},{kernelName:Ec,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(e,gf(cf(n,"float32"),2))}}},{kernelName:Qc,gradFunc:e=>({x:()=>Lm(e)})},{kernelName:Mc,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Om(n.shape,r.shape);return{a:()=>{let t=e;const r=$m(n.shape,a);return r.length>0&&(t=sg(t,r)),Hf(t,n.shape)},b:()=>{let t=e;const n=$m(r.shape,a);return n.length>0&&(t=sg(t,n)),Hf(Rg(t),r.shape)}}}},{kernelName:xc,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,a=r.shape.slice(),{axis:s}=n;io(s,r.shape).forEach((e=>{a[e]=1}));const i=Hf(e,a),o=gf(i,Kg(r.shape,"float32"));return{x:()=>o}}},{kernelName:Lc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>mf(e,ag(wm(n)))}}},{kernelName:Bc,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>gf(Fg(ng(1),ag(n)),e)}}},{kernelName:Pc,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{reps:a}=n;return{x:()=>{let t=Lm(r);if(1===r.rank)for(let n=0;n<a[0];++n)t=pf(t,Kf(e,[n*r.shape[0]],[r.shape[0]]));else if(2===r.rank)for(let n=0;n<a[0];++n)for(let s=0;s<a[1];++s)t=pf(t,Kf(e,[n*r.shape[0],s*r.shape[1]],[r.shape[0],r.shape[1]]));else if(3===r.rank)for(let n=0;n<a[0];++n)for(let s=0;s<a[1];++s)for(let i=0;i<a[2];++i)t=pf(t,Kf(e,[n*r.shape[0],s*r.shape[1],i*r.shape[2]],[r.shape[0],r.shape[1],r.shape[2]]));else{if(4!==r.rank)throw new Error(`Gradient for tile operation is not implemented for rank-${r.rank} tensors yet.`);for(let n=0;n<a[0];++n)for(let s=0;s<a[1];++s)for(let i=0;i<a[2];++i)for(let o=0;o<a[3];++o)t=pf(t,Kf(e,[n*r.shape[0],s*r.shape[1],i*r.shape[2],o*r.shape[3]],[r.shape[0],r.shape[1],r.shape[2],r.shape[3]]))}return t}}}},{kernelName:Vc,gradFunc:(e,t,n)=>{const r=n,{perm:a}=r,s=Km(a);return{x:()=>rv(e,s)}}},{kernelName:Hc,gradFunc:(e,t,n)=>{const r=n,{axis:a}=r;return{value:()=>Rb(e,a)}}},{kernelName:jc,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>function(e,t){const n=Qg(t,Lm(t)),r=mg(e,n);let a=yg(t,ng(0,"int32"));const s=r.rank-a.rank;for(let o=0;o<s;++o)a=cg(a,o+1);a=Lg(a,Kg(r.shape,"bool"));const i=Lm(r);return Mm(a,r,i)}(e,n)}}},{kernelName:qc,gradFunc:e=>({x:()=>Lm(e)})}];
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */for(const t of jw)od(t);
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */mh().prototype.abs=function(){return this.throwIfDisposed(),yf(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.acos=function(){return this.throwIfDisposed(),bf(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.acosh=function(){return this.throwIfDisposed(),vf(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.add=function(e){return this.throwIfDisposed(),pf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.all=function(e,t){return this.throwIfDisposed(),xf(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.any=function(e,t){return this.throwIfDisposed(),kf(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.argMax=function(e){return this.throwIfDisposed(),wf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.argMin=function(e){return this.throwIfDisposed(),Sf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.asScalar=function(){return this.throwIfDisposed(),Xi(1===this.size,(()=>"The array must have only 1 element.")),Hf(this,[])},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.asType=function(e){return this.throwIfDisposed(),cf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.as1D=function(){return this.throwIfDisposed(),Hf(this,[this.size])},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.as2D=function(e,t){return this.throwIfDisposed(),Hf(this,[e,t])},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),Hf(this,[e,t,n])},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.as4D=function(e,t,n,r){return this.throwIfDisposed(),Hf(this,[e,t,n,r])},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.as5D=function(e,t,n,r,a){return this.throwIfDisposed(),Hf(this,[e,t,n,r,a])},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.asin=function(){return this.throwIfDisposed(),Cf(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.asinh=function(){return this.throwIfDisposed(),If(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.atan=function(){return this.throwIfDisposed(),Wf(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.atan2=function(e){return this.throwIfDisposed(),_f(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.atanh=function(){return this.throwIfDisposed(),Tf(this)},mh().prototype.avgPool=function(e,t,n,r){return this.throwIfDisposed(),jf(this,e,t,n,r)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),em(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.batchNorm=function(e,t,n,r,a){return this.throwIfDisposed(),tm(this,e,t,n,r,a)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.broadcastTo=function(e){return this.throwIfDisposed(),lm(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.cast=function(e){return this.throwIfDisposed(),cf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.ceil=function(){return this.throwIfDisposed(),um(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),dm(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof fh&&(e=[e]),Qf([this,...e],t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.conv1d=function(e,t,n,r,a,s){return this.throwIfDisposed(),ym(this,e,t,n,r,a,s)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.conv2dTranspose=function(e,t,n,r,a){return this.throwIfDisposed(),vm(this,e,t,n,r,a)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.conv2d=function(e,t,n,r,a,s){return this.throwIfDisposed(),gm(this,e,t,n,r,a,s)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.cos=function(){return this.throwIfDisposed(),wm(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.cosh=function(){return this.throwIfDisposed(),Sm(this)},
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.cumprod=function(e,t,n){return this.throwIfDisposed(),Cm(this,e,t,n)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),Im(this,e,t,n)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),_m(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.depthwiseConv2d=function(e,t,n,r,a,s){return this.throwIfDisposed(),Tm(this,e,t,n,r,a,s)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.dilation2d=function(e,t,n,r,a){return this.throwIfDisposed(),Em(this,e,t,n,r,a)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.divNoNan=function(e){return this.throwIfDisposed(),Bm(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.div=function(e){return this.throwIfDisposed(),mf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.dot=function(e){return this.throwIfDisposed(),Pm(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.elu=function(){return this.throwIfDisposed(),Gm(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.equal=function(e){return this.throwIfDisposed(),Dm(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.erf=function(){return this.throwIfDisposed(),Um(this)},
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.euclideanNorm=function(e,t){return this.throwIfDisposed(),lg(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.exp=function(){return this.throwIfDisposed(),ug(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.expandDims=function(e){return this.throwIfDisposed(),cg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.expm1=function(){return this.throwIfDisposed(),dg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.fft=function(){return this.throwIfDisposed(),Cb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.flatten=function(){return this.throwIfDisposed(),Hf(this,[this.size])},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.floor=function(){return this.throwIfDisposed(),fg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.floorDiv=function(e){return this.throwIfDisposed(),ff(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.gather=function(e,t,n){return this.throwIfDisposed(),mg(this,e,t,n)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.greaterEqual=function(e){return this.throwIfDisposed(),yg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.greater=function(e){return this.throwIfDisposed(),gg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.ifft=function(){return this.throwIfDisposed(),Ib(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.irfft=function(){return this.throwIfDisposed(),Wb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.isFinite=function(){return this.throwIfDisposed(),vg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.isInf=function(){return this.throwIfDisposed(),Ag(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.isNaN=function(){return this.throwIfDisposed(),xg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.leakyRelu=function(e){return this.throwIfDisposed(),kg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.lessEqual=function(e){return this.throwIfDisposed(),Sg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.less=function(e){return this.throwIfDisposed(),wg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.localResponseNormalization=function(e,t,n,r){return this.throwIfDisposed(),Ig(this,e,t,n,r)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.logSigmoid=function(){return this.throwIfDisposed(),Og(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.logSoftmax=function(e){return this.throwIfDisposed(),Dg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),Mg(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.log=function(){return this.throwIfDisposed(),Wg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.log1p=function(){return this.throwIfDisposed(),_g(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.logicalAnd=function(e){return this.throwIfDisposed(),Lg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.logicalNot=function(){return this.throwIfDisposed(),Bg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.logicalOr=function(e){return this.throwIfDisposed(),Pg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.logicalXor=function(e){return this.throwIfDisposed(),zg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),Xf(this,e,t,n)},mh().prototype.maxPool=function(e,t,n,r){return this.throwIfDisposed(),Hg(this,e,t,n,r)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.max=function(e,t){return this.throwIfDisposed(),Ym(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.maximum=function(e){return this.throwIfDisposed(),Qg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.mean=function(e,t){return this.throwIfDisposed(),Xg(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.min=function(e,t){return this.throwIfDisposed(),eg(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.minimum=function(e){return this.throwIfDisposed(),Yg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),ey(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.mod=function(e){return this.throwIfDisposed(),ty(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.mul=function(e){return this.throwIfDisposed(),gf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.neg=function(){return this.throwIfDisposed(),Rg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.norm=function(e,t,n){return this.throwIfDisposed(),og(this,e,t,n)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.notEqual=function(e){return this.throwIfDisposed(),sy(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),iy(this,e,t,n)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.onesLike=function(){return this.throwIfDisposed(),oy(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.pad=function(e,t){return this.throwIfDisposed(),uy(this,e,t)},mh().prototype.pool=function(e,t,n,r,a,s){return this.throwIfDisposed(),my(this,e,t,n,r,a,s)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.pow=function(e){return this.throwIfDisposed(),tg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.prelu=function(e){return this.throwIfDisposed(),gy(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.prod=function(e,t){return this.throwIfDisposed(),yy(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.reciprocal=function(){return this.throwIfDisposed(),ab(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.relu=function(){return this.throwIfDisposed(),sb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.relu6=function(){return this.throwIfDisposed(),ib(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.reshapeAs=function(e){return this.throwIfDisposed(),Hf(this,e.shape)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.reshape=function(e){return this.throwIfDisposed(),Hf(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),Qv(this,e,t,n)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),Xv(this,e,t,n)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.reverse=function(e){return this.throwIfDisposed(),ob(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.rfft=function(){return this.throwIfDisposed(),Tb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.round=function(){return this.throwIfDisposed(),hb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.rsqrt=function(){return this.throwIfDisposed(),pb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.selu=function(){return this.throwIfDisposed(),fb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.separableConv2d=function(e,t,n,r,a,s){return this.throwIfDisposed(),mb(this,e,t,n,r,a,s)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.sigmoid=function(){return this.throwIfDisposed(),Zf(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.sign=function(){return this.throwIfDisposed(),yb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.sin=function(){return this.throwIfDisposed(),bb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.sinh=function(){return this.throwIfDisposed(),vb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.slice=function(e,t){return this.throwIfDisposed(),Kf(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.softmax=function(e){return this.throwIfDisposed(),Sb(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.softplus=function(){return this.throwIfDisposed(),$g(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),fy(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.split=function(e,t){return this.throwIfDisposed(),_b(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.sqrt=function(){return this.throwIfDisposed(),rg(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.square=function(){return this.throwIfDisposed(),ag(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.squaredDifference=function(e){return this.throwIfDisposed(),Nb(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.squeeze=function(e){return this.throwIfDisposed(),Eb(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.stack=function(e,t){this.throwIfDisposed();const n=e instanceof fh?[this,e]:[this,...e];return Rb(n,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.step=function(e){return this.throwIfDisposed(),$b(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.stridedSlice=function(e,t,n,r,a,s,i,o){return this.throwIfDisposed(),Ob(this,e,t,n,r,a,s,i,o)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.sub=function(e){return this.throwIfDisposed(),Fg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.sum=function(e,t){return this.throwIfDisposed(),sg(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.tan=function(){return this.throwIfDisposed(),Fb(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.tanh=function(){return this.throwIfDisposed(),Jf(this)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.tile=function(e){return this.throwIfDisposed(),hg(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.toBool=function(){return this.throwIfDisposed(),cf(this,"bool")},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.toFloat=function(){return this.throwIfDisposed(),cf(this,"float32")},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.toInt=function(){return this.throwIfDisposed(),cf(this,"int32")},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.topk=function(e,t){return this.throwIfDisposed(),qb(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.transpose=function(e){return this.throwIfDisposed(),rv(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.unique=function(e){return this.throwIfDisposed(),Xb(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),Zb(this,e,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.unstack=function(e){return this.throwIfDisposed(),Kb(this,e)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.where=function(e,t){return this.throwIfDisposed(),Mm(e,this,t)},
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
mh().prototype.zerosLike=function(){return this.throwIfDisposed(),Lm(this)};
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class qw extends Error{constructor(e){super(e),Object.setPrototypeOf(this,qw.prototype)}}class Qw extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Qw.prototype)}}class Xw extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Xw.prototype)}}class Zw extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Zw.prototype)}}class Kw extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Kw.prototype)}}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */class Jw{constructor(e){this.maxEntries=e||100,this.cache=new Map}get(e){let t;return this.cache.has(e)&&(t=this.cache.get(e),this.cache.delete(e),this.cache.set(e,t)),t}put(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxEntries){const e=this.cache.keys().next().value;this.cache.delete(e)}this.cache.set(e,t)}getMaxEntries(){return this.maxEntries}setMaxEntries(e){if(e<0)throw new Error(`The maxEntries of LRU caches must be at least 0, but got ${e}.`);if(this.maxEntries>e)for(let t=0;t<this.maxEntries-e;t++){const e=this.cache.keys().next().value;this.cache.delete(e)}this.maxEntries=e}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function Yw(e,t){if(Array.isArray(e)){let n=[];for(let r=0;r<t;r++)n=n.concat(e);return n}{const n=new Array(t);return n.fill(e),n}}function eS(e,t){if(!e)throw new Kw(t)}function tS(e,t){let n=0;for(const r of e)r===t&&n++;return n}function nS(e){return 1===e.length?e[0]:e}function rS(e){return Array.isArray(e)?e:[e]}function aS(e){const t=e.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return"_"!==t[0]?t:"private"+t}function sS(e){return e.length<=1||-1===e.indexOf("_")?e:e.replace(/[_]+(\w|$)/g,((e,t)=>t.toUpperCase()))}let iS={};function oS(e){if(null==e)return null;const t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function lS(e){if(null!=e&&"object"==typeof e)if(Array.isArray(e))e.forEach((e=>lS(e)));else{const t=Object.keys(e);for(const n of t){const t=e[n];null!=t&&"object"==typeof t&&(Array.isArray(t)||"ndarray"!==t.type||"number"!=typeof t.value?lS(t):e[n]=t.value)}}}function uS(e,t={},n={},r="object",a=!1){if("string"==typeof e){const a=e;let s;if(a in n)s=n[a];else if(a in iS)s=iS[a];else if(s=t[a],null==s)throw new Xw(`Unknown ${r}: ${e}. This may be due to one of the following reasons:\n1. The ${r} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom ${r} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);return s}{const s=e;if(null==s.className||null==s.config)throw new Xw(`${r}: Improper config format: ${JSON.stringify(s)}.\n'className' and 'config' must set.`);const i=s.className;let o,l;if(i in n?[o,l]=n[i]:i in iS?[o,l]=iS.className:i in t&&([o,l]=t[i]),null==o)throw new Xw(`Unknown ${r}: ${i}. This may be due to one of the following reasons:\n1. The ${r} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom ${r} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(null!=l){const e={};for(const n of Object.keys(iS))e[n]=iS[n];for(const a of Object.keys(n))e[a]=n[a];s.config.customObjects=e;const t=Object.assign({},iS);for(const a of Object.keys(n))iS[a]=n[a];lS(s.config);const r=l(o,s.config,n,a);return iS=Object.assign({},t),r}{const e=Object.assign({},iS);for(const r of Object.keys(n))iS[r]=n[r];const t=new o(s.config);return iS=Object.assign({},e),t}}}function cS(e,t){return-1*function(e,t){return e<t?-1:e>t?1:0}(e,t)}function dS(e){if(null==e)return e;const t=[];for(const n of e)-1===t.indexOf(n)&&t.push(n);return t}function hS(e){if(null==e)throw new Xw(`Invalid value in obj: ${JSON.stringify(e)}`);for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}function pS(e,t,n){if(null!=n&&e.indexOf(n)<0)throw new Xw(`${n} is not a valid ${t}.  Valid values are ${e} or null/undefined.`)}function fS(e,t,n=0,r=1/0){return eS(n>=0),eS(r>=n),Array.isArray(e)&&e.length>=n&&e.length<=r&&e.every((e=>typeof e===t))}function mS(e,t){Array.isArray(e)?(Xi(e.length>0,(()=>`${t} is unexpectedly an empty array.`)),e.forEach(((e,n)=>mS(e,`element ${n+1} of ${t}`)))):Xi(Number.isInteger(e)&&e>0,(()=>`Expected ${t} to be a positive integer, but got ${gS(e)}.`))}function gS(e){return null===e?"null":Array.isArray(e)?"["+e.map((e=>gS(e))).join(",")+"]":"string"==typeof e?`"${e}"`:`${e}`}function yS(e){return"relu"===e?"relu":"linear"===e?"linear":"elu"===e?"elu":null}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */let bS=0;function vS(){return bS++}const AS={};function xS(e=""){return e in AS||(AS[e]=0),AS[e]+=1,e+AS[e].toString()}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */const kS=["channelsFirst","channelsLast"],wS=["nearest","bilinear"],SS=["valid","same","causal"],CS=["max","avg"],IS=["sum","mul","concat","ave"],WS=new Map;function _S(e){pS(kS,"DataFormat",e)}function TS(e){pS(SS,"PaddingMode",e)}function NS(e){pS(CS,"PoolMode",e)}const ES=[];function RS(e,t){ES.push(e);try{const e=t();return ES.pop(),e}catch(gQ){throw ES.pop(),gQ}}function $S(e){if(!DS(e))throw new Error("Not a valid tensor name: '"+e+"'");return(0===ES.length?"":ES.join("/")+"/")+e}function OS(e){if(!DS(e))throw new Error("Not a valid tensor name: '"+e+"'");WS.has(e)||WS.set(e,0);const t=WS.get(e);if(WS.set(e,WS.get(e)+1),t>0){const n=`${e}_${t}`;return WS.set(n,1),n}return e}const FS=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function DS(e){return!!e.match(FS)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function MS(e,t,n){null==t&&(t=0),null==n&&(n=e.length);let r=1;for(let a=t;a<n;++a)r*=e[a];return r}function LS(e){if(0===e.length)return Number.NaN;let t=Number.POSITIVE_INFINITY;for(let n=0;n<e.length;n++){const r=e[n];r<t&&(t=r)}return t}function BS(e){if(0===e.length)return Number.NaN;let t=Number.NEGATIVE_INFINITY;for(let n=0;n<e.length;n++){const r=e[n];r>t&&(t=r)}return t}function PS(e,t){if(t<e)throw new Xw(`end (${t}) < begin (${e}) is forbidden.`);const n=[];for(let r=e;r<t;++r)n.push(r);return n}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */let zS;function GS(){return null==zS&&(zS=pp().epsilon()),zS}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function VS(e,t){return cf(e,t)}function US(e,t=-1){const n=e.shape.slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),Hf(e,n)}function HS(e,t,n){return lp((()=>{switch(e.rank){case 1:return Ab(e,t,n);case 2:return xb(e,[t,0],[n,e.shape[1]]);case 3:return kb(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return wb(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return Kf(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return Kf(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new Xw(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}))}function jS(e,t,n){return lp((()=>{switch(e.rank){case 1:return Ab(e,t,n);case 2:return xb(e,[0,t],[e.shape[0],n]);case 3:return kb(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return wb(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new Xw(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}}))}function qS(e,t,n,r){return lp((()=>{switch(e.rank){case 1:return Ab(e,t,n);case 2:switch(r){case 1:return HS(e,t,n);case 2:return jS(e,t,n);default:throw new Xw(`The axis is not within the rank of the tensor ${r}`)}case 3:switch(r){case 1:return HS(e,t,n);case 2:return kb(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return jS(e,t,n);default:throw new Xw(`The axis is not within the rank of the tensor ${r}`)}case 4:switch(r){case 1:return HS(e,t,n);case 2:return wb(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return wb(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return jS(e,t,n);default:throw new Xw(`The axis is not within the rank of the tensor ${r}`)}default:throw new Xw(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}}))}function QS(e,t=-1){let n;return t<0&&(n=e[0].rank,t=0!==n?n:0),t===e[0].rank&&(t=-1),Qf(e,t)}function XS(e,t){switch(e.rank){case 1:return hm([e,t]);case 2:return pm([e,t],0);case 3:return fm([e,t],0);case 4:return mm([e,t],0);default:throw new Xw(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function ZS(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new Xw(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return hg(e,t)}function KS(e,t=0,n=1,r,a){return Jy(e,t,n,r,a)}function JS(e,t,n,r){if(e.rank<2||t.rank<2)throw new Zw(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);if(t.rank>=3){if(e.shape.slice(-1)[0]!==t.shape.slice(-2)[0])throw new Zw(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and  y shape = ${t.shape}`)}if(2===e.rank&&2===t.rank){return xv({a:e,b:t,transposeA:!1,transposeB:!1,bias:r?tC(e.rank,r,"channelsLast"):null,activation:n})}{const a=e.shape.slice(),s=a.pop();e=Hf(e,[-1,s]);const i=t.shape.slice(),o=i.pop(),l=i.pop(),u=[...i,o],c=Array.from({length:t.rank},((e,n)=>0===n?t.rank-2:n<=t.rank-2?n-1:n));t=Hf(rv(t,c),[l,-1]);const d=[...a,...u];return Hf(xv({a:e,b:t,transposeA:!1,transposeB:!1,bias:r?tC(e.rank,r,"channelsLast"):null,activation:n}),d)}}function YS(e,t,n){return lp((()=>(t=Array.isArray(t)?Db(t,"int32"):cf(t,"int32"),mg(e,t,n))))}function eC(e){return gf(e,e)}function tC(e,t,n){const r=t.shape;if(1!==t.rank&&t.rank!==e)throw new Xw(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(5===e){if("channelsFirst"===n)return 1===r.length?Hf(t,[1,r[0],1,1,1]):Hf(t,[1,r[3],r[0],r[1],r[2]]);if("channelsLast"===n)return 1===r.length?Hf(t,[1,1,1,1,r[0]]):Hf(t,[1].concat(r))}else if(4===e){if("channelsFirst"===n)return 1===r.length?Hf(t,[1,r[0],1,1]):Hf(t,[1,r[2],r[0],r[1]]);if("channelsLast"===n)return 1===r.length?Hf(t,[1,1,1,r[0]]):Hf(t,[1].concat(r))}else if(3===e){if("channelsFirst"===n)return 1===r.length?Hf(t,[1,r[0],1]):Hf(t,[1,r[1],r[0]]);if("channelsLast"===n)return 1===r.length?Hf(t,[1,1,r[0]]):Hf(t,[1].concat(r))}else if(e<3)return t;throw new Xw(`Unsupported input rank by biasAdd: ${t.rank}`)}function nC(e,t,n){return lp((()=>(null==n&&(n="channelsLast"),_S(n),pf(e,tC(e.rank,t,n)))))}function rC(e,t,n,r){return lp((()=>lv(e,t,n,r)))}function aC(e,t,n=!1){return n?e():t()}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */const sC=["fanIn","fanOut","fanAvg"],iC=["normal","uniform","truncatedNormal"];class oC extends kA{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}}class lC extends oC{apply(e,t){return Zg(e,t)}}lC.className="Zeros",SA(lC);class uC extends oC{apply(e,t){return Kg(e,t)}}uC.className="Ones",SA(uC);class cC extends oC{constructor(e){if(super(),"object"!=typeof e)throw new Xw(`Expected argument of type ConstantConfig but got ${e}`);if(void 0===e.value)throw new Xw(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return lp((()=>gf(ng(this.value),Kg(e,t))))}getConfig(){return{value:this.value}}}cC.className="Constant",SA(cC);class dC extends oC{constructor(e){super(),this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return eb(e,this.minval,this.maxval,t,this.seed)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}}dC.className="RandomUniform",SA(dC);class hC extends oC{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new Zw(`randomNormal does not support dType ${t}.`);return KS(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}hC.className="RandomNormal",SA(hC);class pC extends oC{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new Zw(`truncatedNormal does not support dType ${t}.`);return Qb(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}pC.className="TruncatedNormal",SA(pC);class fC extends oC{constructor(e){super(),this.gain=null!=e.gain?e.gain:1}apply(e,t){return lp((()=>{if(2!==e.length||e[0]!==e[1])throw new Xw("Identity matrix initializer can only be used for 2D square matrices.");return gf(this.gain,pg(e[0]))}))}getConfig(){return{gain:this.gain}}}fC.className="Identity",SA(fC);class mC extends oC{constructor(e){if(super(),e.scale<0)throw new Xw(`scale must be a positive float. Got: ${e.scale}`);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
var t;this.scale=null==e.scale?1:e.scale,this.mode=null==e.mode?"fanIn":e.mode,t=this.mode,pS(sC,"FanMode",t),this.distribution=null==e.distribution?"normal":e.distribution,function(e){pS(iC,"Distribution",e)}(this.distribution),this.seed=e.seed}apply(e,t){const n=function(e,t="channelsLast"){let n,r;if(_S(t),2===e.length)n=e[0],r=e[1];else if(-1!==[3,4,5].indexOf(e.length)){if("channelsFirst"===t){const t=MS(e,2);n=e[1]*t,r=e[0]*t}else if("channelsLast"===t){const t=MS(e,0,e.length-2);n=e[e.length-2]*t,r=e[e.length-1]*t}}else{const t=MS(e);n=Math.sqrt(t),r=Math.sqrt(t)}return[n,r]}(e),r=n[0],a=n[1];let s=this.scale;if("fanIn"===this.mode?s/=Math.max(1,r):"fanOut"===this.mode?s/=Math.max(1,a):s/=Math.max(1,(r+a)/2),"normal"===this.distribution){const n=Math.sqrt(s);if("float32"!==(t=t||"float32")&&"int32"!==t)throw new Zw(`${this.getClassName()} does not support dType ${t}.`);return Qb(e,0,n,t,this.seed)}{const n=Math.sqrt(3*s);return eb(e,-n,n,t,this.seed)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}}mC.className="VarianceScaling",SA(mC);class gC extends mC{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return mC.className}}gC.className="GlorotUniform",SA(gC);class yC extends mC{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return mC.className}}yC.className="GlorotNormal",SA(yC);class bC extends mC{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return mC.className}}bC.className="HeNormal",SA(bC);class vC extends mC{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return mC.className}}vC.className="HeUniform",SA(vC);class AC extends mC{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return mC.className}}AC.className="LeCunNormal",SA(AC);class xC extends mC{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return mC.className}}xC.className="LeCunUniform",SA(xC);class kC extends oC{constructor(e){super(),this.DEFAULT_GAIN=1,this.ELEMENTS_WARN_SLOW=2e3,this.gain=null==e.gain?this.DEFAULT_GAIN:e.gain,this.seed=e.seed}apply(e,t){return lp((()=>{if(e.length<2)throw new Zw("Shape must be at least 2D.");if("int32"!==t&&"float32"!==t&&void 0!==t)throw new TypeError(`Unsupported data type ${t}.`);const n=Ji(e.slice(0,-1)),r=e[e.length-1];this.ELEMENTS_WARN_SLOW;const a=KS([Math.max(r,n),Math.min(r,n)],0,1,t,this.seed),s=gA.qr(a,!1);let i=s[0];const o=s[1].flatten().stridedSlice([0],[Math.min(r,n)*Math.min(r,n)],[Math.min(r,n)+1]);return i=gf(i,o.sign()),n<r&&(i=i.transpose()),gf(ng(this.gain),i.reshape(e))}))}getConfig(){return{gain:this.gain,seed:this.seed}}}kC.className="Orthogonal",SA(kC);const wC={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function SC(e,t={}){return uS(e,wA.getMap().classNameMap,t,"initializer")}function CC(e){return oS(e)}function IC(e){if("string"==typeof e){const t=e in wC?wC[e]:e;if("GlorotNormal"===t)return new yC;if("GlorotUniform"===t)return new gC;if("HeNormal"===t)return new bC;if("HeUniform"===t)return new vC;if("LeCunNormal"===t)return new AC;if("LeCunUniform"===t)return new xC;{const e={};return e.className=t,e.config={},SC(e)}}return e instanceof oC?e:SC(e)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function WC(e){return Array.isArray(e)&&Array.isArray(e[0])}function _C(e){return 0===e.length?[]:Array.isArray(e[0])?e:[e]}function TC(e){let t;if(Array.isArray(e)){if(1!==e.length)throw new Xw(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function NC(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(1===e.length)return e[0];throw new Xw(`Expected exactly 1 Shape; got ${e.length}`)}return e}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function EC(e){let t=0;for(const n of e)0===n.shape.length?t+=1:t+=n.shape.reduce(((e,t)=>e*t));return t}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */const RC="Variable";class $C{constructor(e,t="float32",n=RC,r=!0,a=null){this.dtype=null==t?"float32":t,this.shape=e.shape,this.id=vS(),n=null==n?RC:n,this.originalName=$S(n),this.name=OS(this.originalName),this.trainable_=r,this.constraint=a,this.val=Yb(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),function(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}(this.val,e),this.val.id!==e.id&&(this.val.assign(e),null!=this.constraint&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}}function OC(e){return e.map((e=>e.read()))}function FC(e){e.forEach((e=>{e[0].write(e[1])}))}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */class DC{constructor(e){this.dtype=e.dtype,this.shape=e.shape,null!=e.shape?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}}class MC{constructor(e,t,n,r,a,s,i){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=r,this.callArgs=a,this.outputTensorIndex=i,this.id=vS(),null!=s&&(this.originalName=$S(s),this.name=OS(this.originalName)),this.rank=t.length}}let LC=0;class BC{constructor(e,t){this.callArgs=t,this.id=LC++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(const n of e.inboundLayers)null!=n&&n.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){const e=[];for(const t of this.inboundLayers)null!=t?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}}let PC=0;class zC extends kA{constructor(e={}){super(),this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=PC++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){const e=this.getClassName();t=aS(e)+"_"+xS(e)}if(this.name=t,this.trainable_=null==e.trainable||e.trainable,null!=e.inputShape||null!=e.batchInputShape){let t;if(null!=e.batchInputShape)t=e.batchInputShape;else if(null!=e.inputShape){let n=null;null!=e.batchSize&&(n=e.batchSize),t=[n].concat(e.inputShape)}this.batchInputShape=t;let n=e.dtype;null==n&&(n=e.inputDType),null==n&&(n="float32"),this.dtype=n}null!=e.weights?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(0===this.inboundNodes.length)throw new Qw(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new Xw(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return nS(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return nS(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new qw(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(0===this.inboundNodes.length)throw new qw(`Layer ${this.name} is not connected, no input to return.`);return nS(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(0===this.inboundNodes.length)throw new qw(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new qw(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return nS(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map((e=>e()))}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach((t=>t.trainable=e)),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter((e=>e.trainable)):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter((e=>!e.trainable)).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){const t=rS(e);if(null==this.inputSpec||0===this.inputSpec.length)return;const n=rS(this.inputSpec);if(t.length!==n.length)throw new Xw(`Layer ${this.name} expects ${n.length} inputs, but it received ${t.length} input tensors. Input received: ${e}`);for(let r=0;r<t.length;r++){const e=t[r],a=n[r];if(null==a)continue;const s=e.rank;if(null!=a.ndim&&s!==a.ndim)throw new Xw(`Input ${r} is incompatible with layer ${this.name}: expected ndim=${a.ndim}, found ndim=${s}`);if(null!=a.maxNDim&&s>a.maxNDim)throw new Xw(`Input ${r} is incompatible with layer ${this.name}: expected max_ndim=${a.maxNDim}, found ndim=${s}`);if(null!=a.minNDim&&s<a.minNDim)throw new Xw(`Input ${r} is incompatible with layer ${this.name}: expected min_ndim=${a.minNDim}, found ndim=${s}.`);if(null!=a.dtype&&e.dtype!==a.dtype)throw new Xw(`Input ${r} is incompatible with layer ${this.name} : expected dtype=${a.dtype}, found dtype=${e.dtype}.`);if(a.axes){const t=e.shape;for(const e in a.axes){const n=Number(e),s=a.axes[e],i=n>=0?t[n]:t[t.length+n];if(null!=s&&-1===[s,null].indexOf(i))throw new Xw(`Input ${r} is incompatible with layer ${this.name}: expected axis ${n} of input shape to have value ${s} but got shape ${t}.`)}}if(null!=a.shape)for(let t=0;t<a.shape.length;++t){const n=a.shape[t],s=e.shape[t];if(null!=n&&null!=s&&n!==s)throw new Xw(`Input ${r} is incompatible with layer ${this.name}: expected shape=${a.shape}, found shape=${e.shape}.`)}}}call(e,t){return e}invokeCallHook(e,t){null!=this._callHook&&this._callHook(e,t)}setCallHook(e){this._callHook=e}clearCallHook(){this._callHook=null}apply(e,t){t=t||{},this.assertNotDisposed();const n=rS(e),r=function(e){let t=!0;for(const n of rS(e))if(!(n instanceof MC)){t=!1;break}return t}(e),a=function(e){let t=!0;for(const n of rS(e))if(n instanceof MC){t=!1;break}return t}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */(e);if(r===a)throw new Xw("Arguments to apply() must be all SymbolicTensors or all Tensors");return RS(this.name,(()=>{if(!this.built){this.assertInputCompatibility(e);const t=[];for(const n of rS(e))t.push(n.shape);this.build(nS(t)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),null===this._refCount&&a&&(this._refCount=1)}if(this.assertInputCompatibility(e),a){let r=this.call(e,t);this.supportsMasking&&this.setMaskMetadata(e,r);const a=rS(r),s=[];for(let e of a)-1!==n.indexOf(e)&&(e=e.clone()),s.push(e);if(r=nS(s),null!=this.activityRegularizer)throw new Zw("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return r}{const n=function(e){e=rS(e);const t=[];for(const n of e)t.push(n.shape);return nS(t)}(e),r=this.computeOutputShape(n);let a;const s="float32";if(this.warnOnIncompatibleInputShape(Array.isArray(e)?n[0]:n),a=null!=r&&r.length>0&&Array.isArray(r[0])?r.map(((n,r)=>new MC(s,n,this,rS(e),t,this.name,r))):new MC(s,r,this,rS(e),t,this.name),this.addInboundNode(e,a,null,null,n,r,t),this._refCount++,null!=this.activityRegularizer)throw new Zw("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return a}}))}warnOnIncompatibleInputShape(e){if(null!=this.batchInputShape)if(e.length!==this.batchInputShape.length);else{let t=!1;this.batchInputShape.forEach(((n,r)=>{null!=n&&null!=e[r]&&e[r]!==n&&(t=!0)}))}}get outputShape(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new qw(`The layer ${this.name} has never been called and thus has no defined output shape.`);const e=[];for(const t of this.inboundNodes){const n=JSON.stringify(t.outputShapes);-1===e.indexOf(n)&&e.push(n)}if(1===e.length){const e=this.inboundNodes[0].outputShapes;return Array.isArray(e)&&Array.isArray(e[0])&&1===e.length?e[0]:e}throw new qw(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new Qw(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return EC(this.weights)}build(e){this.built=!0}getWeights(e=!1){return OC(e?this.trainableWeights:this.weights)}setWeights(e){lp((()=>{const t=this.weights;if(t.length!==e.length)throw new Xw(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(0===t.length)return;const n=[],r=OC(t);for(let a=0;a<r.length;++a){const s=r[a],i=t[a],o=e[a];if(!eo(s.shape,o.shape))throw new Xw(`Layer weight shape ${s.shape} not compatible with provided weight shape ${o.shape}`);n.push([i,o])}FC(n)}))}addWeight(e,t,n,r,a,s,i,o){if(-1!==this._addedWeightNames.indexOf(e))throw new Xw(`Duplicate weight name ${e} for layer ${this.name}`);this._addedWeightNames.push(e),null==n&&(n="float32"),this.fastWeightInitDuringBuild&&(r=null!=o?o():IC("zeros"));const l=r.apply(t,n),u=new $C(l,n,e,s,i);return l.dispose(),null!=a&&this.addLoss((()=>a.apply(u.read()))),null==s&&(s=!0),s?this._trainableWeights.push(u):this._nonTrainableWeights.push(u),u}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){null==e||Array.isArray(e)&&0===e.length||(e=rS(e),void 0!==this._losses&&null!==this._losses&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(null!=t){if(!Array.isArray(t))throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);t.forEach((e=>{if(null!=e)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)}))}return null}return t}setMaskMetadata(e,t,n){if(!this.supportsMasking)return;const r=this.computeMask(e,n),a=rS(t),s=rS(r);if(a.length!==s.length)throw new Error(`${this.name} outputs ${a.length} tensors but ${a.length} masks for those tensors`);for(let i=0;i<a.length;i++)a[i].kerasMask=s[i]}addInboundNode(e,t,n,r,a,s,i=null){const o=rS(e);t=rS(t),n=rS(n),r=rS(r),a=_C(a),s=_C(s);const l=[],u=[],c=[];for(const d of o)l.push(d.sourceLayer),u.push(d.nodeIndex),c.push(d.tensorIndex);new BC({outboundLayer:this,inboundLayers:l,nodeIndices:u,tensorIndices:c,inputTensors:o,outputTensors:t,inputMasks:n,outputMasks:r,inputShapes:a,outputShapes:s},i);for(let d=0;d<t.length;d++)t[d].sourceLayer=this,t[d].nodeIndex=this.inboundNodes.length-1,t[d].tensorIndex=d}getConfig(){const e={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&&(e.batchInputShape=this.batchInputShape),null!=this.dtype&&(e.dtype=this.dtype),e}disposeWeights(){return this.weights.forEach((e=>e.dispose())),this.weights.length}assertNotDisposed(){if(0===this._refCount)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(null===this._refCount)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return 0==--this._refCount&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}}function GC(e,t,n){if((null==t||null!=n&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),0===t.inboundNodes.length)return[e];{const e=t.inboundNodes[n];if(0===e.inboundLayers.length)return e.inputTensors;{const t=[];for(let n=0;n<e.inboundLayers.length;n++){const r=GC(e.inputTensors[n],e.inboundLayers[n],e.nodeIndices[n]);for(const e of r)-1===t.indexOf(e)&&t.push(e)}return t}}}class VC extends zC{constructor(e){if(super({dtype:e.dtype,name:null!=e.name?e.name:xS("input").toString()}),null==e.batchSize&&(e.batchSize=null),null==e.sparse&&(e.sparse=!1),this.trainable=!1,this.built=!0,this.sparse=e.sparse,null!=e.inputShape&&null!=e.batchInputShape)throw new Xw("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");let t=e.batchInputShape;if(null==t){if(null==e.inputShape)throw new Xw("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");t=[e.batchSize].concat(e.inputShape)}else if(null!=e.batchSize)throw new Xw("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");const n=e.dtype||"float32";this.batchInputShape=t,this.dtype=n,this.inputSpec=[{shape:t}];const r=new MC(this.dtype,this.batchInputShape,this,[],{},this.name);r.nodeIndex=0,r.tensorIndex=0,new BC({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[r],outputTensors:[r],inputMasks:[null],outputMasks:[null],inputShapes:[t],outputShapes:[t]})}apply(e,t){throw new Xw(`Cannot pass any input to an InputLayer's apply() method. InputLayer name: ${this.name}`)}dispose(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}}getConfig(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}}}VC.className="InputLayer",SA(VC);class UC{constructor(e){if(this.id2Value={},this.id2Mask={},this.name2Id={},e instanceof UC)for(const t in e.id2Value)this.id2Value[t]=e.id2Value[t],t in e.id2Mask&&(this.id2Mask[t]=e.id2Mask[t]);else{if(null==e)return;for(const t of e)this.add(t.key,t.value)}}add(e,t,n){if(null!=this.id2Value[e.id])throw new Xw(`Duplicate key: name=${e.name}, id=${e.id}`);return this.id2Value[e.id]=
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function(e,t){if(null==e.dtype||e.dtype===t.dtype)return t;try{return cf(t,e.dtype)}catch(RZ){throw new Xw(`The dtype of the feed (${t.dtype}) can not be cast to the dtype of the key '${e.name}' (${e.dtype}).`)}}(e,t),this.name2Id[e.name]=e.id,null!=n&&(this.id2Mask[e.id]=n),this}addFeed(e){this.add(e.key,e.value)}hasKey(e){return null!=this.id2Value[e.id]}names(){return Object.keys(this.name2Id)}getValue(e){if(e instanceof MC){if(null==this.id2Value[e.id])throw new Xw(`Nonexistent key: ${e.name}`);return this.id2Value[e.id]}{const t=this.name2Id[e];if(null==t)throw new Xw(`Feed dict has no SymbolicTensor name: ${e}`);return this.id2Value[t]}}getMask(e){if(e instanceof MC){if(null==this.id2Value[e.id])throw new Xw(`Nonexistent key: ${e.name}`);return this.id2Mask[e.id]}{const t=this.name2Id[e];if(null==t)throw new Xw(`Feed dict has no SymbolicTensor name: ${e}`);return this.id2Mask[t]}}disposeMasks(){null!=this.id2Mask&&up(this.id2Mask)}}const HC=new Jw,jC=new Jw;function qC(e,t,n,r){const a=null!=n&&n.training,s=Array.isArray(e),i=s?e:[e],o=i.map((e=>e.name)),l=[],u=t.names();for(const f of o)-1!==u.indexOf(f)?l.push(t.getValue(f)):l.push(null);null!=r&&(r.maxNumTensors=-1/0,r.minNumTensors=1/0);const c=o.join(",")+"|"+t.names().sort().join(",");let d,h=HC.get(c);if(null==h){const e=function(e,t){Xi(null!=e&&e.length>0,(()=>"Expected at least one fetch, got none"));let n=[],r={};if(1===e.length){const a=XC(e[0],t);n=a.sorted,r=a.recipientMap}else{const a=new Set;for(const s of e){const{sorted:e,recipientMap:i}=XC(s,t);for(const t of e)a.has(t.name)||(n.push(t),a.add(t.name));for(const t in i)null==r[t]&&(r[t]=new Set),i[t].forEach((e=>r[t].add(e)))}}return{sorted:n,recipientCounts:QC(r)}}(i,t);h=e.sorted,d=e.recipientCounts,HC.put(c,h),jC.put(c,d)}d={},a||Object.assign(d,jC.get(c));const p=new UC(t);for(let f=0;f<h.length;++f){if(null!=r){const e=op().numTensors;e>r.maxNumTensors&&(r.maxNumTensors=e),e<r.minNumTensors&&(r.minNumTensors=e)}const e=h[f],s=e.sourceLayer;if(s instanceof VC)continue;const i=[],u=[],c=[];let m=!1;for(const n of e.inputs){const e=p.getValue(n),r=p.getMask(n);i.push(e),u.push(r),null!=r&&(m=!0),a||(d[n.name]--,0!==d[n.name]||t.hasKey(n)||-1!==o.indexOf(n.name)||e.isDisposed||!0===n.sourceLayer.stateful||c.push(e))}m&&((n=n||{}).mask=u[0]);const g=rS(s.apply(i,n));let y=null;s.supportsMasking&&(y=s.computeMask(i,u));const b=ZC(e),v=Array.isArray(b)?b:[b];for(let t=0;t<v.length;++t){p.hasKey(v[t])||p.add(v[t],g[t],Array.isArray(y)?y[0]:y);const e=o.indexOf(v[t].name);-1!==e&&(l[e]=g[t])}a||up(c)}return p.disposeMasks(),s?l:l[0]}function QC(e){const t={};for(const n in e)t[n]=e[n].size;return t}function XC(e,t){const n=new Set,r=[],a={};for(const o of t.names())n.add(o);const s=[],i=[];for(s.push(e);s.length>0;){const e=s[s.length-1];if(n.has(e.name)){s.pop();continue}const t=i[i.length-1]===s.length-1;if(0===e.inputs.length||t)s.pop(),r.push(e),n.add(e.name),t&&i.pop();else{i.push(s.length-1);for(const t of e.inputs)null==a[t.name]&&(a[t.name]=new Set),a[t.name].add(e.name),n.has(t.name)||s.push(t)}}return{sorted:r,recipientMap:a}}function ZC(e){let t;if(1===e.sourceLayer.inboundNodes.length)t=e.sourceLayer.output;else{let n=null;for(let t=0;t<e.sourceLayer.inboundNodes.length;++t)for(const r of e.sourceLayer.inboundNodes[t].outputTensors)if(r.id===e.id){n=t;break}t=e.sourceLayer.getOutputAt(n)}return t}
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function KC(e,t){return lp((()=>rg(sg(gf(e,e),t,!0))))}Do().registerFlag("TOPOLOGICAL_SORT_CACHE_MAX_ENTRIES",(()=>100),(function(e){null!=HC&&HC.setMaxEntries(e),null!=jC&&jC.setMaxEntries(e)}));class JC extends kA{getConfig(){return{}}}class YC extends JC{constructor(e){super(),this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=null!=e.maxValue?e.maxValue:this.defaultMaxValue,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return lp((()=>{const t=KC(e,this.axis),n=dm(t,0,this.maxValue);return gf(e,mf(n,pf(GS(),t)))}))}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}}YC.className="MaxNorm",SA(YC);class eI extends JC{constructor(e){super(),this.defaultAxis=0,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return lp((()=>mf(e,pf(GS(),KC(e,this.axis)))))}getConfig(){return{axis:this.axis}}}eI.className="UnitNorm",SA(eI);class tI extends JC{apply(e){return sb(e)}}tI.className="NonNeg",SA(tI);class nI extends JC{constructor(e){super(),this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=null!=e.minValue?e.minValue:this.defaultMinValue,this.maxValue=null!=e.maxValue?e.maxValue:this.defaultMaxValue,this.rate=null!=e.rate?e.rate:this.defaultRate,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return lp((()=>{const t=KC(e,this.axis),n=pf(gf(this.rate,dm(t,this.minValue,this.maxValue)),gf(1-this.rate,t));return gf(e,mf(n,pf(GS(),t)))}))}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}}nI.className="MinMaxNorm",SA(nI);const rI={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function aI(e){return oS(e)}function sI(e,t={}){return uS(e,wA.getMap().classNameMap,t,"constraint")}function iI(e){if(null==e)return null;if("string"==typeof e){return sI({className:e in rI?rI[e]:e,config:{}})}return e instanceof JC?e:sI(e)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */async function oI(e){if(null==e)return;const t=[],n=[],r=[];for(const a in e){const s=e[a];if("number"!=typeof s){const e=s;t.push(e.data()),n.push(a),r.push(e)}}if(t.length>0){const a=await Promise.all(t);for(let t=0;t<a.length;++t)e[n[t]]=a[t][0];up(r)}}function lI(e){if(null!=e)for(const t in e){const n=e[t];"number"!=typeof n&&n.dispose()}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */var uI,cI;(cI=uI||(uI={}))[cI.SILENT=0]="SILENT",cI[cI.VERBOSE=1]="VERBOSE";class dI{constructor(){this.validationData=null}setParams(e){this.params=e}async onEpochBegin(e,t){}async onEpochEnd(e,t){}async onBatchBegin(e,t){}async onBatchEnd(e,t){}async onTrainBegin(e){}async onTrainEnd(e){}setModel(e){}}class hI{constructor(e,t=10){null==e&&(e=[]),this.callbacks=e,this.queueLength=t}append(e){this.callbacks.push(e)}setParams(e){for(const t of this.callbacks)t.setParams(e)}setModel(e){for(const t of this.callbacks)t.setModel(e)}async onEpochBegin(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onEpochBegin(e,t)}async onEpochEnd(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onEpochEnd(e,t)}async onBatchBegin(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onBatchBegin(e,t)}async onBatchEnd(e,t){null==t&&(t={});for(const n of this.callbacks)await n.onBatchEnd(e,t)}async onTrainBegin(e){null==e&&(e={});for(const t of this.callbacks)await t.onTrainBegin(e)}async onTrainEnd(e){null==e&&(e={});for(const t of this.callbacks)await t.onTrainEnd(e)}}class pI extends dI{constructor(){super()}async onEpochBegin(e){this.seen=0,this.totals={}}async onBatchEnd(e,t){null==t&&(t={});const n=null==t.size?0:t.size;this.seen+=n;for(const r in t){const e=t[r];if("number"==typeof e)this.totals.hasOwnProperty(r)||(this.totals[r]=0),this.totals[r]=this.totals[r]+e*n;else{let t;r in this.totals?t=this.totals[r]:this.totals[r]=0;const a=lp((()=>pf(this.totals[r],gf(e,n))));this.totals[r]=a,null!=t&&t.dispose()}}}async onEpochEnd(e,t){if(null!=t)for(const n of this.params.metrics)null!=this.totals[n]&&("number"==typeof this.totals[n]?t[n]=this.totals[n]/this.seen:lp((()=>{const e=gf(mf(1,this.seen),this.totals[n]);t[n]=e,this.totals[n].dispose(),cp(t[n])})))}}class fI extends dI{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){null==t&&(t={}),this.epoch.push(e);for(const n in t)null==this.history[n]&&(this.history[n]=[]),this.history[n].push(t[n])}async syncData(){const e=[],t=[],n=[];for(const a in this.history){const r=this.history[a];for(let s=0;s<r.length;++s)if("number"!=typeof r[s]){const i=r[s];e.push(i.data()),t.push(a),n.push(s)}}const r=await Promise.all(e);for(let a=0;a<r.length;++a){this.history[t[a]][n[a]].dispose(),this.history[t[a]][n[a]]=r[a][0]}}}class mI extends dI{constructor(e,t){if(super(),this.currentEpoch=0,this.nowFunc=e.nowFunc,this.nextFrameFunc=e.nextFrameFunc||Ix,this.yieldEvery=t||"auto","auto"===this.yieldEvery&&(this.yieldEvery=125),"never"===this.yieldEvery&&null!=e.onYield)throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");bo(this.yieldEvery)&&(this.maybeWait=function(e,t,n){let r,a=null!=n?n():Kd();return(...s)=>{const i=null!=n?n():Kd();return i-a<t||(a=i,r=e(...s)),r}}(this.maybeWait.bind(this),this.yieldEvery,this.nowFunc)),this.trainBegin=e.onTrainBegin,this.trainEnd=e.onTrainEnd,this.epochBegin=e.onEpochBegin,this.epochEnd=e.onEpochEnd,this.batchBegin=e.onBatchBegin,this.batchEnd=e.onBatchEnd,this.yield=e.onYield}async maybeWait(e,t,n){const r=[];null!=this.yield&&(await oI(n),r.push(this.yield(e,t,n))),r.push(this.nextFrameFunc()),await Promise.all(r)}async onEpochBegin(e,t){this.currentEpoch=e,null!=this.epochBegin&&(await oI(t),await this.epochBegin(e,t))}async onEpochEnd(e,t){const n=[];null!=this.epochEnd&&(await oI(t),n.push(this.epochEnd(e,t))),"epoch"===this.yieldEvery&&n.push(this.nextFrameFunc()),await Promise.all(n)}async onBatchBegin(e,t){null!=this.batchBegin&&(await oI(t),await this.batchBegin(e,t))}async onBatchEnd(e,t){const n=[];null!=this.batchEnd&&(await oI(t),n.push(this.batchEnd(e,t))),"batch"===this.yieldEvery?n.push(this.nextFrameFunc()):bo(this.yieldEvery)&&n.push(this.maybeWait(this.currentEpoch,e,t)),await Promise.all(n)}async onTrainBegin(e){null!=this.trainBegin&&(await oI(e),await this.trainBegin(e))}async onTrainEnd(e){null!=this.trainEnd&&(await oI(e),await this.trainEnd(e))}}function gI(e,t){if(null==e&&(e={}),e instanceof dI)return[e];if(Array.isArray(e)&&e[0]instanceof dI)return e;return rS(e).map((e=>new mI(e,t)))}class yI{constructor(){}static registerCallbackConstructor(e,t){Xi(e>=0&&Number.isInteger(e),(()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`)),yI.checkForDuplicate(t),null==yI.constructors[e]&&(yI.constructors[e]=[]),yI.constructors[e].push(t)}static checkForDuplicate(e){for(const t in yI.constructors){yI.constructors[+t].forEach((t=>{if(t===e)throw new Xw("Duplicate callback constructor.")}))}}static clear(){yI.constructors={}}static createCallbacks(e){const t=[];for(const n in yI.constructors){const r=+n;e>=r&&t.push(...yI.constructors[r])}return t.map((e=>new e))}}function bI(e,t,n,r,a,s,i,o,l){const u=new fI,c=[new pI,...yI.createCallbacks(t)];null!=e&&c.push(...e),c.push(u);const d=new hI(c);return d.setParams({epochs:n,initialEpoch:r,samples:a,steps:s,batchSize:i,verbose:t,doValidation:o,metrics:l}),{callbackList:d,history:u}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function vI(e,t={},n=!1){return uS(e,wA.getMap().classNameMap,t,"layer",n)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function AI(e,t){return lp((()=>{"float32"!==e.dtype&&(e=cf(e,"float32"));const n=sg(eC(e),t,!0),r=cm(n.shape,GS()),a=rg(Qg(n,r));return mf(e,a)}))}function xI(e,t){return lp((()=>Xg(eC(Fg(t,e)),-1)))}function kI(e,t){return lp((()=>Xg(yf(Fg(t,e)),-1)))}function wI(e,t){return lp((()=>{const n=Fg(e,t),r=dm(yf(e),GS(),Number.MAX_VALUE),a=yf(mf(n,r));return gf(100,Xg(a,-1))}))}function SI(e,t,n=!1){return lp((()=>{if(n)t=Sb(t);else{const e=sg(t,t.shape.length-1,!0);t=mf(t,e)}return t=dm(t,GS(),1-GS()),Rg(sg(gf(cf(e,"float32"),Wg(t)),t.shape.length-1))}))}function CI(e,t,n=!1){return lp((()=>{const r=cf(fg(function(e){const t=[MS(e.shape)];return Hf(e,t)}(e)),"int32"),a=(t=dm(t,GS(),1-GS())).shape;return SI(Hf(iy(r,a[a.length-1]),a),t,n)}))}function II(e,t){return lp((()=>{let n;return n=dm(t,GS(),1-GS()),n=Wg(mf(n,Fg(1,n))),Xg(function(e,t){if(!eo(e.shape,t.shape))throw new Xw(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return lp((()=>{const n=sb(t),r=Rg(yf(t));return pf(Fg(n,gf(t,e)),_g(ug(r)))}))}(e,n),-1)}))}function WI(e,t){return lp((()=>{const n=AI(e,-1),r=AI(t,-1),a=gf(n,r);return Rg(sg(a,-1))}))}yI.constructors={};const _I={meanSquaredError:xI,meanAbsoluteError:kI,meanAbsolutePercentageError:wI,meanSquaredLogarithmicError:function(e,t){return lp((()=>{const n=dm(t,GS(),Number.MAX_VALUE),r=Wg(pf(1,n)),a=dm(e,GS(),Number.MAX_VALUE),s=Wg(pf(1,a));return Xg(eC(Fg(r,s)),-1)}))},squaredHinge:function(e,t){return lp((()=>{const n=Qg(0,Fg(1,gf(e,t)));return Xg(eC(n),-1)}))},hinge:function(e,t){return lp((()=>{const n=Qg(0,Fg(1,gf(e,t)));return Xg(n,-1)}))},categoricalHinge:function(e,t){return lp((()=>{const n=sg(gf(e,t),-1),r=Ym(gf(Fg(1,e),t),-1);return Qg(0,pf(1,Fg(r,n)))}))},logcosh:function(e,t){return lp((()=>{const n=Math.log(2),r=Fg(t,e),a=Fg(pf(r,$g(gf(-2,r))),n);return Xg(a,-1)}))},categoricalCrossentropy:SI,sparseCategoricalCrossentropy:CI,binaryCrossentropy:II,kullbackLeiblerDivergence:function(e,t){return lp((()=>{const n=dm(e,GS(),1),r=dm(t,GS(),1);return sg(gf(e,Wg(mf(n,r))),-1)}))},poisson:function(e,t){return lp((()=>{const n=Wg(pf(GS(),t));return Xg(Fg(t,gf(e,n)),-1)}))},cosineProximity:WI};function TI(e){if("string"==typeof e){if(e in _I)return _I[e];let t=`Unknown loss ${e}`;throw e.toLowerCase().includes("softmaxcrossentropy")&&(t=`Unknown loss ${e}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new Xw(t)}return e}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function NI(e,t){return lp((()=>{const n=gf(.5,oy(t)),r=VS(gg(t,n),e.dtype);return Xg(Dm(e,r),-1)}))}function EI(e,t){return lp((()=>VS(Dm(wf(e,-1),wf(t,-1)),"float32")))}function RI(e,t){return II(e,t)}function $I(e,t){return e.rank===t.rank&&(e=Eb(e,[e.rank-1])),(t=wf(t,-1)).dtype!==e.dtype&&(t=cf(t,e.dtype)),cf(Dm(e,t),"float32")}const OI=SI,FI=CI,DI={binaryAccuracy:NI,categoricalAccuracy:EI,precision:function(e,t){return lp((()=>{const n=function(e,t){return lp((()=>cf(sg(Lg(Dm(e,1),Dm(t,1))),"float32")))}(e,t),r=function(e,t){return lp((()=>cf(sg(Lg(Dm(e,0),Dm(t,1))),"float32")))}(e,t),a=pf(n,r);return cf(Mm(gg(a,0),mf(n,a),0),"float32")}))},categoricalCrossentropy:OI,sparseCategoricalCrossentropy:FI,mse:xI,MSE:xI,mae:kI,MAE:kI,mape:wI,MAPE:wI,cosine:WI};function MI(e){if("string"==typeof e&&e in DI)return DI[e];if("string"!=typeof e&&null!=e)return e;throw new Xw(`Unknown metric ${e}`)}function LI(e){if(eS(null!==e,`Unknown LossOrMetricFn ${e}`),"string"==typeof e)return e;{let t;for(const n of Object.keys(_I))if(_I[n]===e){t=n;break}if(void 0!==t)return t;for(const n of Object.keys(DI))if(DI[n]===e){t=n;break}return void 0!==t?t:e.name}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function BI(e,t,n=!1){if(null==e||"object"!=typeof e||Object.getPrototypeOf(e)!==Object.prototype||!PI(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){JSON.stringify(e).length}}function PI(e){if(null===e)return!0;if("object"==typeof e){if(Object.getPrototypeOf(e)===Object.prototype){const t=Object.keys(e);for(const n of t){if("string"!=typeof n)return!1;if(!PI(e[n]))return!1}return!0}if(Array.isArray(e)){for(const t of e)if(!PI(t))return!1;return!0}return!1}{const t=typeof e;return"string"===t||"number"===t||"boolean"===t}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function zI(e,t,n,r=console.log){const a=function(e){let t=!0;const n=[],r=[];for(const a in e.nodesByDepth)n.push(e.nodesByDepth[a]);for(const a of n){if(a.length>1||1===a.length&&a[0].inboundLayers.length>1){t=!1;break}r.push(...a)}if(t)for(const a of e.layers){let e=!1;for(const n of a.inboundNodes)if(-1!==r.indexOf(n)){if(e){t=!1;break}e=!0}if(!t)break}return t}(e),s=["Layer (type)","Input Shape","Output shape","Param #"];let i;if(a?(t=t||90,n=n||[.32,.61,.89,1]):(t=t||115,n=n||[.24,.48,.7,.8,1]),n[n.length-1]<=1&&(n=n.map((e=>Math.floor(t*e)))),!a){s.push("Receives inputs"),i=[];for(const t in e.nodesByDepth)i.push(...e.nodesByDepth[t])}r("_".repeat(t)),GI(s,n,r),r("=".repeat(t));const o=e.layers;for(let c=0;c<o.length;++c)a?VI(o[c],n,r):UI(o[c],n,i,r),r((c===o.length-1?"=":"_").repeat(t));e.checkTrainableWeightsConsistency();const l=function(e){let t;t=null!=e.collectedTrainableWeights?EC(e.collectedTrainableWeights):EC(e.trainableWeights);return t}(e),u=EC(e.nonTrainableWeights);r(`Total params: ${l+u}`),r(`Trainable params: ${l}`),r(`Non-trainable params: ${u}`),r("_".repeat(t))}function GI(e,t,n=console.log){let r="";for(let a=0;a<e.length;++a)a>0&&(r=r.slice(0,r.length-1)+" "),r+=e[a],r=r.slice(0,t[a]),r+=" ".repeat(t[a]-r.length);n(r)}function VI(e,t,n){let r,a;try{a=e.inboundNodes.map((e=>JSON.stringify(e.inputShapes))).join(",")}catch(RZ){a="multiple"}try{r=JSON.stringify(e.outputShape)}catch(RZ){r="multiple"}GI([`${e.name} (${e.getClassName()})`,a,r,e.countParams().toString()],t,n)}function UI(e,t,n,r){let a,s;try{s=e.inboundNodes.map((e=>JSON.stringify(e.inputShapes))).join(",")}catch(RZ){s="multiple"}try{a=JSON.stringify(e.outputShape)}catch(RZ){a="multiple"}const i=[];for(const c of e.inboundNodes)if(!(null!=n&&n.length>0&&-1===n.indexOf(c)))for(let e=0;e<c.inboundLayers.length;++e){const t=c.inboundLayers[e].name,n=c.nodeIndices[e],r=c.tensorIndices[e];i.push(`${t}[${n}][${r}]`)}const o=e.name,l=e.getClassName(),u=0===i.length?"":i[0];GI([`${o} (${l})`,s,a,e.countParams().toString(),u],t,r);for(let c=1;c<i.length;++c)GI(["","","","",i[c]],t,r)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function HI(e,t,n){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof n}function jI(e,t){if(null===e)return null;if("string"==typeof e)return sS(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){const n=[],r=e.length;for(let a=0;a<r;++a){const r=e[a];HI(t,a,r)?n.push(r):n.push(jI(r,t))}return n}{const t={};for(const n of Object.keys(e)){const r=e[n];if("name"===n&&"string"==typeof r)t[n]=r;else{const e=sS(n);t[e]=jI(r,e)}}return t}}function qI(e,t){if(null==e)return null;if("string"==typeof e)return aS(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){const n=[],r=e.length;for(let a=0;a<r;++a){const r=e[a];HI(t,a,r)?n.push(r):n.push(qI(r,t))}return n}{const t={};for(const n of Object.keys(e)){const r=e[n],a=aS(n);t[a]="name"!==n&&"className"!==n||"string"!=typeof r?qI(r,n):r}return t}}
/** @license See the LICENSE file. */const QI="4.22.0";
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */class XI extends zC{constructor(e){if(super({}),this.containerNodes=new Set,this.name=e.name,null==this.name){const e=this.getClassName().toLowerCase();this.name=xS(e)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(e.inputs)?this.inputs=e.inputs.slice():this.inputs=[e.inputs],Array.isArray(e.outputs)?this.outputs=e.outputs.slice():this.outputs=[e.outputs],dS(this.inputs).length!==this.inputs.length)throw new Xw(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map((e=>e.name))}`);dS(this.outputs).length,this.outputs.length,this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(const y of this.outputs){const e=y.sourceLayer,t=y.nodeIndex,n=y.tensorIndex;this.outputLayers.push(e),this.outputLayersNodeIndices.push(t),this.outputLayersTensorIndices.push(n)}for(const y of this.inputs){const e=y.sourceLayer,t=y.nodeIndex,n=y.tensorIndex;eS(0===t,"input layer has >1 nodes"),eS(0===n,"input layer has >1 tensors"),this.inputLayers.push(e),this.inputLayersNodeIndices.push(t),this.inputLayersTensorIndices.push(n)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let y=0;y<this.inputLayers.length;y++){const t=this.inputLayers[y];if(!(t instanceof VC))throw new TypeError(`Input layers to a LayersModel must be InputLayer objects. Received inputs: ${e.inputs}. Input ${y} (0-based) originates from layer type ${t.getClassName()}.`);this.inputNames.push(t.name),this.feedInputShapes.push(t.batchInputShape),this.feedInputNames.push(t.name)}for(const y of this.outputLayers)this.outputNames.push(y.name);this.internalInputShapes=this.inputs.map((e=>e.shape)),this.internalOutputShapes=this.outputs.map((e=>e.shape));const t={},n={},r={},a={},s={},i=[],o=(e,t,n,r,a,l)=>{null!=r&&null!=a&&null!=l||(r=e.sourceLayer,a=e.nodeIndex,l=e.tensorIndex);const u=r.inboundNodes[a];if(-1!==n.indexOf(u))throw new Qw(`The tensor ${e.name} at layer "${r.name}" is part of a cycle.`);if(-1!==t.indexOf(u))return;this.containerNodes.add(XI.nodeKey(r,a)),r.id in s||(s[r.id]=Object.keys(s).length),-1===n.indexOf(u)&&n.push(u);const c=u.inboundLayers.length;for(let s=0;s<c;s++){const e=u.inputTensors[s],r=u.inboundLayers[s],a=u.nodeIndices[s],i=u.tensorIndices[s];o(e,t,n,r,a,i)}for(t.push(u);n.indexOf(u)>=0;)n.splice(n.indexOf(u),1);i.push(u)},l=[],u=[];for(const y of this.outputs)o(y,l,u);const c=i.slice().reverse();for(const y of c){n[y.id]=y,y.id in t||(t[y.id]=0);let e=t[y.id];const s=null==r[y.outboundLayer.id]?0:r[y.outboundLayer.id];e=Math.max(e,s),r[y.outboundLayer.id]=e,a[y.outboundLayer.id]=y.outboundLayer,t[y.id]=e;for(let r=0;r<y.inboundLayers.length;r++){const a=y.inboundLayers[r],s=y.nodeIndices[r],i=a.inboundNodes[s],o=null==t[i.id]?0:t[i.id];t[i.id]=Math.max(e+1,o),n[i.id]=i}}const d={};for(const y in t){const e=t[y];e in d||(d[e]=[]),d[e].push(n[y])}const h={};for(const y in r){const e=r[y];e in h||(h[e]=[]),h[e].push(a[y])}let p=Object.keys(h).map((e=>parseInt(e,10))).sort(cS);this.layers=[];for(const y of p){const e=h[y];e.sort(((e,t)=>{const n=s[e.id],r=s[t.id];return n<r?-1:n>r?1:0}));for(const t of e)t instanceof XI&&this.internalContainerRefs.push(t),this.layers.push(t)}this.layersByDepth=h,p=Object.keys(d).map((e=>parseInt(e,10))).sort(cS);const f=this.inputs.slice(),m=[];for(const y of p)for(const e of d[y]){const t=e.outboundLayer;if(null!=t){for(const n of e.inputTensors)if(-1===f.indexOf(n))throw new Qw(`Graph disconnected: cannot obtain value for tensor ${n} at layer "${t.name}". The following previous layers were accessed without issue: ${m}`);for(const t of e.outputTensors)f.push(t);m.push(t.name)}}this.nodesByDepth=d;const g=this.layers.map((e=>e.name));for(const y of g){const e=g.filter((e=>e===y)).length;if(1!==e)throw new Qw(`The name "${y}" is used ${e} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(g))}this.outboundNodes=[],this.inboundNodes=[],new BC({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map((e=>null)),outputMasks:this.outputs.map((e=>null)),inputShapes:this.inputs.map((e=>e.shape)),outputShapes:this.outputs.map((e=>e.shape))}),this.built=!0,this._refCount=1}assertNotDisposed(){if(0===this._refCount)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();const e={refCountAfterDispose:null,numDisposedVariables:0};if(0==--this._refCount){for(const t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(const t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach((t=>{t._trainableWeights.forEach((t=>t.trainable=e))})),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new Xw("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(const t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const e of this.layers)t.push(...e.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){const n={};let r=0;const a=(e=>{const t=Object.keys(e);if(0===t.length)return!1;const n=t[0].split("/");return!isNaN(parseInt(n[n.length-1],10))})(e);a&&this.parseWeights(e);for(const i of this.layers)for(const[e,t]of i.weights.entries()){const s=a?`${t.name.split("/").slice(0,-1).join("/")+"/"}${e}`:t.originalName;if(null!=n[s])throw new Xw(`Duplicate weight name: ${s}`);n[s]=t,r++}const s=[];for(const i in e){let r=i;if(null==n[i]){const e=i.split("/");r=e.slice(0,-2).concat([e[e.length-1]]).join("/")}if(null!=n[r])s.push([n[r],e[i]]);else if(t)throw new Xw(`Provided weight data has no target variable: ${i}`);delete n[r]}if(t){const e=[];for(const t in n)e.push(t);if(e.length>0)throw new Xw(`${e.length} of ${r} weights are not set: ${e}`)}FC(s)}parseWeights(e){for(const t in Object.keys(e)){const n=t.split("/"),r=["vars","layer_checkpoint_dependencies"],a=n.map((e=>e.startsWith("_")?e.slice(1):e)).filter((e=>!r.includes(e))).join("/");a!==t&&(e[a]=e[t],delete e[t])}}updatedConfig(){const e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${QI}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){const n=qI(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return lp((()=>{e=rS(e);const n=new UC;for(let t=0;t<this.inputs.length;++t)n.add(this.inputs[t],e[t]);return qC(this.outputs,n,t)}))}computeMask(e,t){return lp((()=>{let n;return e=rS(e),n=null==t?Yw(null,e.length):rS(t),this.runInternalGraph(e,n)[1]}))}computeOutputShape(e){const t=_C(e);if(t.length!==this.inputLayers.length)throw new Xw(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);const n={};for(let i=0;i<t.length;i++){const e=this.inputLayers[i],r=t[i];n[e.name+"_0_0"]=r}const r=Object.keys(this.nodesByDepth).map((e=>parseInt(e,10))).sort(cS);if(r.length>1)for(const i of r){const e=this.nodesByDepth[i];for(const t of e){const e=t.outboundLayer;if(-1!==this.inputLayers.map((e=>e.id)).indexOf(e.id))continue;const r=[];for(let i=0;i<t.inboundLayers.length;i++){const e=t.inboundLayers[i],a=t.nodeIndices[i],s=t.tensorIndices[i],o=n[`${e.name}_${a}_${s}`];r.push(o)}const a=_C(e.computeOutputShape(nS(r))),s=e.inboundNodes.indexOf(t);for(let t=0;t<a.length;t++){n[`${e.name}_${s}_${t}`]=a[t]}}}const a=[],s=[];for(let i=0;i<this.outputLayers.length;i++){const e=this.outputLayers[i],t=this.outputLayersNodeIndices[i],n=this.outputLayersTensorIndices[i],r=`${e.name}_${t}_${n}`;s.push(r)}for(let i=0;i<s.length;i++){const e=s[i];eS(e in n),a.push(n[e])}return nS(a)}runInternalGraph(e,t){null==t&&(t=Yw(null,e.length));const n={};for(let o=0;o<this.inputs.length;++o){const r=this.inputs[o],a=e[o],s=t[o];n[r.id]=[a,s]}const r=Object.keys(this.nodesByDepth).map((e=>parseInt(e,10))).sort(cS);for(const o of r){const e=this.nodesByDepth[o];for(const t of e){const e=t.outboundLayer,r=t.inputTensors,a=t.outputTensors,s=new Array;for(const t of r)t.id in n&&s.push(n[t.id]);if(s.length===r.length){let r,i,o,l,u={};if(null!=t.callArgs&&(u=t.callArgs),1===s.length){const[t,n]=s[0];null==u.mask&&(u.mask=n),o=rS(e.call(t,u)),l=rS(e.computeMask(t,n)),r=[t],i=[n]}else r=s.map((e=>e[0])),i=s.map((e=>e[1])),null==u.mask&&(u.mask=i),o=rS(e.call(r,u)),l=rS(e.computeMask(r,i));if(e.activityRegularizer)throw new Zw("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let e=0;e<a.length;++e){const t=a[e],r=o[e],s=l[e];n[t.id]=[r,s]}}}}const a=[],s=[],i=[];for(const o of this.outputs){eS(o.id in n,`Could not compute output ${o.name} : ${o.id}`);const[e,t]=n[o.id];i.push(e.shape),a.push(e),s.push(t)}return[a,s,i]}buildNodeConversionMap(e){const t={};let n;for(const r of this.layers){n=r instanceof XI?1:0;for(let e=0;e<r.inboundNodes.length;e++){const a=XI.nodeKey(r,e);this.containerNodes.has(a)&&(t[a]=n,n+=1)}}return t}getLayer(e,t){if(null!=t)return this.findLayer(t);if(null==e)throw new Xw("Provide either a layer name or layer index");if("number"==typeof e)return this.findLayer(e);for(const n of this.layers)if(n.name===e)return n;throw new Xw(`No such layer: ${e}`)}findLayer(e){if(this.layers.length<=e)throw new Xw(`Was asked to retrieve layer at index ${e}, but model only has ${this.layers.length} layer(s).`);return this.layers[e]}calculateLosses(){return lp((()=>{const e=[];for(const t of this.layers)for(let n=0;n<t.inboundNodes.length;++n){const r=XI.nodeKey(t,n);this.containerNodes.has(r)&&e.push(...t.calculateLosses())}return e}))}getConfig(){const e={name:this.name},t=this.buildNodeConversionMap(this.layers),n=[];for(const s of this.layers){const e=s.getClassName(),r=s.getConfig(),a=[];for(let n=0;n<s.inboundNodes.length;n++){const e=s.inboundNodes[n],r=XI.nodeKey(s,n);let i={};if(this.containerNodes.has(r)){if(e.callArgs)try{JSON.stringify(e.callArgs),i=e.callArgs}catch(RZ){i={}}if(e.inboundLayers.length>0){const n=[];for(let r=0;r<e.inboundLayers.length;r++){const a=e.inboundLayers[r],s=e.nodeIndices[r],o=e.tensorIndices[r];let l=t[XI.nodeKey(a,s)];null==l&&(l=0),n.push([a.name,l,o,i])}a.push(n)}}}const i={};i.name=s.name,i.className=e,i.config=r,i.inboundNodes=a,n.push(i)}e.layers=n;const r=[];for(let s=0;s<this.inputLayers.length;s++){const e=this.inputLayers[s],n=this.inputLayersNodeIndices[s],a=XI.nodeKey(e,n);if(!this.containerNodes.has(a))continue;let i=t[a];null==i&&(i=0);const o=this.inputLayersTensorIndices[s];r.push([e.name,i,o])}e.inputLayers=r;const a=[];for(let s=0;s<this.outputLayers.length;s++){const e=this.outputLayers[s],n=this.outputLayersNodeIndices[s],r=XI.nodeKey(e,n);if(!this.containerNodes.has(r))continue;let i=t[r];null==i&&(i=0);const o=this.outputLayersTensorIndices[s];a.push([e.name,i,o])}return e.outputLayers=a,e}static fromConfig(e,t,n={},r=!1){const a={},s={};function i(e,t){e.name in s?s[e.name].push(t):s[e.name]=[t]}function o(e,t){const n=[];let r;for(const s of t){const o=s[0],l=s[1],u=s[2];if(r=null==s[3]?{}:s[3],!(o in a))return void i(e,t);const c=a[o];if(c.inboundNodes.length<=l)return void i(e,t);const d=c.inboundNodes[l];n.push(d.outputTensors[u])}n.length>0&&e.apply(nS(n),r)}function l(e){const n=e.name,s=vI(e,null!=t.customObjects?t.customObjects:{});s.setFastWeightInitDuringBuild(r),a[n]=s;e.inboundNodes.forEach((e=>{if(!(e instanceof Array))throw new Xw(`Corrupted configuration, expected array for nodeData: ${e}`);i(s,e)}))}const u=t.name,c=t.layers;for(const m of c)l(m);for(;!hS(s);)for(const e of c){const t=a[e.name];if(t.name in s){const e=s[t.name];delete s[t.name];for(const n of e)o(t,n)}}const d=[],h=[],p=t.inputLayers;for(const m of p){const e=m[0],t=m[1],n=m[2];eS(e in a);const r=a[e].inboundNodes[t].outputTensors;d.push(r[n])}const f=t.outputLayers;for(const m of f){const e=m[0],t=m[1],n=m[2];eS(e in a);const r=a[e].inboundNodes[t].outputTensors;h.push(r[n])}return new e({inputs:d,outputs:h,name:u})}get stateful(){if(this._stateful)throw new Xw("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(const e of this.layers)if(e.stateful)return!0;return!1}resetStates(){lp((()=>{this.layers.forEach((e=>{e.stateful&&e.resetStates()}))}))}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function ZI(e,t){return function(e,t,n){const r=t.length;if(null==e||Array.isArray(e)&&0===e.length)return t.map((e=>null));if(1===r)return Array.isArray(e)&&1===e.length?e:"object"==typeof e&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==r)throw new Error(`Provided ${n} is an array of ${e.length} element(s), but the model has ${r} outputs. Make sure a set of weights is provided for each model output.`);return e}if("object"==typeof e&&Object.keys(e).length>0&&"object"==typeof e[Object.keys(e)[0]]){const n=[];return t.forEach((t=>{t in e?n.push(e[t]):n.push(null)})),n}throw new Error(`The model has multiple (${r}) outputs, so ${n} must be either an array with ${r} elements or an object with ${t} keys. Provided ${n} not understood: ${JSON.stringify(e)}`)}(e,t,"classWeight")}async function KI(e,t,n,r){if(null!=t||null!=r)throw new Error("Support sampleWeight is not implemented yet");if(null!=n){const t=lp((()=>{if(1===e.shape.length)return df(e);if(2===e.shape.length){if(e.shape[1]>1){return wf(e,1)}if(1===e.shape[1])return Hf(e,[e.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${e.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}throw new Error(`Unexpected rank of target (y) tensor (${e.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)})),r=Array.from(await t.data());up(t);const a=[];return r.forEach((e=>{if(null==n[e])throw new Error(`classWeight must contain all classes in the training data. The class ${e} exists in the data but not in classWeight`);a.push(n[e])})),Db(a,"float32")}return null}function JI(e,t){return gf(e,t)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function YI(e,t){let n,r;const a=t;n=a.xs,r=a.ys,Xi(null!=n&&null!=r,(()=>`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor.  The provided Dataset instead generates ${t}`));const s=eW("input",e.inputNames,n),i=eW("output",e.outputNames,r),o=s[0].shape[0];Xi(s.length===e.inputs.length,(()=>`LayersModel has ${e.inputs.length} inputs, but the dataset provides ${s.length} inputs.  (Expected input keys: ${JSON.stringify(e.inputNames)})`)),Xi(i.length===e.outputs.length,(()=>`LayersModel has ${e.outputs.length} outputs, but the dataset provides ${i.length} outputs.  (Expected output keys: ${JSON.stringify(e.outputNames)})`));for(let l=0;l<s.length;l++)Xi(s[l].shape[0]===o,(()=>`Batch size mismatch: input ${e.inputNames[l]} has ${s[l].shape[0]}; expected  ${o} based on input ${e.inputNames[0]}.`));for(let l=0;l<i.length;l++)Xi(i[l].shape[0]===o,(()=>`Batch size mismatch: output ${e.outputNames[l]} has ${i[l].shape[0]}; expected  ${o} based on input ${e.inputNames[0]}.`));return{xs:s,ys:i}}function eW(e,t,n){if(n instanceof fh)return[n];if(Array.isArray(n))return Xi(n.length===t.length,(()=>`Received an array of ${n.length} Tensors, but expected ${t.length} to match the ${e} keys ${t}.`)),n;{const r=[];for(const a of t){if(null==n[a])throw new Xw(`The feature data generated by the dataset lacks the required ${e} key '${a}'.`);r.push(n[a])}return r}}async function tW(e,t,n){const r=null!=n.batchesPerEpoch;if(Xi(null!=e.optimizer,(()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig).")),Xi(null!=n,(()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call.")),Xi(null!=n.epochs&&n.epochs>0&&Number.isInteger(n.epochs),(()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${n.epochs}`)),Xi(!r||n.batchesPerEpoch>0&&Number.isInteger(n.batchesPerEpoch),(()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${n.batchesPerEpoch}`)),Xi(null==n.validationSplit,(()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead.")),e.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");e.isTraining=!0;try{const a=null!=n.validationData;let s,i;if(a)if(nW(n.validationData))Xi(null==n.validationBatches||n.validationBatches>0&&Number.isInteger(n.validationBatches),(()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${n.validationBatches}`));else{const e=function(e){if(3===e.length)throw new Zw("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}(n.validationData);s=e.xs,i=e.ys}const o=e.makeTrainFunction(),l=e.getDedupedMetricsNames();let u;u=a?l.slice().concat(l.map((e=>"val_"+e))):l.slice();const c=gI(n.callbacks,n.yieldEvery),d=null==n.verbose?1:n.verbose,{callbackList:h,history:p}=bI(c,d,n.epochs,null,null,function(e,t){let n=null;null!=t.batchesPerEpoch?n=t.batchesPerEpoch:Number.isFinite(e.size)&&(n=e.size);return n}(t,n),null,a,u);h.setModel(e),e.history=p,await h.onTrainBegin(),e.stopTraining_=!1;let f=null==n.initialEpoch?0:n.initialEpoch,m=await t.iterator();for(;f<n.epochs;){const u={};await h.onEpochBegin(f);let c=0,d=0;for(r||(m=await t.iterator());!r||c<n.batchesPerEpoch;){const t=await m.next();if(r&&t.done)break;if(null!=t.value){const{xs:r,ys:a}=YI(e,t.value),s={};s.batch=d,s.size=r[0].shape[0],await h.onBatchBegin(d,s);const i=[];if(null!=n.classWeight){const t=ZI(n.classWeight,e.outputNames);for(let e=0;e<t.length;++e)i.push(await KI(a[e],null,t[e]))}const u=r.concat(a).concat(i),p=o(u);up(u);for(let e=0;e<l.length;++e){const t=l[e],n=p[e];s[t]=n,cp(n)}await h.onBatchEnd(d,s),lI(s),d++,c++}if(r?c>=n.batchesPerEpoch:t.done){if(a){let t;t=nW(n.validationData)?rS(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):rS(e.evaluate(s,i,{batchSize:null==n.validationBatchSize?32:n.validationBatchSize,verbose:0}));for(let n=0;n<e.metricsNames.length;++n)u[`val_${e.metricsNames[n]}`]=t[n]}break}if(e.stopTraining_)break}if(await h.onEpochEnd(f,u),f++,e.stopTraining_)break}return await h.onTrainEnd(),await e.history.syncData(),e.history}finally{e.isTraining=!1}}function nW(e){return"function"==typeof e.iterator}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function rW(e){Xi(e>0&&Number.isInteger(e),(()=>`batchSize is required to be a positive integer, but got ${e}`))}function aW(e,t,n){return null==e?[null]:Array.isArray(e)?e.map((e=>HS(e,t,n-t))):HS(e,t,n-t)}function sW(e,t){return lp((()=>null==e?null:Array.isArray(e)?e.map((e=>sW(e,t))):YS(e,"int32"===t.dtype?t:cf(t,"int32"))))}function iW(e,t){const n=[];let r=0,a=null;for(;r<e;)a=r+t,a>=e&&(a=e),n.push([r,a]),r=a;return n}function oW(e){const t=[];e instanceof fh&&(e=[e]);for(let n=0;n<e.length;++n){const r=e[n];if(1===r.rank)t.push(US(r,1));else{if(0===r.rank)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");t.push(r)}}return t}function lW(e,t){if(null==e)return;const n=[];if(t instanceof fh)n.push(t.id);else if(Array.isArray(t))t.forEach((e=>n.push(e.id)));else if(null!=t)for(const a in t){const e=t[a];n.push(e.id)}const r=[];if(e instanceof fh)-1===n.indexOf(e.id)&&r.push(e);else if(Array.isArray(e))e.forEach((e=>{-1===n.indexOf(e.id)&&r.push(e)}));else if(null!=e)for(const a in e){const t=e[a];-1===n.indexOf(t.id)&&r.push(t)}r.forEach((e=>{e.isDisposed||e.dispose()}))}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function uW(e){return Array.isArray(e)}function cW(e){return!function(e){return e instanceof fh}(e)&&!uW(e)}function dW(e,t,n,r=!0,a=""){if(null==t||0===t.length){if(null!=e){let t=!1;if(uW(e)&&e.length>0)t=!0;else if(cW(e)){for(const n in e)if(e.hasOwnProperty(n)){t=!0;break}}else t=!0;if(t)throw new Xw(`Error when checking model ${a} expected no data, but got ${e}`)}return[]}if(null==e)return t.map((e=>null));let s;if(cW(e)){s=[];for(const n of t){if(null==e[n])throw new Xw(`No data provided for "${n}". Need data for each key in: ${t}`);s.push(e[n])}}else if(uW(e)){if(e.length!==t.length)throw new Xw(`Error when checking model ${a}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${t.length} Tensor(s), but instead got the following list of Tensor(s): ${e}`);s=e}else{if(t.length>1)throw new Xw(`The model ${a} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);s=[e]}if(s=oW(s),null!=n)for(let i=0;i<t.length;++i){if(null==n[i])continue;const e=s[i];if(e.shape.length!==n[i].length)throw new Xw(`Error when checking ${a}: expected ${t[i]} to have ${n[i].length} dimension(s). but got array with shape ${e.shape}`);for(let t=0;t<n[i].length;++t){if(0===t&&!r)continue;const s=e.shape[t],o=n[i][t];if(null!=o&&o>=0&&s!==o)throw new Xw(`${a} expected a batch of elements where each example has shape [${n[i].slice(1,n[i].length)}] (i.e.,tensor shape [*,${n[i].slice(1,n[i].length)}]) but the ${a} received an input with ${e.shape[0]} examples, each with shape [${e.shape.slice(1,e.shape.length)}] (tensor shape [${e.shape}])`)}}return s}function hW(e,t,n,r=!0,a=""){let s;if(Array.isArray(e)){if(e.length!==t.length)throw new Xw(`Error when checking model ${a}: the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see ${t.length} Tensor(s), but instead got ${e.length} Tensors(s).`);s=e}else{if(t.length>1)throw new Xw(`The model expects ${t.length} ${a} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(e.shape)}.`);s=[e]}if(null!=n)for(let i=0;i<t.length;++i){if(null==n[i])continue;const e=s[i];if(e.shape.length!==n[i].length)throw new Xw(`Error when checking ${a}: expected ${t[i]} to have ${n[i].length} dimension(s), but got array with shape ${JSON.stringify(e.shape)}`);for(let s=0;s<n[i].length;++s){if(0===s&&!r)continue;const o=e.shape[s],l=n[i][s];if(null!=l&&l!==o)throw new Xw(`Error when checking ${a}: expected ${t[i]} to have shape ${JSON.stringify(n[i])} but got array with shape ${JSON.stringify(e.shape)}.`)}}}class pW extends XI{constructor(e){super(e),this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new Xw("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");zI(this,e,t,n)}compile(e){if(null==e.loss&&(e.loss=[]),this.loss=e.loss,"string"==typeof e.optimizer)this.optimizer_=function(e){const t={Adagrad:()=>Sx.adagrad(.01),Adadelta:()=>Sx.adadelta(1,.95,GS()),Adam:()=>Sx.adam(.001,.9,.999,GS()),Adamax:()=>Sx.adamax(.002,.9,.999,GS(),0),RMSProp:()=>Sx.rmsprop(.001,.9,0,GS()),SGD:()=>Sx.sgd(.01)};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new Xw(`Unknown Optimizer ${e}`)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof IA))throw new Xw("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(Array.isArray(e.loss)||"string"==typeof e.loss||"function"==typeof e.loss)if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new Xw(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);const n=e.loss;t=n.map((e=>TI(e)))}else{const n=TI(e.loss);this.outputs.forEach((e=>{t.push(n)}))}else{e.loss=e.loss;for(const t in e.loss)if(-1===this.outputNames.indexOf(t))throw new Xw(`Unknown entry in loss dictionary: "${t}". Only expected the following keys: ${this.outputNames}`);for(const n of this.outputNames)e.loss[n],t.push(TI(e.loss[n]))}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let s=0;s<this.outputs.length;++s){const e=this.internalOutputShapes[s],t=this.outputNames[s];this.feedOutputNames.push(t),this.feedOutputShapes.push(e),this.feedLossFns.push(this.lossFunctions[s])}const n=[];this.metrics=e.metrics,this.metricsNames=["loss"],this.metricsTensors=[],RS("loss",(()=>{for(let e=0;e<this.outputs.length;++e){if(-1!==n.indexOf(e))continue;const t=this.lossFunctions[e];this.outputs.length>1&&(this.metricsTensors.push([t,e]),this.metricsNames.push(this.outputNames[e]+"_loss"))}}));const r=function(e,t){if(null==e||Array.isArray(e)&&0===e.length)return t.map((e=>[]));let n;if("string"==typeof e||"function"==typeof e)n=[e];else{if(!Array.isArray(e)&&"object"!=typeof e)throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${e}`);n=e}if(Array.isArray(n))return t.map((e=>n));{const e=[];for(const r of t){let t=n.hasOwnProperty(r)?n[r]:[];Array.isArray(t)||(t=[t]),e.push(t)}return e}}(e.metrics,this.outputNames),a=(e,t,n)=>{this.outputNames.length>1&&(t=this.outputNames[e]+"_"+t),this.metricsNames.push(t),this.metricsTensors.push([n,e])};RS("metric",(()=>{for(let e=0;e<this.outputs.length;++e){if(-1!==n.indexOf(e))continue;(t=>{let n,r,s;for(const i of t){if("string"==typeof i&&-1!==["accuracy","acc","crossentropy","ce"].indexOf(i)){const t=this.internalOutputShapes[e];let a;1===t[t.length-1]||this.lossFunctions[e]===II?-1!==["accuracy","acc"].indexOf(i)?r=NI:-1!==["crossentropy","ce"].indexOf(i)&&(r=RI):this.lossFunctions[e]===CI?-1!==["accuracy","acc"].indexOf(i)?r=$I:-1!==["crossentropy","ce"].indexOf(i)&&(r=FI):-1!==["accuracy","acc"].indexOf(i)?r=EI:-1!==["crossentropy","ce"].indexOf(i)&&(r=OI),-1!==["accuracy","acc"].indexOf(i)?a="acc":-1!==["crossentropy","ce"].indexOf(i)&&(a="ce"),s=r,n=""+a}else{const e=MI(i);s=e,n=""+LI(i)}let t;RS(n,(()=>{t=s})),a(e,n,t)}})(r[e])}})),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){null!=this.collectedTrainableWeights&&(this.trainableWeights.length,this.collectedTrainableWeights.length)}evaluate(e,t,n={}){const r=null==n.batchSize?32:n.batchSize;rW(r);const a=this.standardizeUserDataXY(e,t,!0,r);try{const e=a[0].concat(a[1]);this.makeTestFunction();const t=this.testFunction;return nS(this.testLoop(t,e,r,n.verbose,n.steps))}finally{lW(a[0],e),lW(a[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),async function(e,t,n){const r=null!=(n=n||{}).batches,a=e.testFunction;let s=[];if(n.verbose>0)throw new Zw("Verbose mode is not implemented yet.");Xi(!r||n.batches>0&&Number.isInteger(n.batches),(()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(n.batches)}`));const i="function"==typeof t.next?t:await t.iterator();let o=0,l=0;for(;!r||l<n.batches;){const t=await i.next();if(s=lp((()=>{if(t.value){const{xs:n,ys:r}=YI(e,t.value),i=n.concat(r),u=lp((()=>a(i)));if(up(i),0===l)for(let e=0;e<u.length;++e)s.push(ng(0));const c=i[0].shape[0];for(let e=0;e<u.length;++e){const t=u[e],n=s[e];s[e]=lp((()=>pf(s[e],gf(c,t)))),l>0&&up(n)}up(u),o+=c,++l}return s})),t.done)break}for(let u=0;u<s.length;++u){const e=s[u];s[u]=mf(s[u],o),up(e)}return nS(s)}(this,e,t)}checkNumSamples(e,t,n,r="steps"){let a;if(null!=n){if(a=null,null!=t)throw new Xw(`If ${r} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else{if(null==e)throw new Xw(`Either the input data should have a defined shape, or ${r} shoud be specified.`);a=Array.isArray(e)?e[0].shape[0]:e.shape[0]}return a}execute(e,t){if(Array.isArray(t)&&0===t.length)throw new Xw("`outputs` is an empty Array, which is not allowed.");const n=Array.isArray(t),r=n?t:[t],a=this.retrieveSymbolicTensors(r),s=new UC;if(e instanceof fh&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new Xw(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let t=0;t<this.inputs.length;++t)s.add(this.inputs[t],e[t])}else for(const o of this.inputs){const t=e[o.name];if(null==t)throw new Xw(`No value is provided for the model's input ${o.name}`);s.add(o,t)}const i=qC(a,s);return n?i:i[0]}retrieveSymbolicTensors(e){const t=Yw(null,e.length);let n=e.length;for(const r of this.layers){const a=Array.isArray(r.output)?r.output:[r.output],s=a.map((e=>e.name));for(let r=0;r<e.length;++r){const i=s.indexOf(e[r]);if(-1!==i&&(t[r]=a[i],n--),0===n)break}if(0===n)break}if(n>0){const n=[];throw t.forEach(((t,r)=>{null==t&&n.push(e[r])})),new Xw(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(n)}`)}return t}predictLoop(e,t=32,n=!1){return lp((()=>{const r=this.checkNumSamples(e);if(n)throw new Zw("Verbose predictLoop() is not implemented yet.");const a=iW(r,t),s=this.outputs.map((e=>[]));for(let t=0;t<a.length;++t){lp((()=>{const n=a[t][0],r=a[t][1],s=aW(e,n,r),i=[];if(Array.isArray(s))for(let e=0;e<s.length;++e)i.push({key:this.inputs[e],value:s[e]});else i.push({key:this.inputs[0],value:s});const o=new UC(i);return qC(this.outputs,o)})).forEach(((e,t)=>s[t].push(e)))}return nS(s.map((e=>Qf(e,0))))}))}predict(e,t={}){const n=oW(e);hW(n,this.inputNames,this.feedInputShapes,!1);try{const e=null==t.batchSize?32:t.batchSize;return rW(e),this.predictLoop(n,e)}finally{lW(n,e)}}predictOnBatch(e){hW(e,this.inputNames,this.feedInputShapes,!0);const t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,n=!0,r){if(null==this.optimizer_)throw new Qw("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");const a=[];for(let s=0;s<this.feedOutputShapes.length;++s){const e=this.feedOutputShapes[s];this.feedLossFns[s]===CI?a.push(e.slice(0,e.length-1).concat([1])):a.push(e)}if(function(e,t){const n=dS(e.map((e=>e.shape[0])));n.sort();const r=dS(t.map((e=>e.shape[0])));if(r.sort(),n.length>1)throw new Xw(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map((e=>e.shape)))}`);if(r.length>1)throw new Xw(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map((e=>e.shape)))}`);if(n.length>0&&r.length>0&&!eo(n,r))throw new Xw(`Input Tensors should have the same number of samples as target Tensors. Found ${n[0]} input sample(s) and ${r[0]} target sample(s).`)}(e=dW(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=dW(t,this.feedOutputNames,a,!1,"target")),function(e,t,n){const r=[xI,II,SI];for(let a=0;a<e.length;++a){const s=e[a],i=t[a],o=n[a];if(null!=i){if(i===SI&&1===s.shape[s.shape.length-1])throw new Xw(`You are passing a target array of shape ${s.shape} while using a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].`);if(-1!==r.indexOf(i)){const e=s.shape.slice(1),t=o.slice(1);for(let n=0;n<e.length;++n){const r=e[n],a=t[n];if(null!=a&&r!==a)throw new Xw(`A target Tensor with shape ${s.shape} was passed for an output of shape ${o}, while using a loss function that expects targets to have the same shape as the output.`)}}}}}(t,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=r&&r>0&&e[0].shape[0]%r!=0)throw new Xw(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${r}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,n,r,a=!0,s){const[i,o]=this.standardizeUserDataXY(e,t,a,s);if(null!=n)throw new Error("sample weight is not supported yet.");let l=null;if(null!=r){const e=ZI(r,this.outputNames);l=[];for(let t=0;t<e.length;++t)l.push(await KI(o[t],null,e[t]))}return[i,o,l]}testLoop(e,t,n,r=0,a){return lp((()=>{const s=this.checkNumSamples(t,n,a,"steps"),i=[];if(r>0)throw new Zw("Verbose mode is not implemented yet.");if(null!=a)throw new Zw("steps mode in testLoop() is not implemented yet");{const r=iW(s,n),a=Db(PS(0,s));for(let n=0;n<r.length;++n){const s=r[n][0],o=r[n][1],l=HS(a,s,o-s),u=sW(t,l),c=e(u);if(0===n)for(let e=0;e<c.length;++e)i.push(ng(0));for(let e=0;e<c.length;++e){const t=c[e];i[e]=pf(i[e],gf(o-s,t))}}for(let e=0;e<i.length;++e)i[e]=mf(i[e],s)}return i}))}getDedupedMetricsNames(){const e=this.metricsNames,t=[];for(let n=0;n<e.length;++n){const r=e[n];let a=r;if(tS(e,r)>1){a+=`_${tS(e.slice(0,n),r)}`}t.push(a)}return t}makeTrainFunction(){return e=>{const t=[],n=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),a=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+2*this.outputs.length),s=[],i=this.collectedTrainableWeights.map((e=>e.read()));return[this.optimizer_.minimize((()=>{const e=[];for(let t=0;t<this.inputs.length;++t)e.push({key:this.inputs[t],value:n[t]});const i=new UC(e),o=qC(this.outputs,i,{training:!0});let l;for(let n=0;n<this.lossFunctions.length;++n){let e=(0,this.lossFunctions[n])(r[n],o[n]);null!=a[n]&&(e=JI(e,a[n]));const s=Xg(e);t.push(s),l=0===n?e:pf(l,e)}for(let n=0;n<this.metricsTensors.length;++n){let e;if(this.outputs.length>1&&n<this.outputs.length)e=t[n];else{const t=this.metricsTensors[n][0],a=this.metricsTensors[n][1];e=Xg(t(r[a],o[a]))}cp(e),s.push(e)}return l=Xg(l),this.calculateLosses().forEach((e=>{l=pf(l,e)})),l}),!0,i)].concat(s)}}makeTestFunction(){this.testFunction=e=>lp((()=>{const t=[];let n;const r=e.slice(0,this.inputs.length),a=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),s=[];for(let e=0;e<this.inputs.length;++e)s.push({key:this.inputs[e],value:r[e]});const i=new UC(s),o=qC(this.outputs,i);for(let e=0;e<this.lossFunctions.length;++e){const r=this.lossFunctions[e],s=Xg(r(a[e],o[e]));n=0===e?s:pf(n,s),t.push(n)}for(let e=0;e<this.metricsTensors.length;++e){const n=this.metricsTensors[e][0],r=this.metricsTensors[e][1],s=Xg(n(a[r],o[r]));t.push(s)}return t}))}async fit(e,t,n={}){if(this.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");let r,a,s,i,o,l,u,c,d;this.isTraining=!0;try{const h=null==n.batchSize?32:n.batchSize;rW(h);const p=!1,f=await this.standardizeUserData(e,t,n.sampleWeight,n.classWeight,p,h);r=f[0],a=f[1],d=f[2];let m,g=!1;if(null!=n.validationData&&n.validationData.length>0){if(g=!0,2!==n.validationData.length)throw 3===n.validationData.length?new Zw("validationData including sample weights is not supported yet."):new Xw(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${n.validationData} is invalid.`);o=n.validationData[0],l=n.validationData[1];const e=!0,t=await this.standardizeUserData(o,l,null,null,e,h);u=t[0],c=t[1],m=u.concat(c)}else if(null!=n.validationSplit&&n.validationSplit>0&&n.validationSplit<1){g=!0;const e=Math.floor(r[0].shape[0]*(1-n.validationSplit)),t=r[0].shape[0];u=aW(r,e,t),s=r,r=aW(r,0,e),c=aW(a,e,t),i=a,a=aW(a,0,e),m=u.concat(c)}else null!=n.validationSteps&&(g=!0);const y=r.concat(a).concat(d);this.checkTrainableWeightsConsistency();const b=this.makeTrainFunction(),v=this.getDedupedMetricsNames();let A,x;g?(this.makeTestFunction(),A=this.testFunction,x=v.slice().concat(v.map((e=>"val_"+e)))):(A=null,m=[],x=v.slice());const k=gI(n.callbacks,n.yieldEvery);return await this.fitLoop(b,y,v,h,n.epochs,n.verbose,k,A,m,n.shuffle,x,n.initialEpoch,null,null)}finally{this.isTraining=!1,lW(r,e),lW(a,t),lW(s,e),lW(i,t),lW(u,o),lW(c,l),null!=d&&up(d)}}async fitLoop(e,t,n,r,a,s,i,o,l,u,c,d,h,p){null==r&&(r=32),null==a&&(a=1),null==u&&(u=!0),null==d&&(d=0);let f=!1;if(null!=o&&null!=l&&(f=!0),null!=p&&(f=!0,null==h))throw new Xw("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");const m=this.checkNumSamples(t,r,h,"steps_per_epoch");let g;null!=m&&(g=PS(0,m)),null==s&&(s=1);const{callbackList:y,history:b}=bI(i,s,a,d,m,h,r,f,c);y.setModel(this),this.history=b,await y.onTrainBegin(),this.stopTraining_=!1;for(let v=d;v<a;++v){await y.onEpochBegin(v);const a={};if(null!=h)throw new Zw("stepsPerEpoch mode is not implemented yet.");{if("batch"===u)throw new Zw("batch shuffling is not implemneted yet");u&&Ui(g);const s=Db(g),i=iW(m,r);for(let u=0;u<i.length;++u){const c={};if(await y.onBatchBegin(u,c),lp((()=>{const d=i[u][0],h=i[u][1],p=HS(s,d,h-d);c.batch=u,c.size=h-d;const m=sW(t,p),g=e(m);for(let e=0;e<n.length;++e){const t=n[e],r=g[e];c[t]=r,cp(r)}if(u===i.length-1&&f){const e=this.testLoop(o,l,r);for(let t=0;t<n.length;++t){const r=n[t],s=e[t];cp(s),a["val_"+r]=s}}})),await y.onBatchEnd(u,c),lI(c),this.stopTraining_)break}s.dispose()}if(await y.onEpochEnd(v,a),this.stopTraining_)break}return await y.onTrainEnd(),await this.history.syncData(),this.history}async fitDataset(e,t){return tW(this,e,t)}async trainOnBatch(e,t){const n=await this.standardizeUserData(e,t),r=n[0],a=n[1],s=this.makeTrainFunction()(r.concat(a)),i=[];for(const o of s){const e=await o.data();i.push(e[0])}return up(s),lW(n[0],e),lW(n[1],t),nS(i)}getNamedWeights(e){const t=[],n=null!=e&&e.trainableOnly,r=n?this.trainableWeights:this.weights,a=this.getWeights(n);for(let s=0;s<r.length;++s)n&&!r[s].trainable||t.push({name:r[s].originalName,tensor:a[s]});return t}set stopTraining(e){this.stopTraining_=e}get stopTraining(){return this.stopTraining_}get optimizer(){return this.optimizer_}set optimizer(e){this.optimizer_!==e&&(this.optimizer_=e,this.isOptimizerOwned=!1)}dispose(){const e=super.dispose();if(0===e.refCountAfterDispose&&null!=this.optimizer&&this.isOptimizerOwned){const t=op().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=t-op().numTensors}return e}getLossIdentifiers(){let e;if("string"==typeof this.loss)e=aS(this.loss);else if(Array.isArray(this.loss)){for(const e of this.loss)if("string"!=typeof e)throw new Error("Serialization of non-string loss is not supported.");e=this.loss.map((e=>aS(e)))}else{const t=Object.keys(this.loss);e={};const n=this.loss;for(const r of t){if("string"!=typeof n[r])throw new Error("Serialization of non-string loss is not supported.");e[r]=aS(n[r])}}return e}getMetricIdentifiers(){if("string"==typeof this.metrics||"function"==typeof this.metrics)return[aS(LI(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map((e=>aS(LI(e))));{const e={};for(const t in this.metrics)e[t]=aS(LI(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(null!=e.weighted_metrics)throw new Error("Loading weight_metrics is not supported yet.");if(null!=e.loss_weights)throw new Error("Loading loss_weights is not supported yet.");if(null!=e.sample_weight_mode)throw new Error("Loading sample_weight_mode is not supported yet.");const t=vI(jI(e.optimizer_config));let n,r;if("string"==typeof e.loss)n=sS(e.loss);else if(Array.isArray(e.loss))n=e.loss.map((e=>sS(e)));else if(null!=e.loss){n={};for(const t in e.loss)n[t]=sS(e.loss[t])}if(Array.isArray(e.metrics))r=e.metrics.map((e=>sS(e)));else if(null!=e.metrics){r={};for(const t in e.metrics)r[t]=sS(e.metrics[t])}this.compile({loss:n,metrics:r,optimizer:t})}async save(e,t){if("string"==typeof e){const t=Rp(e);if(0===t.length)throw new Xw(`Cannot find any save handlers for URL '${e}'`);if(t.length>1)throw new Xw(`Found more than one (${t.length}) save handlers for URL '${e}'`);e=t[0]}if(null==e.save)throw new Xw("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const n=await fp(this.getNamedWeights(t)),r={modelTopology:this.toJSON(null,!1),format:"layers-model",generatedBy:`TensorFlow.js tfjs-layers v${QI}`,convertedBy:null};if(null!=t&&t.includeOptimizer&&null!=this.optimizer){r.trainingConfig=this.getTrainingConfig();const e="optimizer",{data:t,specs:a}=await fp(await this.optimizer.getWeights(),e);n.specs.push(...a),n.data=Sp([n.data,t])}if(null!=this.userDefinedMetadata){const e=!0;BI(this.userDefinedMetadata,this.name,e),r.userDefinedMetadata=this.userDefinedMetadata}return r.weightData=n.data,r.weightSpecs=n.specs,e.save(r)}setUserDefinedMetadata(e){BI(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}}pW.className="Model",SA(pW);class fW extends pW{}fW.className="Functional",SA(fW);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class mW extends pW{constructor(e){if(super({inputs:[],outputs:[]}),e=e||{},this.trainable=!0,this.built=!1,this.name=null!=e.name?e.name:xS("sequential_"),null!=e.layers)for(const t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some((e=>e<0)))throw new Xw(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){const t=e instanceof mW||e instanceof pW;let n;if(t){if(n=e,1!==n.outputs.length)throw new Xw("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(1!==n.inputs.length)throw new Xw("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(0===this.outputs.length){if(0===e.inboundNodes.length){if(null==e.batchInputShape)throw new Xw("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");const t=function(e){if(null==e.batchShape&&null==e.shape)throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");if(null!=e.batchShape&&null!=e.shape)throw new Xw("Please provide either a `shape` or `batchShape` argument to Input, but not both.");let t=e.batchShape;null!=e.shape&&null==t&&(t=[null].concat(e.shape));let n=e.dtype;return null==n&&(n="float32"),new VC({batchInputShape:t,name:e.name,dtype:n,sparse:e.sparse}).inboundNodes[0].outputTensors[0]}({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(t)}if(t)this.outputs=n.outputs,this.inputs=n.inputs;else{if(1!==e.inboundNodes.length)throw new Xw(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(1!==e.inboundNodes[0].outputTensors.length)throw new Xw("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=GC(this.outputs[0])}this.inboundNodes=[],new BC({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:Yw(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map((e=>e.shape)),outputShapes:this.outputs[0].shape})}else{const t=e.apply(this.outputs[0]);if(Array.isArray(t))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[t],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(0===this.layers.length)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),0===this.layers.length)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{const e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return null==this.model&&this.build(),this.model.call(e,t)}build(e){if(NC(e),0===this.inputs.length||0===this.outputs.length)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new pW({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,n=console.log){this.built||this.build(),super.summary(e,t,n)}setWeights(e){null==this.model&&this.build(),this.model.setWeights(e)}evaluate(e,t,n={}){if(!this.built)throw new Qw("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}async evaluateDataset(e,t){if(!this.built)throw new Qw("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return null==this.model&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return null==this.model&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return null==this.model?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,n={}){if(!this.built)throw new Qw("The model needs to be compiled before being used.");return this.model.fit(e,t,n)}async fitDataset(e,t){if(!this.built)throw new Qw("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,n={},r=!1){let a,s={};if(t instanceof Array){if(null==t[0].className||"Merge"===t[0].className)throw new Xw("Legacy serialization format not supported yet.");a=t}else Xi(null!=t.layers,(()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field.")),a=t.layers,delete t.layers,s=t;const i=new e(s);if(!(i instanceof mW))throw new Zw(`Sequential.fromConfig called on non-Sequential input: ${i}`);for(const o of a){const e=vI(o,void 0,r);r&&e.setFastWeightInitDuringBuild(!0),i.add(e)}return i}set stopTraining(e){if(null==this.model)throw new Xw("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(null==this.model)throw new Xw("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){const e=[];for(const t of this.layers){const n={};n.className=t.getClassName(),n.config=t.getConfig(),e.push(n)}return{name:this.name,layers:e}}}mW.className="Sequential",SA(mW);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
let gW=class extends kA{getConfig(){return{}}};class yW extends gW{apply(e,t=1){return function(e,t=1){if(1!==t)throw new Zw(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return Gm(e)}(e,t)}}yW.className="elu",SA(yW);class bW extends gW{apply(e){return fb(e)}}bW.className="selu",SA(bW);class vW extends gW{apply(e){return sb(e)}}vW.className="relu",SA(vW);class AW extends gW{apply(e){return lp((()=>Yg(6,sb(e))))}}AW.className="relu6",SA(AW);class xW extends gW{apply(e){return e}}xW.className="linear",SA(xW);class kW extends gW{apply(e){return Zf(e)}}kW.className="sigmoid",SA(kW);class wW extends gW{apply(e){return function(e){return lp((()=>{const t=pf(.5,gf(.2,e));return dm(t,0,1)}))}(e)}}wW.className="hardSigmoid",SA(wW);class SW extends gW{apply(e){return $g(e)}}SW.className="softplus",SA(SW);class CW extends gW{apply(e){return function(e){return lp((()=>mf(e,pf(yf(e),1))))}(e)}}CW.className="softsign",SA(CW);class IW extends gW{apply(e){return Jf(e)}}IW.className="tanh",SA(IW);let WW=class extends gW{apply(e,t=-1){return Sb(e,t)}};WW.className="softmax",SA(WW);class _W extends gW{apply(e,t=-1){return Dg(e,t)}}_W.className="logSoftmax",SA(_W);class TW extends gW{apply(e){return lp((()=>lp((()=>{const t=Math.sqrt(2),n=gf(.5,pf(1,Um(mf(e,t))));return gf(e,n)}))))}}TW.className="gelu",SA(TW);class NW extends gW{apply(e){return lp((()=>gf(.5,gf(e,pf(1,Jf(gf(rg(mf(2,Math.PI)),pf(e,gf(.044715,tg(e,3))))))))))}}NW.className="gelu_new",SA(NW);class EW extends gW{apply(e){return lp((()=>gf(e,Jf($g(e)))))}}EW.className="mish",SA(EW);class RW extends gW{apply(e,t=1){return lp((()=>gf(Zf(gf(e,t)),e)))}}function $W(e){return e.getClassName()}function OW(e,t={}){return uS(e,wA.getMap().classNameMap,t,"activation")}function FW(e){if(null==e){const e={className:"linear",config:{}};return OW(e)}if("string"==typeof e){const t={};return t.className=e,t.config={},OW(t)}return e instanceof gW?e:OW(e)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */RW.className="swish",SA(RW);class DW extends kA{}class MW extends DW{constructor(e){super(),function(e){if(null!=e&&"object"!=typeof e)throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${e}`)}(e),this.l1=null==e||null==e.l1?.01:e.l1,this.l2=null==e||null==e.l2?.01:e.l2,this.hasL1=0!==this.l1,this.hasL2=0!==this.l2}apply(e){return lp((()=>{let t=Zg([1]);return this.hasL1&&(t=pf(t,sg(gf(this.l1,yf(e))))),this.hasL2&&(t=pf(t,sg(gf(this.l2,eC(e))))),Hf(t,[])}))}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}}MW.className="L1L2",SA(MW);const LW={l1l2:"L1L2"};function BW(e){return oS(e)}function PW(e,t={}){return uS(e,wA.getMap().classNameMap,t,"regularizer")}function zW(e){if(null==e)return null;if("string"==typeof e){return PW({className:e in LW?LW[e]:e,config:{}})}return e instanceof DW?e:PW(e)}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */class GW extends zC{constructor(e){super(null==e?{}:e),this.supportsMasking=!0,null!=e&&(this.maxValue=e.maxValue)}call(e,t){e=TC(e);let n=sb(e);return null!=this.maxValue&&(n=dm(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){const e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}}GW.className="ReLU",SA(GW);class VW extends zC{constructor(e){super(null==e?{}:e),this.DEFAULT_ALPHA=.3,null==e&&(e={}),this.alpha=null==e.alpha?this.DEFAULT_ALPHA:e.alpha}call(e,t){const n=TC(e);return kg(n,this.alpha)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}VW.className="LeakyReLU",SA(VW);class UW extends zC{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA_INITIALIZER="zeros",null==e&&(e={}),this.supportsMasking=!0,this.alphaInitializer=IC(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=zW(e.alphaRegularizer),this.alphaConstraint=iI(e.alphaConstraint),null==e.sharedAxes)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else{if("number"!=typeof e.sharedAxes)throw new Xw(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`);this.sharedAxes=[e.sharedAxes]}}build(e){const t=(e=NC(e)).slice(1);if(null!=this.sharedAxes)for(const r of this.sharedAxes)t[r-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);const n={};if(null!=this.sharedAxes)for(let r=1;r<e.length;++r)n[r]=e[r];this.inputSpec=[new DC({ndim:e.length,axes:n})],this.built=!0}call(e,t){return e=TC(e),gy(e,this.alpha.read())}getConfig(){const e={alphaInitializer:CC(this.alphaInitializer),alphaRegularizer:BW(this.alphaRegularizer),alphaConstraint:aI(this.alphaConstraint),sharedAxes:this.sharedAxes},t=super.getConfig();return Object.assign(e,t),e}}UW.className="PReLU",SA(UW);let HW=class extends zC{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA=1,null==e&&(e={}),null!=e.alpha&&e.alpha!==this.DEFAULT_ALPHA)throw new Zw(`Non-default alpha value (${e.alpha}) is not supported by the ELU layer yet.`);this.alpha=null==e.alpha?this.DEFAULT_ALPHA:e.alpha}call(e,t){const n=TC(e);return Gm(n)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};HW.className="ELU",SA(HW);class jW extends zC{constructor(e){super(null==e?{}:e),this.DEFAULT_THETA=1,null==e&&(e={}),this.theta=null==e.theta?this.DEFAULT_THETA:e.theta}call(e,t){const n=TC(e);return gf(n,cf(gg(n,this.theta),"float32"))}computeOutputShape(e){return e}getConfig(){const e={theta:this.theta},t=super.getConfig();return Object.assign(e,t),e}}jW.className="ThresholdedReLU",SA(jW);class qW extends zC{constructor(e){super(null==e?{}:e),this.DEFAULT_AXIS=1,null==e&&(e={}),this.softmax=(new WW).apply,this.axis=null==e.axis?this.DEFAULT_AXIS:e.axis}call(e,t){return lp((()=>{let n=TC(e);const r=t.mask;if(null!=r){const e=gf(Fg(Kg(n.shape),cf(r,n.dtype)),ng(-1e9));n=pf(n,e)}return this.axis instanceof Array?this.axis.length>1?ug(Fg(n,Mg(n,this.axis,!0))):this.softmax(n,this.axis[0]):this.softmax(n,this.axis)}))}computeOutputShape(e){return e}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function QW(e,t,n){if("number"==typeof e)return Yw(e,t);if(e.length!==t)throw new Xw(`The ${n} argument must be an integer or tuple of ${t} integers. Received: ${e.length} elements.`);for(let a=0;a<t;++a){const s=e[a];if((r=s)!==parseInt(r.toString(),10))throw new Xw(`The ${n} argument must be an integer or tuple of ${t} integers. Received: ${JSON.stringify(e)} including a non-integer number ${s}`)}return e;var r}function XW(e,t,n,r,a=1){if(null==e)return e;let s;return s="same"===n?e:e-(t+(t-1)*(a-1))+1,Math.floor((s+r-1)/r)}function ZW(e,t,n,r){if(null==e)return null;if("valid"===r)e=e*t+BS([n-t,0]);else{if("same"!==r)throw new Xw(`Unsupport padding mode: ${r}.`);e*=t}return e}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */function KW(e,t){return lp((()=>(_S(t),"channelsFirst"===t?rv(e,[0,2,3,1]):e)))}function JW(e,t){return lp((()=>(_S(t),"channelsFirst"===t?rv(e,[0,2,3,4,1]):e)))}function YW(e,t,n,r=[1,1],a="valid",s,i,o=null){return lp((()=>{if(null==s&&(s="channelsLast"),_S(s),3!==e.rank&&4!==e.rank)throw new Xw(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(3!==t.rank&&4!==t.rank)throw new Xw(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=KW(e,s);if("causal"===a)throw new Zw("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=yv({x:l,filter:t,strides:r,pad:"same"===a?"same":"valid",dilations:i,dataFormat:"NHWC",bias:n,activation:o}),"channelsFirst"===s&&(l=rv(l,[0,3,1,2])),l}))}qW.className="Softmax",SA(qW);class e_ extends zC{constructor(e,t){if(super(t),this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e_.verifyArgs(t),this.rank=e,mS(this.rank,"rank"),1!==this.rank&&2!==this.rank&&3!==this.rank)throw new Zw(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=QW(t.kernelSize,e,"kernelSize"),this.strides=QW(null==t.strides?1:t.strides,e,"strides"),this.padding=null==t.padding?"valid":t.padding,TS(this.padding),this.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,_S(this.dataFormat),this.activation=FW(t.activation),this.useBias=null==t.useBias||t.useBias,this.biasInitializer=IC(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=iI(t.biasConstraint),this.biasRegularizer=zW(t.biasRegularizer),this.activityRegularizer=zW(t.activityRegularizer),this.dilationRate=QW(null==t.dilationRate?1:t.dilationRate,e,"dilationRate"),1===this.rank&&Array.isArray(this.dilationRate)&&1!==this.dilationRate.length)throw new Xw(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(2===this.rank){if("number"==typeof this.dilationRate)this.dilationRate=[this.dilationRate,this.dilationRate];else if(2!==this.dilationRate.length)throw new Xw(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(3===this.rank)if("number"==typeof this.dilationRate)this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(3!==this.dilationRate.length)throw new Xw(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}static verifyArgs(e){if(eS("kernelSize"in e,"required key 'kernelSize' not in config"),"number"!=typeof e.kernelSize&&!fS(e.kernelSize,"number",1,3))throw new Xw(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){const e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:$W(this.activation),useBias:this.useBias,biasInitializer:CC(this.biasInitializer),biasRegularizer:BW(this.biasRegularizer),activityRegularizer:BW(this.activityRegularizer),biasConstraint:aI(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}class t_ extends e_{constructor(e,t){super(e,t),this.kernel=null,t_.verifyArgs(t),this.filters=t.filters,mS(this.filters,"filters"),this.kernelInitializer=IC(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=iI(t.kernelConstraint),this.kernelRegularizer=zW(t.kernelRegularizer)}build(e){e=NC(e);const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new Xw(`The channel dimension of the input should be defined. Found ${e[t]}`);const n=e[t],r=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",r,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:n}}],this.built=!0}call(e,t){return lp((()=>{let t;e=TC(e);const n=null==this.bias?null:this.bias.read(),r=yS(this.activation.getClassName());if(null!=r&&2===this.rank)t=YW(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate,r);else{if(1===this.rank)t=function(e,t,n,r=1,a="valid",s,i=1){return lp((()=>{if(null==s&&(s="channelsLast"),_S(s),3!==e.shape.length)throw new Xw(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(3!==t.shape.length)throw new Xw(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(null!=n&&1!==n.shape.length)throw new Xw(`The bias for a conv1dWithBias operation should be 1, but is ${n.shape.length} instead`);if("channelsFirst"===s&&(e=rv(e,[0,2,1])),"causal"===a)throw new Zw("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let o=ym(e,t,r,"same"===a?"same":"valid","NWC",i);return null!=n&&(o=nC(o,n)),o}))}(e,this.kernel.read(),n,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(2===this.rank)t=YW(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate);else{if(3!==this.rank)throw new Zw("convolutions greater than 3D are not implemented yet.");t=function(e,t,n,r=[1,1,1],a="valid",s,i){return lp((()=>{if(null==s&&(s="channelsLast"),_S(s),4!==e.rank&&5!==e.rank)throw new Xw(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(4!==t.rank&&5!==t.rank)throw new Xw(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let o=JW(e,s);if("causal"===a)throw new Zw("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return o=Am(o,t,r,"same"===a?"same":"valid","NDHWC",i),null!=n&&(o=nC(o,n)),"channelsFirst"===s&&(o=rv(o,[0,4,1,2,3])),o}))}(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate)}null!=this.activation&&(t=this.activation.apply(t))}return t}))}computeOutputShape(e){e=NC(e);const t=[],n="channelsLast"===this.dataFormat?e.slice(1,e.length-1):e.slice(2);for(let a=0;a<n.length;++a){const e=XW(n[a],this.kernelSize[a],this.padding,this.strides[a],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[a]);t.push(e)}let r=[e[0]];return"channelsLast"===this.dataFormat?(r=r.concat(t),r.push(this.filters)):(r.push(this.filters),r=r.concat(t)),r}getConfig(){const e={filters:this.filters,kernelInitializer:CC(this.kernelInitializer),kernelRegularizer:BW(this.kernelRegularizer),kernelConstraint:aI(this.kernelConstraint)},t=super.getConfig();return Object.assign(e,t),e}static verifyArgs(e){if(!("filters"in e)||"number"!=typeof e.filters||e.filters<1)throw new Xw(`Convolution layer expected config.filters to be a 'number' > 0 but got ${JSON.stringify(e.filters)}`)}}class n_ extends t_{constructor(e){super(2,e),n_.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&!fS(e.kernelSize,"number",1,2))throw new Xw(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}}n_.className="Conv2D",SA(n_);class r_ extends t_{constructor(e){super(3,e),r_.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&(!Array.isArray(e.kernelSize)||1!==e.kernelSize.length&&3!==e.kernelSize.length))throw new Xw(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}}r_.className="Conv3D",SA(r_);class a_ extends n_{constructor(e){if(super(e),this.inputSpec=[new DC({ndim:4})],"same"!==this.padding&&"valid"!==this.padding)throw new Xw(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(4!==(e=NC(e)).length)throw new Xw("Input should have rank 4; Received input shape: "+JSON.stringify(e));const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new Xw("The channel dimension of the inputs should be defined. Found `None`.");const n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new DC({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return lp((()=>{let t=TC(e);if(4!==t.shape.length)throw new Xw(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${t.shape.length}`);const n=t.shape,r=n[0];let a,s;"channelsFirst"===this.dataFormat?(a=2,s=3):(a=1,s=2);const i=n[a],o=n[s],l=this.kernelSize[0],u=this.kernelSize[1],c=this.strides[0],d=this.strides[1],h=[r,ZW(i,c,l,this.padding),ZW(o,d,u,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=rv(t,[0,2,3,1]));let p=vm(t,this.kernel.read(),h,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(p=rv(p,[0,3,1,2])),null!=this.bias&&(p=nC(p,this.bias.read(),this.dataFormat)),null!=this.activation&&(p=this.activation.apply(p)),p}))}computeOutputShape(e){const t=(e=NC(e)).slice();let n,r,a;"channelsFirst"===this.dataFormat?(n=1,r=2,a=3):(n=3,r=1,a=2);const s=this.kernelSize[0],i=this.kernelSize[1],o=this.strides[0],l=this.strides[1];return t[n]=this.filters,t[r]=ZW(t[r],o,s,this.padding),t[a]=ZW(t[a],l,i,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}a_.className="Conv2DTranspose",SA(a_);class s_ extends r_{constructor(e){if(super(e),this.inputSpec=[new DC({ndim:5})],"same"!==this.padding&&"valid"!==this.padding)throw new Xw(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(5!==(e=NC(e)).length)throw new Xw("Input should have rank 5; Received input shape: "+JSON.stringify(e));const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new Xw("The channel dimension of the inputs should be defined. Found `None`.");const n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new DC({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return lp((()=>{let t=TC(e);if(5!==t.shape.length)throw new Xw(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${t.shape.length}`);const n=t.shape,r=n[0];let a,s,i;"channelsFirst"===this.dataFormat?(i=2,a=3,s=4):(i=1,a=2,s=3);const o=n[i],l=n[a],u=n[s],c=this.kernelSize[0],d=this.kernelSize[1],h=this.kernelSize[2],p=this.strides[0],f=this.strides[1],m=this.strides[2],g=[r,ZW(o,p,c,this.padding),ZW(l,f,d,this.padding),ZW(u,m,h,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=rv(t,[0,2,3,4,1]));let y=km(t,this.kernel.read(),g,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(y=rv(y,[0,4,1,2,3])),null!==this.bias&&(y=nC(y,this.bias.read(),this.dataFormat)),null!==this.activation&&(y=this.activation.apply(y)),y}))}computeOutputShape(e){const t=(e=NC(e)).slice();let n,r,a,s;"channelsFirst"===this.dataFormat?(n=1,r=2,a=3,s=4):(n=4,r=1,a=2,s=3);const i=this.kernelSize[0],o=this.kernelSize[1],l=this.kernelSize[2],u=this.strides[0],c=this.strides[1],d=this.strides[2];return t[n]=this.filters,t[r]=ZW(t[r],u,i,this.padding),t[a]=ZW(t[a],c,o,this.padding),t[s]=ZW(t[s],d,l,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}s_.className="Conv3DTranspose",SA(s_);class i_ extends t_{constructor(e,t){if(super(e,t),this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,null==t.filters)throw new Xw("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=t.kernelInitializer||null!=t.kernelRegularizer||null!=t.kernelConstraint)throw new Xw("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=t.padding&&"same"!==t.padding&&"valid"!==t.padding)throw new Xw(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=null==t.depthMultiplier?1:t.depthMultiplier,this.depthwiseInitializer=IC(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=zW(t.depthwiseRegularizer),this.depthwiseConstraint=iI(t.depthwiseConstraint),this.pointwiseInitializer=IC(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=zW(t.pointwiseRegularizer),this.pointwiseConstraint=iI(t.pointwiseConstraint)}build(e){if((e=NC(e)).length<this.rank+2)throw new Xw(`Inputs to SeparableConv${this.rank}D should have rank ${this.rank+2}, but received input shape: ${JSON.stringify(e)}`);const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t]||e[t]<0)throw new Xw(`The channel dimension of the inputs should be defined, but found ${JSON.stringify(e[t])}`);const n=e[t],r=this.kernelSize.concat([n,this.depthMultiplier]),a=[];for(let i=0;i<this.rank;++i)a.push(1);a.push(n*this.depthMultiplier,this.filters);const s=!0;this.depthwiseKernel=this.addWeight("depthwise_kernel",r,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,s,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",a,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,s,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,s,this.biasConstraint):this.bias=null,this.inputSpec=[new DC({ndim:this.rank+2,axes:{[t]:n}})],this.built=!0}call(e,t){return lp((()=>{let t;if(e=TC(e),1===this.rank)throw new Zw("1D separable convolution is not implemented yet.");return 2===this.rank&&("channelsFirst"===this.dataFormat&&(e=rv(e,[0,2,3,1])),t=mb(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(t=nC(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),"channelsFirst"===this.dataFormat&&(t=rv(t,[0,3,1,2])),t}))}getConfig(){const e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=CC(this.depthwiseInitializer),e.pointwiseInitializer=CC(this.pointwiseInitializer),e.depthwiseRegularizer=BW(this.depthwiseRegularizer),e.pointwiseRegularizer=BW(this.pointwiseRegularizer),e.depthwiseConstraint=aI(this.depthwiseConstraint),e.pointwiseConstraint=aI(this.pointwiseConstraint),e}}i_.className="SeparableConv";class o_ extends i_{constructor(e){super(2,e)}}o_.className="SeparableConv2D",SA(o_);class l_ extends t_{constructor(e){super(1,e),l_.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){const e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&!fS(e.kernelSize,"number",1,1))throw new Xw(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}}l_.className="Conv1D",SA(l_);class u_ extends zC{constructor(e){super(e),"number"==typeof e.cropping?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:"number"==typeof e.cropping[0]?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=void 0===e.dataFormat?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return"channelsFirst"===this.dataFormat?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return lp((()=>{if(e=TC(e),"channelsLast"===this.dataFormat){const t=qS(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return qS(t,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}{const t=qS(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return qS(t,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}}))}getConfig(){const e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}u_.className="Cropping2D",SA(u_);class c_ extends zC{constructor(e){var t;super(e),this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=null==e.size?this.DEFAULT_SIZE:e.size,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,_S(this.dataFormat),this.interpolation=null==e.interpolation?"nearest":e.interpolation,t=this.interpolation,pS(wS,"InterpolationFormat",t)}computeOutputShape(e){if("channelsFirst"===this.dataFormat){const t=null==e[2]?null:this.size[0]*e[2],n=null==e[3]?null:this.size[1]*e[3];return[e[0],e[1],t,n]}{const t=null==e[1]?null:this.size[0]*e[1],n=null==e[2]?null:this.size[1]*e[2];return[e[0],t,n,e[3]]}}call(e,t){return lp((()=>{let t=TC(e);const n=t.shape;if("channelsFirst"===this.dataFormat){t=rv(t,[0,2,3,1]);const e=this.size[0]*n[2],r=this.size[1]*n[3],a="nearest"===this.interpolation?mA.resizeNearestNeighbor(t,[e,r]):mA.resizeBilinear(t,[e,r]);return rv(a,[0,3,1,2])}{const e=this.size[0]*n[1],r=this.size[1]*n[2];return"nearest"===this.interpolation?mA.resizeNearestNeighbor(t,[e,r]):mA.resizeBilinear(t,[e,r])}}))}getConfig(){const e={size:this.size,dataFormat:this.dataFormat,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}}c_.className="UpSampling2D",SA(c_);class d_ extends e_{constructor(e){super(2,e),this.depthwiseKernel=null,this.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,this.depthwiseInitializer=IC(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=iI(e.depthwiseConstraint),this.depthwiseRegularizer=zW(e.depthwiseRegularizer)}build(e){if((e=NC(e)).length<4)throw new Xw(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);const t="channelsFirst"===this.dataFormat?1:3;if(null==e[t]||e[t]<0)throw new Xw(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);const n=e[t],r=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",r,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return lp((()=>{let t=
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function(e,t,n=[1,1],r="valid",a,s){return lp((()=>{null==a&&(a="channelsLast"),_S(a);let i=KW(e,a);if(4!==e.rank)throw new Xw(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(4!==t.rank)throw new Xw(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return i=Tm(i,t,n,"same"===r?"same":"valid","NHWC",s),"channelsFirst"===a&&(i=rv(i,[0,3,1,2])),i}))}(e=TC(e),this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(t=nC(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),t}))}computeOutputShape(e){e=NC(e);const t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],r="channelsFirst"===this.dataFormat?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,a=XW(t,this.kernelSize[0],this.padding,this.strides[0]),s=XW(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[e[0],r,a,s]:[e[0],a,s,r]}getConfig(){const e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=CC(this.depthwiseInitializer),e.depthwiseRegularizer=BW(this.depthwiseRegularizer),e.depthwiseConstraint=aI(this.depthwiseRegularizer),e}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function h_(e,t,n,r){if(Array.isArray(e)){if(null!=t||null!=n)throw new Xw("When inputs is an array, neither initialState or constants should be provided");null!=r&&(n=e.slice(e.length-r,e.length),e=e.slice(0,e.length-r)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function a(e){return null==e||Array.isArray(e)?e:[e]}return{inputs:e,initialState:t=a(t),constants:n=a(n)}}function p_(e,t,n,r=!1,a,s,i=!1,o=!1){return lp((()=>{const i=t.shape.length;if(i<3)throw new Xw(`Input should be at least 3D, but is ${i}D.`);const l=[1,0].concat(PS(2,i));if(t=rv(t,l),null!=s)throw new Zw("The rnn() functoin of the deeplearn.js backend does not support constants yet.");null!=a&&((a=cf(cf(a,"bool"),"float32")).rank===i-1&&(a=cg(a,-1)),a=rv(a,l)),r&&(t=ob(t,0),null!=a&&(a=ob(a,0)));const u=[];let c,d=n;const h=t.shape[0],p=Kb(t);let f,m;null!=a&&(f=Kb(a));for(let t=0;t<h;++t){const n=p[t],r=lp((()=>e(n,d)));if(null==a)c=r[0],d=r[1];else{const e=lp((()=>{const e=f[t],n=Fg(oy(e),e);return{output:pf(gf(r[0],e),gf(d[0],n)),newStates:d.map(((t,a)=>pf(gf(r[1][a],e),gf(t,n))))}}));c=e.output,d=e.newStates}o&&u.push(c)}if(o){m=Rb(u,1)}return[c,m,d]}))}d_.className="DepthwiseConv2D",SA(d_);class f_ extends zC{constructor(e){let t;if(super(e),null==e.cell)throw new Xw("cell property is missing for the constructor of RNN.");if(t=Array.isArray(e.cell)?new k_({cells:e.cell}):e.cell,null==t.stateSize)throw new Xw("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=null!=e.returnSequences&&e.returnSequences,this.returnState=null!=e.returnState&&e.returnState,this.goBackwards=null!=e.goBackwards&&e.goBackwards,this._stateful=null!=e.stateful&&e.stateful,this.unroll=null!=e.unroll&&e.unroll,this.supportsMasking=!0,this.inputSpec=[new DC({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(null==this.states_){return PS(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map((e=>null))}return this.states_}setStates(e){this.states_=e}computeOutputShape(e){WC(e)&&(e=e[0]);let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);const n=t[0];let r;if(r=this.returnSequences?[e[0],e[1],n]:[e[0],n],this.returnState){const n=[];for(const r of t)n.push([e[0],r]);return[r].concat(n)}return r}computeMask(e,t){return lp((()=>{Array.isArray(t)&&(t=t[0]);const e=this.returnSequences?t:null;if(this.returnState){const t=this.states.map((e=>null));return[e].concat(t)}return e}))}get states(){if(null==this.states_){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let n=0;n<e;++n)t.push(null);return t}return this.states_}set states(e){this.states_=e}build(e){if(null!=this.numConstants)throw new Zw("Constants support is not implemented in RNN yet.");WC(e)&&(e=e[0]);const t=this.stateful?e[0]:null,n=e.slice(2);this.inputSpec[0]=new DC({shape:[t,null,...n]});const r=[e[0]].concat(e.slice(2));let a;if(this.cell.build(r),a=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!eo(this.stateSpec.map((e=>e.shape[e.shape.length-1])),a))throw new Xw(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=a.map((e=>new DC({shape:[null,e]})));this.stateful&&this.resetStates()}resetStates(e,t=!1){lp((()=>{if(!this.stateful)throw new qw("Cannot call resetStates() on an RNN Layer that is not stateful.");const n=this.inputSpec[0].shape[0];if(null==n)throw new Xw("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==this.states_)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((e=>Zg([n,e]))):this.states_=[Zg([n,this.cell.stateSize])];else if(null==e)up(this.states_),null!=this.keptStates&&(up(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((e=>Zg([n,e]))):this.states_[0]=Zg([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new Xw(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);!0===t?this.keptStates.push(this.states_.slice()):up(this.states_);for(let t=0;t<this.states_.length;++t){const r=e[t],a=Array.isArray(this.cell.stateSize)?this.cell.stateSize[t]:this.cell.stateSize,s=[n,a];if(!eo(r.shape,s))throw new Xw(`State ${t} is incompatible with layer ${this.name}: expected shape=${s}, received shape=${r.shape}`);this.states_[t]=r}}this.states_=this.states_.map((e=>cp(e.clone())))}))}apply(e,t){let n=null==t?null:t.initialState,r=null==t?null:t.constants;null==t&&(t={});const a=h_(e,n,r,this.numConstants);e=a.inputs,n=a.initialState,r=a.constants;let s=[],i=[];if(null!=n){t.initialState=n,s=s.concat(n),this.stateSpec=[];for(const e of n)this.stateSpec.push(new DC({shape:e.shape}));i=i.concat(this.stateSpec)}null!=r&&(t.constants=r,s=s.concat(r),this.numConstants=r.length);if(s[0]instanceof MC){const n=[e].concat(s),r=this.inputSpec.concat(i),a=this.inputSpec;this.inputSpec=r;const o=super.apply(n,t);return this.inputSpec=a,o}return super.apply(e,t)}call(e,t){return lp((()=>{const n=null==t?null:t.mask,r=null==t?null:t.training;let a=null==t?null:t.initialState;e=TC(e),null==a&&(a=this.stateful?this.states_:this.getInitialState(e));const s=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(a.length!==s)throw new Xw(`RNN Layer has ${s} state(s) but was passed ${a.length} initial state(s).`);this.unroll;const i={training:r},o=p_(((e,t)=>{const n=this.cell.call([e].concat(t),i);return[n[0],n.slice(1)]}),e,a,this.goBackwards,n,null,this.unroll,this.returnSequences),l=o[0],u=o[1],c=o[2];this.stateful&&this.resetStates(c,r);const d=this.returnSequences?u:l;return this.returnState?[d].concat(c):d}))}getInitialState(e){return lp((()=>{let t=Zg(e.shape);return t=sg(t,[1,2]),t=US(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map((e=>e>1?ZS(t,[1,e]):t)):this.cell.stateSize>1?[ZS(t,[1,this.cell.stateSize])]:[t]}))}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.cell&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){const e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(t.numConstants=this.numConstants);const n=this.cell.getConfig();return this.getClassName()===f_.className&&(t.cell={className:this.cell.getClassName(),config:n}),Object.assign(Object.assign(Object.assign({},n),e),t)}static fromConfig(e,t,n={}){const r=vI(t.cell,n);return new e(Object.assign(t,{cell:r}))}}f_.className="RNN",SA(f_);class m_ extends zC{}class g_ extends m_{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,mS(this.units,"units"),this.activation=FW(null==e.activation?this.DEFAULT_ACTIVATION:e.activation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=IC(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=IC(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=IC(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=zW(e.kernelRegularizer),this.recurrentRegularizer=zW(e.recurrentRegularizer),this.biasRegularizer=zW(e.biasRegularizer),this.kernelConstraint=iI(e.kernelConstraint),this.recurrentConstraint=iI(e.recurrentConstraint),this.biasConstraint=iI(e.biasConstraint),this.dropout=LS([1,BS([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=LS([1,BS([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=NC(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return lp((()=>{if(2!==e.length)throw new Xw(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let n=e[1];e=e[0];const r=null!=t.training&&t.training;let a;0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=w_({ones:()=>oy(e),rate:this.dropout,training:r,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=w_({ones:()=>oy(n),rate:this.recurrentDropout,training:r,dropoutFunc:this.dropoutFunc}));const s=this.dropoutMask,i=this.recurrentDropoutMask;a=JS(null!=s?gf(e,s):e,this.kernel.read()),null!=this.bias&&(a=nC(a,this.bias.read())),null!=i&&(n=gf(n,i));let o=pf(a,JS(n,this.recurrentKernel.read()));return null!=this.activation&&(o=this.activation.apply(o)),[o,o]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:$W(this.activation),useBias:this.useBias,kernelInitializer:CC(this.kernelInitializer),recurrentInitializer:CC(this.recurrentInitializer),biasInitializer:CC(this.biasInitializer),kernelRegularizer:BW(this.kernelRegularizer),recurrentRegularizer:BW(this.recurrentRegularizer),biasRegularizer:BW(this.biasRegularizer),activityRegularizer:BW(this.activityRegularizer),kernelConstraint:aI(this.kernelConstraint),recurrentConstraint:aI(this.recurrentConstraint),biasConstraint:aI(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},e),t)}}g_.className="SimpleRNNCell",SA(g_);class y_ extends f_{constructor(e){e.cell=new g_(e),super(e)}call(e,t){return lp((()=>{null!=this.cell.dropoutMask&&(up(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(up(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,r=null==t?null:t.training,a=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:a})}))}static fromConfig(e,t){return new e(t)}}y_.className="SimpleRNN",SA(y_);class b_ extends m_{constructor(e){if(super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new Xw("GRUCell does not support reset_after parameter set to true.");this.units=e.units,mS(this.units,"units"),this.activation=FW(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=FW(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=IC(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=IC(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=IC(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=zW(e.kernelRegularizer),this.recurrentRegularizer=zW(e.recurrentRegularizer),this.biasRegularizer=zW(e.biasRegularizer),this.kernelConstraint=iI(e.kernelConstraint),this.recurrentConstraint=iI(e.recurrentConstraint),this.biasConstraint=iI(e.biasConstraint),this.dropout=LS([1,BS([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=LS([1,BS([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){const t=(e=NC(e))[e.length-1];this.kernel=this.addWeight("kernel",[t,3*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,3*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[3*this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return lp((()=>{if(2!==e.length)throw new Xw(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);const n=null!=t.training&&t.training;let r=e[1];e=e[0],0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=w_({ones:()=>oy(e),rate:this.dropout,training:n,count:3,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=w_({ones:()=>oy(r),rate:this.recurrentDropout,training:n,count:3,dropoutFunc:this.dropoutFunc}));const a=this.dropoutMask,s=this.recurrentDropoutMask;let i,o,l;0<this.dropout&&this.dropout<1&&(e=gf(e,a[0]));let u=JS(e,this.kernel.read());this.useBias&&(u=nC(u,this.bias.read())),0<this.recurrentDropout&&this.recurrentDropout<1&&(r=gf(r,s[0]));const c=this.recurrentKernel.read(),[d,h]=_b(c,[2*this.units,this.units],c.rank-1),p=JS(r,d),[f,m,g]=_b(u,3,u.rank-1),[y,b]=_b(p,2,p.rank-1);i=this.recurrentActivation.apply(pf(f,y)),o=this.recurrentActivation.apply(pf(m,b));const v=JS(gf(o,r),h);l=this.activation.apply(pf(g,v));const A=pf(gf(i,r),gf(pf(1,Rg(i)),l));return[A,A]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:$W(this.activation),recurrentActivation:$W(this.recurrentActivation),useBias:this.useBias,kernelInitializer:CC(this.kernelInitializer),recurrentInitializer:CC(this.recurrentInitializer),biasInitializer:CC(this.biasInitializer),kernelRegularizer:BW(this.kernelRegularizer),recurrentRegularizer:BW(this.recurrentRegularizer),biasRegularizer:BW(this.biasRegularizer),activityRegularizer:BW(this.activityRegularizer),kernelConstraint:aI(this.kernelConstraint),recurrentConstraint:aI(this.recurrentConstraint),biasConstraint:aI(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation,resetAfter:!1};return Object.assign(Object.assign({},e),t)}}b_.className="GRUCell",SA(b_);class v_ extends f_{constructor(e){e.implementation,e.cell=new b_(e),super(e)}call(e,t){return lp((()=>{null!=this.cell.dropoutMask&&(up(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(up(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,r=null==t?null:t.training,a=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:a})}))}static fromConfig(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}v_.className="GRU",SA(v_);class A_ extends m_{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,mS(this.units,"units"),this.activation=FW(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=FW(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=IC(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=IC(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=IC(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=zW(e.kernelRegularizer),this.recurrentRegularizer=zW(e.recurrentRegularizer),this.biasRegularizer=zW(e.biasRegularizer),this.kernelConstraint=iI(e.kernelConstraint),this.recurrentConstraint=iI(e.recurrentConstraint),this.biasConstraint=iI(e.biasConstraint),this.dropout=LS([1,BS([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=LS([1,BS([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;const n=(e=NC(e))[e.length-1];let r;if(this.kernel=this.addWeight("kernel",[n,4*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,4*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){if(this.unitForgetBias){const e=this.biasInitializer,n=this.units;r=new((t=class extends oC{apply(t,r){const a=e.apply([n]),s=(new uC).apply([n]),i=e.apply([2*n]);return XS(XS(a,s),i)}}).className="CustomInit",t)}else r=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,r,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return lp((()=>{const n=null!=t.training&&t.training;if(3!==e.length)throw new Xw(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let r=e[1];const a=e[2];e=e[0],0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=w_({ones:()=>oy(e),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=w_({ones:()=>oy(r),rate:this.recurrentDropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const s=this.dropoutMask,i=this.recurrentDropoutMask;let o,l,u,c;0<this.dropout&&this.dropout<1&&(e=gf(e,s[0]));let d=JS(e,this.kernel.read());0<this.recurrentDropout&&this.recurrentDropout<1&&(r=gf(r,i[0])),d=pf(d,JS(r,this.recurrentKernel.read())),this.useBias&&(d=nC(d,this.bias.read()));const[h,p,f,m]=_b(d,4,d.rank-1);o=this.recurrentActivation.apply(h),l=this.recurrentActivation.apply(p),u=pf(gf(l,a),gf(o,this.activation.apply(f))),c=this.recurrentActivation.apply(m);const g=gf(c,this.activation.apply(u));return[g,g,u]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:$W(this.activation),recurrentActivation:$W(this.recurrentActivation),useBias:this.useBias,kernelInitializer:CC(this.kernelInitializer),recurrentInitializer:CC(this.recurrentInitializer),biasInitializer:CC(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:BW(this.kernelRegularizer),recurrentRegularizer:BW(this.recurrentRegularizer),biasRegularizer:BW(this.biasRegularizer),activityRegularizer:BW(this.activityRegularizer),kernelConstraint:aI(this.kernelConstraint),recurrentConstraint:aI(this.recurrentConstraint),biasConstraint:aI(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation};return Object.assign(Object.assign({},e),t)}}A_.className="LSTMCell",SA(A_);class x_ extends f_{constructor(e){e.implementation,e.cell=new A_(e),super(e)}call(e,t){return lp((()=>{null!=this.cell.dropoutMask&&(up(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(up(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const n=null==t?null:t.mask,r=null==t?null:t.training,a=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:a})}))}static fromConfig(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}x_.className="LSTM",SA(x_);class k_ extends m_{constructor(e){super(e),this.cells=e.cells}get stateSize(){const e=[];for(const t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return lp((()=>{let n=e.slice(1);const r=[];for(const e of this.cells.slice().reverse())Array.isArray(e.stateSize)?r.push(n.splice(0,e.stateSize.length)):r.push(n.splice(0,1));r.reverse();const a=[];let s;for(let i=0;i<this.cells.length;++i){const o=this.cells[i];n=r[i],s=0===i?[e[0]].concat(n):[s[0]].concat(n),s=o.call(s,t),a.push(s.slice(1))}n=[];for(const e of a.slice().reverse())n.push(...e);return[s[0]].concat(n)}))}build(e){let t;WC(e)&&(e=e[0]),this.cells.forEach(((n,r)=>{RS(`RNNCell_${r}`,(()=>{n.build(e),t=Array.isArray(n.stateSize)?n.stateSize[0]:n.stateSize,e=[e[0],t]}))})),this.built=!0}getConfig(){const e=super.getConfig(),t={cells:this.cells.map((e=>({className:e.getClassName(),config:e.getConfig()})))};return Object.assign(Object.assign({},e),t)}static fromConfig(e,t,n={}){const r=[];for(const a of t.cells)r.push(vI(a,n));return new e({cells:r})}get trainableWeights(){if(!this.trainable)return[];const e=[];for(const t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const e of this.cells)t.push(...e.trainableWeights);return t.concat(e)}return e}getWeights(){const e=[];for(const t of this.cells)e.push(...t.weights);return OC(e)}setWeights(e){const t=[];for(const n of this.cells){const r=n.weights.length,a=e.splice(r);for(let e=0;e<n.weights.length;++e)t.push([n.weights[e],a[e]])}FC(t)}}function w_(e){const{ones:t,rate:n,training:r=!1,count:a=1,dropoutFunc:s}=e,i=()=>null!=s?s(t(),n):rC(t(),n),o=()=>aC(i,t,r);if(!a||a<=1)return cp(o().clone());return Array(a).fill(void 0).map(o).map((e=>cp(e.clone())))}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */k_.className="StackedRNNCells",SA(k_);var S_=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};class C_ extends f_{constructor(e){if(e.unroll)throw new Zw("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new Zw("It is not possible at the moment to stack convolutional cells.");super(e),this.inputSpec=[new DC({ndim:5})]}call(e,t){return lp((()=>{if(null!=this.cell.dropoutMask&&(up(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(up(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new Xw("ConvRNN2D cell does not support constants");const n=null==t?null:t.mask,r=null==t?null:t.training,a=null==t?null:t.initialState;return super.call(e,{mask:n,training:r,initialState:a})}))}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return lp((()=>{const{stateSize:t}=this.cell,n=e.shape,r=this.computeSingleOutputShape(n),a=Zg([r[0],...r.slice(2)]);return Array.isArray(t)?Array(t.length).fill(a):[a]}))}resetStates(e,t=!1){lp((()=>{if(!this.stateful)throw new qw("Cannot call resetStates() on an RNN Layer that is not stateful.");const n=this.inputSpec[0].shape,r=this.computeSingleOutputShape(n),a=[r[0],...r.slice(2)];if(null==n[0])throw new Xw("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==this.getStates())Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((()=>Zg(a))):this.states_=[Zg(a)];else if(null==e)up(this.states_),null!=this.keptStates&&(up(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((()=>Zg(a))):this.states_[0]=Zg(a);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new Xw(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):up(this.states_);for(let t=0;t<this.states_.length;++t){const n=e[t],r=a;if(!eo(n.shape,r))throw new Xw(`State ${t} is incompatible with layer ${this.name}: expected shape=${r}, received shape=${n.shape}`);this.states_[t]=n}}this.states_=this.states_.map((e=>cp(e.clone())))}))}computeSingleOutputShape(e){const{dataFormat:t,filters:n,kernelSize:r,padding:a,strides:s,dilationRate:i}=this.cell,o="channelsFirst"===t,l=e[o?3:2],u=e[o?4:3],c=XW(l,r[0],a,s[0],i[0]),d=XW(u,r[1],a,s[1],i[1]);return[...e.slice(0,2),...o?[n,c,d]:[c,d,n]]}}C_.className="ConvRNN2D";class I_ extends A_{constructor(e){const{filters:t,kernelSize:n,strides:r,padding:a,dataFormat:s,dilationRate:i}=e;super(Object.assign(Object.assign({},e),{units:t})),this.filters=t,mS(this.filters,"filters"),this.kernelSize=QW(n,2,"kernelSize"),this.kernelSize.forEach((e=>mS(e,"kernelSize"))),this.strides=QW(r||1,2,"strides"),this.strides.forEach((e=>mS(e,"strides"))),this.padding=a||"valid",TS(this.padding),this.dataFormat=s||"channelsLast",_S(this.dataFormat),this.dilationRate=QW(i||1,2,"dilationRate"),this.dilationRate.forEach((e=>mS(e,"dilationRate")))}build(e){var t;e=NC(e);const n="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[n])throw new Xw(`The channel dimension of the input should be defined. Found ${e[n]}`);const r=e[n],a=this.kernelSize.concat([r,4*this.filters]);this.kernel=this.addWeight("kernel",a,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);const s=this.kernelSize.concat([this.filters,4*this.filters]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",s,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let e;if(this.unitForgetBias){const n=this.biasInitializer,r=this.filters;e=new((t=class extends oC{apply(e,t){return QS([n.apply([r]),Kg([r]),n.apply([2*r])])}}).className="CustomInit",t)}else e=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.filters],null,e,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return lp((()=>{if(3!==e.length)throw new Xw(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);const n=t.training||!1,r=e[0],a=e[1],s=e[2];0<this.dropout&&this.dropout<1&&null==this.dropoutMask&&(this.dropoutMask=w_({ones:()=>oy(r),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const i=this.dropoutMask,o=(e,t,n)=>t&&t[n]?gf(t[n],e):e;let l=o(r,i,0),u=o(r,i,1),c=o(r,i,2),d=o(r,i,3);0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=w_({ones:()=>oy(a),rate:this.recurrentDropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const h=this.recurrentDropoutMask;let p=o(a,h,0),f=o(a,h,1),m=o(a,h,2),g=o(a,h,3);const[y,b,v,A]=_b(this.kernel.read(),4,3),[x,k,w,S]=this.useBias?_b(this.bias.read(),4):[null,null,null,null];l=this.inputConv(l,y,x,this.padding),u=this.inputConv(u,b,k,this.padding),c=this.inputConv(c,v,w,this.padding),d=this.inputConv(d,A,S,this.padding);const[C,I,W,_]=_b(this.recurrentKernel.read(),4,3);p=this.recurrentConv(p,C),f=this.recurrentConv(f,I),m=this.recurrentConv(m,W),g=this.recurrentConv(g,_);const T=this.recurrentActivation.apply(pf(l,p)),N=this.recurrentActivation.apply(pf(u,f)),E=pf(gf(N,s),gf(T,this.activation.apply(pf(c,m)))),R=gf(this.recurrentActivation.apply(pf(d,g)),this.activation.apply(E));return[R,R,E]}))}getConfig(){const e=super.getConfig(),t=S_(e,["units"]),n={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},t),n)}inputConv(e,t,n,r){const a=gm(e,t,this.strides,r||"valid","channelsFirst"===this.dataFormat?"NCHW":"NHWC",this.dilationRate);return n?nC(a,n,this.dataFormat):a}recurrentConv(e,t){return gm(e,t,1,"same","channelsFirst"===this.dataFormat?"NCHW":"NHWC")}}I_.className="ConvLSTM2DCell",SA(I_);class W_ extends C_{constructor(e){const t=new I_(e);super(Object.assign(Object.assign({},e),{cell:t}))}static fromConfig(e,t){return new e(t)}}W_.className="ConvLSTM2D",SA(W_);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class __ extends zC{constructor(e){super(e),this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(null==this.noiseShape)return this.noiseShape;const t=e.shape,n=[];for(let r=0;r<this.noiseShape.length;++r)n.push(null==this.noiseShape[r]?t[r]:this.noiseShape[r]);return n}call(e,t){return lp((()=>{this.invokeCallHook(e,t);const n=TC(e);if(0<this.rate&&this.rate<1){const e=null!=t.training&&t.training,r=this.getNoiseShape(n);return aC((()=>rC(n,this.rate,r,this.seed)),(()=>n),e)}return e}))}getConfig(){const e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}}__.className="Dropout",SA(__);class T_ extends __{constructor(e){super(e),this.inputSpec=[{ndim:3}]}getNoiseShape(e){const t=e.shape;return[t[0],1,t[2]]}}T_.className="SpatialDropout1D",SA(T_);class N_ extends zC{constructor(e){if(super(e),this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",null==e.batchInputShape&&null==e.inputShape&&null!=e.inputDim){let t=null;null!=e.batchSize&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,mS(this.units,"units"),this.activation=FW(e.activation),null!=e.useBias&&(this.useBias=e.useBias),this.kernelInitializer=IC(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=IC(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=iI(e.kernelConstraint),this.biasConstraint=iI(e.biasConstraint),this.kernelRegularizer=zW(e.kernelRegularizer),this.biasRegularizer=zW(e.biasRegularizer),this.activityRegularizer=zW(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){const t=(e=NC(e))[e.length-1];null==this.kernel&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){const t=(e=NC(e)).slice();return t[t.length-1]=this.units,t}call(e,t){return lp((()=>{this.invokeCallHook(e,t);const n=TC(e),r=yS(this.activation.getClassName());let a;return null!=r?a=JS(n,this.kernel.read(),r,this.bias?this.bias.read():null):(a=JS(n,this.kernel.read()),null!=this.bias&&(a=nC(a,this.bias.read())),null!=this.activation&&(a=this.activation.apply(a))),a}))}getConfig(){const e={units:this.units,activation:$W(this.activation),useBias:this.useBias,kernelInitializer:CC(this.kernelInitializer),biasInitializer:CC(this.biasInitializer),kernelRegularizer:BW(this.kernelRegularizer),biasRegularizer:BW(this.biasRegularizer),activityRegularizer:BW(this.activityRegularizer),kernelConstraint:aI(this.kernelConstraint),biasConstraint:aI(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}N_.className="Dense",SA(N_);class E_ extends zC{constructor(e){super(e=e||{}),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=NC(e);for(const t of e.slice(1))if(null==t)throw new Xw(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],MS(e,1)]}call(e,t){return lp((()=>{this.invokeCallHook(e,t);let n=TC(e);if("channelsFirst"===this.dataFormat&&n.rank>1){const e=[0];for(let t=2;t<n.rank;++t)e.push(t);e.push(1),n=rv(n,e)}return function(e){if(e.rank<=1)throw new Xw(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);const t=[e.shape[0],MS(e.shape,1)];return Hf(e,t)}(n)}))}getConfig(){const e={};null!=this.dataFormat&&(e.dataFormat=this.dataFormat);const t=super.getConfig();return Object.assign(e,t),e}}E_.className="Flatten",SA(E_);class R_ extends zC{constructor(e){super(e),this.supportsMasking=!0,this.activation=FW(e.activation)}call(e,t){return lp((()=>{this.invokeCallHook(e,t);const n=TC(e);return this.activation.apply(n)}))}getConfig(){const e={activation:$W(this.activation)},t=super.getConfig();return Object.assign(e,t),e}}R_.className="Activation",SA(R_);class $_ extends zC{constructor(e){super(e),this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return lp((()=>{return e=TC(e),t=e,n=this.n,lp((()=>{if(2!==t.shape.length)throw new Xw(`repeat() expects a rank-2 tensor, but received a rank-${t.shape.length} tensor.`);return ZS(US(t,1),[1,n,1])}));var t,n}))}getConfig(){const e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}}$_.className="RepeatVector",SA($_);class O_ extends zC{constructor(e){super(e),this.targetShape=e.targetShape;for(let t=0;t<this.targetShape.length;++t)this.isUnknown(this.targetShape[t])&&(this.targetShape[t]=null)}isUnknown(e){return e<0||null==e}fixUnknownDimension(e,t){const n="Total size of new array must be unchanged.",r=t.slice();let a=1,s=null;for(let o=0;o<r.length;++o){const e=r[o];if(this.isUnknown(e)){if(null!==s)throw new Xw("Can only specifiy one unknown dimension.");s=o}else a*=e}const i=MS(e);if(null!==s){if(0===a||i%a!=0)throw new Xw(n);r[s]=i/a}else if(i!==a)throw new Xw(n);return r}computeOutputShape(e){let t=!1;for(let n=0;n<e.length;++n)if(this.isUnknown(e[n])){t=!0;break}return t?e.slice(0,1).concat(this.targetShape):e.slice(0,1).concat(this.fixUnknownDimension(e.slice(1),this.targetShape))}call(e,t){return lp((()=>{this.invokeCallHook(e,t);const n=TC(e),r=n.shape,a=r.slice(0,1).concat(this.fixUnknownDimension(r.slice(1),this.targetShape));return Hf(n,a)}))}getConfig(){const e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}}O_.className="Reshape",SA(O_);class F_ extends zC{constructor(e){if(super(e),null==e.dims)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);const t=PS(1,e.dims.length+1);if(!eo(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new DC({ndim:this.dims.length+1})]}computeOutputShape(e){const t=(e=NC(e)).slice();return this.dims.forEach(((n,r)=>{t[r+1]=e[n]})),t}call(e,t){return rv(TC(e),this.dimsIncludingBatch)}getConfig(){const e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}}F_.className="Permute",SA(F_);class D_ extends zC{constructor(e){super(null==e?{}:e),this.supportsMasking=!0,this.maskValue=null!=e?null==e.maskValue?0:e.maskValue:0}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){const n=TC(e);return kf(sy(n,this.maskValue),-1)}call(e,t){return lp((()=>{this.invokeCallHook(e,t);const n=TC(e),r=kf(sy(n,this.maskValue),-1,!0);return gf(n,cf(r,n.dtype))}))}}D_.className="Masking",SA(D_);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class M_ extends zC{constructor(e){if(super(e),this.embeddings=null,this.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==e.batchInputShape&&null==e.inputShape){let t=null;null!=e.batchSize&&(t=e.batchSize),null==e.inputLength?this.batchInputShape=[t,null]:this.batchInputShape=[t].concat(rS(e.inputLength))}this.inputDim=e.inputDim,mS(this.inputDim,"inputDim"),this.outputDim=e.outputDim,mS(this.outputDim,"outputDim"),this.embeddingsInitializer=IC(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=zW(e.embeddingsRegularizer),this.activityRegularizer=zW(e.activityRegularizer),this.embeddingsConstraint=iI(e.embeddingsConstraint),this.maskZero=e.maskZero,this.supportsMasking=e.maskZero,this.inputLength=e.inputLength}build(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}warnOnIncompatibleInputShape(e){}computeMask(e,t){return lp((()=>this.maskZero?(e=TC(e),sy(e,Lm(e))):null))}computeOutputShape(e){if(e=NC(e),null==this.inputLength)return[...e,this.outputDim];const t=rS(this.inputLength);if(t.length!==e.length-1)throw new Xw(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);{let n=0;for(let r=0;r<t.length;++r){const a=t[r],s=e[r+1];if(null!=a&&null!=s&&a!==s)throw new Xw(`"inputLength" is ${this.inputLength}, but received input shape has shape ${e}`);null==a&&(t[n]=s),n++}}return[e[0],...t,this.outputDim]}call(e,t){return lp((()=>{this.invokeCallHook(e,t);let n=TC(e);"int32"!==n.dtype&&(n=VS(n,"int32"));const r=YS(this.embeddings.read(),Hf(n,[n.size]));return Hf(r,NC(this.computeOutputShape(n.shape)))}))}getConfig(){const e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:CC(this.embeddingsInitializer),embeddingsRegularizer:BW(this.embeddingsRegularizer),activityRegularizer:BW(this.activityRegularizer),embeddingsConstraint:aI(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}}M_.className="Embedding",SA(M_);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class L_ extends zC{constructor(e){super(e||{}),this.supportsMasking=!0}mergeFunction(e){throw new Zw}computeElementwiseOpOutputShape(e,t){if(null==e||null==t)return null;if(e.length<t.length)return this.computeElementwiseOpOutputShape(t,e);if(0===t.length)return e;const n=e.slice(0,e.length-t.length);for(let r=0;r<t.length;++r){const a=e[e.length-t.length+r],s=t[r];if(null==a||null==s||a<0||s<0)n.push(null);else if(1===a)n.push(s);else if(1===s)n.push(a);else{if(a!==s)throw new Xw("Operands could not be broadcast together with shapes "+JSON.stringify(e)+" "+JSON.stringify(t));n.push(a)}}return n}build(e){if(Array.isArray(e)&&!Array.isArray(e[0])&&(e=[NC(e)]),e.length<2)throw new Xw(`A merge layer should be called on an Array of at least 2 inputs. Got ${e.length} input(s).`);let t=[];for(const a of e)null!=a&&null!==a[0]&&t.push(a[0]);if(t=dS(t),t.length>1)throw new Xw(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let n=null==e[0]?null:e[0].slice(1);for(let a=1;a<e.length;++a){const t=null==e[a]?null:e[a].slice(1);n=this.computeElementwiseOpOutputShape(n,t)}const r=e.map((e=>e.length));-1===e.indexOf(null)&&1===dS(r).length?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return lp((()=>{if(this.reshapeRequired){const t=[],n=e.map((e=>e.rank));if(-1===n.indexOf(null)){const r=BS(n);for(let n of e){const e=n.rank;for(let t=0;t<r-e;++t)n=US(n,1);t.push(n)}return this.mergeFunction(t)}{let n=!1;for(const s of e){const e=s.rank;if(null==e){const e=s.shape,r=e[0],a=e.slice(1).concat([r]);let i=Hf(s,[r].concat(MS(e.slice(1))));i=rv(i,[1,0]),i=Hf(i,a),t.push(i),n=!0}else if(e>1){const r=PS(1,e).concat([0]);t.push(rv(s,r)),n=!0}else t.push(s)}let r=this.mergeFunction(t);const a=r.rank;if(n)if(null==a){const e=r.shape,t=e[e.length-1],n=[t].concat(e.slice(0,e.length-1));r=Hf(rv(Hf(r,[-1,t]),[1,0]),n)}else if(a>1){const e=[a-1].concat(PS(0,a-1));r=rv(r,e)}return r}}return this.mergeFunction(e)}))}computeOutputShape(e){let t;t=null==e[0]?null:e[0].slice(1);for(let r=1;r<e.length;++r){const n=null==e[r]?null:e[r].slice(1);t=this.computeElementwiseOpOutputShape(t,n)}let n=[];for(const r of e)null!=r&&null!==r[0]&&n.push(r[0]);return n=dS(n),t=1===n.length?n.concat(t):[null].concat(t),t}computeMask(e,t){return lp((()=>{if(null==t)return null;if(!Array.isArray(t))throw new Xw("`mask` should be an Array");if(!Array.isArray(e))throw new Xw("`inputs` should be an Array");if(t.length!==e.length)throw new Xw(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every((e=>null==e)))return null;let n=(t=t.map((e=>null==e?e:cg(e,0))))[0];for(let e=1;e<t.length-1;++e)n=Lg(n,t[e]);return n}))}}class B_ extends L_{constructor(e){super(e)}mergeFunction(e){return lp((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=pf(t,e[n]);return t}))}}B_.className="Add",SA(B_);class P_ extends L_{constructor(e){super(e)}mergeFunction(e){return lp((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=gf(t,e[n]);return t}))}}P_.className="Multiply",SA(P_);class z_ extends L_{constructor(e){super(e)}mergeFunction(e){return lp((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=pf(t,e[n]);return gf(1/e.length,t)}))}}z_.className="Average",SA(z_);class G_ extends L_{constructor(e){super(e)}mergeFunction(e){return lp((()=>{let t=e[0];for(let n=1;n<e.length;++n)t=Qg(t,e[n]);return t}))}}G_.className="Maximum",SA(G_);class V_ extends L_{constructor(e){super(e)}mergeFunction(e){return lp((()=>{let t=e[0];for(let n=1;n<e.length;++n)t=Yg(t,e[n]);return t}))}}V_.className="Minimum",SA(V_);class U_ extends L_{constructor(e){super(e),this.DEFAULT_AXIS=-1,null==e&&(e={}),this.axis=null==e.axis?this.DEFAULT_AXIS:e.axis,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){if(!Array.isArray(e)||!Array.isArray(e[0])||1===e.length)throw new Xw("A `Concatenate` layer should be called on a list of at least 2 inputs");let t=!0;for(const r of e)if(null!=r){t=!1;break}if(t)return;const n=[];for(let r=0;r<e.length;++r){const t=e[r].slice();t.splice(this.axis,1);let a=!1;for(const e of n)if(eo(e,t)){a=!0;break}a||n.push(t)}if(n.length>1)throw new Xw("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return lp((()=>QS(e,this.axis)))}computeOutputShape(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new Xw("A `Concatenate` layer should be called on a list of inputs.");const t=e,n=t[0].slice(),r=this.axis<0?n.length+this.axis:this.axis;for(const a of t.slice(1)){if(null==n[r]||null==a[r]){n[r]=null;break}n[r]+=a[r]}return n}computeMask(e,t){if(null==t)return null;if(!Array.isArray(t))throw new Xw("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new Xw("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new Xw(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return lp((()=>{let n=!0;if(t.forEach((e=>{null==e||(n=!1)})),n)return null;const r=[];for(let s=0;s<e.length;++s)null==t[s]?r.push(cf(oy(e[s]),"bool")):t[s].rank<e[s].rank?r.push(cg(t[s],-1)):r.push(t[s]);const a=Qf(r,this.axis);return xf(a,-1,!1)}))}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}function H_(e,t){for(;e<0;)e+=t;return e}U_.className="Concatenate",SA(U_);class j_ extends L_{constructor(e){super(e),this.axes=e.axes,this.normalize=null!=e.normalize&&e.normalize,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){Xi(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),(()=>"A `Dot` layer should be called on a list of exactly 2 inputs."));const t=e[0],n=e[1];if(t.length>3||n.length>3)throw new Zw("Dot layer does not support tensors of 4D or higher rank yet.");const r=this.interpretAxes(t,n);if(t[r[0]]!==n[r[1]])throw new Xw(`Dimension incompatibility: ${t[r[0]]} !== ${n[r[1]]}`)}mergeFunction(e){if(2!==e.length)throw new Xw(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t,n=e[0],r=e[1];return t=Array.isArray(this.axes)?this.axes.map(((t,n)=>H_(t,e[n].shape.length))):[H_(this.axes,n.shape.length),H_(this.axes,r.shape.length)],this.normalize&&(n=AI(n,t[0]),r=AI(r,t[1])),function(e,t,n){if(e.shape.length>3||t.shape.length>3)throw new Zw("batchDot is not implemented for tensors of 4D or higher rank yet");if(Xi(e.shape.length>=2,(()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`)),Xi(e.shape.length>=2,(()=>`batchDot requires the rank of y to be >= 2, but got ${t.shape.length}`)),"number"==typeof n&&(n=[n,n]),"complex64"===e.dtype||"complex64"===t.dtype)throw new Zw("batchDot is not implemented for complex64-type Tensors yet.");const r=e.shape.length,a=t.shape.length;null==n&&(n=[r-1,a-2]);const s=n;return lp((()=>{let n,i;if(r>a){n=r-a;const e=[];for(let t=0;t<n;++t)e.push(1);t=Hf(t,t.shape.concat(e))}else if(a>r){n=a-r;const t=[];for(let e=0;e<n;++e)t.push(1);e=Hf(e,e.shape.concat(t))}else n=0;if(2===e.shape.length&&2===t.shape.length)i=s[0]===s[1]?sg(gf(e,t),s[0]):sg(gf(rv(e,[1,0]),t),s[1]);else{const n=s[0]!==e.shape.length-1,r=s[1]===t.shape.length-1;i=Xf(e,t,n,r)}if(n>0){let e;e=r>a?r+a-3:r-1;const t=[];for(let r=e;r<e+n;++r)t.push(r);i=Eb(i,t)}return 1===i.shape.length&&(i=cg(i,1)),i}))}(n,r,t)}interpretAxes(e,t){let n;return n=Array.isArray(this.axes)?this.axes:[H_(this.axes,e.length),H_(this.axes,t.length)],n}computeOutputShape(e){Xi(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),(()=>"A `Dot` layer should be called on a list of exactly 2 inputs."));const t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new Zw("Dot layer does not support tensors of 4D or higher rank yet.");const r=this.interpretAxes(t,n);t.splice(r[0],1),n.splice(r[1],1),n.splice(0,1);const a=t.concat(n);return 1===a.length&&a.push(1),a}computeMask(e,t){return null}getConfig(){const e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}}j_.className="Dot",SA(j_);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class q_ extends zC{constructor(e){super(e),this.supportsMasking=!0,this.stddev=e.stddev}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={stddev:this.stddev};return Object.assign(t,e),t}call(e,t){return lp((()=>{this.invokeCallHook(e,t);const n=TC(e);return aC((()=>pf(KS(n.shape,0,this.stddev),n)),(()=>n),t.training||!1)}))}}q_.className="GaussianNoise",SA(q_);class Q_ extends zC{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return lp((()=>{this.invokeCallHook(e,t);const n=TC(e);if(this.rate>0&&this.rate<1){return aC((()=>{const e=Math.sqrt(this.rate/(1-this.rate));return gf(n,KS(n.shape,1,e))}),(()=>n),t.training||!1)}return n}))}}Q_.className="GaussianDropout",SA(Q_);class X_ extends zC{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||TC(e).shape}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={rate:this.rate};return Object.assign(t,e),t}call(e,t){return lp((()=>{if(this.rate<1&&this.rate>0){const n=this._getNoiseShape(e);return aC((()=>{const t=TC(e),r=-1.7580993408473766;let a=yg(eb(n),this.rate);a=VS(a,"float32");const s=((1-this.rate)*(1+this.rate*r**2))**-.5,i=-s*r*this.rate,o=pf(gf(t,a),gf(pf(a,-1),r));return pf(gf(o,s),i)}),(()=>TC(e)),t.training||!1)}return e}))}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function Z_(e,t,n,r,a,s=.001){let i;if(2===e.rank)i=nm(e,t,n,r,a,s);else if(3===e.rank)i=rm(e,t,n,r,a,s);else{if(4!==e.rank)throw new Zw(`batchNormalization is not implemented for array of rank ${e.rank} yet`);i=am(e,t,n,r,a,s)}return i}function K_(e,t,n,r,a=.001){return eo(r.slice().sort(),PS(0,e.rank-1))?function(e,t,n,r,a=.001){return lp((()=>{const s=ny(e,r),i=s.mean,o=s.variance;return[Z_(e,i,o,n,t,a),i,o]}))}(e,t,n,r,a):function(e,t,n,r,a=.001){return lp((()=>{const s=ny(e,r),i=s.mean,o=s.variance,l=[];for(const t of PS(0,e.rank))-1!==r.indexOf(t)?l.push(1):l.push(e.shape[t]);const u=Hf(i,l),c=Hf(o,l),d=null==t?null:Hf(t,l),h=null==n?null:Hf(n,l);return[Z_(e,u,c,h,d,a),i,o]}))}(e,t,n,r,a)}X_.className="AlphaDropout",SA(X_);class J_ extends zC{constructor(e){null==e&&(e={}),super(e),this.supportsMasking=!0,this.axis=null==e.axis?-1:e.axis,this.momentum=null==e.momentum?.99:e.momentum,this.epsilon=null==e.epsilon?.001:e.epsilon,this.center=null==e.center||e.center,this.scale=null==e.scale||e.scale,this.betaInitializer=IC(e.betaInitializer||"zeros"),this.gammaInitializer=IC(e.gammaInitializer||"ones"),this.movingMeanInitializer=IC(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=IC(e.movingVarianceInitializer||"ones"),this.betaConstraint=iI(e.betaConstraint),this.gammaConstraint=iI(e.gammaConstraint),this.betaRegularizer=zW(e.betaRegularizer),this.gammaRegularizer=zW(e.gammaRegularizer)}build(e){e=NC(e);const t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(null==n)throw new Xw(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new DC({ndim:e.length,axes:{[t]:n}})];const r=[n];this.scale&&(this.gamma=this.addWeight("gamma",r,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",r,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",r,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",r,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return lp((()=>{const n=null!=t.training&&t.training,r=TC(e),a=r.shape,s=a.length,i=PS(0,s),o=this.axis>=0?this.axis:this.axis+s;i.splice(o,1);const l=Yw(1,s);l[o]=a[o];const u=i.slice();u.sort();const c=!eo(u,PS(0,s).slice(0,s-1));if(!n)return(()=>{if(c){const e=Hf(this.movingMean.read(),l),t=Hf(this.movingVariance.read(),l),n=this.center?Hf(this.beta.read(),l):null,a=this.scale?Hf(this.gamma.read(),l):null;return Z_(r,e,t,n,a,this.epsilon)}return Z_(r,this.movingMean.read(),this.movingVariance.read(),null==this.beta?null:this.beta.read(),null==this.gamma?null:this.gamma.read(),this.epsilon)})();const[d,h,p]=K_(r,this.gamma.read(),this.beta.read(),i,this.epsilon),f=(e,t,n)=>{lp((()=>{const r=1-n,a=e.read(),s=gf(Fg(a,t),r);e.write(Fg(a,s))}))};return(()=>{f(this.movingMean,h,this.momentum),f(this.movingVariance,p,this.momentum)})(),d}))}getConfig(){const e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:CC(this.betaInitializer),gammaInitializer:CC(this.gammaInitializer),movingMeanInitializer:CC(this.movingMeanInitializer),movingVarianceInitializer:CC(this.movingVarianceInitializer),betaRegularizer:BW(this.betaRegularizer),gammaRegularizer:BW(this.gammaRegularizer),betaConstraint:aI(this.betaConstraint),gammaConstraint:aI(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}}J_.className="BatchNormalization",SA(J_);class Y_ extends zC{constructor(e){if(null==e&&(e={}),super(e),this.axis=null==e.axis?-1:e.axis,"number"==typeof this.axis){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else{if(!Array.isArray(this.axis))throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);for(const e of this.axis)if(!Number.isInteger(e))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}this.epsilon=null==e.epsilon?.001:e.epsilon,this.center=null==e.center||e.center,this.scale=null==e.scale||e.scale,this.betaInitializer=IC(e.betaInitializer||"zeros"),this.gammaInitializer=IC(e.gammaInitializer||"ones"),this.betaRegularizer=zW(e.betaRegularizer),this.gammaRegularizer=zW(e.gammaRegularizer),this.supportsMasking=!0}build(e){const t=(e=NC(e)).length;"number"==typeof this.axis&&(this.axis=[this.axis]);for(let a=0;a<this.axis.length;++a)this.axis[a]<0&&(this.axis[a]+=t);for(const a of this.axis)if(a<0||a>=t)throw new Error(`Invalid axis: ${a}`);if(this.axis.length!==dS(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);const n=this.axis.map((t=>e[t])),r=!0;this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,r):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,r):this.beta=null,this.built=!0}call(e,t){const n=TC(e),r=n.shape,a=r.length;return lp((()=>{let{mean:e,variance:t}=ny(n,this.axis,!0);const s=Yw(1,a);for(const n of this.axis)s[n]=r[n];const i=e=>null!=e&&e.shape.length!==a?Hf(e,s):e;let o=this.scale?i(this.gamma.read()):null,l=this.center?i(this.beta.read()):null;const u=[],c=[];for(let n=0;n<a;++n)-1!==this.axis.indexOf(n)?(u.push(r[n]),c.push(1)):(u.push(1),c.push(r[n]));return e=hg(e,u),t=hg(t,u),null!=o&&(o=hg(o,c)),null!=l&&(l=hg(l,c)),Z_(n,e,t,l,o,this.epsilon)}))}getConfig(){const e={axis:this.axis,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:CC(this.betaInitializer),gammaInitializer:CC(this.gammaInitializer),betaRegularizer:BW(this.betaRegularizer),gammaRegularizer:BW(this.gammaRegularizer)},t=super.getConfig();return Object.assign(e,t),e}}Y_.className="LayerNormalization",SA(Y_);class eT extends zC{constructor(e){if(null==e&&(e={}),super(e),this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,null==e.padding)this.padding=[[1,1],[1,1]];else if("number"==typeof e.padding)this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,2!==e.padding.length)throw new Xw(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,n;if("number"==typeof e.padding[0])t=[e.padding[0],e.padding[0]],n=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,2!==e.padding[0].length)throw new Xw(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],2!==e.padding[1].length)throw new Xw(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);n=e.padding[1]}this.padding=[t,n]}this.inputSpec=[new DC({ndim:4})]}computeOutputShape(e){let t,n;return e=NC(e),"channelsFirst"===this.dataFormat?(t=null!=e[2]&&e[2]>=0?e[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[3]&&e[3]>=0?e[3]+this.padding[1][0]+this.padding[1][1]:null,[e[0],e[1],t,n]):(t=null!=e[1]&&e[1]>=0?e[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[2]&&e[2]>=0?e[2]+this.padding[1][0]+this.padding[1][1]:null,[e[0],t,n,e[3]])}call(e,t){return lp((()=>{return t=TC(e),n=this.padding,r=this.dataFormat,lp((()=>{if(4!==t.rank)throw new Xw(`temporalPadding expects input tensor to be 4-D, but received a ${t.rank}-D tensor.`);if(null==n&&(n=[[1,1],[1,1]]),2!==n.length||2!==n[0].length||2!==n[1].length)throw new Xw("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==r&&(r="channelsLast"),"channelsLast"!==r&&"channelsFirst"!==r)throw new Xw(`Unknown data format: ${r}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let e;return e="channelsFirst"===r?[[0,0],[0,0],n[0],n[1]]:[[0,0],n[0],n[1],[0,0]],uy(t,e)}));
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
var t,n,r}))}getConfig(){const e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
function tT(e,t,n,r,a,s){return lp((()=>{let i;_S(a),NS(s),TS(r),null==n&&(n=[1,1]),null==r&&(r="valid"),null==a&&(a="channelsLast"),null==s&&(s="max"),e=KW(e,a);const o="same"===r?"same":"valid";return i="max"===s?Hg(e,t,n,o):jf(e,t,n,o),"channelsFirst"===a&&(i=rv(i,[0,3,1,2])),i}))}function nT(e,t,n,r,a,s){return lp((()=>{let i;_S(a),NS(s),TS(r),null==n&&(n=[1,1,1]),null==r&&(r="valid"),null==a&&(a="channelsLast"),null==s&&(s="max"),e=JW(e,a);const o="same"===r?"same":"valid";return i="max"===s?jg(e,t,n,o):qf(e,t,n,o),"channelsFirst"===a&&(i=rv(i,[0,4,1,2,3])),i}))}eT.className="ZeroPadding2D",SA(eT);class rT extends zC{constructor(e){if(null==e.poolSize&&(e.poolSize=2),super(e),"number"==typeof e.poolSize)this.poolSize=[e.poolSize];else{if(!Array.isArray(e.poolSize)||1!==e.poolSize.length||"number"!=typeof e.poolSize[0])throw new Xw(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);this.poolSize=e.poolSize}if(mS(this.poolSize,"poolSize"),null==e.strides)this.strides=this.poolSize;else if("number"==typeof e.strides)this.strides=[e.strides];else{if(!Array.isArray(e.strides)||1!==e.strides.length||"number"!=typeof e.strides[0])throw new Xw(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);this.strides=e.strides}mS(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,TS(this.padding),this.inputSpec=[new DC({ndim:3})]}computeOutputShape(e){const t=XW((e=NC(e))[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return lp((()=>{this.invokeCallHook(e,t),e=US(TC(e),2);const n=this.poolingFunction(TC(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return Eb(n,[2])}))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}}class aT extends rT{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return _S(a),TS(r),tT(e,t,n,r,a,"max")}}aT.className="MaxPooling1D",SA(aT);class sT extends rT{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return _S(a),TS(r),tT(e,t,n,r,a,"avg")}}sT.className="AveragePooling1D",SA(sT);class iT extends zC{constructor(e){if(null==e.poolSize&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],null==e.strides)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(2!==e.strides.length)throw new Xw(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];mS(this.poolSize,"poolSize"),mS(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,_S(this.dataFormat),TS(this.padding),this.inputSpec=[new DC({ndim:4})]}computeOutputShape(e){e=NC(e);let t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2];return t=XW(t,this.poolSize[0],this.padding,this.strides[0]),n=XW(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}call(e,t){return lp((()=>(this.invokeCallHook(e,t),this.poolingFunction(TC(e),this.poolSize,this.strides,this.padding,this.dataFormat))))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class oT extends iT{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return _S(a),TS(r),tT(e,t,n,r,a,"max")}}oT.className="MaxPooling2D",SA(oT);class lT extends iT{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return _S(a),TS(r),tT(e,t,n,r,a,"avg")}}lT.className="AveragePooling2D",SA(lT);class uT extends zC{constructor(e){if(null==e.poolSize&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],null==e.strides)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(3!==e.strides.length)throw new Xw(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];mS(this.poolSize,"poolSize"),mS(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,_S(this.dataFormat),TS(this.padding),this.inputSpec=[new DC({ndim:5})]}computeOutputShape(e){e=NC(e);let t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],r="channelsFirst"===this.dataFormat?e[4]:e[3];return t=XW(t,this.poolSize[0],this.padding,this.strides[0]),n=XW(n,this.poolSize[1],this.padding,this.strides[1]),r=XW(r,this.poolSize[2],this.padding,this.strides[2]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n,r]:[e[0],t,n,r,e[4]]}call(e,t){return lp((()=>(this.invokeCallHook(e,t),this.poolingFunction(TC(e),this.poolSize,this.strides,this.padding,this.dataFormat))))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class cT extends uT{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return _S(a),TS(r),nT(e,t,n,r,a,"max")}}cT.className="MaxPooling3D",SA(cT);class dT extends uT{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return _S(a),TS(r),nT(e,t,n,r,a,"avg")}}dT.className="AveragePooling3D",SA(dT);class hT extends zC{constructor(e){super(e),this.inputSpec=[new DC({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new Zw}}class pT extends hT{constructor(e){super(e||{})}call(e,t){return lp((()=>{const t=TC(e);return Xg(t,1)}))}}pT.className="GlobalAveragePooling1D",SA(pT);class fT extends hT{constructor(e){super(e||{})}call(e,t){return lp((()=>{const t=TC(e);return Ym(t,1)}))}}fT.className="GlobalMaxPooling1D",SA(fT);class mT extends zC{constructor(e){super(e),this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,_S(this.dataFormat),this.inputSpec=[new DC({ndim:4})]}computeOutputShape(e){return"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new Zw}getConfig(){const e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class gT extends mT{call(e,t){return lp((()=>{const t=TC(e);return"channelsLast"===this.dataFormat?Xg(t,[1,2]):Xg(t,[2,3])}))}}gT.className="GlobalAveragePooling2D",SA(gT);class yT extends mT{call(e,t){return lp((()=>{const t=TC(e);return"channelsLast"===this.dataFormat?Ym(t,[1,2]):Ym(t,[2,3])}))}}yT.className="GlobalMaxPooling2D",SA(yT);
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class bT extends zC{constructor(e){super(e),this.layer=e.layer}build(e){this.built=!0}get trainable(){return null!=this.layer&&this.layer.trainable}set trainable(e){null!=this.layer&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){const e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.layer&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,n={}){const r=vI(t.layer,n);delete t.layer;const a={layer:r};return Object.assign(a,t),new e(a)}}class vT extends bT{constructor(e){super(e),this.supportsMasking=!0}build(e){if((e=NC(e)).length<3)throw new Xw(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];const t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){const t=[(e=NC(e))[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),r=e[1];return[n[0],r].concat(n.slice(1))}call(e,t){return lp((()=>p_(((e,n)=>[TC(this.layer.call(e,t)),[]]),e=TC(e),[],!1,null,null,!1,!0)[1]))}}vT.className="TimeDistributed",SA(vT);class AT extends bT{constructor(e){super(e);const t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=vI(n),t.goBackwards=!0!==t.goBackwards;const r={};var a;if(r.className=e.layer.getClassName(),r.config=t,this.backwardLayer=vI(r),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=void 0===e.mergeMode?"concat":e.mergeMode,a=this.mergeMode,pS(IS,"BidirectionalMergeMode",a),e.weights)throw new Zw("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,null!=this.forwardLayer&&(this.forwardLayer.trainable=e),null!=this.backwardLayer&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){const t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}computeOutputShape(e){let t,n,r,a=this.forwardLayer.computeOutputShape(e);return Array.isArray(a)&&Array.isArray(a[0])||(a=[a]),this.returnState?(r=a.slice(1),t=a[0]):t=a[0],"concat"===this.mergeMode?(t[t.length-1]*=2,n=[t]):n=null==this.mergeMode?[t,t.slice()]:[t],this.returnState?null==this.mergeMode?n.concat(r).concat(r.slice()):[t].concat(r).concat(r.slice()):nS(n)}apply(e,t){let n=null==t?null:t.initialState,r=null==t?null:t.constants;null==t&&(t={});const a=h_(e,n,r,this.numConstants);if(e=a.inputs,n=a.initialState,r=a.constants,Array.isArray(e)&&(n=e.slice(1),e=e[0]),(null==n||0===n.length)&&null==r)return super.apply(e,t);const s=[],i=[];if(null!=n){const e=n.length;if(e%2>0)throw new Xw("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=n,s.push(...n);const r=n.map((e=>new DC({shape:e.shape})));this.forwardLayer.stateSpec=r.slice(0,e/2),this.backwardLayer.stateSpec=r.slice(e/2),i.push(...r)}if(null!=r)throw new Zw("Support for constants in Bidirectional layers is not implemented yet.");const o=s[0]instanceof MC;for(const l of s)if(l instanceof MC!==o)throw new Xw("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(o){const n=[e].concat(s),r=this.inputSpec.concat(i),a=this.inputSpec;this.inputSpec=r;const o=super.apply(n,t);return this.inputSpec=a,o}return super.apply(e,t)}call(e,t){return lp((()=>{const n=t.initialState;let r,a,s,i;if(null==n)r=this.forwardLayer.call(e,t),a=this.backwardLayer.call(e,t);else{const s=n.slice(0,n.length/2),i=n.slice(n.length/2);r=this.forwardLayer.call(e,Object.assign(t,{initialState:s})),a=this.backwardLayer.call(e,Object.assign(t,{initialState:i}))}return this.returnState&&(Array.isArray(r)&&(s=r.slice(1).concat(a.slice(1))),r=r[0],a=a[0]),this.returnSequences&&(a=ob(a,1)),"concat"===this.mergeMode?i=QS([r,a]):"sum"===this.mergeMode?i=pf(r,a):"ave"===this.mergeMode?i=gf(.5,pf(r,a)):"mul"===this.mergeMode?i=gf(r,a):null==this.mergeMode&&(i=[r,a]),this.returnState?null==this.mergeMode?i.concat(s):[i].concat(s):i}))}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){RS(this.forwardLayer.name,(()=>{this.forwardLayer.build(e)})),RS(this.backwardLayer.name,(()=>{this.backwardLayer.build(e)})),this.built=!0}computeMask(e,t){let n;if(Array.isArray(t)&&(t=t[0]),n=this.returnSequences?null==this.mergeMode?[t,t]:t:null==this.mergeMode?[null,null]:null,this.returnState){const e=this.forwardLayer.states.map((e=>null));return Array.isArray(n)?n.concat(e).concat(e):[n].concat(e).concat(e)}return n}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),null!=this.forwardLayer&&this.forwardLayer.setFastWeightInitDuringBuild(e),null!=this.backwardLayer&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){const e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){const n=vI(t.layer);if(delete t.layer,null!=t.numConstants)throw new Zw("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");const r=t;return r.layer=n,new e(r)}}AT.className="Bidirectional",SA(AT);
/**
 * @license
 * Copyright 2022 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class xT extends zC{constructor(e){super(e),this.scale=e.scale,e.offset?this.offset=e.offset:this.offset=0}getConfig(){const e={scale:this.scale,offset:this.offset},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return lp((()=>("float32"!==(e=TC(e)).dtype&&(e=VS(e,"float32")),pf(gf(e,this.scale),this.offset))))}}xT.className="Rescaling",SA(xT);
/**
 * @license
 * Copyright 2022 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
const{resizeBilinear:kT,cropAndResize:wT}=mA;class ST extends zC{constructor(e){super(e),this.height=e.height,this.width=e.width}centerCrop(e,t,n,r,a,s,i,o){return lp((()=>{let l,u=!1;const c=[t/s,n/i,(r+t)/s,(a+n)/i],d=[];3===e.rank?(u=!0,l=Rb([e])):l=e;for(let e=0;e<l.shape[0];e++)d.push(c);const h=rp(d,[d.length,4]),p=nb(0,d.length,1,"int32"),f=wT(l,h,p,[r,a],"nearest");return VS(u?TC(Kb(f)):f,o)}))}upsize(e,t,n,r){return lp((()=>VS(kT(e,[t,n]),r)))}call(e,t){return lp((()=>{const t=TC(e),n=t.dtype,r=t.shape,a=r[r.length-3],s=r[r.length-2];let i=0;a!==this.height&&(i=Math.floor((a-this.height)/2));let o=0;return s!==this.width&&(o=Math.floor((s-this.width)/2),0===o&&(o=1)),i>=0&&o>=0?this.centerCrop(t,i,o,this.height,this.width,a,s,n):this.upsize(e,this.height,this.width,n)}))}getConfig(){const e={height:this.height,width:this.width},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){const t=(e=NC(e)).length-3,n=e.length-2;return e[t]=this.height,e[n]=this.width,e}}ST.className="CenterCrop",SA(ST);
/**
 * @license
 * Copyright 2022 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class CT extends zC{constructor(e){super(e),this.numTokens=e.numTokens,e.outputMode?this.outputMode=e.outputMode:this.outputMode="multiHot"}getConfig(){const e={numTokens:this.numTokens,outputMode:this.outputMode},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){return null==(e=NC(e))?[this.numTokens]:"oneHot"===this.outputMode&&1!==e[e.length-1]?(e.push(this.numTokens),e):(e[e.length-1]=this.numTokens,e)}call(e,t){return lp((()=>{let n;if("int32"!==(e=TC(e)).dtype&&(e=VS(e,"int32")),void 0!==t.countWeights){if("count"!==this.outputMode)throw new Xw(`countWeights is not used when outputMode !== count.\n              Received countWeights=${t.countWeights}`);n=TC(t.countWeights)}const r=Ym(e),a=eg(e),s=gg(this.numTokens,r).bufferSync().get(0),i=yg(a,0).bufferSync().get(0);if(!s||!i)throw new Xw(`Input values must be between 0 < values <= numTokens with numTokens=${this.numTokens}`);
/**
 * @license
 * Copyright 2022 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
return function(e,t,n,r){let a=TC(e);if("int32"!==a.dtype&&(a=VS(a,"int32")),"int"===t)return a;const s=a.shape;if(0===a.rank&&(a=cg(a,-1)),"oneHot"===t&&1!==a.shape[a.shape.length-1]&&(a=cg(a,-1)),a.rank>2)throw new Xw(`When outputMode is not int, maximum output rank is 2 Received outputMode ${t} and input shape ${s} which would result in output rank ${a.rank}.`);const i=["multiHot","oneHot"].includes(t);let o;if(o=Wm(a,void 0!==r&&"count"===t?r:[],n,i),"tfIdf"!==t)return o;if(r)return gf(o,r);throw new Xw("When outputMode is 'tfIdf', weights must be provided.")}(e,this.outputMode,this.numTokens,n)}))}}CT.className="CategoryEncoding",SA(CT);
/**
 * @license
 * Copyright 2022 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
const IT=new Set(["bilinear","nearest"]);class WT extends zC{constructor(e){if(super(e),this.height=e.height,this.width=e.width,e.interpolation){if(!IT.has(e.interpolation))throw new Xw(`Invalid interpolation parameter: ${e.interpolation} is not implemented`);this.interpolation=e.interpolation}else this.interpolation="bilinear";this.cropToAspectRatio=Boolean(e.cropToAspectRatio)}computeOutputShape(e){const t=(e=NC(e))[2];return[this.height,this.width,t]}getConfig(){const e={height:this.height,width:this.width,interpolation:this.interpolation,cropToAspectRatio:this.cropToAspectRatio},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return lp((()=>{const t=[this.height,this.width];if("bilinear"===this.interpolation)return mA.resizeBilinear(e,t,!this.cropToAspectRatio);if("nearest"===this.interpolation)return mA.resizeNearestNeighbor(e,t,!this.cropToAspectRatio);throw new Error(`Interpolation is ${this.interpolation} but only ${[...IT]} are supported`)}))}}WT.className="Resizing",SA(WT);
/**
 * @license
 * Copyright 2023 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class _T{constructor(e){this.seed=e}next(){if(void 0!==this.seed)return this.seed++}}_T.className="RandomSeed";
/**
 * @license
 * Copyright 2023 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
class TT extends zC{constructor(e){super(e),this.randomGenerator=new _T(e.seed)}getConfig(){const e={seed:this.randomGenerator.seed},t=super.getConfig();return Object.assign(e,t),e}}TT.className="BaseRandomLayer";
/**
 * @license
 * Copyright 2023 CodeSmith LLC
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 * =============================================================================
 */
const NT=new Set(["bilinear","nearest"]);class ET extends TT{constructor(e){super(e);const{factor:t,interpolation:n="bilinear"}=e;if(this.factor=t,Array.isArray(this.factor)&&2===this.factor.length)this.widthLower=this.factor[0],this.widthUpper=this.factor[1];else{if(Array.isArray(this.factor)||!(this.factor>0))throw new Xw(`Invalid factor: ${this.factor}. Must be positive number or tuple of 2 numbers`);this.widthLower=-this.factor,this.widthUpper=this.factor}if(this.widthLower<-1||this.widthUpper<-1)throw new Xw(`factor must have values larger than -1. Got: ${this.factor}`);if(this.widthUpper<this.widthLower)throw new Xw(`factor cannot have upper bound less than lower bound.\n        Got upper bound: ${this.widthUpper}.\n        Got lower bound: ${this.widthLower}\n      `);if(n){if(!NT.has(n))throw new Xw(`Invalid interpolation parameter: ${n} is not implemented`);this.interpolation=n}}getConfig(){const e={factor:this.factor,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){const t=(e=NC(e))[2];return[this.imgHeight,-1,t]}call(e,t){return lp((()=>{const t=TC(e);this.imgHeight=t.shape[t.shape.length-3];const n=t.shape[t.shape.length-2];this.widthFactor=eb([1],1+this.widthLower,1+this.widthUpper,"float32",this.randomGenerator.next());let r=this.widthFactor.dataSync()[0]*n;r=Math.round(r);const a=[this.imgHeight,r];switch(this.interpolation){case"bilinear":return mA.resizeBilinear(e,a);case"nearest":return mA.resizeNearestNeighbor(e,a);default:throw new Error(`Interpolation is ${this.interpolation}\n          but only ${[...NT]} are supported`)}}))}}ET.className="RandomWidth",SA(ET);
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * =============================================================================
 */
var RT,$T,OT,FT,DT;Do().registerFlag("KEEP_INTERMEDIATE_TENSORS",(()=>!1),(e=>{})),($T=RT||(RT={}))[$T.DT_INVALID=0]="DT_INVALID",$T[$T.DT_FLOAT=1]="DT_FLOAT",$T[$T.DT_DOUBLE=2]="DT_DOUBLE",$T[$T.DT_INT32=3]="DT_INT32",$T[$T.DT_UINT8=4]="DT_UINT8",$T[$T.DT_INT16=5]="DT_INT16",$T[$T.DT_INT8=6]="DT_INT8",$T[$T.DT_STRING=7]="DT_STRING",$T[$T.DT_COMPLEX64=8]="DT_COMPLEX64",$T[$T.DT_INT64=9]="DT_INT64",$T[$T.DT_BOOL=10]="DT_BOOL",$T[$T.DT_QINT8=11]="DT_QINT8",$T[$T.DT_QUINT8=12]="DT_QUINT8",$T[$T.DT_QINT32=13]="DT_QINT32",$T[$T.DT_BFLOAT16=14]="DT_BFLOAT16",$T[$T.DT_QINT16=15]="DT_QINT16",$T[$T.DT_QUINT16=16]="DT_QUINT16",$T[$T.DT_UINT16=17]="DT_UINT16",$T[$T.DT_COMPLEX128=18]="DT_COMPLEX128",$T[$T.DT_HALF=19]="DT_HALF",$T[$T.DT_RESOURCE=20]="DT_RESOURCE",$T[$T.DT_VARIANT=21]="DT_VARIANT",$T[$T.DT_UINT32=22]="DT_UINT32",$T[$T.DT_UINT64=23]="DT_UINT64",$T[$T.DT_FLOAT_REF=101]="DT_FLOAT_REF",$T[$T.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",$T[$T.DT_INT32_REF=103]="DT_INT32_REF",$T[$T.DT_UINT8_REF=104]="DT_UINT8_REF",$T[$T.DT_INT16_REF=105]="DT_INT16_REF",$T[$T.DT_INT8_REF=106]="DT_INT8_REF",$T[$T.DT_STRING_REF=107]="DT_STRING_REF",$T[$T.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",$T[$T.DT_INT64_REF=109]="DT_INT64_REF",$T[$T.DT_BOOL_REF=110]="DT_BOOL_REF",$T[$T.DT_QINT8_REF=111]="DT_QINT8_REF",$T[$T.DT_QUINT8_REF=112]="DT_QUINT8_REF",$T[$T.DT_QINT32_REF=113]="DT_QINT32_REF",$T[$T.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",$T[$T.DT_QINT16_REF=115]="DT_QINT16_REF",$T[$T.DT_QUINT16_REF=116]="DT_QUINT16_REF",$T[$T.DT_UINT16_REF=117]="DT_UINT16_REF",$T[$T.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",$T[$T.DT_HALF_REF=119]="DT_HALF_REF",$T[$T.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",$T[$T.DT_VARIANT_REF=121]="DT_VARIANT_REF",$T[$T.DT_UINT32_REF=122]="DT_UINT32_REF",$T[$T.DT_UINT64_REF=123]="DT_UINT64_REF",FT=OT||(OT={}),(DT=FT.CheckpointFormatVersion||(FT.CheckpointFormatVersion={}))[DT.LEGACY=0]="LEGACY",DT[DT.V1=1]="V1",DT[DT.V2=2]="V2";
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const MT={};function LT(e){return MT[e]}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function BT(e,t,n,r,a){const s=t.inputParams[e];if(s&&void 0!==s.inputIndexStart){const e=s.inputIndexStart,i=0===s.inputIndexEnd?void 0:void 0===s.inputIndexEnd?e+1:s.inputIndexEnd,o=e<0?t.inputNames.length+e:e;if("tensor"===s.type)return PT(t.inputNames[o],n,r,a);if("tensors"===s.type){const s=t.inputs.slice(e,i);return t.inputNames.slice(e,i).filter(((e,t)=>{var n;return"NoOp"!==(null===(n=s[t])||void 0===n?void 0:n.op)})).map((e=>PT(e,n,r,a)))}const l=PT(t.inputNames[o],n,r,a),u=l.dataSync();return"number"===s.type?u[0]:So(l.shape,u)}const i=t.attrParams[e];return i&&i.value}function PT(e,t,n,r){const[a,s]=UT(e,n);if(null!=r){const e=r.getHashTableHandleByName(a);if(null!=e)return e}const i=n.currentContextIds.find((e=>!!t[VT(a,e)]));return void 0!==i?t[VT(a,i)][s]:void 0}function zT(e,t,n){return t[VT(e,n.currentContextId)]}function GT(e,t){const[n,r,a]=UT(e,t);return[VT(n,t&&t.currentContextId),r,a]}function VT(e,t){return t?`${e}-${t}`:e}function UT(e,t){if(""===e)return["",0,void 0];const n=null!=t&&null!=t.parseNodeNameCache;if(n){const n=t.parseNodeNameCache.get(e);if(null!=n)return n}const r=e.split(":");let a;if(1===r.length)a=[e,0,void 0];else{const e=r[0],t=3===r.length?r[1]:void 0;a=[e,Number(r[r.length-1]),t]}return n&&t.parseNodeNameCache.set(e,a),a}function HT(e,t,n){let r=BT("pad",e,t,n);if("explicit"===r){r=BT("explicitPaddings",e,t,n);const a=[[0,0],[0,0],[0,0],[0,0]];for(let e=0;e<4;e++)a[e][0]=r[2*e],a[e][1]=r[2*e+1];return a}return r}function jT(e){return e.kept?e:df(e)}
/**
 * @license
 * Copyright 2023 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const qT=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},Symbol.toStringTag,{value:"Module"})),QT=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsFinite",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsInf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},Symbol.toStringTag,{value:"Module"})),XT=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcatV2",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListLength",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}]},{tfOpName:"TensorListResize",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"size",type:"number"}]}]},Symbol.toStringTag,{value:"Module"})),ZT=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}]},Symbol.toStringTag,{value:"Module"})),KT=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomStandardNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniformInt",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number"},{tfName:"maxval",name:"maxval",type:"number"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}]},Symbol.toStringTag,{value:"Module"})),JT=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},Symbol.toStringTag,{value:"Module"})),YT=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"LowerBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"UpperBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}]},Symbol.toStringTag,{value:"Module"})),eN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}]},Symbol.toStringTag,{value:"Module"})),tN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"InitializeTable",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]},{tfOpName:"InitializeTableV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]}]},Symbol.toStringTag,{value:"Module"})),nN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]},{tfOpName:"ImageProjectiveTransformV3",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"transforms",type:"tensor"},{start:2,name:"outputShape",type:"number[]"},{start:3,name:"fillValue",type:"number"}],attrs:[{tfName:"interpolation",name:"interpolation",type:"string"},{tfName:"fill_mode",name:"fillMode",type:"string"}]}]},Symbol.toStringTag,{value:"Module"})),rN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BitwiseAnd",category:"logical",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}]}]},Symbol.toStringTag,{value:"Module"})),aN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"MatrixBandPart",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"numLower",type:"tensor"},{start:1,name:"numUpper",type:"tensor"}]}]},Symbol.toStringTag,{value:"Module"})),sN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"EuclideanNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",defaultValue:!1}]},{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]}]},Symbol.toStringTag,{value:"Module"})),iN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cumprod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}]},Symbol.toStringTag,{value:"Module"})),oN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]},{tfOpName:"TensorScatterUpdate",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"values",type:"tensor"}]}]},Symbol.toStringTag,{value:"Module"})),lN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}]},Symbol.toStringTag,{value:"Module"})),uN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}]},Symbol.toStringTag,{value:"Module"})),cN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"StaticRegexReplace",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"pattern",name:"pattern",type:"string"},{tfName:"rewrite",name:"rewrite",type:"string"},{tfName:"replace_global",name:"replaceGlobal",type:"bool"}]},{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}]},Symbol.toStringTag,{value:"Module"})),dN=Object.freeze(Object.defineProperty({__proto__:null,json:[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"EnsureShape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}]},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class hN{static get Instance(){return this._instance||(this._instance=new this)}constructor(){const e=[].concat(...[qT,QT,XT,ZT,KT,JT,YT,eN,tN,nN,rN,aN,sN,iN,oN,lN,uN,cN,dN].map((e=>e.json)));this.opMappers=e.reduce(((e,t)=>(e[t.tfOpName]=t,e)),{})}transformGraph(e,t={}){const n=e.node,r=[],a=[],s=[],i=n.reduce(((e,t)=>(e[t.name]=this.mapNode(t),t.op.startsWith("Placeholder")?r.push(e[t.name]):"Const"===t.op?a.push(e[t.name]):null!=t.input&&0!==t.input.length||s.push(e[t.name]),e)),{});let o=[];const l=[];let u={},c={};null!=t&&(u=this.mapSignatureEntries(t.inputs),c=this.mapSignatureEntries(t.outputs));const d=Object.keys(i);d.forEach((e=>{const t=i[e];t.inputNames.forEach(((e,n)=>{const[r,,a]=GT(e),s=i[r];if(null!=s.outputs){const e=s.outputs.indexOf(a);if(-1!==e){const a=`${r}:${e}`;t.inputNames[n]=a}}t.inputs.push(s),s.children.push(t)}))})),0===Object.keys(c).length?d.forEach((e=>{const t=i[e];0===t.children.length&&l.push(t)})):Object.keys(c).forEach((e=>{const[t]=GT(e),n=i[t];null!=n&&(n.signatureKey=c[e],l.push(n))})),Object.keys(u).length>0?Object.keys(u).forEach((e=>{const[t]=GT(e),n=i[t];n&&(n.signatureKey=u[e],o.push(n))})):o=r;let h={};null!=e.library&&null!=e.library.function&&(h=e.library.function.reduce(((e,t)=>(e[t.signature.name]=this.mapFunction(t),e)),{}));const p={nodes:i,inputs:o,outputs:l,weights:a,placeholders:r,signature:t,functions:h};return s.length>0&&(p.initNodes=s),p}mapSignatureEntries(e){return Object.keys(e||{}).reduce(((t,n)=>(t[e[n].name]=n,t)),{})}mapNode(e){const t=LT(e.op)||this.opMappers[e.op]||{};null==e.attr&&(e.attr={});const n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map((e=>e.startsWith("^")?e.slice(1):e)),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return null!=t.inputs&&(n.inputParams=t.inputs.reduce(((e,t)=>(e[t.name]={type:t.type,inputIndexStart:t.start,inputIndexEnd:t.end},e)),{})),null!=t.attrs&&(n.attrParams=t.attrs.reduce(((t,n)=>{const r=n.type;let a;switch(n.type){case"string":a=fN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=fN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"string[]":a=SN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=SN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number":a=gN(e.attr,n.tfName,n.defaultValue||0),void 0===a&&n.tfDeprecatedName&&(a=gN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number[]":a=wN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=wN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool":a=mN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=mN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool[]":a=IN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=IN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape":a=kN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=kN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape[]":a=CN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=CN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype":a=vN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=vN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype[]":a=AN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=AN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"func":a=bN(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=bN(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${n.type} for op: ${e.op}`)}return t[n.name]={value:a,type:r},t}),{})),n}mapFunction(e){const t=e.nodeDef,n=[];let r={};null!=t&&(r=t.reduce(((e,t)=>(e[t.name]=this.mapNode(t),"Const"===t.op&&n.push(e[t.name]),e)),{}));const a=[],s=[];e.signature.inputArg.forEach((e=>{const[t]=GT(e.name),n={name:t,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:yN(e.type),type:"dtype"}},children:[]};n.signatureKey=e.name,a.push(n),r[t]=n}));Object.keys(r).forEach((e=>{const t=r[e];t.inputNames.forEach(((e,n)=>{const[a,,s]=GT(e),i=r[a];if(null!=i.outputs){const e=i.outputs.indexOf(s);if(-1!==e){const r=`${a}:${e}`;t.inputNames[n]=r}}t.inputs.push(i),i.children.push(t)}))}));const i=e.ret;e.signature.outputArg.forEach((e=>{const[t,n]=GT(i[e.name]),a=r[t];null!=a&&(a.defaultOutput=n,s.push(a))}));const o=this.mapArgsToSignature(e);return{nodes:r,inputs:a,outputs:s,weights:n,placeholders:[],signature:o}}mapArgsToSignature(e){return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce(((e,t)=>(e[t.name]=this.mapArgToTensorInfo(t),e)),{}),outputs:e.signature.outputArg.reduce(((t,n)=>(t[n.name]=this.mapArgToTensorInfo(n,e.ret),t)),{})}}mapArgToTensorInfo(e,t){let n=e.name;return null!=t&&(n=t[n]),{name:n,dtype:e.type}}}function pN(e,t){const n=Array.isArray(e)?String.fromCharCode.apply(null,e):function(e){const t=Do().global;if(void 0!==t.atob)return t.atob(e);if("undefined"!=typeof Buffer)return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}(e);return t?n:n.toLowerCase()}function fN(e,t,n,r=!1){const a=e[t];return null!=a?pN(a.s,r):n}function mN(e,t,n){const r=e[t];return r?r.b:n}function gN(e,t,n){const r=e[t]||{},a=null!=r.i?r.i:null!=r.f?r.f:n;return"number"==typeof a?a:parseInt(a,10)}function yN(e){switch("string"==typeof e&&(e=RT[e]),e){case RT.DT_FLOAT:case RT.DT_HALF:return"float32";case RT.DT_INT32:case RT.DT_INT64:case RT.DT_INT8:case RT.DT_UINT8:return"int32";case RT.DT_BOOL:return"bool";case RT.DT_DOUBLE:return"float32";case RT.DT_STRING:return"string";case RT.DT_COMPLEX64:case RT.DT_COMPLEX128:return"complex64";default:return null}}function bN(e,t,n){const r=e[t];return r&&r.func?r.func.name:n}function vN(e,t,n){const r=e[t];return r&&r.type?yN(r.type):n}function AN(e,t,n){const r=e[t];return r&&r.list&&r.list.type?r.list.type.map((e=>yN(e))):n}function xN(e){if(!e.unknownRank)return null!=e.dim?e.dim.map((e=>"number"==typeof e.size?e.size:parseInt(e.size,10))):[]}function kN(e,t,n){const r=e[t];return r&&r.shape?xN(r.shape):n}function wN(e,t,n){const r=e[t];return r?((r.list.f&&r.list.f.length?r.list.f:r.list.i)||[]).map((e=>"number"==typeof e?e:parseInt(e,10))):n}function SN(e,t,n,r=!1){const a=e[t];return a&&a.list&&a.list.s?a.list.s.map((e=>pN(e,r))):n}function CN(e,t,n){const r=e[t];return r&&r.list&&r.list.shape?r.list.shape.map((e=>xN(e))):n}function IN(e,t,n){const r=e[t];return r&&r.list&&r.list.b?r.list.b:n}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class WN{constructor(e,t,n){this.node=e,this.tensorMap=t,this.context=n,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map((e=>this.getInput(e))),null!=e.rawAttrs&&(this.attrs=Object.keys(e.rawAttrs).reduce(((e,t)=>(e[t]=this.getAttr(t),e)),{}))}getInput(e){return PT(e,this.tensorMap,this.context)}getAttr(e,t){const n=this.node.rawAttrs[e];if(null!=n.tensor)return PT(e,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return gN(this.node.rawAttrs,e,t);if(null!=n.s)return fN(this.node.rawAttrs,e,t);if(null!=n.b)return mN(this.node.rawAttrs,e,t);if(null!=n.shape)return kN(this.node.rawAttrs,e,t);if(null!=n.type)return vN(this.node.rawAttrs,e,t);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return wN(this.node.rawAttrs,e,t);if(null!=n.list.s)return SN(this.node.rawAttrs,e,t);if(null!=n.list.shape)return CN(this.node.rawAttrs,e,t);if(null!=n.list.b)return IN(this.node.rawAttrs,e,t);if(null!=n.list.type)return AN(this.node.rawAttrs,e,t)}return t}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _N=Object.freeze(Object.defineProperty({__proto__:null,OP_SCOPE_SUFFIX:Yh,abs:yf,acos:bf,acosh:vf,add:pf,addN:Af,all:xf,any:kf,argMax:wf,argMin:Sf,asin:Cf,asinh:If,atan:Wf,atan2:_f,atanh:Tf,avgPool:jf,avgPool3d:qf,basicLSTMCell:Yf,batchNorm:tm,batchNorm2d:nm,batchNorm3d:rm,batchNorm4d:am,batchToSpaceND:em,bincount:sm,bitwiseAnd:im,booleanMaskAsync:nv,broadcastArgs:om,broadcastTo:lm,buffer:uf,cast:cf,ceil:um,clipByValue:dm,clone:df,complex:tp,concat:Qf,concat1d:hm,concat2d:pm,concat3d:fm,concat4d:mm,conv1d:ym,conv2d:gm,conv2dTranspose:vm,conv3d:Am,conv3dTranspose:km,cos:wm,cosh:Sm,cosineWindow:cv,cumprod:Cm,cumsum:Im,denseBincount:Wm,depthToSpace:_m,depthwiseConv2d:Tm,diag:Nm,dilation2d:Em,div:mf,divNoNan:Bm,dot:Pm,dropout:lv,einsum:zm,elu:Gm,enclosingPowerOfTwo:uv,ensureShape:Vm,equal:Dm,erf:Um,euclideanNorm:lg,exp:ug,expandDims:cg,expm1:dg,eye:pg,fft:Cb,fill:cm,floor:fg,floorDiv:ff,fused:kv,gather:mg,gatherND:ov,greater:gg,greaterEqual:yg,ifft:Ib,imag:bg,image:mA,inTopKAsync:dv,irfft:Wb,isFinite:vg,isInf:Ag,isNaN:xg,leakyRelu:kg,less:wg,lessEqual:Sg,linalg:gA,linspace:Cg,localResponseNormalization:Ig,log:Wg,log1p:_g,logSigmoid:Og,logSoftmax:Dg,logSumExp:Mg,logicalAnd:Lg,logicalNot:Bg,logicalOr:Pg,logicalXor:zg,losses:yA,lowerBound:Ug,matMul:Xf,max:Ym,maxPool:Hg,maxPool3d:jg,maxPoolWithArgmax:qg,maximum:Qg,mean:Xg,meshgrid:Jg,min:eg,minimum:Yg,mirrorPad:ey,mod:ty,moments:ny,movingAverage:av,mul:gf,multiRNNCell:ry,multinomial:ay,neg:Rg,norm:og,notEqual:sy,oneHot:iy,ones:Kg,onesLike:oy,op:ep,outerProduct:ly,pad:uy,pad1d:cy,pad2d:dy,pad3d:hy,pad4d:py,pool:my,pow:tg,prelu:gy,print:hf,prod:yy,raggedGather:by,raggedRange:vy,raggedTensorToTensor:Ay,rand:xy,randomGamma:Ky,randomNormal:Jy,randomStandardNormal:Yy,randomUniform:eb,randomUniformInt:tb,range:nb,real:rb,reciprocal:ab,relu:sb,relu6:ib,reshape:Hf,reverse:ob,reverse1d:lb,reverse2d:ub,reverse3d:cb,reverse4d:db,rfft:Tb,round:hb,rsqrt:pb,scalar:ng,scatterND:sv,searchSorted:Vg,selu:fb,separableConv2d:mb,setdiff1dAsync:gb,sigmoid:Zf,sign:yb,signal:fA,sin:bb,sinh:vb,slice:Kf,slice1d:Ab,slice2d:xb,slice3d:kb,slice4d:wb,softmax:Sb,softplus:$g,spaceToBatchND:fy,sparse:bA,sparseToDense:iv,spectral:pA,split:_b,sqrt:rg,square:ag,squaredDifference:Nb,squeeze:Eb,stack:Rb,step:$b,stridedSlice:Ob,string:vA,sub:Fg,sum:sg,tan:Fb,tanh:Jf,tensor:rp,tensor1d:Db,tensor2d:Mb,tensor3d:Lb,tensor4d:Bb,tensor5d:Pb,tensor6d:zb,tensorScatterUpdate:jb,tile:hg,topk:qb,transpose:rv,truncatedNormal:Qb,unique:Xb,unsortedSegmentSum:Zb,unstack:Kb,upperBound:Jb,variable:Yb,where:Mm,whereAsync:tv,zeros:Zg,zerosLike:Lm},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function TN(e,t,n=""){if("number"!=typeof e&&"number"!=typeof t){Xi(e.length===t.length,(()=>n+` Shapes ${e} and ${t} must match`));for(let r=0;r<e.length;r++){const a=e[r],s=t[r];Xi(a<0||s<0||a===s,(()=>n+` Shapes ${e} and ${t} must match`))}}}function NN(e){return"number"!=typeof e&&!e.some((e=>e<0))}function EN(e,t,n){let r=RN(e,n);const a=!NN(r);if(a&&0===t.length)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${r}`);if(a&&t.forEach((e=>{r=RN(e.shape,r)})),!NN(r))throw new Error(`Non-fully-defined elementShape: ${r}`);return r}function RN(e,t){if("number"==typeof e)return t;if("number"==typeof t)return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);const n=[];for(let r=0;r<e.length;++r){const a=e[r],s=t[r];if(a>=0&&s>=0&&a!==s)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);n[r]=a>=0?a:s}return n}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class $N{constructor(e,t,n,r,a,s,i){this.name=e,this.dtype=t,this.maxSize=n,this.elementShape=r,this.identicalElementShapes=a,this.dynamicSize=s,this.clearAfterRead=i,this.tensors=[],this.closed_=!1,this.idTensor=ng(0),cp(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(e){this.tensors.forEach((t=>{null!=e&&e.has(t.tensor.id)||t.tensor.dispose()})),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(e){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||e>=this.size())throw new Error(`Tried to read from index ${e}, but array size is: ${this.size()}`);const t=this.tensors[e];if(t.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${e} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor}readMany(e){return e.map((e=>this.read(e)))}write(e,t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error(`Tried to write to index ${e}, but array is not resizeable and size is: ${this.maxSize}`);const n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e},\n          because the value dtype is ${t.dtype}, but TensorArray dtype is ${this.dtype}.`);if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=t.shape),TN(this.elementShape,t.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${e}.`),n.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been read.`);if(n.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${e}, because it has already been written.`);n.tensor=t,cp(t),n.written=!0,this.tensors[e]=n}writeMany(e,t){if(e.length!==t.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${e.length} is not the same as tensors size: ${t.length}.`);e.forEach(((e,n)=>this.write(e,t[n])))}gather(e,t){if(t&&t!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${t}`);if(e)e=e.slice(0,this.size());else{e=[];for(let t=0;t<this.size();t++)e.push(t)}if(0===e.length)return rp([],[0].concat(this.elementShape));const n=this.readMany(e);return TN(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),Rb(n,0)}concat(e){if(e&&e!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but concat requested dtype ${e}`);if(0===this.size())return rp([],[0].concat(this.elementShape));const t=[];for(let r=0;r<this.size();r++)t.push(r);const n=this.readMany(t);return TN(this.elementShape,n[0].shape,`TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${n[0].shape})`),Qf(n,0)}scatter(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);if(e.length!==t.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${e.length} vs. ${t.shape[0]}`);const n=Math.max(...e);if(!this.dynamicSize&&n>=this.maxSize)throw new Error(`Max index must be < array size (${n}  vs. ${this.maxSize})`);this.writeMany(e,Kb(t,0))}split(e,t){if(t.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${t.dtype}`);let n=0;const r=e.map((e=>(n+=e,n)));if(n!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to\n          tensor.shape[0], but sum of lengths is\n        ${n}, and tensor's shape is: ${t.shape}`);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${e.length}), and the TensorArray is not marked as dynamically resizeable`);const a=0===n?0:t.size/n,s=[];lp((()=>{t=Hf(t,[1,n,a]);for(let n=0;n<e.length;++n){const i=[0,0===n?0:r[n-1],0],o=[1,e[n],a];s[n]=Hf(Kf(t,i,o),this.elementShape)}return s}));const i=[];for(let o=0;o<e.length;o++)i[o]=o;this.writeMany(i,s)}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class ON{get id(){return this.idTensor.id}constructor(e,t,n,r=-1){this.tensors=e,this.elementShape=t,this.elementDtype=n,null!=e&&e.forEach((e=>{if(n!==e.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${e.dtype}`);TN(t,e.shape,"TensorList shape mismatch: "),cp(e)})),this.idTensor=ng(0),this.maxNumElements=r,cp(this.idTensor)}copy(){return new ON([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(e){this.tensors.forEach((t=>{null!=e&&e.has(t.id)||t.dispose()})),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(e,t,n=-1){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(-1!==n&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);TN(e,this.elementShape,"TensorList shape mismatch: ");const r=EN(this.elementShape,this.tensors,e);return lp((()=>{const e=this.tensors.map((e=>Hf(e,r)));return Rb(e,0)}))}popBack(e,t){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);if(0===this.size())throw new Error("Trying to pop from an empty list.");const n=EN(this.elementShape,this.tensors,e),r=this.tensors.pop();return r.kept=!1,TN(r.shape,e,"TensorList shape mismatch: "),Hf(r,n)}pushBack(e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(TN(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");cp(e),this.tensors.push(e)}resize(e){if(e<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${e}`);if(-1!==this.maxNumElements&&e>this.maxNumElements)throw new Error(`TensorListResize input size ${e} is greater maxNumElement ${this.maxNumElements}.`);const t=new ON([],this.elementShape,this.elementDtype,this.maxNumElements);t.tensors.length=e;for(let n=0;n<Math.min(this.tensors.length,e);++n)t.tensors[n]=this.tensors[n];return t}getItem(e,t,n){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(e<0||e>this.tensors.length)throw new Error(`Trying to access element ${e} in a list with ${this.tensors.length} elements.`);if(null==this.tensors[e])throw new Error(`element at index ${e} is null.`);TN(this.tensors[e].shape,t,"TensorList shape mismatch: ");const r=EN(this.elementShape,this.tensors,t);return Hf(this.tensors[e],r)}setItem(e,t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(e<0||-1!==this.maxNumElements&&e>=this.maxNumElements)throw new Error(`Trying to set element ${e} in a list with max ${this.maxNumElements} elements.`);TN(this.elementShape,t.shape,"TensorList shape mismatch: "),cp(t),null!=this.tensors[e]&&(this.tensors[e].kept=!1),this.tensors[e]=t}gather(e,t,n){if(t!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t}, but list elements ${this.elementDtype}`);TN(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());const r=EN(this.elementShape,this.tensors,n);return 0===e.length?rp([],[0].concat(r)):lp((()=>{const t=e.map((e=>Hf(this.tensors[e],r)));return Rb(t,0)}))}concat(e,t){if(e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);TN(this.elementShape,t,"TensorList shape mismatch: ");const n=EN(this.elementShape,this.tensors,t);return 0===this.size()?rp([],[0].concat(n)):lp((()=>{const e=this.tensors.map((e=>Hf(e,n)));return Qf(e,0)}))}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const FN=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{const r=BT("thenBranch",e,t,n),a=BT("elseBranch",e,t,n),s=BT("cond",e,t,n),i=BT("args",e,t,n);return(await s.data())[0]?n.functionMap[r].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap):n.functionMap[a].executeFunctionAsync(i,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{const r=BT("body",e,t,n),a=BT("cond",e,t,n),s=BT("args",e,t,n),i=await n.functionMap[a].executeFunctionAsync(s,n.tensorArrayMap,n.tensorListMap),o=s.map((e=>e.id));let l=await i[0].data();i.forEach((e=>{e.kept||-1!==o.indexOf(e.id)||e.dispose()}));let u=s;for(;l[0];){const e=u;u=await n.functionMap[r].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);const t=u.map((e=>e.id));e.forEach((e=>{e.kept||-1!==o.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()}));const s=await n.functionMap[a].executeFunctionAsync(u,n.tensorArrayMap,n.tensorListMap);l=await s[0].data(),s.forEach((e=>{e.kept||-1!==o.indexOf(e.id)||-1!==t.indexOf(e.id)||e.dispose()}))}return u}case"LoopCond":return[jT(BT("pred",e,t,n))];case"Switch":{const r=BT("pred",e,t,n);let a=BT("data",e,t,n);return a.kept||(a=jT(a)),(await r.data())[0]?[void 0,a]:[a,void 0]}case"Merge":{const r=e.inputNames.find((e=>void 0!==PT(e,t,n)));if(r){return[jT(PT(r,t,n))]}return}case"Enter":{const r=BT("frameName",e,t,n),a=BT("tensor",e,t,n);return n.enterFrame(r),[jT(a)]}case"Exit":{const r=BT("tensor",e,t,n);return n.exitFrame(),[jT(r)]}case"NextIteration":{const r=BT("tensor",e,t,n);return n.nextIteration(),[jT(r)]}case"TensorArrayV3":{const r=BT("size",e,t,n),a=BT("dtype",e,t,n),s=BT("elementShape",e,t,n),i=BT("dynamicSize",e,t,n),o=BT("clearAfterRead",e,t,n),l=BT("identicalElementShapes",e,t,n),u=BT("name",e,t,n),c=new $N(u,a,r,s,l,i,o);return n.addTensorArray(c),[c.idTensor,ng(1)]}case"TensorArrayWriteV3":{const r=BT("tensorArrayId",e,t,n),a=BT("index",e,t,n),s=BT("tensor",e,t,n),i=n.getTensorArray(r.id);return i.write(a,s),[i.idTensor]}case"TensorArrayReadV3":{const r=BT("tensorArrayId",e,t,n),a=BT("index",e,t,n);return[n.getTensorArray(r.id).read(a)]}case"TensorArrayGatherV3":{const r=BT("tensorArrayId",e,t,n),a=BT("indices",e,t,n),s=BT("dtype",e,t,n);return[n.getTensorArray(r.id).gather(a,s)]}case"TensorArrayScatterV3":{const r=BT("tensorArrayId",e,t,n),a=BT("indices",e,t,n),s=BT("tensor",e,t,n),i=n.getTensorArray(r.id);return i.scatter(a,s),[i.idTensor]}case"TensorArrayConcatV3":{const r=BT("tensorArrayId",e,t,n),a=n.getTensorArray(r.id),s=BT("dtype",e,t,n);return[a.concat(s)]}case"TensorArraySplitV3":{const r=BT("tensorArrayId",e,t,n),a=BT("tensor",e,t,n),s=BT("lengths",e,t,n),i=n.getTensorArray(r.id);return i.split(s,a),[i.idTensor]}case"TensorArraySizeV3":{const r=BT("tensorArrayId",e,t,n);return[ng(n.getTensorArray(r.id).size(),"int32")]}case"TensorArrayCloseV3":{const r=BT("tensorArrayId",e,t,n),a=n.getTensorArray(r.id);return a.clearAndClose(),[a.idTensor]}case"TensorListSetItem":{const r=BT("tensorListId",e,t,n),a=BT("index",e,t,n),s=BT("tensor",e,t,n),i=n.getTensorList(r.id);return i.setItem(a,s),[i.idTensor]}case"TensorListGetItem":{const r=BT("tensorListId",e,t,n),a=BT("index",e,t,n),s=BT("elementShape",e,t,n),i=BT("elementDType",e,t,n);return[n.getTensorList(r.id).getItem(a,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{const r=BT("indices",e,t,n),a=function(e,t,n,r){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);const a=Math.max(...t);if(null!=r&&-1!==r&&a>=r)throw new Error(`Max index must be < array size (${a}  vs. ${r})`);const s=new ON([],n,e.dtype,r),i=Kb(e,0);return t.forEach(((e,t)=>{s.setItem(e,i[t])})),s}(BT("tensor",e,t,n),r,BT("elementShape",e,t,n),BT("numElements",e,t,n));return n.addTensorList(a),[a.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const r=BT("elementShape",e,t,n),a=BT("elementDType",e,t,n);let s;s="TensorListReserve"===e.op?"numElements":"maxNumElements";const i=BT(s,e,t,n),o=function(e,t,n,r){return new ON([],e,t,r)}(r,a,0,"TensorListReserve"===e.op?-1:i);return n.addTensorList(o),[o.idTensor]}case"TensorListGather":{const r=BT("tensorListId",e,t,n),a=BT("indices",e,t,n),s=BT("elementShape",e,t,n),i=BT("elementDType",e,t,n);return[n.getTensorList(r.id).gather(a,i,s)]}case"TensorListStack":{const r=BT("tensorListId",e,t,n),a=BT("elementShape",e,t,n),s=BT("elementDType",e,t,n),i=BT("numElements",e,t,n);return[n.getTensorList(r.id).stack(a,s,i)]}case"TensorListFromTensor":{const r=function(e,t,n){const r=e.dtype;if(e.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${e.shape}`);if(e.dtype!==n)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${n}`);TN(e.shape.slice(1),t,"TensorList shape mismatch: ");const a=Kb(e);return new ON(a,t,r)}(BT("tensor",e,t,n),BT("elementShape",e,t,n),BT("elementDType",e,t,n));return n.addTensorList(r),[r.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{const r=BT("tensorListId",e,t,n),a=n.getTensorList(r.id),s=BT("dtype",e,t,n),i=BT("elementShape",e,t,n);return[a.concat(s,i)]}case"TensorListPushBack":{const r=BT("tensorListId",e,t,n),a=BT("tensor",e,t,n),s=n.getTensorList(r.id);return s.pushBack(a),[s.idTensor]}case"TensorListPopBack":{const r=BT("tensorListId",e,t,n),a=BT("elementShape",e,t,n),s=BT("elementDType",e,t,n);return[n.getTensorList(r.id).popBack(a,s)]}case"TensorListSplit":{const r=BT("tensor",e,t,n),a=BT("elementShape",e,t,n),s=function(e,t,n){let r=0;const a=t.map((e=>(r+=e,r)));if(r!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to\n          tensor.shape[0], but sum of lengths is\n        ${r}, and tensor's shape is: ${e.shape}`);const s=RN(e.shape.slice(1),n),i=0===r?0:e.size/r,o=lp((()=>{const n=[];e=Hf(e,[1,r,i]);for(let r=0;r<t.length;++r){const o=[0,0===r?0:a[r-1],0],l=[1,t[r],i];n[r]=Hf(Kf(e,o,l),s)}return e.dispose(),n})),l=new ON([],n,e.dtype,t.length);for(let u=0;u<o.length;u++)l.setItem(u,o[u]);return l}(r,BT("lengths",e,t,n),a);return n.addTensorList(s),[s.idTensor]}case"TensorListLength":{const r=BT("tensorListId",e,t,n);return[ng(n.getTensorList(r.id).size(),"int32")]}case"TensorListResize":{const r=BT("tensorListId",e,t,n),a=BT("size",e,t,n),s=n.getTensorList(r.id).resize(a);return n.addTensorList(s),[s.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function DN(e,t,n){const[r,a]=BT("fusedOps",e,t,n),s="biasadd"===r,i=!s,o="prelu"===a,l="fusedbatchnorm"===r,u=BT("numArgs",e,t,n);if(s){if(o&&2!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!o&&s&&1!==u)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(l)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");const c=BT("strides",e,t,n),d=HT(e,t,n),h=BT("dataFormat",e,t,n).toUpperCase(),p=BT("dilations",e,t,n);let[f,m]=BT("args",e,t,n);i&&(m=f,f=void 0);return{stride:c,pad:d,dataFormat:h,dilations:p,biasArg:f,preluArg:m,activationFunc:a,leakyreluAlpha:BT("leakyreluAlpha",e,t,n)}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function MN(e,t,n){return{boxes:BT("boxes",e,t,n),scores:BT("scores",e,t,n),maxOutputSize:BT("maxOutputSize",e,t,n),iouThreshold:BT("iouThreshold",e,t,n),scoreThreshold:BT("scoreThreshold",e,t,n),softNmsSigma:BT("softNmsSigma",e,t,n)}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class LN{get id(){return this.handle.id}constructor(e,t){this.keyDType=e,this.valueDType=t,this.handle=ng(0),this.tensorMap=new Map,cp(this.handle)}clearAndClose(){this.tensorMap.forEach((e=>e.dispose())),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return ng(this.size(),"int32")}async import(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return this.tensorMap.forEach((e=>e.dispose())),this.tensorMap.clear(),lp((()=>{const e=Kb(t),r=n.length,a=e.length;Xi(r===a,(()=>`The number of elements doesn't match, keys has ${r} elements, the values has ${a} elements.`));for(let t=0;t<r;t++){const r=n[t],a=e[t];cp(a),this.tensorMap.set(r,a)}return this.handle}))}async find(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return lp((()=>{const e=[];for(let r=0;r<n.length;r++){const a=n[r],s=this.findWithDefault(a,t);e.push(s)}return Rb(e)}))}findWithDefault(e,t){const n=this.tensorMap.get(e);return null!=n?n:t}checkKeyAndValueTensor(e,t){if(e.dtype!==this.keyDType)throw new Error(`Expect key dtype ${this.keyDType}, but got ${e.dtype}`);if(t.dtype!==this.valueDType)throw new Error(`Expect value dtype ${this.valueDType}, but got ${t.dtype}`)}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function BN(e,t,n,r,a=lp){const s=((e,t,n)=>{switch(e.category){case"arithmetic":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[r.add(BT("a",e,t,n),BT("b",e,t,n))];case"AddN":return[r.addN(BT("tensors",e,t,n))];case"FloorMod":case"Mod":return[r.mod(BT("a",e,t,n),BT("b",e,t,n))];case"Mul":return[r.mul(BT("a",e,t,n),BT("b",e,t,n))];case"RealDiv":case"Div":return[r.div(BT("a",e,t,n),BT("b",e,t,n))];case"DivNoNan":return[r.divNoNan(BT("a",e,t,n),BT("b",e,t,n))];case"FloorDiv":return[r.floorDiv(BT("a",e,t,n),BT("b",e,t,n))];case"Sub":return[r.sub(BT("a",e,t,n),BT("b",e,t,n))];case"Minimum":return[r.minimum(BT("a",e,t,n),BT("b",e,t,n))];case"Maximum":return[r.maximum(BT("a",e,t,n),BT("b",e,t,n))];case"Pow":return[r.pow(BT("a",e,t,n),BT("b",e,t,n))];case"SquaredDifference":return[r.squaredDifference(BT("a",e,t,n),BT("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"basic_math":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"Abs":case"ComplexAbs":return[r.abs(BT("x",e,t,n))];case"Acos":return[r.acos(BT("x",e,t,n))];case"Acosh":return[r.acosh(BT("x",e,t,n))];case"Asin":return[r.asin(BT("x",e,t,n))];case"Asinh":return[r.asinh(BT("x",e,t,n))];case"Atan":return[r.atan(BT("x",e,t,n))];case"Atan2":return[r.atan2(BT("x",e,t,n),BT("y",e,t,n))];case"Atanh":return[r.atanh(BT("x",e,t,n))];case"Ceil":return[r.ceil(BT("x",e,t,n))];case"Complex":return[r.complex(BT("real",e,t,n),BT("imag",e,t,n))];case"Cos":return[r.cos(BT("x",e,t,n))];case"Cosh":return[r.cosh(BT("x",e,t,n))];case"Elu":return[r.elu(BT("x",e,t,n))];case"Erf":return[r.erf(BT("x",e,t,n))];case"Exp":return[r.exp(BT("x",e,t,n))];case"Expm1":return[r.expm1(BT("x",e,t,n))];case"Floor":return[r.floor(BT("x",e,t,n))];case"Log":return[r.log(BT("x",e,t,n))];case"Log1p":return[r.log1p(BT("x",e,t,n))];case"Imag":return[r.imag(BT("x",e,t,n))];case"Neg":return[r.neg(BT("x",e,t,n))];case"Reciprocal":return[r.reciprocal(BT("x",e,t,n))];case"Real":return[r.real(BT("x",e,t,n))];case"Relu":return[r.relu(BT("x",e,t,n))];case"Round":return[r.round(BT("x",e,t,n))];case"Selu":return[r.selu(BT("x",e,t,n))];case"Sigmoid":return[r.sigmoid(BT("x",e,t,n))];case"Sin":return[r.sin(BT("x",e,t,n))];case"Sign":return[r.sign(BT("x",e,t,n))];case"Sinh":return[r.sinh(BT("x",e,t,n))];case"Softplus":return[r.softplus(BT("x",e,t,n))];case"Sqrt":return[r.sqrt(BT("x",e,t,n))];case"Square":return[r.square(BT("x",e,t,n))];case"Tanh":return[r.tanh(BT("x",e,t,n))];case"Tan":return[r.tan(BT("x",e,t,n))];case"ClipByValue":return[r.clipByValue(BT("x",e,t,n),BT("clipValueMin",e,t,n),BT("clipValueMax",e,t,n))];case"Relu6":return[r.relu6(BT("x",e,t,n))];case"Rsqrt":return[r.rsqrt(PT(e.inputNames[0],t,n))];case"LeakyRelu":return[r.leakyRelu(BT("x",e,t,n),BT("alpha",e,t,n))];case"Prelu":return[r.prelu(BT("x",e,t,n),BT("alpha",e,t,n))];case"IsNan":return[r.isNaN(PT(e.inputNames[0],t,n))];case"IsInf":return[r.isInf(PT(e.inputNames[0],t,n))];case"IsFinite":return[r.isFinite(PT(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"control":return FN(e,t,n);case"convolution":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"Conv1D":{const a=BT("stride",e,t,n),s=BT("pad",e,t,n),i=BT("dataFormat",e,t,n).toUpperCase(),o=BT("dilation",e,t,n);return[r.conv1d(BT("x",e,t,n),BT("filter",e,t,n),a,s,i,o)]}case"Conv2D":{const a=BT("strides",e,t,n),s=HT(e,t,n),i=BT("dataFormat",e,t,n).toUpperCase(),o=BT("dilations",e,t,n);return[r.conv2d(BT("x",e,t,n),BT("filter",e,t,n),[a[1],a[2]],s,i,[o[1],o[2]])]}case"_FusedConv2D":{const{stride:a,pad:s,dataFormat:i,dilations:o,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=DN(e,t,n);return[r.fused.conv2d({x:BT("x",e,t,n),filter:BT("filter",e,t,n),strides:[a[1],a[2]],pad:s,dataFormat:i,dilations:[o[1],o[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"FusedDepthwiseConv2dNative":{const{stride:a,pad:s,dataFormat:i,dilations:o,biasArg:l,preluArg:u,activationFunc:c,leakyreluAlpha:d}=DN(e,t,n);return[r.fused.depthwiseConv2d({x:BT("x",e,t,n),filter:BT("filter",e,t,n),strides:[a[1],a[2]],pad:s,dataFormat:i,dilations:[o[1],o[2]],bias:l,activation:c,preluActivationWeights:u,leakyreluAlpha:d})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{const a=BT("outputShape",e,t,n),s=BT("strides",e,t,n),i=HT(e,t,n);return[r.conv2dTranspose(BT("x",e,t,n),BT("filter",e,t,n),a,[s[1],s[2]],i)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const a=BT("strides",e,t,n),s=HT(e,t,n),i=BT("dilations",e,t,n),o=BT("dataFormat",e,t,n).toUpperCase();return[r.depthwiseConv2d(BT("input",e,t,n),BT("filter",e,t,n),[a[1],a[2]],s,o,[i[1],i[2]])]}case"Conv3D":{const a=BT("strides",e,t,n),s=BT("pad",e,t,n),i=BT("dataFormat",e,t,n).toUpperCase(),o=BT("dilations",e,t,n);return[r.conv3d(BT("x",e,t,n),BT("filter",e,t,n),[a[1],a[2],a[3]],s,i,[o[1],o[2],o[3]])]}case"AvgPool":{const a=BT("strides",e,t,n),s=BT("pad",e,t,n),i=BT("kernelSize",e,t,n);return[r.avgPool(BT("x",e,t,n),[i[1],i[2]],[a[1],a[2]],s)]}case"MaxPool":{const a=BT("strides",e,t,n),s=BT("pad",e,t,n),i=BT("kernelSize",e,t,n);return[r.maxPool(BT("x",e,t,n),[i[1],i[2]],[a[1],a[2]],s)]}case"MaxPoolWithArgmax":{const a=BT("strides",e,t,n),s=BT("pad",e,t,n),i=BT("kernelSize",e,t,n),o=BT("includeBatchInIndex",e,t,n),{result:l,indexes:u}=r.maxPoolWithArgmax(BT("x",e,t,n),[i[1],i[2]],[a[1],a[2]],s,o);return[l,u]}case"AvgPool3D":{const a=BT("strides",e,t,n),s=BT("pad",e,t,n),i=BT("kernelSize",e,t,n);return[r.avgPool3d(BT("x",e,t,n),[i[1],i[2],i[3]],[a[1],a[2],a[3]],s)]}case"MaxPool3D":{const a=BT("strides",e,t,n),s=BT("pad",e,t,n),i=BT("kernelSize",e,t,n);return[r.maxPool3d(BT("x",e,t,n),[i[1],i[2],i[3]],[a[1],a[2],a[3]],s)]}case"Dilation2D":{const a=BT("strides",e,t,n),s=BT("pad",e,t,n),i=BT("dilations",e,t,n),o=a[1],l=a[2],u=i[1],c=i[2];return[r.dilation2d(BT("x",e,t,n),BT("filter",e,t,n),[o,l],s,[u,c],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"creation":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"Fill":{const a=BT("shape",e,t,n),s=BT("dtype",e,t,n),i=BT("value",e,t,n);return[r.fill(a,i,s)]}case"LinSpace":{const a=BT("start",e,t,n),s=BT("stop",e,t,n),i=BT("num",e,t,n);return[r.linspace(a,s,i)]}case"Multinomial":{const a=BT("logits",e,t,n),s=BT("numSamples",e,t,n),i=BT("seed",e,t,n);return[r.multinomial(a,s,i)]}case"OneHot":{const a=BT("indices",e,t,n),s=BT("depth",e,t,n),i=BT("onValue",e,t,n),o=BT("offValue",e,t,n),l=BT("dtype",e,t,n);return[r.oneHot(a,s,i,o,l)]}case"Ones":return[r.ones(BT("shape",e,t,n),BT("dtype",e,t,n))];case"OnesLike":return[r.onesLike(BT("x",e,t,n))];case"RandomStandardNormal":return[r.randomStandardNormal(BT("shape",e,t,n),BT("dtype",e,t,n),BT("seed",e,t,n))];case"RandomUniform":return[r.randomUniform(BT("shape",e,t,n),BT("minval",e,t,n),BT("maxval",e,t,n),BT("dtype",e,t,n))];case"RandomUniformInt":return[r.randomUniformInt(BT("shape",e,t,n),BT("minval",e,t,n),BT("maxval",e,t,n),BT("seed",e,t,n))];case"Range":{const a=BT("start",e,t,n),s=BT("stop",e,t,n),i=BT("step",e,t,n);return[r.range(a,s,i,BT("dtype",e,t,n))]}case"TruncatedNormal":{const a=BT("shape",e,t,n),s=BT("mean",e,t,n),i=BT("stdDev",e,t,n),o=BT("seed",e,t,n);return[r.truncatedNormal(a,s,i,BT("dtype",e,t,n),o)]}case"Zeros":return[r.zeros(BT("shape",e,t,n),BT("dtype",e,t,n))];case"ZerosLike":return[r.zerosLike(BT("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"dynamic":return(async(e,t,n,r,a=_N)=>{switch(e.op){case"NonMaxSuppressionV5":{const{boxes:r,scores:s,maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:u}=MN(e,t,n),c=await a.image.nonMaxSuppressionWithScoreAsync(r,s,i,o,l,u);return[c.selectedIndices,c.selectedScores]}case"NonMaxSuppressionV4":{const{boxes:r,scores:s,maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=MN(e,t,n),u=BT("padToMaxOutputSize",e,t,n),c=await a.image.nonMaxSuppressionPaddedAsync(r,s,i,o,l,u);return[c.selectedIndices,c.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{const{boxes:r,scores:s,maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=MN(e,t,n);return[await a.image.nonMaxSuppressionAsync(r,s,i,o,l)]}case"Where":{const r=a.cast(BT("condition",e,t,n),"bool"),s=[await a.whereAsync(r)];return r.dispose(),s}case"ListDiff":return a.setdiff1dAsync(BT("x",e,t,n),BT("y",e,t,n));default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n);case"evaluation":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"LowerBound":{const a=BT("sortedSequence",e,t,n),s=BT("values",e,t,n);return[r.lowerBound(a,s)]}case"TopKV2":{const a=BT("x",e,t,n),s=BT("k",e,t,n),i=BT("sorted",e,t,n),o=r.topk(a,s,i);return[o.values,o.indices]}case"UpperBound":{const a=BT("sortedSequence",e,t,n),s=BT("values",e,t,n);return[r.upperBound(a,s)]}case"Unique":{const a=BT("x",e,t,n),s=r.unique(a);return[s.values,s.indices]}case"UniqueV2":{const a=BT("x",e,t,n),s=BT("axis",e,t,n),i=r.unique(a,s);return[i.values,i.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"image":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"ResizeBilinear":{const a=BT("images",e,t,n),s=BT("size",e,t,n),i=BT("alignCorners",e,t,n),o=BT("halfPixelCenters",e,t,n);return[r.image.resizeBilinear(a,[s[0],s[1]],i,o)]}case"ResizeNearestNeighbor":{const a=BT("images",e,t,n),s=BT("size",e,t,n),i=BT("alignCorners",e,t,n),o=BT("halfPixelCenters",e,t,n);return[r.image.resizeNearestNeighbor(a,[s[0],s[1]],i,o)]}case"CropAndResize":{const a=BT("image",e,t,n),s=BT("boxes",e,t,n),i=BT("boxInd",e,t,n),o=BT("cropSize",e,t,n),l=BT("method",e,t,n),u=BT("extrapolationValue",e,t,n);return[r.image.cropAndResize(a,s,i,o,l,u)]}case"ImageProjectiveTransformV3":{const a=BT("images",e,t,n),s=BT("transforms",e,t,n),i=BT("outputShape",e,t,n),o=BT("fillValue",e,t,n),l=BT("interpolation",e,t,n),u=BT("fillMode",e,t,n);return[r.image.transform(a,s,l.toLowerCase(),u.toLowerCase(),o,i)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"graph":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":const a=BT("default",e,t,n);return[PT(e.name,t,n)||a];case"Placeholder":return[PT(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":case"Snapshot":return[jT(BT("x",e,t,n))];case"IdentityN":return BT("x",e,t,n).map((e=>jT(e)));case"Shape":return[r.tensor1d(BT("x",e,t,n).shape,"int32")];case"ShapeN":return BT("x",e,t,n).map((e=>r.tensor1d(e.shape)));case"Size":return[r.scalar(BT("x",e,t,n).size,"int32")];case"Rank":return[r.scalar(BT("x",e,t,n).rank,"int32")];case"NoOp":return[r.scalar(1)];case"Print":const s=BT("x",e,t,n),i=BT("data",e,t,n);BT("message",e,t,n),BT("summarize",e,t,n);for(let e=0;e<i.length;e++);return[s];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"logical":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"Equal":return[r.equal(BT("a",e,t,n),BT("b",e,t,n))];case"NotEqual":return[r.notEqual(BT("a",e,t,n),BT("b",e,t,n))];case"Greater":return[r.greater(BT("a",e,t,n),BT("b",e,t,n))];case"GreaterEqual":return[r.greaterEqual(BT("a",e,t,n),BT("b",e,t,n))];case"Less":return[r.less(BT("a",e,t,n),BT("b",e,t,n))];case"LessEqual":return[r.lessEqual(BT("a",e,t,n),BT("b",e,t,n))];case"LogicalAnd":return[r.logicalAnd(BT("a",e,t,n),BT("b",e,t,n))];case"LogicalNot":return[r.logicalNot(BT("a",e,t,n))];case"LogicalOr":return[r.logicalOr(BT("a",e,t,n),BT("b",e,t,n))];case"Select":case"SelectV2":return[r.where(BT("condition",e,t,n),BT("a",e,t,n),BT("b",e,t,n))];case"BitwiseAnd":return[r.bitwiseAnd(BT("a",e,t,n),BT("b",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"matrices":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[r.matMul(BT("a",e,t,n),BT("b",e,t,n),BT("transposeA",e,t,n),BT("transposeB",e,t,n))];case"Einsum":return[r.einsum(BT("equation",e,t,n),...BT("tensors",e,t,n))];case"Transpose":return[r.transpose(BT("x",e,t,n),BT("perm",e,t,n))];case"_FusedMatMul":const[a,s]=BT("fusedOps",e,t,n),i="biasadd"===a,o="prelu"===s,l=BT("numArgs",e,t,n),u=BT("leakyreluAlpha",e,t,n);if(i){if(o&&2!==l)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!o&&1!==l)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}const[c,d]=BT("args",e,t,n);return[r.fused.matMul({a:BT("a",e,t,n),b:BT("b",e,t,n),transposeA:BT("transposeA",e,t,n),transposeB:BT("transposeB",e,t,n),bias:c,activation:s,preluActivationWeights:d,leakyreluAlpha:u})];case"MatrixBandPart":return[r.linalg.bandPart(BT("a",e,t,n),BT("numLower",e,t,n),BT("numUpper",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"normalization":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"EuclideanNorm":return[r.euclideanNorm(BT("x",e,t,n),BT("axis",e,t,n),BT("keepDims",e,t,n))];case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[r.batchNorm(BT("x",e,t,n),BT("mean",e,t,n),BT("variance",e,t,n),BT("offset",e,t,n),BT("scale",e,t,n),BT("epsilon",e,t,n))];case"LRN":return[r.localResponseNormalization(BT("x",e,t,n),BT("radius",e,t,n),BT("bias",e,t,n),BT("alpha",e,t,n),BT("beta",e,t,n))];case"Softmax":return[r.softmax(BT("x",e,t,n))];case"LogSoftmax":return[r.logSoftmax(BT("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"ragged":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"RaggedGather":{const{outputNestedSplits:a,outputDenseValues:s}=r.raggedGather(BT("paramsNestedSplits",e,t,n),BT("paramsDenseValues",e,t,n),BT("indices",e,t,n),BT("outputRaggedRank",e,t,n));return a.concat(s)}case"RaggedRange":{const{rtNestedSplits:a,rtDenseValues:s}=r.raggedRange(BT("starts",e,t,n),BT("limits",e,t,n),BT("splits",e,t,n));return[a,s]}case"RaggedTensorToTensor":return[r.raggedTensorToTensor(BT("shape",e,t,n),BT("values",e,t,n),BT("defaultValue",e,t,n),BT("rowPartitionTensors",e,t,n),BT("rowPartitionTypes",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"reduction":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"Max":{const a=BT("axis",e,t,n),s=BT("keepDims",e,t,n);return[r.max(BT("x",e,t,n),a,s)]}case"Mean":{const a=BT("axis",e,t,n),s=BT("keepDims",e,t,n);return[r.mean(BT("x",e,t,n),a,s)]}case"Min":{const a=BT("axis",e,t,n),s=BT("keepDims",e,t,n);return[r.min(BT("x",e,t,n),a,s)]}case"Sum":{const a=BT("axis",e,t,n),s=BT("keepDims",e,t,n);return[r.sum(BT("x",e,t,n),a,s)]}case"All":{const a=BT("axis",e,t,n),s=BT("keepDims",e,t,n);return[r.all(BT("x",e,t,n),a,s)]}case"Any":{const a=BT("axis",e,t,n),s=BT("keepDims",e,t,n);return[r.any(BT("x",e,t,n),a,s)]}case"ArgMax":{const a=BT("axis",e,t,n);return[r.argMax(BT("x",e,t,n),a)]}case"ArgMin":{const a=BT("axis",e,t,n);return[r.argMin(BT("x",e,t,n),a)]}case"Prod":{const a=BT("axis",e,t,n),s=BT("keepDims",e,t,n);return[r.prod(BT("x",e,t,n),a,s)]}case"Cumprod":{const a=BT("axis",e,t,n),s=BT("exclusive",e,t,n),i=BT("reverse",e,t,n);return[r.cumprod(BT("x",e,t,n),a,s,i)]}case"Cumsum":{const a=BT("axis",e,t,n),s=BT("exclusive",e,t,n),i=BT("reverse",e,t,n);return[r.cumsum(BT("x",e,t,n),a,s,i)]}case"Bincount":const a=BT("x",e,t,n),s=BT("weights",e,t,n),i=BT("size",e,t,n);return[r.bincount(a,s,i)];case"DenseBincount":{const a=BT("x",e,t,n),s=BT("weights",e,t,n),i=BT("size",e,t,n),o=BT("binaryOutput",e,t,n);return[r.denseBincount(a,s,i,o)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"slice_join":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"ConcatV2":case"Concat":{const a=BT("n",e,t,n),s=BT("axis",e,t,n);let i=BT("tensors",e,t,n);return i=i.slice(0,a),[r.concat(i,s)]}case"Gather":{const a=BT("x",e,t,n),s=BT("indices",e,t,n);return[r.gather(a,r.cast(s,"int32"),0)]}case"GatherV2":{const a=BT("axis",e,t,n),s=BT("batchDims",e,t,n),i=BT("x",e,t,n),o=BT("indices",e,t,n);return[r.gather(i,r.cast(o,"int32"),a,s)]}case"Reverse":{const a=BT("dims",e,t,n),s=[];for(let e=0;e<a.length;e++)a[e]&&s.push(e);const i=BT("x",e,t,n);return[r.reverse(i,s)]}case"ReverseV2":{const a=BT("axis",e,t,n),s=BT("x",e,t,n);return[r.reverse(s,a)]}case"Slice":{const a=BT("begin",e,t,n),s=BT("size",e,t,n);return[r.slice(BT("x",e,t,n),a,s)]}case"StridedSlice":{const a=BT("begin",e,t,n),s=BT("end",e,t,n),i=BT("strides",e,t,n),o=BT("beginMask",e,t,n),l=BT("endMask",e,t,n),u=BT("ellipsisMask",e,t,n),c=BT("newAxisMask",e,t,n),d=BT("shrinkAxisMask",e,t,n),h=BT("x",e,t,n);return[r.stridedSlice(h,a,s,i,o,l,u,c,d)]}case"Pack":return lp((()=>{const a=BT("axis",e,t,n),s=BT("tensors",e,t,n),i=s[0].shape,o=r.squeeze(s[0]).shape,l=s.map((e=>{const t=eo(e.shape,i);if(!t&&!eo(r.squeeze(e).shape,o))throw new Error("the input tensors shape does not match");return t?e:r.reshape(e,i)}));return[r.stack(l,a)]}));case"Unpack":{const a=BT("axis",e,t,n),s=BT("tensor",e,t,n);return r.unstack(s,a)}case"Tile":{const a=BT("reps",e,t,n);return[r.tile(BT("x",e,t,n),a)]}case"Split":case"SplitV":{const a=BT("axis",e,t,n),s=BT("numOrSizeSplits",e,t,n),i=BT("x",e,t,n);return r.split(i,s,a)}case"ScatterNd":{const a=BT("indices",e,t,n),s=BT("values",e,t,n),i=BT("shape",e,t,n);return[r.scatterND(a,s,i)]}case"GatherNd":{const a=BT("x",e,t,n),s=BT("indices",e,t,n);return[r.gatherND(a,s)]}case"SparseToDense":{const a=BT("sparseIndices",e,t,n),s=BT("outputShape",e,t,n),i=BT("sparseValues",e,t,n),o=BT("defaultValue",e,t,n);return[r.sparseToDense(a,i,s,i.dtype===o.dtype?o:r.cast(o,i.dtype))]}case"TensorScatterUpdate":{const a=BT("indices",e,t,n),s=BT("values",e,t,n),i=BT("tensor",e,t,n);return[r.tensorScatterUpdate(i,a,s)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"sparse":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"SparseFillEmptyRows":{const{outputIndices:a,outputValues:s,emptyRowIndicator:i,reverseIndexMap:o}=r.sparse.sparseFillEmptyRows(BT("indices",e,t,n),BT("values",e,t,n),BT("denseShape",e,t,n),BT("defaultValue",e,t,n));return[a,s,i,o]}case"SparseReshape":{const{outputIndices:a,outputShape:s}=r.sparse.sparseReshape(BT("inputIndices",e,t,n),BT("inputShape",e,t,n),BT("newShape",e,t,n));return[a,s]}case"SparseSegmentMean":return[r.sparse.sparseSegmentMean(BT("data",e,t,n),BT("indices",e,t,n),BT("segmentIds",e,t,n))];case"SparseSegmentSum":return[r.sparse.sparseSegmentSum(BT("data",e,t,n),BT("indices",e,t,n),BT("segmentIds",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"spectral":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"FFT":return[r.fft(BT("x",e,t,n))];case"IFFT":return[r.ifft(BT("x",e,t,n))];case"RFFT":return[r.rfft(BT("x",e,t,n))];case"IRFFT":return[r.irfft(BT("x",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"string":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"StaticRegexReplace":return[r.string.staticRegexReplace(BT("input",e,t,n),BT("pattern",e,t,n),BT("rewrite",e,t,n),BT("replaceGlobal",e,t,n))];case"StringNGrams":{const{nGrams:a,nGramsSplits:s}=r.string.stringNGrams(BT("data",e,t,n),BT("dataSplits",e,t,n),BT("separator",e,t,n),BT("nGramWidths",e,t,n),BT("leftPad",e,t,n),BT("rightPad",e,t,n),BT("padWidth",e,t,n),BT("preserveShortSequences",e,t,n));return[a,s]}case"StringSplit":{const{indices:a,values:s,shape:i}=r.string.stringSplit(BT("input",e,t,n),BT("delimiter",e,t,n),BT("skipEmpty",e,t,n));return[a,s,i]}case"StringToHashBucketFast":return[r.string.stringToHashBucketFast(BT("input",e,t,n),BT("numBuckets",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"transformation":return a((()=>((e,t,n,r=_N)=>{switch(e.op){case"Cast":return[r.cast(BT("x",e,t,n),BT("dtype",e,t,n))];case"ExpandDims":{const a=BT("axis",e,t,n);return[r.expandDims(BT("x",e,t,n),a)]}case"Squeeze":{const a=BT("axis",e,t,n);return[r.squeeze(BT("x",e,t,n),a)]}case"Reshape":return[r.reshape(BT("x",e,t,n),BT("shape",e,t,n))];case"EnsureShape":return[r.ensureShape(BT("x",e,t,n),BT("shape",e,t,n))];case"MirrorPad":return[r.mirrorPad(BT("x",e,t,n),BT("padding",e,t,n),BT("mode",e,t,n))];case"PadV2":case"Pad":return[r.pad(BT("x",e,t,n),BT("padding",e,t,n),BT("constantValue",e,t,n))];case"SpaceToBatchND":{const a=BT("blockShape",e,t,n),s=BT("paddings",e,t,n);return[r.spaceToBatchND(BT("x",e,t,n),a,s)]}case"BatchToSpaceND":{const a=BT("blockShape",e,t,n),s=BT("crops",e,t,n);return[r.batchToSpaceND(BT("x",e,t,n),a,s)]}case"DepthToSpace":{const a=BT("blockSize",e,t,n),s=BT("dataFormat",e,t,n).toUpperCase();return[r.depthToSpace(BT("x",e,t,n),a,s)]}case"BroadcastTo":return[r.broadcastTo(BT("x",e,t,n),BT("shape",e,t,n))];case"BroadcastArgs":return[r.broadcastArgs(BT("s0",e,t,n),BT("s1",e,t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"hash_table":return(async(e,t,n,r)=>{switch(e.op){case"HashTable":case"HashTableV2":{const a=r.getHashTableHandleByName(e.name);if(null!=a)return[a];{const a=BT("keyDType",e,t,n),s=BT("valueDType",e,t,n),i=new LN(a,s);return r.addHashTable(e.name,i),[i.handle]}}case"InitializeTable":case"InitializeTableV2":case"LookupTableImport":case"LookupTableImportV2":{const a=BT("tableHandle",e,t,n,r),s=BT("keys",e,t,n),i=BT("values",e,t,n),o=r.getHashTableById(a.id);return[await o.import(s,i)]}case"LookupTableFind":case"LookupTableFindV2":{const a=BT("tableHandle",e,t,n,r),s=BT("keys",e,t,n),i=BT("defaultValue",e,t,n),o=r.getHashTableById(a.id);return[await o.find(s,i)]}case"LookupTableSize":case"LookupTableSizeV2":{const a=BT("tableHandle",e,t,n,r);return[r.getHashTableById(a.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n,r);case"custom":const s=LT(e.op);if(s&&s.customExecutor)return s.customExecutor(new WN(e,t,n));throw TypeError(`Custom op ${e.op} is not registered.`);default:throw TypeError(`Unknown op '${e.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(e,t,n);return Ro(s)?s.then((e=>[].concat(e))):[].concat(s)}class PN{constructor(e={},t={},n={},r={},a){this.weightMap=e,this.tensorArrayMap=t,this.tensorListMap=n,this.functionMap=r,this.parseNodeNameCache=a,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(e,t){return{id:e,frameName:t,iterationId:0}}set currentContext(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){const e=[];for(let t=0;t<this.contexts.length-1;t++){const n=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(n))}e.push(""),this._currentContextIds=e}contextIdforContexts(e){return e?e.map((e=>0===e.id&&0===e.iterationId?"":`${e.frameName}-${e.iterationId}`)).join("/"):""}enterFrame(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()}nextIteration(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");{this.contexts=this.contexts.slice(),this.lastId++;const e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}}getWeight(e){return this.weightMap[e]}addTensorArray(e){this.tensorArrayMap[e.id]=e}getTensorArray(e){return this.tensorArrayMap[e]}addTensorList(e){this.tensorListMap[e.id]=e}getTensorList(e){return this.tensorListMap[e]}dispose(e){for(const t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(const t in this.tensorListMap)this.tensorListMap[t].clearAndClose(e)}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function zN(e,t,n,r){const a=new Set,s=[];let i=null,o=null;const l=new Set,u=new Set(Object.keys(e).map((e=>UT(e)[0])));r=r||[];const c=new Set(r.map((e=>UT(e.name)[0]))),d=[...t];for(;d.length>0;){const e=d.pop();(qN(e)||QN(e)||XN(e))&&null==i&&(i=e,o=i.children.map((e=>e.name)).filter((e=>a.has(e)))),a.add(e.name),null==n[e.name]&&(u.has(e.name)||c.has(e.name)||(0!==e.inputs.length?e.inputs.forEach((e=>{l.has(e.name)||(l.add(e.name),d.push(e))})):s.push(e.name)))}return{inputs:e,outputs:t,usedNodes:a,missingInputs:s,dynamicNode:i,syncInputs:o}}function GN(e,t){const{usedNodes:n,inputs:r}=t,a=Object.keys(r).map((e=>UT(e)[0])).map((t=>e.nodes[t])),s=e.initNodes||[],i=e=>n.has("string"==typeof e?e:e.name);function o(e){return[...new Map(e.map((e=>[e.name,e]))).values()]}const l=o([...a,...e.weights,...s]).filter(i),u=o([...l,...Object.values(e.nodes)]).filter(i),c=new Map(u.map((e=>[e.name,e]))),d={};for(const m of u){d[m.name]=d[m.name]||0;for(const e of m.children)i(e)||(d[e.name]=Number.POSITIVE_INFINITY),d[e.name]=(d[e.name]||0)+1}const h=Object.entries(d).filter((([,e])=>0===e)).map((([e])=>e)),p=[...h];for(;h.length>0;){const e=h.pop(),t=c.get(e);for(const n of t.children.filter(i))0==--d[n.name]&&(p.push(n.name),h.push(n.name))}const f=function(e,t){const n=new Map(e.map((e=>[e.name,e]))),r=t.map((e=>e.name)),a=new Set(r);for(;r.length>0;){const e=r.pop(),t=n.get(e);for(const s of t.children)n.has(s.name)&&!a.has(s.name)&&(a.add(s.name),r.push(s.name))}const s=e.filter((e=>a.has(e.name)));return s}(p.map((e=>c.get(e))),l);return function(e,t){const n=new Map(e.map(((e,t)=>[e.name,t]))),r=new Set(t.map((e=>e.name))),a=e=>r.has("string"==typeof e?e:e.name),s=new Set(e.map((e=>e.name))),i=e=>s.has("string"==typeof e?e:e.name);for(const o of e){for(const e of o.children.filter(i)){if(!n.has(e.name))throw new VN(`Child ${e.name} of node ${o.name} is unreachable.`);if(n.get(o.name)>n.get(e.name))throw new VN(`Node ${o.name} is scheduled to run after its child ${e.name}.`)}if(!a(o))for(const e of o.inputs){if(!n.has(e.name))throw new VN(`Input ${e.name} of node ${o.name} is unreachable.`);if(n.get(e.name)>n.get(o.name))throw new VN(`Node ${o.name} is scheduled to run before its input ${e.name}.`)}}}(f,l),f}class VN extends Error{constructor(e){super(`NodesExecutionOrderError: ${e}`)}}const UN=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),HN=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),jN=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function qN(e){return UN.has(e.op)}function QN(e){return HN.has(e.op)}function XN(e){return jN.has(e.op)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class ZN{get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(e){const t=Object.keys(e).map((t=>e[t].map((e=>e.id))));this._weightIds=[].concat(...t),this._weightMap=e}set resourceManager(e){this._resourceManager=e}get inputs(){return this._inputs.map((e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0})))}get outputs(){return this._outputs.map((e=>({name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0})))}get inputNodes(){return this._inputs.map((e=>e.signatureKey||e.name))}get outputNodes(){return this._outputs.map((e=>{const t=e.signatureKey||e.name;return e.defaultOutput?`${t}:${e.defaultOutput}`:t}))}get functions(){return Object.keys(this._functions).reduce(((e,t)=>(e[t]=this._functions[t].signature,e)),{})}constructor(e,t){this.graph=e,this.parent=t,this.compiledMap=new Map,this.parseNodeNameCache=new Map,this._weightMap={},this.SEPARATOR=",",this._functions={},this._functionExecutorMap={},this.keepIntermediateTensors=!1,this._outputs=e.outputs,this._inputs=e.inputs,this._initNodes=e.initNodes,this._signature=e.signature,this._functions=e.functions,null!=e.functions&&Object.keys(e.functions).forEach((t=>{this._functionExecutorMap[t]=new ZN(e.functions[t],this)}))}getCompilationKey(e,t){const n=e.map((e=>e.name)).sort(),r=t.map((e=>e.name)).sort();return n.join(this.SEPARATOR)+"--"+r.join(this.SEPARATOR)}compile(e,t){const n=zN(e,t,this.weightMap,this._initNodes),{missingInputs:r,dynamicNode:a,syncInputs:s}=n;if(null!=a)throw new Error(`This execution contains the node '${a.name}', which has the dynamic op '${a.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${s}]`);if(r.length>0){const n=t.map((e=>e.name)),a=Object.keys(e);throw new Error(`Cannot compute the outputs [${n}] from the provided inputs [${a}]. Missing the following inputs: [${r}]`)}const i=GN(this.graph,n),o=function(e){const t=new Map(e.map(((e,t)=>[e.name,t]))),n=Number.MAX_SAFE_INTEGER,r=e.map(((e,t)=>qN(e)?n:t)),a=e=>{const n=r[t.get(e.name)];return null==n?-1:n},s=e.map(((e,t)=>e.children.map(a).reduce(((e,t)=>Math.max(e,t)),r[t]))),i=new Map;for(let o=0;o<e.length;++o){const t=s[o];if(t===n)continue;const r=e[o],a=e[t];i.has(a.name)||i.set(a.name,[]),i.get(a.name).push(r)}return i}(i);return{orderedNodes:i,nodeLiveUntilMap:o}}cloneAndKeepTensor(e){if(null==e)return null;const t=e.clone();return cp(t),t}cloneTensorList(e){if(!e)return null;return e.map((e=>this.cloneAndKeepTensor(e)))}cloneTensorMap(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,this.cloneTensorList(t)])))}execute(e,t){this.disposeIntermediateTensors(),e=this.mapInputs(e);const n=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);const r=n.map((e=>this.graph.nodes[UT(e)[0]])),a=t.map((e=>UT(e)[0])),s=new Set(a);let i=a.map((e=>this.graph.nodes[e]));0===i.length&&(i=this._outputs);const o=this.getCompilationKey(r,i);let l=this.compiledMap.get(o);null==l&&(l=this.compile(e,i),this.compiledMap.set(o,l));try{this.keepIntermediateTensors=Do().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(gQ){this.keepIntermediateTensors=!1}const u={},c={};return lp((()=>{const n=new PN(this.weightMap,u,c,this.functionExecutorMap,this.parseNodeNameCache),r=Object.assign({},this.weightMap);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap)),Object.keys(e).forEach((t=>{const[a,s]=UT(t,n),i=[];i[s]=e[t],r[a]=i,this.keepIntermediateTensors&&(this.clonedTensorsMap[a]=this.cloneTensorList(i))}));const a=this.getFrozenTensorIds(r),{orderedNodes:i,nodeLiveUntilMap:o}=l;for(const e of i){if(r[e.name])continue;const t=BN(e,r,n,this._resourceManager);if(Ro(t))throw new Error(`The execution of the op '${e.op}' returned a promise. Please use model.executeAsync() instead.`);r[e.name]=t,this.keepIntermediateTensors&&(this.clonedTensorsMap[e.name]=this.cloneTensorList(t)),this.checkTensorForDisposalWithNodeLiveUntilInfo(e,r,n,a,s,o.get(e.name))}return null==this.parent&&n.dispose(a),t.map((e=>PT(e,r,n)))}))}getFrozenTensorIds(e){const t=[].concat.apply([],Object.keys(e).map((t=>e[t])).map((e=>e.map((e=>e.id)))));return new Set(t)}checkTensorForDisposal(e,t,n,r,a,s,i){if(!qN(t)&&!s.has(e)){for(const r of n[e])null!=r&&(i[r.id]=(i[r.id]||0)+t.children.length);for(const e of t.inputs){if(qN(e))continue;const t=zT(e.name,n,r);if(null!=t)for(const e of t){if(!e||e.kept||a.has(e.id))continue;const t=i[e.id];1===t?(e.dispose(),delete i[e.id]):null!=t&&i[e.id]--}}}}checkTensorForDisposalWithNodeLiveUntilInfo(e,t,n,r,a,s){var i;if(!qN(e)&&null!=s)for(const o of s){if(qN(i=o)||a.has(i.name))continue;const e=zT(o.name,t,n);for(const t of e)!t||t.kept||r.has(t.id)||t.dispose()}}async executeAsync(e,t){return this._executeAsync(e,t)}disposeIntermediateTensors(){this.clonedTensorsMap&&(Object.values(this.clonedTensorsMap).forEach((e=>{for(const t of e)t&&!t.isDisposed&&t.dispose()})),this.clonedTensorsMap=null)}getIntermediateTensors(){return this.clonedTensorsMap}async _executeAsync(e,t,n=!1,r={},a={}){this.disposeIntermediateTensors(),n||(e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t));try{this.keepIntermediateTensors=Do().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(gQ){this.keepIntermediateTensors=!1}const s=new PN(this.weightMap,r,a,this.functionExecutorMap,this.parseNodeNameCache);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap));const i=await this.executeWithControlFlow(e,s,t,n),o=t.map((e=>PT(e,i,s))),l=o.map((e=>e.id)),u=Object.keys(e).map((t=>e[t].id)),c=new Set([...l,...u,...this.weightIds]);return Object.values(i).forEach((e=>{e.forEach((e=>{!e||e.isDisposed||c.has(e.id)||e.dispose()}))})),null==this.parent&&s.dispose(c),o}async executeFunctionAsync(e,t,n){const r=e.reduce(((e,t,n)=>(e[this.inputs[n].name]=t,e)),{});return this._executeAsync(r,this.outputNodes,!0,t,n)}async executeWithControlFlow(e,t,n,r){const a=Object.keys(e),s=a.map((e=>this.graph.nodes[UT(e)[0]])),i=n.map((e=>UT(e)[0])),o=new Set(i);let l=i.map((e=>this.graph.nodes[e]));0===l.length&&(l=this._outputs);const{usedNodes:u,missingInputs:c,dynamicNode:d,syncInputs:h}=zN(e,l,this.weightMap,this._initNodes),p=[...s,...this.graph.weights,...this._initNodes||[]].map((e=>({node:e,contexts:t.currentContext}))),f=Object.assign({},this.weightMap);Object.keys(e).forEach((t=>{const[n,r]=UT(t),a=[];a[r]=e[t],f[n]=a}));const m={},g=this.getFrozenTensorIds(f),y={};for(;p.length>0;){const e=this.processStack(s,p,t,f,y,g,o,m,u);await Promise.all(e)}const b=l.filter((e=>!qN(e)&&!PT(e.name,f,t))).map((e=>e.name));if(b.length>0){let e="";throw null!=d&&(e=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${h}]`),new Error(`Cannot compute the outputs [${b}] from the provided inputs [${a}]. Consider providing the following inputs: [${c}]. ${e}`)}return f}processStack(e,t,n,r,a,s,i,o,l){const u=[];for(;t.length>0;){const e=t.pop();n.currentContext=e.contexts;let c="";if("Enter"===e.node.op&&BT("isConstant",e.node,r,n)&&([c]=GT(e.node.name,n)),null==r[e.node.name]){const d=BN(e.node,r,n,this._resourceManager);c||([c]=GT(e.node.name,n));const h=n.currentContext;Ro(d)?u.push(d.then((u=>(r[c]=u,this.keepIntermediateTensors&&(this.clonedTensorsMap[c]=this.cloneTensorList(u)),n.currentContext=h,this.checkTensorForDisposal(c,e.node,r,n,s,i,o),this.processChildNodes(e.node,t,n,r,a,l),u)))):(r[c]=d,this.keepIntermediateTensors&&(this.clonedTensorsMap[c]=this.cloneTensorList(d)),this.checkTensorForDisposal(c,e.node,r,n,s,i,o),this.processChildNodes(e.node,t,n,r,a,l))}else this.processChildNodes(e.node,t,n,r,a,l)}return u}processChildNodes(e,t,n,r,a,s){e.children.forEach((e=>{const[i]=GT(e.name,n);!a[i]&&s.has(e.name)&&("Merge"===e.op?e.inputNames.some((e=>!!PT(e,r,n)))&&(a[i]=!0,t.push({contexts:n.currentContext,node:e})):e.inputNames.every((e=>!!PT(e,r,n)))&&(a[i]=!0,t.push({contexts:n.currentContext,node:e})))}))}dispose(){Object.keys(this.weightMap).forEach((e=>this.weightMap[e].forEach((e=>e.dispose()))))}checkInputShapeAndType(e){Object.keys(e).forEach((t=>{const n=e[t],[r]=UT(t),a=this.graph.nodes[r];if(a.attrParams.shape&&a.attrParams.shape.value){const e=a.attrParams.shape.value;Xi(e.length===n.shape.length&&n.shape.every(((t,n)=>-1===e[n]||e[n]===t)),(()=>`The shape of dict['${a.name}'] provided in model.execute(dict) must be [${e}], but was [${n.shape}]`))}a.attrParams.dtype&&a.attrParams.dtype.value&&Xi(n.dtype===a.attrParams.dtype.value,(()=>`The dtype of dict['${a.name}'] provided in model.execute(dict) must be ${a.attrParams.dtype.value}, but was ${n.dtype}`))}))}mapInputs(e){var t,n;const r={};for(const a in e){const s=null===(n=null===(t=this._signature)||void 0===t?void 0:t.inputs)||void 0===n?void 0:n[a];null!=s?r[s.name]=e[a]:r[a]=e[a]}return r}checkInputs(e){const t=Object.keys(e).filter((e=>{const[t]=UT(e);return null==this.graph.nodes[t]}));if(t.length>0)throw new Error(`The dict provided in model.execute(dict) has keys: [${t}] that are not part of graph`)}mapOutputs(e){return e.map((e=>{var t,n;const r=null===(n=null===(t=this._signature)||void 0===t?void 0:t.outputs)||void 0===n?void 0:n[e];return null!=r?r.name:e}),{})}checkOutputs(e){e.forEach((e=>{const[t]=UT(e);if(!this.graph.nodes[t])throw new Error(`The output '${e}' is not found in the graph`)}))}}class KN{constructor(e={},t={}){this.hashTableNameToHandle=e,this.hashTableMap=t}addHashTable(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}getHashTableHandleByName(e){return this.hashTableNameToHandle[e]}getHashTableById(e){return this.hashTableMap[e]}dispose(){for(const e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(const e in this.hashTableNameToHandle)this.hashTableNameToHandle[e].dispose(),delete this.hashTableNameToHandle[e]}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const JN="?tfjs-format=file",YN="model.json";class eE{get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}get modelStructuredOutputKeys(){return this.structuredOutputKeys}constructor(e,t={},n=XA){this.modelUrl=e,this.loadOptions=t,this.version="n/a",this.io=n,null==t&&(this.loadOptions={}),this.resourceManager=new KN}findIOHandler(){const e=this.modelUrl;if(null!=e.load)this.handler=e;else if(null!=this.loadOptions.requestInit)this.handler=this.io.browserHTTPRequest(e,this.loadOptions);else{const t=this.io.getLoadHandlers(e,this.loadOptions);if(0===t.length)t.push(this.io.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error(`Found more than one (${t.length}) load handlers for URL '${[e]}'`);this.handler=t[0]}}load(){if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const e=this.handler.load();return Ro(e)?e.then((e=>null==e.getWeightStream?this.loadSync(e):this.loadStreaming(e))):this.loadSync(e)}loadSync(e){const t=this.io.decodeWeights(e.weightData,e.weightSpecs);return this.loadWithWeightMap(e,t)}async loadStreaming(e){if(null==e.getWeightStream)throw new Error("Model artifacts missing streamWeights function");const t=await Ap(e.getWeightStream(),e.weightSpecs);return this.loadWithWeightMap(e,t)}loadWithWeightMap(e,t){this.artifacts=e;const n=this.artifacts.modelTopology;let r=this.artifacts.signature;if(null!=this.artifacts.userDefinedMetadata){const e=this.artifacts.userDefinedMetadata;null!=e.signature&&(r=e.signature),null!=e.structuredOutputKeys&&(this.structuredOutputKeys=e.structuredOutputKeys)}if(this.signature=r,this.version=`${n.versions.producer}.${n.versions.minConsumer}`,this.executor=new ZN(hN.Instance.transformGraph(n,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(t),this.executor.resourceManager=this.resourceManager,null!=e.modelInitializer&&null!=e.modelInitializer.node){const t=hN.Instance.transformGraph(e.modelInitializer);this.initializer=new ZN(t),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializerSignature=e.initializerSignature}return!0}async save(e,t){if("string"==typeof e){const t=this.io.getSaveHandlers(e);if(0===t.length)throw new Error(`Cannot find any save handlers for URL '${e}'`);if(t.length>1)throw new Error(`Found more than one (${t.length}) save handlers for URL '${e}'`);e=t[0]}if(null==e.save)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return e.save(this.artifacts)}addStructuredOutputNames(e){if(this.structuredOutputKeys){const t={};return(e instanceof fh?[e]:e).forEach(((e,n)=>t[this.structuredOutputKeys[n]]=e)),t}return e}predict(e,t){const n=this.execute(e,this.outputNodes);return this.addStructuredOutputNames(n)}async predictAsync(e,t){const n=await this.executeAsync(e,this.outputNodes);return this.addStructuredOutputNames(n)}normalizeInputs(e){var t;if(!(e instanceof fh||Array.isArray(e))){const n=null===(t=this.signature)||void 0===t?void 0:t.inputs;if(null!=n)for(const t in n){const r=n[t];null!=r.resourceId&&(e[t]=this.resourceIdToCapturedInput[r.resourceId])}return e}e=Array.isArray(e)?e:[e];const n=Object.keys(this.resourceIdToCapturedInput).length;if(e.length+n!==this.inputNodes.length)throw new Error(`Input tensor count mismatch, the graph model has ${this.inputNodes.length-n} non-resource placeholders, while there are ${e.length} input tensors provided.`);let r=0;return this.inputNodes.reduce(((t,n)=>{var a,s,i;const o=null===(i=null===(s=null===(a=this.signature)||void 0===a?void 0:a.inputs)||void 0===s?void 0:s[n])||void 0===i?void 0:i.resourceId;return t[n]=null!=o?this.resourceIdToCapturedInput[o]:e[r++],t}),{})}normalizeOutputs(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}executeInitializerGraph(){return null==this.initializer?[]:null==this.initializerSignature?this.initializer.execute({},[]):this.initializer.execute({},Object.keys(this.initializerSignature.outputs))}async executeInitializerGraphAsync(){return null==this.initializer?[]:null==this.initializerSignature?this.initializer.executeAsync({},[]):this.initializer.executeAsync({},Object.keys(this.initializerSignature.outputs))}setResourceIdToCapturedInput(e){if(this.resourceIdToCapturedInput={},this.initializerSignature){const t=this.initializerSignature.outputs,n=Object.keys(t);for(let r=0;r<n.length;r++){const a=t[n[r]];this.resourceIdToCapturedInput[a.resourceId]=e[r]}}}execute(e,t){null==this.resourceIdToCapturedInput&&this.setResourceIdToCapturedInput(this.executeInitializerGraph()),e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=this.executor.execute(e,t);return n.length>1?n:n[0]}async executeAsync(e,t){null==this.resourceIdToCapturedInput&&this.setResourceIdToCapturedInput(await this.executeInitializerGraphAsync()),e=this.normalizeInputs(e),t=this.normalizeOutputs(t);const n=await this.executor.executeAsync(e,t);return n.length>1?n:n[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(e){return Object.keys(e).reduce(((t,n)=>(t[n]=[e[n]],t)),{})}dispose(){this.executor.dispose(),this.initializer&&(this.initializer.dispose(),this.resourceIdToCapturedInput&&up(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}}async function tE(e,t={},n=XA){if(null==e)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");null==t&&(t={}),t.fromTFHub&&"string"==typeof e&&(e=function(e){e.endsWith("/")||(e+="/");return`${e}${YN}${JN}`}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * =============================================================================
 */(e));const r=new eE(e,t,n);return await r.load(),r}var nE,rE;
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function aE(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>{null!=e&&Xi("complex64"!==e.dtype,(()=>`${t} does not support complex64 tensors in the CPU backend.`))}))}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(rE=nE||(nE={}))[rE.FAIL=0]="FAIL",rE[rE.SHORTEST=1]="SHORTEST",rE[rE.LONGEST=2]="LONGEST";const sE=ev;class iE extends Gi{nextDataId(){return iE.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new zi(this,ip())}write(e,t,n){this.firstUse&&(this.firstUse=!1,Do().get("IS_NODE")&&ed());const r={id:this.nextDataId()};return this.data.set(r,{values:e,dtype:n,refCount:1}),r}makeTensorInfo(e,t,n){let r;if("string"===t&&null!=n&&n.length>0&&go(n[0])){const a=n.map((e=>Jd(e)));r=this.write(a,e,t)}else r=this.write(n,e,t);return{dataId:r,shape:e,dtype:t}}refCount(e){if(this.data.has(e)){return this.data.get(e).refCount}return 0}incRef(e){this.data.get(e).refCount++}decRef(e){if(this.data.has(e)){this.data.get(e).refCount--}}move(e,t,n,r,a){this.data.set(e,{values:t,dtype:r,refCount:a})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){const{dtype:t,complexTensorInfos:n}=this.data.get(e);if("complex64"===t){return Zx(this.readSync(n.real.dataId),this.readSync(n.imag.dataId))}return Co(this.data.get(e).values,t)}bufferSync(e){const t=this.readSync(e.dataId);if("string"===e.dtype)try{const n=t.map((e=>Yd(e)));return uf(e.shape,e.dtype,n)}catch(n){throw new Error("Failed to decode encoded string bytes into utf-8")}return uf(e.shape,e.dtype,t)}makeOutput(e,t,n){return ip().makeTensorFromTensorInfo(this.makeTensorInfo(t,n,e),this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;const{complexTensorInfos:n}=this.data.get(e);null!=n&&(this.disposeData(n.real.dataId,!0),this.disposeData(n.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){const t=Kd();e();return{kernelMs:Kd()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){aE([e],"where");const t=this.readSync(e.dataId);return sE(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function oE(e){const t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}iE.nextDataId=0;const lE={kernelName:zo,backendName:"cpu",kernelFunc:e=>{const{x:t}=e.inputs,n=e.backend;aE(t,"abs");let r=new Float32Array(Ji(t.shape));return r=oE(n.data.get(t.dataId).values),n.makeOutput(r,t.shape,t.dtype)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function uE(e){return(t,n,r,a,s)=>{const i=Om(t,n),o=i.length,l=ko(i),u=lo(s,Ji(i)),c=t.length,d=n.length,h=ko(t),p=ko(n),f=Rm(t,i),m=Rm(n,i);if(f.length+m.length===0)for(let g=0;g<u.length;++g)u[g]=e(r[g%r.length],a[g%a.length]);else for(let g=0;g<u.length;++g){const t=Eo(g,o,l),n=t.slice(-c);f.forEach((e=>n[e]=0));const s=No(n,c,h),i=t.slice(-d);m.forEach((e=>i[e]=0));const y=No(i,d,p);u[g]=e(r[s],a[y])}return[u,i]}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function cE(e){const{inputs:t,backend:n}=e,{real:r,imag:a}=t,s=n.data.get(r.dataId).values,i=n.data.get(a.dataId).values,o=n.makeTensorInfo(r.shape,"complex64");return n.data.get(o.dataId).complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",s),imag:n.makeTensorInfo(a.shape,"float32",i)},o}const dE={kernelName:fl,backendName:"cpu",kernelFunc:cE};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function hE(e,t,n="float32"){if("complex64"===n){return cE({inputs:{real:hE(e,t,"float32"),imag:hE(e,t,"float32")},backend:e})}const r=Wo(Ji(t),n);return e.makeTensorInfo(t,n,r)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function pE(e){const{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}const fE={kernelName:ru,backendName:"cpu",kernelFunc:pE};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function mE(e){const{inputs:t,backend:n}=e,{input:r}=t,a=n.data.get(r.dataId).complexTensorInfos.real,s=n.data.get(a.dataId).values;return n.makeTensorInfo(a.shape,a.dtype,s)}const gE={kernelName:Ku,backendName:"cpu",kernelFunc:mE};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function yE(e,t,n,r){if("int32"===r){return[t,"int32",Int32Array.from(e)]}if("bool"===r){const r=Zd([0],n),[a,s]=uE(((e,t)=>e!==t?1:0))(t,[],e,r,"bool");return[s,"bool",a]}throw new Error(`Error in Cast: failed to cast ${n} to ${r}`)}function bE(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dtype:s}=r;if("complex64"===s){if("complex64"===a.dtype)return pE({inputs:{x:a},backend:n});const e=hE(n,a.shape,a.dtype),t=bE({inputs:{x:a},backend:n,attrs:{dtype:"float32"}}),r=cE({inputs:{real:t,imag:e},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),r}if("complex64"===a.dtype){const e=mE({inputs:{input:a},backend:n}),t=bE({inputs:{x:e},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(e),t}if(!po(a.dtype,s)){const e=pE({inputs:{x:a},backend:n});return{dataId:e.dataId,shape:e.shape,dtype:s}}const i=n.data.get(a.dataId).values,[o,l,u]=yE(i,a.shape,a.dtype,s);return n.makeTensorInfo(o,l,u)}const vE={kernelName:dl,backendName:"cpu",kernelFunc:bE};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function AE(e,t,n,r){return null==n?({inputs:n,backend:a})=>{const{a:s,b:i}=n,o=a;aE([s,i],e);const l=o.data.get(s.dataId).values,u=o.data.get(i.dataId).values,c="string"===s.dtype?Tk(l):l,d="string"===s.dtype?Tk(u):u,h=r||s.dtype,[p,f]=t(s.shape,i.shape,c,d,h);return o.makeTensorInfo(f,h,p)}:({inputs:e,backend:a})=>{const{a:s,b:i}=e,o=a;if("complex64"===s.dtype||"complex64"===i.dtype){const e=bE({inputs:{x:s},backend:o,attrs:{dtype:"complex64"}}),t=o.data.get(e.dataId),r=t.complexTensorInfos.real,a=t.complexTensorInfos.imag,l=o.data.get(r.dataId).values,u=o.data.get(a.dataId).values,c=bE({inputs:{x:i},backend:o,attrs:{dtype:"complex64"}}),d=o.data.get(c.dataId),h=d.complexTensorInfos.real,p=d.complexTensorInfos.imag,f=o.data.get(h.dataId).values,m=o.data.get(p.dataId).values,[g,y,b]=n(s.shape,i.shape,l,u,f,m),v=o.makeTensorInfo(b,"float32",g),A=o.makeTensorInfo(b,"float32",y),x=cE({inputs:{real:v,imag:A},backend:o});return o.disposeIntermediateTensorInfo(e),o.disposeIntermediateTensorInfo(c),o.disposeIntermediateTensorInfo(v),o.disposeIntermediateTensorInfo(A),x}{const e=o.data.get(s.dataId).values,n=o.data.get(i.dataId).values,a=r||s.dtype,[l,u]=t(s.shape,i.shape,e,n,a);return o.makeTensorInfo(u,a,l)}}}function xE(e){return(t,n,r,a,s,i)=>{const o=Om(t,n),l=Ji(o),u=o.length,c=ko(o),d=lo("float32",l),h=lo("float32",l),p=Rm(t,o),f=Rm(n,o),m=Zx(r,a),g=Zx(s,i),y=t.length,b=ko(t),v=n.length,A=ko(n);if(p.length+f.length===0)for(let x=0;x<d.length;x++){const t=x%m.length,n=x%g.length,r=e(m[2*t],m[2*t+1],g[2*n],g[2*n+1]);d[x]=r.real,h[x]=r.imag}else for(let x=0;x<d.length;x++){const t=Eo(x,u,c),n=t.slice(-y);p.forEach((e=>n[e]=0));const r=No(n,y,b),a=t.slice(-v);f.forEach((e=>a[e]=0));const s=No(a,v,A),i=e(m[2*r],m[2*r+1],g[2*s],g[2*s+1]);d[x]=i.real,h[x]=i.imag}return[d,h,o]}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kE=uE(((e,t)=>e+t)),wE=xE(((e,t,n,r)=>({real:e+n,imag:t+r}))),SE=AE(Uo,kE,wE),CE={kernelName:Uo,backendName:"cpu",kernelFunc:SE};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function IE(e,t,n,r,a){const s=Ji(r),i=Wo(a,n);for(let o=0;o<e.length;o++){const n=e[o];if(n<0)throw new Error("Input x must be non-negative!");n>=a||(i[n]+=s>0?t[o]:1)}return i}function WE(e,t,n,r=!1){const a=e.shape[0],s=e.shape[1],i=uf([a,n],t.dtype);for(let o=0;o<a;o++)for(let a=0;a<s;a++){const s=e.get(o,a);if(s<0)throw new Error("Input x must be non-negative!");s>=n||(r?i.set(1,o,s):t.size>0?i.set(i.get(o,s)+t.get(o,a),o,s):i.set(i.get(o,s)+1,o,s))}return i}
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _E=uE(((e,t)=>e&t)),TE=AE(ll,_E),NE={kernelName:ll,backendName:"cpu",kernelFunc:TE};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function EE(e){return(t,n,r)=>{const a=uo(n,t.length);for(let s=0;s<t.length;++s)a[s]=e(t[s],r);return a}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function RE(e,t,n){return $E(e,EE(t),n)}function $E(e,t,n){return({inputs:r,attrs:a,backend:s})=>{const{x:i}=r;aE(i,e);const o=s,l=o.data.get(i.dataId).values;let u;if("string"===i.dtype){if(!Array.isArray(l))throw new Error("String tensor's value was not an instance of Array");u=Tk(l)}else u=l;const c=n||i.dtype,d=t(u,c,a);return o.makeTensorInfo(i.shape,c,d)}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const OE=EE((e=>Math.ceil(e))),FE=$E(hl,OE),DE={kernelName:hl,backendName:"cpu",kernelFunc:FE};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function ME(e,t,n,r){const a=uo(n,Ji(t));if(r&&"string"!==n){let t=0;e.forEach((e=>{const n=Ji(e.shape);a.set(e.vals,t),t+=n}))}else{let r=0;e.forEach((e=>{const s="string"===n?Tk(e.vals):e.vals;let i=0;for(let n=0;n<e.shape[0];++n){const o=n*t[1]+r;for(let t=0;t<e.shape[1];++t)a[o+t]=s[i++]}r+=e.shape[1]}))}return a}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const LE=uE(((e,t)=>e===t?1:0)),BE=AE(Vl,LE,null,"bool"),PE={kernelName:Vl,backendName:"cpu",kernelFunc:BE},zE=EE((e=>Math.exp(e))),GE=$E(Ul,zE,"float32"),VE={kernelName:Ul,backendName:"cpu",kernelFunc:GE},UE=EE((e=>Math.expm1(e))),HE=$E(jl,UE),jE={kernelName:jl,backendName:"cpu",kernelFunc:HE},qE=EE((e=>Math.floor(e))),QE=$E(Zl,qE),XE={kernelName:Zl,backendName:"cpu",kernelFunc:QE},ZE=uE(((e,t)=>Math.floor(e/t))),KE=AE(Kl,ZE,null,"int32"),JE={kernelName:Kl,backendName:"cpu",kernelFunc:KE};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function YE(e,t,n,r,a,s,i,o,l){const u=uf([r,s],n);for(let c=0;c<r;c++){const n=[];let r=0;for(let t=0;t<a;t++){const s=e[c*a+t];r+=s*i[t],n.push(s)}if(r<0||r>=l/s)throw new Error(`Invalid indices: ${n} does not index into ${o}`);for(let e=0;e<s;e++)u.values[c*s+e]=t.get(...t.indexToLoc(r*s+e))}return u}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function eR(e,t,n){const r=uf(n,e.dtype);for(let a=0;a<r.size;++a){const n=r.indexToLoc(a).slice(),s=n[0],i=n[2],o=t.locToIndex([s,i]);n[2]=t.values[o];const l=e.locToIndex(n);0<=l&&l<e.values.length&&(r.values[a]=e.values[l])}return r}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tR=uE(((e,t)=>e>t?1:0)),nR=AE(tu,tR,null,"bool"),rR={kernelName:tu,backendName:"cpu",kernelFunc:nR},aR=uE(((e,t)=>e>=t?1:0)),sR=AE(nu,aR,null,"bool"),iR={kernelName:nu,backendName:"cpu",kernelFunc:sR},oR=uE(((e,t)=>e<t?1:0)),lR=AE(cu,oR,null,"bool"),uR={kernelName:cu,backendName:"cpu",kernelFunc:lR},cR=uE(((e,t)=>e<=t?1:0)),dR=AE(du,cR,null,"bool"),hR={kernelName:du,backendName:"cpu",kernelFunc:dR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function pR(e,t,n){const r=(t-e)/(n-1),a=Wo(n,"float32");a[0]=e;for(let s=1;s<a.length;s++)a[s]=a[s-1]+r;return a}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const fR=EE((e=>Math.log(e))),mR=$E(pu,fR),gR={kernelName:pu,backendName:"cpu",kernelFunc:mR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function yR(e,t,n,r){const a=lo(r,Ji(n));for(let s=0;s<a.length;++s){const n=s*t;let r=e[n];for(let a=0;a<t;++a){const t=e[n+a];(Number.isNaN(t)||t>r)&&(r=t)}a[s]=r}return a}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bR=uE(((e,t)=>Math.max(e,t))),vR=AE(ku,bR),AR={kernelName:ku,backendName:"cpu",kernelFunc:vR},xR=uE(((e,t)=>Math.min(e,t))),kR=AE(Nu,xR),wR={kernelName:Nu,backendName:"cpu",kernelFunc:kR},SR=uE(((e,t)=>e*t)),CR=xE(((e,t,n,r)=>({real:e*n-t*r,imag:e*r+t*n}))),IR=AE(Ou,SR,CR),WR={kernelName:Ou,backendName:"cpu",kernelFunc:IR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function _R(e,t,n){const r=Xd(-1,n);return SR([],t,r,e,n)}const TR={kernelName:Fu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t;aE(r,"neg");const a=n.data.get(r.dataId).values,[s,i]=_R(a,r.shape,r.dtype);return n.makeTensorInfo(i,r.dtype,s)}},NR=uE(((e,t)=>e!==t?1:0)),ER=AE(Du,NR,null,"bool"),RR={kernelName:Du,backendName:"cpu",kernelFunc:ER};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function $R(e,t,n,r,a){const s=t.length,i=Ji(t),o=ko(t),l=ko(a),u=lo(n,Ji(a));for(let c=0;c<i;++c){const t=Eo(c,s,o),n=new Array(t.length);for(let e=0;e<n.length;e++)n[e]=t[r[e]];u[No(n,s,l)]=e[c]}return u}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function OR(e){const{inputs:t,attrs:n,backend:r}=e,{x:a}=t,{perm:s}=n;aE(a,"transpose");const i=a.shape.length,o=new Array(i);for(let u=0;u<o.length;u++)o[u]=a.shape[s[u]];const l=$R(r.data.get(a.dataId).values,a.shape,a.dtype,s,o);return{dataId:r.write(l,o,a.dtype),shape:o,dtype:a.dtype}}const FR={kernelName:Vc,backendName:"cpu",kernelFunc:OR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function DR(e,t,n,r){const[a,s]=qm(e,r),i=_h(t,"int32"),o=Wo(Ji(a),i),l=Ji(s);for(let u=0;u<o.length;++u){const e=u*l;let t=1;for(let r=0;r<l;++r)t*=n[e+r];o[u]=t}return{outVals:o,outShape:a,outDtype:i}}const MR={kernelName:ju,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;aE(a,"prod");const o=a.shape.length,l=io(s,a.shape),u=Zm(l,o);let c=l,d=a;const h=[];null!=u&&(d=OR({inputs:{x:a},backend:n,attrs:{perm:u}}),h.push(d),c=Jm(c.length,o));const p=n.data.get(d.dataId).values,{outVals:f,outShape:m,outDtype:g}=DR(d.shape,d.dtype,p,c);let y=m;return i&&(y=Qm(m,l)),h.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(y,g,f)}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function LR(e,t,n,r){const a=[];let s=0;const i=t.length-1+n.length,o=new Array(i).fill(null).map((()=>[0]));!function(e,t){for(let n=0;n<e.length;++n){const r=e[n],a=n===e.length-1?t:e[n+1].length;if(0===r.length)throw new Error("Ragged splits may not be empty");if(r[0]<0)throw new Error("Ragged splits must be non-negative");if(r[r.length-1]>a)throw new Error("Ragged splits must not point past values");for(let e=1;e<r.length;++e)if(r[e-1]>r[e])throw new Error("Ragged splits must be sorted in ascending order")}}(n,r);let l=1;for(let u=0;u<t.length-1;++u){l*=t[u];const e=t[u+1];for(let t=1;t<l+1;++t)o[u].push(t*e)}for(let u=0;u<e.length;++u){let r=e[u],i=e[u]+1;for(let e=0;e<n.length;++e){const a=n[e],s=e+t.length-1;if(s>=0){const e=o[s],t=e[e.length-1]-a[r];for(let n=r;n<i;++n)o[s].push(a[n+1]+t)}r=a[r],i=a[i]}i!==r&&(a.push([r,i]),s+=i-r)}return{outSplits:o,valueSlices:a,numValues:s}}function BR(e,t){const n=e.slice(0,t);for(;n.length<t;)n.push(1);for(let r=t;r<e.length;r++)n[t-1]*=e[r];return n}function PR(e,t,n,r,a){const s=t.slice();s[0]=a;const i=uo(n,Ji(s)),o=e.length;return function(e,t,n,r,a,s){const i=BR(t,2)[1],o=BR(s,2)[1];let l=0;for(const u of n)for(let t=u[0];t<u[1];++t){for(let n=0;n<r;++n)a[l*o+n]=e[t*i+n];++l}}(e,t,r,0===o?0:o/t[0],i,s),[i,s]}function zR(e,t,n,r,a,s,i,o){if(0===e.length)throw new Error("paramsNestedSplits must be non empty");if(0===t[0].length)throw new Error("Split tensors must not be scalars");if(function(e,t,n){e.forEach(((e,r)=>{if(e<0||e>=n){const a=Eo(r,t.length,ko(t)).join(",");throw new Error(`indices[${a}] = ${e} is not in [0, ${n})`)}}))}(s,i,t[0][0]-1),0===r.length)throw new Error("params.rank must be nonzero");const l=r[0],{outSplits:u,valueSlices:c,numValues:d}=LR(s,i,e,l),h=function(e){const t=[];for(let n=0;n<e.length;++n){const r=uo("int32",e[n].length);t.push(r),e[n].forEach(((e,t)=>r[t]=e))}return t}(u),p=PR(n,r,a,c,d);return[h,p[0],p[1]]}
/**
 * @license
 * Copyright 2022 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const GR=2147483647;function VR(e,t,n,r,a,s,i){if(t.length>1)throw new Error("starts must be a scalar or vector");if(a.length>1)throw new Error("limits must be a scalar or vector");if(i.length>1)throw new Error("deltas must be a scalar or vector");const o=0===t.length,l=0===a.length,u=0===i.length,c=[];o||c.push(t[0]),l||c.push(a[0]),u||c.push(i[0]);for(let m=1;m<c.length;++m)if(c[m]!==c[m-1])throw new Error("starts, limits, and deltas must have the same shape");const d=0===c.length?1:c[0],h=uo("int32",d+1);h[0]=0;for(let m=0;m<d;++m){const t=o?e[0]:e[m],n=l?r[0]:r[m],a=u?s[0]:s[m];if(0===a)throw new Error("Requires delta != 0");let i;if(a>0&&n<t||a<0&&n>t)i=0;else if(i=Math.ceil(Math.abs((n-t)/a)),i>GR)throw new Error("Requires ((limit - start) / delta) <= 2147483647");h[m+1]=h[m]+i}const p=uo(n,h[d]);let f=0;for(let m=0;m<d;++m){const t=h[m+1]-h[m];let n=o?e[0]:e[m];const r=u?s[0]:s[m];for(let e=0;e<t;++e)p[f++]=n,n+=r}return[h,p]}
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */var UR=Tx;class HR{constructor(e,t,n,r,a,s,i,o,l,u){this.shape=e,this.shapeShape=t,this.values=n,this.valuesShape=r,this.valuesDType=a,this.defaultValue=s,this.defaultValueShape=i,this.rowPartitionValues=o,this.rowPartitionValuesShapes=l,this.rowPartitionTypes=Rx(u),this.raggedRank=$x(this.rowPartitionTypes)}getRowPartitionTypeByDimension(e){return this.rowPartitionTypes[0]===UR.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}getRowPartitionTensor(e){return this.rowPartitionTypes[0]===UR.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}getMaxWidth(e){const t=this.getRowPartitionTensor(e-1);switch(this.getRowPartitionTypeByDimension(e-1)){case UR.VALUE_ROWIDS:return HR.getMaxWidthValueRowID(t);case UR.ROW_SPLITS:return HR.getMaxWidthRowSplit(t);default:throw new Error(`Cannot handle partition type ${UR[this.getRowPartitionTypeByDimension(e-1)]}`)}}static getMaxWidthRowSplit(e){const t=e.length;if(0===t||1===t)return 0;let n=0;for(let r=0;r<t-1;++r){const t=e[r+1]-e[r];t>n&&(n=t)}return n}static getMaxWidthValueRowID(e){const t=e.length;if(0===t)return 0;let n=0,r=e[0],a=0;for(let s=1;s<t;++s){const t=e[s];t!==r&&(r=t,a=Math.max(s-n,a),n=s)}return Math.max(t-n,a)}tensorShapeFromTensor(e,t,n=!0){if(0===t.length){if(-1===e[0])return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return qR(e,n)}calculateOutputSize(e){const t=this.valuesShape;Ox(this.defaultValueShape,t);const n=this.tensorShapeFromTensor(this.shape,this.shapeShape),r=Ex(this.raggedRank,n,t);r[0]<0&&(r[0]=e);for(let a=1;a<=this.raggedRank;++a)r[a]<0&&(r[a]=this.getMaxWidth(a));return r}calculateFirstParentOutputIndex(e,t,n){const r=Math.min(e,n),a=[];let s=0;for(let i=0;i<r;++i,s+=t)a.push(s);for(let i=r;i<e;++i)a.push(-1);return Xi(a.length===e,(()=>"Final length of result must be equal to firstDimension.")),a}calculateOutputIndexRowSplit(e,t,n,r){const a=e.length,s=[];for(let i=0;i<a-1;++i){const a=e[i+1]-e[i];let o=Math.min(r,a),l=t[i];-1===l&&(o=0);for(let e=0;e<o;++e)s.push(l),l+=n;for(let e=0;e<a-o;++e)s.push(-1)}if(a>0&&s.length!==e[a-1])throw new Error("Invalid row split size.");return s}calculateOutputIndexValueRowID(e,t,n,r){const a=e.length,s=[];if(0===a)return[];let i=0,o=e[0];if(o>=t.length)throw new Error(`Got currentValueRowId=${o}, which is not less than ${t.length}`);let l=t[o];s.push(l);for(let u=1;u<a;++u){const a=e[u];if(a===o)l>=0&&(++i,i<r?l+=n:l=-1);else{if(i=0,o=a,a>=t.length)throw new Error(`Got nextValueRowId=${a} which is not less than ${t.length}`);l=t[a]}s.push(l)}if(s.length!==e.length)throw new Error("Invalid row ids.");return s}calculateOutputIndex(e,t,n,r){const a=this.getRowPartitionTensor(e),s=this.getRowPartitionTypeByDimension(e);switch(s){case UR.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(a,t,n,r);case UR.ROW_SPLITS:if(a.length-1>t.length)throw new Error(`Row partition size is greater than output size: ${a.length-1} > ${t.length}`);return this.calculateOutputIndexRowSplit(a,t,n,r);default:throw new Error(`Unsupported partition type: ${UR[s]}`)}}getFirstDimensionSize(){const e=this.rowPartitionValues[0];if(0===this.rowPartitionTypes.length)throw new Error("No row_partition_types given.");const t=this.rowPartitionTypes[0];switch(t){case UR.FIRST_DIM_SIZE:return e[0];case UR.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case UR.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${UR[t]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");const e=this.getFirstDimensionSize(),t=this.calculateOutputSize(e),n=new Array(this.raggedRank+1);n[n.length-1]=1;for(let s=n.length-2;s>=0;--s)n[s]=n[s+1]*t[s+1];const r=qR(t,!1),a=uo(this.valuesDType,Ji(r));if(n[0]*t[0]>0){let s=this.calculateFirstParentOutputIndex(e,n[0],t[0]);for(let e=1;e<=this.raggedRank;++e){s=this.calculateOutputIndex(e-1,s,n[e],t[e])}this.setOutput(this.raggedRank,s,a,r)}return[r,a]}setOutput(e,t,n,r){if(0===n.length)return;const a=this.values,s=n;let i=r.slice();i=i.slice(e+1);const o=Ji(i),l=t.length;let u=this.defaultValue;if(u.length!==o&&1!==u.length){const e=this.defaultValueShape;lp((()=>{const t=Hf(u,e),n=lm(t,i);u=n.dataSync()}))}let c=0,d=0,h=0;for(let p=0;p<=l;++p){let e=p<l?t[p]:-1;if(e!==h){if(d<h){const e=a.subarray(c*o);jR(s.subarray(d*o),e,(h-d)*o)}if(p>=l){const t=n.length;e=Math.floor(t/o)}if(e>h)if(1===this.defaultValue.length)s.subarray(h*o,e*o).fill(this.defaultValue[0]),h=e;else for(;e>h;){jR(s.slice(h*o),u,o),++h}e<0?(c=p+1,d=h):(c=p,d=h,h=d+1)}else++h}}}function jR(e,t,n){for(let r=0;r<n;r++)e[r]=t[r]}function qR(e,t){const n=[];for(let r of e){if(r<0){if(!t)throw new Error(`Dimension ${r} must be >= 0`);if(r<-1)throw new Error(`Dimension ${r} must be >= -1`);r=-1}n.push(r)}return n}function QR(e,t,n,r,a,s,i,o,l,u){return new HR(e,t,n,r,a,s,i,o,l,u).compute()}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function XR(e,t,n,r){if(e===t||e<t&&n<0||t<e&&n>1)return Wo(0,r);const a=Wo(Math.abs(Math.ceil((t-e)/n)),r);t<e&&1===n&&(n=-1),a[0]=e;for(let s=1;s<a.length;s++)a[s]=a[s-1]+n;return a}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ZR=EE((e=>1/Math.sqrt(e))),KR=$E(lc,ZR),JR={kernelName:lc,backendName:"cpu",kernelFunc:KR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function YR(e,t,n,r,a,s,i,o,l,u){const c=[r/a,a],d=e.values,h=t.values;if(0===r)return uf(n,t.dtype);const p=l instanceof dh?l:uf(c,t.dtype);"string"==typeof l||"number"==typeof l?p.values.fill(l):"boolean"==typeof l&&p.values.fill(+l);for(let f=0;f<s;f++){const e=[];let s=0;for(let t=0;t<i;t++){const n=d[f*i+t];e.push(n),s+=n*o[t]}if(s<0||s>=r/a)throw new Error(`Invalid indices: ${e} does not index into ${n}`);for(let n=0;n<a;n++)u?p.values[s*a+n]+=h[f*a+n]:p.values[s*a+n]=0===t.rank?h[0]:h[f*a+n]}return p}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const e$=EE((e=>1/(1+Math.exp(-e)))),t$=RE(bc,(e=>1/(1+Math.exp(-e)))),n$={kernelName:bc,backendName:"cpu",kernelFunc:t$};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function r$(e,t,n,r,a){const s=yx(r,t,n),i=Ji(n),o=ko(r);if(s){const n=bx(t,o);return"string"===a?e.slice(n,n+i):e.subarray(n,n+i)}const l=uf(r,a,"string"===a?Tk(e):e),u=uf(n,a);for(let c=0;c<u.size;++c){const e=u.indexToLoc(c),n=e.map(((e,n)=>e+t[n]));u.set(l.get(...n),...e)}return"string"===a?Nk(u.values):u.values}function a$(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,size:i}=r;aE(a,"slice");const[o,l]=vx(a,s,i);ox(a,o,l);const u=r$(n.data.get(a.dataId).values,o,l,a.shape,a.dtype);return n.makeTensorInfo(l,a.dtype,u)}const s$={kernelName:fc,backendName:"cpu",kernelFunc:a$};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function i$(e,t,n,r,a,s,i){const o=t[0],l=s[0],u=new Array(l),c=new Array(o),d=t[1];if(0===l){if(0!==o)throw new Error(pk(o));return[uo(n,0),[0,d],uo(a,0),u,c]}let h=!0,p=0;const f=new Array(l).fill(0);for(let g=0;g<o;++g){const t=e[g*d];if(t<0)throw new Error(fk(g,t));if(t>=l)throw new Error(mk(g,t,l));++f[t],h=h&&t>=p,p=t}let m=!0;for(let g=0;g<l;++g){const e=0===f[g];u[g]=e,m=m&&!e,f[g]=Math.max(f[g],1),g>0&&(f[g]+=f[g-1])}if(m&&h){const t=e,n=r;for(let e=0;e<o;++e)c[e]=e;return[t,[o,d],n,u,c]}{const t=f[l-1],s=uo(n,t*d),h=uo(a,t),p=new Array(l).fill(0);for(let n=0;n<o;++n){const t=e[n*d],a=p[t],i=(0===t?0:f[t-1])+a;p[t]++;for(let r=0;r<d;++r)s[i*d+r]=e[n*d+r];h[i]=r[n],c[n]=i}for(let e=0;e<l;++e){if(0===p[e]){const t=0===e?0:f[e-1];s[t*d+0]=e;for(let e=1;e<d;++e)s[t*d+e]=0;h[t]=i}}return[s,[t,d],h,u,c]}}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function o$(e,t,n,r,a){const s=Ji(r),i=t[0],o=a.length,l=[];let u=1,c=-1;for(let m=0;m<o;++m){const e=a[m];if(-1===e){if(-1!==c)throw new Error(gk(c,m));c=m,l.push(1)}else{if(e<0)throw new Error(yk(m,e));u*=e,l.push(e)}}if(-1!==c){if(u<=0)throw new Error("reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero");const e=Math.trunc(s/u);if(u*e!==s)throw new Error(vk(r,l));l[c]=e}if(Ji(l)!==s)throw new Error(Ak(r,l));const d=r.length,h=[];if(d>0){h[d-1]=1;for(let e=d-2;e>=0;--e)h[e]=h[e+1]*r[e+1]}const p=[];if(o>0){p[o-1]=1;for(let e=o-2;e>=0;--e)p[e]=p[e+1]*l[e+1]}const f=uo(n,i*o);for(let m=0;m<i;++m){let t=0;for(let n=0;n<d;++n)t+=e[m*d+n]*h[n];for(let e=0;e<o;++e)f[m*o+e]=Math.trunc(t/p[e]),t%=p[e]}return[f,[i,o],l]}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function l$(e,t,n,r,a,s=!1,i=0){const o=r.length,l=[t[0],e.length/t[0]],u=l[1],c=o>0?a[o-1]+1:0;if(c<0)throw new Error("segment ids must be >= 0");const d=t.slice();d[0]=c;const h=uo(n,d.reduce(((e,t)=>e*t),1));if(0===o)return c>0&&h.fill(i),[h,d];if(c<=0)throw new Error("segment ids must be >= 0");let p=0,f=1,m=0,g=a[p];for(;;){let t=0;if(f<o){if(t=a[f],g===t){++f;continue}if(g>=t)throw new Error("segment ids are not increasing")}if(g<0||g>=c)throw new Error(wk(g,c));g>m&&h.fill(i,m*u,g*u);for(let n=p;n<f;++n){const t=r[n];if(t<0||t>=l[0])throw new Error(Sk(n,r[n],l[0]));for(let n=0;n<u;n++)h[g*u+n]+=e[t*u+n]}if(s)for(let e=0;e<u;e++)h[g*u+e]/=f-p;if(p=f,++f,m=g+1,g=t,f>o)break}return m<c&&h.fill(i,m*u,c*u),[h,d]}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const u$=EE((e=>Math.sqrt(e))),c$=RE(Ac,(e=>Math.sqrt(e))),d$={kernelName:Ac,backendName:"cpu",kernelFunc:c$},h$=uE(((e,t)=>{const n=e-t;return n*n})),p$=AE(Nc,h$),f$={kernelName:Nc,backendName:"cpu",kernelFunc:p$},m$=EE(((e,t)=>{const{pattern:n,replaceGlobal:r,rewrite:a}=t;return e.replace(new RegExp(n,r?"g":""),a)})),g$=$E(Rc,m$),y$={kernelName:Rc,backendName:"cpu",kernelFunc:g$};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function b$(e,t,n,r){const a=uf(e,t.dtype);for(let s=0;s<a.size;s++){const e=a.indexToLoc(s),i=new Array(e.length);for(let t=0;t<i.length;t++)i[t]=e[t]*n[t]+r[t];a.set(t.get(...i),...e)}return a}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class v${constructor(e,t,n,r,a,s){this.separator=Jd(e),this.nGramWidths=t,this.leftPad=Jd(n),this.rightPad=Jd(r),this.padWidth=a,this.preserveShort=s}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,t){const n=this.getPadWidth(t);return Math.max(0,e+2*n-t+1)}createNGrams(e,t,n,r,a,s){for(let i=0;i<a;++i){const o=this.getPadWidth(s),l=Math.max(0,o-i),u=Math.max(0,o-(a-(i+1))),c=s-(l+u),d=t+(l>0?0:i-o);let h=0;h+=l*this.leftPad.length;for(let t=0;t<c;++t)h+=e[d+t].length;h+=u*this.rightPad.length;h+=(l+u+c-1)*this.separator.length,n[r+i]=new Uint8Array(h);const p=n[r+i];let f=0;const m=e=>e.forEach((e=>p[f++]=e));for(let e=0;e<l;++e)m(this.leftPad),m(this.separator);for(let t=0;t<c-1;++t)m(e[d+t]),m(this.separator);if(c>0){m(e[d+c-1]);for(let e=0;e<u;++e)m(this.separator),m(this.rightPad)}else{for(let e=0;e<u-1;++e)m(this.rightPad),m(this.separator);m(this.rightPad)}}}compute(e,t){const n=e.length,r=t.length;if(r>0){let e=t[0];if(0!==e)throw new Error(`First split value must be 0, got ${e}`);for(let a=1;a<r;++a){let r=t[a]>=e;if(r=r&&t[a]<=n,!r)throw new Error(`Invalid split value ${t[a]}, must be in [${e}, ${n}]`);e=t[a]}if(e!==n)throw new Error(`Last split value must be data size. Expected ${n}, got ${e}`)}const a=r-1,s=uo("int32",r);if(0===n||0===r){const e=new Array(n);for(let t=0;t<=a;++t)s[t]=0;return[e,s]}s[0]=0;for(let o=1;o<=a;++o){const e=t[o]-t[o-1];let n=0;this.nGramWidths.forEach((t=>{n+=this.getNumNGrams(e,t)})),this.preserveShort&&e>0&&0===n&&(n=1),s[o]=s[o-1]+n}const i=new Array(s[a]);for(let o=0;o<a;++o){const n=t[o];let r=s[o];if(this.nGramWidths.forEach((a=>{const s=t[o+1]-t[o],l=this.getNumNGrams(s,a);this.createNGrams(e,n,i,r,l,a),r+=l})),this.preserveShort&&r===s[o]){const a=t[o+1]-t[o];if(0===a)continue;const s=a+2*this.padWidth,l=1;this.createNGrams(e,n,i,r,l,s)}}return[i,s]}}function A$(e,t,n,r,a,s,i,o){return new v$(n,r,a,s,i,o).compute(e,t)}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function x$(e,t,n,r){if(!e.length)return;if(0===t.length){for(let t=0;t<e.length;++t)r.push(e.subarray(t,t+1));return}if(1===t.length){const a=t[0];let s=e.indexOf(a);for(;-1!==s;){const t=e.subarray(0,s);n&&0===t.length||r.push(t),s=(e=e.subarray(s+1)).indexOf(a)}return void(n&&0===e.length||r.push(e))}let a=0;for(let s=0;s<e.length+1;s++)if(s===e.length||-1!==t.indexOf(e[s])){const t=e.subarray(a,s);n&&0===t.length||r.push(t),a=s+1}}function k$(e,t,n){const r=e.length,a=[];let s=0,i=0;const o=new Array(r);for(let h=0;h<r;++h){const r=a.length;x$(e[h],t,n,a);const l=a.length-r;o[h]=l,s+=l,i=Math.max(i,l)}const l=uo("int32",2*s),u=new Array(s),c=[r,i];let d=0;for(let h=0;h<r;++h)for(let e=0;e<o[h];++e)l[2*d]=h,l[2*d+1]=e,u[d]=a[d],++d;return[l,u,c]}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function w$(e,t){const n=uo("int32",e.length);for(let r=0;r<e.length;++r)n[r]=Qd(e[r]).modulo(t).getLowBitsUnsigned();return n}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const S$=uE(((e,t)=>e-t)),C$=xE(((e,t,n,r)=>({real:e-n,imag:t-r}))),I$=AE(Mc,S$,C$),W$={kernelName:Mc,backendName:"cpu",kernelFunc:I$};
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function _$(e,t){const n=new Array(e.rank);for(let a=0;a<n.length;a++)n[a]=e.shape[a]*t[a];const r=uf(n,e.dtype);for(let a=0;a<r.values.length;++a){const t=r.indexToLoc(a),n=new Array(e.rank);for(let r=0;r<n.length;r++)n[r]=t[r]%e.shape[r];const s=e.locToIndex(n);r.values[a]=e.values[s]}return r}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const T$=(e,t)=>{const n=t.value-e.value;return 0===n?e.index-t.index:n};function N$(e,t,n=0,r=e.length-1){for(;r>n;){if(r-n>600){const a=r-n+1,s=t-n+1,i=Math.log(a),o=.5*Math.exp(2*i/3),l=.5*Math.sqrt(i*o*(a-o)/a)*Math.sign(s-a/2);N$(e,t,Math.max(n,Math.floor(t-s*o/a+l)),Math.min(r,Math.floor(t+(a-s)*o/a+l)))}const a=e[t];let s=n,i=r;for(qi(e,n,t),T$(e[r],a)>0&&qi(e,n,r);s<i;){for(qi(e,s,i),s++,i--;T$(e[s],a)<0;)s+=1;for(;T$(e[i],a)>0;)i-=1}0===T$(e[n],a)?qi(e,n,i):(i+=1,qi(e,i,r)),i<=t&&(n=i+1),t<=i&&(r=i-1)}}function E$(e,t,n,r,a){const s=t[t.length-1],[i,o]=[e.length/s,s],l=lo(n,i*r),u=lo("int32",i*r);for(let d=0;d<i;d++){const t=d*o,n=e.subarray(t,t+o);let s=new Array(n.length);n.forEach(((e,t)=>s[t]={value:e,index:t})),r<s.length&&(N$(s,r),s=s.slice(0,r)),a&&s.sort(T$);const i=d*r,c=l.subarray(i,i+r),h=u.subarray(i,i+r);for(let e=0;e<r;e++)c[e]=s[e].value,h[e]=s[e].index}const c=t.slice();return c[c.length-1]=r,[uf(c,n,l),uf(c,"int32",u)]}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function R$(e,t,n,r){const a=io(t,n)[0],s=[1,n[0],1];for(let f=0;f<a;f++)s[0]*=n[f];s[1]=n[a];for(let f=a+1;f<n.length;f++)s[2]*=n[f];const i=new Map,o=new Int32Array(n[a]),l=new dh(s,r,e),u=[],c=1===s[0]&&1===s[2];for(let f=0;f<n[a];f++){let t;if(c)t=e[f].toString();else{const e=[];for(let t=0;t<s[0];t++)for(let n=0;n<s[2];n++)e.push(l.get(t,f,n));t=e.join(",")}const n=i.get(t);if(null!=n)o[f]=n;else{const e=i.size;i.set(t,e),o[f]=e,u.push(f)}}const d=s.slice();d[1]=i.size;const h=new dh(d,r);u.forEach(((e,t)=>{for(let n=0;n<s[0];n++)for(let r=0;r<s[2];r++)h.set(l.get(n,e,r),n,t,r)}));const p=n.slice();return p[a]=d[1],{outputValues:h.values,outputShape:p,indices:o}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $$=Object.freeze(Object.defineProperty({__proto__:null,addImpl:kE,bincountImpl:IE,bincountReduceImpl:WE,bitwiseAndImpl:_E,castImpl:yE,ceilImpl:OE,concatImpl:ME,equalImpl:LE,expImpl:zE,expm1Impl:UE,floorDivImpl:ZE,floorImpl:qE,gatherNdImpl:YE,gatherV2Impl:eR,greaterEqualImpl:aR,greaterImpl:tR,lessEqualImpl:cR,lessImpl:oR,linSpaceImpl:pR,logImpl:fR,maxImpl:yR,maximumImpl:bR,minimumImpl:xR,multiplyImpl:SR,negImpl:_R,notEqualImpl:NR,prodImpl:DR,raggedGatherImpl:zR,raggedRangeImpl:VR,raggedTensorToTensorImpl:QR,rangeImpl:XR,rsqrtImpl:ZR,scatterImpl:YR,sigmoidImpl:e$,simpleAbsImpl:oE,sliceImpl:r$,sparseFillEmptyRowsImpl:i$,sparseReshapeImpl:o$,sparseSegmentReductionImpl:l$,sqrtImpl:u$,squaredDifferenceImpl:h$,staticRegexReplaceImpl:m$,stridedSliceImpl:b$,stringNGramsImpl:A$,stringSplitImpl:k$,stringToHashBucketFastImpl:w$,subImpl:S$,tileImpl:_$,topKImpl:E$,transposeImpl:$R,uniqueImpl:R$},Symbol.toStringTag,{value:"Module"}));
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */hp("cpu",(()=>new iE),1);
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const O$=RE(Pl,(e=>e>=0?e:Math.exp(e)-1)),F$={kernelName:Pl,backendName:"cpu",kernelFunc:O$};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function D$(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{alpha:s}=r;aE([a],"leakyRelu");const i=Ji(a.shape),o=n.data.get(a.dataId).values,l=lo("float32",i);for(let u=0;u<o.length;u++)l[u]=o[u]<0?s*o[u]:o[u];return n.makeTensorInfo(a.shape,"float32",l)}const M$={kernelName:uu,backendName:"cpu",kernelFunc:D$},L$=uE(((e,t)=>e<0?t*e:e));
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function B$(e){const{inputs:t,backend:n}=e,{x:r,alpha:a}=t;aE([r,a],"prelu");const s=n.data.get(r.dataId).values,i=n.data.get(a.dataId).values,[o,l]=L$(r.shape,a.shape,s,i,"float32");return n.makeTensorInfo(l,"float32",o)}const P$={kernelName:Hu,backendName:"cpu",kernelFunc:B$},z$=RE(Yu,(e=>Math.max(0,e))),G$={kernelName:Yu,backendName:"cpu",kernelFunc:z$},V$=RE(sc,(e=>Math.min(Math.max(0,e),6))),U$={kernelName:sc,backendName:"cpu",kernelFunc:V$};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function H$(e,t,n,r,a){if("linear"===n)return pE({inputs:{x:t},backend:e});if("relu"===n)return z$({inputs:{x:t},backend:e});if("elu"===n)return O$({inputs:{x:t},backend:e});if("relu6"===n)return V$({inputs:{x:t},backend:e});if("prelu"===n)return B$({inputs:{x:t,alpha:r},backend:e});if("leakyrelu"===n)return D$({inputs:{x:t},backend:e,attrs:{alpha:a}});if("sigmoid"===n)return t$({inputs:{x:t},backend:e});throw new Error(`Activation ${n} has not been implemented for the CPU backend.`)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function j$(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{shape:s}=r,i=Ji(a.shape),o=so(s,i),l=Ji(o);Xi(i===l,(()=>`The new shape (${o}) has ${l} elements and the old shape (${a.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`)),n.incRef(a.dataId);const u=n.data.get(a.dataId);if(null!=u.complexTensorInfos){const e=u.complexTensorInfos.real,t=u.complexTensorInfos.imag;e.shape=o,t.shape=o}return{dataId:a.dataId,shape:o,dtype:a.dtype}}const q$={kernelName:ec,backendName:"cpu",kernelFunc:j$};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Q$(e){const{inputs:t,backend:n,attrs:r}=e,{a:a,b:s}=t,{transposeA:i,transposeB:o}=r;aE([a,s],"matMul");const l=a.shape.length,u=s.shape.length,c=i?a.shape[l-2]:a.shape[l-1],d=o?s.shape[u-1]:s.shape[u-2],h=i?a.shape[l-1]:a.shape[l-2],p=o?s.shape[u-2]:s.shape[u-1],f=a.shape.slice(0,-2),m=s.shape.slice(0,-2),g=Ji(f),y=Ji(m),b=Om(a.shape.slice(0,-2),s.shape.slice(0,-2)).concat([h,p]);Xi(c===d,(()=>`Error in matMul: inner shapes (${c}) and (${d}) of Tensors with shapes ${a.shape} and ${s.shape} and transposeA=${i} and transposeB=${o} must match.`));const v=o?[y,p,d]:[y,d,p],A=j$({inputs:{x:a},backend:n,attrs:{shape:i?[g,c,h]:[g,h,c]}}),x=j$({inputs:{x:s},backend:n,attrs:{shape:v}}),k=i?A.shape[1]:A.shape[2],w=i?A.shape[2]:A.shape[1],S=o?x.shape[1]:x.shape[2],C=Math.max(g,y),I=n.data.get(A.dataId).values,W=n.data.get(x.dataId).values,_=ko(A.shape),T=ko(x.shape),[N,E,R]=i?[_[0],1,_[1]]:[_[0],_[1],1],[$,O,F]=o?[1,T[1],T[0]]:[T[1],1,T[0]],D=w*S,M=uf([C,w,S],A.dtype),L=M.values,B=n.blockSize;for(let P=0;P<C;P++){const e=P%g,t=P%y;for(let n=0;n<w;n+=B){const r=Math.min(n+B,w);for(let a=0;a<S;a+=B){const s=Math.min(a+B,S);for(let i=0;i<k;i+=B){const o=Math.min(i+B,k);for(let l=n;l<r;l++)for(let n=a;n<s;n++){let r=0;for(let a=i;a<o;a++){r+=I[e*N+l*E+a*R]*W[a*$+n*O+t*F]}L[P*D+(l*S+n)]+=r}}}}}return n.disposeIntermediateTensorInfo(A),n.disposeIntermediateTensorInfo(x),n.makeTensorInfo(b,M.dtype,M.values)}const X$={kernelName:sl,backendName:"cpu",kernelFunc:Q$};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Z$={kernelName:Kc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{a:a,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=r;let h,p,f;const m=[];h=Q$({inputs:{a:a,b:s},attrs:{transposeA:l,transposeB:u},backend:n}),i&&(p=SE({inputs:{a:h,b:i},backend:n}),m.push(h),h=p),c&&(f=H$(n,h,c,o,d),m.push(h),h=f);for(const g of m)n.disposeIntermediateTensorInfo(g);return h}},K$=RE(Go,(e=>Math.acos(e))),J$={kernelName:Go,backendName:"cpu",kernelFunc:K$},Y$=RE(Vo,(e=>Math.acosh(e))),eO={kernelName:Vo,backendName:"cpu",kernelFunc:Y$};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tO={kernelName:Ho,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n}=e,r=t;aE(t,"addN");const a=r.map((e=>n.data.get(e.dataId).values)),s=uf(r[0].shape,r[0].dtype),i=s.values;for(let o=0;o<r.length;o++){const e=a[o];for(let t=0;t<i.length;t++)i[t]+=e[t]}return n.makeTensorInfo(s.shape,s.dtype,s.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const nO={kernelName:jo,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;aE(a,"all");const o=io(s,a.shape);let l=o;const u=Zm(l,a.shape.length);let c=a;null!=u&&(c=OR({inputs:{x:a},backend:n,attrs:{perm:u}}),l=Jm(l.length,a.shape.length)),Xm("all",l,c.shape.length);const[d,h]=qm(c.shape,l),p=Ji(h),f=Wo(Ji(d),c.dtype),m=n.data.get(c.dataId).values;for(let y=0;y<f.length;++y){const e=y*p;let t=m[e];for(let n=0;n<p;++n){const r=m[e+n];t=t&&r}f[y]=t}null!=u&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,f);if(i){const e=j$({inputs:{x:g},backend:n,attrs:{shape:Qm(d,o)}});return n.disposeIntermediateTensorInfo(g),e}return g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const rO={kernelName:qo,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;aE(a,"any");const o=io(s,a.shape);let l=o;const u=Zm(l,a.shape.length);let c=a;null!=u&&(c=OR({inputs:{x:a},backend:n,attrs:{perm:u}}),l=Jm(l.length,a.shape.length)),Xm("any",l,c.shape.length);const[d,h]=qm(c.shape,l),p=Ji(h),f=Wo(Ji(d),c.dtype),m=n.data.get(c.dataId).values;for(let y=0;y<f.length;++y){const e=y*p;let t=m[e];for(let n=0;n<p;++n){const r=m[e+n];t=t||r}f[y]=t}null!=u&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,f);if(i){const e=j$({inputs:{x:g},backend:n,attrs:{shape:Qm(d,o)}});return n.disposeIntermediateTensorInfo(g),e}return g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const aO={kernelName:Qo,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;aE(a,"argMax");let i=io(s,a.shape);const o=Zm(i,a.shape.length);let l=a;const u=[];null!=o&&(l=OR({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Jm(i.length,l.shape.length)),i=[i[0]],Xm("argMax",i,l.shape.length);const[c,d]=qm(l.shape,i),h=Wo(Ji(c),"int32"),p=Ji(d),f=n.data.get(l.dataId).values;for(let m=0;m<h.length;++m){const e=m*p;let t=f[e],n=0;for(let r=0;r<p;++r){const a=f[e+r];a>t&&(t=a,n=r)}h[m]=n}return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(c,"int32",h)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sO={kernelName:Xo,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;aE(a,"argMin");let i=io(s,a.shape);const o=Zm(i,a.shape.length);let l=a;const u=[];null!=o&&(l=OR({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Jm(i.length,l.shape.length)),i=[i[0]],Xm("argMin",i,l.shape.length);const[c,d]=qm(l.shape,i),h=Wo(Ji(c),"int32"),p=Ji(d),f=n.data.get(l.dataId).values;for(let m=0;m<h.length;++m){const e=m*p;let t=f[e],n=0;for(let r=0;r<p;++r){const a=f[e+r];a<t&&(t=a,n=r)}h[m]=n}return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(c,"int32",h)}},iO=RE(Zo,(e=>Math.asin(e))),oO={kernelName:Zo,backendName:"cpu",kernelFunc:iO},lO=RE(Ko,(e=>Math.asinh(e))),uO={kernelName:Ko,backendName:"cpu",kernelFunc:lO},cO=RE(Jo,(e=>Math.atan(e))),dO={kernelName:Jo,backendName:"cpu",kernelFunc:cO},hO=uE(((e,t)=>Math.atan2(e,t))),pO=AE(el,hO),fO={kernelName:el,backendName:"cpu",kernelFunc:pO},mO=RE(Yo,(e=>Math.atanh(e))),gO={kernelName:Yo,backendName:"cpu",kernelFunc:mO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function yO(e,t,n,r,a,s){const i=a.strideHeight,o=a.strideWidth,l=a.dilationHeight,u=a.dilationWidth,c=a.effectiveFilterHeight,d=a.effectiveFilterWidth,h=a.padInfo.top,p=a.padInfo.left,f="max"===s?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,m=uf(a.outShape,n),g=m.values,y=a.outShape[1]*a.outShape[2]*a.outShape[3],b=a.outShape[2]*a.outShape[3],v=a.outShape[3];for(let A=0;A<a.batchSize;++A){const t=A*y,n=A*r[0];for(let m=0;m<a.inChannels;++m)for(let y=0;y<a.outHeight;++y){const A=y*i-h,x=Math.max(0,A),k=Math.min(a.inHeight,c+A),w=t+y*b;for(let t=0;t<a.outWidth;++t){const i=t*o-p,c=Math.max(0,i),h=Math.min(a.inWidth,d+i);let y=f,b=0,A=0;for(let t=x;t<k;t+=l){const a=n+t*r[1];for(let t=c;t<h;t+=u){const n=e[a+t*r[2]+m];"max"===s&&n>y?y=n:"avg"===s&&(b+=n,A++)}if(isNaN(y))break}g[w+t*v+m]="avg"===s?b/A:y}}}return m}function bO(e,t,n,r,a=!1,s=!1){const i=uf(r.outShape,"int32"),o=r.strideHeight,l=r.strideWidth,u=r.dilationHeight,c=r.dilationWidth,d=r.effectiveFilterHeight,h=r.effectiveFilterWidth,p=r.padInfo.top,f=r.padInfo.left,m=uf(t,n,e);for(let g=0;g<r.batchSize;++g)for(let e=0;e<r.inChannels;++e)for(let t=0;t<r.outHeight;++t){const n=t*o-p;let y=n;for(;y<0;)y+=u;const b=Math.min(r.inHeight,d+n);for(let o=0;o<r.outWidth;++o){const d=o*l-f;let p=d;for(;p<0;)p+=c;const v=Math.min(r.inWidth,h+d);let A=Number.NEGATIVE_INFINITY,x=-1;for(let t=y;t<b;t+=u){const i=t-n;for(let n=p;n<v;n+=c){const o=n-d,l=m.get(g,t,n,e);l>A&&(A=l,x=a?s?((g*r.inHeight+t)*r.inWidth+n)*r.inChannels+e:(t*r.inWidth+n)*r.inChannels+e:i*h+o)}}i.set(x,g,t,o,e)}}return i}function vO(e,t,n,r,a,s){const i=a.strideDepth,o=a.strideHeight,l=a.strideWidth,u=a.dilationDepth,c=a.dilationHeight,d=a.dilationWidth,h=a.effectiveFilterDepth,p=a.effectiveFilterHeight,f=a.effectiveFilterWidth,m=a.padInfo.front,g=a.padInfo.top,y=a.padInfo.left,b="max"===s?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,v=uf(a.outShape,n),A=v.values,x=a.outShape[1]*a.outShape[2]*a.outShape[3]*a.outShape[4],k=a.outShape[2]*a.outShape[3]*a.outShape[4],w=a.outShape[3]*a.outShape[4],S=a.outShape[4];for(let C=0;C<a.batchSize;++C){const t=C*x,n=C*r[0];for(let v=0;v<a.inChannels;++v)for(let x=0;x<a.outDepth;++x){const C=x*i-m;let I=C;for(;I<0;)I+=u;const W=Math.min(a.inDepth,h+C),_=t+x*k;for(let t=0;t<a.outHeight;++t){const i=t*o-g;let h=i;for(;h<0;)h+=c;const m=Math.min(a.inHeight,p+i),x=_+t*w;for(let t=0;t<a.outWidth;++t){const i=t*l-y;let o=i;for(;o<0;)o+=d;const p=Math.min(a.inWidth,f+i),g=x+t*S;let k=b,w=0,C=0;for(let t=I;t<W;t+=u){const a=n+t*r[1];for(let t=h;t<m;t+=c){const n=a+t*r[2];for(let t=o;t<p;t+=d){const a=e[n+t*r[3]+v];if("max"===s&&a>k?k=a:"avg"===s&&(w+=a,C++),isNaN(k))break}if(isNaN(k))break}if(isNaN(k))break}A[g+v]="avg"===s?w/Math.max(C,1):k}}}}return v}const AO={kernelName:tl,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;aE(a,"avgPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Xi(zf(i,1),(()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Ef(a.shape,s,i,1,o,l);let c;if(1===u.filterWidth&&1===u.filterHeight&&eo(u.inShape,u.outShape))c=pE({inputs:{x:a},backend:n});else{const e=n.data.get(a.dataId).values,t=ko(a.shape),r=yO(e,a.shape,a.dtype,t,u,"avg");c=n.makeTensorInfo(u.outShape,a.dtype,r.values)}return c}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xO={kernelName:rl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:u}=r;aE(a,"avgPool3d");const c=Rf(a.shape,s,i,1,o,l,u),d=vO(n.data.get(a.dataId).values,a.shape,a.dtype,ko(a.shape),c,"avg");return n.makeTensorInfo(d.shape,"float32",d.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kO={kernelName:al,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:u}=r;aE([a,s],"avgPool3DGrad");const c=Rf(s.shape,i,o,1,l,u),d=c.strideDepth,h=c.strideHeight,p=c.strideWidth,f=c.filterDepth,m=c.filterHeight,g=c.filterWidth,y=c.dilationDepth,b=c.dilationHeight,v=c.dilationWidth,A=c.effectiveFilterDepth,x=c.effectiveFilterHeight,k=c.effectiveFilterWidth,w=A-1-c.padInfo.front,S=k-1-c.padInfo.left,C=x-1-c.padInfo.top,I=uf(s.shape,"float32"),W=1/(f*m*g),_=n.bufferSync(a);for(let T=0;T<c.batchSize;++T)for(let e=0;e<c.inChannels;++e)for(let t=0;t<c.inDepth;++t)for(let n=0;n<c.inHeight;++n)for(let r=0;r<c.inWidth;++r){const a=t-w,s=n-C,i=r-S;let o=0;for(let t=0;t<A;t+=y){const n=(a+t)/d;if(!(n<0||n>=c.outDepth||Math.floor(n)!==n))for(let t=0;t<x;t+=b){const r=(s+t)/h;if(!(r<0||r>=c.outHeight||Math.floor(r)!==r))for(let t=0;t<k;t+=v){const a=(i+t)/p;if(a<0||a>=c.outWidth||Math.floor(a)!==a)continue;o+=_.get(T,n,r,a,e)}}}I.set(o*W,T,t,n,r,e)}return n.makeTensorInfo(I.shape,I.dtype,I.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wO={kernelName:nl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s;aE([a,s],"avgPoolGrad");const{filterSize:o,strides:l,pad:u}=r,c=Ef(i.shape,o,l,1,u),d=c.strideHeight,h=c.strideWidth,p=c.filterHeight,f=c.filterWidth,m=c.dilationHeight,g=c.dilationWidth,y=c.effectiveFilterHeight,b=c.effectiveFilterWidth,v=b-1-c.padInfo.left,A=y-1-c.padInfo.top,x=uf(i.shape,"float32"),k=1/(p*f),w=n.data.get(a.dataId).values,S=uf(a.shape,"float32",w);for(let C=0;C<c.batchSize;++C)for(let e=0;e<c.inChannels;++e)for(let t=0;t<c.inHeight;++t)for(let n=0;n<c.inWidth;++n){const r=t-A,a=n-v;let s=0;for(let t=0;t<y;t+=m){const n=(r+t)/d;if(!(n<0||n>=c.outHeight||Math.floor(n)!==n))for(let t=0;t<b;t+=g){const r=(a+t)/h;if(r<0||r>=c.outWidth||Math.floor(r)!==r)continue;s+=S.get(C,n,r,e)}}x.set(s*k,C,t,n,e)}return n.makeTensorInfo(x.shape,x.dtype,x.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const SO={kernelName:Jl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,scale:s,offset:i,mean:o,variance:l}=t;Xi(o.shape.length===l.shape.length,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),Xi(null==i||o.shape.length===i.shape.length,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),Xi(null==s||o.shape.length===s.shape.length,(()=>"Batch normalization gradient requires mean and scale to have equal ranks.")),aE([a,o,l,s,i],"batchNorm");let{varianceEpsilon:u}=r;null==u&&(u=.001);const c=n.data.get(a.dataId).values,d=n.data.get(o.dataId).values,h=n.data.get(l.dataId).values,p=s?n.data.get(s.dataId).values:new Float32Array([1]),f=i?n.data.get(i.dataId).values:new Float32Array([0]),m=new Float32Array(c.length),g=f.length,y=p.length,b=h.length,v=d.length;let A=0,x=0,k=0,w=0;for(let S=0;S<c.length;++S)m[S]=f[A++]+(c[S]-d[x++])*p[k++]/Math.sqrt(h[w++]+u),A>=g&&(A=0),x>=v&&(x=0),k>=y&&(k=0),w>=b&&(w=0);return n.makeTensorInfo(a.shape,a.dtype,m)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const CO={kernelName:il,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,crops:i}=r;aE([a],"batchToSpaceND");const o=s.reduce(((e,t)=>e*t)),l=Mx(a.shape,s,o),u=Lx(l.length,s.length),c=Bx(a.shape,s,o),d=Px(i,s.length),h=zx(c,i,s.length),p=j$({inputs:{x:a},backend:n,attrs:{shape:l}}),f=OR({inputs:{x:p},backend:n,attrs:{perm:u}}),m=j$({inputs:{x:f},backend:n,attrs:{shape:c}}),g=a$({inputs:{x:m},backend:n,attrs:{begin:d,size:h}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const IO={kernelName:ol,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:i}=r,o=IE(n.data.get(a.dataId).values,n.data.get(s.dataId).values,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,o)}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const WO={kernelName:cl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{s0:r,s1:a}=t,s=n.data.get(r.dataId).values,i=n.data.get(a.dataId).values,o=Om(Array.from(s),Array.from(i));return n.makeTensorInfo([o.length],"int32",Int32Array.from(o))}},_O=RE(pl,((e,t)=>{const n=t;return e>n.clipValueMax?n.clipValueMax:e<n.clipValueMin?n.clipValueMin:e})),TO={kernelName:pl,backendName:"cpu",kernelFunc:_O},NO={kernelName:ml,backendName:"cpu",kernelFunc:e=>{const{x:t}=e.inputs,n=e.backend,r=new Float32Array(Ji(t.shape)),a=n.data.get(t.dataId),s=a.complexTensorInfos.real,i=a.complexTensorInfos.imag,o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values;for(let u=0;u<o.length;u++){const e=o[u],t=l[u];r[u]=Math.hypot(e,t)}return n.makeOutput(r,t.shape,"float32")}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function EO(e){const{inputs:t,backend:n}=e,{input:r}=t,a=n.data.get(r.dataId).complexTensorInfos.imag,s=n.data.get(a.dataId).values;return n.makeTensorInfo(a.shape,a.dtype,s)}const RO={kernelName:su,backendName:"cpu",kernelFunc:EO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function $O(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r,s=io(a,t[0].shape)[0];Wx(t.map((e=>e.shape)),s);let i=_x(t.map((e=>e.shape)),s);if(0===Ji(i))return n.makeTensorInfo(i,t[0].dtype,[]);const o=t.filter((e=>Ji(e.shape)>0));if(1===o.length)return pE({inputs:{x:o[0]},backend:n});if("complex64"===o[0].dtype){const e=o.map((e=>mE({inputs:{input:e},backend:n}))),t=o.map((e=>EO({inputs:{input:e},backend:n}))),r=$O({inputs:e,backend:n,attrs:{axis:s}}),a=$O({inputs:t,backend:n,attrs:{axis:s}}),i=cE({inputs:{real:r,imag:a},backend:n});return e.forEach((e=>n.disposeIntermediateTensorInfo(e))),t.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(a),i}const l=o.map((e=>{const t=Ji(e.shape.slice(s));return j$({inputs:{x:e},backend:n,attrs:{shape:[-1,t]}})})),u=l.map((e=>({vals:n.data.get(e.dataId).values,shape:e.shape})));i=_x(l.map((e=>e.shape)),1);const c=1===l[0].shape[0],d=ME(u,i,t[0].dtype,c),h=_x(o.map((e=>e.shape)),s),p=n.makeTensorInfo(h,t[0].dtype,d);return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),p}const OO={kernelName:gl,backendName:"cpu",kernelFunc:$O};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function FO(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:u,dimRoundingMode:c}=r;aE([a,s],"conv2d");const d=Vf(l),h=$f(a.shape,s.shape,i,u,o,c,!1,d),p=h.filterHeight,f=h.filterWidth,m=h.dilationHeight,g=h.dilationWidth,y=h.padInfo.left,b=h.padInfo.top,v="channelsLast"===h.dataFormat,A=new dh(h.outShape,a.dtype),x=ko(a.shape),k=ko(s.shape),w=x[0],S=v?x[1]:x[2],C=v?x[2]:1,I=v?1:x[1],W=A.strides[0],_=v?A.strides[1]:A.strides[2],T=v?A.strides[2]:1,N=v?1:A.strides[1],E=n.data.get(a.dataId).values,R=n.data.get(s.dataId).values,$=A.values;for(let O=0;O<h.batchSize;++O){const e=O*w,t=O*W;for(let n=0;n<h.outHeight;++n){const r=t+n*_,a=n*h.strideHeight-b;for(let t=0;t<p;++t){const n=a+t*m;if(n<0||n>=h.inHeight)continue;const s=t*k[0],i=e+n*S;for(let e=0;e<h.outWidth;++e){const t=r+e*T,n=e*h.strideWidth-y;for(let e=0;e<f;++e){const r=n+e*g;if(r<0||r>=h.inWidth)continue;const a=i+r*C;let o=s+e*k[1];for(let e=0;e<h.inChannels;++e){const n=E[a+e*I];for(let e=0;e<h.outChannels;++e)$[t+e*N]+=n*R[o+e];o+=h.outChannels}}}}}}return n.makeTensorInfo(A.shape,A.dtype,$)}const DO={kernelName:yl,backendName:"cpu",kernelFunc:FO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const MO={kernelName:bl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:u,filterShape:c}=r;aE([a,s],"conv2dBackpropFilter");const d=Vf(l),h=$f(a.shape,c,i,1,o,u,!1,d),{strideHeight:p,strideWidth:f,filterHeight:m,filterWidth:g}=h,y="channelsLast"===h.dataFormat,b=new dh(h.filterShape,"float32"),v=h.padInfo.left,A=h.padInfo.top,x=n.data.get(a.dataId).values,k=n.data.get(s.dataId).values,w=new dh(a.shape,a.dtype,x),S=new dh(s.shape,s.dtype,k);for(let C=0;C<m;++C){const e=Math.max(0,Math.ceil((A-C)/p)),t=Math.min(h.outHeight,(h.inHeight+A-C)/p);for(let n=0;n<g;++n){const r=Math.max(0,Math.ceil((v-n)/f)),a=Math.min(h.outWidth,(h.inWidth+v-n)/f);for(let s=0;s<h.inChannels;++s)for(let i=0;i<h.outChannels;++i){let o=0;for(let l=0;l<h.batchSize;++l)for(let u=e;u<t;++u){const e=C+u*p-A;for(let t=r;t<a;++t){const r=n+t*f-v;o+=y?w.get(l,e,r,s)*S.get(l,u,t,i):w.get(l,s,e,r)*S.get(l,i,u,t)}}b.set(o,C,n,s,i)}}}return n.makeTensorInfo(b.shape,b.dtype,b.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const LO={kernelName:vl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:u,dimRoundingMode:c}=r;aE([a,s],"conv2dBackpropInput");const d=ko(s.shape),h=ko(a.shape);let p=Vf(u);const f=$f(i,s.shape,o,1,l,c,!1,p),m=new dh(f.inShape,"float32"),g=m.values,y=n.data.get(a.dataId).values,b=n.data.get(s.dataId).values,[v,A,x]=d,{batchSize:k,filterHeight:w,filterWidth:S,inChannels:C,inHeight:I,inWidth:W,outChannels:_,outHeight:T,outWidth:N,strideHeight:E,strideWidth:R}=f;p=f.dataFormat;const $=w-1-f.padInfo.top,O=S-1-f.padInfo.left,F="channelsLast"===p,D=m.strides[0],M=F?m.strides[1]:m.strides[2],L=F?m.strides[2]:1,B=F?1:m.strides[1],P=h[0],z=F?h[1]:h[2],G=F?h[2]:1,V=F?1:h[1];for(let U=0;U<k;++U)for(let e=0;e<C;++e)for(let t=0;t<I;++t){const n=t-$,r=Math.max(0,Math.ceil(n/E)),a=Math.min(T,(w+n)/E);for(let s=0;s<W;++s){const i=s-O,o=Math.max(0,Math.ceil(i/R)),l=Math.min(N,(S+i)/R);let u=0;for(let t=r;t<a;++t){const r=t*E-n;for(let n=o;n<l;++n){const a=P*U+z*t+G*n,s=v*(w-1-r)+A*(S-1-(n*R-i))+x*e;for(let e=0;e<_;++e){u+=y[a+V*e]*b[s+e]}}}g[D*U+M*t+L*s+B*e]=u}}return n.makeTensorInfo(m.shape,m.dtype,m.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const BO={kernelName:Al,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l}=r;aE([a,s],"conv3d");const u=Of(a.shape,s.shape,i,l,o),{filterDepth:c,filterHeight:d,filterWidth:h,dilationDepth:p,dilationHeight:f,dilationWidth:m,padInfo:g}=u,y=g.front,b=g.left,v=g.top,A=new dh(u.outShape,a.dtype),x=n.data.get(a.dataId).values,k=n.data.get(s.dataId).values,w=A.values,S=ko(a.shape),C=ko(s.shape);for(let I=0;I<u.batchSize;++I){const e=I*S[0],t=I*A.strides[0];for(let n=0;n<u.outDepth;++n){const r=t+n*A.strides[1],a=n*u.strideDepth-y;for(let t=0;t<c;++t){const n=a+t*p;if(n<0||n>=u.inDepth)continue;const s=t*C[0],i=e+n*S[1];for(let e=0;e<u.outHeight;++e){const t=r+e*A.strides[2],n=e*u.strideHeight-v;for(let e=0;e<d;++e){const r=n+e*f;if(r<0||r>=u.inHeight)continue;const a=s+e*C[1],o=i+r*S[2];for(let e=0;e<u.outWidth;++e){const n=t+e*u.outChannels,r=e*u.strideWidth-b;for(let e=0;e<h;++e){const t=r+e*m;if(t<0||t>=u.inWidth)continue;const s=a+e*C[2],i=o+t*u.inChannels;let l=s;for(let e=0;e<u.inChannels;++e){const t=x[i+e];for(let e=0;e<u.outChannels;++e)w[n+e]+=t*k[l+e];l+=u.outChannels}}}}}}}}return n.makeTensorInfo(A.shape,A.dtype,A.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const PO={kernelName:xl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,pad:o,filterShape:l}=r;aE([a,s],"conv3dBackpropFilterV2");const u=ko(a.shape),c=ko(s.shape),d=Of(a.shape,l,i,1,o),h=d.strideDepth,p=d.strideHeight,f=d.strideWidth,m=d.filterDepth,g=d.filterHeight,y=d.filterWidth,b=new dh(d.filterShape,"float32"),v=b.values,[A,x,k,w]=b.strides,S=n.data.get(s.dataId).values,[C,I,W,_]=c,T=n.data.get(a.dataId).values,[N,E,R,$]=u,O=d.padInfo.front,F=d.padInfo.left,D=d.padInfo.top;for(let M=0;M<m;++M){const e=Math.max(0,Math.ceil((O-M)/h)),t=Math.min(d.outDepth,(d.inDepth+O-M)/h),n=M*A;for(let r=0;r<g;++r){const a=Math.max(0,Math.ceil((D-r)/p)),s=Math.min(d.outHeight,(d.inHeight+D-r)/p),i=r*x+n;for(let n=0;n<y;++n){const o=Math.max(0,Math.ceil((F-n)/f)),l=Math.min(d.outWidth,(d.inWidth+F-n)/f),u=n*k+i;for(let i=0;i<d.inChannels;++i){const c=i*w+u;for(let u=0;u<d.outChannels;++u){let m=0;for(let c=0;c<d.batchSize;++c){const d=c*N,g=c*C;for(let c=e;c<t;++c){const e=(M+c*h-O)*E+d,t=c*I+g;for(let c=a;c<s;++c){const a=(r+c*p-D)*R+e,s=c*W+t;for(let e=o;e<l;++e){const t=e*_+s;m+=T[(n+e*f-F)*$+a+i]*S[t+u]}}}}v[c+u]=m}}}}}return n.makeTensorInfo(b.shape,b.dtype,b.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zO={kernelName:kl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{pad:i,strides:o,inputShape:l}=r;aE([a],"conv3dBackpropInputV2");const u=ko(a.shape),c=ko(s.shape),d=Of(l,s.shape,o,1,i),h=new dh(d.inShape,"float32"),p=h.values,[f,m,g,y]=h.strides,b=n.data.get(a.dataId).values,[v,A,x,k]=u,w=n.data.get(s.dataId).values,[S,C,I,W]=c,{batchSize:_,filterDepth:T,filterHeight:N,filterWidth:E,inChannels:R,inDepth:$,inHeight:O,inWidth:F,outChannels:D,outDepth:M,outHeight:L,outWidth:B,strideDepth:P,strideHeight:z,strideWidth:G}=d,V=T-1-d.padInfo.front,U=N-1-d.padInfo.top,H=E-1-d.padInfo.left;for(let j=0;j<_;++j)for(let e=0;e<R;++e)for(let t=0;t<$;++t){const n=t-V,r=Math.max(0,Math.ceil(n/P)),a=Math.min(M,(T+n)/P);for(let s=0;s<O;++s){const i=s-U,o=Math.max(0,Math.ceil(i/z)),l=Math.min(L,(N+i)/z);for(let u=0;u<F;++u){const c=u-H,d=Math.max(0,Math.ceil(c/G)),h=Math.min(B,(E+c)/G);let _=0;for(let t=r;t<a;++t){const r=t*P-n;for(let n=o;n<l;++n){const a=n*z-i;for(let s=d;s<h;++s){const i=v*j+A*t+x*n+k*s,o=S*(T-1-r)+C*(N-1-a)+I*(E-1-(s*G-c))+W*e;for(let e=0;e<D;++e){_+=b[i+e]*w[o+e]}}}}p[f*j+m*t+g*s+y*u+e]=_}}}return n.makeTensorInfo(h.shape,h.dtype,h.values)}},GO=RE(wl,(e=>Math.cos(e))),VO={kernelName:wl,backendName:"cpu",kernelFunc:GO},UO=RE(Sl,(e=>Math.cosh(e))),HO={kernelName:Sl,backendName:"cpu",kernelFunc:UO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jO={kernelName:Wl,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{image:a,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:u}=r,[c,d,h,p]=a.shape,f=s.shape[0],[m,g]=o,y=uf([f,m,g,p],"float32"),b=n.data.get(s.dataId).values,v=n.data.get(i.dataId).values,A=n.data.get(a.dataId).values,x=ko(a.shape),k=ko(y.shape);for(let w=0;w<f;w++){const e=4*w,t=b[e],n=b[e+1],r=b[e+2],a=b[e+3],s=v[w];if(s>=c)continue;const i=m>1?(r-t)*(d-1)/(m-1):0,o=g>1?(a-n)*(h-1)/(g-1):0;for(let c=0;c<m;c++){const e=m>1?t*(d-1)+c*i:.5*(t+r)*(d-1);if(e<0||e>d-1)for(let t=0;t<g;t++)for(let e=0;e<p;e++){const n=e+t*k[2]+c*k[1]+w*k[0];y.values[n]=u}else if("bilinear"===l){const t=Math.floor(e),r=Math.ceil(e),i=e-t;for(let e=0;e<g;e++){const l=g>1?n*(h-1)+e*o:.5*(n+a)*(h-1);if(l<0||l>h-1){for(let t=0;t<p;t++){const n=t+e*k[2]+c*k[1]+w*k[0];y.values[n]=u}continue}const d=Math.floor(l),f=Math.ceil(l),m=l-d;for(let n=0;n<p;n++){let a=n+d*x[2]+t*x[1]+s*x[0];const o=A[a];a=n+f*x[2]+t*x[1]+s*x[0];const l=A[a];a=n+d*x[2]+r*x[1]+s*x[0];const u=A[a];a=n+f*x[2]+r*x[1]+s*x[0];const h=o+(l-o)*m,p=u+(A[a]-u)*m;a=n+e*k[2]+c*k[1]+w*k[0],y.values[a]=h+(p-h)*i}}}else for(let t=0;t<g;++t){const r=g>1?n*(h-1)+t*o:.5*(n+a)*(h-1);if(r<0||r>h-1){for(let e=0;e<p;e++){const n=e+t*k[2]+c*k[1]+w*k[0];y.values[n]=u}continue}const i=Math.round(r),l=Math.round(e);for(let e=0;e<p;e++){const n=e+i*x[2]+l*x[1]+s*x[0],r=e+t*k[2]+c*k[1]+w*k[0];y.values[r]=A[n]}}}}return n.makeTensorInfo(y.shape,y.dtype,y.values)}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const qO={kernelName:Cl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;aE(a,"cumprod");const l=Zm([s],a.shape.length);let u=a;null!=l&&(u=OR({inputs:{x:a},backend:n,attrs:{perm:l}}));const c=Jm(1,a.shape.length)[0];if(c!==u.shape.length-1)throw new Error(`backend.cumprod in CPU expects an inner-most axis=${u.shape.length-1} but got axis=${c}`);const d=_h(u.dtype,"int32"),h=Io(Ji(u.shape),d),p=n.data.get(u.dataId).values,f=u.shape[u.shape.length-1],m=o?(e,t)=>e+f-t-1:(e,t)=>e+t;for(let y=0;y<p.length;y+=f)for(let e=0;e<f;e++){const t=m(y,e);if(0===e)h[t]=i?1:p[t];else{const n=m(y,e-1);h[t]=i?p[n]*h[n]:p[t]*h[n]}}const g=n.makeTensorInfo(u.shape,d,h);if(null!=l){const e=OR({inputs:{x:g},backend:n,attrs:{perm:Km(l)}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(u),e}return g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const QO={kernelName:Il,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;aE(a,"cumsum");const l=Zm([s],a.shape.length);let u=a;null!=l&&(u=OR({inputs:{x:a},backend:n,attrs:{perm:l}}));const c=Jm(1,a.shape.length)[0];if(c!==u.shape.length-1)throw new Error(`backend.cumsum in CPU expects an inner-most axis=${u.shape.length-1} but got axis=${c}`);const d=_h(u.dtype,"int32"),h=Wo(Ji(u.shape),d),p=n.data.get(u.dataId).values,f=u.shape[u.shape.length-1],m=o?(e,t)=>e+f-t-1:(e,t)=>e+t;for(let y=0;y<p.length;y+=f)for(let e=0;e<f;e++){const t=m(y,e);if(0===e)h[t]=i?0:p[t];else{const n=m(y,e-1);h[t]=i?p[n]+h[n]:p[t]+h[n]}}const g=n.makeTensorInfo(u.shape,d,h);if(null!=l){const e=OR({inputs:{x:g},backend:n,attrs:{perm:Km(l)}});return n.disposeIntermediateTensorInfo(g),n.disposeIntermediateTensorInfo(u),e}return g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const XO={kernelName:_l,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:i,binaryOutput:o}=r;if(1===a.shape.length){const e=IE(n.data.get(a.dataId).values,n.data.get(s.dataId).values,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,e)}if(2===a.shape.length){const e=WE(n.bufferSync(a),n.bufferSync(s),i,o);return n.makeTensorInfo(e.shape,s.dtype,e.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${a.shape.length}.`)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ZO={kernelName:Tl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockSize:s,dataFormat:i}=r;Xi("NHWC"===i,(()=>`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`));const o=a.shape[0],l=a.shape[1],u=a.shape[2],c=a.shape[3],d=l*s,h=u*s,p=c/(s*s),f=n.data.get(a.dataId).values,m=new Float32Array(o*d*h*p);let g=0;for(let y=0;y<o;++y)for(let e=0;e<d;++e){const t=Math.floor(e/s),n=e%s;for(let e=0;e<h;++e){const r=Math.floor(e/s),a=(n*s+e%s)*p;for(let e=0;e<p;++e){const n=e+a+c*(r+u*(t+l*y));m[g++]=f[n]}}}return n.makeTensorInfo([o,d,h,p],a.dtype,m)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function KO(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:u}=r;aE([a,s],"depthwiseConv2DNative");const c=ko(a.shape),d=ko(s.shape);let h=l;null==h&&(h=[1,1]),Xi(zf(i,h),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${h}'`));const p=$f(a.shape,s.shape,i,h,o,u,!0),{filterHeight:f,filterWidth:m,dilationHeight:g,dilationWidth:y,padInfo:b}=p,v=b.left,A=b.top,x=p.outChannels/p.inChannels,k=new dh(p.outShape,a.dtype),w=n.data.get(a.dataId).values,S=n.data.get(s.dataId).values,C=k.values;for(let I=0;I<p.batchSize;++I){const e=I*c[0],t=I*k.strides[0];for(let n=0;n<p.outHeight;++n){const r=t+n*k.strides[1],a=n*p.strideHeight-A;for(let t=0;t<f;++t){const n=a+t*g;if(n<0||n>=p.inHeight)continue;const s=t*d[0],i=e+n*c[1];for(let e=0;e<p.outWidth;++e){const t=r+e*k.strides[2],n=e*p.strideWidth-v;for(let e=0;e<m;++e){const r=n+e*y;if(r<0||r>=p.inWidth)continue;const a=s+e*d[1],o=i+r*p.inChannels;let l=t,u=a;for(let e=0;e<p.inChannels;++e){const t=w[o+e];for(let e=0;e<x;++e)C[l+e]+=t*S[u+e];l+=x,u+=x}}}}}}return n.makeTensorInfo(k.shape,k.dtype,k.values)}const JO={kernelName:Nl,backendName:"cpu",kernelFunc:KO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const YO={kernelName:El,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:u,filterShape:c}=r;aE([a,s],"depthwiseConv2dNativeBackpropFilter");const d=$f(a.shape,c,i,o,l,u,!0),{strideHeight:h,strideWidth:p,filterHeight:f,filterWidth:m}=d,g=new dh(d.filterShape,"float32"),y=d.padInfo.left,b=d.padInfo.top,v=d.outChannels/d.inChannels,A=n.data.get(a.dataId).values,x=new dh(a.shape,a.dtype,A),k=n.data.get(s.dataId).values,w=new dh(s.shape,s.dtype,k);for(let S=0;S<f;++S){const e=Math.max(0,Math.ceil((b-S)/h)),t=Math.min(d.outHeight,(d.inHeight+b-S)/h);for(let n=0;n<m;++n){const r=Math.max(0,Math.ceil((y-n)/p)),a=Math.min(d.outWidth,(d.inWidth+y-n)/p);for(let s=0;s<d.outChannels;++s){const i=Math.trunc(s/v),o=s%v;let l=0;for(let u=0;u<d.batchSize;++u)for(let o=e;o<t;++o){const e=S+o*h-b;for(let t=r;t<a;++t){const r=n+t*p-y;l+=x.get(u,e,r,i)*w.get(u,o,t,s)}}g.set(l,S,n,i,o)}}}return n.makeTensorInfo(g.shape,g.dtype,g.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const eF={kernelName:Rl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:u,inputShape:c}=r;aE([a,s],"depthwiseConv2DNativeBackpropInput");const d=ko(a.shape),h=ko(s.shape),p=$f(c,s.shape,i,o,l,u,!0),f=new dh(p.inShape,"float32"),m=f.values,[g,y,b]=f.strides,v=n.data.get(a.dataId).values,[A,x,k]=d,w=n.data.get(s.dataId).values,[S,C,I]=h,{batchSize:W,filterHeight:_,filterWidth:T,inChannels:N,inHeight:E,inWidth:R,outChannels:$,outHeight:O,outWidth:F,strideHeight:D,strideWidth:M}=p,L=_-1-p.padInfo.top,B=T-1-p.padInfo.left,P=$/N;for(let z=0;z<W;++z)for(let e=0;e<N;++e)for(let t=0;t<E;++t){const n=t-L,r=Math.max(0,Math.ceil(n/D)),a=Math.min(O,(_+n)/D);for(let s=0;s<R;++s){const i=s-B,o=Math.max(0,Math.ceil(i/M)),l=Math.min(F,(T+i)/M);let u=0;for(let t=r;t<a;++t){const r=t*D-n;for(let n=o;n<l;++n){const a=A*z+x*t+k*n,s=S*(_-1-r)+C*(T-1-(n*M-i))+I*e;for(let t=0;t<P;++t){u+=v[a+(e*P+t)]*w[s+t]}}}m[g*z+y*t+b*s+e]=u}}return n.makeTensorInfo(f.shape,f.dtype,f.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tF={kernelName:$l,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=Ji(r.shape),s=n.data.get(r.dataId).values,i=uf([a,a],r.dtype),o=i.values;for(let u=0;u<s.length;u++)o[u*a+u]=s[u];const l=[...r.shape,...r.shape];return n.makeTensorInfo(l,i.dtype,i.values)}},nF={kernelName:Ol,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r,filter:a}=e,{strides:s,pad:i,dilations:o}=n,l=t,u=l.data.get(r.dataId).values,c=r.shape.length,d=l.data.get(a.dataId).values,h=a.shape.length,{batchSize:p,inHeight:f,inWidth:m,inChannels:g,outHeight:y,outWidth:b,padInfo:v,strideHeight:A,strideWidth:x,filterHeight:k,filterWidth:w,dilationHeight:S,dilationWidth:C,outShape:I}=Nf(r.shape,a.shape,s,i,"NHWC",o),W=Ji(I),_=I.length,T=uo(r.dtype,W);for(let N=0;N<p;++N)for(let e=0;e<y;++e){const t=e*A-v.top;for(let n=0;n<b;++n){const s=n*x-v.left;for(let i=0;i<g;++i){let o=Number.MIN_SAFE_INTEGER;for(let e=0;e<k;++e){const n=t+e*S;if(n>=0&&n<f)for(let t=0;t<w;++t){const l=s+t*C;if(l>=0&&l<m){const s=No([N,n,l,i],c,ko(r.shape)),p=No([e,t,i],h,ko(a.shape)),f=u[s]+d[p];f>o&&(o=f)}}}T[No([N,e,n,i],_,ko(I))]=o}}}return{dataId:l.write(Zd(T,r.dtype),I,r.dtype),shape:I,dtype:r.dtype}}},rF={kernelName:Dl,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r,filter:a,dy:s}=e,{strides:i,pad:o,dilations:l}=n,u=t,c=So(r.shape,u.data.get(r.dataId).values),d=So(a.shape,u.data.get(a.dataId).values),{batchSize:h,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:y,padInfo:b,strideHeight:v,strideWidth:A,filterHeight:x,filterWidth:k,dilationHeight:w,dilationWidth:S,outShape:C}=Nf(r.shape,a.shape,i,o,"NHWC",l);Xi(s.rank===C.length,(()=>`Error in ${Dl}, dy must have the same rank as output ${C.length}, but got ${s.rank}`));const I=So(C,u.data.get(s.dataId).values),W=_o(a.shape,a.dtype);for(let _=0;_<h;++_)for(let e=0;e<g;++e){const t=e*v-b.top;for(let n=0;n<y;++n){const r=n*A-b.left;for(let a=0;a<m;++a){let s=Number.MIN_SAFE_INTEGER,i=0,o=0;for(let e=0;e<x;++e){const n=t+e*w;if(n>=0&&n<p)for(let t=0;t<k;++t){const l=r+t*S;if(l>=0&&l<f){const r=c[_][n][l][a]+d[e][t][a];r>s&&(s=r,i=e,o=t)}}}W[i][o][a]+=I[_][e][n][a]}}}return{dataId:u.write(Zd(W,r.dtype),a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}},aF={kernelName:Fl,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r,filter:a,dy:s}=e,{strides:i,pad:o,dilations:l}=n,u=t,c=So(r.shape,u.data.get(r.dataId).values),d=So(a.shape,u.data.get(a.dataId).values),{batchSize:h,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:y,padInfo:b,strideHeight:v,strideWidth:A,filterHeight:x,filterWidth:k,dilationHeight:w,dilationWidth:S,outShape:C}=Nf(r.shape,a.shape,i,o,"NHWC",l);Xi(s.rank===C.length,(()=>`Error in ${Fl}, dy must have the same rank as output ${C.length}, but got ${s.rank}`));const I=So(C,u.data.get(s.dataId).values),W=_o(r.shape,r.dtype);for(let _=0;_<h;++_)for(let e=0;e<g;++e){const t=e*v-b.top;for(let n=0;n<y;++n){const r=n*A-b.left;for(let a=0;a<m;++a){let s=Number.MIN_SAFE_INTEGER,i=t<0?0:t,o=r<0?0:r;for(let e=0;e<x;++e){const n=t+e*w;if(n>=0&&n<p)for(let t=0;t<k;++t){const l=r+t*S;if(l>=0&&l<f){const r=c[_][n][l][a]+d[e][t][a];r>s&&(s=r,i=n,o=l)}}}W[_][i][o][a]+=I[_][e][n][a]}}}return{dataId:u.write(Zd(W,r.dtype),r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sF={kernelName:Ml,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{image:a}=t,{canvas:s,options:i}=r,{contextOptions:o,imageOptions:l}=i||{},u=(null==l?void 0:l.alpha)||1,c=(null==o?void 0:o.contextType)||"2d";if("2d"!==c)throw new Error(`Context type ${o.contextType} is not supported by the CPU backend.`);const d=s.getContext(c,(null==o?void 0:o.contextAttributes)||{});if(null==d)throw new Error(`Could not get the context with ${c} type.`);const[h,p]=a.shape.slice(0,2),f=2===a.shape.length?1:a.shape[2],m=n.data.get(a.dataId).values,g="float32"===a.dtype?255:1,y=new Uint8ClampedArray(p*h*4);for(let v=0;v<h*p;++v){const e=[0,0,0,255*u];for(let n=0;n<f;n++){const t=m[v*f+n];if("float32"===a.dtype){if(t<0||t>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${t}.`)}else if("int32"===a.dtype&&(t<0||t>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${t}.`);1===f?(e[0]=t*g,e[1]=t*g,e[2]=t*g):e[n]=t*g}const t=4*v;y[t+0]=Math.round(e[0]),y[t+1]=Math.round(e[1]),y[t+2]=Math.round(e[2]),y[t+3]=Math.round(e[3])}s.width=p,s.height=h;const b=new ImageData(y,p,h);return d.putImageData(b,0,0),a}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function iF(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;let o;aE(a,"sum"),o="bool"===a.dtype?bE({inputs:{x:a},backend:n,attrs:{dtype:"int32"}}):pE({inputs:{x:a},backend:n});const l=o.shape.length,u=io(s,o.shape),c=Zm(u,l);let d=u,h=o;null!=c&&(h=OR({inputs:{x:o},backend:n,attrs:{perm:c}}),d=Jm(d.length,l)),Xm("sum",d,h.shape.length);const[p,f]=qm(h.shape,d);let m=hE(n,p,_h(h.dtype,"int32"));const g=Ji(f),y=n.data.get(m.dataId).values,b=n.data.get(h.dataId).values;for(let v=0;v<y.length;++v){const e=v*g;let t=0;for(let n=0;n<g;++n)t+=b[e+n];y[v]=t}if(i){const e=m;m=j$({inputs:{x:m},backend:n,attrs:{shape:Qm(m.shape,u)}}),n.disposeIntermediateTensorInfo(e)}return n.disposeIntermediateTensorInfo(o),null!=c&&n.disposeIntermediateTensorInfo(h),m}const oF={kernelName:xc,backendName:"cpu",kernelFunc:iF};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lF={kernelName:Bl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{equation:a}=r,s=t,{allDims:i,summedDims:o,idDims:l}=ik(a,s.length);lk(i.length,l,s);const{path:u,steps:c}=uk(o,l),d=c.length;let h=null,p=i.length;const f=[];for(let m=0;m<d;++m){for(const e of c[m]){const{permutationIndices:t,expandDims:r}=ok(p,l[e]);let a;ck(t)?a=s[e]:(a=OR({inputs:{x:s[e]},backend:n,attrs:{perm:t}}),f.push(a));const i=a.shape.slice();for(let e=0;e<r.length;++e)i.splice(r[e],0,1);eo(a.shape,i)||(a=j$({inputs:{x:a},backend:n,attrs:{shape:i}}),f.push(a)),null===h?h=a:(h=IR({inputs:{a:a,b:h},backend:n}),f.push(h))}m<d-1&&(u[m]>=0&&(h=iF({inputs:{x:h},backend:n,attrs:{axis:u[m]-(i.length-p),keepDims:!1}}),f.push(h)),p--)}for(const m of f)m!==h&&n.disposeIntermediateTensorInfo(m);return h}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uF={kernelName:zl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{dy:r,y:a}=t;aE([r,a],"eluGrad");const s=new Float32Array(Ji(a.shape)),i=n.data.get(a.dataId).values,o=n.data.get(r.dataId).values;for(let l=0;l<i.length;++l){const e=i[l];s[l]=e>=0?o[l]:o[l]*(e+1)}return n.makeTensorInfo(a.shape,"float32",s)}},cF=Ux,dF=Hx,hF=jx,pF=qx,fF=Qx,mF=Xx,gF=RE(Gl,(e=>{const t=Math.sign(e),n=Math.abs(e),r=1/(1+cF*n);return t*(1-((((mF*r+fF)*r+pF)*r+hF)*r+dF)*r*Math.exp(-n*n))})),yF={kernelName:Gl,backendName:"cpu",kernelFunc:gF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function bF(e){const{inputs:t,backend:n,attrs:r}=e,{input:a}=t,{dim:s}=r,i=a.shape.length,o=a.shape.slice();let l=s;return s<0&&(Xi(-(i+1)<=s,(()=>`Axis must be in the interval [${-(i+1)}, ${i}]`)),l=i+s+1),o.splice(l,0,1),j$({inputs:{x:a},backend:n,attrs:{shape:o}})}const vF={kernelName:Hl,backendName:"cpu",kernelFunc:bF},AF=uE(((e,t)=>e/t)),xF=AE(Ll,AF),kF={kernelName:Ll,backendName:"cpu",kernelFunc:xF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function wF(e,t,n){const r=e.shape,a=r[0],s=r[1],i=n.data.get(e.dataId),o=i.complexTensorInfos.real,l=i.complexTensorInfos.imag,u=[a,s],c=Ji(u),d=lo("float32",c),h=lo("float32",c);for(let g=0;g<a;g++){const e=a$({inputs:{x:o},backend:n,attrs:{begin:[g,0],size:[1,s]}}),r=a$({inputs:{x:l},backend:n,attrs:{begin:[g,0],size:[1,s]}}),a=cE({inputs:{real:e,imag:r},backend:n}),{real:i,imag:u}=SF(a,t,n),c=Zx(i,u);for(let t=0;t<s;t++){const e=ek(c,t);d[g*s+t]=e.real,h[g*s+t]=e.imag}n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(r),n.disposeIntermediateTensorInfo(a)}const p=n.makeTensorInfo(u,"float32",d),f=n.makeTensorInfo(u,"float32",h),m=cE({inputs:{real:p,imag:f},backend:n});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),m}function SF(e,t,n){const r=Ji(e.shape),a=n.data.get(e.dataId),s=n.data.get(a.complexTensorInfos.real.dataId).values,i=n.data.get(a.complexTensorInfos.imag.dataId).values;if((o=r)&o-1){const e=function(e,t,n){const r=new Float32Array(2*t);for(let a=0;a<t;a++){let s=0,i=0;for(let r=0;r<t;r++){const o=rk(a*r,t,n),l=ek(e,r);s+=l.real*o.real-l.imag*o.imag,i+=l.real*o.imag+l.imag*o.real}n&&(s/=t,i/=t),tk(r,s,i,a)}return r}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(Zx(s,i),r,t);return Kx(e)}{const a=CF(s,i,r,t,n),o=[e.shape[0],e.shape[1]];if(t){const e=n.makeTensorInfo(o,"float32",a.real),t=n.makeTensorInfo(o,"float32",a.imag),s=n.makeTensorInfo([],"float32",Xd(r,"float32")),i=pE({inputs:{x:s},backend:n}),l=kF.kernelFunc({inputs:{a:e,b:s},backend:n}),u=kF.kernelFunc({inputs:{a:t,b:i},backend:n}),c=n.data.get(l.dataId).values,d=n.data.get(u.dataId).values;return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(u),{real:c,imag:d}}return a}var o}function CF(e,t,n,r,a){if(1===n)return{real:e,imag:t};const s=Zx(e,t),i=n/2,o=Jx(s),l=o.real,u=o.imag,c=[l.length],d=a.makeTensorInfo(c,"float32",l),h=a.makeTensorInfo(c,"float32",u),p=cE({inputs:{real:d,imag:h},backend:a}),f=Yx(s),m=f.real,g=f.imag,y=[m.length],b=a.makeTensorInfo(y,"float32",m),v=a.makeTensorInfo(y,"float32",g),A=cE({inputs:{real:b,imag:v},backend:a}),x=CF(l,u,i,r,a),k=x.real,w=x.imag,S=[k.length],C=a.makeTensorInfo(S,"float32",k),I=a.makeTensorInfo(S,"float32",w),W=cE({inputs:{real:C,imag:I},backend:a}),_=CF(m,g,i,r,a),T=_.real,N=_.imag,E=[T.length],R=a.makeTensorInfo(E,"float32",T),$=a.makeTensorInfo(E,"float32",N),O=cE({inputs:{real:R,imag:$},backend:a}),F=nk(n,r),D=[F.real.length],M=a.makeTensorInfo(D,"float32",F.real),L=a.makeTensorInfo(D,"float32",F.imag),B=cE({inputs:{real:M,imag:L},backend:a}),P=IR({inputs:{a:B,b:O},backend:a}),z=SE({inputs:{a:W,b:P},backend:a}),G=I$({inputs:{a:W,b:P},backend:a}),V=mE({inputs:{input:z},backend:a}),U=mE({inputs:{input:G},backend:a}),H=EO({inputs:{input:z},backend:a}),j=EO({inputs:{input:G},backend:a}),q=$O({inputs:[V,U],backend:a,attrs:{axis:0}}),Q=$O({inputs:[H,j],backend:a,attrs:{axis:0}}),X=a.data.get(q.dataId).values,Z=a.data.get(Q.dataId).values;return a.disposeIntermediateTensorInfo(d),a.disposeIntermediateTensorInfo(h),a.disposeIntermediateTensorInfo(p),a.disposeIntermediateTensorInfo(b),a.disposeIntermediateTensorInfo(v),a.disposeIntermediateTensorInfo(A),a.disposeIntermediateTensorInfo(C),a.disposeIntermediateTensorInfo(I),a.disposeIntermediateTensorInfo(W),a.disposeIntermediateTensorInfo(R),a.disposeIntermediateTensorInfo($),a.disposeIntermediateTensorInfo(O),a.disposeIntermediateTensorInfo(M),a.disposeIntermediateTensorInfo(L),a.disposeIntermediateTensorInfo(B),a.disposeIntermediateTensorInfo(P),a.disposeIntermediateTensorInfo(z),a.disposeIntermediateTensorInfo(G),a.disposeIntermediateTensorInfo(V),a.disposeIntermediateTensorInfo(H),a.disposeIntermediateTensorInfo(U),a.disposeIntermediateTensorInfo(j),a.disposeIntermediateTensorInfo(q),a.disposeIntermediateTensorInfo(Q),{real:X,imag:Z}}const IF={kernelName:ql,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t,a=Ji(r.shape),s=r.shape[r.shape.length-1],i=j$({inputs:{x:r},backend:n,attrs:{shape:[a/s,s]}}),o=wF(i,!1,n),l=j$({inputs:{x:o},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function WF(e){const{backend:t,attrs:n}=e,{shape:r,value:a,dtype:s}=n,i=s||vo(a),o=uo(i,Ji(r));return function(e,t){e.fill(t)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(o,a),t.makeTensorInfo(r,i,o)}const _F={kernelName:Ql,backendName:"cpu",kernelFunc:WF};const TF={kernelName:Xl,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:r}=e,a=n,s=lo(r.dtype,Ji(r.shape)),[i,o,l,u]=r.shape,c=a.data.get(r.dataId).values;for(let d=0;d<i;d++){const e=d*l*o*u;for(let t=0;t<o;t++){const n=t*(l*u);for(let t=0;t<l;t++){const r=t*u;for(let a=0;a<u;a++){const i=Math.round(l-t-1),o=e+n+r+a;let d=c[o];if(i>=0&&i<l){d=c[e+n+i*u+a]}s[o]=d}}}}return{dataId:a.write(s,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const NF={kernelName:Jc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=r;let m=FO({inputs:{x:a,filter:s},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h}});if(i){const e=m;if("NCHW"===c&&1===i.shape.length&&1!==i.shape[0]){const e=j$({inputs:{x:i},backend:n,attrs:{shape:[i.shape[0],1,1]}});m=SE({inputs:{a:m,b:e},backend:n}),n.disposeIntermediateTensorInfo(e)}else m=SE({inputs:{a:m,b:i},backend:n});n.disposeIntermediateTensorInfo(e)}if(p){const e=m;if("NCHW"===c&&"prelu"===p&&1===o.shape.length&&1!==o.shape[0]){const e=j$({inputs:{x:o},backend:n,attrs:{shape:[o.shape[0],1,1]}});m=H$(n,m,p,e,f),n.disposeIntermediateTensorInfo(e)}else m=H$(n,m,p,o,f);n.disposeIntermediateTensorInfo(e)}return m}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const EF={kernelName:Yc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=r;let m=KO({inputs:{x:a,filter:s},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h}});if(i){const e=m;m=SE({inputs:{a:m,b:i},backend:n}),n.disposeIntermediateTensorInfo(e)}if(p){const e=m;m=H$(n,m,p,o,f),n.disposeIntermediateTensorInfo(e)}return m}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const RF={kernelName:eu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{params:r,indices:a}=t,s=Ji(r.shape),i=a.shape,o=i[i.length-1],[l,u,c,d]=sx(r,a);if(0===u)return n.makeTensorInfo(l,r.dtype,[]);const h=YE(n.data.get(a.dataId).values,n.bufferSync(r),r.dtype,u,o,c,d,r.shape,s);return n.makeTensorInfo(l,r.dtype,h.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $F={kernelName:Yl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,indices:s}=t,{axis:i,batchDims:o}=r;aE([a,s],"gatherV2");const l=io(i,a.shape)[0],u=n.data.get(s.dataId).values,c=a.shape[l];for(let v=0;v<u.length;++v){const e=u[v];Xi(e<=c-1&&e>=0,(()=>`GatherV2: the index value ${e} is not in [0, ${c-1}]`))}let d=o;null==o&&(d=0);const h=Ji(s.shape),p=Wk(a,s,l,d),f=j$({inputs:{x:a},backend:n,attrs:{shape:[p.batchSize,p.outerSize,p.dimSize,p.sliceSize]}}),m=j$({inputs:{x:s},backend:n,attrs:{shape:[p.batchSize,h/p.batchSize]}}),g=[p.batchSize,p.outerSize,h/p.batchSize,p.sliceSize],y=n.bufferSync(m),b=eR(n.bufferSync(f),y,g);return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),n.makeTensorInfo(p.outputShape,b.dtype,b.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const OF={kernelName:au,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t,a=Ji(r.shape),s=r.shape[r.shape.length-1],i=j$({inputs:{x:r},backend:n,attrs:{shape:[a/s,s]}}),o=wF(i,!0,n),l=j$({inputs:{x:o},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}},FF=RE(iu,(e=>Number.isFinite(e)?1:0),"bool"),DF={kernelName:iu,backendName:"cpu",kernelFunc:FF},MF=RE(ou,(e=>Math.abs(e)===1/0?1:0),"bool"),LF={kernelName:ou,backendName:"cpu",kernelFunc:MF},BF=RE(lu,(e=>Number.isNaN(e)?1:0),"bool"),PF={kernelName:lu,backendName:"cpu",kernelFunc:BF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zF={kernelName:hu,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{backend:t,attrs:n}=e,{start:r,stop:a,num:s}=n,i=pR(r,a,s);return t.makeTensorInfo([i.length],"float32",i)}},GF=RE(fu,(e=>Math.log1p(e))),VF={kernelName:fu,backendName:"cpu",kernelFunc:GF},UF=uE(((e,t)=>e&&t)),HF=AE(mu,UF,null,"bool"),jF={kernelName:mu,backendName:"cpu",kernelFunc:HF},qF=RE(gu,(e=>e?0:1),"bool"),QF={kernelName:gu,backendName:"cpu",kernelFunc:qF},XF=uE(((e,t)=>e||t)),ZF=AE(yu,XF,null,"bool"),KF={kernelName:yu,backendName:"cpu",kernelFunc:ZF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const JF={kernelName:vu,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=r;aE(a,"LRN");const u=a.shape[3],c=u-1,d=n.data.get(a.dataId).values,h=Ji(a.shape),p=new Float32Array(h);function f(e){const t=e%u;let n=e-t+Math.max(0,t-s);const r=e-t+Math.min(t+s,c);let a=0;for(;n<=r;n++){const e=d[n];a+=e*e}return a}for(let m=0;m<h;m++){const e=f(m),t=d[m]*Math.pow(i+o*e,-l);p[m]=t}return n.makeTensorInfo(a.shape,a.dtype,p)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const YF={kernelName:Au,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:u,beta:c}=r;aE(i,"LRNGrad");const d=Ji(i.shape),h=i.shape[3],p=n.data.get(i.dataId).values,f=n.data.get(a.dataId).values,m=n.data.get(s.dataId).values,g=new Float32Array(d),y=d;for(let b=0;b<y;b++){const e=b%h,t=b-e+Math.max(0,e-o),n=b-e+Math.min(h,e+o+1);let r=0;for(let a=t;a<n;a++)r+=Math.pow(f[a],2);r=u*r+l;for(let a=t;a<n;a++){let e=-2*u*c*f[a]*m[b]/r;b===a&&(e+=Math.pow(r,-c)),e*=p[b],g[a]+=e}}return n.makeTensorInfo(i.shape,a.dtype,g)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function eD(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reductionIndices:s,keepDims:i}=r,o=n;let l=a.shape;const u=l.length,c=io(s,l);let d=c;const h=Zm(d,u);let p=o.data.get(a.dataId).values;if(null!=h){const e=new Array(u);for(let t=0;t<e.length;t++)e[t]=l[h[t]];p=$R(p,l,a.dtype,h,e),d=Jm(d.length,u),l=e}aE(a,"max"),Xm("max",d,u);const[f,m]=qm(l,d),g=yR(p,Ji(m),f,a.dtype),y=o.write(g,f,a.dtype);let b=f;if(i){b=Qm(f,c)}return{dataId:y,shape:b,dtype:a.dtype}}const tD={kernelName:xu,backendName:"cpu",kernelFunc:eD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const nD={kernelName:wu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;aE(a,"maxPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Xi(zf(i,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Ef(a.shape,s,i,1,o,l);let c;if(1===u.filterWidth&&1===u.filterHeight&&eo(u.inShape,u.outShape))c=pE({inputs:{x:a},backend:n});else{const e=n.data.get(a.dataId).values,t=ko(a.shape),r=yO(e,a.shape,a.dtype,t,u,"max");c=n.makeTensorInfo(u.outShape,a.dtype,r.values)}return c}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const rD={kernelName:Cu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:u}=r;aE(a,"maxPool3d");const c=Rf(a.shape,s,i,1,o,l,u),d=vO(n.data.get(a.dataId).values,a.shape,a.dtype,ko(a.shape),c,"max");return n.makeTensorInfo(d.shape,"float32",d.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const aD={kernelName:Iu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,{filterSize:i,strides:o,pad:l,dimRoundingMode:u}=r;aE([a,s],"maxPool3DGrad");const c=Rf(s.shape,i,o,1,l,u),d=function(e,t){const n=uf(t.outShape,"int32"),r=t.strideDepth,a=t.strideHeight,s=t.strideWidth,i=t.dilationDepth,o=t.dilationHeight,l=t.dilationWidth,u=t.effectiveFilterDepth,c=t.effectiveFilterHeight,d=t.effectiveFilterWidth,h=t.padInfo.front,p=t.padInfo.top,f=t.padInfo.left;for(let m=0;m<t.batchSize;++m)for(let g=0;g<t.inChannels;++g)for(let y=0;y<t.outDepth;++y){const b=y*r-h;let v=b;for(;v<0;)v+=i;const A=Math.min(t.inDepth,u+b);for(let r=0;r<t.outHeight;++r){const u=r*a-p;let h=u;for(;h<0;)h+=o;const x=Math.min(t.inHeight,c+u);for(let a=0;a<t.outWidth;++a){const p=a*s-f;let k=p;for(;k<0;)k+=l;const w=Math.min(t.inWidth,d+p);let S=Number.NEGATIVE_INFINITY,C=-1;for(let t=v;t<A;t+=i){const n=t-b;for(let r=h;r<x;r+=o){const a=r-u;for(let s=k;s<w;s+=l){const i=s-p,o=e.get(m,t,r,s,g);o>=S&&(S=o,C=n*c*d+a*c+i)}}}n.set(C,m,y,r,a,g)}}}return n}(n.bufferSync(s),c),h=c.strideDepth,p=c.strideHeight,f=c.strideWidth,m=c.dilationDepth,g=c.dilationHeight,y=c.dilationWidth,b=c.effectiveFilterDepth,v=c.effectiveFilterHeight,A=c.effectiveFilterWidth,x=b-1-c.padInfo.front,k=A-1-c.padInfo.left,w=v-1-c.padInfo.top,S=uf(s.shape,"float32"),C=n.bufferSync(a);for(let I=0;I<c.batchSize;++I)for(let e=0;e<c.inChannels;++e)for(let t=0;t<c.inDepth;++t)for(let n=0;n<c.inHeight;++n)for(let r=0;r<c.inWidth;++r){const a=t-x,s=n-w,i=r-k;let o=0;for(let t=0;t<b;t+=m){const n=(a+t)/h;if(!(n<0||n>=c.outDepth||Math.floor(n)!==n))for(let r=0;r<v;r+=g){const a=(s+r)/p;if(!(a<0||a>=c.outHeight||Math.floor(a)!==a))for(let s=0;s<A;s+=y){const l=(i+s)/f;if(l<0||l>=c.outWidth||Math.floor(l)!==l)continue;const u=b*v*A-1-d.get(I,n,a,l,e)===t*v*A+r*A+s?1:0;if(0===u)continue;o+=C.get(I,n,a,l,e)*u}}}S.set(o,I,t,n,r,e)}return n.makeTensorInfo(S.shape,S.dtype,S.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sD={kernelName:Su,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s,output:i}=t,o=s;aE([s,i],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=r,h=Ef(o.shape,l,u,1,c,d),p=n.data.get(o.dataId).values,f=uf(h.outShape,o.dtype,bO(p,o.shape,o.dtype,h).values),m=h.strideHeight,g=h.strideWidth,y=h.dilationHeight,b=h.dilationWidth,v=h.effectiveFilterHeight,A=h.effectiveFilterWidth,x=A-1-h.padInfo.left,k=v-1-h.padInfo.top,w=uf(o.shape,"float32"),S=n.data.get(a.dataId).values,C=uf(a.shape,"float32",S);for(let I=0;I<h.batchSize;++I)for(let e=0;e<h.inChannels;++e)for(let t=0;t<h.inHeight;++t)for(let n=0;n<h.inWidth;++n){const r=t-k,a=n-x;let s=0;for(let t=0;t<v;t+=y){const n=(r+t)/m;if(!(n<0||n>=h.outHeight||Math.floor(n)!==n))for(let r=0;r<A;r+=b){const i=(a+r)/g;if(i<0||i>=h.outWidth||Math.floor(i)!==i)continue;const o=v*A-1-f.get(I,n,i,e)===t*A+r?1:0;if(0===o)continue;s+=C.get(I,n,i,e)*o}}w.set(s,I,t,n,e)}return n.makeTensorInfo(w.shape,w.dtype,w.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const iD={kernelName:Wu,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:r}=e,{filterSize:a,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;aE(r,"MaxPoolWithArgmax");const u=l.data.get(r.dataId).values,c=Ef(r.shape,a,s,[1,1],i),[d,h]=function(e,t,n,r,a){const s=yO(e,0,n,ko(t),a,"max"),i=bO(e,t,n,a,!0,r);return[s.values,i.values]}(u,r.shape,r.dtype,o,c),p=l.write(d,c.outShape,r.dtype),f=l.write(h,c.outShape,r.dtype);return[{dataId:p,shape:c.outShape,dtype:r.dtype},{dataId:f,shape:c.outShape,dtype:"int32"}]}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const oD={kernelName:_u,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=io(s,a.shape),l=Ji(qm(a.shape,o)[1]),u=[],c=n.makeTensorInfo([],"float32",new Float32Array([l]));u.push(c);const d=bE({inputs:{x:a},backend:n,attrs:{dtype:"float32"}});u.push(d);const h=xF({inputs:{a:d,b:c},backend:n});u.push(h);const p=iF({inputs:{x:h},backend:n,attrs:{axis:s,keepDims:i}});return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),p}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lD={kernelName:Tu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;aE(a,"min");const o=io(s,a.shape);let l=o;const u=Zm(l,a.shape.length);let c=a;null!=u&&(c=OR({inputs:{x:a},backend:n,attrs:{perm:u}}),l=Jm(l.length,a.shape.length)),Xm("min",l,c.shape.length);const[d,h]=qm(c.shape,l),p=Ji(h),f=Wo(Ji(d),c.dtype),m=n.data.get(c.dataId).values;for(let y=0;y<f.length;++y){const e=y*p;let t=m[e];for(let n=0;n<p;++n){const r=m[e+n];(Number.isNaN(r)||r<t)&&(t=r)}f[y]=t}null!=u&&n.disposeIntermediateTensorInfo(c);const g=n.makeTensorInfo(d,c.dtype,f);if(i){const e=j$({inputs:{x:g},backend:n,attrs:{shape:Qm(d,o)}});return n.disposeIntermediateTensorInfo(g),e}return g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uD={kernelName:Eu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{paddings:s,mode:i}=r;aE(a,"mirrorPad");const o=s.map(((e,t)=>e[0]+a.shape[t]+e[1])),l=s.map((e=>e[0])),u=s.map(((e,t)=>e[0]+a.shape[t])),c="reflect"===i?0:1,d=n.data.get(a.dataId).values,h=a.shape.length,p=ko(a.shape),f=Ji(o),m=o.length,g=ko(o),y=lo(a.dtype,f);for(let b=0;b<f;b++){let e=Eo(b,m,g);for(let n=0;n<m;n++)e[n]<l[n]?e[n]=2*l[n]-e[n]-c:e[n]>=u[n]&&(e[n]=2*(u[n]-1)-e[n]+c);e=e.map(((e,t)=>e-l[t]));const t=No(e,h,p);y[b]=d[t]}return{dataId:n.write(y,o,a.dtype),shape:o,dtype:a.dtype}}},cD=uE(((e,t)=>{const n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t})),dD=AE(Ru,cD),hD={kernelName:Ru,backendName:"cpu",kernelFunc:dD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function pD(e){const{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{dim:s}=r,i=a.shape.length;let o=s;if(-1===o&&(o=i-1),o!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${o}`);const l=io([o],a.shape),u=eD({inputs:{x:a},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),c=Qm(u.shape,l),d=j$({inputs:{x:u},backend:n,attrs:{shape:c}}),h=I$({inputs:{a:a,b:d},backend:n}),p=GE({inputs:{x:h},backend:n}),f=iF({inputs:{x:p},backend:n,attrs:{axis:l,keepDims:!1}}),m=j$({inputs:{x:f},backend:n,attrs:{shape:c}}),g=xF({inputs:{a:p,b:m},backend:n});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),g}const fD={kernelName:Sc,backendName:"cpu",kernelFunc:pD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const mD={kernelName:$u,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{numSamples:s,seed:i,normalized:o}=r;aE(a,"multinomial");const l=o?a:pD({inputs:{logits:a},backend:n,attrs:{dim:-1}}),u=l.shape[0],c=l.shape[1],d=n.data.get(l.dataId).values,h=[u,s],p=Wo(Ji(h),"int32");for(let f=0;f<u;++f){const e=f*c,t=new Float32Array(c-1);t[0]=d[e];for(let a=1;a<t.length;++a)t[a]=t[a-1]+d[e+a];const n=Vy.alea(i.toString()),r=f*s;for(let a=0;a<s;++a){const e=n();p[r+a]=t.length;for(let n=0;n<t.length;n++)if(e<t[n]){p[r+a]=n;break}}}return o||n.disposeIntermediateTensorInfo(l),n.makeTensorInfo(h,"int32",p)}},gD=Dv;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yD={kernelName:Mu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=r;aE(a,"NonMaxSuppression");const u=n.data.get(a.dataId).values,c=n.data.get(s.dataId).values,{selectedIndices:d}=gD(u,c,i,o,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}},bD=Mv;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vD={kernelName:Lu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:u}=r;aE(a,"NonMaxSuppressionPadded");const c=n.data.get(a.dataId).values,d=n.data.get(s.dataId).values,{selectedIndices:h,validOutputs:p}=bD(c,d,i,o,l,u);return[n.makeTensorInfo([h.length],"int32",new Int32Array(h)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}},AD=Lv;
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xD={kernelName:Bu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:u}=r;aE(a,"NonMaxSuppressionWithScore");const c=n.data.get(a.dataId).values,d=n.data.get(s.dataId).values,h=i,p=o,f=l,m=u,{selectedIndices:g,selectedScores:y}=AD(c,d,h,p,f,m);return[n.makeTensorInfo([g.length],"int32",new Int32Array(g)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kD={kernelName:zu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{indices:a}=t,{dtype:s,depth:i,onValue:o,offValue:l}=r;aE(a,"oneHot");const u=Ji(a.shape),c=new Float32Array(u*i);c.fill(l);const d=n.data.get(a.dataId).values;for(let h=0;h<u;++h)d[h]>=0&&d[h]<i&&(c[h*i+d[h]]=o);return n.makeTensorInfo([...a.shape,i],s,c)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function wD(e){const{inputs:t,backend:n}=e,{x:r}=t;if("string"===r.dtype)throw new Error("zerosLike is not supported for string tensors");if("complex64"===r.dtype){const e=mE({inputs:{input:r},backend:n}),t=wD({inputs:{x:e},backend:n}),a=EO({inputs:{input:r},backend:n}),s=wD({inputs:{x:a},backend:n}),i=cE({inputs:{real:t,imag:s},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),i}return WF({backend:n,attrs:{shape:r.shape,value:0,dtype:r.dtype}})}const SD={kernelName:qc,backendName:"cpu",kernelFunc:wD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const CD={kernelName:Pu,backendName:"cpu",kernelFunc:function e(t){const{inputs:n,backend:r}=t,{x:a}=n;if("string"===a.dtype)throw new Error("onesLike is not supported for string tensors");if("complex64"===a.dtype){const t=mE({inputs:{input:a},backend:r}),n=e({inputs:{x:t},backend:r}),s=EO({inputs:{input:a},backend:r}),i=wD({inputs:{x:s},backend:r}),o=cE({inputs:{real:n,imag:i},backend:r});return r.disposeIntermediateTensorInfo(t),r.disposeIntermediateTensorInfo(n),r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(i),o}return WF({backend:r,attrs:{shape:a.shape,value:1,dtype:a.dtype}})}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ID(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r;if(1===t.length)return bF({inputs:{input:t[0]},backend:n,attrs:{dim:a}});const s=t[0].shape,i=t[0].dtype;t.forEach((e=>{Zi(s,e.shape,"All tensors passed to stack must have matching shapes"),Xi(i===e.dtype,(()=>"All tensors passed to stack must have matching dtypes"))}));const o=[],l=$O({inputs:t.map((e=>{const t=bF({inputs:{input:e},backend:n,attrs:{dim:a}});return o.push(t),t})),backend:n,attrs:{axis:a}});return o.forEach((e=>n.disposeIntermediateTensorInfo(e))),l}const WD={kernelName:Gu,backendName:"cpu",kernelFunc:ID};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _D={kernelName:Vu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{paddings:s,constantValue:i}=r;aE(a,"pad");const o=s.map(((e,t)=>e[0]+a.shape[t]+e[1])),l=s.map((e=>e[0])),u=n.data.get(a.dataId).values,c=Ji(a.shape),d=a.shape.length,h=ko(a.shape),p=Ji(o),f=o.length,m=ko(o),g=lo(a.dtype,p);0!==i&&g.fill(i);for(let y=0;y<c;y++){g[No(Eo(y,d,h).map(((e,t)=>e+l[t])),f,m)]=u[y]}return{dataId:n.write(g,o,a.dtype),shape:o,dtype:a.dtype}}},TD=uE(((e,t)=>Math.pow(e,t))),ND=AE(Uu,TD),ED={kernelName:Uu,backendName:"cpu",kernelFunc:ND};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const RD={kernelName:qu,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{paramsNestedSplits:a,paramsDenseValues:s,indices:i}=t,o=a.map((e=>n.data.get(e.dataId).values)),l=a.map((e=>e.shape)),u=n.data.get(s.dataId).values,c=n.data.get(i.dataId).values,[d,h,p]=zR(o,l,u,s.shape,s.dtype,c,i.shape),f=d.map((e=>n.makeTensorInfo([e.length],"int32",e))),m=n.makeTensorInfo(p,s.dtype,h);return f.concat([m])}};
/**
 * @license
 * Copyright 2022 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $D={kernelName:Qu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{starts:r,limits:a,deltas:s}=t,i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values,l=n.data.get(s.dataId).values,[u,c]=VR(i,r.shape,r.dtype,o,a.shape,l,s.shape);return[n.makeTensorInfo([u.length],"int32",u),n.makeTensorInfo([c.length],r.dtype,c)]}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const OD={kernelName:Xu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{shape:a,values:s,defaultValue:i,rowPartitionTensors:o}=t,{rowPartitionTypes:l}=r,u=n.data.get(a.dataId).values,c=n.data.get(s.dataId).values,d=n.data.get(i.dataId).values,h=o.map((e=>n.data.get(e.dataId).values)),p=o.map((e=>e.shape)),[f,m]=QR(u,a.shape,c,s.shape,s.dtype,d,i.shape,h,p,l);return n.makeTensorInfo(f,s.dtype,m)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const FD={kernelName:Zu,backendName:"cpu",kernelFunc:function(e){const{backend:t,attrs:n}=e,{start:r,stop:a,dtype:s,step:i}=n,o=XR(r,a,i,s);return t.makeTensorInfo([o.length],s,o)}},DD=RE(Ju,(e=>1/e)),MD={kernelName:Ju,backendName:"cpu",kernelFunc:DD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const LD={kernelName:rc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:i,size:o}=r;aE(a,"resizeBilinear");const l=ko(a.shape),[u,c]=o,[d,h,p,f]=a.shape,m=n.data.get(a.dataId).values,g=new Float32Array(Ji([d,u,c,f])),y=[s&&u>1?h-1:h,s&&c>1?p-1:p],b=[s&&u>1?u-1:u,s&&c>1?c-1:c];let v=0;const A=y[0]/b[0],x=y[1]/b[1];for(let k=0;k<d;k++)for(let e=0;e<u;e++){let t;t=i?A*(e+.5)-.5:A*e;const n=Math.max(0,Math.floor(t)),r=t-n,a=Math.min(h-1,Math.ceil(t)),s=k*l[0]+n*l[1],o=k*l[0]+a*l[1];for(let e=0;e<c;e++){let t;t=i?x*(e+.5)-.5:x*e;const n=Math.max(0,Math.floor(t)),a=t-n,u=Math.min(p-1,Math.ceil(t)),c=s+n*l[2],d=o+n*l[2],h=s+u*l[2],y=o+u*l[2];for(let e=0;e<f;e++){const t=m[c+e],n=m[d+e],s=t+(m[h+e]-t)*a,i=s+(n+(m[y+e]-n)*a-s)*r;g[v++]=i}}}return n.makeTensorInfo([d,u,c,f],"float32",g)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const BD={kernelName:ac,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r;aE([s,a],"resizeBilinearGrad");const o=ko(a.shape),[l,u,c,d]=a.shape,[,h,p]=s.shape,f=new Float32Array(l*u*c*d),m=[i&&h>1?u-1:u,i&&p>1?c-1:c],g=[i&&h>1?h-1:h,i&&p>1?p-1:p],y=m[0]/g[0],b=m[1]/g[1],v=n.data.get(s.dataId).values;let A=0;for(let x=0;x<l;x++){const e=x*o[0];for(let t=0;t<h;t++){const n=t*y,r=Math.floor(n),a=Math.min(Math.ceil(n),u-1),s=e+r*o[1],i=e+a*o[1],l=n-r,h=1-l;for(let e=0;e<p;e++){const t=e*b,n=Math.floor(t),r=Math.min(Math.ceil(t),c-1),a=t-n,u=1-a,p=s+n*o[2],m=s+r*o[2],g=i+n*o[2],y=i+r*o[2],x=h*u,k=h*a,w=l*u,S=l*a;for(let e=0;e<d;e++){const t=v[A++];f[p+e]+=t*x,f[m+e]+=t*k,f[g+e]+=t*w,f[y+e]+=t*S}}}}return n.makeTensorInfo([l,c,u,d],"float32",f)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const PD={kernelName:tc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:i,size:o}=r;aE(a,"resizeNearestNeighbor");const l=ko(a.shape),[u,c]=o,[d,h,p,f]=a.shape,m=n.data.get(a.dataId).values,g=new Float32Array(d*u*c*f),y=[s&&u>1?h-1:h,s&&c>1?p-1:p],b=[s&&u>1?u-1:u,s&&c>1?c-1:c],v=y[0]/b[0],A=y[1]/b[1];let x=0;for(let k=0;k<d;k++){const e=k*l[0];for(let t=0;t<u;t++){const n=i?v*(t+.5):v*t;let r=Math.min(h-1,s?Math.round(n):Math.floor(n));i&&(r=Math.max(0,r));const a=e+r*l[1];for(let e=0;e<c;e++){const t=i?A*(e+.5):A*e;let n=Math.min(p-1,s?Math.round(t):Math.floor(t));i&&(n=Math.max(0,n));const r=a+n*l[2];for(let e=0;e<f;e++){const t=m[r+e];g[x++]=t}}}}return n.makeTensorInfo([d,u,c,f],a.dtype,g)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zD={kernelName:nc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r;aE([s,a],"resizeNearestNeighborGrad");const o=ko(a.shape),l=ko(s.shape),[u,c,d,h]=a.shape,[,p,f]=s.shape,m=new Float32Array(u*c*d*h),g=n.data.get(s.dataId).values,y=[i&&p>1?c-1:c,i&&f>1?d-1:d],b=[i&&p>1?p-1:p,i&&f>1?f-1:f],v=y[0]/b[0],A=y[1]/b[1],x=1/v,k=1/A,w=2*Math.ceil(x)+2,S=2*Math.ceil(k)+2;for(let C=0;C<u;C++){const e=C*o[0];for(let t=0;t<c;t++){const n=e+t*o[1],r=Math.floor(t*x),a=Math.floor(r-w/2);for(let s=0;s<d;s++){const r=n+s*o[2],u=Math.floor(s*k),y=Math.floor(u-S/2);for(let n=0;n<h;n++){let o=0;for(let r=0;r<w;r++){const u=r+a;if(u<0||u>=p)continue;const h=e+u*l[1],m=u*v;if(t===Math.min(c-1,i?Math.round(m):Math.floor(m)))for(let e=0;e<S;e++){const t=e+y;if(t<0||t>=f)continue;const r=h+t*l[2],a=t*A;s===Math.min(d-1,i?Math.round(a):Math.floor(a))&&(o+=g[r+n])}}m[r+n]=o}}}}return n.makeTensorInfo(a.shape,a.dtype,m)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const GD={kernelName:ic,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dims:s}=r;aE(a,"reverse");const i=a.shape.length,o=io(s,a.shape);if(0===i)return pE({inputs:{x:a},backend:n});const l=new dh(a.shape,a.dtype),u=n.bufferSync(a);for(let c=0;c<l.size;c++){const e=l.indexToLoc(c),t=e.slice();o.forEach((e=>t[e]=a.shape[e]-1-t[e])),l.set(u.get(...t),...e)}return n.makeTensorInfo(l.shape,l.dtype,l.values)}},VD={kernelName:Zc,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:r}=e,{radians:a,fillValue:s,center:i}=t,o=n,l=lo(r.dtype,Ji(r.shape)),[u,c,d,h]=r.shape,[p,f]=Dx(i,c,d),m=Math.sin(a),g=Math.cos(a),y=o.data.get(r.dataId).values;for(let b=0;b<u;b++){const e=b*d*c*h;for(let t=0;t<c;t++){const n=t*(d*h);for(let r=0;r<d;r++){const a=r*h;for(let i=0;i<h;i++){const o=[u,t,r,i],b=o[2],v=o[1];let A=(b-p)*g-(v-f)*m,x=(b-p)*m+(v-f)*g;A=Math.round(A+p),x=Math.round(x+f);let k=s;if("number"!=typeof s&&(k=3===i?255:s[i]),A>=0&&A<d&&x>=0&&x<c){k=y[e+x*(d*h)+A*h+i]}l[e+n+a+i]=k}}}}return{dataId:o.write(l,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},UD=RE(oc,(e=>{const t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1})),HD={kernelName:oc,backendName:"cpu",kernelFunc:UD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jD={kernelName:uc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{indices:a,updates:s}=t,{shape:i}=r,{sliceRank:o,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=Ub(0,a,i),h=YR(n.bufferSync(a),n.bufferSync(s),i,d,u,l,o,c,0,!0);return n.makeTensorInfo(i,h.dtype,h.values)}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function qD(e,t){let n=0,r=e.length,a=0;for(;n<r;)a=Math.floor((n+r)/2),e[a]<t?n=a+1:r=a;return r}function QD(e,t){let n=0,r=e.length,a=0;for(;n<r;)a=Math.floor((n+r)/2),e[a]<=t?n=a+1:r=a;return r}const XD={kernelName:dc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{sortedSequence:a,values:s}=t,{side:i}=r,o=function(e,t,n,r,a,s){const i=uo("int32",n*a);for(let o=0;o<n;++o){const n=e.slice(o*r,(o+1)*r),l=o*a;for(let e=0;e<a;++e)i[l+e]="left"===s?qD(n,t[e+l]):QD(n,t[e+l])}return i}(n.data.get(a.dataId).values,n.data.get(s.dataId).values,a.shape[0],a.shape[1],s.shape[1],i);return n.makeTensorInfo(s.shape,"int32",o)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ZD={kernelName:hc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{condition:r,t:a,e:s}=t;aE([r,a,s],"select");const i=r.shape.length,o=n.data.get(r.dataId).values,l=n.data.get(a.dataId).values,u=n.data.get(s.dataId).values,c=_h(a.dtype,s.dtype),d=Wo(Ji(a.shape),c);let h=0;const p=0===i||i>1||1===a.shape.length?1:Ji(a.shape.slice(1));for(let f=0;f<o.length;f++)for(let e=0;e<p;e++)1===o[f]?d[h++]=l[f]:d[h++]=u[f];return n.makeTensorInfo(a.shape,c,d)}},KD=Gx,JD=Vx,YD=RE(pc,(e=>e>=0?JD*e:KD*(Math.exp(e)-1))),eM={kernelName:pc,backendName:"cpu",kernelFunc:YD},tM=RE(yc,(e=>e<0?-1:e>0?1:0)),nM={kernelName:yc,backendName:"cpu",kernelFunc:tM},rM=RE(mc,(e=>Math.sin(e))),aM={kernelName:mc,backendName:"cpu",kernelFunc:rM},sM=RE(gc,(e=>Math.sinh(e))),iM={kernelName:gc,backendName:"cpu",kernelFunc:sM},oM=Math.log(1.1920928955078125e-7)+2,lM=RE(vc,(e=>{const t=e>-oM,n=e<oM,r=Math.exp(e);let a;return a=n?r:t?e:Math.log(1+r),a})),uM={kernelName:vc,backendName:"cpu",kernelFunc:lM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const cM={kernelName:kc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,paddings:i}=r;aE([a],"spaceToBatchND");const o=Ji(s),l=[[0,0]];l.push(...i);for(let g=1+s.length;g<a.shape.length;++g)l.push([0,0]);const u=_D.kernelFunc({inputs:{x:a},backend:n,attrs:{paddings:l,constantValue:0}}),c=Mx(u.shape,s,o,!1),d=Lx(c.length,s.length,!1),h=Bx(u.shape,s,o,!1),p=j$({inputs:{x:u},backend:n,attrs:{shape:c}}),f=OR({inputs:{x:p},backend:n,attrs:{perm:d}}),m=j$({inputs:{x:f},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),m}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dM={kernelName:Cc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{indices:r,values:a,denseShape:s,defaultValue:i}=t;if(1!==s.shape.length)throw new Error(`Dense shape must be a vector, saw:\n        ${s.shape}`);if(2!==r.shape.length)throw new Error(`Indices must be a matrix, saw:\n        ${r.shape}`);if(1!==a.shape.length)throw new Error(`Values must be a vector, saw:\n        ${a.shape}`);if(0!==i.shape.length)throw new Error(`Default value must be a scalar, saw:\n        ${i.shape}`);const o=n.data.get(r.dataId).values,l=n.data.get(a.dataId).values,u=n.data.get(s.dataId).values,c=n.data.get(i.dataId).values[0],[d,h,p,f,m]=i$(o,r.shape,r.dtype,l,a.dtype,u,c);return[n.makeTensorInfo(h,r.dtype,d),n.makeTensorInfo([h[0]],a.dtype,p),n.makeTensorInfo([f.length],"bool",new Uint8Array(f.map((e=>Number(e))))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const hM={kernelName:Ic,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{inputIndices:r,inputShape:a,newShape:s}=t;if(2!==r.shape.length)throw new Error(`Input indices should be a matrix but received shape\n        ${r.shape}`);if(1!==a.shape.length)throw new Error(`Input shape should be a vector but received shape\n        ${a.shape}`);if(1!==s.shape.length)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);const i=Array.from(n.data.get(a.dataId).values),o=n.data.get(r.dataId).values,l=Array.from(n.data.get(s.dataId).values),[u,c,d]=o$(o,r.shape,r.dtype,i,l);return[n.makeTensorInfo(c,r.dtype,u),n.makeTensorInfo([d.length],s.dtype,new Int32Array(d))]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const pM={kernelName:Wc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{data:r,indices:a,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error(`Indices should be a vector but received shape\n          ${a.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n          ${s.shape}`);if(a.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");const i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values,l=n.data.get(s.dataId).values,[u,c]=l$(i,r.shape,r.dtype,o,l,!0);return n.makeTensorInfo(c,r.dtype,u)}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const fM={kernelName:_c,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{data:r,indices:a,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error(`Indices should be a vector but received shape\n         ${a.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n         ${s.shape}`);if(a.shape[0]!==s.shape[0])throw new Error("segmentIds and indices should have same size.");const i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values,l=n.data.get(s.dataId).values,[u,c]=l$(i,r.shape,r.dtype,o,l);return n.makeTensorInfo(c,r.dtype,u)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const mM={kernelName:Tc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{sparseIndices:a,sparseValues:s,defaultValue:i}=t,{outputShape:o}=r,{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:h}=Ub(0,a,o),p=!1,f=n.bufferSync(a);let m;switch(s.dtype){case"bool":m=YR(f,n.bufferSync(s),o,h,c,u,l,d,Boolean(n.data.get(i.dataId).values[0]),p);break;case"float32":m=YR(f,n.bufferSync(s),o,h,c,u,l,d,n.data.get(i.dataId).values[0],p);break;case"int32":m=YR(f,n.bufferSync(s),o,h,c,u,l,d,n.data.get(i.dataId).values[0],p);break;case"string":m=YR(f,n.bufferSync(s),o,h,c,u,l,d,Yd(n.data.get(i.dataId).values[0]),p);break;default:throw new Error(`Unsupported type ${s.dtype}`)}return n.makeTensorInfo(o,m.dtype,m.values)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gM={kernelName:wc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{numOrSizeSplits:s,axis:i}=r,o=io(i,a.shape)[0],l=hk(a,s,o),u=new Array(a.shape.length).fill(0),c=a.shape.slice();return l.map((e=>{const t=[...c];t[o]=e;const r=a$({inputs:{x:a},backend:n,attrs:{begin:u,size:t}});return u[o]+=e,r}))}},yM={kernelName:Ec,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{const{x:n}=e,r=t;aE(n,"square");const a=r.data.get(n.dataId).values,s=new Float32Array(a.length);for(let i=0;i<a.length;++i){const e=a[i];s[i]=e*e}return{dataId:r.write(s,n.shape,n.dtype),shape:n.shape,dtype:n.dtype}}},bM=RE(Qc,((e,t)=>{const n=t;return isNaN(e)?NaN:e>0?1:n.alpha})),vM={kernelName:Qc,backendName:"cpu",kernelFunc:bM};
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const AM={kernelName:$c,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:h}=r;aE(a,"stridedSlice");const{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:y,begin:b,end:v,strides:A}=Ax(a.shape,s,i,o,l,u,c,d,h);let x;if(m)x=j$({inputs:{x:a},backend:n,attrs:{shape:f}});else if(g||y){Xi(a.shape.length>=1,(()=>`Input must have rank at least 1, got: ${a.shape.length}`));const e=lx(b,v,A),t=a$({inputs:{x:a},backend:n,attrs:{begin:b,size:e}});x=j$({inputs:{x:t},backend:n,attrs:{shape:f}}),n.disposeIntermediateTensorInfo(t)}else{const e=b$(p,n.bufferSync(a),A,b);x=n.makeTensorInfo(f,e.dtype,e.values)}return x}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const xM={kernelName:Oc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{separator:a,nGramWidths:s,leftPad:i,rightPad:o,padWidth:l,preserveShortSequences:u}=r,{data:c,dataSplits:d}=t,h=n.data.get(c.dataId).values,p=n.data.get(d.dataId).values,[f,m]=A$(h,p,a,s,i,o,l,u);return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(d.shape,"int32",m)]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kM={kernelName:Fc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{skipEmpty:a}=r,{input:s,delimiter:i}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(1!==s.shape.length)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(0!==i.shape.length)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);const o=n.data.get(s.dataId).values,l=n.data.get(i.dataId).values[0],[u,c,d]=k$(o,l,a),h=c.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wM={kernelName:Dc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{numBuckets:a}=r,{input:s}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(a<=0)throw new Error("Number of buckets must be at least 1");const i=w$(n.data.get(s.dataId).values,a);return n.makeTensorInfo(s.shape,"int32",i)}},SM=RE(Lc,(e=>Math.tan(e))),CM={kernelName:Lc,backendName:"cpu",kernelFunc:SM},IM=RE(Bc,(e=>Math.tanh(e)));
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function WM(e,t,n){switch(n){case"reflect":return function(e,t){let n=e;if(n<0)if(t<=1)n=0;else{const e=2*t;n<e&&(n=e*Math.trunc(-n/e)+n),n=n<-t?n+e:-n-1}else if(n>t-1)if(t<=1)n=0;else{const e=2*t;n-=e*Math.trunc(n/e),n>=t&&(n=e-n-1)}return Hi(0,n,t-1)}(e,t);case"wrap":return function(e,t){let n=e;if(n<0)if(t<=1)n=0;else{const e=t-1;n+=t*(Math.trunc(-n/e)+1)}else if(n>t-1)if(t<=1)n=0;else{const e=t-1;n-=t*Math.trunc(n/e)}return Hi(0,n,t-1)}(e,t);case"nearest":return function(e,t){return Hi(0,e,t-1)}(e,t);default:return function(e){return e}(e)}}function _M(e,t,n,r,a,s,i,o,l,u,c){return 0<=o&&o<t&&0<=l&&l<n?e[i*r+o*a+l*s+u]:c}function TM(e,t,n,r,a,s,i,o,l,u,c){return _M(e,t,n,r,a,s,i,Math.round(o),Math.round(l),u,c)}function NM(e,t,n,r,a,s,i,o,l,u,c){const d=Math.floor(o),h=Math.floor(l),p=d+1,f=h+1;return(p-o)*((f-l)*_M(e,t,n,r,a,s,i,d,h,u,c)+(l-h)*_M(e,t,n,r,a,s,i,d,f,u,c))+(o-d)*((f-l)*_M(e,t,n,r,a,s,i,p,h,u,c)+(l-h)*_M(e,t,n,r,a,s,i,p,f,u,c))}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const EM={kernelName:jc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,segmentIds:s}=t,{numSegments:i}=r;aE(a,"unsortedSegmentSum");const o=[],l=[],u=a.shape.length-s.shape.length;let c=s;for(let h=0;h<u;++h){const e=bF({inputs:{input:c},backend:n,attrs:{dim:h+1}});c=e,l.push(e)}for(let h=0;h<i;++h){const e=Xd(h,"int32"),t=n.makeTensorInfo([],"int32",e),r=BE({inputs:{a:t,b:c},backend:n}),s=bE({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),i=IR({inputs:{a:s,b:a},backend:n}),u=iF({inputs:{x:i},backend:n,attrs:{axis:0,keepDims:!1}});o.push(u),l.push(t),l.push(r),l.push(s),l.push(i),l.push(u)}const d=ID({inputs:o,backend:n,attrs:{axis:0}});return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),d}},RM=[Z$,lE,J$,eO,CE,tO,nO,rO,aO,sO,oO,uO,dO,fO,gO,AO,xO,kO,wO,X$,SO,CO,IO,NE,WO,vE,DE,TO,dE,NO,OO,DO,MO,LO,BO,PO,zO,VO,HO,jO,qO,QO,XO,ZO,JO,YO,eF,tF,nF,rF,aF,sF,lF,F$,uF,PE,yF,VE,vF,jE,IF,_F,TF,XE,JE,NF,EF,RF,$F,rR,iR,fE,OF,RO,DF,LF,PF,M$,uR,hR,zF,gR,VF,jF,QF,KF,JF,YF,tD,AR,nD,rD,aD,sD,iD,oD,lD,wR,uD,hD,mD,WR,TR,yD,vD,xD,RR,kD,CD,WD,_D,ED,P$,MR,RD,$D,OD,FD,gE,kF,MD,G$,U$,q$,LD,BD,PD,zD,GD,VD,HD,JR,jD,XD,ZD,eM,n$,nM,aM,iM,s$,fD,uM,cM,dM,hM,pM,fM,mM,gM,d$,yM,f$,y$,vM,AM,xM,kM,wM,W$,oF,CM,{kernelName:Bc,backendName:"cpu",kernelFunc:IM},{kernelName:cc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n}=e,{tensor:r,indices:a,updates:s}=t,{sliceRank:i,numUpdates:o,sliceSize:l,strides:u,outputSize:c}=Ub(0,a,r.shape),d=n.bufferSync(a),h=n.bufferSync(s),p=n.bufferSync(r),f=YR(d,h,r.shape,c,l,o,i,u,p,!1);return n.makeTensorInfo(r.shape,f.dtype,f.values)}},{kernelName:Pc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reps:s}=r;aE(a,"tile");const i=_$(n.bufferSync(a),s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}},{kernelName:zc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{k:s,sorted:i}=r;aE(a,"topk");const o=n.data.get(a.dataId).values,[l,u]=E$(o,a.shape,a.dtype,s,i);return[n.makeTensorInfo(l.shape,l.dtype,l.values),n.makeTensorInfo(u.shape,u.dtype,u.values)]}},{kernelName:Gc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,attrs:n,backend:r}=e,{image:a,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:u}=n,[c,d,h,p]=a.shape,[f,m]=null!=u?u:[d,h],g=[c,f,m,p],y=ko(a.shape),b=y[0],v=y[1],A=y[2],x=ko(g),k=x[0],w=x[1],S=x[2],C=lo(a.dtype,Ji(g));C.fill(l);const I=r.data.get(a.dataId).values,W=r.data.get(s.dataId).values;for(let _=0;_<c;++_){const e=1===s.shape[0]?W:W.subarray(8*_,8*_+8);for(let t=0;t<f;++t)for(let n=0;n<m;++n)for(let r=0;r<p;++r){let a;const s=e[6]*n+e[7]*t+1;if(0===s)continue;const u=(e[0]*n+e[1]*t+e[2])/s,c=(e[3]*n+e[4]*t+e[5])/s,p=WM(u,h,o),f=WM(c,d,o);switch(i){case"nearest":a=TM(I,d,h,b,v,A,_,f,p,r,l);break;case"bilinear":a=NM(I,d,h,b,v,A,_,f,p,r,l);break;default:throw new Error(`Error in Transform: Expect 'nearest' or 'bilinear', but got ${i}`)}C[_*k+t*w+n*S+r]=a}return r.makeTensorInfo(g,a.dtype,C)}return{dataId:r.write(C,g,a.dtype),shape:a.shape,dtype:a.dtype}}},FR,{kernelName:Uc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,attrs:n,backend:r}=e,{axis:a}=n,{x:s}=t;aE(s,"unique");const i=r.data.get(s.dataId).values,{outputValues:o,outputShape:l,indices:u}=R$(i,a,s.shape,s.dtype);return[r.makeTensorInfo(l,s.dtype,o),r.makeTensorInfo([u.length],"int32",u)]}},{kernelName:Hc,backendName:"cpu",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{value:a}=t;let{axis:s}=r;s<0&&(s+=a.shape.length);const i=a.shape.length,o=a.shape[s],l=new Array(i-1);let u=0;for(let p=0;p<i;p++)p!==s&&(l[u++]=a.shape[p]);const c=new Array(i).fill(0),d=a.shape.slice();d[s]=1;const h=new Array(o);for(let p=0;p<h.length;p++){c[s]=p;const e=a$({inputs:{x:a},backend:n,attrs:{begin:c,size:d}});h[p]=j$({inputs:{x:e},backend:n,attrs:{shape:l}}),n.disposeIntermediateTensorInfo(e)}return h}},EM,SD];
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */for(const t of RM)id(t);
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $M={},OM={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function FM(e,t){if(!(e in $M)||null!=t){const n=function(e,t){if(1!==e&&2!==e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const n=null==t?function(e){if(Do().getBool("IS_SAFARI")||"undefined"==typeof OffscreenCanvas||2!==e){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}return new OffscreenCanvas(300,150)}(e):t;n.addEventListener("webglcontextlost",(t=>{t.preventDefault(),delete $M[e]}),!1),Do().getBool("SOFTWARE_WEBGL_ENABLED")&&(OM.failIfMajorPerformanceCaveat=!1);if(1===e)return n.getContext("webgl",OM)||n.getContext("experimental-webgl",OM);return n.getContext("webgl2",OM)}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(e,t);if(null===n)return null;$M[e]=n}const n=$M[e];return null==n||n.isContextLost()?(delete $M[e],FM(e)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),$M[e])}var DM,MM,LM,BM,PM,zM;function GM(e,t){return[t,e]}function VM(e){const t=Ji(e);return no(Math.ceil(t/4))}function UM(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function HM(e,t){const n=e;let r,a,s,i,o,l,u,c,d,h;return 2===Do().getNumber("WEBGL_VERSION")?(r=n.R32F,a=n.R16F,s=n.RGBA16F,i=n.RGBA32F,o=n.RED,u=4,c=1,d=n.HALF_FLOAT,h=n.FLOAT,l=n.RGBA8):(r=e.RGBA,a=e.RGBA,s=e.RGBA,i=n.RGBA,o=e.RGBA,u=4,c=4,d=null!=t?t.HALF_FLOAT_OES:null,h=e.FLOAT,l=e.RGBA),{internalFormatFloat:r,internalFormatHalfFloat:a,internalFormatPackedHalfFloat:s,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:l,downloadUnpackNumChannels:u,defaultNumChannels:c,textureTypeHalfFloat:d,textureTypeFloat:h}}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function jM(e,t){const n=t();return Do().getBool("DEBUG")&&function(e){const t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+function(e,t){switch(t){case e.NO_ERROR:return"NO_ERROR";case e.INVALID_ENUM:return"INVALID_ENUM";case e.INVALID_VALUE:return"INVALID_VALUE";case e.INVALID_OPERATION:return"INVALID_OPERATION";case e.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case e.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case e.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return`Unknown error code ${t}`}}(e,t))}(e),n}(MM=DM||(DM={}))[MM.DENSE=0]="DENSE",MM[MM.SHARED_BATCH=1]="SHARED_BATCH",(BM=LM||(LM={}))[BM.RENDER=0]="RENDER",BM[BM.UPLOAD=1]="UPLOAD",BM[BM.PIXELS=2]="PIXELS",BM[BM.DOWNLOAD=3]="DOWNLOAD",(zM=PM||(PM={}))[zM.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",zM[zM.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",zM[zM.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",zM[zM.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",zM[zM.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16";function qM(e){return!!(Do().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===e||5.96e-8<Math.abs(e)&&Math.abs(e)<65504)}function QM(e,t){return rL(e,(()=>e.getExtension(t)),'Extension "'+t+'" not supported on this browser.')}const XM=/ERROR: [0-9]+:([0-9]+):/g;function ZM(e,t){const n=XM.exec(t);if(null==n)return;const r=+n[1],a=e.split("\n"),s=a.length.toString().length+2,i=a.map(((e,t)=>ro((t+1).toString(),s)+e));let o=0;for(let l=0;l<i.length;l++)o=Math.max(i[l].length,o);i.slice(0,r-1),i.slice(r-1,r),i.slice(r)}function KM(e,t){if(jM(e,(()=>e.validateProgram(t))),!1===e.getProgramParameter(t,e.VALIDATE_STATUS))throw new Error("Shader program validation failed.")}function JM(e,t,n,r,a,s,i){const o=e.getAttribLocation(t,n);return-1!==o&&(jM(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,r))),jM(e,(()=>e.vertexAttribPointer(o,a,e.FLOAT,!1,s,i))),jM(e,(()=>e.enableVertexAttribArray(o))),!0)}function YM(e,t,n){!function(e,t){const n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(r<e.TEXTURE0||r>n){throw new Error(`textureUnit must be in ${`[gl.TEXTURE0, gl.TEXTURE${n}]`}.`)}}(e,n),jM(e,(()=>e.activeTexture(e.TEXTURE0+n))),jM(e,(()=>e.bindTexture(e.TEXTURE_2D,t)))}function eL(e,t,n){jM(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,n))),jM(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)))}function tL(e,t){jM(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,t))),jM(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)))}function nL(e){const t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+function(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${t}`}}(e,t))}function rL(e,t,n){const r=jM(e,(()=>t()));if(null==r)throw new Error(n);return r}function aL(e,t=2){return Ji(e.slice(0,e.length-t))}function sL(e){if(0===e.length)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function iL(e){let t=[1,1,1];return 0===e.length||1===e.length&&1===e[0]||(t=[aL(e),...sL(e)]),t}function oL(e){return e%2==0}function lL(e,t){if(eo(e=e.slice(-2),t=t.slice(-2)))return!0;if(!e.length||!t.length)return!0;if(0===e[0]||0===e[1]||0===t[0]||0===t[1])return!0;if(e.length!==t.length){const n=e[e.length-1],r=t[t.length-1];if(n===r)return!0;if(oL(n)&&oL(r)&&(1===e[0]||1===t[0]))return!0}return e[1]===t[1]&&oL(e[0])&&oL(t[0])}let uL,cL;function dL(e,t){return null!=e.getExtension(t)}function hL(e){try{if(null!=FM(e))return!0}catch(gQ){return!1}return!1}function pL(e){if(0===e)return!1;const t=FM(e);if(1!==e){if(dL(t,"EXT_color_buffer_float"))return fL(t);const e="EXT_color_buffer_half_float";if(dL(t,e)){const n=t.getExtension(e);return function(e,t){const n=HM(e,t),r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const a=1,s=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,a,s,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);const i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);const o=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(r),e.deleteFramebuffer(i),o}(t,n)}return!1}if(!dL(t,"OES_texture_float"))return!1;if(!dL(t,"WEBGL_color_buffer_float"))return!1;return fL(t)}function fL(e){const t=HM(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,1,1,0,t.textureFormatFloat,t.textureTypeFloat,null);const r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);const a=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(r),a}function mL(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>{null!=e&&Xi("complex64"!==e.dtype,(()=>`${t} does not support complex64 tensors in the WebGL backend.`))}))}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gL=Do();
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function yL(){let e,t,n,r,a,s,i,o,l,u;return 2===Do().getNumber("WEBGL_VERSION")?(e="#version 300 es",t="in",n="out",r="in",a="texture",s="outputColor",i="out vec4 outputColor;",o=Do().getBool("WEBGL2_ISNAN_CUSTOM")?"\n      bool isnan_custom(float val) {\n        uint floatToUint = floatBitsToUint(val);\n        return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n      }\n\n      bvec4 isnan_custom(vec4 val) {\n        return bvec4(isnan_custom(val.x),\n          isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n      }\n\n      #define isnan(value) isnan_custom(value)\n    ":"",l="",u="\n      #define round(value) newRound(value)\n      int newRound(float value) {\n        return int(floor(value + 0.5));\n      }\n\n      ivec4 newRound(vec4 value) {\n        return ivec4(floor(value + vec4(0.5)));\n      }\n    "):(e="",t="attribute",n="varying",r="varying",a="texture2D",s="gl_FragColor",i="",o="\n      #define isnan(value) isnan_custom(value)\n      bool isnan_custom(float val) {\n        return (val > 0. || val < 1. || val == 0.) ? false : true;\n      }\n      bvec4 isnan_custom(vec4 val) {\n        return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n      }\n    ",l="\n      uniform float INFINITY;\n\n      bool isinf(float val) {\n        return abs(val) == INFINITY;\n      }\n      bvec4 isinf(vec4 val) {\n        return equal(abs(val), vec4(INFINITY));\n      }\n    ",u="\n      int round(float value) {\n        return int(floor(value + 0.5));\n      }\n\n      ivec4 round(vec4 value) {\n        return ivec4(floor(value + vec4(0.5)));\n      }\n    "),{version:e,attribute:t,varyingVs:n,varyingFs:r,texture2D:a,output:s,defineOutput:i,defineSpecialNaN:o,defineSpecialInf:l,defineRound:u}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function bL(e,t,n="index"){const r=ko(t);return r.map(((t,a)=>`${`int ${e[a]} = ${n} / ${t}`}; ${a===r.length-1?`int ${e[a+1]} = ${n} - ${e[a]} * ${t}`:`index -= ${e[a]} * ${t}`};`)).join("")}function vL(e,t,n="index"){const r=ko(t);return r.map(((t,a)=>`${`int ${e[a]} = ${n} / outShapeStrides[${a}]`}; ${a===r.length-1?`int ${e[a+1]} = ${n} - ${e[a]} * outShapeStrides[${a}]`:`index -= ${e[a]} * outShapeStrides[${a}]`};`)).join("")}function AL(e,t,n="index"){const r=function(e,t){const n=e.length,r=e.map((e=>`${t}[${e}]`)),a=new Array(n-1);a[n-2]=r[n-1];for(let s=n-3;s>=0;--s)a[s]=`(${a[s+1]} * ${r[s+1]})`;return a}(e.map(((e,t)=>t)),t);return r.map(((t,a)=>`${`int ${e[a]} = ${n} / ${r[a]}`}; ${a===r.length-1?`int ${e[a+1]} = ${n} - ${e[a]} * ${r[a]}`:`index -= ${e[a]} * ${r[a]}`};`)).join("")}function xL(e){const t=ko(e).map((e=>e.toString()));return`\n  int getFlatIndex(ivec3 coords) {\n    return coords.x * ${t[0]} + coords.y * ${t[1]} + coords.z;\n  }\n`}gL.registerFlag("HAS_WEBGL",(()=>gL.getNumber("WEBGL_VERSION")>0)),gL.registerFlag("WEBGL_VERSION",(()=>hL(2)?2:hL(1)?1:0)),gL.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",(()=>!1)),gL.registerFlag("WEBGL_BUFFER_SUPPORTED",(()=>2===gL.get("WEBGL_VERSION"))),gL.registerFlag("WEBGL_CPU_FORWARD",(()=>!0)),gL.registerFlag("WEBGL_FORCE_F16_TEXTURES",(()=>!1)),gL.registerFlag("WEBGL_PACK",(()=>gL.getBool("HAS_WEBGL"))),gL.registerFlag("WEBGL_PACK_NORMALIZATION",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_CLIP",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_DEPTHWISECONV",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_REDUCE",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_LAZILY_UNPACK",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_CONV_IM2COL",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE",(()=>gL.getBool("WEBGL_PACK"))),gL.registerFlag("WEBGL_MAX_TEXTURE_SIZE",(()=>function(e){if(null==uL){const t=FM(e);uL=t.getParameter(t.MAX_TEXTURE_SIZE)}return uL}(gL.getNumber("WEBGL_VERSION")))),gL.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",(()=>function(e){if(null==cL){const t=FM(e);cL=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,cL)}(gL.getNumber("WEBGL_VERSION")))),gL.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",(()=>{const e=gL.getNumber("WEBGL_VERSION");return 0===e?0:function(e){if(0===e)return 0;let t;const n=FM(e);return t=dL(n,"EXT_disjoint_timer_query_webgl2")&&2===e?2:dL(n,"EXT_disjoint_timer_query")?1:0,t}(e)})),gL.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",(()=>gL.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!Uh())),gL.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",(()=>function(e){if(0===e)return!1;const t=FM(e);if(1===e){if(!dL(t,"OES_texture_float"))return!1}else if(!dL(t,"EXT_color_buffer_float"))return!1;return fL(t)}(gL.getNumber("WEBGL_VERSION")))),gL.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",(()=>!gL.getBool("WEBGL_FORCE_F16_TEXTURES")&&gL.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))),gL.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",(()=>pL(gL.getNumber("WEBGL_VERSION")))),gL.registerFlag("WEBGL_FENCE_API_ENABLED",(()=>{return 2===(e=gL.getNumber("WEBGL_VERSION"))&&null!=FM(e).fenceSync;var e})),gL.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",(()=>gL.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0)),gL.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",(()=>-1),(e=>{if("number"!=typeof e)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be a number but got ${e}.`);if(e<0&&-1!==e)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${e}.`)})),gL.registerFlag("WEBGL_FLUSH_THRESHOLD",(()=>Uh()?1:-1),(e=>{if("number"!=typeof e)throw new Error(`WEBGL_FLUSH_THRESHOLD must be a number but got ${e}.`);if(e<0&&-1!==e)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${e}.`)})),gL.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",(()=>128)),gL.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",(()=>!1)),gL.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",(()=>1e5)),gL.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",(()=>128)),gL.registerFlag("WEBGL_EXP_CONV",(()=>!1)),gL.registerFlag("SOFTWARE_WEBGL_ENABLED",(()=>gL.getBool("IS_TEST"))),gL.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",(()=>1/0)),gL.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",(()=>!1)),gL.registerFlag("WEBGL2_ISNAN_CUSTOM",(()=>!1)),gL.registerFlag("ENGINE_COMPILE_ONLY",(()=>!1));const kL="\n  const float FLOAT_MAX = 1.70141184e38;\n  const float FLOAT_MIN = 1.17549435e-38;\n\n  lowp vec4 encode_float(highp float v) {\n    if (isnan(v)) {\n      return vec4(255, 255, 255, 255);\n    }\n\n    highp float av = abs(v);\n\n    if(av < FLOAT_MIN) {\n      return vec4(0.0, 0.0, 0.0, 0.0);\n    } else if(v > FLOAT_MAX) {\n      return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n    } else if(v < -FLOAT_MAX) {\n      return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;\n    }\n\n    highp vec4 c = vec4(0,0,0,0);\n\n    highp float e = floor(log2(av));\n    highp float m = exp2(fract(log2(av))) - 1.0;\n\n    c[2] = floor(128.0 * m);\n    m -= c[2] / 128.0;\n    c[1] = floor(32768.0 * m);\n    m -= c[1] / 32768.0;\n    c[0] = floor(8388608.0 * m);\n\n    highp float ebias = e + 127.0;\n    c[3] = floor(ebias / 2.0);\n    ebias -= c[3] * 2.0;\n    c[2] += floor(ebias) * 128.0;\n\n    c[3] += 128.0 * step(0.0, -v);\n\n    return c / 255.0;\n  }\n",{getBroadcastDims:wL}=Ek;
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function SL(e,t,n){const r=[];if(e.forEach((e=>{const t=Ji(e.shapeInfo.logicalShape);if(e.shapeInfo.isUniform?r.push(`uniform float ${e.name}${t>1?`[${t}]`:""};`):(r.push(`uniform sampler2D ${e.name};`),r.push(`uniform int offset${e.name};`)),n.enableShapeUniforms){const{uniformShape:t}=FL(n.packedInputs,e.shapeInfo.logicalShape,e.shapeInfo.texShape);switch(t.length){case 1:r.push(`uniform int ${e.name}Shape;`);break;case 2:r.push(`uniform ivec2 ${e.name}Shape;`);break;case 3:r.push(`uniform ivec3 ${e.name}Shape;`);break;case 4:r.push(`uniform ivec4 ${e.name}Shape;`)}r.push(`uniform ivec2 ${e.name}TexShape;`)}})),n.enableShapeUniforms){switch(t.logicalShape.length){case 1:r.push("uniform int outShape;");break;case 2:r.push("uniform ivec2 outShape;"),r.push("uniform int outShapeStrides;");break;case 3:r.push("uniform ivec3 outShape;"),r.push("uniform ivec2 outShapeStrides;");break;case 4:r.push("uniform ivec4 outShape;"),r.push("uniform ivec3 outShapeStrides;")}r.push("uniform ivec2 outTexShape;")}n.customUniforms&&n.customUniforms.forEach((e=>{r.push(`uniform ${e.type} ${e.name}${e.arrayIndex?`[${e.arrayIndex}]`:""};`)}));const a=r.join("\n"),s=e.map((e=>function(e,t,n=!1,r){let a="";a+=n?IL(e,r):CL(e,r);const s=e.shapeInfo.logicalShape,i=t.logicalShape;s.length<=i.length&&(a+=n?function(e,t){const n=e.name,r=n.charAt(0).toUpperCase()+n.slice(1),a="get"+r+"AtOutCoords",s=e.shapeInfo.logicalShape.length,i=t.logicalShape.length,o=wL(e.shapeInfo.logicalShape,t.logicalShape),l=OL(i),u=i-s;let c;const d=["x","y","z","w","u","v"];c=0===s?"":i<2&&o.length>=1?"coords = 0;":o.map((e=>`coords.${d[e+u]} = 0;`)).join("\n");let h="";h=i<2&&s>0?"coords":e.shapeInfo.logicalShape.map(((e,t)=>`coords.${d[t+u]}`)).join(", ");let p="return outputValue;";const f=1===Ji(e.shapeInfo.logicalShape),m=Ji(t.logicalShape),g=1===m;if(1!==s||f||g){if(f&&!g)p=1===i?"\n        return vec4(outputValue.x, outputValue.x, 0., 0.);\n      ":"\n        return vec4(outputValue.x);\n      ";else if(o.length){const e=s-2,t=s-1;o.indexOf(e)>-1&&o.indexOf(t)>-1?p="return vec4(outputValue.x);":o.indexOf(e)>-1?p="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":o.indexOf(t)>-1&&(p="return vec4(outputValue.xx, outputValue.zz);")}}else p="\n      return vec4(outputValue.xy, outputValue.xy);\n    ";return`\n    vec4 ${a}() {\n      ${l} coords = getOutputCoords();\n      ${c}\n      vec4 outputValue = get${r}(${h});\n      ${p}\n    }\n  `}(e,t):function(e,t){const n=e.name,r=n.charAt(0).toUpperCase()+n.slice(1),a="get"+r+"AtOutCoords",s=t.texShape,i=e.shapeInfo.texShape,o=e.shapeInfo.logicalShape.length,l=t.logicalShape.length;if(!e.shapeInfo.isUniform&&o===l&&null==e.shapeInfo.flatOffset&&eo(i,s))return`\n      float ${a}() {\n        return sampleTexture(${n}, resultUV);\n      }\n    `;const u=OL(l),c=wL(e.shapeInfo.logicalShape,t.logicalShape),d=l-o;let h;const p=["x","y","z","w","u","v"];h=0===o?"":l<2&&c.length>=1?"coords = 0;":c.map((e=>`coords.${p[e+d]} = 0;`)).join("\n");let f="";f=l<2&&o>0?"coords":e.shapeInfo.logicalShape.map(((e,t)=>`coords.${p[t+d]}`)).join(", ");return`\n    float ${a}() {\n      ${u} coords = getOutputCoords();\n      ${h}\n      return get${r}(${f});\n    }\n  `}(e,t));return a}(e,t,n.packedInputs,n.enableShapeUniforms))).join("\n"),i=t.texShape,o=yL(),l=function(e){return`\n    float sampleTexture(sampler2D textureSampler, vec2 uv) {\n      return ${e.texture2D}(textureSampler, uv).r;\n    }\n  `}(o);let u,c,d=function(e){const t=`${e.version}\n    precision highp float;\n    precision highp int;\n    precision highp sampler2D;\n    ${e.varyingFs} vec2 resultUV;\n    ${e.defineOutput}\n    const vec2 halfCR = vec2(0.5, 0.5);\n\n    struct ivec5\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n    };\n\n    struct ivec6\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n      int v;\n    };\n\n    uniform float NAN;\n    ${e.defineSpecialNaN}\n    ${e.defineSpecialInf}\n    ${e.defineRound}\n\n    int imod(int x, int y) {\n      return x - y * (x / y);\n    }\n\n    int idiv(int a, int b, float sign) {\n      int res = a / b;\n      int mod = imod(a, b);\n      if (sign < 0. && mod != 0) {\n        res -= 1;\n      }\n      return res;\n    }\n\n    //Based on the work of Dave Hoskins\n    //https://www.shadertoy.com/view/4djSRW\n    #define HASHSCALE1 443.8975\n    float random(float seed){\n      vec2 p = resultUV * seed;\n      vec3 p3  = fract(vec3(p.xyx) * HASHSCALE1);\n      p3 += dot(p3, p3.yzx + 19.19);\n      return fract((p3.x + p3.y) * p3.z);\n    }\n\n    ${WL}\n    ${_L}\n    ${TL}\n  `;return t}(o);t.isPacked?(u=function(e,t,n){switch(e.length){case 0:return EL();case 1:return function(e,t,n){const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(1===r[0])return n?"\n      int getOutputCoords() {\n        return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));\n      }\n    ":`\n      int getOutputCoords() {\n        return 2 * int(resultUV.x * ${r[1]}.0);\n      }\n    `;if(1===r[1])return n?"\n      int getOutputCoords() {\n        return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));\n      }\n    ":`\n      int getOutputCoords() {\n        return 2 * int(resultUV.y * ${r[0]}.0);\n      }\n    `;if(n)return"\n    int getOutputCoords() {\n      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(packedTexShape[0], packedTexShape[1]));\n      return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);\n    }\n  ";return`\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(${r[0]}, ${r[1]}));\n      return 2 * (resTexRC.x * ${r[1]} + resTexRC.y);\n    }\n  `}(0,t,n);case 2:return function(e,t,n){const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(eo(e,t))return n?"\n      ivec2 getOutputCoords() {\n        ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n        return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));\n      }\n    ":`\n      ivec2 getOutputCoords() {\n        return 2 * ivec2(resultUV.yx * vec2(${r[0]}, ${r[1]}));\n      }\n    `;const a=Math.ceil(e[1]/2);if(n)return"\n    ivec2 getOutputCoords() {\n      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n      int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(packedTexShape[0], packedTexShape[1]));\n\n      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n      int r = 2 * (index / texelsInLogicalRow);\n      int c = imod(index, texelsInLogicalRow) * 2;\n\n      return ivec2(r, c);\n    }\n  ";return`\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(${r[0]}, ${r[1]}));\n\n      int index = resTexRC.x * ${r[1]} + resTexRC.y;\n      int r = 2 * (index / ${a});\n      int c = imod(index, ${a}) * 2;\n\n      return ivec2(r, c);\n    }\n  `}(e,t,n);case 3:return function(e,t,n){if(n)return"\n    ivec3 getOutputCoords() {\n      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n      int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));\n      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(packedTexShape[0], packedTexShape[1]));\n      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n      int b = index / texelsInBatch;\n      index -= b * texelsInBatch;\n\n      int r = 2 * (index / texelsInLogicalRow);\n      int c = imod(index, texelsInLogicalRow) * 2;\n\n      return ivec3(b, r, c);\n    }\n  ";const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),s=a*Math.ceil(e[1]/2);return`\n    ivec3 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(${r[0]}, ${r[1]}));\n      int index = resTexRC.x * ${r[1]} + resTexRC.y;\n\n      int b = index / ${s};\n      index -= b * ${s};\n\n      int r = 2 * (index / ${a});\n      int c = imod(index, ${a}) * 2;\n\n      return ivec3(b, r, c);\n    }\n  `}(e,t,n);default:return function(e,t,n){if(n)return"\n    ivec4 getOutputCoords() {\n      ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(packedTexShape[0], packedTexShape[1]));\n      int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n      int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));\n      int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));\n      int texelsInBatchN = texelsInBatch * outShape[1];\n\n      int b2 = index / texelsInBatchN;\n      index -= b2 * texelsInBatchN;\n\n      int b = index / texelsInBatch;\n      index -= b * texelsInBatch;\n\n      int r = 2 * (index / texelsInLogicalRow);\n      int c = imod(index, texelsInLogicalRow) * 2;\n\n      return ivec4(b2, b, r, c);\n    }\n  ";const r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[e.length-1]/2),s=a*Math.ceil(e[e.length-2]/2);let i=s,o="",l="b, r, c";for(let u=2;u<e.length-1;u++)i*=e[e.length-u-1],o=`\n      int b${u} = index / ${i};\n      index -= b${u} * ${i};\n    `+o,l=`b${u}, `+l;return`\n    ivec${e.length} getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(${r[0]}, ${r[1]}));\n      int index = resTexRC.x * ${r[1]} + resTexRC.y;\n\n      ${o}\n\n      int b = index / ${s};\n      index -= b * ${s};\n\n      int r = 2 * (index / ${a});\n      int c = imod(index, ${a}) * 2;\n\n      return ivec${e.length}(${l});\n    }\n  `}(e,t,n)}}(t.logicalShape,i,n.enableShapeUniforms),c=function(e){return`\n    void setOutput(vec4 val) {\n      ${e.output} = val;\n    }\n  `}(o)):(u=function(e,t,n){switch(e.length){case 0:return EL();case 1:return function(e,t,n){if(1===t[0])return n?"\n      int getOutputCoords() {\n        return int(resultUV.x * float(outTexShape[1]));\n      }\n    ":`\n      int getOutputCoords() {\n        return int(resultUV.x * ${t[1]}.0);\n      }\n    `;if(1===t[1])return n?"\n      int getOutputCoords() {\n        return int(resultUV.y * float(outTexShape[0]));\n      }\n    ":`\n      int getOutputCoords() {\n        return int(resultUV.y * ${t[0]}.0);\n      }\n    `;if(n)return"\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(outTexShape[0], outTexShape[1]));\n      return resTexRC.x * outTexShape[1] + resTexRC.y;\n    }\n  ";return`\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(${t[0]}, ${t[1]}));\n      return resTexRC.x * ${t[1]} + resTexRC.y;\n    }\n  `}(0,t,n);case 2:return function(e,t,n){if(eo(e,t))return n?"\n      ivec2 getOutputCoords() {\n        return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));\n      }\n    ":`\n      ivec2 getOutputCoords() {\n        return ivec2(resultUV.yx * vec2(${t[0]}, ${t[1]}));\n      }\n    `;if(1===e[1])return n?"\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2(outTexShape[0], outTexShape[1]));\n        int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n        return ivec2(index, 0);\n      }\n    ":`\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2(${t[0]}, ${t[1]}));\n        int index = resTexRC.x * ${t[1]} + resTexRC.y;\n        return ivec2(index, 0);\n      }\n    `;if(1===e[0])return n?"\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2(outTexShape[0], outTexShape[1]));\n        int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n        return ivec2(0, index);\n      }\n    ":`\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2(${t[0]}, ${t[1]}));\n        int index = resTexRC.x * ${t[1]} + resTexRC.y;\n        return ivec2(0, index);\n      }\n    `;if(n)return"\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(outTexShape[0], outTexShape[1]));\n      int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n      int r = index / outShape[1];\n      int c = index - r * outShape[1];\n      return ivec2(r, c);\n    }\n  ";return`\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(${t[0]}, ${t[1]}));\n      int index = resTexRC.x * ${t[1]} + resTexRC.y;\n      int r = index / ${e[1]};\n      int c = index - r * ${e[1]};\n      return ivec2(r, c);\n    }\n  `}(e,t,n);case 3:return function(e,t,n){if(n){return`\n  ivec3 getOutputCoords() {\n    ivec2 resTexRC = ivec2(resultUV.yx *\n                           vec2(outTexShape[0], outTexShape[1]));\n    int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n    ${vL(["r","c","d"],e)}\n    return ivec3(r, c, d);\n  }\n`}const r=bL(["r","c","d"],e);return`\n    ivec3 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2(${t[0]}, ${t[1]}));\n      int index = resTexRC.x * ${t[1]} + resTexRC.y;\n      ${r}\n      return ivec3(r, c, d);\n    }\n  `}(e,t,n);case 4:return function(e,t,n){if(n){return`\n    ivec4 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2(outTexShape[0], outTexShape[1]));\n      int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n      ${vL(["r","c","d","d2"],e)}\n      return ivec4(r, c, d, d2);\n    }\n  `}const r=bL(["r","c","d","d2"],e);return`\n    ivec4 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2(${t[0]}, ${t[1]}));\n      int index = resTexRC.x * ${t[1]} + resTexRC.y;\n      ${r}\n      return ivec4(r, c, d, d2);\n    }\n  `}(e,t,n);case 5:return function(e,t){const n=bL(["r","c","d","d2","d3"],e);return`\n    ivec5 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx * vec2(${t[0]},\n                             ${t[1]}));\n\n      int index = resTexRC.x * ${t[1]} + resTexRC.y;\n\n      ${n}\n\n      ivec5 outShape = ivec5(r, c, d, d2, d3);\n      return outShape;\n    }\n  `}(e,t);case 6:return function(e,t){const n=bL(["r","c","d","d2","d3","d4"],e);return`\n    ivec6 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2(${t[0]}, ${t[1]}));\n      int index = resTexRC.x * ${t[1]} + resTexRC.y;\n\n      ${n}\n\n      ivec6 result = ivec6(r, c, d, d2, d3, d4);\n      return result;\n    }\n  `}(e,t);default:throw new Error(`${e.length}-D output sampling is not yet supported`)}}(t.logicalShape,i,n.enableShapeUniforms),c=function(e){return`\n    void setOutput(float val) {\n      ${e.output} = vec4(val, 0, 0, 0);\n    }\n  `}(o)),n.packedInputs&&(d+=NL);return[d,l,c,a,u,s,n.userCode].join("\n")}function CL(e,t=!1){const n=e.shapeInfo.logicalShape;switch(n.length){case 0:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`float ${r}() {return ${n};}`;const[a,s]=e.shapeInfo.texShape;if(1===a&&1===s)return`\n      float ${r}() {\n        return sampleTexture(${n}, halfCR);\n      }\n    `;const i=RL(n);if(t)return`\n    float ${r}() {\n      vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], ${i});\n      return sampleTexture(${n}, uv);\n    }\n  `;const[o,l]=e.shapeInfo.texShape;return`\n    float ${r}() {\n      vec2 uv = uvFromFlat(${o}, ${l}, ${i});\n      return sampleTexture(${n}, uv);\n    }\n  `}(e,t);case 1:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return`\n      float ${r}(int index) {\n        ${$L(e)}\n      }\n    `;const a=e.shapeInfo.texShape,s=a[0],i=a[1];if(1===i&&1===s)return`\n      float ${r}(int index) {\n        return sampleTexture(${n}, halfCR);\n      }\n    `;const o=RL(n);if(1===i)return t?`\n      float ${r}(int index) {\n        vec2 uv = vec2(0.5, (float(index + ${o}) + 0.5) / float(${n}TexShape[0]));\n        return sampleTexture(${n}, uv);\n      }\n    `:`\n      float ${r}(int index) {\n        vec2 uv = vec2(0.5, (float(index + ${o}) + 0.5) / ${s}.0);\n        return sampleTexture(${n}, uv);\n      }\n    `;if(1===s)return t?`\n      float ${r}(int index) {\n        vec2 uv = vec2((float(index + ${o}) + 0.5) / float(${n}TexShape[1]), 0.5);\n        return sampleTexture(${n}, uv);\n      }\n    `:`\n      float ${r}(int index) {\n        vec2 uv = vec2((float(index + ${o}) + 0.5) / ${i}.0, 0.5);\n        return sampleTexture(${n}, uv);\n      }\n    `;if(t)return`\n    float ${r}(int index) {\n      vec2 uv = uvFromFlat(${n}TexShape[0], ${n}TexShape[1], index + ${o});\n      return sampleTexture(${n}, uv);\n    }\n  `;return`\n    float ${r}(int index) {\n      vec2 uv = uvFromFlat(${s}, ${i}, index + ${o});\n      return sampleTexture(${n}, uv);\n    }\n  `}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),s=e.shapeInfo.texShape;if(null!=s&&eo(n,s)){if(t)return`\n      float ${a}(int row, int col) {\n        vec2 uv = (vec2(col, row) + halfCR) / vec2(${r}TexShape[1], ${r}TexShape[0]);\n        return sampleTexture(${r}, uv);\n      }\n    `;const e=s[0];return`\n    float ${a}(int row, int col) {\n      vec2 uv = (vec2(col, row) + halfCR) / vec2(${s[1]}.0, ${e}.0);\n      return sampleTexture(${r}, uv);\n    }\n  `}const{newShape:i,keptDims:o}=oo(n),l=i;if(l.length<n.length){const n=["row","col"];return`\n      ${CL(DL(e,l),t)}\n      float ${a}(int row, int col) {\n        return ${a}(${ML(n,o)});\n      }\n    `}if(e.shapeInfo.isUniform)return`\n      float ${a}(int row, int col) {\n        int index = round(dot(vec2(row, col), vec2(${n[1]}, 1)));\n        ${$L(e)}\n      }\n    `;const u=s[0],c=s[1],d=RL(r);if(1===c)return t?`\n      float ${a}(int row, int col) {\n        float index = dot(vec3(row, col, ${d}), vec3(${r}Shape[1], 1, 1));\n        vec2 uv = vec2(0.5, (index + 0.5) / float(${r}TexShape[0]));\n        return sampleTexture(${r}, uv);\n      }\n    `:`\n    float ${a}(int row, int col) {\n      float index = dot(vec3(row, col, ${d}), vec3(${n[1]}, 1, 1));\n      vec2 uv = vec2(0.5, (index + 0.5) / ${u}.0);\n      return sampleTexture(${r}, uv);\n    }\n  `;if(1===u)return t?`\n      float ${a}(int row, int col) {\n        float index = dot(vec3(row, col, ${d}), vec3(${r}Shape[1], 1, 1));\n        vec2 uv = vec2((index + 0.5) / float(${r}TexShape[1]), 0.5);\n        return sampleTexture(${r}, uv);\n      }\n    `:`\n    float ${a}(int row, int col) {\n      float index = dot(vec3(row, col, ${d}), vec3(${n[1]}, 1, 1));\n      vec2 uv = vec2((index + 0.5) / ${c}.0, 0.5);\n      return sampleTexture(${r}, uv);\n    }\n  `;if(t)return`\n      float ${a}(int row, int col) {\n        // Explicitly use integer operations as dot() only works on floats.\n        int index = row * ${r}Shape[1] + col + ${d};\n        vec2 uv = uvFromFlat(${r}TexShape[0], ${r}TexShape[1], index);\n        return sampleTexture(${r}, uv);\n      }\n    `;return`\n  float ${a}(int row, int col) {\n    // Explicitly use integer operations as dot() only works on floats.\n    int index = row * ${n[1]} + col + ${d};\n    vec2 uv = uvFromFlat(${u}, ${c}, index);\n    return sampleTexture(${r}, uv);\n  }\n`}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),s=n[1]*n[2],i=n[2],{newShape:o,keptDims:l}=oo(n),u=o;if(u.length<n.length){const n=["row","col","depth"];return`\n        ${CL(DL(e,u),t)}\n        float ${a}(int row, int col, int depth) {\n          return ${a}(${ML(n,l)});\n        }\n      `}if(e.shapeInfo.isUniform)return`\n      float ${a}(int row, int col, int depth) {\n        int index = round(dot(vec3(row, col, depth),\n                          vec3(${s}, ${i}, 1)));\n        ${$L(e)}\n      }\n    `;const c=e.shapeInfo.texShape,d=c[0],h=c[1],p=e.shapeInfo.flatOffset;if(h===s&&null==p)return t?`\n      float ${a}(int row, int col, int depth) {\n        int stride1 = ${r}Shape[2];\n        float texR = float(row);\n        float texC = dot(vec2(col, depth), vec2(stride1, 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(${r}TexShape[1], ${r}TexShape[0]);\n        return sampleTexture(${r}, uv);\n      }\n    `:`\n        float ${a}(int row, int col, int depth) {\n          float texR = float(row);\n          float texC = dot(vec2(col, depth), vec2(${i}, 1));\n          vec2 uv = (vec2(texC, texR) + halfCR) /\n                     vec2(${h}.0, ${d}.0);\n          return sampleTexture(${r}, uv);\n        }\n      `;if(h===i&&null==p)return t?`\n      float ${a}(int row, int col, int depth) {\n        float texR = dot(vec2(row, col), vec2(${r}Shape[1], 1));\n        float texC = float(depth);\n        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${r}TexShape[1], ${r}TexShape[0]);\n        return sampleTexture(${r}, uv);\n      }\n    `:`\n    float ${a}(int row, int col, int depth) {\n      float texR = dot(vec2(row, col), vec2(${n[1]}, 1));\n      float texC = float(depth);\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${h}.0, ${d}.0);\n      return sampleTexture(${r}, uv);\n    }\n  `;const f=RL(r);if(t)return`\n    float ${a}(int row, int col, int depth) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int stride0 = ${r}Shape[1] * ${r}Shape[2];\n      int stride1 = ${r}Shape[2];\n      int index = row * stride0 + col * stride1 + depth + ${f};\n      vec2 uv = uvFromFlat(${r}TexShape[0], ${r}TexShape[1], index);\n      return sampleTexture(${r}, uv);\n    }\n    `;return`\n      float ${a}(int row, int col, int depth) {\n        // Explicitly use integer operations as dot() only works on floats.\n        int index = row * ${s} + col * ${i} + depth + ${f};\n        vec2 uv = uvFromFlat(${d}, ${h}, index);\n        return sampleTexture(${r}, uv);\n      }\n  `}(e,t);case 4:return function(e,t){const n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),s=n[3],i=n[2]*s,o=n[1]*i,{newShape:l,keptDims:u}=oo(n);if(l.length<n.length){const n=["row","col","depth","depth2"];return`\n      ${CL(DL(e,l),t)}\n      float ${a}(int row, int col, int depth, int depth2) {\n        return ${a}(${ML(n,u)});\n      }\n    `}if(e.shapeInfo.isUniform)return`\n      float ${a}(int row, int col, int depth, int depth2) {\n        int index = round(dot(vec4(row, col, depth, depth2),\n                          vec4(${o}, ${i}, ${s}, 1)));\n        ${$L(e)}\n      }\n    `;const c=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,h=d[0],p=d[1],f=`int stride2 = ${r}Shape[3];`,m=`int stride1 = ${r}Shape[2] * stride2;`,g=`int stride0 = ${r}Shape[1] * stride1;`;if(p===o&&null==c)return t?`\n      float ${a}(int row, int col, int depth, int depth2) {\n        ${f}\n        ${m}\n        float texR = float(row);\n        float texC =\n            dot(vec3(col, depth, depth2),\n                vec3(stride1, stride2, 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(${r}TexShape[1], ${r}TexShape[0]);\n        return sampleTexture(${r}, uv);\n      }\n    `:`\n      float ${a}(int row, int col, int depth, int depth2) {\n        float texR = float(row);\n        float texC =\n            dot(vec3(col, depth, depth2),\n                vec3(${i}, ${s}, 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(${p}.0, ${h}.0);\n        return sampleTexture(${r}, uv);\n      }\n    `;if(p===s&&null==c)return t?`\n      float ${a}(int row, int col, int depth, int depth2) {\n        float texR = dot(vec3(row, col, depth),\n                         vec3(${r}Shape[1] * ${r}Shape[2], ${r}Shape[2], 1));\n        float texC = float(depth2);\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2(${r}TexShape[1], ${r}TexShape[0]);\n        return sampleTexture(${r}, uv);\n      }\n    `:`\n      float ${a}(int row, int col, int depth, int depth2) {\n        float texR = dot(vec3(row, col, depth),\n                         vec3(${n[1]*n[2]}, ${n[2]}, 1));\n        float texC = float(depth2);\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2(${p}.0, ${h}.0);\n        return sampleTexture(${r}, uv);\n      }\n    `;const y=RL(r);if(t)return`\n    float ${a}(int row, int col, int depth, int depth2) {\n      // Explicitly use integer operations as dot() only works on floats.\n      ${f}\n      ${m}\n      ${g}\n      int index = row * stride0 + col * stride1 +\n          depth * stride2 + depth2;\n      vec2 uv = uvFromFlat(${r}TexShape[0], ${r}TexShape[1], index + ${y});\n      return sampleTexture(${r}, uv);\n    }\n  `;return`\n    float ${a}(int row, int col, int depth, int depth2) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * ${o} + col * ${i} +\n          depth * ${s} + depth2;\n      vec2 uv = uvFromFlat(${h}, ${p}, index + ${y});\n      return sampleTexture(${r}, uv);\n    }\n  `}(e,t);case 5:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=t[4],s=t[3]*a,i=t[2]*s,o=t[1]*i,{newShape:l,keptDims:u}=oo(t);if(l.length<t.length){const t=["row","col","depth","depth2","depth3"];return`\n      ${CL(DL(e,l))}\n      float ${r}(int row, int col, int depth, int depth2, int depth3) {\n        return ${r}(${ML(t,u)});\n      }\n    `}if(e.shapeInfo.isUniform)return`\n      float ${r}(int row, int col, int depth, int depth2, int depth3) {\n        float index = dot(\n          vec4(row, col, depth, depth2),\n          vec4(${o}, ${i}, ${s}, ${a})) +\n          depth3;\n        ${$L(e)}\n      }\n    `;const c=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,h=d[0],p=d[1];if(p===o&&null==c)return`\n      float ${r}(int row, int col, int depth, int depth2, int depth3) {\n        int texR = row;\n        float texC = dot(vec4(col, depth, depth2, depth3),\n                         vec4(${i}, ${s}, ${a}, 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(${p}.0, ${h}.0);\n        return sampleTexture(${n}, uv);\n      }\n    `;if(p===a&&null==c)return`\n      float ${r}(int row, int col, int depth, int depth2, int depth3) {\n        float texR = dot(\n          vec4(row, col, depth, depth2),\n          vec4(${t[1]*t[2]*t[3]},\n               ${t[2]*t[3]}, ${t[3]}, 1));\n        int texC = depth3;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2(${p}.0, ${h}.0);\n        return sampleTexture(${n}, uv);\n      }\n    `;const f=RL(n);return`\n    float ${r}(int row, int col, int depth, int depth2, int depth3) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * ${o} + col * ${i} + depth * ${s} +\n          depth2 * ${a} + depth3 + ${f};\n      vec2 uv = uvFromFlat(${h}, ${p}, index);\n      return sampleTexture(${n}, uv);\n    }\n  `}(e);case 6:return function(e){const t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),{newShape:a,keptDims:s}=oo(t);if(a.length<t.length){const t=["row","col","depth","depth2","depth3","depth4"];return`\n      ${CL(DL(e,a))}\n      float ${r}(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        return ${r}(${ML(t,s)});\n      }\n    `}const i=t[5],o=t[4]*i,l=t[3]*o,u=t[2]*l,c=t[1]*u;if(e.shapeInfo.isUniform)return`\n      float ${r}(int row, int col, int depth,\n                  int depth2, int depth3, int depth4) {\n        int index = round(dot(\n          vec4(row, col, depth, depth2),\n          vec4(${c}, ${u}, ${l}, ${o})) +\n          dot(\n            vec2(depth3, depth4),\n            vec2(${i}, 1)));\n        ${$L(e)}\n      }\n    `;const d=e.shapeInfo.flatOffset,h=e.shapeInfo.texShape,p=h[0],f=h[1];if(f===c&&null==d)return`\n      float ${r}(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        int texR = row;\n        float texC = dot(vec4(col, depth, depth2, depth3),\n          vec4(${u}, ${l}, ${o}, ${i})) +\n               float(depth4);\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2(${f}.0, ${p}.0);\n        return sampleTexture(${n}, uv);\n      }\n    `;if(f===i&&null==d)return`\n      float ${r}(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        float texR = dot(vec4(row, col, depth, depth2),\n          vec4(${t[1]*t[2]*t[3]*t[4]},\n               ${t[2]*t[3]*t[4]},\n               ${t[3]*t[4]},\n               ${t[4]})) + float(depth3);\n        int texC = depth4;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2(${f}.0, ${p}.0);\n        return sampleTexture(${n}, uv);\n      }\n    `;const m=RL(n);return`\n    float ${r}(int row, int col, int depth,\n                  int depth2, int depth3, int depth4) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * ${c} + col * ${u} + depth * ${l} +\n          depth2 * ${o} + depth3 * ${i} + depth4 + ${m};\n      vec2 uv = uvFromFlat(${p}, ${f}, index);\n      return sampleTexture(${n}, uv);\n    }\n  `}(e);default:throw new Error(`${n.length}-D input sampling is not yet supported`)}}function IL(e,t){switch(e.shapeInfo.logicalShape.length){case 0:return function(e){const t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1),r=yL();return`\n    vec4 ${n}() {\n      return ${r.texture2D}(${t}, halfCR);\n    }\n  `}(e);case 1:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=e.shapeInfo.texShape,s=yL();if(t)return`\n    vec4 ${r}(int index) {\n      ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));\n      vec2 uv = packedUVfrom1D(\n        packedTexShape[0], packedTexShape[1], index);\n      return ${s.texture2D}(${n}, uv);\n    }\n  `;const i=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)];return`\n    vec4 ${r}(int index) {\n      vec2 uv = packedUVfrom1D(\n        ${i[0]}, ${i[1]}, index);\n      return ${s.texture2D}(${n}, uv);\n    }\n  `}(e,t);case 2:return function(e,t){const n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),s=e.shapeInfo.texShape,i=s[0],o=s[1],l=yL();if(null!=s&&eo(n,s))return t?`\n      vec4 ${a}(int row, int col) {\n        vec2 uv = (vec2(col, row) + halfCR) / vec2(${r}TexShape[1], ${r}TexShape[0]);\n\n        return ${l.texture2D}(${r}, uv);\n      }\n    `:`\n      vec4 ${a}(int row, int col) {\n        vec2 uv = (vec2(col, row) + halfCR) / vec2(${o}.0, ${i}.0);\n\n        return ${l.texture2D}(${r}, uv);\n      }\n    `;if(t)return`\n    vec4 ${a}(int row, int col) {\n      ivec2 packedTexShape = ivec2(ceil(float(${r}TexShape[0]) / 2.0), ceil(float(${r}TexShape[1]) / 2.0));\n      int valuesPerRow = int(ceil(float(${r}Shape[1]) / 2.0));\n      vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);\n      return ${l.texture2D}(${r}, uv);\n    }\n  `;const u=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)],c=Math.ceil(n[1]/2);return`\n    vec4 ${a}(int row, int col) {\n      vec2 uv = packedUVfrom2D(${c}, ${u[0]}, ${u[1]}, row, col);\n      return ${l.texture2D}(${r}, uv);\n    }\n  `}(e,t);case 3:return function(e,t){const n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),s=e.shapeInfo.texShape,i=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];if(1===n[0]){const r=[1,2],s=["b","row","col"];return`\n        ${IL(DL(e,n.slice(1)),t)}\n        vec4 ${a}(int b, int row, int col) {\n          return ${a}(${ML(s,r)});\n        }\n      `}const o=yL();if(t)return`\n    vec4 ${a}(int b, int row, int col) {\n      ivec2 packedTexShape = ivec2(ceil(float(${r}TexShape[0]) / 2.0), ceil(float(${r}TexShape[1]) / 2.0));\n      int valuesPerRow = int(ceil(float(${r}Shape[2]) / 2.0));\n      int texelsInBatch = valuesPerRow * int(ceil(float(${r}Shape[1]) / 2.0));\n      vec2 uv = packedUVfrom3D(\n        packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);\n      return ${o.texture2D}(${r}, uv);\n    }\n  `;const l=i[0],u=i[1],c=Math.ceil(n[2]/2),d=c*Math.ceil(n[1]/2);return`\n    vec4 ${a}(int b, int row, int col) {\n      vec2 uv = packedUVfrom3D(\n        ${l}, ${u}, ${d}, ${c}, b, row, col);\n      return ${o.texture2D}(${r}, uv);\n    }\n  `}(e,t);default:return function(e,t){const n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=yL();if(t)return`\n    vec4 ${r}(int b2, int b, int row, int col) {\n      int valuesPerRow = int(ceil(float(${n}Shape[3]) / 2.0));\n      int texelsInBatch = valuesPerRow * int(ceil(float(${n}Shape[2]) / 2.0));\n      int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);\n      texelsInBatch *= ${n}Shape[1];\n      index = b2 * texelsInBatch + index;\n      ivec2 packedTexShape = ivec2(ceil(float(${n}TexShape[0]) / 2.0), ceil(float(${n}TexShape[1]) / 2.0));\n      int texR = index / packedTexShape[1];\n      int texC = index - texR * packedTexShape[1];\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ${a.texture2D}(${n}, uv);\n    }\n  `;const s=e.shapeInfo.logicalShape,i=s.length,o=e.shapeInfo.texShape,l=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)],u=l[0],c=l[1],d=Math.ceil(s[i-1]/2);let h=d*Math.ceil(s[i-2]/2),p="int b, int row, int col",f=`b * ${h} + (row / 2) * ${d} + (col / 2)`;for(let m=2;m<i-1;m++)p=`int b${m}, `+p,h*=s[i-m-1],f=`b${m} * ${h} + `+f;return`\n    vec4 ${r}(${p}) {\n      int index = ${f};\n      int texR = index / ${c};\n      int texC = index - texR * ${c};\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${c}, ${u});\n      return ${a.texture2D}(${n}, uv);\n    }\n  `}(e,t)}}const WL="\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n  int texelIndex = index / 2;\n  int texR = texelIndex / texNumC;\n  int texC = texelIndex - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",_L="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n  int texNumC, int row, int col) {\n  int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n  int texR = texelIndex / texNumC;\n  int texC = texelIndex - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",TL="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n    int texelsInBatch, int texelsInLogicalRow, int b,\n    int row, int col) {\n  int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",NL="\n  float getChannel(vec4 frag, vec2 innerDims) {\n    vec2 modCoord = mod(innerDims, 2.);\n    return modCoord.x == 0. ?\n      (modCoord.y == 0. ? frag.r : frag.g) :\n      (modCoord.y == 0. ? frag.b : frag.a);\n  }\n  float getChannel(vec4 frag, int dim) {\n    float modCoord = mod(float(dim), 2.);\n    return modCoord == 0. ? frag.r : frag.g;\n  }\n";function EL(){return"\n    int getOutputCoords() {\n      return 0;\n    }\n  "}function RL(e){return`offset${e}`}function $L(e){const t=e.name,n=Ji(e.shapeInfo.logicalShape);return n<2?`return ${t};`:`\n    for (int i = 0; i < ${n}; i++) {\n      if (i == index) {\n        return ${t}[i];\n      }\n    }\n  `}function OL(e){if(e<=1)return"int";if(2===e)return"ivec2";if(3===e)return"ivec3";if(4===e)return"ivec4";if(5===e)return"ivec5";if(6===e)return"ivec6";throw Error(`GPU for rank ${e} is not yet supported`)}function FL(e,t,n){const{newShape:r,keptDims:a}=oo(t),s=t.length,i=e&&3===s&&1===t[0],o=i?t.slice(1):r,l=!e&&s>1&&!eo(t,n)&&r.length<s||i;return{useSqueezeShape:l,uniformShape:l?o:t,keptDims:a}}function DL(e,t){const n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function ML(e,t){return t.map((t=>e[t])).join(", ")}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function LL(e,t,n,r){const a=n.map(((e,n)=>{const r={logicalShape:e.shape,texShape:e.isUniform?null:e.texData.texShape,isUniform:e.isUniform,isPacked:!e.isUniform&&e.texData.isPacked,flatOffset:null};return null!=e.texData&&null!=e.texData.slice&&e.texData.slice.flatOffset>0&&(r.flatOffset=e.texData.slice.flatOffset),{name:t.variableNames[n],shapeInfo:r}})),s=a.map((e=>e.shapeInfo)),i={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},o=SL(a,i,t),l=function(e,t){const n=rL(e,(()=>e.createShader(e.FRAGMENT_SHADER)),"Unable to create fragment WebGLShader.");if(jM(e,(()=>e.shaderSource(n,t))),jM(e,(()=>e.compileShader(n))),Do().get("ENGINE_COMPILE_ONLY"))return n;if(!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw ZM(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}(e.gl,o),u=e.createProgram(l);return Do().get("ENGINE_COMPILE_ONLY")?{program:t,fragmentShader:l,source:o,webGLProgram:u,inShapeInfos:s,outShapeInfo:i,variablesLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}:(e.buildVao(u),Object.assign({program:t,fragmentShader:l,source:o,webGLProgram:u,inShapeInfos:s,outShapeInfo:i},BL(e,t,u)))}function BL(e,t,n){const r=[],a=[];let s,i,o,l=null,u=null;u=e.getUniformLocation(n,"NAN",!1),1===Do().getNumber("WEBGL_VERSION")&&(l=e.getUniformLocation(n,"INFINITY",!1));const c=!1;for(const d of t.variableNames){const a={name:d,uniform:e.getUniformLocation(n,d,c),offset:e.getUniformLocation(n,`offset${d}`,c)};t.enableShapeUniforms&&(a.shape=e.getUniformLocation(n,`${d}Shape`,c),a.texShape=e.getUniformLocation(n,`${d}TexShape`,c)),r.push(a)}if(t.enableShapeUniforms&&(s=e.getUniformLocation(n,"outShape",c),o=e.getUniformLocation(n,"outShapeStrides",c),i=e.getUniformLocation(n,"outTexShape",c)),t.customUniforms)for(const d of t.customUniforms)a.push(e.getUniformLocation(n,d.name,c));return{variablesLocations:r,customUniformLocations:a,infLoc:l,nanLoc:u,outShapeLocation:s,outShapeStridesLocation:o,outTexShapeLocation:i}}function PL(e,t){if(e.length!==t.length)throw Error(`Binary was compiled with ${e.length} inputs, but was executed with ${t.length} inputs`);e.forEach(((e,n)=>{const r=e.logicalShape,a=t[n],s=a.shape;if(!eo(r,s))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${r} and ${s} must match`);if(e.isUniform&&a.isUniform)return;const i=e.texShape,o=a.isUniform?null:a.texData.texShape;if(!eo(i,o))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${i} and ${o} must match`)}))}function zL(e){return Do().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&e<=4}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class GL{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=DM.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=yL();this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length),this.userCode=`\n      ivec3 outCoordsFromFlatIndex(int index) {\n        ${this.enableShapeUniforms?vL(["r","c","d"],e):bL(["r","c","d"],e)}\n        return ivec3(r, c, d);\n      }\n\n      void main() {\n        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n        vec4 result = vec4(0.);\n\n        for (int i=0; i<4; i++) {\n          int flatIndex = index + i;\n          ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n          result[i] = getA(rc.x, rc.y, rc.z);\n        }\n\n        ${t.output} = result;\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class VL{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=DM.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=yL();this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length),this.userCode=`\n      ivec3 outCoordsFromFlatIndex(int index) {\n        ${this.enableShapeUniforms?vL(["r","c","d"],e):bL(["r","c","d"],e)}\n        return ivec3(r, c, d);\n      }\n\n      void main() {\n        ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n        int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n        vec4 result = vec4(0.);\n\n        for (int i=0; i<4; i++) {\n          int flatIndex = index + i;\n          ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n          result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n        }\n\n        ${t.output} = result;\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class UL{constructor(e){this.variableNames=["A"],this.outTexUsage=LM.DOWNLOAD;const t=yL();this.outputShape=e,this.userCode=`\n      ${kL}\n\n      void main() {\n        float x = getAAtOutCoords();\n        ${t.output} = encode_float(x);\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class HL{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=LM.DOWNLOAD;const t=yL();this.outputShape=e,this.userCode=`\n      ${kL}\n\n      void main() {\n        ivec3 coords = getOutputCoords();\n        float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n        ${t.output} = encode_float(x);\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jL={R:0,G:1,B:2,A:3};class qL{constructor(e,t=!1,n="RGBA"){this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];const r=yL();this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length);let a="result";t&&(a="floor(result * 255. + 0.5)");let s="";for(let i=0;i<n.length;i++){const e=n[i];s+=`\n          if(offset == ${i}) {\n            result = values[${jL[e]}];\n          }`}this.userCode=`\n      ${this.enableShapeUniforms?"\n  int getFlatIndex(ivec3 coords) {\n    return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n  }\n":xL(e)}\n\n      void main() {\n        ivec3 coords = getOutputCoords();\n        int flatIndex = getFlatIndex(coords);\n        float result = 0.;\n        int offset = imod(flatIndex, ${n.length});\n\n        flatIndex = idiv(flatIndex, ${n.length}, 1.);\n\n        int r = flatIndex / texShape[1];\n        if (r < texShape[0]) {\n          int c = imod(flatIndex, texShape[1]);\n          vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n          vec4 values = ${r.texture2D}(A, uv);\n          ${s}\n        }\n        ${r.output} = vec4(${a}, 0., 0., 0.);\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class QL{constructor(e,t=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=yL();this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length);let r="",a="result";t&&(a="floor(result * 255. + 0.5)");for(let s=0;s<=1;s++)for(let t=0;t<=1;t++){const a=2*s+t;r+=`\n          localCoords = coords;\n          if(localCoords[2] + ${t} < ${this.enableShapeUniforms?"outShape[2]":`${e[2]}`}) {\n          localCoords[2] += ${t};\n          if (localCoords[1] + ${s} < ${this.enableShapeUniforms?"outShape[1]":`${e[1]}`}) {\n            localCoords[1] += ${s};\n\n            flatIndex = getFlatIndex(localCoords);\n            offset = imod(flatIndex, 4);\n\n            flatIndex = idiv(flatIndex, 4, 1.);\n\n            int r = flatIndex / texShape[1];\n            int c = imod(flatIndex, texShape[1]);\n            vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n            values = ${n.texture2D}(A, uv);\n\n            if (offset == 0) {\n              result[${a}] = values[0];\n            } else if (offset == 1) {\n              result[${a}] = values[1];\n            } else if (offset == 2) {\n              result[${a}] = values[2];\n            } else {\n              result[${a}] = values[3];\n            }\n          }\n        }\n        `}this.userCode=`\n        ${this.enableShapeUniforms?"\n  int getFlatIndex(ivec3 coords) {\n    return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n  }\n":xL(e)}\n\n        void main() {\n          ivec3 coords = getOutputCoords();\n\n          vec4 result = vec4(0.);\n          int flatIndex, r, c, offset;\n          ivec3 localCoords;\n          vec2 uv;\n          vec4 values;\n\n          ${r}\n\n          ${n.output} = ${a};\n        }\n    `}}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function XL(e){const t=yL();return function(e,t){const n=rL(e,(()=>e.createShader(e.VERTEX_SHADER)),"Unable to create vertex WebGLShader.");if(jM(e,(()=>e.shaderSource(n,t))),jM(e,(()=>e.compileShader(n))),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw new Error("Failed to compile vertex shader.");return n}(e,`${t.version}\n    precision highp float;\n    ${t.attribute} vec3 clipSpacePos;\n    ${t.attribute} vec2 uv;\n    ${t.varyingVs} vec2 resultUV;\n\n    void main() {\n      gl_Position = vec4(clipSpacePos, 1);\n      resultUV = uv;\n    }`)}function ZL(e){return function(e,t){const n=rL(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return jM(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n))),jM(e,(()=>e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW))),n}(e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function KL(e){return function(e,t){const n=rL(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return jM(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n))),jM(e,(()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW))),n}(e,new Uint16Array([0,1,2,2,1,3]))}function JL(e,t,n,r,a,s){!function(e,t){const n=Do().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0)throw new Error(`Requested texture size [${e}x${t}] is invalid.`);if(e>n||t>n)throw new Error(`Requested texture size [${e}x${t}] greater than WebGL maximum on this browser / GPU [${n}x${n}].`)}(t,n);const i=function(e){return rL(e,(()=>e.createTexture()),"Unable to create WebGLTexture.")}(e),o=e.TEXTURE_2D;return jM(e,(()=>e.bindTexture(o,i))),jM(e,(()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE))),jM(e,(()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE))),jM(e,(()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST))),jM(e,(()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST))),1===Do().getNumber("WEBGL_VERSION")?jM(e,(()=>e.texImage2D(o,0,r,t,n,0,a,s,null))):jM(e,(()=>e.texStorage2D(o,1,r,t,n))),jM(e,(()=>e.bindTexture(e.TEXTURE_2D,null))),{texture:i,texShape:[n,t]}}function YL(e){return e.internalFormatFloat}function eB(e){return e.internalFormatHalfFloat}function tB(e){return e.downloadTextureFormat}function nB(e){return e.internalFormatPackedFloat}function rB(e){return e.internalFormatPackedHalfFloat}function aB(e,t,n,r,a,s,i,o){const l=e,u=new Float32Array(function(e,t){const[n,r]=UM(e,t);return n*r*4}(s,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,t),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,u),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),u}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class sB{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.itemsToPoll=[];const t=Do().getNumber("WEBGL_VERSION");if(null!=e?(this.gl=e,function(e,t){$M[e]=t}(t,e)):this.gl=FM(t),e=this.gl,2===Do().getNumber("WEBGL_VERSION")){const t=e;this.createVertexArray=()=>jM(t,(()=>t.createVertexArray())),this.bindVertexArray=e=>jM(t,(()=>t.bindVertexArray(e))),this.deleteVertexArray=e=>jM(t,(()=>t.deleteVertexArray(e))),this.getVertexArray=()=>jM(t,(()=>t.getParameter(t.VERTEX_ARRAY_BINDING)))}else if(null!=e){const t=e.getExtension("OES_vertex_array_object");if(null==t)throw new Error("All WebGL1 implementations are expected to offer OES_vertex_array_object.");this.createVertexArray=()=>jM(e,(()=>t.createVertexArrayOES())),this.bindVertexArray=n=>jM(e,(()=>t.bindVertexArrayOES(n))),this.deleteVertexArray=n=>jM(e,(()=>t.deleteVertexArrayOES(n))),this.getVertexArray=()=>jM(e,(()=>e.getParameter(t.VERTEX_ARRAY_BINDING_OES)))}let n="WEBGL_color_buffer_float";const r="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),1===Do().getNumber("WEBGL_VERSION")){const e="OES_texture_float",t="OES_texture_half_float";if(this.textureFloatExtension=QM(this.gl,e),dL(this.gl,t))this.textureHalfFloatExtension=QM(this.gl,t);else if(Do().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),dL(this.gl,r))this.colorBufferHalfFloatExtension=QM(this.gl,r);else if(Do().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",dL(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!dL(this.gl,r))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension(r)}this.vertexBuffer=ZL(this.gl),this.indexBuffer=KL(this.gl),this.framebuffer=function(e){return rL(e,(()=>e.createFramebuffer()),"Unable to create WebGLFramebuffer.")}(this.gl),this.textureConfig=HM(this.gl,this.textureHalfFloatExtension)}get debug(){return Do().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program,this.outputTexture;const e=this.gl;jM(e,(()=>e.finish())),jM(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,null))),jM(e,(()=>e.deleteFramebuffer(this.framebuffer))),jM(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,null))),jM(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null))),jM(e,(()=>e.deleteBuffer(this.indexBuffer))),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),function(e,t,n,r){const[a,s]=GM(t,n);return JL(e,a,s,YL(r),r.textureFormatFloat,e.FLOAT)}(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),function(e,t,n,r){const[a,s]=GM(t,n);return JL(e,a,s,eB(r),r.textureFormatFloat,r.textureTypeHalfFloat)}(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),function(e,t,n,r){const[a,s]=GM(t,n);return JL(e,a,s,tB(r),e.RGBA,e.UNSIGNED_BYTE)}(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),function(e,t,n){jM(e,(()=>e.bindTexture(e.TEXTURE_2D,t))),n.data instanceof Uint8Array?2===Do().getNumber("WEBGL_VERSION")?jM(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,e.RGBA,e.UNSIGNED_BYTE,n.data))):jM(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data))):2===Do().getNumber("WEBGL_VERSION")?jM(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n))):jM(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n))),jM(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))}(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,n,r){this.throwIfDisposed(),function(e,t,n,r,a,s){let i,o,l;jM(e,(()=>e.bindTexture(e.TEXTURE_2D,t))),a instanceof Uint8Array?(i=new Uint8Array(n*r*4),o=e.UNSIGNED_BYTE,l=e.RGBA):(i=new Float32Array(n*r*4),o=e.FLOAT,l=s.internalFormatPackedFloat),i.set(a),2===Do().getNumber("WEBGL_VERSION")?jM(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,r,e.RGBA,o,i))):jM(e,(()=>e.texImage2D(e.TEXTURE_2D,0,l,n,r,0,e.RGBA,o,i))),jM(e,(()=>e.bindTexture(e.TEXTURE_2D,null)))}(this.gl,e,t,n,r,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),function(e,t,n,r){const[a,s]=UM(t,n);return JL(e,a,s,rB(r),e.RGBA,r.textureTypeHalfFloat)}(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),function(e,t,n,r){const[a,s]=UM(t,n);return JL(e,a,s,nB(r),e.RGBA,e.FLOAT)}(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(tL(this.gl,this.framebuffer),this.outputTexture=null),jM(this.gl,(()=>this.gl.deleteTexture(e)))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,(()=>function(e,t,n,r){const[a,s]=GM(t,n),i=new Uint8Array(t*n*4);return jM(e,(()=>e.readPixels(0,0,a,s,r.downloadTextureFormat,e.UNSIGNED_BYTE,i))),new Float32Array(i.buffer)}(this.gl,t,n,this.textureConfig)))}downloadPackedMatrixFromBuffer(e,t,n,r,a,s){return aB(this.gl,e,0,0,0,a,s,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return function(e,t,n){const r=e,a=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,t),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,a),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),a}(this.gl,e,t)}createBufferFromTexture(e,t,n){this.bindTextureToFrameBuffer(e);const r=function(e,t,n){const r=e.createBuffer();jM(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,r)));const a=16*t*n;return jM(e,(()=>e.bufferData(e.PIXEL_PACK_BUFFER,a,e.STREAM_READ))),jM(e,(()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0))),jM(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null))),r}(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r}createAndWaitForFence(){const e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,n;if(Do().getBool("WEBGL_FENCE_API_ENABLED")){const r=e,a=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=()=>{const e=r.clientWaitSync(a,0,0);return e===r.ALREADY_SIGNALED||e===r.CONDITION_SATISFIED},t=a}else Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):n=()=>!0;return{query:t,isFencePassed:n}}downloadMatrixFromPackedTexture(e,t,n){return this.downloadMatrixDriver(e,(()=>function(e,t,n){const r=new Float32Array(t*n*4);return jM(e,(()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,r))),r}(this.gl,t,n)))}createProgram(e){this.throwIfDisposed();const t=this.gl;null==this.vertexShader&&(this.vertexShader=XL(t));const n=function(e){return rL(e,(()=>e.createProgram()),"Unable to create WebGLProgram.")}(t);jM(t,(()=>t.attachShader(n,this.vertexShader))),jM(t,(()=>t.attachShader(n,e))),function(e,t){if(jM(e,(()=>e.linkProgram(t))),!Do().get("ENGINE_COMPILE_ONLY")&&!1===e.getProgramParameter(t,e.LINK_STATUS))throw new Error("Failed to link vertex and fragment shaders.")}(t,n);const r=Object.assign(n,{vao:this.createVertexArray()});return this.debug&&KM(t,r),r}buildVao(e){this.setProgram(e),this.bindVertexArray(e.vao);const t=this.gl;jM(t,(()=>t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer))),function(e,t,n){jM(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n))),JM(e,t,"clipSpacePos",n,3,20,0)&&JM(e,t,"uv",n,2,20,12)}(t,e,this.vertexBuffer)}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&(jM(this.gl,(()=>this.gl.deleteProgram(e))),this.deleteVertexArray(e.vao))}setProgram(e){this.throwIfDisposed(),this.program=e,null!=this.program&&this.debug&&KM(this.gl,this.program),jM(this.gl,(()=>this.gl.useProgram(e)))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?function(e,t,n){return rL(e,(()=>e.getUniformLocation(t,n)),'uniform "'+n+'" not present in program.')}(this.gl,e,t):function(e,t,n){return e.getUniformLocation(t,n)}(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),jM(this.gl,(()=>this.gl.getAttribLocation(e,t)))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),function(e,t,n,r){jM(e,(()=>YM(e,t,r))),jM(e,(()=>e.uniform1i(n,r)))}(this.gl,e,t,n)}setOutputMatrixTexture(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}setOutputPackedMatrixTexture(e,t,n){this.throwIfDisposed();const[r,a]=UM(t,n);this.setOutputMatrixTextureDriver(e,r,a)}setOutputMatrixWriteRegion(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t)}setOutputPackedMatrixWriteRegion(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){null!=this.program&&KM(this.gl,this.program),nL(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;if(this.debug){this.getVertexArray();this.debugValidate()}jM(e,(()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),jM(this.gl,(()=>this.gl.finish()))}getQueryTimerExtension(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=QM(this.gl,2===Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(2===Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2(),n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}const e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(2===Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){const e=this.gl,t=this.getQueryTimerExtensionWebGL2();return void e.endQuery(t.TIME_ELAPSED_EXT)}const e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await ao((()=>this.disposed||this.isQueryAvailable(e,Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")))),this.getQueryTime(e,Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(0===t)return null;if(2===t){const t=this.gl;return t.getQueryParameter(e,t.QUERY_RESULT)/1e6}{const t=this.getQueryTimerExtensionWebGL1();return t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(0===t)return!0;if(2===t){const t=this.gl,n=this.getQueryTimerExtensionWebGL2(),r=t.getQueryParameter(e,t.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(n.GPU_DISJOINT_EXT)),r&&!this.disjoint}{const t=this.getQueryTimerExtensionWebGL1(),n=t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(t.GPU_DISJOINT_EXT)),n&&!this.disjoint}}pollFence(e){return new Promise((t=>{this.addItemToPoll((()=>e.isFencePassed()),(()=>t()))}))}pollItems(){const e=function(e){let t=0;for(;t<e.length;++t){if(!e[t]())break}return t-1}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(this.itemsToPoll.map((e=>e.isDoneFn)));for(let t=0;t<=e;++t){const{resolveFn:e}=this.itemsToPoll[t];e()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){if(this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1)return;let n;"setTimeoutCustom"in Do().platform&&(n=Do().platform.setTimeoutCustom.bind(Do().platform)),ao((()=>(this.pollItems(),0===this.itemsToPoll.length)),(()=>0),null,n)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),eL(this.gl,e,this.framebuffer),this.debug&&nL(this.gl)}unbindTextureToFrameBuffer(){null!=this.outputTexture?(eL(this.gl,this.outputTexture,this.framebuffer),this.debug&&nL(this.gl)):tL(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);const n=t();return this.unbindTextureToFrameBuffer(),n}setOutputMatrixTextureDriver(e,t,n){this.throwIfDisposed();const r=this.gl;eL(r,e,this.framebuffer),this.debug&&nL(r),this.outputTexture=e,jM(r,(()=>r.viewport(0,0,t,n))),jM(r,(()=>r.scissor(0,0,t,n)))}setOutputMatrixWriteRegionDriver(e,t,n,r){this.throwIfDisposed(),jM(this.gl,(()=>this.gl.scissor(e,t,n,r)))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(null==this.program)throw new Error("No GPU program is currently set.")}}const{addImpl:iB,bincountImpl:oB,bincountReduceImpl:lB,bitwiseAndImpl:uB,castImpl:cB,ceilImpl:dB,concatImpl:hB,equalImpl:pB,expImpl:fB,expm1Impl:mB,floorImpl:gB,gatherNdImpl:yB,gatherV2Impl:bB,greaterImpl:vB,greaterEqualImpl:AB,lessImpl:xB,lessEqualImpl:kB,linSpaceImpl:wB,logImpl:SB,maxImpl:CB,maximumImpl:IB,minimumImpl:WB,multiplyImpl:_B,negImpl:TB,notEqualImpl:NB,prodImpl:EB,raggedGatherImpl:RB,raggedRangeImpl:$B,raggedTensorToTensorImpl:OB,rangeImpl:FB,rsqrtImpl:DB,scatterImpl:MB,sigmoidImpl:LB,simpleAbsImpl:BB,sliceImpl:PB,sparseFillEmptyRowsImpl:zB,sparseReshapeImpl:GB,sparseSegmentReductionImpl:VB,sqrtImpl:UB,staticRegexReplaceImpl:HB,stridedSliceImpl:jB,stringNGramsImpl:qB,stringSplitImpl:QB,stringToHashBucketFastImpl:XB,subImpl:ZB,tileImpl:KB,topKImpl:JB,transposeImpl:YB,uniqueImpl:eP}=$$;
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function tP(e,t){return["x","y","z","w","u","v"].slice(0,t).map((t=>`${e}.${t}`))}function nP(e,t){return 1===t?[e]:tP(e,t)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class rP{constructor(e){if(this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.enableShapeUniforms=zL(this.outputShape.length),0===this.rank)this.userCode="\n        void main() {\n          setOutput(vec4(getA(), 0., 0., 0.));\n        }\n      ";else{const e=nP("rc",this.rank),t=OL(this.rank),n=this.getOutOfBoundsCondition(e),r=this.getSetup(e),a=this.getOutput(e);this.userCode=`\n        void main() {\n          ${t} rc = getOutputCoords();\n\n          if(${n}) {\n            setOutput(vec4(0));\n          } else {\n            ${r}\n\n            setOutput(vec4(${a}));\n          }\n        }\n      `}}getSourceCoordsArr(e){const t=[];for(let n=0;n<=1;n++)for(let r=0;r<=1;r++){let a=`${0===n?"r":"rp1"}, ${0===r?"c":"cp1"}`;for(let t=2;t<this.rank;t++)a=`${e[e.length-1-t]},`+a;t.push(a)}return t}getOutOfBoundsCondition(e){if(1===this.rank)return`rc > ${this.enableShapeUniforms?"outShape":this.outputShape[0]}`;let t="";for(let n=this.rank-2;n<this.rank;n++)t+=`${e[n]} >= ${this.enableShapeUniforms?`outShape[${n}]`:this.outputShape[n]}`,n<this.rank-1&&(t+="||");return t}getSetup(e){if(1===this.rank)return"";const t=e.slice(-2),n=this.enableShapeUniforms?`outShape[${this.rank} - 1]`:this.outputShape[this.rank-1],r=this.enableShapeUniforms?`outShape[${this.rank} - 2]`:this.outputShape[this.rank-2];return`\n      int r = ${t[0]};\n      int c = ${t[1]};\n      int rp1 = r + 1;\n      int cp1 = c + 1;\n\n      bool cEdge = cp1 >= ${n};\n      bool rEdge = rp1 >= ${r};\n    `}getOutput(e){const t=this.getSourceCoordsArr(e);if(1===this.rank){return`getA(rc), (rc + 1 >= ${this.enableShapeUniforms?"outShape":this.outputShape[0]} ? 0. : getA(rc + 1)), 0, 0`}return`getA(${t[0]}),\n            cEdge ? 0. : getA(${t[1]}),\n            rEdge ? 0. : getA(${t[2]}),\n            rEdge || cEdge ? 0. : getA(${t[3]})`}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class aP{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length);let n="";for(let s=0;s<4;s++){let e="thisRC = rc;";s%2==1&&(e+="thisRC.z += 1;"),s>1&&(e+="thisRC.y += 1;"),n+=`\n        ${e}\n        ${s>0?"if(thisRC.y < rows && thisRC.z < cols){":""}\n          int flatIndex = getFlatIndex(thisRC);\n\n          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n          vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n          result[${s}] =\n            getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n        ${s>0?"}":""}\n      `}var r,a;
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */this.userCode=`\n      ${r=t,a=this.enableShapeUniforms,`\n    ivec3 inputCoordsFromReshapedOutCoords(int index) {\n      ${a?AL(["r","c","d"],"inputShape"):bL(["r","c","d"],r)}\n      return ivec3(r, c, d);\n    }\n  `}\n      ${this.enableShapeUniforms?"\n  int getFlatIndex(ivec3 coords) {\n    return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n  }\n":xL(e)}\n\n      void main() {\n        ivec3 rc = getOutputCoords();\n\n        vec4 result = vec4(0.);\n\n        ivec3 thisRC;\n        int rows = ${this.enableShapeUniforms?"outShape[1]":e[1]};\n        int cols = ${this.enableShapeUniforms?"outShape[2]":e[2]};\n\n        ${n}\n\n        setOutput(result);\n      }\n    `}}class sP{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.usedTextures={},this.logEnabled=!1}acquireTexture(e,t,n){const r=oP(t,n),a=lP(e,r,n);a in this.freeTextures||(this.freeTextures[a]=[]),a in this.usedTextures||(this.usedTextures[a]=[]);const s=iP(e,r,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[a].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=s,this.log();const e=this.freeTextures[a].pop();return this.usedTextures[a].push(e),e}let i;return r===PM.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===PM.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):r===PM.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===PM.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===PM.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[a].push(i),this.numUsedTextures++,this._numBytesAllocated+=s,this.log(),i}releaseTexture(e,t,n,r){if(null==this.freeTextures)return;const a=oP(n,r),s=lP(t,a,r);s in this.freeTextures||(this.freeTextures[s]=[]);const i=iP(t,a,this.gpgpu.gl,this.gpgpu.textureConfig,r),o=Do().getNumber("WEBGL_DELETE_TEXTURE_THRESHOLD");-1!==o&&this._numBytesAllocated>o?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=i):(this.freeTextures[s].push(e),this.numFreeTextures++,this._numBytesFree+=i),this.numUsedTextures--;const l=this.usedTextures[s],u=l&&l.indexOf(e);if(null==u||u<0)throw new Error("Cannot release a texture that was never provided by this texture manager");l[u]=l[l.length-1],l.pop(),this.log()}log(){if(!this.logEnabled)return;this.numFreeTextures,this.numUsedTextures,this._numBytesFree,this._numBytesAllocated}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(null!=this.freeTextures){for(const e in this.freeTextures)this.freeTextures[e].forEach((e=>{this.gpgpu.deleteMatrixTexture(e.texture)}));for(const e in this.usedTextures)this.usedTextures[e].forEach((e=>{this.gpgpu.deleteMatrixTexture(e.texture)}));this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}function iP(e,t,n,r,a){const s=function(e,t){switch(e){case PM.PACKED_2X2_FLOAT32:return nB(t);case PM.PACKED_2X2_FLOAT16:return rB(t);case PM.UNPACKED_FLOAT32:return YL(t);case PM.UNPACKED_FLOAT16:return eB(t);case PM.PACKED_4X1_UNSIGNED_BYTE:return tB(t);default:throw new Error(`Unknown physical texture type ${e}`)}}(t,r);let i;if(a){const[t,n]=UM(e[0],e[1]);i=t*n}else{const[t,n]=GM(e[0],e[1]);i=t*n}const o=function(e,t){const n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F)return 16;if(t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;if(t===n.RGBA8)return 4;throw new Error(`Unknown internal format ${t}`)}(n,s);return i*o}function oP(e,t){if(e===LM.UPLOAD)return PM.PACKED_2X2_FLOAT32;if(e===LM.RENDER||null==e)return function(e){return Do().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?PM.PACKED_2X2_FLOAT32:PM.UNPACKED_FLOAT32:e?PM.PACKED_2X2_FLOAT16:PM.UNPACKED_FLOAT16}(t);if(e===LM.DOWNLOAD||e===LM.PIXELS)return PM.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function lP(e,t,n){return`${e[0]}_${e[1]}_${t}_${n}`}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class uP{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length),this.userCode=`\n      float unaryOperation(float x) {\n        ${t}\n      }\n\n      void main() {\n        float x = getAAtOutCoords();\n        float y = unaryOperation(x);\n\n        setOutput(y);\n      }\n    `}}const cP="if (isnan(x)) return x;",dP="return abs(x);",hP=cP+"\n  return (x < 0.0) ? 0.0 : x;\n",pP=cP+"\n  return (x < 0.0) ? 0.0 : min(6.0, x);\n",fP="return x;";class mP{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length),this.userCode=`\n      vec4 unaryOperation(vec4 x) {\n        ${t}\n      }\n\n      void main() {\n        vec4 x = getAAtOutCoords();\n        vec4 y = unaryOperation(x);\n\n        setOutput(y);\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class gP{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length);const t=e.length,n=nP("rc",t),r=OL(t),a=function(e,t){if(1===e)return"rc";let n="";for(let r=0;r<e;r++)n+=t[r],r<e-1&&(n+=",");return n}(t,n),s=n.slice(-2),i=t<=1?"rc":`vec2(${s.join(",")})`;this.userCode=`\n      void main() {\n        ${r} rc = getOutputCoords();\n        vec4 packedInput = getA(${a});\n\n        setOutput(getChannel(packedInput, ${i}));\n      }\n    `}}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yP=ev,bP={};const vP=Do().getNumber("CPU_HANDOFF_SIZE_THRESHOLD");class AP extends Gi{nextDataId(){return AP.nextDataId++}constructor(e){if(super(),this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!Do().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let t;if(null!=e){if(e instanceof sB)t=e;else{const n=FM(Do().getNumber("WEBGL_VERSION"),e);t=new sB(n)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{const e=FM(Do().getNumber("WEBGL_VERSION"));t=new sB(e),this.binaryCache=((n=Do().getNumber("WEBGL_VERSION"))in bP||(bP[n]={}),bP[n]),this.gpgpuCreatedLocally=!0}var n;this.gpgpu=t,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new sP(this.gpgpu),this.numMBBeforeWarning=null==Do().global.screen?1024:Do().global.screen.height*Do().global.screen.width*window.devicePixelRatio*600/1024/1024,this.texData=new zi(this,ip())}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}writeTexture(e,t,n,r,a,s){const i=this.makeTensorInfo(t,n),o=this.texData.get(i.dataId);o.isPacked=!1,o.texture={texture:e,texShape:[r,a]},o.texShape=[r,a];const l=iL(t),u=new qL(l,!1,s),c=this.runWebGLProgram(u,[i],n,[[r,a]]);return c.shape=t,o.texture=null,this.disposeIntermediateTensorInfo(i),c.dataId}write(e,t,n){if((Do().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||Do().getBool("DEBUG"))&&this.checkNumericalProblems(e),"complex64"===n&&null!=e)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");const r={id:this.nextDataId()};return this.texData.set(r,{shape:t,dtype:n,values:e,usage:LM.UPLOAD,refCount:1}),r}refCount(e){if(this.texData.has(e)){return this.texData.get(e).refCount}return 0}incRef(e){this.texData.get(e).refCount++}decRef(e){if(this.texData.has(e)){this.texData.get(e).refCount--}}move(e,t,n,r,a){if(Do().getBool("DEBUG")&&this.checkNumericalProblems(t),"complex64"===r)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:r,values:t,usage:LM.UPLOAD,refCount:a})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){const t=this.texData.get(e),{values:n,dtype:r,complexTensorInfos:a,slice:s,shape:i,isPacked:o}=t;if(null!=s){let t;t=o?new mP(i,fP):new uP(i,fP);const n=this.runWebGLProgram(t,[{dataId:e,shape:i,dtype:r}],r),a=this.readSync(n.dataId);return this.disposeIntermediateTensorInfo(n),a}if(null!=n)return this.convertAndCacheOnCPU(e);if("string"===r)return n;const l=null!=this.activeTimers;let u,c;if(l&&(u=Kd()),"complex64"===r){c=Zx(this.readSync(a.real.dataId),this.readSync(a.imag.dataId))}else c=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=Kd()-u),this.convertAndCacheOnCPU(e,c)}async read(e){if(this.pendingRead.has(e)){const t=this.pendingRead.get(e);return new Promise((e=>t.push(e)))}const t=this.texData.get(e),{values:n,shape:r,slice:a,dtype:s,complexTensorInfos:i,isPacked:o}=t;if(null!=a){let t;t=o?new mP(r,fP):new uP(r,fP);const n=this.runWebGLProgram(t,[{dataId:e,shape:r,dtype:s}],s),a=this.read(n.dataId);return this.disposeIntermediateTensorInfo(n),a}if(null!=n)return this.convertAndCacheOnCPU(e);if(Do().getBool("DEBUG")&&!Do().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===Do().getNumber("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let l,u,c=null;if("complex64"!==s&&Do().get("WEBGL_BUFFER_SUPPORTED")){l=this.decode(e);const t=this.texData.get(l.dataId);c=this.gpgpu.createBufferFromTexture(t.texture.texture,...VM(r))}if(this.pendingRead.set(e,[]),"complex64"!==s&&await this.gpgpu.createAndWaitForFence(),"complex64"===s){const e=await Promise.all([this.read(i.real.dataId),this.read(i.imag.dataId)]);u=Zx(e[0],e[1])}else if(null==c)u=this.getValuesFromTexture(e);else{const e=Ji(r);u=this.gpgpu.downloadFloat32MatrixFromBuffer(c,e)}if(null!=l&&this.disposeIntermediateTensorInfo(l),null!=c){const e=this.gpgpu.gl;jM(e,(()=>e.deleteBuffer(c)))}const d=this.convertAndCacheOnCPU(e,u),h=this.pendingRead.get(e);return this.pendingRead.delete(e),h.forEach((e=>e(d))),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&ip().removeDataId(e,this),this.pendingDeletes--),d}readToGPU(e,t={}){const n=this.texData.get(e),{values:r,shape:a,slice:s,dtype:i,isPacked:o,texture:l}=n;if("complex64"===i)throw new Error("Does not support reading texture for complex64 dtype.");if(null!=s){let n;n=o?new mP(a,fP):new uP(a,fP);const r=this.runWebGLProgram(n,[{dataId:e,shape:a,dtype:i}],i),s=this.readToGPU(r,t);return this.disposeIntermediateTensorInfo(r),s}if(null==l)throw null!=r?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");const u=this.decode(e,t.customTexShape),c=ip().makeTensorFromTensorInfo(u),d=this.texData.get(u.dataId);return Object.assign({tensorRef:c},d.texture)}bufferSync(e){const t=this.readSync(e.dataId);if("string"===e.dtype)try{const n=t.map((e=>Yd(e)));return uf(e.shape,e.dtype,n)}catch(n){throw new Error("Failed to decode encoded string bytes into utf-8")}return uf(e.shape,e.dtype,t)}checkNumericalProblems(e){if(null!=e)for(let t=0;t<e.length;t++){const n=e[t];if(!qM(n)){if(Do().getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))throw Error(`The value ${n} cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`);throw Error(`The value ${n} cannot be represented on this device.`)}}}getValuesFromTexture(e){const{shape:t,dtype:n,isPacked:r}=this.texData.get(e),a=Ji(t);if(Do().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){const n=this.decode(e),r=this.texData.get(n.dataId),s=this.gpgpu.downloadMatrixFromPackedTexture(r.texture.texture,...VM(t)).subarray(0,a);return this.disposeIntermediateTensorInfo(n),s}const s=Do().getBool("WEBGL_PACK")&&!0===r,i=s?iL(t):t,o=s?new HL(i):new UL(i),l=this.runWebGLProgram(o,[{shape:i,dtype:n,dataId:e}],"float32"),u=this.texData.get(l.dataId),c=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(u.texture.texture,u.texShape[0],u.texShape[1]).subarray(0,a);return this.disposeIntermediateTensorInfo(l),c}timerAvailable(){return Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0}time(e){const t=this.activeTimers,n=[];let r=!1;null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,e();const a=th(this.activeTimers.map((e=>e.query))).filter((e=>null!=e)),s=th(this.activeTimers.map((e=>e.name))).filter((e=>null!=e));this.activeTimers=t,r&&(this.programTimersStack=null);const i={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>{if(Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const e=await Promise.all(a);i.kernelMs=Qi(e),i.getExtraProfileInfo=()=>e.map(((e,t)=>({name:s[t],ms:e}))).map((e=>`${e.name}: ${e.ms}`)).join(", ")}else i.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,i})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:Kd(),endMs:null}}endTimer(e){return Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=Kd(),e)}async getQueryTime(e){if(Do().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);const t=e;return t.endMs-t.startMs}disposeData(e,t=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);const{complexTensorInfos:n}=this.texData.get(e);return null!=n&&(this.disposeData(n.real.dataId,t),this.disposeData(n.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){const{texture:t,dtype:n,texShape:r,usage:a,isPacked:s,slice:i}=this.texData.get(e),o=i&&i.origDataId||e,l=this.dataRefCount.get(o);l>1?this.dataRefCount.set(o,l-1):(this.dataRefCount.delete(o),null!=t&&(this.numBytesInGPU-=this.computeBytes(r,n),this.textureManager.releaseTexture(t,r,a,s)));const u=this.texData.get(e);u.texture=null,u.texShape=null,u.isPacked=!1,u.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=vP){return Do().getBool("WEBGL_CPU_FORWARD")&&e.every((e=>null==this.texData.get(e.dataId).texture&&Ji(e.shape)<t))}getGPGPUContext(){return this.gpgpu}where(e){ed();const t=e.dataSync();return yP(e.shape,t)}packedUnaryOp(e,t,n){const r=new mP(e.shape,t),a=this.compileAndRun(r,[e],n);return ip().makeTensorFromTensorInfo(a)}abs(e){if(this.shouldExecuteOnCPU([e])&&"complex64"!==e.dtype){const t=BB(this.texData.get(e.dataId).values);return this.makeOutput(e.shape,e.dtype,t)}if(Do().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,dP,e.dtype);const t=new uP(e.shape,dP),n=this.compileAndRun(t,[e]);return ip().makeTensorFromTensorInfo(n)}makeTensorInfo(e,t,n){let r;if("string"===t&&null!=n&&n.length>0&&go(n[0])){const a=n.map((e=>Jd(e)));r=this.write(a,e,t)}else r=this.write(n,e,t);return this.texData.get(r).usage=null,{dataId:r,shape:e,dtype:t}}makeOutput(e,t,n){return ip().makeTensorFromTensorInfo(this.makeTensorInfo(e,t,n),this)}unpackTensor(e){const t=new gP(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){const t=new rP(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}packedReshape(e,t){const n=[aL(e.shape),...sL(e.shape)],r={dtype:e.dtype,shape:n,dataId:e.dataId},a=[aL(t),...sL(t)],s=new aP(a,n),i=[n],o=this.runWebGLProgram(s,[r],e.dtype,i,!0);return{dataId:o.dataId,shape:t,dtype:o.dtype}}decode(e,t){const n=this.texData.get(e),{isPacked:r,shape:a,dtype:s}=n;if(null!=t){Xi(Ji(a)<=t[0]*t[1]*4,(()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data."))}const i=iL(a);let o;o=r?new VL(i):new GL(i);const l=[null!=t?t:VM(i)];return{dtype:s,shape:a,dataId:this.runWebGLProgram(o,[{shape:i,dtype:s,dataId:e}],s,l,!0,t).dataId}}runWebGLProgram(e,t,n,r,a=!1,s){const i=this.makeTensorInfo(e.outputShape,n),o=this.texData.get(i.dataId);if(e.packedOutput&&(o.isPacked=!0),e.outPackingScheme===DM.DENSE){const t=null!=s?s:VM(e.outputShape);o.texShape=t.map((e=>2*e))}if(null!=e.outTexUsage&&(o.usage=e.outTexUsage),0===Ji(i.shape))return o.values=lo(i.dtype,0),i;const l=[],u=t.map((t=>{if("complex64"===t.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let n=this.texData.get(t.dataId);if(null==n.texture){if(!e.packedInputs&&Ji(t.shape)<=Do().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:t.shape,texData:null,isUniform:!0,uniformValues:n.values};e.packedInputs&&(n.isPacked=!0,n.shape=t.shape)}if(this.uploadToGPU(t.dataId),!!n.isPacked!=!!e.packedInputs)t=n.isPacked?this.unpackTensor(t):this.packTensor(t),l.push(t),n=this.texData.get(t.dataId);else if(n.isPacked&&!lL(n.shape,t.shape)){const e=t,r=t.shape;t.shape=n.shape,t=this.packedReshape(t,r),l.push(t),n=this.texData.get(t.dataId),e.shape=r}return{shape:t.shape,texData:n,isUniform:!1}}));this.uploadToGPU(i.dataId);const c={shape:i.shape,texData:o,isUniform:!1},d=function(e,t,n){let r="";t.concat(n).forEach((t=>{const a=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0;if(e.enableShapeUniforms&&!t.isUniform){const s=t.texData.texShape,{useSqueezeShape:i,uniformShape:o,keptDims:l}=FL(e.packedInputs,t.shape,s);let u="",c="",d="";if(1===o.length&&e.packedInputs){const e=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)];u=`${e[0]>1}_${e[1]>1}`}else if(2!==o.length||e.packedInputs){if(o.length>2&&!e.packedInputs){const e=ko(o);d=`${e[0]===s[1]}_${e[e.length-1]===s[1]}`}}else c=`${o[0]>1}_${o[1]>1}`;const h=t.shape.length,p=2===o.length&&eo(t.shape,s),f=1===Ji(t.shape),m=Rm(t.shape,n.shape),g=!e.packedInputs&&h===n.shape.length&&eo(s,n.texData.texShape),y=e.packedInputs||o.length>2?"":`${s[0]>1}_${s[1]>1}`;r+=`${h}_${g}_${i?l:""}_${o.length}_${f}_${m}_${p}_${u}_${c}_${d}_${y}_${a}`}else{const e=t.isUniform?"uniform":t.texData.texShape;r+=`${t.shape}_${e}_${a}`}}));const a=e.userCode;let s=e.constructor.name;return s+="_"+r+"_"+a+`${Do().getNumber("WEBGL_VERSION")}`,s}(e,u,c),h=this.getAndSaveBinary(d,(()=>LL(this.gpgpu,e,u,c))),p=null!=this.activeTimers;let f;p&&(f=this.startTimer()),Do().get("ENGINE_COMPILE_ONLY")||function(e,t,n,r,a){t.program.enableShapeUniforms||(PL(t.inShapeInfos,n),PL([t.outShapeInfo],[r]));const s=r.texData.texture,i=r.texData.texShape;r.texData.isPacked?e.setOutputPackedMatrixTexture(s.texture,i[0],i[1]):e.setOutputMatrixTexture(s.texture,i[0],i[1]),e.setProgram(t.webGLProgram),e.bindVertexArray(t.webGLProgram.vao),1===Do().getNumber("WEBGL_VERSION")&&null!==t.infLoc&&e.gl.uniform1f(t.infLoc,1/0),null!==t.nanLoc&&e.gl.uniform1f(t.nanLoc,NaN);for(let l=0;l<n.length;++l){const r=n[l],{uniform:a,offset:s,shape:i,texShape:o}=t.variablesLocations[l];if(i){const{uniformShape:n}=FL(t.program.packedInputs,r.shape,r.texData.texShape);switch(n.length){case 1:e.gl.uniform1iv(i,new Int32Array(n));break;case 2:e.gl.uniform2iv(i,new Int32Array(n));break;case 3:e.gl.uniform3iv(i,new Int32Array(n));break;case 4:e.gl.uniform4iv(i,new Int32Array(n))}}if(o&&e.gl.uniform2i(o,r.texData.texShape[0],r.texData.texShape[1]),null!=a)if(r.isUniform)if(Ji(r.shape)<2)e.gl.uniform1f(a,r.uniformValues[0]);else{let t=r.uniformValues;t instanceof Float32Array||(t=new Float32Array(t)),e.gl.uniform1fv(a,t)}else null!=r.texData.slice&&null!=s&&e.gl.uniform1i(s,r.texData.slice.flatOffset),e.setInputMatrixTexture(r.texData.texture.texture,a,l)}const o=t.outShapeLocation;if(o)switch(r.shape.length){case 1:e.gl.uniform1iv(o,new Int32Array(r.shape));break;case 2:e.gl.uniform2iv(o,new Int32Array(r.shape));break;case 3:e.gl.uniform3iv(o,new Int32Array(r.shape));break;case 4:e.gl.uniform4iv(o,new Int32Array(r.shape))}if(t.outShapeStridesLocation){const n=ko(r.shape);switch(r.shape.length){case 2:e.gl.uniform1iv(t.outShapeStridesLocation,new Int32Array(n));break;case 3:e.gl.uniform2iv(t.outShapeStridesLocation,new Int32Array(n));break;case 4:e.gl.uniform3iv(t.outShapeStridesLocation,new Int32Array(n))}}if(t.outTexShapeLocation&&e.gl.uniform2i(t.outTexShapeLocation,r.texData.texShape[0],r.texData.texShape[1]),t.program.customUniforms&&a)for(let l=0;l<t.program.customUniforms.length;++l){const n=t.program.customUniforms[l],r=t.customUniformLocations[l],s=a[l];if("float"===n.type)e.gl.uniform1fv(r,s);else if("vec2"===n.type)e.gl.uniform2fv(r,s);else if("vec3"===n.type)e.gl.uniform3fv(r,s);else if("vec4"===n.type)e.gl.uniform4fv(r,s);else if("int"===n.type)e.gl.uniform1iv(r,s);else if("ivec2"===n.type)e.gl.uniform2iv(r,s);else if("ivec3"===n.type)e.gl.uniform3iv(r,s);else{if("ivec4"!==n.type)throw Error(`uniform type ${n.type} is not supported yet.`);e.gl.uniform4iv(r,s)}}e.executeProgram()}(this.gpgpu,h,u,c,r),l.forEach((e=>this.disposeIntermediateTensorInfo(e))),p&&(f=this.endTimer(f),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(f)}));const m=Do().getNumber("WEBGL_FLUSH_THRESHOLD");if(m>0){const e=Kd();e-this.lastGlFlushTime>m&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=e)}if(!Do().getBool("WEBGL_LAZILY_UNPACK")&&o.isPacked&&!1===a){const e=this.unpackTensor(i);return this.disposeIntermediateTensorInfo(i),e}return i}compileAndRun(e,t,n,r,a=!1){n=n||t[0].dtype;return this.runWebGLProgram(e,t,n,r,a)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){if(!this.disposed){if(!Do().getBool("IS_TEST")){Object.keys(this.binaryCache).forEach((e=>{this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram),delete this.binaryCache[e]}))}this.textureManager.dispose(),null!=this.canvas&&"undefined"!=typeof HTMLCanvasElement&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0}}floatPrecision(){return null==this.floatPrecisionValue&&(this.floatPrecisionValue=lp((()=>{if(!Do().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=Do().getBool("DEBUG");Do().set("DEBUG",!1);const t=this.abs(ng(1e-8)).dataSync()[0];if(Do().set("DEBUG",e),t>0)return 32}return 16}))),this.floatPrecisionValue}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}uploadToGPU(e){const t=this.texData.get(e),{shape:n,dtype:r,values:a,texture:s,usage:i,isPacked:o}=t;if(null!=s)return;const l=null!=this.activeTimers;let u;l&&(u=Kd());let c=t.texShape;if(null==c&&(c=function(e,t=!1){let n=Do().getNumber("WEBGL_MAX_TEXTURE_SIZE"),r=Do().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");if(r===1/0&&Do().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(r=n/2),t&&(n*=2,r*=2,1===(e=e.map(((t,n)=>n>=e.length-2?ji(e[n]):e[n]))).length&&(e=[2,e[0]])),2!==e.length){const t=oo(e);e=t.newShape}let a=Ji(e),s=null;e.length<=1&&a<=n?s=[1,a]:2===e.length&&e[0]<=n&&e[1]<=n?s=e:3===e.length&&e[0]*e[1]<=n&&e[2]<=n?s=[e[0]*e[1],e[2]]:3===e.length&&e[0]<=n&&e[1]*e[2]<=n?s=[e[0],e[1]*e[2]]:4===e.length&&e[0]*e[1]*e[2]<=n&&e[3]<=n?s=[e[0]*e[1]*e[2],e[3]]:4===e.length&&e[0]<=n&&e[1]*e[2]*e[3]<=n&&(s=[e[0],e[1]*e[2]*e[3]]);const i=null!=s&&Math.max(...s)>r&&Math.min(...s)<=(t?2:1)&&Math.min(...s)>0;if(null==s||i)if(t){const t=aL(e);let n=2,r=2;e.length&&([n,r]=sL(e)),a=t*(n/2)*(r/2),s=no(a).map((e=>2*e))}else s=no(a);return s}(n,o),t.texShape=c),null!=a){const e=iL(n);let s,i=c[1],d=c[0];const h=a instanceof Uint8Array||a instanceof Uint8ClampedArray;!o&&h||([i,d]=UM(c[0],c[1])),s=o?new QL(e,h):new qL(e,h);const p=h?[d,i]:c,f=this.makeTensorInfo(p,r),m=this.texData.get(f.dataId);m.usage=h?LM.PIXELS:LM.UPLOAD,m.texShape=p,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(f.dataId),i,d,a);const g=[[d,i]],y=!0,b=this.runWebGLProgram(s,[f],r,g,y),v=this.texData.get(b.dataId);t.texShape=v.texShape,t.isPacked=v.isPacked,t.usage=v.usage,Do().get("ENGINE_COMPILE_ONLY")?this.disposeData(b.dataId):(t.texture=v.texture,t.values=null,this.texData.delete(b.dataId)),this.disposeIntermediateTensorInfo(f),l&&(this.uploadWaitMs+=Kd()-u)}else{const e=this.acquireTexture(c,i,r,o);t.texture=e}}convertAndCacheOnCPU(e,t){const n=this.texData.get(e),{dtype:r}=n;return null!=t&&(n.values=function(e,t){if("float32"===t||"complex64"===t)return e;if("int32"===t||"bool"===t){const n="int32"===t?new Int32Array(e.length):new Uint8Array(e.length);for(let t=0;t<n.length;++t)n[t]=Math.round(e[t]);return n}throw new Error(`Unknown dtype ${t}`)}
/**
 * @license
 * Copyright 2020 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(t,r)),n.values}acquireTexture(e,t,n,r){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0}return this.textureManager.acquireTexture(e,t,r)}computeBytes(e,t){return e[0]*e[1]*fo(t)}checkCompileCompletion(){for(const[,e]of Object.entries(this.binaryCache))this.checkCompletion_(e)}async checkCompileCompletionAsync(){const e=[];if(this.gpgpu.parallelCompilationExtension){for(const[,t]of Object.entries(this.binaryCache))e.push(this.checkCompletionAsync_(t));return Promise.all(e)}for(const[,t]of Object.entries(this.binaryCache)){const n=new Promise((e=>{try{this.checkCompletion_(t),e(!0)}catch(n){throw n}}));e.push(n)}return Promise.all(e)}async checkCompletionAsync_(e){return this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)?this.checkCompletion_(e):(await Ix(),this.checkCompletionAsync_(e))}checkCompletion_(e){if(!1===this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.gl.LINK_STATUS)){if(!1===this.gpgpu.gl.getShaderParameter(e.fragmentShader,this.gpgpu.gl.COMPILE_STATUS))throw ZM(e.source,this.gpgpu.gl.getShaderInfoLog(e.fragmentShader)),new Error("Failed to compile fragment shader.");throw new Error("Failed to link vertex and fragment shaders.")}return!0}getUniformLocations(){for(const e of Object.values(this.binaryCache)){this.gpgpu.buildVao(e.webGLProgram);const{variablesLocations:t,customUniformLocations:n,infLoc:r,nanLoc:a,outShapeLocation:s,outShapeStridesLocation:i,outTexShapeLocation:o}=BL(this.gpgpu,e.program,e.webGLProgram);e.variablesLocations=t,e.customUniformLocations=n,e.infLoc=r,e.nanLoc=a,e.outShapeLocation=s,e.outShapeStridesLocation=i,e.outTexShapeLocation=o}}createTensorFromGPUData(e,t,n){e.channels=e.channels||"RGBA";const{texture:r,height:a,width:s,channels:i}=e,o=ip().backend;if(!o.gpgpu.gl.isTexture(r))throw new Error("The texture is invalid. Also, please make sure the texture and the TFJS WebGL backend are using the same canvas. If you want to use your own custom canvas, you have to create and use the custom TFJS WebGL backend created from the canvas through 'new tf.MathBackendWebGL(customCanvas)'.");const l=o.writeTexture(r,t,n,a,s,i);return ip().makeTensorFromDataId(l,t,n,o)}}AP.nextDataId=0,Hh()&&hp("webgl",(()=>new AP),2)
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */;const xP="\n  if (isnan(a)) return a;\n  if (isnan(b)) return b;\n";class kP{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=Om(t,n),this.enableShapeUniforms=zL(this.outputShape.length),this.userCode=`\n      float binaryOperation(float a, float b) {\n        ${e}\n      }\n\n      void main() {\n        float a = getAAtOutCoords();\n        float b = getBAtOutCoords();\n        setOutput(binaryOperation(a, b));\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wP="\n  result.r = isNaN.r ? NAN : result.r;\n  result.g = isNaN.g ? NAN : result.g;\n  result.b = isNaN.b ? NAN : result.b;\n  result.a = isNaN.a ? NAN : result.a;\n";class SP{constructor(e,t,n,r=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Om(t,n);const a=this.outputShape.length;this.enableShapeUniforms=zL(a);let s="";if(r)if(0===a||1===Ji(this.outputShape))s="\n          result.y = 0.;\n          result.z = 0.;\n          result.w = 0.;\n        ";else{if(s=`\n          ${OL(a)} coords = getOutputCoords();\n        `,1===a)this.enableShapeUniforms?s+="\n            result.y = (coords + 1) >= outShape ? 0. : result.y;\n            result.z = 0.;\n            result.w = 0.;\n          ":s+=`\n            result.y = (coords + 1) >= ${this.outputShape[0]} ? 0. : result.y;\n            result.z = 0.;\n            result.w = 0.;\n          `;else{const e=nP("coords",a);this.enableShapeUniforms?s+=`\n            bool nextRowOutOfBounds =\n              (${e[a-2]} + 1) >= outShape[${a} - 2];\n            bool nextColOutOfBounds =\n              (${e[a-1]} + 1) >= outShape[${a} - 1];\n            result.y = nextColOutOfBounds ? 0. : result.y;\n            result.z = nextRowOutOfBounds ? 0. : result.z;\n            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n          `:s+=`\n            bool nextRowOutOfBounds =\n              (${e[a-2]} + 1) >= ${this.outputShape[a-2]};\n            bool nextColOutOfBounds =\n              (${e[a-1]} + 1) >= ${this.outputShape[a-1]};\n            result.y = nextColOutOfBounds ? 0. : result.y;\n            result.z = nextRowOutOfBounds ? 0. : result.z;\n            result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n          `}}this.userCode=`\n      vec4 binaryOperation(vec4 a, vec4 b) {\n        ${e}\n      }\n\n      void main() {\n        vec4 a = getAAtOutCoords();\n        vec4 b = getBAtOutCoords();\n\n        vec4 result = binaryOperation(a, b);\n        ${s}\n\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function CP(e){const{inputs:t,backend:n}=e,{x:r}=t;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}const IP={kernelName:ru,backendName:"webgl",kernelFunc:CP};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function WP(e){const{inputs:t,backend:n}=e,{real:r,imag:a}=t,s=n.makeTensorInfo(r.shape,"complex64"),i=n.texData.get(s.dataId),o=CP({inputs:{x:r},backend:n}),l=CP({inputs:{x:a},backend:n});return i.complexTensorInfos={real:o,imag:l},s}const _P={kernelName:fl,backendName:"webgl",kernelFunc:WP},TP="return (a < 0.) ? b * a : a;",NP="\n  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const EP={kernelName:uu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{alpha:s}=r,i=n.makeTensorInfo([],"float32",Xd(s,"float32")),o=Do().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new SP(NP,a.shape,i.shape):new kP(TP,a.shape,i.shape),l=n.runWebGLProgram(o,[a,i],"float32");return n.disposeIntermediateTensorInfo(i),l}},RP="return (a < 0.) ? b * a : a;",$P="\n  vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n  return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const OP={kernelName:Hu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r,alpha:a}=t,s=Do().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new SP($P,r.shape,a.shape):new kP(RP,r.shape,a.shape);return n.runWebGLProgram(s,[r,a],"float32")}},FP="if (isnan(x)) return x;";
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function DP({opSnippet:e,packedOpSnippet:t,cpuKernelImpl:n,dtype:r}){return({inputs:a,backend:s})=>{const{x:i}=a,o=s,l=r||i.dtype;if(o.shouldExecuteOnCPU([i])&&null!=n){const e=o.texData.get(i.dataId),t=n(e.values,l);return o.makeTensorInfo(i.shape,l,t)}let u;return u=Do().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&null!=t?new mP(i.shape,t):new uP(i.shape,e),o.runWebGLProgram(u,[i],l)}}function MP({opSnippet:e,packedOpSnippet:t,checkOutOfBounds:n=!1,supportsComplex:r=!1,cpuKernelImpl:a,dtype:s}){return({inputs:i,backend:o})=>{const{a:l,b:u}=i,c=o;if(r&&"complex64"===l.dtype){const t=c.texData.get(l.dataId),n=c.texData.get(u.dataId),[r,a]=[[t.complexTensorInfos.real,n.complexTensorInfos.real],[t.complexTensorInfos.imag,n.complexTensorInfos.imag]].map((t=>{const[n,r]=t,a={dataId:n.dataId,dtype:n.dtype,shape:l.shape},s={dataId:r.dataId,dtype:r.dtype,shape:u.shape},i=new kP(e,l.shape,u.shape);return c.runWebGLProgram(i,[a,s],_h(n.dtype,r.dtype))})),s=WP({inputs:{real:r,imag:a},backend:c});return c.disposeIntermediateTensorInfo(r),c.disposeIntermediateTensorInfo(a),s}const d=s||_h(l.dtype,u.dtype);if(("string"===l.dtype||"string"===u.dtype||c.shouldExecuteOnCPU([l,u]))&&null!=a){const e=c.texData.get(l.dataId).values,t=c.texData.get(u.dataId).values,n="string"===l.dtype?Tk(e):e,r="string"===l.dtype?Tk(t):t,[s,i]=a(l.shape,u.shape,n,r,d),o=c.makeTensorInfo(i,d);return c.texData.get(o.dataId).values=s,o}let h;return h=Do().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&null!=t?new SP(t,l.shape,u.shape,n):new kP(e,l.shape,u.shape),c.runWebGLProgram(h,[l,u],d)}}function LP(e,t=!1){if("linear"===e)return"return x;";if("relu"===e)return t?"\n  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n  bvec4 isNaN = isnan(x);\n\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n":hP;if("elu"===e)return t?"\n  vec4 result;\n\n  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n  return result;\n":"return (x >= 0.0) ? x : (exp(x) - 1.0);";if("relu6"===e)return t?"\n  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n  bvec4 isNaN = isnan(x);\n\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n":pP;if("prelu"===e)return t?$P:RP;if("leakyrelu"===e)return t?NP:TP;if("sigmoid"===e)return"return 1.0 / (1.0 + exp(-1.0 * x));";throw new Error(`Activation ${e} has not been implemented for the WebGL backend.`)}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class BP{constructor(e,t,n,r=!1,a=!1,s=!1,i=null,o=!1,l=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n,this.enableShapeUniforms=zL(this.outputShape.length);const u=r?e[1]:e[2],c=Math.ceil(u/2),d=r?"i * 2, rc.y":"rc.y, i * 2",h=a?"rc.z, i * 2":"i * 2, rc.z",p=r?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],f=a?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];let m="",g="";i&&(m=o?`vec4 activation(vec4 a) {\n          vec4 b = getPreluActivationWeightsAtOutCoords();\n          ${i}\n        }`:l?`vec4 activation(vec4 a) {\n          vec4 b = getLeakyreluAlphaAtOutCoords();\n          ${i}\n        }`:`vec4 activation(vec4 x) {\n          ${i}\n        }`,g="result = activation(result);");const y=s?"result += getBiasAtOutCoords();":"";s&&this.variableNames.push("bias"),o&&this.variableNames.push("preluActivationWeights"),l&&this.variableNames.push("leakyreluAlpha");let b="rc.x",v="rc.x";e[0]<t[0]?b=`imod(rc.x, ${e[0]})`:t[0]<e[0]&&(v=`imod(rc.x, ${t[0]})`),this.userCode=`\n      ${m}\n      // Don't use uniform for sharedDimensionPacked for performance.\n      const float sharedDimension = ${c}.0;\n\n      vec4 dot2x2ARowBCol(ivec3 rc) {\n        vec4 result = vec4(0);\n        int batchA = ${b};\n        int batchB = ${v};\n        for (int i = 0; i < ${c}; i++) {\n          vec4 a = getMatrixA(batchA, ${d});\n          vec4 b = getMatrixB(batchB, ${h});\n\n          // These swizzled products need to be separately added.\n          // See: https://github.com/tensorflow/tfjs/issues/1735\n          result += (${p[0]} * ${f[0]});\n          result += (${p[1]} * ${f[1]});\n        }\n        return result;\n      }\n\n      void main() {\n        ivec3 rc = getOutputCoords();\n        vec4 result = dot2x2ARowBCol(rc);\n\n        ${y}\n\n        ${g}\n\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const PP="return areal * breal - aimag * bimag;",zP="return areal * bimag + aimag * breal;";class GP{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Om(t,n),this.userCode=`\n      float binaryOpComplex(\n          float areal, float aimag, float breal, float bimag) {\n        ${e}\n      }\n\n      void main() {\n        float areal = getARealAtOutCoords();\n        float aimag = getAImagAtOutCoords();\n        float breal = getBRealAtOutCoords();\n        float bimag = getBImagAtOutCoords();\n        setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const VP="return a * b;";function UP(e){const{inputs:t,backend:n}=e,{a:r,b:a}=t,s=_h(r.dtype,a.dtype);if("complex64"===r.dtype){const e=n.texData.get(r.dataId),t=n.texData.get(a.dataId),s=new GP(PP,r.shape,a.shape),i=new GP(zP,r.shape,a.shape),o=[{dataId:e.complexTensorInfos.real.dataId,dtype:e.complexTensorInfos.real.dtype,shape:r.shape},{dataId:e.complexTensorInfos.imag.dataId,dtype:e.complexTensorInfos.imag.dtype,shape:r.shape},{dataId:t.complexTensorInfos.real.dataId,dtype:t.complexTensorInfos.real.dtype,shape:a.shape},{dataId:t.complexTensorInfos.imag.dataId,dtype:t.complexTensorInfos.imag.dtype,shape:a.shape}],l=n.runWebGLProgram(s,o,"float32"),u=n.runWebGLProgram(i,o,"float32"),c=WP({inputs:{real:l,imag:u},backend:n});return n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(u),c}if(n.shouldExecuteOnCPU([r,a])){const e=n.texData.get(r.dataId),t=n.texData.get(a.dataId),[i,o]=_B(r.shape,a.shape,e.values,t.values,s),l=n.makeTensorInfo(o,s);return n.texData.get(l.dataId).values=i,l}let i;return i=Do().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new SP(VP,r.shape,a.shape):new kP(VP,r.shape,a.shape),n.runWebGLProgram(i,[r,a],s)}const HP={kernelName:Ou,backendName:"webgl",kernelFunc:UP};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function jP(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{shape:s}=r,i=n,o=Ji(a.shape),l=so(s,o),u=Ji(l);Xi(o===u,(()=>`The new shape (${l}) has ${u} elements and the old shape (${a.shape}) has ${o} elements. The new shape and old shape must have the same number of elements.`));const c=i.texData.get(a.dataId);return!c.isPacked||lL(a.shape,l)||null!==c.texture&&lL(c.shape,l)?(i.incRef(a.dataId),{dataId:a.dataId,shape:l,dtype:a.dtype}):function(e,t,n){const r=[aL(e.shape),...sL(e.shape)],a={dtype:e.dtype,shape:r,dataId:e.dataId},s=[aL(t),...sL(t)],i=new aP(s,r),o=[r],l=n.runWebGLProgram(i,[a],e.dtype,o,!0);return{dataId:l.dataId,shape:t,dtype:l.dtype}}(a,l,i)}const qP={kernelName:ec,backendName:"webgl",kernelFunc:jP};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class QP{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:r,inSize:a,outSize:s}=e;this.outputShape=[r,s];const i=4*Math.floor(n/4),o=n%4;let l="sumValue += dot(values, ones);";if(null!=t){const e=1/t;l=`sumValue += dot(values * ${to(e)?e.toPrecision(2):e}, ones);`}let u="";a%n>0&&(u=`\n        if (inIdx < 0 || inIdx >= ${a}) {\n          return 0.0;\n        }\n      `),this.userCode=`\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float getValue(int batch, int inIdx) {\n        ${u}\n        return getX(batch, inIdx);\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = outIdx * ${n};\n\n        float sumValue = 0.0;\n\n        for (int i = 0; i < ${i}; i += 4) {\n          int inIdx = inOffset + i;\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          ${l}\n        }\n\n        int inIdx = inOffset + ${i};\n        if (${1===o}) {\n          vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);\n\n          ${l}\n        } else if (${2===o}) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1), 0.0, 0.0);\n\n          ${l}\n        } else if (${3===o}) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2), 0.0);\n\n          ${l}\n        }\n        setOutput(sumValue);\n      }\n    `}}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class XP{constructor(e,t){this.variableNames=["x"];const{windowSize:n,batchSize:r,inSize:a,outSize:s}=e;this.outputShape=[r,s];let i="0.0",o="";"prod"===t?i="1.0":"min"===t?(i="1.0 / 1e-20",o="min"):"max"===t&&(i="-1.0 / 1e-20",o="max");let l=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"sum"===t?l="sumValue":"prod"===t?l="prodValue":"all"===t?l="allValue":"any"===t&&(l="anyValue");const u=4*Math.floor(n/4),c=n%4;let d=`\n      if (${"sum"===t}) {\n        sumValue += dot(values, ones);\n      } else if (${"prod"===t}) {\n        vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n        prodValue *= tmp[0] * tmp[1];\n      } else {\n        minMaxValue = ${o}(values, minMaxValue);\n        if (${"min"===t} || ${"max"===t}) {\n          minMaxValue = ${o}(values, minMaxValue);\n          bvec4 isNaN = isnan(values);\n          if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {\n            minMaxValue = vec4(NAN);\n          }\n        }\n      }\n    `,h="vec4";"all"===t?(i="1.0",d="\n        bool reducedAllValue = all(values);\n        float floatedReducedAllValue = float(reducedAllValue);\n        allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n      ",h="bvec4"):"any"===t&&(i="0.0",d="\n        bool reducedAnyValue = any(values);\n        float floatedReducedAnyValue = float(reducedAnyValue);\n        anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n      ",h="bvec4");let p="";a%n>0&&(p=`\n        if (inIdx < 0 || inIdx >= ${a}) {\n          return initializationValue;\n        }\n      `),this.userCode=`\n      const float initializationValue = ${i};\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float getValue(int batch, int inIdx) {\n        ${p}\n        return getX(batch, inIdx);\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = outIdx * ${n};\n\n        vec4 minMaxValue = vec4(${i});\n        float prodValue = 1.0;\n        float sumValue = 0.0;\n        float allValue = 1.0;\n        float anyValue = 0.0;\n\n        for (int i = 0; i < ${u}; i += 4) {\n          int inIdx = inOffset + i;\n          ${h} values = ${h}(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          ${d}\n        }\n\n        int inIdx = inOffset + ${u};\n        if (${1===c}) {\n          ${h} values = ${h}(\n            getValue(batch, inIdx),\n            initializationValue,\n            initializationValue,\n            initializationValue\n          );\n\n          ${d}\n        } else if (${2===c}) {\n          ${h} values = ${h}(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            initializationValue,\n            initializationValue\n          );\n\n          ${d}\n        } else if (${3===c}) {\n          ${h} values = ${h}(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            initializationValue\n          );\n\n          ${d}\n        }\n        setOutput(${l});\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function ZP(e,t,n,r){const a=function(e){const t=[];for(;0===t.length||1!==t[t.length-1].outSize;){const n=t.length?t[t.length-1].outSize:e[1],r=Fx(n);t.push({inSize:n,windowSize:r,outSize:Math.ceil(n/r)})}return t}(e.shape);let s=e;for(let i=0;i<a.length;i++){const{inSize:o,windowSize:l,outSize:u}=a[i];let c,d;c="mean"===n?0===i?new QP({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:u},o):new QP({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:u}):new XP({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:u},n),d=s,s=r.runWebGLProgram(c,[s],t),d.dataId!==e.dataId&&r.disposeIntermediateTensorInfo(d)}return s}
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class KP{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let s=0;s<n.length;s++)n[s]=e[t[s]];this.outputShape=n,this.rank=n.length;const r=OL(this.rank),a=function(e){const t=e.length;if(t>6)throw Error(`Transpose for rank ${t} is not yet supported`);const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(t);for(let a=0;a<e.length;a++)r[e[a]]=n[a];return r.join()}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(t);this.userCode=`\n    void main() {\n      ${r} resRC = getOutputCoords();\n      setOutput(getA(${a}));\n    }\n    `}}class JP{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;const n=new Array(e.length);for(let u=0;u<n.length;u++)n[u]=e[t[u]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);const r=OL(this.rank),a=tP("rc",this.rank),s=new Array(this.rank);for(let u=0;u<t.length;u++)s[t[u]]=a[u];const i=`vec2(${s.slice(-2).join()})`,o=`++${a[this.rank-1]} < ${n[this.rank-1]}`,l=`getChannel(getA(${s.join()}), ${i})`;this.userCode=`\n    void main() {\n      ${r} rc = getOutputCoords();\n      vec4 result = vec4(0.);\n      result[0] = ${l};\n      if(${o}) {\n        result[1] = ${l};\n      }\n      --${a[this.rank-1]};\n      if(++${a[this.rank-2]} < ${n[this.rank-2]}) {\n        result[2] = ${l};\n        if(${o}) {\n          result[3] = ${l};\n        }\n      }\n      setOutput(result);\n    }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function YP(e,t,n){const r=Do().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new JP(e.shape,t):new KP(e.shape,t);return n.runWebGLProgram(r,[e],e.dtype)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function ez(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;return function(e,t,n,r){const a=t,s=e.shape.length,i=io(a,e.shape);let o=i;const l=Zm(o,s),u=null!=l;let c=e;u&&(c=YP(e,l,r),o=Jm(o.length,s)),Xm("sum",o,s);const[d,h]=qm(c.shape,o);let p=d;n&&(p=Qm(d,i));const f=Ji(h),m=jP({inputs:{x:c},attrs:{shape:[Ji(e.shape)/f,f]},backend:r}),g=ZP(m,Th(e.dtype),"sum",r),y=jP({inputs:{x:g},attrs:{shape:p},backend:r});return r.disposeIntermediateTensorInfo(m),r.disposeIntermediateTensorInfo(g),u&&r.disposeIntermediateTensorInfo(c),y}(a,s,i,n)}const tz={kernelName:xc,backendName:"webgl",kernelFunc:ez};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function nz(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{perm:s}=r,i=n,o=a.shape.length,l=new Array(o);for(let c=0;c<l.length;c++)l[c]=a.shape[s[c]];let u;if(i.shouldExecuteOnCPU([a])){const e=i.texData.get(a.dataId).values,t=YB(e,a.shape,a.dtype,s,l);u=i.makeTensorInfo(l,a.dtype);i.texData.get(u.dataId).values=t}else u=YP(a,s,i);return u}const rz={kernelName:Vc,backendName:"webgl",kernelFunc:nz};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function az({a:e,b:t,transposeA:n,transposeB:r,backend:a,bias:s=null,preluActivationWeights:i=null,leakyreluAlpha:o=0,activation:l=null}){const u=e.shape.length,c=t.shape.length,d=n?e.shape[u-2]:e.shape[u-1],h=r?t.shape[c-1]:t.shape[c-2],p=n?e.shape[u-1]:e.shape[u-2],f=r?t.shape[c-2]:t.shape[c-1],m=e.shape.slice(0,-2),g=t.shape.slice(0,-2),y=Ji(m),b=Ji(g),v=Om(e.shape.slice(0,-2),t.shape.slice(0,-2)).concat([p,f]);Xi(d===h,(()=>`Error in matMul: inner shapes (${d}) and (${h}) of Tensors with shapes ${e.shape} and ${t.shape} and transposeA=${n} and transposeB=${r} must match.`));const A=n?[y,d,p]:[y,p,d],x=r?[b,f,h]:[b,h,f],k=jP({inputs:{x:e},backend:a,attrs:{shape:A}}),w=jP({inputs:{x:t},backend:a,attrs:{shape:x}}),S=[k,w],C=Math.max(y,b),I=n?k.shape[1]:k.shape[2],W=null!=s,_=null!=i,T="leakyrelu"===l,N=null!=l?LP(l,!0):null;let E;if((1===p||1===f)&&I>1e3&&!1===(W||_||T||null!=N)){let e=k,t=w;n&&(e=nz({inputs:{x:k},backend:a,attrs:{perm:[0,2,1]}}),S.push(e)),r&&(t=nz({inputs:{x:w},backend:a,attrs:{perm:[0,2,1]}}),S.push(t));const s=1===f;let i=e;1!==f&&(i=jP({inputs:{x:e},backend:a,attrs:{shape:[C,I,1]}}),S.push(i));const o=1===f?2:1;let l=t;s&&(l=jP({inputs:{x:t},backend:a,attrs:{shape:[C,1,I]}}),S.push(l));const u=UP({inputs:{a:i,b:l},backend:a});E=ez({inputs:{x:u},backend:a,attrs:{axis:o,keepDims:!0}}),S.push(u)}else{const l=_h(e.dtype,t.dtype),u=new BP(A,x,[C,p,f],n,r,W,N,_,T),c=[k,w];if(null!=s&&c.push(s),_&&c.push(i),T){const e=a.makeTensorInfo([],"float32",Xd(o,"float32"));c.push(e),S.push(e)}E=a.runWebGLProgram(u,c,l)}const R=jP({inputs:{x:E},backend:a,attrs:{shape:v}});S.push(E);for(const $ of S)a.disposeIntermediateTensorInfo($);return R}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const sz={kernelName:Kc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{a:a,b:s,bias:i,preluActivationWeights:o}=t,{transposeA:l,transposeB:u,activation:c,leakyreluAlpha:d}=r;return az({a:a,b:s,transposeA:l,transposeB:u,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:d,activation:c})}},iz="return abs(x);";
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const oz={kernelName:zo,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])&&"complex64"!==r.dtype){const e=n.texData.get(r.dataId),t=BB(e.values);return n.makeTensorInfo(r.shape,r.dtype,t)}let a;return a=Do().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new mP(r.shape,iz):new uP(r.shape,iz),n.runWebGLProgram(a,[r],r.dtype)}},lz=DP({opSnippet:cP+"\n  if (abs(x) > 1.) {\n    return NAN;\n  }\n  return acos(x);\n"}),uz={kernelName:Go,backendName:"webgl",kernelFunc:lz},cz=DP({opSnippet:cP+"\n  if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));"}),dz={kernelName:Vo,backendName:"webgl",kernelFunc:cz},hz="return a + b;",pz=MP({opSnippet:hz,packedOpSnippet:hz,supportsComplex:!0,cpuKernelImpl:iB}),fz={kernelName:Uo,backendName:"webgl",kernelFunc:pz};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class mz{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map(((e,t)=>`T${t}`));const n=[];this.variableNames.forEach((e=>{n.push(`float v${e} = get${e}AtOutCoords();`)}));const r=this.variableNames.map((e=>`v${e}`)).join(" + ");this.userCode=`\n      void main() {\n        ${n.join("\n        ")}\n\n        float result = ${r};\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class gz{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map(((e,t)=>`T${t}`));const n=[];this.variableNames.forEach((e=>{n.push(`vec4 v${e} = get${e}AtOutCoords();`)}));const r=this.variableNames.map((e=>`v${e}`)).join(" + ");this.userCode=`\n      void main() {\n        ${n.join("\n        ")}\n\n        vec4 result = ${r};\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yz={kernelName:Ho,backendName:"webgl",kernelFunc:function e(t){const{inputs:n,backend:r}=t,a=n;if(1===a.length)return CP({inputs:{x:a[0]},backend:r});if(a.length>Do().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){const t=Math.floor(a.length/2),n=e({inputs:a.slice(0,t),backend:r}),s=e({inputs:a.slice(t),backend:r});return e({inputs:[n,s],backend:r})}const s=a.map((e=>e.dtype)).reduce(((e,t)=>_h(e,t))),i=a.map((e=>e.shape)),o=Do().getBool("WEBGL_PACK")?new gz(a[0].shape,i):new mz(a[0].shape,i);return r.runWebGLProgram(o,a,s)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bz={kernelName:jo,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=io(s,a.shape);let u=l;const c=Zm(u,o);let d=a;null!=c&&(d=nz({inputs:{x:a},backend:n,attrs:{perm:c}}),u=Jm(u.length,o)),Xm("all",u,o);const[h,p]=qm(d.shape,u),f=jP({inputs:{x:d},backend:n,attrs:{shape:[-1,Ji(p)]}}),m=ZP(f,f.dtype,"all",n);let g;if(i){g=jP({inputs:{x:m},backend:n,attrs:{shape:Qm(h,l)}})}else g=jP({inputs:{x:m},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),null!=c&&n.disposeIntermediateTensorInfo(d),g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vz={kernelName:qo,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=io(s,a.shape);let u=l;const c=Zm(u,o);let d=a;null!=c&&(d=nz({inputs:{x:a},backend:n,attrs:{perm:c}}),u=Jm(u.length,o)),Xm("any",u,o);const[h,p]=qm(d.shape,u),f=jP({inputs:{x:d},backend:n,attrs:{shape:[-1,Ji(p)]}}),m=ZP(f,f.dtype,"any",n);let g;if(i){g=jP({inputs:{x:m},backend:n,attrs:{shape:Qm(h,l)}})}else g=jP({inputs:{x:m},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),null!=c&&n.disposeIntermediateTensorInfo(d),g}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class Az{constructor(e,t,n){this.variableNames=["A"];const{windowSize:r,batchSize:a,outSize:s}=e;n||this.variableNames.push("bestIndicesA"),this.outputShape=[a,s];const i="max"===t?">":"<",o=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=`\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = outIdx * ${r};\n\n        int bestIndex = inOffset;\n        float bestValue = getA(batch, bestIndex);\n\n        for (int i = 0; i < ${r}; i++) {\n          int inIdx = ${o};\n          float candidate = getA(batch, inIdx);\n          if (candidate ${i} bestValue) {\n            bestValue = candidate;\n            bestIndex = inIdx;\n          }\n        }\n        setOutput(float(bestIndex));\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class xz{constructor(e,t,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,Xi(e.length>2,(()=>`Packed arg${n.charAt(0).toUpperCase()+n.slice(1)} supports only inputs with rank above 2.`));const a=e[e.length-1],s=Math.ceil(a/t);this.outputShape=e.slice(0,-1),s>1&&this.outputShape.push(s),r||this.variableNames.push("bestIndicesA");const i=this.outputShape,o=i.length,l=OL(o),u=nP("coords",o);let c,d;if(1===s){d=o+1;const e=OL(d);c=`\n        ${e} sourceLocR = ${e}(${u.join()}, 0);\n        ++${u[o-1]};\n        ${e} sourceLocG = ${e}(${u.join()}, 0);\n        ++${u[o-2]};\n        ${e} sourceLocA = ${e}(${u.join()}, 0);\n        --${u[o-1]};\n        ${e} sourceLocB = ${e}(${u.join()}, 0);\n        --${u[o-2]};`}else d=o,c=`\n        ${l} sourceLocR = coords;\n        ++${u[o-1]};\n        ${l} sourceLocG = coords;\n        ++${u[o-2]};\n        ${l} sourceLocA = coords;\n        --${u[o-1]};\n        ${l} sourceLocB = coords;\n        --${u[o-2]};`;const h=["x","y","z","w","u","v"].slice(0,d),p="."+h[d-1],f=h.map((e=>"int "+e)),m=nP("sourceLocR",d-1).concat("inIdx.r"),g=nP("sourceLocG",d-1).concat("inIdx.g"),y=nP("sourceLocB",d-1).concat("inIdx.b"),b=nP("sourceLocA",d-1).concat("inIdx.a"),v="max"===n?"greaterThan":"lessThan",A=r?"":`\n          inIdx = round(vec4(getBestIndicesAChannel(${m.join()}),\n                             getBestIndicesAChannel(${g.join()}),\n                             getBestIndicesAChannel(${y.join()}),\n                             getBestIndicesAChannel(${b.join()})));`,x=`vec4(\n            getAChannel(${m.join()}),\n            hasNextCol ? getAChannel(${g.join()}) : 0.,\n            hasNextRow ? getAChannel(${y.join()}) : 0.,\n            hasNextRow && hasNextCol ? getAChannel(${b.join()}) : 0.)`,k=r?"":`\n      float getBestIndicesAChannel(${f.join()}) {\n        return getChannel(getBestIndicesA(${h.join()}),\n                                          vec2(${h.slice(-2).join()}));\n      }`;this.userCode=`\n      float getAChannel(${f.join()}) {\n        return getChannel(getA(${h.join()}),\n                               vec2(${h.slice(-2).join()}));\n      }\n      ${k}\n      void main() {\n        ${l} coords = getOutputCoords();\n        bool hasNextCol = ${u[o-1]} < ${i[o-1]-1};\n        bool hasNextRow = ${u[o-2]} < ${i[o-2]-1};\n        ${c}\n        ivec4 srcIdx = ivec4(sourceLocR${p}, sourceLocG${p},\n          sourceLocB${p}, sourceLocA${p}) * ${t};\n        ivec4 inIdx = srcIdx;\n        vec4 bestIndex = vec4(inIdx);\n        vec4 bestValue = ${x};\n\n        for (int i = 0; i < ${t}; i++) {\n          inIdx = srcIdx;\n          ${A}\n          vec4 candidate = ${x};\n          bvec4 nan = isnan(candidate);\n          bvec4 replace = bvec4(\n            vec4(${v}(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n          bestValue = vec4(replace.x  ? candidate.x : bestValue.x,\n                           replace.y  ? candidate.y : bestValue.y,\n                           replace.z  ? candidate.z : bestValue.z,\n                           replace.w  ? candidate.w : bestValue.w);\n          bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n          srcIdx++;\n        }\n        setOutput(bestIndex);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function kz(e,t,n,r=null){let a=t.shape[0],s=t.shape[1];null!=r&&(a=r.shape[0],s=r.shape[1]);const i=Fx(s),o={windowSize:i,inSize:s,batchSize:a,outSize:Math.ceil(s/i)},l=new Az(o,n,null==r),u=[t];null!=r&&u.push(r);const c=e.runWebGLProgram(l,u,"int32");if(1===c.shape[1])return c;const d=kz(e,t,n,c);return e.disposeIntermediateTensorInfo(c),d}function wz(e,t,n,r=null){const a=null!=r?r.shape:t.shape,s=Fx(a[a.length-1]),i=new xz(a,s,n,null==r),o=null==r?[t]:[t,r],l=e.runWebGLProgram(i,o,"int32");if(l.shape.length===t.shape.length){const r=wz(e,t,n,l);return e.disposeIntermediateTensorInfo(l),r}return l}function Sz(e,t,n,r){const a=[n];if(Xm("arg"+r.charAt(0).toUpperCase()+r.slice(1),a,t.shape.length),!Do().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){const n=[],s=e.texData.get(t.dataId);let i=t;null!==s&&s.isPacked&&(i=e.unpackTensor(t),n.push(i));const[o,l]=qm(i.shape,a),u=Ji(l),c=jP({inputs:{x:i},backend:e,attrs:{shape:[-1,u]}});n.push(c);const d=kz(e,c,r);n.push(d);const h=jP({inputs:{x:d},backend:e,attrs:{shape:o}});return n.forEach((t=>e.disposeIntermediateTensorInfo(t))),h}return wz(e,t,r)}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Cz={kernelName:Qo,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;let i=io(s,a.shape);const o=Zm(i,a.shape.length);let l=a;const u=[];null!=o&&(l=nz({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Jm(i.length,l.shape.length)),Xm("argMax",[i[0]],l.shape.length);const c=Sz(n,l,i[0],"max");return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),c}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Iz={kernelName:Xo,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;let i=io(s,a.shape);const o=Zm(i,a.shape.length);let l=a;const u=[];null!=o&&(l=nz({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Jm(i.length,l.shape.length)),Xm("argMin",[i[0]],l.shape.length);const c=Sz(n,l,i[0],"min");return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),c}},Wz=DP({opSnippet:cP+"\n  if (abs(x) > 1.) {\n    return NAN;\n  }\n  return asin(x);\n"}),_z={kernelName:Zo,backendName:"webgl",kernelFunc:Wz},Tz=DP({opSnippet:cP+"return log(x + sqrt(x * x + 1.0));"}),Nz={kernelName:Ko,backendName:"webgl",kernelFunc:Tz},Ez=DP({opSnippet:cP+"\n  return atan(x);\n"}),Rz={kernelName:Jo,backendName:"webgl",kernelFunc:Ez},$z=MP({opSnippet:xP+"\n  return atan(a, b);\n",packedOpSnippet:"\n  vec4 result = atan(a, b);\n  bvec4 isNaNA = isnan(a);\n  bvec4 isNaNB = isnan(b);\n  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n  "+wP+"\n  return result;\n"}),Oz={kernelName:el,backendName:"webgl",kernelFunc:$z},Fz=DP({opSnippet:cP+"\n  if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;"}),Dz={kernelName:Yo,backendName:"webgl",kernelFunc:Fz};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class Mz{constructor(e,t,n,r=!1,a=!1){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const s=e.filterWidth,i=e.strideHeight,o=e.strideWidth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterHeight,d=e.effectiveFilterWidth,h=e.padInfo.top,p=e.padInfo.left;this.outputShape=e.outShape;const f="avg"===t,m=`((batch  * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,g=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`;let y="0.0";if(f||(y="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode=`\n        const ivec2 strides = ivec2(${i}, ${o});\n        const ivec2 pads = ivec2(${h}, ${p});\n\n        void main() {\n          ivec4 coords = getOutputCoords();\n          int batch = coords[0];\n          int d = coords[3];\n\n          ivec2 xRCCorner = coords.yz * strides - pads;\n          int xRCorner = xRCCorner.x;\n          int xCCorner = xRCCorner.y;\n\n          // max/min x(?, ?, d) to get y(yR, yC, d).\n          // ? = to be determined\n          float minMaxValue = 0.0;\n          float minMaxValueFound = 0.0;\n          int minMaxPosition = 0;\n          float avgValue = 0.0;\n\n          for (int wR = 0; wR < ${c};\n              wR += ${l}) {\n            int xR = xRCorner + wR;\n\n            if (xR < 0 || xR >= ${e.inHeight}) {\n              continue;\n            }\n\n            for (int wC = 0; wC < ${d};\n                wC += ${u}) {\n              int xC = xCCorner + wC;\n\n              if (xC < 0 || xC >= ${e.inWidth}) {\n                continue;\n              }\n\n              float value = getX(batch, xR, xC, d);\n\n              // If a min / max value has already been found, use it. If not,\n              // use the current value.\n              float currMinMaxValue = mix(\n                  value, minMaxValue, minMaxValueFound);\n              if (value ${t} currMinMaxValue) {\n                minMaxValue = value;\n                minMaxValueFound = 1.0;\n                minMaxPosition = ${r?a?m:g:`wR * ${d} + wC`};\n              }\n            }\n          }\n          setOutput(float(minMaxPosition));\n        }\n      `)}let b=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"avg"===t&&(b="avgValue / max(count, 1.0)");const v=4*Math.floor(s/4),A=s%4,x=`\n      if (${f}) {\n        avgValue += dot(values, ones);\n      } else {\n        minMaxValue = max(values, minMaxValue);\n      }\n    `;this.userCode=`\n      const ivec2 strides = ivec2(${i}, ${o});\n      const ivec2 pads = ivec2(${h}, ${p});\n      const float initializationValue = ${y};\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float count = 0.0;\n\n      float getValue(int batch, int xR, int xC, int d) {\n        if (xC < 0 || xC >= ${e.inWidth}) {\n          return initializationValue;\n        }\n        count += 1.0;\n        return getX(batch, xR, xC, d);\n      }\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d = coords[3];\n\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // max/min x(?, ?, d) to get y(yR, yC, d).\n        // ? = to be determined\n        vec4 minMaxValue = vec4(${y});\n        float avgValue = 0.0;\n        count = 0.0;\n\n        for (int wR = 0; wR < ${c};\n            wR += ${l}) {\n          int xR = xRCorner + wR;\n\n          if (xR < 0 || xR >= ${e.inHeight}) {\n            continue;\n          }\n\n          for (int wC = 0; wC < ${v}; wC += 4) {\n            int xC = xCCorner + wC * ${u};\n\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + ${u}, d),\n              getValue(batch, xR, xC + 2 * ${u}, d),\n              getValue(batch, xR, xC + 3 * ${u}, d)\n            );\n\n            ${x}\n          }\n\n          int xC = xCCorner + ${v};\n          if (${1===A}) {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              initializationValue,\n              initializationValue,\n              initializationValue\n            );\n\n            ${x}\n          } else if (${2===A}) {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + ${u}, d),\n              initializationValue,\n              initializationValue\n            );\n\n            ${x}\n          } else if (${3===A}) {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + ${u}, d),\n              getValue(batch, xR, xC + 2 * ${u}, d),\n              initializationValue\n            );\n\n            ${x}\n          }\n        }\n        setOutput(${b});\n      }\n    `}}class Lz{constructor(e,t,n,r=!1,a=!1){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");const s=e.filterWidth,i=e.strideDepth,o=e.strideHeight,l=e.strideWidth,u=e.dilationDepth,c=e.dilationHeight,d=e.dilationWidth,h=e.effectiveFilterDepth,p=e.effectiveFilterHeight,f=e.effectiveFilterWidth,m=e.padInfo.front,g=e.padInfo.top,y=e.padInfo.left;this.outputShape=e.outShape;const b="avg"===t;let v="0.0";if(b||(v="-1.0 / 1e-20"),n){const t=">=";return void(this.userCode=`\n        const ivec3 strides =\n            ivec3(${i}, ${o}, ${l});\n        const ivec3 pads = ivec3(${m}, ${g}, ${y});\n\n        void main() {\n          ivec5 coords = getOutputCoords();\n          int batch = coords.x;\n          int ch = coords.u;\n\n          ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n          int xDCorner = xCorner.x;\n          int xRCorner = xCorner.y;\n          int xCCorner = xCorner.z;\n\n          // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n          // ? = to be determined\n          float minMaxValue = 0.0;\n          float minMaxValueFound = 0.0;\n          int minMaxPosition = 0;\n\n          for (int wD = 0; wD < ${h};\n              wD += ${u}) {\n            int xD = xDCorner + wD;\n\n            if (xD < 0 || xD >= ${e.inDepth}) {\n              continue;\n            }\n\n            for (int wR = 0; wR < ${p};\n                wR += ${c}) {\n              int xR = xRCorner + wR;\n\n              if (xR < 0 || xR >= ${e.inHeight}) {\n                continue;\n              }\n\n              for (int wC = 0; wC < ${f};\n                  wC += ${d}) {\n                int xC = xCCorner + wC;\n\n                if (xC < 0 || xC >= ${e.inWidth}) {\n                  continue;\n                }\n\n                float value = getX(batch, xD, xR, xC, ch);\n\n                // If a min / max value has already been found, use it. If not,\n                // use the current value.\n                float currMinMaxValue = mix(\n                    value, minMaxValue, minMaxValueFound);\n                if (value ${t} currMinMaxValue) {\n                  minMaxValue = value;\n                  minMaxValueFound = 1.0;\n                  minMaxPosition = ${r?a?`(((batch * ${e.inDepth} + xD) * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`((xD * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + ch`:`wD * ${p} * ${f} +\n                      wR * ${f} + wC`};\n                }\n              }\n            }\n          }\n          setOutput(float(minMaxPosition));\n        }\n      `)}let A=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;"avg"===t&&(A="avgValue / max(count, 1.0)");const x=4*Math.floor(s/4),k=s%4,w=`\n      if (${b}) {\n        avgValue += dot(values, ones);\n      } else {\n        minMaxValue = max(values, minMaxValue);\n      }\n    `;this.userCode=`\n      const ivec3 strides =\n        ivec3(${i}, ${o}, ${l});\n      const ivec3 pads = ivec3(${m}, ${g}, ${y});\n      const float initializationValue = ${v};\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float count = 0.0;\n\n      float getValue(int batch, int xD, int xR, int xC, int ch) {\n        if (xC < 0 || xC >= ${e.inWidth}) {\n          return initializationValue;\n        }\n        count += 1.0;\n        return getX(batch, xD, xR, xC, ch);\n      }\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int ch = coords.u;\n\n        ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n        int xDCorner = xCorner.x;\n        int xRCorner = xCorner.y;\n        int xCCorner = xCorner.z;\n\n        // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n        // ? = to be determined\n        vec4 minMaxValue = vec4(${v});\n        float avgValue = 0.0;\n        count = 0.0;\n\n        for (int wD = 0; wD < ${h};\n            wD += ${u}) {\n          int xD = xDCorner + wD;\n\n          if (xD < 0 || xD >= ${e.inDepth}) {\n            continue;\n          }\n\n          for (int wR = 0; wR < ${p};\n            wR += ${c}) {\n            int xR = xRCorner + wR;\n\n            if (xR < 0 || xR >= ${e.inHeight}) {\n              continue;\n            }\n\n            for (int wC = 0; wC < ${x}; wC += 4) {\n              int xC = xCCorner + wC * ${d};\n\n              vec4 values = vec4(\n                getValue(batch, xD, xR, xC, ch),\n                getValue(batch, xD, xR, xC + ${d}, ch),\n                getValue(batch, xD, xR, xC + 2 * ${d}, ch),\n                getValue(batch, xD, xR, xC + 3 * ${d}, ch)\n              );\n\n              ${w}\n            }\n\n            int xC = xCCorner + ${x};\n            if (${1===k}) {\n              vec4 values = vec4(\n                getValue(batch, xD, xR, xC, ch),\n                initializationValue,\n                initializationValue,\n                initializationValue\n              );\n\n              ${w}\n            } else if (${2===k}) {\n              vec4 values = vec4(\n                getValue(batch, xD, xR, xC, ch),\n                getValue(batch, xD, xR, xC + ${d}, ch),\n                initializationValue,\n                initializationValue\n              );\n\n              ${w}\n            } else if (${3===k}) {\n              vec4 values = vec4(\n                getValue(batch, xD, xR, xC, ch),\n                getValue(batch, xD, xR, xC + ${d}, ch),\n                getValue(batch, xD, xR, xC + 2 * ${d}, ch),\n                initializationValue\n              );\n\n              ${w}\n            }\n          }\n        }\n        setOutput(${A});\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Bz={kernelName:tl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;mL(a,"avgPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Xi(zf(i,1),(()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Ef(a.shape,s,i,1,o,l);if(1===u.filterWidth&&1===u.filterHeight&&eo(u.inShape,u.outShape))return CP({inputs:{x:a},backend:n});const c=new Mz(u,"avg",!1);return n.runWebGLProgram(c,[a],"float32")}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Pz={kernelName:rl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l,dataFormat:u}=r,c=Rf(a.shape,s,i,[1,1,1],o,l,u),d=new Lz(c,"avg",!1);return n.runWebGLProgram(d,[a],"float32")}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class zz{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=o-1-e.padInfo.top,c=l-1-e.padInfo.left,d=1/(t*n);this.userCode=`\n      const ivec2 pads = ivec2(${u}, ${c});\n      const float avgMultiplier = float(${d});\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n\n        ivec2 dyRCCorner = coords.yz - pads;\n        int dyRCorner = dyRCCorner.x;\n        int dyCCorner = dyRCCorner.y;\n\n        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < ${o};\n            wR += ${s}) {\n          float dyR = float(dyRCorner + wR) / ${r}.0;\n\n          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC < ${l};\n            wC+= ${i}) {\n            float dyC = float(dyCCorner + wC) / ${a}.0;\n\n            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            float dyValue = getDy(b, idyR, idyC, d);\n\n            dotProd += dyValue * avgMultiplier;\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}class Gz{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,d=e.effectiveFilterHeight,h=e.effectiveFilterWidth,p=c-1-e.padInfo.front,f=d-1-e.padInfo.top,m=h-1-e.padInfo.left,g=1/(t*n*r);this.userCode=`\n      const ivec3 pads = ivec3(${p}, ${f}, ${m});\n      const float avgMultiplier = float(${g});\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int ch = coords.u;\n\n        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n        int dyDCorner = dyCorner.x;\n        int dyRCorner = dyCorner.y;\n        int dyCCorner = dyCorner.z;\n\n        // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n        // dx(xD, xR, xC, ch).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n\n        for (int wD = 0; wD < ${c};\n            wD += ${o}) {\n          float dyD = float(dyDCorner + wD) / ${a}.0;\n\n          if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {\n            continue;\n          }\n          int idyD = int(dyD);\n\n          for (int wR = 0; wR < ${d};\n              wR += ${l}) {\n            float dyR = float(dyRCorner + wR) / ${s}.0;\n\n            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n                fract(dyR) > 0.0) {\n              continue;\n            }\n            int idyR = int(dyR);\n\n            for (int wC = 0; wC < ${h};\n                wC += ${u}) {\n              float dyC = float(dyCCorner + wC) / ${i}.0;\n\n              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n                  fract(dyC) > 0.0) {\n                continue;\n              }\n              int idyC = int(dyC);\n\n              float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n              dotProd += dyValue * avgMultiplier;\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Vz={kernelName:al,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s,{filterSize:o,strides:l,pad:u,dimRoundingMode:c}=r,d=Rf(i.shape,o,l,[1,1,1],u,c),h=new Gz(d);return n.runWebGLProgram(h,[a],i.dtype)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Uz={kernelName:nl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s;mL([a,s],"avgPoolGrad");const{filterSize:o,strides:l,pad:u}=r,c=Ef(i.shape,o,l,1,u),d=new zz(c);return n.runWebGLProgram(d,[a],i.dtype)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Hz={kernelName:sl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{a:a,b:s}=t,{transposeA:i,transposeB:o}=r;return az({a:a,b:s,transposeA:i,transposeB:o,backend:n})}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class jz{constructor(e,t,n,r,a,s){this.outputShape=[],this.variableNames=["x","mean","variance"],Om(e,t),Om(e,n);let i="0.0";null!=r&&(Om(e,r),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";null!=a&&(Om(e,a),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`\n      void main() {\n        float x = getXAtOutCoords();\n        float mean = getMeanAtOutCoords();\n        float variance = getVarianceAtOutCoords();\n        float offset = ${i};\n        float scale = ${o};\n        float inv = scale * inversesqrt(variance + float(${s}));\n        setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class qz{constructor(e,t,n,r,a,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Om(e,t),Om(e,n);let i="vec4(0.0)";null!=r&&(Om(e,r),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";null!=a&&(Om(e,a),this.variableNames.push("scale"),o="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=`\n      void main() {\n        vec4 offset = ${i};\n        vec4 scale = ${o};\n\n        vec4 x = getXAtOutCoords();\n        vec4 mean = getMeanAtOutCoords();\n        vec4 variance = getVarianceAtOutCoords();\n\n        vec4 inv = scale * inversesqrt(variance + vec4(${s}));\n\n        setOutput((x - mean) * inv + offset);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Qz={kernelName:Jl,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r,mean:a,variance:s,offset:i,scale:o}=e;Xi(a.shape.length===s.shape.length,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),Xi(null==i||a.shape.length===i.shape.length,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),Xi(null==o||a.shape.length===o.shape.length,(()=>"Batch normalization gradient requires mean and scale to have equal ranks."));let{varianceEpsilon:l}=n;null==l&&(l=.001);const u=[r,a,s];let c=null;null!=i&&(c=i.shape,u.push(i));let d=null;null!=o&&(d=o.shape,u.push(o));const h=Do().getBool("WEBGL_PACK_NORMALIZATION")?new qz(r.shape,a.shape,s.shape,c,d,l):new jz(r.shape,a.shape,s.shape,c,d,l);return t.runWebGLProgram(h,u,u[0].dtype)}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class Xz{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const t=OL(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const n=function(e){if(1===e)return"sourceLoc";if(e<=6)return Zz.slice(0,e).map((e=>"sourceLoc."+e)).join(",");throw Error(`Slicing for rank ${e} is not yet supported`)}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(this.rank);let r;r=`\n        ${t} sourceLoc;\n        ${t} coords = getOutputCoords();\n        ${e.map(((e,t)=>`sourceLoc.${Zz[t]} = start[${t}] + coords.${Zz[t]};`)).join("\n")}\n      `,this.userCode=`\n      void main() {\n        ${r}\n        setOutput(getSource(${n}));\n      }\n    `}}const Zz=["x","y","z","w","u","v"];class Kz{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const t=OL(this.rank),n=nP("coords",this.rank),r=nP("sourceLoc",this.rank),a=1===this.rank?"sourceLoc":`vec2(${r.slice(-2).join()})`,s=`getChannel(getSource(${r.join()}), ${a})`,i=`\n      result.x = ${s};\n      if (++${n[this.rank-1]} < ${e[this.rank-1]}) {\n        ++${r[this.rank-1]};\n        result.y = ${s};\n        --${r[this.rank-1]};\n      }\n    `,o=1===this.rank?"":`\n      --${n[this.rank-1]};\n      if (++${n[this.rank-2]} < ${e[this.rank-2]}) {\n        ++${r[this.rank-2]};\n        result.z = ${s};\n        if (++${n[this.rank-1]} < ${e[this.rank-1]}) {\n          ++${r[this.rank-1]};\n          result.w = ${s};\n        }\n      }\n    `,l=this.rank<=4?`sourceLoc = coords +\n            ${t}(${e.map(((e,t)=>`start[${t}]`)).join()});`:e.map(((e,t)=>`${r[t]} = ${n[t]} + start[${t}];`)).join("\n");this.userCode=`\n      void main() {\n        ${t} coords = getOutputCoords();\n        ${t} sourceLoc;\n        ${l}\n        vec4 result = vec4(0.);\n        ${i}\n        ${o}\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function Jz(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,size:i}=r,[o,l]=vx(a,s,i);if(ox(a,o,l),0===Ji(l))return n.makeTensorInfo(l,a.dtype,[]);if(n.shouldExecuteOnCPU([a])||"string"===a.dtype){const e=n.texData.get(a.dataId),t=PB(e.values,o,l,a.shape,a.dtype);return n.makeTensorInfo(l,a.dtype,t)}const{isPacked:u}=n.texData.get(a.dataId),c=yx(a.shape,o,l);if(u||!c){const e=Do().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Kz(l):new Xz(l),t=[o];return n.runWebGLProgram(e,[a],a.dtype,t)}return n.uploadToGPU(a.dataId),function(e,t,n,r){const a=r.texData.get(e.dataId),s=r.makeTensorInfo(n,e.dtype),i=r.texData.get(s.dataId);Object.assign(i,a),i.refCount=1,i.shape=n,i.dtype=e.dtype;let o=bx(t,ko(e.shape));a.slice&&(o+=a.slice.flatOffset),i.slice={flatOffset:o,origDataId:a.slice&&a.slice.origDataId||e.dataId};const l=r.dataRefCount.get(i.slice.origDataId)||1;return r.dataRefCount.set(i.slice.origDataId,l+1),s}(a,o,l,n)}const Yz={kernelName:fc,backendName:"webgl",kernelFunc:Jz},eG={kernelName:il,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,crops:i}=r;Xi(a.shape.length<=4,(()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"));const o=s.reduce(((e,t)=>e*t)),l=Mx(a.shape,s,o),u=Lx(l.length,s.length),c=Bx(a.shape,s,o),d=Px(i,s.length),h=zx(c,i,s.length),p=[],f=jP({inputs:{x:a},backend:n,attrs:{shape:l}}),m=nz({inputs:{x:f},backend:n,attrs:{perm:u}}),g=jP({inputs:{x:m},backend:n,attrs:{shape:c}}),y=Jz({inputs:{x:g},backend:n,attrs:{begin:d,size:h}});return p.push(f),p.push(m),p.push(g),p.forEach((e=>n.disposeIntermediateTensorInfo(e))),y}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const tG={kernelName:ol,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:i}=r,o=n.readSync(a.dataId),l=n.readSync(s.dataId),u=oB(o,l,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,u)}};
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const nG={kernelName:ll,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{a:r,b:a}=t,s=Do().getBool("WEBGL_PACK_BINARY_OPERATIONS"),i=Do().getNumber("WEBGL_VERSION");if(n.shouldExecuteOnCPU([r,a])||1===i){const e=n.texData.get(r.dataId).values,t=n.texData.get(a.dataId).values,[s,i]=uB(r.shape,a.shape,e,t,r.dtype),o=n.makeTensorInfo(i,r.dtype);return n.texData.get(o.dataId).values=s,o}let o;return o=s?new SP("\n  int r = int(a.r) & int(b.r);\n  int g = int(a.g) & int(b.g);\n  int rb = int(a.b) & int(b.b);\n  int ra = int(a.a) & int(b.a);\n  return vec4(r, g, rb, ra);\n",r.shape,a.shape,!1):new kP("\n  return float(int(a.r) & int(b.r));\n",r.shape,a.shape),n.runWebGLProgram(o,[r,a],r.dtype)}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const rG={kernelName:cl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{s0:r,s1:a}=t,s=n.readSync(r.dataId),i=n.readSync(a.dataId),o=Om(Array.from(s),Array.from(i));return n.makeTensorInfo([o.length],"int32",Int32Array.from(o))}},aG=MP({opSnippet:"return float(a != b);",cpuKernelImpl:NB,dtype:"bool"}),sG={kernelName:Du,backendName:"webgl",kernelFunc:aG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function iG(e){const{inputs:t,backend:n}=e,{input:r}=t;return CP({inputs:{x:n.texData.get(r.dataId).complexTensorInfos.real},backend:n})}const oG={kernelName:Ku,backendName:"webgl",kernelFunc:iG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lG={kernelName:dl,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function e(t){const{inputs:n,backend:r,attrs:a}=t,{x:s}=n,{dtype:i}=a;if("complex64"===i){if("complex64"===s.dtype)return CP({inputs:{x:s},backend:r});const t=Zg(s.shape),n=e({inputs:{x:s},backend:r,attrs:{dtype:"float32"}}),a=WP({inputs:{real:n,imag:t},backend:r});return t.dispose(),r.disposeIntermediateTensorInfo(n),a}if("complex64"===s.dtype){const t=iG({inputs:{input:s},backend:r}),n=e({inputs:{x:t},backend:r,attrs:{dtype:i}});return r.disposeIntermediateTensorInfo(t),n}if(!po(s.dtype,i)){const e=CP({inputs:{x:s},backend:r});return{dataId:e.dataId,shape:e.shape,dtype:i}}if(r.shouldExecuteOnCPU([s])){const e=r.texData.get(s.dataId).values,[t,n,a]=cB(e,s.shape,s.dtype,i);return r.makeTensorInfo(t,n,a)}if("int32"===i)return function(e,t){const n=new uP(e.shape,"return float(int(x));"),r=t.runWebGLProgram(n,[e],"int32");return{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}(s,r);if("bool"===i){const e=r.makeTensorInfo([],"bool",lo("bool",1)),t=aG({inputs:{a:s,b:e},backend:r});return r.disposeIntermediateTensorInfo(e),t}throw new Error(`Error in Cast: failed to cast ${s.dtype} to ${i}`)}},uG="return ceil(x);",cG=DP({opSnippet:uG,packedOpSnippet:uG,cpuKernelImpl:dB}),dG={kernelName:hl,backendName:"webgl",kernelFunc:cG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class hG{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\n\n      void main() {\n        float value = getAAtOutCoords();\n        if (isnan(value)) {\n          setOutput(value);\n          return;\n        }\n\n        setOutput(clamp(value, minVal, maxVal));\n      }\n    "}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class pG{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode="\n      void main() {\n        vec4 value = getAAtOutCoords();\n\n        if (any(isnan(value))) {\n          setOutput(value);\n          return;\n        }\n\n        setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n      }\n    "}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const fG={kernelName:pl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{clipValueMin:s,clipValueMax:i}=r;let o;o=Do().getBool("WEBGL_PACK_CLIP")?new pG(a.shape):new hG(a.shape);const l=[[s],[i]];return n.runWebGLProgram(o,[a],a.dtype,l)}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class mG{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode="\n      void main() {\n        float re = abs(getRealAtOutCoords());\n        float im = abs(getImagAtOutCoords());\n        float mx = max(re, im);\n\n        // sadly the length function in glsl is not underflow-safe\n        // (at least not on Intel GPUs). So the safe solution is\n        // to ensure underflow-safety in all cases.\n        setOutput(\n          mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n        );\n      }\n    "}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function gG(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}const yG={kernelName:ml,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=n.texData.get(r.dataId),s=new mG(r.shape),i=[gG(r,a.complexTensorInfos.real),gG(r,a.complexTensorInfos.imag)];return n.runWebGLProgram(s,i,i[0].dtype)}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class bG{constructor(e){this.outputShape=[],this.outputShape=_x(e,1),this.variableNames=e.map(((e,t)=>`T${t}`));const t=new Array(e.length-1);t[0]=e[0][1];for(let s=1;s<t.length;s++)t[s]=t[s-1]+e[s][1];const n=[`if (yC < ${t[0]}) setOutput(getT0(yR, yC));`];for(let s=1;s<t.length;s++){const e=t[s-1];n.push(`else if (yC < ${t[s]}) setOutput(getT${s}(yR, yC-${e}));`)}const r=t.length,a=t[t.length-1];n.push(`else setOutput(getT${r}(yR, yC-${a}));`),this.userCode=`\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int yR = coords.x;\n        int yC = coords.y;\n\n        ${n.join("\n        ")}\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class vG{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=_x(e,t);const n=this.outputShape,r=n.length,a=OL(r),s=nP("coords",r),i=["x","y","z","w","u","v"].slice(0,r);this.variableNames=e.map(((e,t)=>`T${t}`));const o=new Array(e.length-1);o[0]=e[0][t];for(let f=1;f<o.length;f++)o[f]=o[f-1]+e[f][t];const l=i[t],u=i.slice(-2),c=i.join();let d=`if (${l} < ${o[0]}) {\n        return getChannel(\n            getT0(${c}), vec2(${u.join()}));\n        }`;for(let f=1;f<o.length;f++){const e=o[f-1];d+=`\n        if (${l} < ${o[f]}  && ${l} >= ${o[f-1]}) {\n          return getChannel(\n            getT${f}(${AG(i,l,e)}),\n            vec2(${AG(u,l,e)}));\n        }`}const h=o.length,p=o[o.length-1];d+=`\n        return getChannel(\n          getT${h}(${AG(i,l,p)}),\n          vec2(${AG(u,l,p)}));`,this.userCode=`\n      float getValue(${i.map((e=>"int "+e))}) {\n        ${d}\n      }\n\n      void main() {\n        ${a} coords = getOutputCoords();\n        vec4 result = vec4(getValue(${s}), 0., 0., 0.);\n\n        ${s[r-1]} = ${s[r-1]} + 1;\n        if (${s[r-1]} < ${n[r-1]}) {\n          result.g = getValue(${s});\n        }\n\n        ${s[r-2]} = ${s[r-2]} + 1;\n        if (${s[r-2]} < ${n[r-2]}) {\n          result.a = getValue(${s});\n        }\n\n        ${s[r-1]} = ${s[r-1]} - 1;\n        if (${s[r-2]} < ${n[r-2]} &&\n            ${s[r-1]} < ${n[r-1]}) {\n          result.b = getValue(${s});\n        }\n        setOutput(result);\n      }\n    `}}function AG(e,t,n){const r=e.indexOf(t);return e.map(((e,t)=>t===r?`${e} - ${n}`:e)).join()}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function xG(e){const{inputs:t,backend:n}=e,{input:r}=t;return CP({inputs:{x:n.texData.get(r.dataId).complexTensorInfos.imag},backend:n})}const kG={kernelName:su,backendName:"webgl",kernelFunc:xG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function wG(e,t,n){const r=e[0].dtype;if("complex64"===r){const r=e.map((e=>iG({inputs:{input:e},backend:n}))),a=e.map((e=>xG({inputs:{input:e},backend:n}))),s=wG(r,t,n),i=wG(a,t,n),o=WP({inputs:{real:s,imag:i},backend:n});return r.forEach((e=>n.disposeIntermediateTensorInfo(e))),a.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.disposeIntermediateTensorInfo(s),n.disposeIntermediateTensorInfo(i),o}let a=n.shouldExecuteOnCPU(e);if("string"===r&&(a=!0),a){const a=e.map((e=>{const r=Ji(e.shape.slice(t));return jP({inputs:{x:e},backend:n,attrs:{shape:[-1,r]}})})),s=a.map((e=>({vals:n.readSync(e.dataId),shape:e.shape}))),i=_x(a.map((e=>e.shape)),1),o=1===a[0].shape[0],l=hB(s,i,r,o),u=_x(e.map((e=>e.shape)),t),c=n.makeTensorInfo(u,r,l);return a.forEach((e=>n.disposeIntermediateTensorInfo(e))),c}const s=e.filter((e=>Ji(e.shape)>0)),i=Do().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&s[0].shape.length>1;if(1===s.length){const t=i?new uP(e[0].shape,fP):new mP(e[0].shape,fP);return n.runWebGLProgram(t,e,r)}const o=Do().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(s.length>o){const e=[];for(let a=0;a<s.length;a+=o){const r=s.slice(a,a+o);e.push(wG(r,t,n))}const r=wG(e,t,n);for(const t of e)n.disposeIntermediateTensorInfo(t);return r}if(i){const e=new vG(s.map((e=>e.shape)),t);return n.runWebGLProgram(e,s,r)}const{tensors2D:l,outShape:u}=function(e,t,n){const r=_x(e.map((e=>e.shape)),t),a=e.map((e=>jP({inputs:{x:e},attrs:{shape:[-1,Ji(e.shape.slice(t))]},backend:n})));return{tensors2D:a,outShape:r}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(s,t,n),c=new bG(l.map((e=>e.shape))),d=n.runWebGLProgram(c,l,r);l.forEach((e=>n.disposeIntermediateTensorInfo(e)));const h=jP({inputs:{x:d},attrs:{shape:u},backend:n});return n.disposeIntermediateTensorInfo(d),h}function SG(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r,s=io(a,t[0].shape)[0];Wx(t.map((e=>e.shape)),s);const i=_x(t.map((e=>e.shape)),s);if(0===Ji(i))return n.makeTensorInfo(i,t[0].dtype,[]);const o=t.filter((e=>Ji(e.shape)>0));return 1===o.length?CP({inputs:{x:o[0]},backend:n}):wG(o,s,n)}const CG={kernelName:gl,backendName:"webgl",kernelFunc:SG};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class IG{constructor(e,t=!1,n=null,r=!1,a=!1){this.variableNames=["x","W"],this.outputShape=e.outShape;const s=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,l=e.strideWidth,u=e.dilationHeight,c=e.dilationWidth,d=e.filterHeight,h=e.filterWidth,p=4*Math.floor(e.inChannels/4),f=e.inChannels%4,m="channelsLast"===e.dataFormat,g=m?1:2,y=m?2:3,b=m?3:1;let v="",A="";n&&(v=r?`float activation(float a) {\n          float b = getPreluActivationWeightsAtOutCoords();\n          ${n}\n        }`:a?`float activation(float a) {\n          float b = getLeakyreluAlphaAtOutCoords();\n          ${n}\n        }`:`\n          float activation(float x) {\n            ${n}\n          }\n        `,A="result = activation(result);");const x=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n      ${v}\n\n      const ivec2 strides = ivec2(${o}, ${l});\n      const ivec2 pads = ivec2(${s}, ${i});\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d2 = coords[${b}];\n\n        ivec2 xRCCorner =\n            ivec2(coords[${g}], coords[${y}]) * strides - pads;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < ${d}; wR++) {\n          int xR = xRCorner + wR * ${u};\n\n          if (xR < 0 || xR >= ${e.inHeight}) {\n            continue;\n          }\n\n          for (int wC = 0; wC < ${h}; wC++) {\n            int xC = xCCorner + wC * ${c};\n\n            if (xC < 0 || xC >= ${e.inWidth}) {\n              continue;\n            }\n\n            for (int d1 = 0; d1 < ${p}; d1 += 4) {\n              vec4 wValues = vec4(\n                getW(wR, wC, d1, d2),\n                getW(wR, wC, d1 + 1, d2),\n                getW(wR, wC, d1 + 2, d2),\n                getW(wR, wC, d1 + 3, d2)\n              );\n\n              if (${m}) {\n                vec4 xValues = vec4(\n                  getX(batch, xR, xC, d1),\n                  getX(batch, xR, xC, d1 + 1),\n                  getX(batch, xR, xC, d1 + 2),\n                  getX(batch, xR, xC, d1 + 3)\n                );\n                dotProd += dot(xValues, wValues);\n              } else {\n                vec4 xValues = vec4(\n                  getX(batch, d1, xR, xC),\n                  getX(batch, d1 + 1, xR, xC),\n                  getX(batch, d1 + 2, xR, xC),\n                  getX(batch, d1 + 3, xR, xC)\n                );\n                dotProd += dot(xValues, wValues);\n              }\n            }\n\n            if (${1===f}) {\n\n              if (${m}) {\n                dotProd +=\n                    getX(batch, xR, xC, ${p}) *\n                    getW(wR, wC, ${p}, d2);\n              } else {\n                dotProd +=\n                    getX(batch, ${p}, xR, xC) *\n                    getW(wR, wC, ${p}, d2);\n              }\n\n            } else if (${2===f}) {\n              vec2 wValues = vec2(\n                getW(wR, wC, ${p}, d2),\n                getW(wR, wC, ${p} + 1, d2)\n              );\n\n              if (${m}) {\n                vec2 xValues = vec2(\n                  getX(batch, xR, xC, ${p}),\n                  getX(batch, xR, xC, ${p} + 1)\n                );\n                dotProd += dot(xValues, wValues);\n              } else {\n                vec2 xValues = vec2(\n                  getX(batch, ${p}, xR, xC),\n                  getX(batch, ${p} + 1, xR, xC)\n                );\n                dotProd += dot(xValues, wValues);\n              }\n\n            } else if (${3===f}) {\n              vec3 wValues = vec3(\n                getW(wR, wC, ${p}, d2),\n                getW(wR, wC, ${p} + 1, d2),\n                getW(wR, wC, ${p} + 2, d2)\n              );\n\n              if (${m}) {\n                vec3 xValues = vec3(\n                  getX(batch, xR, xC, ${p}),\n                  getX(batch, xR, xC, ${p} + 1),\n                  getX(batch, xR, xC, ${p} + 2)\n                );\n                dotProd += dot(xValues, wValues);\n              } else {\n                vec3 xValues = vec3(\n                  getX(batch, ${p}, xR, xC),\n                  getX(batch, ${p} + 1, xR, xC),\n                  getX(batch, ${p} + 2, xR, xC)\n                );\n                dotProd += dot(xValues, wValues);\n              }\n\n            }\n          }\n        }\n\n        float result = dotProd;\n        ${x}\n        ${A}\n        setOutput(result);\n      }\n    `}}class WG{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const t=e.padInfo.front,n=e.padInfo.top,r=e.padInfo.left,a=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=e.dilationDepth,l=e.dilationHeight,u=e.dilationWidth,c=e.filterDepth,d=e.filterHeight,h=e.filterWidth,p=4*Math.floor(e.inChannels/4),f=e.inChannels%4;this.userCode=`\n      const ivec3 strides = ivec3(${a}, ${s}, ${i});\n      const ivec3 pads = ivec3(${t}, ${n}, ${r});\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int d2 = coords.u;\n\n        ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n        int xFCorner = xFRCCorner.x;\n        int xRCorner = xFRCCorner.y;\n        int xCCorner = xFRCCorner.z;\n\n        // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n        // y(yF, yR, yC, d2). ? = to be determined. : = across all\n        // values in that axis.\n        float dotProd = 0.0;\n        for (int wF = 0; wF < ${c}; wF++) {\n          int xF = xFCorner + wF * ${o};\n\n          if (xF < 0 || xF >= ${e.inDepth}) {\n            continue;\n          }\n\n          for (int wR = 0; wR < ${d}; wR++) {\n            int xR = xRCorner + wR * ${l};\n\n            if (xR < 0 || xR >= ${e.inHeight}) {\n              continue;\n            }\n\n            for (int wC = 0; wC < ${h}; wC++) {\n              int xC = xCCorner + wC * ${u};\n\n              if (xC < 0 || xC >= ${e.inWidth}) {\n                continue;\n              }\n\n              for (int d1 = 0; d1 < ${p}; d1 += 4) {\n                vec4 xValues = vec4(\n                  getX(batch, xF, xR, xC, d1),\n                  getX(batch, xF, xR, xC, d1 + 1),\n                  getX(batch, xF, xR, xC, d1 + 2),\n                  getX(batch, xF, xR, xC, d1 + 3)\n                );\n                vec4 wValues = vec4(\n                  getW(wF, wR, wC, d1, d2),\n                  getW(wF, wR, wC, d1 + 1, d2),\n                  getW(wF, wR, wC, d1 + 2, d2),\n                  getW(wF, wR, wC, d1 + 3, d2)\n                );\n\n                dotProd += dot(xValues, wValues);\n              }\n\n              if (${1===f}) {\n                dotProd +=\n                  getX(batch, xF, xR, xC, ${p}) *\n                  getW(wF, wR, wC, ${p}, d2);\n              } else if (${2===f}) {\n                vec2 xValues = vec2(\n                  getX(batch, xF, xR, xC, ${p}),\n                  getX(batch, xF, xR, xC, ${p} + 1)\n                );\n                vec2 wValues = vec2(\n                  getW(wF, wR, wC, ${p}, d2),\n                  getW(wF, wR, wC, ${p} + 1, d2)\n                );\n                dotProd += dot(xValues, wValues);\n              } else if (${3===f}) {\n                vec3 xValues = vec3(\n                  getX(batch, xF, xR, xC, ${p}),\n                  getX(batch, xF, xR, xC, ${p} + 1),\n                  getX(batch, xF, xR, xC, ${p} + 2)\n                );\n                vec3 wValues = vec3(\n                  getW(wF, wR, wC, ${p}, d2),\n                  getW(wF, wR, wC, ${p} + 1, d2),\n                  getW(wF, wR, wC, ${p} + 2, d2)\n                );\n                dotProd += dot(xValues, wValues);\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class _G{constructor(e,t=!1,n=null,r=!1,a=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=zL(this.outputShape.length);const s=e.padInfo.left,i=e.strideWidth,o=e.dilationWidth,l=e.filterHeight,u=e.filterWidth,c=u;let d="\n       int xR; int xC; int xCOffset;\n       vec4 wTexel; vec4 previous; vec4 final;";for(let m=0;m<u;m++)d+=`\n           vec4 xTexelC${2*m};\n           int xTexelC${2*m}Ready;\n           vec4 xTexelC${2*m+1};\n           int xTexelC${2*m+1}Ready;\n           vec4 xC${m};`;d+=`\n     for (int r = 0; r < ${l}; r++) {\n      for (int d1 = 0; d1 < ${e.inChannels}; d1 += 2) {\n       `;for(let m=0;m<u;m++)d+=`\n           xTexelC${2*m} = vec4(0.0);\n           xTexelC${2*m}Ready = 0;\n           xTexelC${2*m+1} = vec4(0.0);\n           xTexelC${2*m+1}Ready = 0;\n           xC${m} = vec4(0.0);`;d+="\n         xR = xRCorner + r * dilations[0];\n         if (xR >=0 && xR < inDims[0]) {\n       ";for(let m=0;m<(c+1)/2;m++){const t=2*m;if(d+=`\n           xC = xCCorner + ${t*o};\n           `,1===i){if(t<u&&(s%2==1?(d+=`\n                 xCOffset = xC + 1;\n                 if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t}Ready == 0) {\n                   xTexelC${t} = getX(batch, xR, xCOffset, d1);\n\n                   // Need to manually clear unused channels in case\n                   // we're reading from recycled texture.\n                   if (xCOffset + 1 >= inDims[1]) {\n                     xTexelC${t}.zw = vec2(0.0);\n                   }\n                   xTexelC${t}Ready = 1;\n                 }\n               `,d+=1===o&&t>0?`\n                 xC${t} = vec4(xTexelC${t-2}.zw, xTexelC${t}.xy);\n                 `:`\n                   xCOffset = xC + 1 - 2;\n\n                   if (xCOffset >= 0 && xCOffset < inDims[1]) {\n                     previous = getX(batch, xR, xCOffset, d1);\n\n                     // Need to manually clear unused channels in case\n                     // we're reading from recycled texture.\n                     if (xCOffset + 1 >= inDims[1]) {\n                       previous.zw = vec2(0.0);\n                     }\n\n                     xC${t} = vec4(previous.zw, xTexelC${t}.xy);\n                   } else {\n                     xC${t} = vec4(0.0, 0.0, xTexelC${t}.xy);\n                   }\n                   `):d+=`\n                 if (xC >= 0 && xC < inDims[1] && xTexelC${t}Ready == 0) {\n                   xTexelC${t} = getX(batch, xR, xC, d1);\n                   if (xC + 1 >= inDims[1]) {\n                     xTexelC${t}.zw = vec2(0.0);\n                   }\n                   xTexelC${t}Ready = 1;\n                 }\n\n                 xC${t} = xTexelC${t};\n                 `,t+1<u)){const e=s%2==0?ji(o):o;o%2==0&&s%2==1||o%2!=0&&s%2!=1?(d+=`\n                   xCOffset = xC + imod(pads[1], 2) + ${e};\n\n                   if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n                     xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n\n                     // Need to manually clear unused channels in case\n                     // we're reading from recycled texture.\n                     if (xCOffset + 1 >= inDims[1]) {\n                       xTexelC${t+1}.zw = vec2(0.0);\n                     }\n                     xTexelC${t+1}Ready = 1;\n                   }\n                   `,d+=o>1?`\n                     xCOffset -= 2;\n                     if (xCOffset >= 0 && xCOffset < inDims[1]) {\n                      previous = getX(batch, xR, xCOffset, d1);\n                      xC${t+1} = vec4(previous.zw, xTexelC${t+1}.xy);\n                     } else {\n                      xC${t+1} = vec4(0.0, 0.0, xTexelC${t+1}.xy);\n                     }\n                     `:`\n                     xC${t+1} = vec4(xTexelC${t}.zw, xTexelC${t+1}.xy);\n                     `):d+=1===e?`\n                     xC${t+1} = xTexelC${t};\n                     `:`\n                     xCOffset = xC + ${e};\n\n                     if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n                       xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n                       if (xCOffset + 1 >= inDims[1]) {\n                         xTexelC${t+1}.zw = vec2(0.0);\n                       }\n                       xTexelC${t+1}Ready = 1;\n                     }\n\n                     xC${t+1} = xTexelC${t+1};\n                     `}}else t<u&&(s%2==1?(d+=`\n                 xCOffset = xC + 1 - strides[1];\n                 if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t}Ready == 0) {\n                   xTexelC${t} = getX(batch, xR, xCOffset, d1);\n                   // Need to manually clear unused channels in case\n                   // we're reading from recycled texture.\n                   if (xCOffset + 1 >= inDims[1]) {\n                     xTexelC${t}.zw = vec2(0.0);\n                   }\n                   xTexelC${t}Ready = 1;\n                 }\n\n                 if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${t+1}Ready == 0) {\n                   xTexelC${t+1} = getX(batch, xR, xC + 1, d1);\n                   // Need to manually clear unused channels in case\n                   // we're reading from recycled texture.\n                   if (xC + 2 >= inDims[1]) {\n                     xTexelC${t+1}.zw = vec2(0.0);\n                   }\n                   xTexelC${t+1}Ready = 1;\n                 }\n\n                 xC${t} = vec4(xTexelC${t}.zw, xTexelC${t+1}.zw);\n               `,t+1<u&&(d+=`\n                   final = vec4(0.0);\n                   xCOffset = xC + 1 + strides[1];\n                   if(xCOffset >= 0 && xCOffset < inDims[1]) {\n                     final = getX(batch, xR, xCOffset, d1);\n                   }\n                   xC${t+1} = vec4(xTexelC${t+1}.xy, final.xy);\n                 `)):(d+=`\n                 if(xC >= 0 && xC < inDims[1] && xTexelC${t}Ready == 0) {\n                   xTexelC${t} = getX(batch, xR, xC, d1);\n                   if (xC + 1 >= inDims[1]) {\n                     xTexelC${t}.zw = vec2(0.0);\n                   }\n                   xTexelC${t}Ready = 1;\n                 }\n\n                 xCOffset = xC + strides[1];\n                 if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${t+1}Ready == 0) {\n                   xTexelC${t+1} = getX(batch, xR, xCOffset, d1);\n                   if (xCOffset + 1 >= inDims[1]) {\n                     xTexelC${t+1}.zw = vec2(0.);\n                   }\n                   xTexelC${t+1}Ready = 1;\n                 }\n\n                 xC${t} = vec4(\n                   xTexelC${t}.xy, xTexelC${t+1}.xy);\n               `,t+1<u&&(d+=`\n                   xC${t+1} = vec4(xTexelC${t}.zw, xTexelC${t+1}.zw);\n                 `)));t<u&&(d+=`\n             wTexel = getW(r, ${t}, d1, d2);\n             dotProd += xC${t}.xxzz * vec4(wTexel.xy, wTexel.xy);\n             if(d1 + 1 < ${e.inChannels}) {\n               dotProd += xC${t}.yyww * vec4(wTexel.zw, wTexel.zw);\n             }\n           `,t+1<u&&(d+=`\n               wTexel = getW(r, ${t+1}, d1, d2);\n               dotProd += xC${t+1}.xxzz * vec4(wTexel.xy, wTexel.xy);\n               if(d1 + 1 < ${e.inChannels}) {\n                 dotProd += xC${t+1}.yyww * vec4(wTexel.zw, wTexel.zw);\n               }\n             `))}d+="\n     }\n   ",d+="\n     }\n   ",d+="\n     }\n   ";let h="",p="";n&&(h=r?`vec4 activation(vec4 a) {\n           vec4 b = getPreluActivationWeightsAtOutCoords();\n           ${n}\n         }`:a?`vec4 activation(vec4 a) {\n           vec4 b = getLeakyreluAlphaAtOutCoords();\n           ${n}\n         }`:`vec4 activation(vec4 x) {\n           ${n}\n         }`,p="result = activation(result);");const f=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n       ${h}\n\n       void main() {\n         ivec4 coords = getOutputCoords();\n         int batch = coords.x;\n         ivec2 xRCCorner = coords.yz * strides - pads;\n         int d2 = coords.w;\n         int xRCorner = xRCCorner.x;\n         int xCCorner = xRCCorner.y;\n\n         //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n         vec4 dotProd = vec4(0.000000000000001);\n\n         ${d}\n\n         vec4 result = dotProd - vec4(0.000000000000001);\n         ${f}\n         ${p}\n         setOutput(result);\n       }\n     `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class TG{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec4"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=e,this.enableShapeUniforms=zL(this.outputShape.length);const{dataFormat:n}=t,r=yL(),a="channelsLast"===n,s=a?1:2,i=a?2:3,o=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":`if(blockIndex < ${e[2]} && pos < ${e[1]}) {`;let l="";for(let u=0;u<=1;u++)for(let e=0;e<=1;e++)l+=`\n          blockIndex = rc.z + ${e};\n          pos = rc.y + ${u};\n\n          ${o}\n            offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];\n            d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);\n\n            if(d0 < inputShape[${s}] && d0 >= 0) {\n              // Use custom imod instead mod. On Intel GPU, mod may generate\n              // unexpected value.\n              // https://github.com/tensorflow/tfjs/issues/5447\n              offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];\n              d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /\n                  inChannels);\n\n              if(d1 < inputShape[${i}] && d1 >= 0) {\n\n                ch = imod(pos, inChannels);\n\n                if (${a}) {\n                  innerDims = vec2(d1, ch);\n                  result[${2*u+e}] = getChannel(\n                    getA(rc.x, d0, int(innerDims.x),\n                    int(innerDims.y)), innerDims);\n                } else {\n                  innerDims = vec2(d0, d1);\n                  result[${2*u+e}] = getChannel(\n                    getA(rc.x, ch, int(innerDims.x),\n                    int(innerDims.y)), innerDims);\n                }\n              }\n            }\n          }\n        `;this.userCode=`\n      void main() {\n        ivec3 rc = getOutputCoords();\n\n        vec4 result = vec4(0);\n\n        int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n        vec2 innerDims;\n\n        ${l}\n\n        ${r.output} = result;\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function NG(e,t){const n=e.length;return n>=3?t?[...e.slice(0,-3),e[n-3]*e[n-2],e[n-1]]:[...e.slice(0,-3),e[n-3],e[n-2]*e[n-1]]:!t&&1===n&&e[0]>1?[e[0],1]:null}function EG({x:e,filter:t,convInfo:n,backend:r,bias:a=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){const l=e.shape,u=r.texData.get(e.dataId),c=n.inChannels,d=l[0]*l[1]*l[2],h=n.outChannels,p="channelsLast"===n.dataFormat,f=!1;let m;const g=[];if(null!=s){const e=NG(s.shape,p);null!=e&&(s=jP({inputs:{x:s},backend:r,attrs:{shape:e}}),g.push(s))}if(null!=a){const e=NG(a.shape,p);null!=e&&(a=jP({inputs:{x:a},backend:r,attrs:{shape:e}}),g.push(a))}if(!((1===d||1===h)&&c>1e3)&&u.isPacked&&p&&null!=u.texture&&l[2]%2!=0&&eo(u.shape.slice(-3),l.slice(-3))){const c=l[0]*l[1]*(l[2]+1),d={dataId:e.dataId,shape:[1,c,n.inChannels],dtype:e.dtype},h=u.shape;u.shape=u.shape.slice(),u.shape[u.shape.length-2]++,Xi(lL(u.shape,d.shape),(()=>`packed reshape ${u.shape} to ${d.shape} isn't free`));const p=jP({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}});g.push(p);const y=az({a:d,b:p,backend:r,transposeA:false,transposeB:f,bias:a,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),b=r.texData.get(y.dataId);Xi(b.isPacked,(()=>"batchMatMul result is expected to be packed")),u.shape=h,b.shape=n.outShape,m=CP({inputs:{x:y},backend:r}),m.shape=n.outShape,g.push(y)}else{const l=n.outHeight*n.outWidth,u=jP({inputs:{x:e},backend:r,attrs:{shape:p?[n.batchSize,l,n.inChannels]:[n.batchSize,n.inChannels,l]}}),c=jP({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}}),d=az({a:p?u:c,b:p?c:u,transposeA:!p,transposeB:f,backend:r,bias:a,activation:o,preluActivationWeights:s,leakyreluAlpha:i});m=jP({inputs:{x:d},backend:r,attrs:{shape:n.outShape}}),g.push(u),g.push(c),g.push(d)}for(const y of g)r.disposeIntermediateTensorInfo(y);return m}function RG({x:e,filter:t,convInfo:n,backend:r,bias:a=null,preluActivationWeights:s=null,leakyreluAlpha:i=0,activation:o=null}){const{filterWidth:l,filterHeight:u,inChannels:c,outWidth:d,outHeight:h,dataFormat:p}=n,f="channelsLast"===p,m=l*u*c,g=h*d,y=[n.batchSize,m,g],b=[];if(null!=s){const e=NG(s.shape,f);null!=e&&(s=jP({inputs:{x:s},backend:r,attrs:{shape:e}}),b.push(s))}if(null!=a){const e=NG(a.shape,f);null!=e&&(a=jP({inputs:{x:a},backend:r,attrs:{shape:e}}),b.push(a))}const v=jP({inputs:{x:t},backend:r,attrs:{shape:[1,m,Ji(t.shape)/m]}});b.push(v);const A=new TG(y,n),x=[e.shape,[n.padInfo.top,n.padInfo.left],[n.strideHeight,n.strideWidth],[n.dilationHeight,n.dilationWidth],[n.inChannels],[n.filterWidth*n.inChannels],[n.outWidth]],k=r.runWebGLProgram(A,[e],"float32",x),w=jP({inputs:{x:k},backend:r,attrs:{shape:y}});b.push(k),b.push(w);const S=null!=a,C=null!=s,I="leakyrelu"===o,W=o?LP(o,!0):null,_=new BP(f?w.shape:v.shape,f?v.shape:w.shape,f?[n.batchSize,g,n.outChannels]:[n.batchSize,n.outChannels,g],!0,!1,S,W,C,I),T=f?[w,v]:[v,w];if(a&&T.push(a),C&&T.push(s),I){const e=r.makeTensorInfo([],"float32",Xd(i,"float32"));T.push(e),b.push(e)}const N=r.runWebGLProgram(_,T,"float32"),E=jP({inputs:{x:N},backend:r,attrs:{shape:n.outShape}});b.push(N);for(const R of b)r.disposeIntermediateTensorInfo(R);return E}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $G={kernelName:yl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dataFormat:l,dilations:u,dimRoundingMode:c}=r,d=Vf(l),h=$f(a.shape,s.shape,i,u,o,c,!1,d);let p;if(1!==h.filterHeight||1!==h.filterWidth||1!==h.dilationHeight||1!==h.dilationWidth||1!==h.strideHeight||1!==h.strideWidth||"SAME"!==h.padInfo.type&&"VALID"!==h.padInfo.type)if(h.strideWidth<=2&&"channelsLast"===d&&Do().getBool("WEBGL_EXP_CONV")){const e=new _G(h),t=[[h.padInfo.top,h.padInfo.left],[h.strideHeight,h.strideWidth],[h.dilationHeight,h.dilationWidth],[h.inHeight,h.inWidth]];p=n.runWebGLProgram(e,[a,s],"float32",t)}else if(Do().getBool("WEBGL_CONV_IM2COL"))p=RG({x:a,filter:s,convInfo:h,backend:n});else{const e=new IG(h);p=n.runWebGLProgram(e,[a,s],"float32")}else p=EG({x:a,filter:s,convInfo:h,backend:n});const f=jP({inputs:{x:p},backend:n,attrs:{shape:h.outShape}});return n.disposeIntermediateTensorInfo(p),f}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class OG{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=e.padInfo.left,s="channelsLast"===e.dataFormat;this.userCode=`\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int wR = coords.x;\n        int wC = coords.y;\n        int d1 = coords.z;\n        int d2 = coords.w;\n\n        // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n\n        for (int b = 0; b < ${e.batchSize}; b++) {\n          for (int yR = 0; yR < ${e.outHeight}; yR++) {\n            int xR = wR + yR * ${t} - ${r};\n\n            if (xR < 0 || xR >= ${e.inHeight}) {\n              continue;\n            }\n\n            for (int yC = 0; yC < ${e.outWidth}; yC++) {\n              int xC = wC + yC * ${n} - ${a};\n\n              if (xC < 0 || xC >= ${e.inWidth}) {\n                continue;\n              }\n\n              ${s?"float dyValue = getDy(b, yR, yC, d2);\n              float xValue = getX(b, xR, xC, d1);\n              dotProd += (xValue * dyValue);":"float dyValue = getDy(b, d2, yR, yC);\n              float xValue = getX(b, d1, xR, xC);\n              dotProd += (xValue * dyValue);"}\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}class FG{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s="channelsLast"===e.dataFormat,i=t-1-e.padInfo.top,o=n-1-e.padInfo.left,l=s?1:2,u=s?2:3,c=s?3:1;this.userCode=`\n      const ivec2 pads = ivec2(${i}, ${o});\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d1 = coords[${c}];\n\n        ivec2 dyCorner = ivec2(coords[${l}], coords[${u}]) - pads;\n        int dyRCorner = dyCorner.x;\n        int dyCCorner = dyCorner.y;\n\n        // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < ${t}; wR++) {\n          float dyR = float(dyRCorner + wR) / ${r}.0;\n\n          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = ${t} - 1 - wR;\n\n          for (int wC = 0; wC < ${n}; wC++) {\n            float dyC = float(dyCCorner + wC) / ${a}.0;\n\n            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            int wCPerm = ${n} - 1 - wC;\n\n            for (int d2 = 0; d2 < ${e.outChannels}; d2++) {\n\n              if (${s}) {\n                float xValue = getDy(batch, idyR, idyC, d2);\n                float wValue = getW(wRPerm, wCPerm, d1, d2);\n                dotProd += xValue * wValue;\n              } else {\n                float xValue = getDy(batch, d2, idyR, idyC);\n                float wValue = getW(wRPerm, wCPerm, d1, d2);\n                dotProd += xValue * wValue;\n              }\n\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}class DG{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=e.padInfo.front,s=e.padInfo.top,i=e.padInfo.left;this.userCode=`\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int wF = coords.x;\n        int wR = coords.y;\n        int wC = coords.z;\n        int d1 = coords.w;\n        int d2 = coords.u;\n\n        float dotProd = 0.0;\n\n        for (int b = 0; b < ${e.batchSize}; b++) {\n          for (int yF = 0; yF < ${e.outDepth}; yF++) {\n            int xF = wF + yF * ${t} - ${a};\n\n            if (xF < 0 || xF >= ${e.inDepth}) {\n              continue;\n            }\n\n            for (int yR = 0; yR < ${e.outHeight}; yR++) {\n              int xR = wR + yR * ${n} - ${s};\n\n              if (xR < 0 || xR >= ${e.inHeight}) {\n                continue;\n              }\n\n              for (int yC = 0; yC < ${e.outWidth}; yC++) {\n                int xC = wC + yC * ${r} - ${i};\n\n                if (xC < 0 || xC >= ${e.inWidth}) {\n                  continue;\n                }\n\n                float dyValue = getDy(b, yF, yR, yC, d2);\n                float xValue = getX(b, xF, xR, xC, d1);\n                dotProd += (xValue * dyValue);\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}class MG{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterDepth,n=e.filterHeight,r=e.filterWidth,a=e.strideDepth,s=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.front,l=n-1-e.padInfo.top,u=r-1-e.padInfo.left;this.userCode=`\n      const ivec3 pads = ivec3(${o}, ${l}, ${u});\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int d1 = coords.u;\n\n\n        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n        int dyFCorner = dyCorner.x;\n        int dyRCorner = dyCorner.y;\n        int dyCCorner = dyCorner.z;\n\n        float dotProd = 0.0;\n        for (int wF = 0; wF < ${t}; wF++) {\n          float dyF = float(dyFCorner + wF) / ${a}.0;\n\n          if (dyF < 0.0 || dyF >= ${e.outDepth}.0 || fract(dyF) > 0.0) {\n            continue;\n          }\n          int idyF = int(dyF);\n\n          int wFPerm = ${t} - 1 - wF;\n\n          for (int wR = 0; wR < ${n}; wR++) {\n            float dyR = float(dyRCorner + wR) / ${s}.0;\n\n            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n              fract(dyR) > 0.0) {\n              continue;\n            }\n            int idyR = int(dyR);\n\n            int wRPerm = ${n} - 1 - wR;\n\n            for (int wC = 0; wC < ${r}; wC++) {\n              float dyC = float(dyCCorner + wC) / ${i}.0;\n\n              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n                  fract(dyC) > 0.0) {\n                continue;\n              }\n              int idyC = int(dyC);\n\n              int wCPerm = ${r} - 1 - wC;\n\n              for (int d2 = 0; d2 < ${e.outChannels}; d2++) {\n                float xValue = getDy(batch, idyF, idyR, idyC, d2);\n                float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n                dotProd += xValue * wValue;\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const LG={kernelName:bl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,pad:o,dataFormat:l,dimRoundingMode:u,filterShape:c}=r,d=Vf(l),h=$f(a.shape,c,i,1,o,u,!1,d),p=new OG(h);return n.runWebGLProgram(p,[a,s],"float32")}};
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class BG{constructor(e){this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=e.inShape,this.enableShapeUniforms=zL(this.outputShape.length);const t=e.filterHeight,n=e.filterWidth,r=t-1-e.padInfo.top,a=n-1-e.padInfo.left;this.userCode=`\n      const ivec2 pads = ivec2(${r}, ${a});\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d1 = coords[3];\n\n        ivec2 dyCorner = ivec2(coords[1], coords[2]) - pads;\n        int dyRCorner = dyCorner.x;\n        int dyCCorner = dyCorner.y;\n\n        vec4 result = vec4(0.);\n        for (int wR = 0; wR < ${t}; wR++) {\n          float dyR = float(dyRCorner + wR) / strides[0];\n          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n          int wRPerm = ${t} - 1 - wR;\n\n          for (int wC = 0; wC < ${n}; wC++) {\n            int wCPerm = ${n} - 1 - wC;\n\n            float dyC = float(dyCCorner + wC) / strides[1];\n            bool idyCVal = (dyC >= 0.0) && (dyC < ${e.outWidth}.0)\n              && (fract(dyC) == 0.0);\n            int idyC = int(dyC);\n\n            float dyC2 = float(dyCCorner + wC + 1) / strides[1];\n            bool idyCVal2 = (dyC2 >= 0.0) && (dyC2 < ${e.outWidth}.0)\n              && (fract(dyC2) == 0.0);\n            int idyC2 = int(dyC2);\n\n            if (idyCVal && idyCVal2) {\n              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {\n                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n                vec4 dySample = getDy(batch, idyR, idyC, d2);\n                vec4 dySample2 = (idyC / 2 == idyC2 / 2) ?\n                  dySample : getDy(batch, idyR, idyC2, d2);\n\n                vec2 dyValue = mod(float(idyC), 2.) == 0. ?\n                  dySample.xy : dySample.zw;\n                result.xy += vec2(dot(dyValue, wValue.xy),\n                  dot(dyValue, wValue.zw));\n\n                dyValue = mod(float(idyC2), 2.) == 0. ?\n                  dySample2.xy : dySample2.zw;\n                result.zw += vec2(dot(dyValue, wValue.xy),\n                  dot(dyValue, wValue.zw));\n              }\n            } else if (idyCVal) {\n              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {\n                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n                vec4 dySample = getDy(batch, idyR, idyC, d2);\n                vec2 dyValue = mod(float(idyC), 2.) == 0. ?\n                  dySample.xy : dySample.zw;\n                result.xy += vec2(dot(dyValue, wValue.xy),\n                  dot(dyValue, wValue.zw));\n              }\n            } else if (idyCVal2) {\n              for (int d2 = 0; d2 < ${e.outChannels}; d2 += 2) {\n                vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n                vec4 dySample = getDy(batch, idyR, idyC2, d2);\n                vec2 dyValue = mod(float(idyC2), 2.) == 0. ?\n                  dySample.xy : dySample.zw;\n                result.zw += vec2(dot(dyValue, wValue.xy),\n                  dot(dyValue, wValue.zw));\n              }\n            }\n          }\n        }\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const PG={kernelName:vl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{inputShape:i,strides:o,pad:l,dataFormat:u,dimRoundingMode:c}=r,d=Vf(u),h=$f(i,s.shape,o,1,l,c,!1,d);if(Do().getBool("WEBGL_PACK_CONV2DTRANSPOSE")&&"channelsLast"===d){const e=[[h.strideHeight,h.strideWidth]],t=new BG(h);return n.runWebGLProgram(t,[a,s],"float32",e)}{const e=new FG(h);return n.runWebGLProgram(e,[a,s],"float32")}}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zG={kernelName:Al,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l}=r,u=Of(a.shape,s.shape,i,l,o),c=new WG(u);return n.runWebGLProgram(c,[a,s],"float32")}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const GG={kernelName:xl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,pad:o,filterShape:l}=r,u=Of(a.shape,l,i,1,o),c=new DG(u);return n.runWebGLProgram(c,[a,s],"float32")}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const VG={kernelName:kl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{pad:i,strides:o,inputShape:l}=r,u=Of(l,s.shape,o,1,i),c=new MG(u);return n.runWebGLProgram(c,[a,s],"float32")}},UG=DP({opSnippet:FP+"\n  return cos(x);\n",packedOpSnippet:`\n  vec4 result = cos(x);\n  bvec4 isNaN = isnan(x);\n  ${wP}\n  return result;\n`}),HG={kernelName:wl,backendName:"webgl",kernelFunc:UG},jG=DP({opSnippet:"\n  float e2x = exp(-x);\n  return (e2x + 1.0 / e2x) / 2.0;\n"}),qG={kernelName:Sl,backendName:"webgl",kernelFunc:jG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class QG{constructor(e,t,n,r,a){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];const[s,i,o,l]=e,[u]=t,[c,d]=n;this.outputShape=[u,c,d,l];const h="bilinear"===r?1:0,[p,f]=[i-1+".0",o-1+".0"],[m,g,y]=c>1?[""+(i-1)/(c-1),"(y2-y1) * height_ratio",`y1*${p} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${p}`],[b,v,A]=d>1?[""+(o-1)/(d-1),"(x2-x1) * width_ratio",`x1*${f} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${f}`];this.userCode=`\n      const float height_ratio = float(${m});\n      const float width_ratio = float(${b});\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int y = coords[1];\n        int x = coords[2];\n        int d = coords[3];\n\n        // get box vals\n        float y1 = getBoxes(b,0);\n        float x1 = getBoxes(b,1);\n        float y2 = getBoxes(b,2);\n        float x2 = getBoxes(b,3);\n\n        // get image in batch index\n        int bInd = round(getBoxInd(b));\n        if(bInd < 0 || bInd >= ${s}) {\n          return;\n        }\n\n        float height_scale = ${g};\n        float width_scale = ${v};\n\n        float in_y = ${y};\n        if( in_y < 0.0 || in_y > ${p} ) {\n          setOutput(float(${a}));\n          return;\n        }\n        float in_x = ${A};\n        if( in_x < 0.0 || in_x > ${f} ) {\n          setOutput(float(${a}));\n          return;\n        }\n\n        vec2 sourceFracIndexCR = vec2(in_x,in_y);\n        if(${h} == 1) {\n          // Compute the four integer indices.\n          ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n          ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n          float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n          float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n          float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n          float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n          vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n          float top = topLeft + (topRight - topLeft) * fracCR.x;\n          float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n          float newValue = top + (bottom - top) * fracCR.y;\n          setOutput(newValue);\n        } else {\n          // Compute the coordinators of nearest neighbor point.\n          ivec2 sourceNearestCR = ivec2(floor(\n            sourceFracIndexCR + vec2(0.5,0.5)));\n          float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n          setOutput(newValue);\n        }\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const XG={kernelName:Wl,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{image:a,boxes:s,boxInd:i}=t,{cropSize:o,method:l,extrapolationValue:u}=r,c=new QG(a.shape,s.shape,o,l,u);return n.runWebGLProgram(c,[a,s,i],"float32")}};var ZG,KG;(KG=ZG||(ZG={})).Prod="*",KG.Sum="+";class JG{constructor(e,t,n,r){this.op=e,this.outputShape=t,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];const a=this.outputShape.length,s=this.op===ZG.Prod?"1.0":"0.0",i=n?s:`getX(${YG(a,"coords",this.op)})`,o=this.outputShape[this.outputShape.length-1];let l="",u="";n?(l=r?"end != "+(o-1):"end != 0",u=r?"end + 1":"end - 1"):(l=r?`end + pow2 < ${o}`:"end >= pow2",u=r?"end + pow2":"end - pow2"),this.userCode=`\n      void main() {\n        ${OL(a)} coords = getOutputCoords();\n        int end = ${eV(a,"coords",this.op)};\n        float val = ${i};\n        int pow2 = int(pow(2.0, index));\n        if (${l}) {\n          int idx = ${u};\n          ${eV(a,"coords",this.op)} = idx;\n          val ${this.op}= getX(${YG(a,"coords",this.op)});\n        }\n        setOutput(val);\n      }\n    `}}function YG(e,t,n){if(1===e)return`${t}`;if(2===e)return`${t}.x, ${t}.y`;if(3===e)return`${t}.x, ${t}.y, ${t}.z`;if(4===e)return`${t}.x, ${t}.y, ${t}.z, ${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}function eV(e,t,n){if(1===e)return`${t}`;if(2===e)return`${t}.y`;if(3===e)return`${t}.z`;if(4===e)return`${t}.w`;throw new Error(`Cumulative ${n} for rank ${e} is not yet supported`)}
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function tV(e,t,n,r,a,s){const i=t.shape.length,o=Zm([r],i);let l=t;null!=o&&(l=nz({inputs:{x:t},backend:n,attrs:{perm:o}}));const u=Jm(1,i)[0];if(u!==i-1)throw new Error(`WebGL cumprod shader expects an inner-most axis=${t.shape.length-1} but got axis=${r}`);const c=l.shape[u];let d=CP({inputs:{x:l},backend:n});for(let h=0;h<=Math.ceil(Math.log2(c))-1;h++){const t=new JG(e,l.shape,!1,s),r=[[h]],a=d;d=n.runWebGLProgram(t,[d],d.dtype,r),n.disposeIntermediateTensorInfo(a)}if(a){const t=new JG(e,l.shape,a,s),r=d;d=n.runWebGLProgram(t,[d],d.dtype),n.disposeIntermediateTensorInfo(r)}if(null!=o){const e=nz({inputs:{x:d},backend:n,attrs:{perm:Km(o)}});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(l),e}return d}
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const nV={kernelName:Cl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;return tV(ZG.Prod,a,n,s,i,o)}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const rV={kernelName:Il,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;return tV(ZG.Sum,a,n,s,i,o)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const aV={kernelName:_l,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:i,binaryOutput:o}=r;if(1===a.shape.length){const e=n.readSync(a.dataId),t=n.readSync(s.dataId),r=oB(e,t,s.dtype,s.shape,i);return n.makeTensorInfo([i],s.dtype,r)}if(2===a.shape.length){const e=n.bufferSync(a),t=n.bufferSync(s),r=lB(e,t,i,o);return n.makeTensorInfo(r.shape,s.dtype,r.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${a.shape.length}.`)}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class sV{constructor(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=n,this.userCode=`\n    void main() {\n      ivec4 coords = getOutputCoords();\n      int b = coords[0];\n      int h = ${this.getHeightCoordString()};\n      int w = ${this.getWidthCoordString()};\n      int d = ${this.getDepthCoordString()};\n\n      int in_h = h / ${t};\n      int offset_h = imod(h, ${t});\n      int in_w = w / ${t};\n      int offset_w = imod(w, ${t});\n      int offset_d = (offset_h * ${t} + offset_w) *\n        ${this.getOutputDepthSize()};\n      int in_d = d + offset_d;\n\n      float result = ${this.getInputSamplingString()};\n      setOutput(result);\n    }\n  `}getHeightCoordString(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"}getWidthCoordString(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"}getDepthCoordString(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"}getOutputDepthSize(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]}getInputSamplingString(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const iV={kernelName:Tl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockSize:s,dataFormat:i}=r,o=a.shape[0],l=("NHWC"===i?a.shape[1]:a.shape[2])*s,u=("NHWC"===i?a.shape[2]:a.shape[3])*s,c=("NHWC"===i?a.shape[3]:a.shape[1])/(s*s),d=new sV("NHWC"===i?[o,l,u,c]:[o,c,l,u],s,i);return n.runWebGLProgram(d,[a],a.dtype)}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class oV{constructor(e,t=!1,n=null,r=!1,a=!1){this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=zL(this.outputShape.length);const s=e.filterHeight,i=e.filterWidth,o=e.outChannels/e.inChannels;let l="",u="";n&&(l=r?`float activation(float a) {\n          float b = getPreluActivationWeightsAtOutCoords();\n          ${n}\n        }`:a?`float activation(float a) {\n          float b = getLeakyreluAlphaAtOutCoords();\n          ${n}\n        }`:`\n          float activation(float x) {\n            ${n}\n          }\n        `,u="result = activation(result);");const c=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n      ${l}\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords.x;\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int d2 = coords.w;\n        int d1 = d2 / ${o};\n        int q = d2 - d1 * ${o};\n\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n        for (int wR = 0; wR < ${s}; wR++) {\n          int xR = xRCorner + wR * dilations[0];\n\n          if (xR < 0 || xR >= inDims[0]) {\n            continue;\n          }\n\n          for (int wC = 0; wC < ${i}; wC++) {\n            int xC = xCCorner + wC * dilations[1];\n\n            if (xC < 0 || xC >= inDims[1]) {\n              continue;\n            }\n\n            float xVal = getX(batch, xR, xC, d1);\n            float wVal = getW(wR, wC, d1, q);\n            dotProd += xVal * wVal;\n          }\n        }\n\n        float result = dotProd;\n        ${c}\n        ${u}\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class lV{constructor(e,t=!1,n=null,r=!1,a=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=zL(this.outputShape.length);const s=e.outChannels/e.inChannels,i=e.padInfo.left,o=e.strideWidth,l=e.dilationWidth,u=e.filterHeight,c=e.filterWidth,d=c;let h="\n      int xR; int xC; int xCOffset;\n      vec4 wTexel; vec4 previous; vec4 final;";for(let g=0;g<c;g++)h+=`\n          vec4 xTexelC${2*g};\n          int xTexelC${2*g}Ready;\n          vec4 xTexelC${2*g+1};\n          int xTexelC${2*g+1}Ready;\n          vec4 xC${g};`;h+=`\n    for (int r = 0; r < ${u}; r++) {\n      `;for(let g=0;g<c;g++)h+=`\n          xTexelC${2*g} = vec4(0.0);\n          xTexelC${2*g}Ready = 0;\n          xTexelC${2*g+1} = vec4(0.0);\n          xTexelC${2*g+1}Ready = 0;\n          xC${g} = vec4(0.0);`;h+="\n        xR = xRCorner + r * dilations[0];\n        if (xR >=0 && xR < inDims[0]) {\n      ";for(let g=0;g<(d+1)/2;g++){const e=2*g;if(h+=`\n          xC = xCCorner + ${e*l};\n          `,1===o){if(e<c&&(i%2==1?(h+=`\n                xCOffset = xC + 1;\n                if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${e}Ready == 0) {\n                  xTexelC${e} = getX(batch, xR, xCOffset, d1);\n\n                  // Need to manually clear unused channels in case\n                  // we're reading from recycled texture.\n                  if (xCOffset + 1 >= inDims[1]) {\n                    xTexelC${e}.zw = vec2(0.0);\n                  }\n                  xTexelC${e}Ready = 1;\n                }\n              `,h+=1===l&&e>0?`\n                xC${e} = vec4(xTexelC${e-2}.zw, xTexelC${e}.xy);\n                `:`\n                  xCOffset = xC + 1 - 2;\n\n                  if (xCOffset >= 0 && xCOffset < inDims[1]) {\n                    previous = getX(batch, xR, xCOffset, d1);\n\n                    // Need to manually clear unused channels in case\n                    // we're reading from recycled texture.\n                    if (xCOffset + 1 >= inDims[1]) {\n                      previous.zw = vec2(0.0);\n                    }\n\n                    xC${e} = vec4(previous.zw, xTexelC${e}.xy);\n                  } else {\n                    xC${e} = vec4(0.0, 0.0, xTexelC${e}.xy);\n                  }\n                  `):h+=`\n                if (xC >= 0 && xC < inDims[1] && xTexelC${e}Ready == 0) {\n                  xTexelC${e} = getX(batch, xR, xC, d1);\n                  if (xC + 1 >= inDims[1]) {\n                    xTexelC${e}.zw = vec2(0.0);\n                  }\n                  xTexelC${e}Ready = 1;\n                }\n\n                xC${e} = xTexelC${e};\n                `,e+1<c)){const t=i%2==0?ji(l):l;l%2==0&&i%2==1||l%2!=0&&i%2!=1?(h+=`\n                  xCOffset = xC + imod(pads[1], 2) + ${t};\n\n                  if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${e+1}Ready == 0) {\n                    xTexelC${e+1} = getX(batch, xR, xCOffset, d1);\n\n                    // Need to manually clear unused channels in case\n                    // we're reading from recycled texture.\n                    if (xCOffset + 1 >= inDims[1]) {\n                      xTexelC${e+1}.zw = vec2(0.0);\n                    }\n                    xTexelC${e+1}Ready = 1;\n                  }\n                  `,h+=l>1?`\n                    xCOffset -= 2;\n                    if (xCOffset >= 0 && xCOffset < inDims[1]) {\n                     previous = getX(batch, xR, xCOffset, d1);\n                     xC${e+1} = vec4(previous.zw, xTexelC${e+1}.xy);\n                    } else {\n                     xC${e+1} = vec4(0.0, 0.0, xTexelC${e+1}.xy);\n                    }\n                    `:`\n                    xC${e+1} = vec4(xTexelC${e}.zw, xTexelC${e+1}.xy);\n                    `):h+=1===t?`\n                    xC${e+1} = xTexelC${e};\n                    `:`\n                    xCOffset = xC + ${t};\n\n                    if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${e+1}Ready == 0) {\n                      xTexelC${e+1} = getX(batch, xR, xCOffset, d1);\n                      if (xCOffset + 1 >= inDims[1]) {\n                        xTexelC${e+1}.zw = vec2(0.0);\n                      }\n                      xTexelC${e+1}Ready = 1;\n                    }\n\n                    xC${e+1} = xTexelC${e+1};\n                    `}}else e<c&&(i%2==1?(h+=`\n                xCOffset = xC + 1 - strides[1];\n                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${e}Ready == 0) {\n                  xTexelC${e} = getX(batch, xR, xCOffset, d1);\n                  // Need to manually clear unused channels in case\n                  // we're reading from recycled texture.\n                  if (xCOffset + 1 >= inDims[1]) {\n                    xTexelC${e}.zw = vec2(0.0);\n                  }\n                  xTexelC${e}Ready = 1;\n                }\n\n                if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC${e+1}Ready == 0) {\n                  xTexelC${e+1} = getX(batch, xR, xC + 1, d1);\n                  // Need to manually clear unused channels in case\n                  // we're reading from recycled texture.\n                  if (xC + 2 >= inDims[1]) {\n                    xTexelC${e+1}.zw = vec2(0.0);\n                  }\n                  xTexelC${e+1}Ready = 1;\n                }\n\n                xC${e} = vec4(xTexelC${e}.zw, xTexelC${e+1}.zw);\n              `,e+1<c&&(h+=`\n                  final = vec4(0.0);\n                  xCOffset = xC + 1 + strides[1];\n                  if(xCOffset >= 0 && xCOffset < inDims[1]) {\n                    final = getX(batch, xR, xCOffset, d1);\n                  }\n                  xC${e+1} = vec4(xTexelC${e+1}.xy, final.xy);\n                `)):(h+=`\n                if(xC >= 0 && xC < inDims[1] && xTexelC${e}Ready == 0) {\n                  xTexelC${e} = getX(batch, xR, xC, d1);\n                  if (xC + 1 >= inDims[1]) {\n                    xTexelC${e}.zw = vec2(0.0);\n                  }\n                  xTexelC${e}Ready = 1;\n                }\n\n                xCOffset = xC + strides[1];\n                if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC${e+1}Ready == 0) {\n                  xTexelC${e+1} = getX(batch, xR, xCOffset, d1);\n                  if (xCOffset + 1 >= inDims[1]) {\n                    xTexelC${e+1}.zw = vec2(0.);\n                  }\n                  xTexelC${e+1}Ready = 1;\n                }\n\n                xC${e} = vec4(\n                  xTexelC${e}.xy, xTexelC${e+1}.xy);\n              `,e+1<c&&(h+=`\n                  xC${e+1} = vec4(xTexelC${e}.zw, xTexelC${e+1}.zw);\n                `)));e<c&&(h+=`\n            wTexel = getW(r, ${e}, d1, q);\n            dotProd += xC${e} * vec4(wTexel.xz, wTexel.xz);\n          `,e+1<c&&(h+=`\n              wTexel = getW(r, ${e+1}, d1, q);\n              dotProd += xC${e+1} * vec4(wTexel.xz, wTexel.xz);\n            `))}h+="\n    }\n  ",h+="\n      }\n    ";let p="",f="";n&&(p=r?`vec4 activation(vec4 a) {\n          vec4 b = getPreluActivationWeightsAtOutCoords();\n          ${n}\n        }`:a?`vec4 activation(vec4 a) {\n          vec4 b = getLeakyreluAlphaAtOutCoords();\n          ${n}\n        }`:`vec4 activation(vec4 x) {\n          ${n}\n        }`,f="result = activation(result);");const m=t?"result += getBiasAtOutCoords();":"";t&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),a&&this.variableNames.push("leakyreluAlpha"),this.userCode=`\n      ${p}\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords.x;\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int d2 = coords.w;\n        int d1 = d2 / ${s};\n        int q = d2 - d1 * ${s};\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n        vec4 dotProd = vec4(0.000000000000001);\n\n        ${h}\n\n        vec4 result = dotProd - vec4(0.000000000000001);\n        ${m}\n        ${f}\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uV={kernelName:Nl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:u}=r;let c=l;null==c&&(c=[1,1]),Xi(zf(i,c),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`));const d=$f(a.shape,s.shape,i,c,o,u,!0);let h;h=Do().getBool("WEBGL_PACK_DEPTHWISECONV")&&d.strideWidth<=2&&d.outChannels/d.inChannels==1?new lV(d):new oV(d);const p=[[d.padInfo.top,d.padInfo.left],[d.strideHeight,d.strideWidth],[d.dilationHeight,d.dilationWidth],[d.inHeight,d.inWidth]];return n.runWebGLProgram(h,[a,s],"float32",p)}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class cV{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,a=e.padInfo.left,s=e.outChannels/e.inChannels;this.userCode=`\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int wR = coords.x;\n        int wC = coords.y;\n        int d1 = coords.z;\n        int dm = coords.w;\n        int d2 = d1 * ${s} + dm;\n\n        float dotProd = 0.0;\n\n        // TO DO: Vec4 over the batch size\n        for (int b = 0; b < ${e.batchSize}; b++) {\n          for (int yR = 0; yR < ${e.outHeight}; yR++) {\n            int xR = wR + yR * ${t} - ${r};\n\n            if (xR < 0 || xR >= ${e.inHeight}) {\n              continue;\n            }\n\n            for (int yC = 0; yC < ${e.outWidth}; yC++) {\n              int xC = wC + yC * ${n} - ${a};\n\n              if (xC < 0 || xC >= ${e.inWidth}) {\n                continue;\n              }\n\n              float dyValue = getDy(b, yR, yC, d2);\n              float xValue = getX(b, xR, xC, d1);\n              dotProd += (xValue * dyValue);\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}class dV{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,a=e.strideWidth,s=t-1-e.padInfo.top,i=n-1-e.padInfo.left,o=e.outChannels/e.inChannels;this.userCode=`\n      const ivec2 pads = ivec2(${s}, ${i});\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d1 = coords[3];\n        ivec2 dyCorner = coords.yz - pads;\n        int dyRCorner = dyCorner.x;\n        int dyCCorner = dyCorner.y;\n\n        float dotProd = 0.0;\n\n        for (int wR = 0; wR < ${t}; wR++) {\n          float dyR = float(dyRCorner + wR) / ${r}.0;\n\n          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = ${t} - 1 - wR;\n\n          for (int wC = 0; wC < ${n}; wC++) {\n            float dyC = float(dyCCorner + wC) / ${a}.0;\n\n            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            int wCPerm = ${n} - 1 - wC;\n\n            // TO DO: Vec4 over the channelMul\n            for (int dm = 0; dm < ${o}; dm++) {\n              int d2 = d1 * ${o} + dm;\n              float xValue = getDy(batch, idyR, idyC, d2);\n              float wValue = getW(wRPerm, wCPerm, d1, dm);\n              dotProd += xValue * wValue;\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const hV={kernelName:El,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,dy:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:u,filterShape:c}=r,d=$f(a.shape,c,i,o,l,u,!0),h=new cV(d);return n.runWebGLProgram(h,[a,s],"float32")}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const pV={kernelName:Rl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,filter:s}=t,{strides:i,dilations:o,pad:l,dimRoundingMode:u,inputShape:c}=r,d=$f(c,s.shape,i,o,l,u,!0),h=new dV(d);return n.runWebGLProgram(h,[a,s],"float32")}};
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class fV{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode="\n      void main() {\n          ivec2 coords = getOutputCoords();\n          float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n          setOutput(val);\n      }\n    "}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const mV={kernelName:$l,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=[...r.shape,...r.shape],s=Ji(r.shape),i=jP({inputs:{x:r},backend:n,attrs:{shape:[s]}}),o=new fV(s),l=n.runWebGLProgram(o,[i],i.dtype),u=jP({inputs:{x:l},backend:n,attrs:{shape:a}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(l),u}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class gV{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const{inHeight:t,inWidth:n,padInfo:r,strideHeight:a,strideWidth:s,filterHeight:i,filterWidth:o,dilationHeight:l,dilationWidth:u}=e,{top:c,left:d}=r;this.userCode=`\n      const ivec2 strides = ivec2(${a}, ${s});\n      const ivec2 pads = ivec2(${c}, ${d});\n      const float neg_infinity = -3.4e38;\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords.x;\n        int d1 = coords.w;\n        ivec2 outTopLeftCorner =\n            coords.yz * strides - pads;\n        int hBeg = outTopLeftCorner.x;\n        int wBeg = outTopLeftCorner.y;\n\n        float curVal = neg_infinity;\n        for (int h = 0; h < ${i}; h++) {\n          int hIn = hBeg + h * ${l};\n\n          if (hIn >= 0 && hIn < ${t}) {\n            for (int w = 0; w < ${o}; w++) {\n              int wIn = wBeg + w * ${u};\n\n              if (wIn >= 0 && wIn < ${n}) {\n                float xVal = getX(batch, hIn, wIn, d1);\n                float wVal = getW(h, w, d1);\n\n                float val = xVal + wVal;\n                if (val > curVal) {\n                  curVal = val;\n                }\n              }\n            }\n          }\n        }\n\n        float result = curVal;\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yV={kernelName:Ol,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l}=r,u=Nf(a.shape,s.shape,i,o,"NHWC",l);let c;const d=new gV(u);c=n.runWebGLProgram(d,[a,s],"float32");const h=jP({inputs:{x:c},backend:n,attrs:{shape:u.outShape}});return n.disposeIntermediateTensorInfo(c),h}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bV={kernelName:Bl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{equation:a}=r,s=t,{allDims:i,summedDims:o,idDims:l}=ik(a,s.length);lk(i.length,l,s);const{path:u,steps:c}=uk(o,l),d=c.length;let h=null,p=i.length;const f=[];for(let m=0;m<d;++m){for(const e of c[m]){const{permutationIndices:t,expandDims:r}=ok(p,l[e]);let a;ck(t)?a=s[e]:(a=nz({inputs:{x:s[e]},backend:n,attrs:{perm:t}}),f.push(a));const i=a.shape.slice();for(let e=0;e<r.length;++e)i.splice(r[e],0,1);eo(a.shape,i)||(a=jP({inputs:{x:a},backend:n,attrs:{shape:i}}),f.push(a)),null===h?h=a:(h=UP({inputs:{a:a,b:h},backend:n}),f.push(h))}m<d-1&&(u[m]>=0&&(h=ez({inputs:{x:h},backend:n,attrs:{axis:u[m]-(i.length-p),keepDims:!1}}),f.push(h)),p--)}for(const m of f)m!==h&&n.disposeIntermediateTensorInfo(m);return h}},vV=DP({opSnippet:"return (x >= 0.0) ? x : (exp(x) - 1.0);",packedOpSnippet:"\n  vec4 result;\n\n  result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n  result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n  result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n  result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n  return result;\n"}),AV={kernelName:Pl,backendName:"webgl",kernelFunc:vV},xV={kernelName:zl,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n}=e,{dy:r,y:a}=t,s=Do().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new SP("\n  vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n  return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",r.shape,a.shape):new kP("return (b >= 0.0) ? a : a * (b + 1.0);",r.shape,a.shape);return n.runWebGLProgram(s,[r,a],r.dtype)}},kV=MP({opSnippet:"return float(a == b);",packedOpSnippet:"\n  return vec4(equal(a, b));\n",dtype:"bool",cpuKernelImpl:pB}),wV={kernelName:Vl,backendName:"webgl",kernelFunc:kV},SV=DP({opSnippet:`\n  // Error function is calculated approximately with elementary function.\n  // See "Handbook of Mathematical Functions with Formulas,\n  // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n  float p = ${Ux};\n  float a1 = ${Hx};\n  float a2 = ${jx};\n  float a3 = ${qx};\n  float a4 = ${Qx};\n  float a5 = ${Xx};\n\n  float sign = sign(x);\n  x = abs(x);\n  float t = 1.0 / (1.0 + p * x);\n  return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n`}),CV={kernelName:Gl,backendName:"webgl",kernelFunc:SV},IV=DP({opSnippet:FP+"\n  return exp(x);\n",packedOpSnippet:"\n  vec4 result = exp(x);\n  bvec4 isNaN = isnan(x);\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n",cpuKernelImpl:fB,dtype:"float32"}),WV={kernelName:Ul,backendName:"webgl",kernelFunc:IV};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function _V(e){const{inputs:t,attrs:n,backend:r}=e,{dim:a}=n,{input:s}=t,i=s.shape.length,o=s.shape.slice();let l=a;return a<0&&(Xi(-(i+1)<=a,(()=>`Axis must be in the interval [${-(i+1)}, ${i}]`)),l=i+a+1),o.splice(l,0,1),jP({inputs:{x:s},backend:r,attrs:{shape:o}})}const TV={kernelName:Hl,backendName:"webgl",kernelFunc:_V},NV="return exp(x) - 1.0;",EV=DP({opSnippet:NV,packedOpSnippet:NV,cpuKernelImpl:mB}),RV={kernelName:jl,backendName:"webgl",kernelFunc:EV};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class $V{constructor(e,t,n){this.variableNames=["real","imag"];const r=t[1];this.outputShape=t;const a=n?`2.0 * ${Math.PI}`:`-2.0 * ${Math.PI}`,s=n?`${r}.0`:"1.0";let i;if("real"===e)i="return real * expR - imag * expI;";else{if("imag"!==e)throw new Error(`FFT component must be either "real" or "imag", got ${e}.`);i="return real * expI + imag * expR;"}this.userCode=`\n      const float exponentMultiplier = ${a};\n\n      float unaryOpComplex(float real, float expR, float imag, float expI) {\n        ${i}\n      }\n\n      float mulMatDFT(int batch, int index) {\n        float indexRatio = float(index) / float(${r});\n        float exponentMultiplierTimesIndexRatio =\n            exponentMultiplier * indexRatio;\n\n        float result = 0.0;\n\n        for (int i = 0; i < ${r}; i++) {\n          // x = (-2|2 * PI / N) * index * i;\n          float x = exponentMultiplierTimesIndexRatio * float(i);\n          float expR = cos(x);\n          float expI = sin(x);\n          float real = getReal(batch, i);\n          float imag = getImag(batch, i);\n\n          result +=\n              unaryOpComplex(real, expR, imag, expI) / ${s};\n        }\n\n        return result;\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        setOutput(mulMatDFT(coords[0], coords[1]));\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function OV(e,t,n){const r=n.texData.get(e.dataId),a=Ji(e.shape),s=e.shape[e.shape.length-1],i=jP({inputs:{x:e},backend:n,attrs:{shape:[a/s,s]}}),o=i.shape,l=new $V("real",o,t),u=new $V("imag",o,t),c=[{dataId:r.complexTensorInfos.real.dataId,dtype:r.complexTensorInfos.real.dtype,shape:o},{dataId:r.complexTensorInfos.imag.dataId,dtype:r.complexTensorInfos.imag.dtype,shape:o}],d=n.runWebGLProgram(l,c,"float32"),h=n.runWebGLProgram(u,c,"float32"),p=WP({inputs:{real:d,imag:h},backend:n});n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h);const f=jP({inputs:{x:p},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(p),f}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const FV={kernelName:ql,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t;return OV(r,!1,n)}};
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class DV{constructor(e,t){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode="\n      void main() {\n        // Input can be obtained from uniform value.\n        setOutput(value);\n      }\n    "}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function MV(e){const{backend:t,attrs:n}=e,{shape:r,value:a}=n;let{dtype:s}=n;if(s=s||vo(a),"string"===s){const e=uo(s,Ji(r));return e.fill(a),t.makeTensorInfo(r,s,e)}{const e=new DV(r,a),n=[[a]];return t.runWebGLProgram(e,[],s,n)}}const LV={kernelName:Ql,backendName:"webgl",kernelFunc:MV};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class BV{constructor(e){this.variableNames=["Image"],this.outputShape=[];const t=e[2];this.outputShape=e,this.userCode=`\n        void main() {\n          ivec4 coords = getOutputCoords();\n          int x = coords[2];\n\n          int coordX = ${t} - x - 1;\n          float outputValue;\n          if(coordX >= 0 && coordX < ${t}) {\n            outputValue = getImage(coords[0], coords[1], coordX, coords[3]);\n          } else {\n            outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);\n          }\n          setOutput(outputValue);\n        }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const PV={kernelName:Xl,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{const{image:n}=e,r=t,a=new BV(n.shape);return r.runWebGLProgram(a,[n],n.dtype)}},zV="return floor(x);",GV=DP({opSnippet:zV,packedOpSnippet:zV,cpuKernelImpl:gB}),VV={kernelName:Zl,backendName:"webgl",kernelFunc:GV},UV=MP({opSnippet:"\n  float s = sign(a) * sign(b);\n  int ia = round(a);\n  int ib = round(b);\n  if (ib != 0) {\n    // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n    return float(idiv(ia, ib, s));\n  } else {\n    return NAN;\n  }\n",packedOpSnippet:"\n  ivec4 ia = round(a);\n  ivec4 ib = round(b);\n  bvec4 cond = notEqual(ib, ivec4(0));\n  ivec4 result = ivec4(0);\n  vec4 s = sign(a) * sign(b);\n\n  // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n  if (cond[0]) {\n    result[0] = idiv(ia[0], ib[0], s[0]);\n  }\n  if (cond[1]) {\n    result[1] = idiv(ia[1], ib[1], s[1]);\n  }\n  if (cond[2]) {\n    result[2] = idiv(ia[2], ib[2], s[2]);\n  }\n  if (cond[3]) {\n    result[3] = idiv(ia[3], ib[3], s[3]);\n  }\n  return vec4(result);\n",dtype:"int32"}),HV={kernelName:Kl,backendName:"webgl",kernelFunc:UV};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class jV{constructor(e){this.variableNames=["A"];const t=yL(),[n,r]=e;this.outputShape=e,this.userCode=`\n      void main() {\n        ivec3 coords = getOutputCoords();\n        int texR = coords[0];\n        int texC = coords[1];\n        int depth = coords[2];\n        vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${r}.0, ${n}.0);\n\n        vec4 values = ${t.texture2D}(A, uv);\n        float value;\n        if (depth == 0) {\n          value = values.r;\n        } else if (depth == 1) {\n          value = values.g;\n        } else if (depth == 2) {\n          value = values.b;\n        } else if (depth == 3) {\n          value = values.a;\n        }\n\n        setOutput(floor(value * 255.0 + 0.5));\n      }\n    `}}
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class qV{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const t=yL(),[n,r]=e;this.outputShape=e,this.userCode=`\n      void main() {\n        ivec3 coords = getOutputCoords();\n        int texR = coords[0];\n        int texC = coords[1];\n        int depth = coords[2];\n\n        vec4 result = vec4(0.);\n\n        for(int row=0; row<=1; row++) {\n          for(int col=0; col<=1; col++) {\n            texC = coords[1] + row;\n            depth = coords[2] + col;\n\n            vec2 uv = (vec2(texC, texR) + halfCR) /\n                       vec2(${r}.0, ${n}.0);\n            vec4 values = ${t.texture2D}(A, uv);\n            float value;\n            if (depth == 0) {\n              value = values.r;\n            } else if (depth == 1) {\n              value = values.g;\n            } else if (depth == 2) {\n              value = values.b;\n            } else if (depth == 3) {\n              value = values.a;\n            }\n\n            result[row * 2 + col] = floor(value * 255.0 + 0.5);\n          }\n        }\n\n        ${t.output} = result;\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const QV={kernelName:Xc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e;let{pixels:a}=t;const{numChannels:s}=r,i="undefined"!=typeof HTMLVideoElement&&a instanceof HTMLVideoElement,o="undefined"!=typeof HTMLImageElement&&a instanceof HTMLImageElement,[l,u]=i?[a.videoWidth,a.videoHeight]:[a.width,a.height],c=[u,l],d=[u,l,s];if(o||i){const e=Do().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");null!=XV&&e===ZV||(ZV=e,XV=document.createElement("canvas").getContext("2d",{willReadFrequently:ZV})),XV.canvas.width=l,XV.canvas.height=u,XV.drawImage(a,0,0,l,u),a=XV.canvas}const h=n.makeTensorInfo(c,"int32");n.texData.get(h.dataId).usage=LM.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(h.dataId),a);const p=Do().getBool("WEBGL_PACK")?new qV(d):new jV(d),f=n.runWebGLProgram(p,[h],"int32");return n.disposeData(h.dataId),f}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */};let XV,ZV=Do().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");const KV={kernelName:Jc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h,activation:p,leakyreluAlpha:f}=r,m=Vf(c),g=$f(a.shape,s.shape,l,d,u,h,!1,m);let y;const b=[],v=null!=i,A=null!=o,x="leakyrelu"===p,k=()=>{const e=[a,s],t=(e,t)=>{if("NCHW"===t&&1===e.shape.length&&1!==e.shape[0]){const t=jP({inputs:{x:e},backend:n,attrs:{shape:[e.shape[0],1,1]}});return b.push(t),t}return e};if(v&&e.push(t(i,c)),A&&e.push(t(o,c)),x){const t=n.makeTensorInfo([],"float32",Xd(f,"float32"));e.push(t),b.push(t)}return e};if(1!==g.filterHeight||1!==g.filterWidth||1!==g.dilationHeight||1!==g.dilationWidth||1!==g.strideHeight||1!==g.strideWidth||"SAME"!==g.padInfo.type&&"VALID"!==g.padInfo.type)if(g.strideWidth<=2&&"channelsLast"===m&&Do().getBool("WEBGL_EXP_CONV")){const e=p?LP(p,!0):null,t=new _G(g,v,e,A,x),r=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],a=k();y=n.runWebGLProgram(t,a,"float32",r)}else if(Do().getBool("WEBGL_CONV_IM2COL"))y=RG({x:a,filter:s,convInfo:g,backend:n,bias:i,activation:p,preluActivationWeights:o,leakyreluAlpha:f});else{const e=p?LP(p,!1):null,t=new IG(g,v,e,A,x),r=k();y=n.runWebGLProgram(t,r,"float32")}else y=EG({x:a,filter:s,convInfo:g,backend:n,bias:i,activation:p,preluActivationWeights:o,leakyreluAlpha:f});const w=jP({inputs:{x:y},backend:n,attrs:{shape:g.outShape}});return b.push(y),b.forEach((e=>n.disposeIntermediateTensorInfo(e))),w}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const JV={kernelName:Yc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s,bias:i,preluActivationWeights:o}=t,{strides:l,pad:u,dilations:c,dimRoundingMode:d,activation:h,leakyreluAlpha:p}=r,f=[];let m=c;null==m&&(m=[1,1]),Xi(zf(l,m),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${m}'`));const g=$f(a.shape,s.shape,l,m,u,d,!0),y=Do().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels==1,b=h?LP(h,y):null,v=[a,s],A=null!=i,x=null!=o,k="leakyrelu"===h;if(A&&v.push(i),x&&v.push(o),k){const e=n.makeTensorInfo([],"float32",Xd(p,"float32"));v.push(e),f.push(e)}let w;w=y?new lV(g,A,b,x,k):new oV(g,A,b,x,k);const S=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],C=n.runWebGLProgram(w,v,"float32",S);return f.forEach((e=>n.disposeIntermediateTensorInfo(e))),C}};class YV{constructor(e,t,n,r){this.sliceDim=e,this.strides=t,this.paramsShape=r,this.variableNames=["x","indices"],this.outputShape=n;const a=OL(n.length);let s="\n    int index;";for(let i=0;i<this.sliceDim;i++)s+=`\n          index = round(getIndices(coords[0], ${i}));\n          out_of_bounds = out_of_bounds || index < 0;\n          out_of_bounds = out_of_bounds || index >= ${this.paramsShape[i]};\n          flattenIndex += index * ${this.strides[i]};`;this.userCode=`\n         void main() {\n          ${a} coords = getOutputCoords();\n          int flattenIndex = 0;\n          bool out_of_bounds = false;\n\n          ${s}\n\n          setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));\n        }\n      `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const eU={kernelName:eu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{params:r,indices:a}=t,s=a.shape,i=s[s.length-1],o=Ji(r.shape),[l,u,c,d]=sx(r,a),h=jP({inputs:{x:a},backend:n,attrs:{shape:[u,i]}}),p=jP({inputs:{x:r},backend:n,attrs:{shape:[Ji(r.shape)/c,c]}});if(n.shouldExecuteOnCPU([r,a])||"string"===r.dtype){const e=n.readSync(a.dataId),t=n.bufferSync(r),s=yB(e,t,r.dtype,u,i,c,d,r.shape,o);return n.makeTensorInfo(l,r.dtype,s.values)}const f=new YV(i,d,[u,c],r.shape),m=n.runWebGLProgram(f,[p,h],p.dtype),g=jP({inputs:{x:m},backend:n,attrs:{shape:l}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(m),g}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class tU{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;const n=OL(this.rank),r=function(e){const t=["resRC.x","resRC.y","resRC.z","resRC.w"],n=[];for(let r=0;r<e.length;r++)2===r?n.push("index"):n.push(`${t[r]}`);return n.join()}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(e);this.userCode=`\n      void main() {\n        ${n} resRC = getOutputCoords();\n        int index = int(getIndices(resRC.x, resRC.z));\n        float inBounds = (index >= 0) && (index < ${e[2]}) ? 1.0 : 0.0;\n        setOutput(inBounds * getA(${r}));\n      }\n    `}}function nU(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,indices:s}=t,{axis:i,batchDims:o}=r,l=io(i,a.shape)[0];if(Do().get("DEBUG")){const e=n.readSync(s.dataId),t=a.shape[l];for(let n=0;n<e.length;++n){const r=e[n];Xi(r<=t-1&&r>=0,(()=>`GatherV2: the index value ${r} is not in [0, ${t-1}]`))}}const u=Wk(a,s,l,o),c=Ji(s.shape),d=[],h=jP({inputs:{x:a},backend:n,attrs:{shape:[u.batchSize,u.outerSize,u.dimSize,u.sliceSize]}}),p=jP({inputs:{x:s},backend:n,attrs:{shape:[u.batchSize,c/u.batchSize]}});d.push(h),d.push(p);const f=[u.batchSize,u.outerSize,c/u.batchSize,u.sliceSize];if(n.shouldExecuteOnCPU([a,s])||"string"===a.dtype){const e=n.bufferSync(p),t=n.bufferSync(h),r=bB(t,e,f);return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(u.outputShape,r.dtype,r.values)}const m=new tU(h.shape,f),g=n.runWebGLProgram(m,[h,p],h.dtype);d.push(g);const y=jP({inputs:{x:g},backend:n,attrs:{shape:u.outputShape}});return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),y}const rU={kernelName:Yl,backendName:"webgl",kernelFunc:nU},aU=MP({opSnippet:"return float(a > b);",packedOpSnippet:"\n  return vec4(greaterThan(a, b));\n",cpuKernelImpl:vB,dtype:"bool"}),sU={kernelName:tu,backendName:"webgl",kernelFunc:aU},iU=MP({opSnippet:"return float(a >= b);",packedOpSnippet:"\n  return vec4(greaterThanEqual(a, b));\n",dtype:"bool",cpuKernelImpl:AB}),oU={kernelName:nu,backendName:"webgl",kernelFunc:iU};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lU={kernelName:au,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n}=e,{input:r}=t;return OV(r,!0,n)}},uU=DP({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"}),cU={kernelName:iu,backendName:"webgl",kernelFunc:uU},dU=DP({opSnippet:"return float(isinf(x));",dtype:"bool"}),hU={kernelName:ou,backendName:"webgl",kernelFunc:dU},pU=DP({opSnippet:"return float(isnan(x));",dtype:"bool"}),fU={kernelName:lu,backendName:"webgl",kernelFunc:pU},mU=MP({opSnippet:"return float(a < b);",packedOpSnippet:"\n  return vec4(lessThan(a, b));\n",cpuKernelImpl:xB,dtype:"bool"}),gU={kernelName:cu,backendName:"webgl",kernelFunc:mU},yU=MP({opSnippet:"return float(a <= b);",packedOpSnippet:"\n  return vec4(lessThanEqual(a, b));\n",cpuKernelImpl:kB,dtype:"bool"}),bU={kernelName:du,backendName:"webgl",kernelFunc:yU};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vU={kernelName:hu,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{backend:t,attrs:n}=e,{start:r,stop:a,num:s}=n,i=wB(r,a,s);return t.makeTensorInfo([i.length],"float32",i)}},AU=DP({opSnippet:FP+"\n  return x < 0.0 ? 0./0. : log(x);\n",packedOpSnippet:"\n  vec4 result = log(x);\n  bvec4 isNaN = isnan(x);\n  result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);\n  result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);\n  result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);\n  result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);\n  return result;\n",cpuKernelImpl:SB}),xU={kernelName:pu,backendName:"webgl",kernelFunc:AU},kU=DP({opSnippet:FP+"\n  return log(1.0 + x);\n"}),wU={kernelName:fu,backendName:"webgl",kernelFunc:kU},SU=MP({opSnippet:"return float(a >= 1.0 && b >= 1.0);",packedOpSnippet:"\n  return vec4(\n    vec4(greaterThanEqual(a, vec4(1.0))) *\n    vec4(greaterThanEqual(b, vec4(1.0))));\n",dtype:"bool"}),CU={kernelName:mu,backendName:"webgl",kernelFunc:SU},IU=DP({opSnippet:"return float(!(x >= 1.0));"}),WU={kernelName:gu,backendName:"webgl",kernelFunc:IU},_U=MP({opSnippet:"return float(a >= 1.0 || b >= 1.0);",packedOpSnippet:"\n  return min(\n    vec4(greaterThanEqual(a, vec4(1.0))) +\n    vec4(greaterThanEqual(b, vec4(1.0))),\n    vec4(1.0));\n",dtype:"bool"}),TU={kernelName:yu,backendName:"webgl",kernelFunc:_U};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class NU{constructor(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[];const s=t,i=e[3]-1;let o;this.outputShape=e;const l=`float(${n}) + float(${r}) * sum`;o=.5===a?`inversesqrt(${l})`:1===a?`1.0/(${l})`:`exp(log(${l}) * float(-${a}));`,this.userCode=`\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int r = coords[1];\n        int c = coords[2];\n        int d = coords[3];\n        float x = getX(b, r, c, d);\n        float sum = 0.0;\n        for (int j = -${s}; j <= ${s}; j++) {\n          int idx = d + j;\n          if (idx >= 0 && idx <=  ${i}) {\n            float z = getX(b, r, c, idx);\n            sum += z * z;\n          }\n        }\n        float val = x * ${o};\n        setOutput(val);\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class EU{constructor(e,t,n,r,a){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;const s=t,i=e[3]-1;let o;this.outputShape=e;const l=`float(${n}) + float(${r}) * sum`;o=.5===a?`inversesqrt(${l})`:1===a?`1.0/(${l})`:`exp(log(${l}) * float(-${a}));`,this.userCode=`\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords.x;\n        int r = coords.y;\n        int c = coords.z;\n        int d = coords.w;\n\n        bool hasNextCol = d < ${this.outputShape[3]};\n        bool hasNextRow = c < ${this.outputShape[2]};\n\n        vec4 sum = vec4(0.);\n        vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n        vec4 xAtOutputCoords = vec4(\n          getChannel(xFragAtOutputCoords, vec2(c, d)),\n          hasNextCol ?\n            getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n          hasNextRow ?\n            getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n          (hasNextRow && hasNextCol) ?\n            getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n        );\n\n        int firstChannel = d - ${s};\n        vec2 cache = vec2(0.);\n        if(firstChannel >= 0){\n          vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n          cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n            if(hasNextRow){\n              cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n            }\n        }\n\n        ivec2 depth = ivec2(d, d + 1);\n        for (int j = - ${s}; j <= ${s}; j++) {\n          ivec2 idx = depth + j;\n          bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n          bvec2 belowUpperBound = lessThanEqual(idx, ivec2(${i}));\n\n          bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n          bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n          if(depthInRange || depthPlusOneInRange){\n            vec4 z = vec4(0.);\n            vec4 xFragAtCurrentDepth;\n            z.xz = cache.xy;\n            if(depthPlusOneInRange && hasNextCol){\n              xFragAtCurrentDepth = idx.y != d ?\n                getX(b, r, c, idx.y) : xFragAtOutputCoords;\n              z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n              if(hasNextRow){\n                z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n              }\n            }\n            cache.xy = z.yw;\n            sum += z * z;\n          }\n        }\n        vec4 result = xAtOutputCoords * ${o};\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const RU={kernelName:vu,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{depthRadius:s,bias:i,alpha:o,beta:l}=r,u=Do().getBool("WEBGL_PACK_NORMALIZATION")?new EU(a.shape,s,i,o,l):new NU(a.shape,s,i,o,l);return n.runWebGLProgram(u,[a],a.dtype)}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class $U{constructor(e,t,n,r,a){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=n,this.alpha=r,this.beta=a,this.userCode=`\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int r = coords[1];\n        int c = coords[2];\n\n        float result = 0.0;\n        for (int d = 0; d < ${this.depth}; ++d) {\n          int depthBegin = int(max(0.0, float(d - ${t})));\n          int depthEnd = int(min(float(${this.depth}),\n              float(d + ${t} + 1)));\n\n          const int MIN_DEPTH_BEGIN = 0;\n          const int MAX_DEPTH_END = ${this.depth};\n\n          float norm = 0.0;\n          for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n            if (k < depthBegin){\n              continue;\n            }\n            else if (k >= depthBegin && k < depthEnd) {\n              norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n            }\n            else {\n              break;\n            }\n          }\n\n          norm = float(${r}) * norm + float(${n});\n\n          for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n            if (k < depthBegin){\n              continue;\n            }\n            else if (k >= depthBegin && k < depthEnd){\n              float dyi = -2.0 * float(${r})\n                * float(${a})\n                * getInputImage(b, r, c, k) * getOutputImage(b, r, c, d)\n                / norm;\n              if (k == d) {\n                dyi += pow(norm, -1.0 * ${a});\n              }\n              if (k == coords[3]) {\n                dyi *= getDy(b, r, c, d);\n                result += dyi;\n              }\n            }\n            else {\n              break;\n            }\n          }\n      }\n      setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const OU={kernelName:Au,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a,y:s,dy:i}=t,{depthRadius:o,bias:l,alpha:u,beta:c}=r,d=new $U(a.shape,o,l,u,c);return n.runWebGLProgram(d,[a,s,i],a.dtype)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function FU(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reductionIndices:s,keepDims:i}=r,o=a.shape.length,l=io(s,a.shape);let u=l;const c=Zm(u,o),d=null!=c,h=n.shouldExecuteOnCPU([a]);let p=a;if(d){if(h){const e=n.texData.get(p.dataId).values,t=new Array(o);for(let n=0;n<t.length;n++)t[n]=a.shape[c[n]];const r=YB(e,a.shape,a.dtype,c,t);p=n.makeTensorInfo(t,a.dtype);n.texData.get(p.dataId).values=r}else p=YP(a,c,n);u=Jm(u.length,o)}Xm("max",u,o);const[f,m]=qm(p.shape,u);let g,y=f;if(i&&(y=Qm(f,l)),h){const e=n.texData.get(p.dataId).values,t=CB(e,Ji(m),y,a.dtype);g=n.makeTensorInfo(y,a.dtype);n.texData.get(g.dataId).values=t}else g=
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e,t,n,r){const a=Ji(t),s=jP({inputs:{x:e},attrs:{shape:[Ji(e.shape)/a,a]},backend:r}),i=ZP(s,e.dtype,"max",r),o=jP({inputs:{x:i},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(i),o}(p,m,y,n);return d&&n.disposeIntermediateTensorInfo(p),g}const DU={kernelName:xu,backendName:"webgl",kernelFunc:FU},MU=MP({opSnippet:xP+"\n  return max(a, b);\n",packedOpSnippet:"\n  vec4 result = vec4(max(a, b));\n  bvec4 isNaNA = isnan(a);\n  bvec4 isNaNB = isnan(b);\n  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n  "+wP+"\n  return result;\n",cpuKernelImpl:IB}),LU={kernelName:ku,backendName:"webgl",kernelFunc:MU};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const BU={kernelName:wu,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;mL(a,"maxPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Xi(zf(i,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Ef(a.shape,s,i,1,o,l);if(1===u.filterWidth&&1===u.filterHeight&&eo(u.inShape,u.outShape))return CP({inputs:{x:a},backend:n});const c=new Mz(u,"max",!1);return n.runWebGLProgram(c,[a],a.dtype)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const PU={kernelName:Cu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{filterSize:s,strides:i,pad:o,dataFormat:l,dimRoundingMode:u}=r,c=Rf(a.shape,s,i,[1,1,1],o,u,l),d=new Lz(c,"max",!1);return n.runWebGLProgram(d,[a],a.dtype)}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class zU{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideHeight,n=e.strideWidth,r=e.dilationHeight,a=e.effectiveFilterHeight,s=e.effectiveFilterWidth,i=a-1-e.padInfo.top,o=s-1-e.padInfo.left,l=a*s-1;this.userCode=`\n      const ivec2 pads = ivec2(${i}, ${o});\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n\n        ivec2 dyRCCorner = coords.yz - pads;\n        int dyRCorner = dyRCCorner.x;\n        int dyCCorner = dyRCCorner.y;\n\n        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < ${a};\n          wR += ${r}) {\n          float dyR = float(dyRCorner + wR) / ${t}.0;\n\n          if (dyR < 0.0 || dyR >= ${e.outHeight}.0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC < ${s}; wC++) {\n            float dyC = float(dyCCorner + wC) / ${n}.0;\n\n            if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            float dyValue = getDy(b, idyR, idyC, d);\n            int maxPosValue = ${l} - int(getMaxPos(b, idyR, idyC, d));\n\n            // Get the current value, check it against the value from the\n            // position matrix.\n            int curPosValue = wR * ${s} + wC;\n            float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n            dotProd += dyValue * mask;\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}class GU{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideDepth,n=e.strideHeight,r=e.strideWidth,a=e.dilationDepth,s=e.dilationHeight,i=e.dilationWidth,o=e.effectiveFilterDepth,l=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=o-1-e.padInfo.front,d=l-1-e.padInfo.top,h=u-1-e.padInfo.left,p=o*l*u-1;this.userCode=`\n      const ivec3 pads = ivec3(${c}, ${d}, ${h});\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int ch = coords.u;\n\n        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n        int dyDCorner = dyCorner.x;\n        int dyRCorner = dyCorner.y;\n        int dyCCorner = dyCorner.z;\n\n        // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n        // dx(xD, xR, xC, ch).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n\n        for (int wD = 0; wD < ${o};\n           wD += ${a}) {\n          float dyD = float(dyDCorner + wD) / ${t}.0;\n\n          if (dyD < 0.0 || dyD >= ${e.outDepth}.0 || fract(dyD) > 0.0) {\n            continue;\n          }\n          int idyD = int(dyD);\n\n          for (int wR = 0; wR < ${l};\n              wR += ${s}) {\n            float dyR = float(dyRCorner + wR) / ${n}.0;\n\n            if (dyR < 0.0 || dyR >= ${e.outHeight}.0 ||\n                fract(dyR) > 0.0) {\n              continue;\n            }\n            int idyR = int(dyR);\n\n            for (int wC = 0; wC < ${u};\n                wC += ${i}) {\n              float dyC = float(dyCCorner + wC) / ${r}.0;\n\n              if (dyC < 0.0 || dyC >= ${e.outWidth}.0 ||\n                  fract(dyC) > 0.0) {\n                continue;\n              }\n              int idyC = int(dyC);\n\n              float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n              int maxPosValue = ${p} -\n                  int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n              // Get the current value, check it against the value from the\n              // position matrix.\n              int curPosValue =\n                  wD * ${l} * ${u} +\n                  wR * ${u} + wC;\n              float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n              dotProd += dyValue * mask;\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const VU={kernelName:Iu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s,{filterSize:o,strides:l,pad:u,dimRoundingMode:c}=r,d=Rf(i.shape,o,l,[1,1,1],u,c),h=new Lz(d,"max",!0),p=n.runWebGLProgram(h,[i],i.dtype),f=new GU(d),m=n.runWebGLProgram(f,[a,p],i.dtype);return n.disposeIntermediateTensorInfo(p),m}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const UU={kernelName:Su,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s,output:i}=t,o=s;mL([s,i],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=r,h=Ef(o.shape,l,u,1,c,d),p=new Mz(h,"max",!0),f=n.runWebGLProgram(p,[o],o.dtype),m=new zU(h),g=n.runWebGLProgram(m,[a,f],o.dtype);return n.disposeIntermediateTensorInfo(f),g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const HU={kernelName:Wu,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:r}=e,{filterSize:a,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;Xi(4===r.shape.length,(()=>`Error in maxPool: input must be rank 4 but got rank ${r.shape.length}.`));const u=[1,1];Xi(zf(s,u),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${u}'`));const c=Ef(r.shape,a,s,u,i),[d,h]=function(e,t,n,r){let a=new Mz(n,"max",!1);const s=r.runWebGLProgram(a,[e],"float32");return a=new Mz(n,"max",!0,!0,t),[s,r.runWebGLProgram(a,[e],"float32")]}(r,o,c,l);return[d,h]}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
const jU={kernelName:_u,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:r}=e,{keepDims:a,axis:s}=t,i=n,o=r.shape.length,l=io(s,r.shape);let u=l;const c=Zm(u,o),d=null!=c,h=i.shouldExecuteOnCPU([r]),p=[];let f=r;if(d){if(h){const e=i.texData.get(f.dataId).values,t=new Array(o);for(let a=0;a<t.length;a++)t[a]=r.shape[c[a]];const n=YB(e,r.shape,r.dtype,c,t);f=i.makeTensorInfo(t,r.dtype);i.texData.get(f.dataId).values=n}else f=YP(r,c,i);p.push(f),u=Jm(u.length,o)}Xm("sum",u,o);const[m,g]=qm(f.shape,u);let y=m;a&&(y=Qm(m,l));const b=function(e,t,n,r){const a=Ji(t),s=jP({inputs:{x:e},attrs:{shape:[Ji(e.shape)/a,a]},backend:r}),i=ZP(s,"float32","mean",r),o=jP({inputs:{x:i},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(i),o}(f,g,y,i);for(const v of p)i.disposeIntermediateTensorInfo(v);return b}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const qU={kernelName:Tu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=io(s,a.shape);let u=l;const c=Zm(u,o);let d=a;null!=c&&(d=nz({inputs:{x:a},backend:n,attrs:{perm:c}}),u=Jm(u.length,a.shape.length)),Xm("min",u,o);const[h,p]=qm(d.shape,u),f=jP({inputs:{x:d},backend:n,attrs:{shape:[-1,Ji(p)]}}),m=ZP(f,f.dtype,"min",n);let g;if(i){g=jP({inputs:{x:m},backend:n,attrs:{shape:Qm(h,l)}})}else g=jP({inputs:{x:m},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),null!=c&&n.disposeIntermediateTensorInfo(d),g}},QU=MP({opSnippet:xP+"\n  return min(a, b);\n",packedOpSnippet:"\n  vec4 result = vec4(min(a, b));\n  bvec4 isNaNA = isnan(a);\n  bvec4 isNaNB = isnan(b);\n  bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n  "+wP+"\n  return result;\n",cpuKernelImpl:WB}),XU={kernelName:Nu,backendName:"webgl",kernelFunc:QU};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class ZU{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,a=OL(r),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r),l="reflect"===n?0:1;this.userCode=1!==r?`\n      ${a} start = ${a}(${s});\n      ${a} end = ${a}(${i});\n\n      void main() {\n        ${a} outC = getOutputCoords();\n        for (int i = 0; i < ${r}; i++) {\n          if (outC[i] < start[i]) {\n            outC[i] = start[i] * 2 - outC[i] - ${l};\n          } else if(outC[i] >= end[i]) {\n            outC[i] = (end[i] - 1) * 2 - outC[i] + ${l};\n          }\n        }\n        ${a} coords = outC - start;\n        setOutput(getX(${o}));\n      }\n    `:`\n        int start = ${s};\n        int end = ${i};\n\n        void main() {\n          int outC = getOutputCoords();\n          if (outC < start) {\n            outC = start * 2 - outC - ${l};\n          } else if(outC >= end) {\n            outC = (end - 1) * 2 - outC + ${l};\n          }\n          setOutput(getX(outC - start));\n        }\n      `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class KU{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,a=OL(r),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),o=nP("rc",r),l=nP("source",r),u=`${o[r-1]} < ${this.outputShape[r-1]}`,c=1===r?"source":`vec2(${l.slice(-2).join()})`,d="reflect"===n?0:1;let h="";if(1===r){const e=`\n        ${a} source = rc;\n        if (source < start) {\n          source = start * 2 - source - ${d};\n        } else if (source >= end) {\n          source = (end - 1) * 2 - source + ${d};\n        }\n        source -= start;\n      `;h=`\n        ${a} rc = outputLoc;\n        ${e}\n        result[0] = getChannel(getX(${l.join()}), ${c});\n        ${o[r-1]} += 1;\n        if(${u}) {\n          ${e}\n          result[1] = getChannel(getX(${l.join()}), ${c});\n        }\n      `}else{const e=`\n        ${a} source = rc;\n        ${a} lt = ${a}(lessThan(source, start));\n        ${a} gte = ${a}(greaterThanEqual(source, end));\n        ${a} orig = 1 - (lt + gte);\n        source = orig * source +\n                lt * (start * 2 - source - ${d}) +\n                gte * ((end - 1) * 2 - source + ${d});\n        source -= start;\n      `;h=`\n        ${a} rc = outputLoc;\n        ${e}\n        result[0] = getChannel(getX(${l.join()}), ${c});\n        ${o[r-1]} += 1;\n        if(${u}) {\n          ${e}\n          result[1] = getChannel(getX(${l.join()}), ${c});\n        }\n        rc = outputLoc;\n        ${o[r-2]} += 1;\n        if(${o[r-2]} < ${this.outputShape[r-2]}) {\n          ${e}\n          result[2] = getChannel(getX(${l.join()}), ${c});\n          ${o[r-1]} += 1;\n          if(${u}) {\n            ${e}\n            result[3] = getChannel(getX(${l.join()}), ${c});\n          }\n        }\n      `}this.userCode=`\n      const ${a} start = ${a}(${s});\n      const ${a} end = ${a}(${i});\n\n      void main() {\n        ${a} outputLoc = getOutputCoords();\n        vec4 result = vec4(0.);\n        ${h}\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const JU={kernelName:Eu,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r}=e,{paddings:a,mode:s}=n,i=Do().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new KU(r.shape,a,s):new ZU(r.shape,a,s);return t.runWebGLProgram(i,[r],r.dtype)}},YU=MP({opSnippet:"if (b == 0.0) return NAN;\n  return mod(a, b);",packedOpSnippet:"\n  vec4 result = mod(a, b);\n  bvec4 isNaN = equal(b, vec4(0.0));\n  "+wP+"\n  return result;\n"}),eH={kernelName:Ru,backendName:"webgl",kernelFunc:YU};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class tH{constructor(e,t,n){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,n],this.userCode=`\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n\n        float r = random(seed);\n        float cdf = 0.0;\n\n        for (int i = 0; i < ${t-1}; i++) {\n          cdf += getProbs(batch, i);\n\n          if (r < cdf) {\n            setOutput(float(i));\n            return;\n          }\n        }\n\n        // If no other event happened, last event happened.\n        setOutput(float(${t-1}));\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const nH=MP({opSnippet:"\nif (a == b) {\n  return 1.0;\n};\nreturn a / b;",packedOpSnippet:"\n  // vec4 one = vec4(equal(a, b));\n  // return one + (vec4(1.0) - one) * a / b;\n  vec4 result = a / b;\n  if(a.x == b.x) {\n    result.x = 1.;\n  }\n  if(a.y == b.y) {\n    result.y = 1.;\n  }\n  if(a.z == b.z) {\n    result.z = 1.;\n  }\n  if(a.w == b.w) {\n    result.w = 1.;\n  }\n\n  return result;\n",checkOutOfBounds:!0}),rH={kernelName:Ll,backendName:"webgl",kernelFunc:nH},aH="return a - b;",sH=MP({opSnippet:aH,packedOpSnippet:aH,supportsComplex:!0,cpuKernelImpl:ZB}),iH={kernelName:Mc,backendName:"webgl",kernelFunc:sH};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function oH(e){const{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{dim:s}=r,i=io([s],a.shape),o=FU({inputs:{x:a},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=Qm(o.shape,i),u=jP({inputs:{x:o},backend:n,attrs:{shape:l}}),c=sH({inputs:{a:a,b:u},backend:n}),d=IV({inputs:{x:c},backend:n}),h=ez({inputs:{x:d},backend:n,attrs:{axis:i,keepDims:!1}}),p=jP({inputs:{x:h},backend:n,attrs:{shape:l}}),f=nH({inputs:{a:d,b:p},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),f}const lH={kernelName:Sc,backendName:"webgl",kernelFunc:oH};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uH={kernelName:$u,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{numSamples:s,seed:i,normalized:o}=r,l=o?a:oH({inputs:{logits:a},backend:n,attrs:{dim:a.shape.length-1}}),u=l.shape[0],c=l.shape[1],d=new tH(u,c,s),h=[[i]],p=n.runWebGLProgram(d,[l],"int32",h);return o||n.disposeIntermediateTensorInfo(l),p}},cH=cP+"\n  return -x;\n";
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dH={kernelName:Fu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t;if(n.shouldExecuteOnCPU([r])){const e=n.texData.get(r.dataId),[t,a]=TB(e.values,r.shape,r.dtype);return n.makeTensorInfo(a,r.dtype,t)}let a;return a=Do().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new mP(r.shape,"\n  vec4 result = -x;\n  bvec4 isNaN = isnan(x);\n\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n"):new uP(r.shape,cH),n.runWebGLProgram(a,[r],r.dtype)}},hH=Dv;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const pH={kernelName:Mu,backendName:"webgl",kernelFunc:function(e){ed();const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l}=r,u=n.readSync(a.dataId),c=n.readSync(s.dataId),{selectedIndices:d}=hH(u,c,i,o,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}},fH=Mv;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const mH={kernelName:Lu,backendName:"webgl",kernelFunc:function(e){ed();const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,padToMaxOutputSize:u}=r,c=n.readSync(a.dataId),d=n.readSync(s.dataId),{selectedIndices:h,validOutputs:p}=fH(c,d,i,o,l,u);return[n.makeTensorInfo([h.length],"int32",new Int32Array(h)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}},gH=Lv;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const yH={kernelName:Bu,backendName:"webgl",kernelFunc:function(e){ed();const{inputs:t,backend:n,attrs:r}=e,{boxes:a,scores:s}=t,{maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:u}=r,c=n.readSync(a.dataId),d=n.readSync(s.dataId),h=i,p=o,f=l,m=u,{selectedIndices:g,selectedScores:y}=gH(c,d,h,p,f,m);return[n.makeTensorInfo([g.length],"int32",new Int32Array(g)),n.makeTensorInfo([y.length],"float32",new Float32Array(y))]}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class bH{constructor(e,t,n,r){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=`\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int index = round(getIndices(coords.x));\n        setOutput(mix(float(${r}), float(${n}),\n                      float(index == coords.y)));\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const vH={kernelName:zu,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{indices:a}=t,{dtype:s,depth:i,onValue:o,offValue:l}=r,u=Ji(a.shape),c=new bH(u,i,o,l),d=jP({inputs:{x:a},backend:n,attrs:{shape:[u]}}),h=n.runWebGLProgram(c,[d],s);n.disposeIntermediateTensorInfo(d);const p=jP({inputs:{x:h},backend:n,attrs:{shape:[...a.shape,i]}});return n.disposeIntermediateTensorInfo(h),p}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function AH(e){const{inputs:t,backend:n}=e,{x:r}=t;if("complex64"===r.dtype){const e=iG({inputs:{input:r},backend:n}),t=AH({inputs:{x:e},backend:n}),a=xG({inputs:{input:r},backend:n}),s=AH({inputs:{x:a},backend:n}),i=WP({inputs:{real:t,imag:s},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),i}return MV({attrs:{shape:r.shape,dtype:r.dtype,value:"string"===r.dtype?"":0},backend:n})}const xH={kernelName:qc,backendName:"webgl",kernelFunc:AH};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const kH={kernelName:Pu,backendName:"webgl",kernelFunc:function e(t){const{inputs:n,backend:r}=t,{x:a}=n;if("string"===a.dtype)throw new Error("onesLike is not supported under string dtype");if("complex64"===a.dtype){const t=iG({inputs:{input:a},backend:r}),n=e({inputs:{x:t},backend:r}),s=xG({inputs:{input:a},backend:r}),i=AH({inputs:{x:s},backend:r}),o=WP({inputs:{real:n,imag:i},backend:r});return r.disposeIntermediateTensorInfo(t),r.disposeIntermediateTensorInfo(n),r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(i),o}return MV({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:r})}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const wH={kernelName:Gu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r;if(1===t.length)return _V({inputs:{input:t[0]},backend:n,attrs:{dim:a}});const s=t[0].shape,i=t[0].dtype;t.forEach((e=>{Zi(s,e.shape,"All tensors passed to stack must have matching shapes"),Xi(i===e.dtype,(()=>"All tensors passed to stack must have matching dtypes"))}));const o=[],l=SG({inputs:t.map((e=>{const t=_V({inputs:{input:e},backend:n,attrs:{dim:a}});return o.push(t),t})),backend:n,attrs:{axis:a}});return o.forEach((e=>n.disposeIntermediateTensorInfo(e))),l}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class SH{constructor(e,t,n){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,a=OL(r),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),o=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?`\n      ${a} start = ${a}(${s});\n      ${a} end = ${a}(${i});\n\n      void main() {\n        ${a} outC = getOutputCoords();\n        if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n          setOutput(value);\n        } else {\n          ${a} coords = outC - start;\n          setOutput(getX(${o}));\n        }\n      }\n    `:`\n        int start = ${s};\n        int end = ${i};\n\n        void main() {\n          int outC = getOutputCoords();\n          if (outC < start || outC >= end) {\n            setOutput(value);\n          } else {\n            setOutput(getX(outC - start));\n          }\n        }\n      `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class CH{constructor(e,t,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,a=OL(r),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),o=nP("rc",r),l=nP("source",r),u=`${o[r-1]} < ${this.outputShape[r-1]}`,c=1===r?"source":`vec2(${l.slice(-2).join()})`,d=[`${a} rc = outputLoc;`,`${o[r-1]} += 1;\n       if(${u}) {\n      `,1===r?"":`}\n       rc = outputLoc;\n       ${o[r-2]} += 1;\n       if(${o[r-2]} < ${this.outputShape[r-2]}) {`,1===r?"":`  ${o[r-1]} += 1;\n         if(${u}) {`],h=1===r?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))";let p="";for(let f=0,m=1===r?2:4;f<m;f++)p+=`\n        ${d[f]}\n        if (${h}) {\n          result[${f}] = float(value);\n        } else {\n          ${a} source = rc - start;\n          result[${f}] = getChannel(getX(${l.join()}), ${c});\n        }\n      `;p+=1===r?"} ":"}}",this.userCode=`\n      const ${a} start = ${a}(${s});\n      const ${a} end = ${a}(${i});\n\n      void main() {\n        ${a} outputLoc = getOutputCoords();\n        vec4 result = vec4(0.);\n        ${p}\n        setOutput(result);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const IH=e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{paddings:s,constantValue:i}=r;if(0===Ji(a.shape)){return MV({backend:n,attrs:{shape:s.map(((e,t)=>e[0]+a.shape[t]+e[1])),value:i,dtype:a.dtype}})}const o=Do().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new CH(a.shape,s,i):new SH(a.shape,s,i),l=[[i]];return n.runWebGLProgram(o,[a],a.dtype,l)},WH={kernelName:Vu,backendName:"webgl",kernelFunc:IH},_H=MP({opSnippet:"\n  if(a < 0.0 && floor(b) < b){\n    return NAN;\n  }\n  if (b == 0.0) {\n    return 1.0;\n  }\n  return (round(mod(b, 2.0)) != 1) ?\n      pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",packedOpSnippet:"\n  // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n  vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n  vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n  vec4 result = multiplier * pow(abs(a), b);\n\n  // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n  bvec4 isExpZero = equal(b, vec4(0.0));\n  result.r = isExpZero.r ? 1.0 : result.r;\n  result.g = isExpZero.g ? 1.0 : result.g;\n  result.b = isExpZero.b ? 1.0 : result.b;\n  result.a = isExpZero.a ? 1.0 : result.a;\n\n  bvec4 isNaN1 = lessThan(a, vec4(0.0));\n  bvec4 isNaN2 = lessThan(floor(b), b);\n  bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);\n  "+wP+"\n  return result;\n"}),TH={kernelName:Uu,backendName:"webgl",kernelFunc:_H};const NH={kernelName:ju,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=a.shape.length,l=[],u=io(s,a.shape);let c=u;const d=Zm(c,o);let h,p=a;if(null!=d&&(p=nz({inputs:{x:a},backend:n,attrs:{perm:d}}),c=Jm(c.length,o),l.push(p)),Xm("prod",c,o),n.shouldExecuteOnCPU([p])){const e=n.texData.get(p.dataId).values,{outVals:t,outShape:r,outDtype:a}=EB(p.shape,p.dtype,e,c);h=n.makeTensorInfo(r,a,t)}else{const[e,t]=qm(p.shape,c),r=Ji(t),s=jP({inputs:{x:p},backend:n,attrs:{shape:[-1,r]}}),i=ZP(s,Th(a.dtype),"prod",n);h=jP({inputs:{x:i},backend:n,attrs:{shape:e}}),l.push(s),l.push(i)}if(i){l.push(h);const e=Qm(h.shape,u);h=jP({inputs:{x:h},backend:n,attrs:{shape:e}})}return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),h}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const EH={kernelName:qu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{paramsNestedSplits:a,paramsDenseValues:s,indices:i}=t,{outputRaggedRank:o}=r,l=a.map((e=>n.readSync(e.dataId))),u=a.map((e=>e.shape)),c=n.readSync(s.dataId),d=n.readSync(i.dataId),[h,p,f]=RB(l,u,c,s.shape,s.dtype,d,i.shape,o),m=h.map((e=>n.makeTensorInfo([e.length],"int32",e))),g=n.makeTensorInfo(f,s.dtype,p);return m.concat([g])}};
/**
 * @license
 * Copyright 2022 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const RH={kernelName:Qu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{starts:r,limits:a,deltas:s}=t,i=n.readSync(r.dataId),o=n.readSync(a.dataId),l=n.readSync(s.dataId),[u,c]=$B(i,r.shape,r.dtype,o,a.shape,l,s.shape);return[n.makeTensorInfo([u.length],"int32",u),n.makeTensorInfo([c.length],r.dtype,c)]}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const $H={kernelName:Xu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{shape:a,values:s,defaultValue:i,rowPartitionTensors:o}=t,{rowPartitionTypes:l}=r,u=n.readSync(a.dataId),c=n.readSync(s.dataId),d=n.readSync(i.dataId),h=o.map((e=>n.readSync(e.dataId))),p=o.map((e=>e.shape)),[f,m]=OB(u,a.shape,c,s.shape,s.dtype,d,i.shape,h,p,l);return n.makeTensorInfo(f,s.dtype,m)}},OH=e=>{const{backend:t,attrs:n}=e,{start:r,stop:a,step:s,dtype:i}=n,o=FB(r,a,s,i);return t.makeTensorInfo([o.length],i,o)},FH={kernelName:Zu,backendName:"webgl",kernelFunc:OH},DH=DP({opSnippet:"return 1.0 / x;"}),MH={kernelName:Ju,backendName:"webgl",kernelFunc:DH},LH=DP({opSnippet:cP+"\n  return (x < 0.0) ? 0.0 : x;\n",packedOpSnippet:"\n  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n  bvec4 isNaN = isnan(x);\n\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n"}),BH={kernelName:Yu,backendName:"webgl",kernelFunc:LH},PH=DP({opSnippet:cP+"\n  return (x < 0.0) ? 0.0 : min(6.0, x);\n",packedOpSnippet:"\n  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n  bvec4 isNaN = isnan(x);\n\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n"}),zH={kernelName:sc,backendName:"webgl",kernelFunc:PH};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class GH{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];const[s,i,o,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?i-1:i,r&&n>1?o-1:o],c=[r&&t>1?t-1:t,r&&n>1?n-1:n];let d;d=a?"(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n      const vec2 effectiveInputOverOutputRatioRC = vec2(\n          ${u[0]/c[0]},\n          ${u[1]/c[1]});\n      const vec2 inputShapeRC = vec2(${i}.0, ${o}.0);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        ivec2 yRC = coords.yz;\n\n        // Fractional source index.\n        vec2 sourceFracIndexRC = ${d};\n\n        // Compute the four integer indices.\n        ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));\n        ivec2 sourceCeilRC = ivec2(\n          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n        float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n        float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n        float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n        float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n        vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n        float top = topLeft + (topRight - topLeft) * fracRC.y;\n        float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n        float newValue = top + (bottom - top) * fracRC.x;\n\n        setOutput(newValue);\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class VH{constructor(e,t,n,r,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[s,i,o,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?i-1:i,r&&n>1?o-1:o],c=[r&&t>1?t-1:t,r&&n>1?n-1:n];let d;d=a?"(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n      const vec3 effectiveInputOverOutputRatioRC = vec3(\n          ${u[0]/c[0]},\n          ${u[1]/c[1]},\n          ${u[1]/c[1]});\n      const vec3 inputShapeRC = vec3(${i}.0, ${o}.0,\n                                     ${o}.0);\n\n      float getAValue(int b, int r, int c, int d) {\n        return getChannel(getA(b, r, c, d), vec2(c, d));\n      }\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        // Calculate values for next column in yRC.z.\n        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n        // Fractional source index.\n        vec3 sourceFracIndexRC = ${d};\n\n        // Compute the four integer indices.\n        ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));\n        ivec3 sourceCeilRC = ivec3(\n          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n        // Should we calculate next column and row elements in 2x2 packed cell.\n        bool hasNextCol = d < ${l-1};\n        bool hasNextRow = coords.z < ${n-1};\n\n        // In parallel, construct four corners for all four components in\n        // packed 2x2 cell.\n        vec4 topLeft = vec4(\n          getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n                     : 0.0,\n          (hasNextRow && hasNextCol) ?\n            getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n        vec4 bottomLeft = vec4(\n          getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n                     : 0.0,\n          (hasNextRow && hasNextCol) ?\n            getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n        vec4 topRight = vec4(\n          getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n          hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n                     : 0.0,\n          (hasNextRow && hasNextCol) ?\n            getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n        vec4 bottomRight = vec4(\n          getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n          hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n                     : 0.0,\n          (hasNextRow && hasNextCol) ?\n            getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n        vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n        vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n        vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n        vec4 newValue = mix(top, bottom, fracRC.x);\n\n        setOutput(newValue);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const UH={kernelName:rc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:i,size:o}=r,[l,u]=o,c=Do().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new VH(a.shape,l,u,s,i):new GH(a.shape,l,u,s,i);return n.runWebGLProgram(c,[a],"float32")}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class HH{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,r,a]=t,[,s,i]=e,o=[n&&s>1?r-1:r,n&&i>1?a-1:a],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],u=o[0]/l[0],c=o[1]/l[1],d=1/u,h=1/c,p=2*Math.ceil(d)+2,f=2*Math.ceil(h)+2;this.userCode=`\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        int r = coords[1];\n        int c = coords[2];\n\n        float accumulator = 0.0;\n\n        const float heightScale = float(${u});\n        const float widthScale = float(${c});\n\n        const float invHeightScale = float(${d});\n        const float invWidthScale = float(${h});\n\n        const int winHeight = int(${p});\n        const int winWidth = int(${f});\n\n        // Compute bounds for where in dy we will look\n        float startRLerp = floor(float(r) * invHeightScale);\n        int startDyR = int(startRLerp - float(winHeight / 2));\n\n        float startCLerp = floor(float(c) * invWidthScale);\n        int startDyC = int(startCLerp - float(winWidth / 2));\n\n        // Loop over dy\n        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n          int dyR = dyROffset + startDyR;\n\n          // Guard against the window exceeding the bounds of dy\n          if (dyR < 0 || dyR >= ${s}) {\n            continue;\n          }\n\n          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n            int dyC = dyCOffset + startDyC;\n\n            // Guard against the window exceeding the bounds of dy\n            if (dyC < 0 || dyC >= ${i}) {\n              continue;\n            }\n\n            float dxR = float(dyR) * heightScale;\n            int topDxRIndex = int(floor(dxR));\n            int bottomDxRIndex = int(min(ceil(dxR), ${r-1}.0));\n            float dxRLerp = dxR - float(topDxRIndex);\n            float inverseDxRLerp = 1.0 - dxRLerp;\n\n            float dxC = float(dyC) * widthScale;\n            int leftDxCIndex = int(floor(dxC));\n            int rightDxCIndex = int(min(ceil(dxC), ${a-1}.0));\n            float dxCLerp = dxC - float(leftDxCIndex);\n            float inverseDxCLerp = 1.0 - dxCLerp;\n\n            if (r == topDxRIndex && c == leftDxCIndex) {\n              // topLeft\n              accumulator +=\n                getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n            }\n\n            if (r == topDxRIndex && c == rightDxCIndex) {\n              // topRight\n              accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n            }\n\n            if (r == bottomDxRIndex && c == leftDxCIndex) {\n              // bottomLeft\n              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n            }\n\n            if (r == bottomDxRIndex && c == rightDxCIndex) {\n              // bottomRight\n              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n            }\n          }\n        }\n        // End loop over dy\n\n        setOutput(accumulator);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jH={kernelName:ac,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r,o=new HH(s.shape,a.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class qH{constructor(e,t,n,r,a){this.variableNames=["A"],this.outputShape=[];const[s,i,o,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?i-1:i,r&&n>1?o-1:o],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0";let h;h=a?"max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n      const vec2 effectiveInputOverOutputRatioRC = vec2(\n          ${u[0]/c[0]},\n          ${u[1]/c[1]});\n      const vec2 inputShapeRC = vec2(${i}.0, ${o}.0);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        ivec2 yRC = coords.yz;\n\n        // Fractional source index.\n        vec2 sourceFracIndexRC = ${h};\n\n        // Compute the coordinators of nearest neighbor point.\n        ivec2 sourceNearestRC = ivec2(\n          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));\n        float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n        setOutput(newValue);\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class QH{constructor(e,t,n,r,a){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[s,i,o,l]=e;this.outputShape=[s,t,n,l];const u=[r&&t>1?i-1:i,r&&n>1?o-1:o],c=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=r?"0.5":"0.0";let h;h=a?"max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=`\n      const vec3 effectiveInputOverOutputRatioRC = vec3(\n          ${u[0]/c[0]},\n          ${u[1]/c[1]},\n          ${u[1]/c[1]});\n      const vec3 inputShapeRC = vec3(${i}.0, ${o}.0,\n                                     ${o}.0);\n\n      float getAValue(int b, int r, int c, int d) {\n        return getChannel(getA(b, r, c, d), vec2(c, d));\n      }\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        // Calculate values for next column in yRC.z.\n        ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n        // Fractional source index.\n        vec3 sourceFracIndexRC = ${h};\n\n        // Compute the coordinators of nearest neighbor point.\n        ivec3 sourceNearestRC = ivec3(\n          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ${d})));\n\n        // Should we calculate next column and row elements in 2x2 packed cell.\n        bool hasNextCol = d < ${l-1};\n        bool hasNextRow = coords.z < ${n-1};\n\n        vec4 newValue = vec4(\n          getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),\n          hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)\n                     : 0.0,\n          hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)\n                     : 0.0,\n          (hasNextRow && hasNextCol) ?\n            getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);\n\n        setOutput(newValue);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const XH={kernelName:tc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:i,size:o}=r,[l,u]=o,c=Do().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new QH(a.shape,l,u,s,i):new qH(a.shape,l,u,s,i);return n.runWebGLProgram(c,[a],a.dtype)}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class ZH{constructor(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,r,a]=t,[,s,i]=e,o=[n&&s>1?r-1:r,n&&i>1?a-1:a],l=[n&&s>1?s-1:s,n&&i>1?i-1:i],u=o[0]/l[0],c=o[1]/l[1],d=1/u,h=1/c,p=2*Math.ceil(d)+2,f=2*Math.ceil(h)+2;this.userCode=`\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        int r = coords[1];\n        int c = coords[2];\n\n        float accumulator = 0.0;\n\n        const float heightScale = float(${u});\n        const float widthScale = float(${c});\n\n        const float invHeightScale = float(${d});\n        const float invWidthScale = float(${h});\n\n        const int winHeight = int(${p});\n        const int winWidth = int(${f});\n\n        // Compute bounds for where in dy we will look\n        float startRLerp = floor(float(r) * invHeightScale);\n        int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n        float startCLerp = floor(float(c) * invWidthScale);\n        int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n        // Loop over dy\n        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n          int dyR = dyROffset + startDyR;\n\n          // Guard against the window exceeding the bounds of dy\n          if (dyR < 0 || dyR >= ${s}) {\n            continue;\n          }\n\n          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n            int dyC = dyCOffset + startDyC;\n\n            // Guard against the window exceeding the bounds of dy\n            if (dyC < 0 || dyC >= ${i}) {\n              continue;\n            }\n\n            float sourceFracRow =\n              float(${o[0]}) *\n                (float(dyR) / float(${l[0]}));\n\n            float sourceFracCol =\n                float(${o[1]}) *\n                  (float(dyC) / float(${l[1]}));\n\n            int sourceNearestRow = int(min(\n                float(int(${r}) - 1),\n                ${n} ? float(round(sourceFracRow)) :\n                                  float(floor(sourceFracRow))));\n\n            int sourceNearestCol = int(min(\n                float(int(${a}) - 1),\n                ${n} ? float(round(sourceFracCol)) :\n                                  float(floor(sourceFracCol))));\n\n            if (r == sourceNearestRow && c == sourceNearestCol) {\n              accumulator += getDy(b, dyR, dyC, d);\n            }\n          }\n        }\n        // End loop over dy\n\n        setOutput(accumulator);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const KH={kernelName:nc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r,o=new ZH(s.shape,a.shape,i);return n.runWebGLProgram(o,[s],s.dtype)}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class JH{constructor(e,t){this.variableNames=["x"];const n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);if(this.outputShape=e,1===n)return void(this.userCode=`\n        void main() {\n          int coord = getOutputCoords();\n          setOutput(getX(${e[0]} - coord - 1));\n        }\n      `);const r=e.map(((n,r)=>(n=>-1!==t.indexOf(n)&&1!==e[n]?`${e[n]} - coords[${n}] - 1`:`coords[${n}]`)(r))).join(","),a=OL(n);this.userCode=`\n      void main() {\n        ${a} coords = getOutputCoords();\n        setOutput(getX(${r}));\n      }\n    `}}
/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class YH{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;const n=e.length;if(n>4)throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);this.outputShape=e;const r=nP("rc",n),a=`${r[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${r[n-2]} + 1 < ${this.outputShape[n-2]}`,i=OL(n);var o;function l(n){const r=e.map(((r,a)=>function(n,r){return-1!==t.indexOf(n)&&1!==e[n]?`${e[n]} - ${r[n]} - 1`:`${r[n]}`}(a,n)));return`getChannel(getX(${r.join(",")}), vec2(${r.slice(-2).join(",")}))`}this.userCode=1===n?`\n        void main(){\n          int rc = getOutputCoords();\n          vec4 result = vec4(0.);\n          result.r = getChannel(getX(${e[0]} - rc - 1),\n            ${e[0]} - rc - 1);\n          if(${a}){\n              result.g = getChannel(getX(${e[0]} - (rc  + 1) - 1),\n                ${e[0]} - (rc  + 1) - 1);\n          }\n          setOutput(result);\n        }\n      `:`\n        void main() {\n          ${i} rc = getOutputCoords();\n          vec4 result = vec4(0.);\n          result.r = ${o=r.slice(),l(o)};\n          if(${a}){\n            result.g = ${function(e){return e[n-1]="("+e[n-1]+" + 1)",l(e)}(r.slice())};\n          }\n          if(${s}) {\n            result.b = ${function(e){return e[n-2]="("+e[n-2]+" + 1)",l(e)}(r.slice())};\n            if(${a}) {\n              result.a = ${function(e){return e[n-1]="("+e[n-1]+" + 1)",e[n-2]="("+e[n-2]+" + 1)",l(e)}(r.slice())};\n            }\n          }\n          setOutput(result);\n        }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const ej={kernelName:ic,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dims:s}=r,i=a.shape.length,o=io(s,a.shape);if(0===i)return CP({inputs:{x:a},backend:n});const l=Do().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new YH(a.shape,o):new JH(a.shape,o);return n.runWebGLProgram(l,[a],a.dtype)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class tj{constructor(e,t){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];const n=e[1],r=e[2];this.outputShape=e;let a="";a="number"==typeof t?`float outputValue = ${t.toFixed(2)};`:`\n        vec3 fill = vec3(${t.join(",")});\n        float outputValue = fill[coords[3]];`,this.userCode=`\n        void main() {\n          ivec4 coords = getOutputCoords();\n          int x = coords[2];\n          int y = coords[1];\n          float coordXFloat = (float(x) - params[0]) * params[3] -\n            (float(y) - params[1]) * params[2];\n          float coordYFloat = (float(x) - params[0]) * params[2] +\n            (float(y) - params[1]) * params[3];\n          int coordX = int(round(coordXFloat + params[0]));\n          int coordY = int(round(coordYFloat + params[1]));\n          ${a}\n          if(coordX >= 0 && coordX < ${r} && coordY >= 0 && coordY < ${n}) {\n            outputValue = getImage(coords[0], coordY, coordX, coords[3]);\n          }\n          setOutput(outputValue);\n        }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const nj={kernelName:Zc,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:r}=e,{radians:a,fillValue:s,center:i}=t,o=n,l=new tj(r.shape,s),[u,c]=Dx(i,r.shape[1],r.shape[2]),d=[[u,c,Math.sin(a),Math.cos(a)]];return o.runWebGLProgram(l,[r],r.dtype,d)}},rj=DP({opSnippet:"\n  // OpenGL ES does not support round function.\n  // The algorithm is based on banker's rounding.\n  float base = floor(x);\n  if ((x - base) < 0.5) {\n    return floor(x);\n  } else if ((x - base) > 0.5) {\n    return ceil(x);\n  } else {\n    if (mod(base, 2.0) == 0.0) {\n      return base;\n    } else {\n      return base + 1.0;\n    }\n  }\n"}),aj={kernelName:oc,backendName:"webgl",kernelFunc:rj},sj=DP({opSnippet:"return inversesqrt(x);",cpuKernelImpl:DB}),ij={kernelName:lc,backendName:"webgl",kernelFunc:sj};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
class oj{constructor(e,t,n,r,a,s,i=!0,o=!1){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;const l=OL(a.length),u=OL(s.length);let c="";1===n?c="i":2===n&&(c="i, j");const d=`getIndices(${c})`;let h="";1===r?h="i":2===r&&(h="i, coords[1]");const p=`getUpdates(${h})`;let f="";o&&(f="coords[0], coords[1]");const m=`getDefaultValue(${f})`,g=t>1?"strides[j]":"strides";this.userCode=`\n        ${l} strides = ${l}(${a});\n\n        void main() {\n          ${u} coords = getOutputCoords();\n          float sum = 0.0;\n          bool found = false;\n          for (int i = 0; i < ${e}; i++) {\n            int flattenedIndex = 0;\n            for (int j = 0; j < ${t}; j++) {\n              int index = round(${d});\n              flattenedIndex += index * ${g};\n            }\n            if (flattenedIndex == coords[0]) {\n              sum += ${p};\n              found = true;\n            }\n          }\n          setOutput(mix(${m}, sum, float(found)));\n        }\n      `}}
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class lj{constructor(e,t,n,r,a,s,i=!0,o=!1){this.variableNames=["updates","indices","defaultValue"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=s;const l=OL(a.length),u=OL(s.length);let c="";1===n?c="i":2===n&&(c="i, j");const d=`getIndices(${c})`;let h="";1===r?h="i":2===r&&(h="i, coords[1]");const p=`getUpdates(${h})`;let f="";o&&(f="coords[0], coords[1]");const m=`getDefaultValue(${f})`,g=t>1?"strides[j]":"strides",y=t>1?"strides[j + 1]":"strides";this.userCode=`\n        ${l} strides = ${l}(${a});\n\n        void main() {\n          ${u} coords = getOutputCoords();\n          vec4 sum = vec4(0.);\n          vec4 found = vec4(0.);\n          for (int i = 0; i < ${e}; i+=2) {\n            ivec2 flattenedIndex = ivec2(0);\n            for (int j = 0; j < ${t}; j+=2) {\n              ivec4 index = round(${d});\n              flattenedIndex += index.xz * ${g};\n              if (j + 1 < ${t}) {\n                flattenedIndex += index.yw * ${y};\n              }\n            }\n            if (flattenedIndex[0] == coords[0] || flattenedIndex[1] == coords[0] ||\n                flattenedIndex[0] == coords[0] + 1 || flattenedIndex[1] == coords[0] + 1) {\n              vec4 updVals = ${p};\n              if (flattenedIndex[0] == coords[0]) {\n                sum.xy += updVals.xy;\n                found.xy = vec2(1.);\n              } else if (flattenedIndex[0] == coords[0] + 1) {\n                sum.zw += updVals.xy;\n                found.zw = vec2(1.);\n              }\n              if (flattenedIndex[1] == coords[0]) {\n                sum.xy += updVals.zw;\n                found.xy = vec2(1.);\n              } else if (flattenedIndex[1] == coords[0] + 1) {\n                sum.zw += updVals.zw;\n                found.zw = vec2(1.);\n              }\n            }\n          }\n          setOutput(mix(${m}, sum, found));\n        }\n      `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uj={kernelName:uc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{indices:a,updates:s}=t,{shape:i}=r,{sliceRank:o,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=Ub(0,a,i),h=[d/u,u];if(0===d)return n.makeTensorInfo(i,a.dtype);const p=jP({inputs:{x:a},backend:n,attrs:{shape:[l,o]}}),f=jP({inputs:{x:s},backend:n,attrs:{shape:[l,u]}}),m=n.makeTensorInfo([],"float32",new Float32Array([0]));let g;g=Do().getBool("WEBGL_PACK")?new lj(l,o,p.shape.length,f.shape.length,c,h):new oj(l,o,p.shape.length,f.shape.length,c,h);const y=n.runWebGLProgram(g,[f,p,m],f.dtype),b=jP({inputs:{x:y},backend:n,attrs:{shape:i}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(m),b}};
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class cj{constructor(e,t,n,r){this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[e,n];const a=`for (int i = 0; i < ${Math.ceil(Math.log2(t+1))}; ++i) { if (left >= right) break;`,s=2===Do().getNumber("WEBGL_VERSION")?"while (left < right) {":a,i="left"===r?"<":"<=";this.userCode=`\n       int findBound(int batch, float value) {\n         int left = 0;\n         int right = numInputs;\n         int mid;\n         ${s}\n           mid = (left + right) / 2;\n           if (getSortedSequence(batch, mid) ${i} value) {\n             left = mid + 1;\n           } else {\n             right = mid;\n           }\n         }\n         return right;\n       }\n\n       void main() {\n         ivec2 coords = getOutputCoords();\n         int batch = coords[0];\n         int valueIndex = coords[1];\n\n         float value = getValues(batch, valueIndex);\n\n         setOutput(float(findBound(batch, value)));\n       }\n     `}}
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dj={kernelName:dc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{sortedSequence:a,values:s}=t,{side:i}=r,o=new cj(a.shape[0],a.shape[1],s.shape[1],i),l=[[a.shape[1]]];return n.runWebGLProgram(o,[a,s],"int32",l)}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class hj{constructor(e,t,n){let r,a;if(this.variableNames=["c","a","b"],this.outputShape=t,n>4)throw Error(`Where for rank ${n} is not yet supported`);if(1===n)a="resRC",r="resRC";else{const n=["resRC.x","resRC.y","resRC.z","resRC.w"],s=[],i=[];for(let r=0;r<t.length;r++)i.push(`${n[r]}`),r<e&&s.push(`${n[r]}`);r=s.join(),a=i.join()}const s=OL(n);this.userCode=`\n      void main() {\n        ${s} resRC = getOutputCoords();\n        float cVal = getC(${r});\n        if (cVal >= 1.0) {\n          setOutput(getA(${a}));\n        } else {\n          setOutput(getB(${a}));\n        }\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const pj={kernelName:hc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{condition:r,t:a,e:s}=t,i=new hj(r.shape.length,a.shape,a.shape.length);return n.runWebGLProgram(i,[r,a,s],_h(a.dtype,s.dtype))}},fj=DP({opSnippet:`\n  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n  // see: https://arxiv.org/abs/1706.02515\n  float scaleAlpha = 1.7580993408473768;\n  float scale = ${Vx};\n  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n`}),mj={kernelName:pc,backendName:"webgl",kernelFunc:fj},gj=DP({opSnippet:FP+"\n  return 1.0 / (1.0 + exp(-1.0 * x));\n",packedOpSnippet:"\n  vec4 result = 1.0 / (1.0 + exp(-1.0 * x));\n  bvec4 isNaN = isnan(x);\n\n  result.r = isNaN.r ? x.r : result.r;\n  result.g = isNaN.g ? x.g : result.g;\n  result.b = isNaN.b ? x.b : result.b;\n  result.a = isNaN.a ? x.a : result.a;\n\n  return result;\n",cpuKernelImpl:LB}),yj={kernelName:bc,backendName:"webgl",kernelFunc:gj},bj=DP({opSnippet:"\n  if (isnan(x)) { return 0.0; }\n  return sign(x);\n"}),vj={kernelName:yc,backendName:"webgl",kernelFunc:bj},Aj=DP({opSnippet:FP+"\n  return sin(x);\n",packedOpSnippet:`\n  vec4 result = sin(x);\n  bvec4 isNaN = isnan(x);\n  ${wP}\n  return result;\n`}),xj={kernelName:mc,backendName:"webgl",kernelFunc:Aj},kj=DP({opSnippet:"\n  float e2x = exp(x);\n  return (e2x - 1.0 / e2x) / 2.0;\n"}),wj={kernelName:gc,backendName:"webgl",kernelFunc:kj},Sj=DP({opSnippet:"\n  float epsilon = 1.1920928955078125e-7;\n  float threshold = log(epsilon) + 2.0;\n\n  bool too_large = x > -threshold;\n  bool too_small = x < threshold;\n\n  float result;\n  float exp_x = exp(x);\n\n  if (too_large){\n    result = x;\n  }\n  else if (too_small){\n    result = exp_x;\n  }\n  else{\n    result = log(exp_x + 1.0);\n  }\n  return result;\n"}),Cj={kernelName:vc,backendName:"webgl",kernelFunc:Sj},Ij={kernelName:kc,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,paddings:i}=r;Xi(a.shape.length<=4,(()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"));const o=s.reduce(((e,t)=>e*t)),l=[[0,0]];l.push(...i);for(let y=1+s.length;y<a.shape.length;++y)l.push([0,0]);const u=[],c=IH({inputs:{x:a},backend:n,attrs:{paddings:l,constantValue:0}}),d=Mx(c.shape,s,o,!1),h=Lx(d.length,s.length,!1),p=Bx(c.shape,s,o,!1),f=jP({inputs:{x:c},backend:n,attrs:{shape:d}}),m=nz({inputs:{x:f},backend:n,attrs:{perm:h}}),g=jP({inputs:{x:m},backend:n,attrs:{shape:p}});return u.push(c),u.push(f),u.push(m),u.forEach((e=>n.disposeIntermediateTensorInfo(e))),g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Wj={kernelName:Cc,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n}=e,{indices:r,values:a,denseShape:s,defaultValue:i}=t;if(1!==s.shape.length)throw new Error(`Dense shape must be a vector, saw:\n         ${s.shape}`);if(2!==r.shape.length)throw new Error(`Indices must be a matrix, saw:\n         ${r.shape}`);if(1!==a.shape.length)throw new Error(`Values must be a vector, saw:\n         ${a.shape}`);if(0!==i.shape.length)throw new Error(`Default value must be a scalar, saw:\n        ${i.shape}`);const o=n.readSync(r.dataId),l=n.readSync(a.dataId),u=n.readSync(s.dataId),c=n.readSync(i.dataId)[0],[d,h,p,f,m]=zB(o,r.shape,r.dtype,l,a.dtype,u,c);return[n.makeTensorInfo(h,r.dtype,d),n.makeTensorInfo([h[0]],a.dtype,p),n.makeTensorInfo([f.length],"bool",new Uint8Array(f.map((e=>Number(e))))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const _j={kernelName:Ic,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{inputIndices:r,inputShape:a,newShape:s}=t;if(2!==r.shape.length)throw new Error(`Input indices should be a matrix but received shape ${r.shape}`);if(1!==a.shape.length)throw new Error(`Input shape should be a vector but received shape ${a.shape}`);if(1!==s.shape.length)throw new Error(`Target shape should be a vector but received shape ${s.shape}`);const i=Array.from(n.readSync(a.dataId)),o=n.readSync(r.dataId),l=Array.from(n.readSync(s.dataId)),[u,c,d]=GB(o,r.shape,r.dtype,i,l);return[n.makeTensorInfo(c,r.dtype,u),n.makeTensorInfo([d.length],s.dtype,new Int32Array(d))]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Tj={kernelName:Wc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{data:r,indices:a,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error(`Indices should be a vector but received shape\n              ${a.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n              ${s.shape}`);const i=n.readSync(r.dataId),o=n.readSync(a.dataId),l=n.readSync(s.dataId),[u,c]=VB(i,r.shape,r.dtype,o,l,!0);return n.makeTensorInfo(c,r.dtype,u)}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Nj={kernelName:_c,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{data:r,indices:a,segmentIds:s}=t;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error(`Indices should be a vector but received shape\n             ${a.shape}`);if(1!==s.shape.length)throw new Error(`Segment ids should be a vector but received shape\n             ${s.shape}`);const i=n.readSync(r.dataId),o=n.readSync(a.dataId),l=n.readSync(s.dataId),[u,c]=VB(i,r.shape,r.dtype,o,l);return n.makeTensorInfo(c,r.dtype,u)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Ej={kernelName:Tc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{sparseIndices:a,sparseValues:s,defaultValue:i}=t,{outputShape:o}=r,{sliceRank:l,numUpdates:u,sliceSize:c,strides:d,outputSize:h}=Ub(0,a,o),p=!1;if("string"===s.dtype){const e=n.bufferSync(a),t=n.bufferSync(s),r=Yd(n.readSync(i.dataId)[0]),f=MB(e,t,o,h,c,u,l,d,r,p);return n.makeTensorInfo(o,f.dtype,f.values)}const f=new oj(u,l,a.shape.length,s.shape.length,d,[h,1],p),m=n.runWebGLProgram(f,[s,a,i],s.dtype),g=jP({inputs:{x:m},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(m),g}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Rj={kernelName:wc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{numOrSizeSplits:s,axis:i}=r,o=io(i,a.shape)[0],l=hk(a,s,o),u=a.shape.length,c=new Array(u).fill(0),d=a.shape.slice();return l.map((e=>{const t=[...d];t[o]=e;const r=Jz({inputs:{x:a},backend:n,attrs:{begin:c,size:t}});return c[o]+=e,r}))}},$j="return sqrt(x);",Oj=DP({opSnippet:$j,packedOpSnippet:$j,cpuKernelImpl:UB}),Fj={kernelName:Ac,backendName:"webgl",kernelFunc:Oj},Dj={kernelName:Ec,backendName:"webgl",kernelFunc:DP({opSnippet:"return x * x;"})},Mj="return (a - b) * (a - b);",Lj=MP({opSnippet:Mj,packedOpSnippet:Mj}),Bj={kernelName:Nc,backendName:"webgl",kernelFunc:Lj};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Pj={kernelName:Rc,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2023 Google LLC.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;if("string"!==a.dtype)throw new Error("Input must be of datatype string");const s=Tk(n.readSync(a.dataId)),i=HB(s,"string",r);return n.makeTensorInfo(a.shape,"string",i)}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const zj={kernelName:Qc,backendName:"webgl",kernelFunc:function({inputs:e,attrs:t,backend:n}){const{x:r}=e,a=cP+`\n    return x > 0.0 ? 1.0 : float(${t.alpha});\n  `,s=new uP(r.shape,a);return n.runWebGLProgram(s,[r],r.dtype)}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class Gj{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;const r=n.length,a=OL(n.length),s=OL(n.length);let i="";if(1===r)i="coords * strides + begin";else{let e=0;i=n.map(((t,r)=>(e++,1===n.length?`coords * strides[${r}] + begin[${r}]`:`coords[${e-1}] * strides[${r}] + begin[${r}]`))).join(",")}this.userCode=`\n      ${a} begin = ${a}(${e});\n      ${a} strides = ${a}(${t});\n\n      void main() {\n        ${s} coords = getOutputCoords();\n        setOutput(getX(${i}));\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Vj={kernelName:$c,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,end:i,strides:o,beginMask:l,endMask:u,ellipsisMask:c,newAxisMask:d,shrinkAxisMask:h}=r,{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:y,begin:b,end:v,strides:A}=Ax(a.shape,s,i,o,l,u,c,d,h);let x;if(m)x=jP({inputs:{x:a},backend:n,attrs:{shape:f}});else if(g||y){Xi(a.shape.length>=1,(()=>`Input must have rank at least 1, got: ${a.shape.length}`));const e=lx(b,v,A),t=Jz({inputs:{x:a},backend:n,attrs:{begin:b,size:e}});x=jP({inputs:{x:t},backend:n,attrs:{shape:f}}),n.disposeIntermediateTensorInfo(t)}else{if(n.shouldExecuteOnCPU([a])){const e=n.readSync(a.dataId),t=uf(a.shape,a.dtype,e),r=jB(p,t,A,b);x=n.makeTensorInfo(f,a.dtype,r.values)}else{const e=new Gj(b,A,p);x=n.runWebGLProgram(e,[a],a.dtype)}}const k=jP({inputs:{x:x},backend:n,attrs:{shape:f}});return n.disposeIntermediateTensorInfo(x),k}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Uj={kernelName:Oc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{separator:a,nGramWidths:s,leftPad:i,rightPad:o,padWidth:l,preserveShortSequences:u}=r,{data:c,dataSplits:d}=t,h=n.readSync(c.dataId),p=n.readSync(d.dataId),[f,m]=qB(h,p,a,s,i,o,l,u);return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(d.shape,"int32",m)]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Hj={kernelName:Fc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{skipEmpty:a}=r,{input:s,delimiter:i}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(1!==s.shape.length)throw new Error(`Input must be a vector, got shape: ${s.shape}`);if(0!==i.shape.length)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);const o=n.readSync(s.dataId),l=n.readSync(i.dataId)[0],[u,c,d]=QB(o,l,a),h=c.length;return[n.makeTensorInfo([h,2],"int32",u),n.makeTensorInfo([h],"string",c),n.makeTensorInfo([2],"int32",new Int32Array(d))]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const jj={kernelName:Dc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{numBuckets:a}=r,{input:s}=t;if("string"!==s.dtype)throw new Error("Input must be of datatype string");if(a<=0)throw new Error("Number of buckets must be at least 1");const i=n.readSync(s.dataId),o=XB(i,a);return n.makeTensorInfo(s.shape,"int32",o)}},qj=DP({opSnippet:"return tan(x);"}),Qj={kernelName:Lc,backendName:"webgl",kernelFunc:qj},Xj=DP({opSnippet:"\n  float e2x = exp(-2.0 * abs(x));\n  return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n"}),Zj={kernelName:Bc,backendName:"webgl",kernelFunc:Xj};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Kj={kernelName:cc,backendName:"webgl",kernelFunc:
/**
 * @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
function(e){const{inputs:t,backend:n,attrs:r}=e,{tensor:a,indices:s,updates:i}=t,{sliceRank:o,numUpdates:l,sliceSize:u,strides:c,outputSize:d}=Ub(0,s,a.shape),h=[d/u,u];if(0===d)return n.makeTensorInfo(a.shape,s.dtype);const p=jP({inputs:{x:s},backend:n,attrs:{shape:[l,o]}}),f=jP({inputs:{x:i},backend:n,attrs:{shape:[l,u]}}),m=jP({inputs:{x:a},backend:n,attrs:{shape:h}}),g=new oj(l,o,p.shape.length,f.shape.length,c,h,!1,!0),y=n.runWebGLProgram(g,[f,p,m],m.dtype),b=jP({inputs:{x:y},backend:n,attrs:{shape:a.shape}});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),b}};
/**
 * @license
 * Copyright 2017 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class Jj{constructor(e,t){this.variableNames=["A"];const n=new Array(e.length);for(let s=0;s<n.length;s++)n[s]=e[s]*t[s];this.outputShape=n,this.rank=n.length;const r=OL(this.rank),a=function(e){const t=e.length;if(t>5)throw Error(`Tile for rank ${t} is not yet supported`);if(1===t)return`imod(resRC, ${e[0]})`;const n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[];for(let a=0;a<e.length;a++)r.push(`imod(${n[a]}, ${e[a]})`);return r.join()}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */(e);this.userCode=`\n      void main() {\n        ${r} resRC = getOutputCoords();\n        setOutput(getA(${a}));\n      }\n    `}}function Yj(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reps:s}=r;if("string"===a.dtype||a.shape.length>5){const e=n.readSync(a.dataId),t="string"===a.dtype?e.map((e=>Yd(e))):e,r=uf(a.shape,a.dtype,t),i=KB(r,s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}const i=new Jj(a.shape,s);return n.runWebGLProgram(i,[a],a.dtype)}const eq={kernelName:Pc,backendName:"webgl",kernelFunc:Yj};class tq{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=e,this.userCode="\n       void main() {\n         ivec2 coords = getOutputCoords();\n         int batch = coords[0];\n         int elemIdx = coords[1];\n\n         // We compare elements pair-wise within a group of size 2 * inc.\n         // The comparing rule for each group alternates between ascending\n         // and descending. Within each group, we compare each pair at\n         // positions i and i+inc. To decide whether an element at position i\n         // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n         // inc, it is in the first half of the group, we denote it as x0,\n         // otherwise we denote it as x1.\n         // For example, as shown in the Bitonic top K paper referenced above,\n         // Figure5(a) shows that element[1] is in the\n         // second half of the group when group size is 2, but it is in the\n         // first half of the group when group size is 4.\n\n         bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;\n         int i = isFirstInPair ? elemIdx : elemIdx - inc;\n\n         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n         int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));\n         float x0 = i0 < n ? getX(batch, i0) : negativeInf;\n         float x1 = i1 < n ? getX(batch, i1) : negativeInf;\n\n         // Denotes which direction indices are in (ascending or descending).\n         bool reverse = imod(elemIdx, 2 * dir) >= dir;\n         bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n         if (reverse == isGreater) { // Elements in opposite order of direction\n           int iTemp = i0;\n           i0 = i1;\n           i1 = iTemp;\n         }\n         if (isFirstInPair) {\n            setOutput(float(i0));\n         } else {\n            setOutput(float(i1));\n         }\n       }\n     "}}class nq{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=e,this.userCode="\n    void main() {\n         // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...\n         ivec2 coords = getOutputCoords();\n         int batch = coords[0];\n         int elemIdx = coords[1];\n\n         // The output size is half of the previous size.\n         // If the previous sequence is | | | | _ _ _ _  | | | |  _ _ _ _ (k=4),\n         // we only need to output the indices at positions |, the indices at\n         // positions _ can be thrown away, see Figure5(b) After Phase 2\n         // (Merge phase) in the Bitonic Top K paper referenced above.\n         // For example, the paper shows we only need to output the orange bars.\n         // The output sequence should look like this | | | | | | | |.\n         // Because the sequence is halved, to map the output index back\n         // to the previous sequence to find the corresponding value,\n         // we need to double the index. When we double the index,\n         // we basically interpolate a position, so 2i looks like\n         // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position\n         // of each 2k positions by - elemIdx % k. E.g. for output at\n         // index 4,5,6,7, we want to get the corresponding element at\n         // original index 8,9,10,11, for output at index 8,9,10,11,\n         // we want to get the corresponding element at original index\n         // 16,17,18,19, so on and so forth.\n\n         int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));\n         int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n         int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));\n\n         float x0 = getX(batch, i0);\n         float x1 = i1 < n ? getX(batch, i1) : x0;\n\n         setOutput(x0 >= x1 ? float(i0) : float(i1));\n       }\n     "}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */function rq(e,t){null!==t&&e.disposeIntermediateTensorInfo(t)}function aq(e){let t=1;for(;t<e;)t*=2;return t}const sq={kernelName:zc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{k:s,sorted:i}=r,o=Do().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),l=Do().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"),u=a.shape,c=u[u.length-1];if(n.shouldExecuteOnCPU([a])||c<o||s>l){const e=n.readSync(a.dataId),[t,r]=JB(e,u,a.dtype,s,i);return[n.makeTensorInfo(t.shape,t.dtype,t.values),n.makeTensorInfo(r.shape,r.dtype,r.values)]}if(0===s)return u[u.length-1]=0,[n.makeTensorInfo(u,a.dtype,[]),n.makeTensorInfo(u,"int32",[])];if(1===c)return[a,MV({attrs:{shape:u,dtype:"int32",value:0},backend:n})];const d=n.texData.get(a.dataId),h=null!==d&&d.isPacked,p=h?n.unpackTensor(a):a,f=Ji(u)/c,m=jP({inputs:{x:p},attrs:{shape:[f,c]},backend:n});h&&rq(n,p);const g=aq(s),y=aq(c);let b=null;const v=()=>null===b?[m,m]:[m,b],A=(e,t,r)=>{const a=v(),s=new tq(r),i=[[c],[null===b?1:0],[Number.NEGATIVE_INFINITY],[e],[t]],o=b;b=n.runWebGLProgram(s,a,"int32",i),rq(n,o)};for(let C=1;C<g;C*=2){const e=2*C;for(let t=C;t>=1;t/=2)A(e,t,[f,y])}for(let C=y;C>g;C/=2){const e=v(),t=new nq([f,C/2]),r=[[c],[null===b?1:0],[g]],a=b;b=n.runWebGLProgram(t,e,"int32",r),rq(n,a);const s=g/2,i=2*s;for(let n=s;n>=1;n/=2)A(i,n,b.shape)}let x=b;b=Jz({inputs:{x:b},backend:n,attrs:{begin:0,size:[f,s]}}),rq(n,x);let k=nU({inputs:{x:m,indices:b},backend:n,attrs:{axis:1,batchDims:1}});rq(n,m);const w=u.slice(0,-1);w.push(s),x=b,b=jP({inputs:{x:b},attrs:{shape:w},backend:n}),rq(n,x);const S=k;return k=jP({inputs:{x:k},attrs:{shape:w},backend:n}),rq(n,S),[k,b]}};
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class iq{constructor(e,t,n,r,a,s){this.variableNames=["Image","Transforms"],this.outputShape=s;const i="nearest"===n?1:2;let o;switch(r){case"constant":default:o=1;break;case"reflect":o=2;break;case"wrap":o=3;break;case"nearest":o=4}this.userCode=`\n            float mapCoord(float outCoord, float len) {\n              float inCoord = outCoord;\n              if(${o} == 2) {\n                if (inCoord < 0.0) {\n                  if (len <= 1.0) {\n                    inCoord = 0.0;\n                  } else {\n                    float sz2 = 2.0 * len;\n                    if (inCoord < sz2) {\n                      inCoord = sz2 * float(int(float(-inCoord / sz2))) +\n                      inCoord;\n                    }\n                    inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;\n                  }\n                } else if (inCoord > len - 1.0) {\n                  if (len <= 1.0) {\n                    inCoord = 0.0;\n                  } else {\n                    float sz2 = 2.0 * len;\n                    inCoord -= sz2 * float(int(float(inCoord / sz2)));\n                    if (inCoord >= len) {\n                      inCoord = sz2 - inCoord - 1.0;\n                    }\n                  }\n                }\n                return clamp(inCoord, 0.0, len - 1.0);\n              } else if (${o} == 3) {\n                if (inCoord < 0.0) {\n                  if (len <= 1.0) {\n                    inCoord = 0.0;\n                  } else {\n                    float sz = len - 1.0;\n                    inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);\n                  }\n                } else if (inCoord > len - 1.0) {\n                  if (len <= 1.0) {\n                    inCoord = 0.0;\n                  } else {\n                    float sz = len - 1.0;\n                    inCoord -= len * float(int(float(inCoord / sz)));\n                  }\n                }\n                return clamp(inCoord, 0.0, len - 1.0);\n              } else if (${o} == 4) {\n                return clamp(outCoord, 0.0, len - 1.0);\n              } else {\n                return outCoord;\n              }\n            }\n\n            float readWithFillValue(int batch, int coordY, int coordX,\n              int channel) {\n              float outputValue;\n              if (0 <= coordY && coordY < ${e} && 0 <= coordX && coordX < ${t}) {\n                  outputValue = getImage(batch, coordY, coordX, channel);\n              } else {\n                outputValue = float(${a});\n              }\n              return outputValue;\n            }\n\n            void main() {\n              ivec4 coords = getOutputCoords();\n              float outputValue;\n              int batch = coords[0];\n              int x = coords[2];\n              int y = coords[1];\n              int channel = coords[3];\n              float xf = float(x);\n              float yf = float(y);\n              float a1 = getTransforms(batch, 0);\n              float a2 = getTransforms(batch, 1);\n              float a3 = getTransforms(batch, 2);\n              float b1 = getTransforms(batch, 3);\n              float b2 = getTransforms(batch, 4);\n              float b3 = getTransforms(batch, 5);\n              float c1 = getTransforms(batch, 6);\n              float c2 = getTransforms(batch, 7);\n              float projection = c1 * xf + c2 * yf + 1.0;\n              if (projection == 0.0) {\n                outputValue = float(${a});\n              } else {\n                float inX = (a1 * xf + a2 * yf + a3) / projection;\n                float inY = (b1 * xf + b2 * yf + b3) / projection;\n                float mapX = mapCoord(inX, float(${t}));\n                float mapY = mapCoord(inY, float(${e}));\n\n                if (${i} == 1) {\n                  int coordY = int(round(mapY));\n                  int coordX = int(round(mapX));\n                  outputValue = readWithFillValue(batch, coordY, coordX,\n                    channel);\n                } else {\n                  float yFloor = floor(mapY);\n                  float xFloor = floor(mapX);\n                  float yCeil = yFloor + 1.0;\n                  float xCeil = xFloor + 1.0;\n                  float valueYFloor = (xCeil - mapX) *\n                  readWithFillValue(batch, int(yFloor), int(xFloor), channel) +\n                  (mapX - xFloor) *\n                  readWithFillValue(batch, int(yFloor), int(xCeil), channel);\n                  float valueYCeil = (xCeil - mapX) *\n                  readWithFillValue(batch, int(yCeil), int(xFloor), channel) +\n                  (mapX - xFloor) *\n                  readWithFillValue(batch, int(yCeil), int(xCeil), channel);\n                  outputValue = (yCeil - mapY) * valueYFloor +\n                  (mapY - yFloor) * valueYCeil;\n                }\n              }\n              setOutput(outputValue);\n            }\n        `}}
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const oq={kernelName:Gc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{image:a,transforms:s}=t,{interpolation:i,fillMode:o,fillValue:l,outputShape:u}=r,[c,d,h,p]=a.shape,[f,m]=null!=u?u:[d,h],g=new iq(d,h,i,o,l,[c,f,m,p]);return n.runWebGLProgram(g,[a,s],"float32")}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const lq={kernelName:Uc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,attrs:n,backend:r}=e,{axis:a}=n,{x:s}=t;mL(s,"unique");const i=r.readSync(s.dataId),{outputValues:o,outputShape:l,indices:u}=eP(i,a,s.shape,s.dtype);return[r.makeTensorInfo(l,s.dtype,o),r.makeTensorInfo([u.length],"int32",u)]}};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const uq={kernelName:Hc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{value:a}=t;let{axis:s}=r;s<0&&(s+=a.shape.length);const i=a,o=i.shape.length,l=a.shape[s],u=new Array(o-1);let c=0;for(let m=0;m<o;m++)m!==s&&(u[c++]=i.shape[m]);const d=[],h=new Array(o).fill(0),p=i.shape.slice();p[s]=1;const f=new Array(l);for(let m=0;m<f.length;m++){h[s]=m;const e=Jz({inputs:{x:i},backend:n,attrs:{begin:h,size:p}}),t=jP({inputs:{x:e},backend:n,attrs:{shape:u}});f[m]=t,d.push(e)}return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),f}};
/**
 * @license
 * Copyright 2018 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */class cq{constructor(e,t){this.variableNames=["x","segmentIds"];const n=e.windowSize,r=e.batchSize,a=e.inSize,s=e.numSegments,i=s*Math.ceil(a/n);this.outputShape=[r,i];const o=4*Math.floor(n/4),l=n%4,u="\n        sumValue += dot(values, segFilter);\n    ";let c="";a%n>0&&(c=`\n        if (inIdx < 0 || inIdx >= ${a}) {\n          return initializationValue;\n        }\n      `);let d="";a%n>0&&(d=`\n        if (inIdx < 0 || inIdx >= ${a}) {\n          return -1.0;\n        }\n      `),this.userCode=`\n      const float initializationValue = 0.0;\n\n      float getValue(int batch, int inIdx) {\n        ${c}\n        return getX(batch, inIdx);\n      }\n\n      float getSegmentIdAtIndex(int inIdx) {\n        ${d}\n        return getSegmentIds(inIdx);\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = int(floor(float(outIdx) / float(\n          ${s})) * float(${n}));\n        int currentSeg = int(mod(float(outIdx), float(${s})));\n\n        float sumValue = 0.0;\n\n        for (int i = 0; i < ${o}; i += 4) {\n          int inIdx = inOffset + i;\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n          );\n\n          ${u}\n        }\n\n        int inIdx = inOffset + ${o};\n        if (${1===l}) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            initializationValue,\n            initializationValue,\n            initializationValue\n          );\n\n          int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            0,\n            0,\n            0\n          );\n\n          ${u}\n        } else if (${2===l}) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            initializationValue,\n            initializationValue\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n              0,\n              0\n          );\n\n          ${u}\n        } else if (${3===l}) {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            initializationValue\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n            0\n          );\n\n          ${u}\n        }\n        setOutput(sumValue);\n      }\n    `}}
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const dq={kernelName:jc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,segmentIds:s}=t,{numSegments:i}=r,o=a.shape.length,l=[];let u=0;const c=Zm([u],o);let d=a;null!=c&&(d=nz({inputs:{x:a},backend:n,attrs:{perm:c}}),l.push(d),u=Jm(1,o)[0]);const h=Ik(d.shape,u,i),p=Ji([d.shape[u]]),f=jP({inputs:{x:d},backend:n,attrs:{shape:[-1,p]}});l.push(f);const m=Th(a.dtype),g=(e,t,r,a,s)=>{const i=e.shape[0],o=e.shape[1],u=Ck(o,s),c=new cq({windowSize:u,inSize:o,batchSize:i,numSegments:s},t),d=n.compileAndRun(c,[e,r],a);if(l.push(d),d.shape[1]===s)return d;const h=OH({backend:n,attrs:{start:0,stop:s,step:1,dtype:"float32"}}),p=Yj({inputs:{x:h},backend:n,attrs:{reps:[o/u]}});l.push(h),l.push(p);return g(d,t,p,a,s)},y=jP({inputs:{x:g(f,"unsortedSegmentSum",s,m,i)},backend:n,attrs:{shape:h}});let b=y;if(null!=c){l.push(y);const e=Km(c);b=nz({inputs:{x:b},backend:n,attrs:{perm:e}})}return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),b}},hq=[sz,oz,uz,dz,fz,yz,bz,vz,Cz,Iz,_z,Nz,Rz,Oz,Dz,Bz,Pz,Vz,Uz,Hz,Qz,eG,tG,nG,rG,lG,dG,fG,_P,yG,CG,$G,LG,PG,zG,GG,VG,HG,qG,XG,nV,rV,aV,iV,uV,hV,pV,mV,yV,bV,AV,xV,wV,CV,WV,TV,RV,FV,LV,PV,VV,HV,QV,KV,JV,eU,rU,sU,oU,IP,lU,kG,cU,hU,fU,EP,gU,bU,vU,xU,wU,CU,WU,TU,RU,OU,DU,LU,BU,PU,VU,UU,HU,jU,qU,XU,JU,eH,uH,HP,dH,pH,mH,yH,sG,vH,kH,wH,WH,TH,OP,NH,EH,RH,$H,FH,oG,rH,MH,BH,zH,qP,UH,jH,XH,KH,ej,nj,aj,ij,uj,dj,pj,mj,yj,vj,xj,wj,Yz,lH,Cj,Ij,Wj,_j,Tj,Nj,Ej,Rj,Fj,Dj,Bj,Pj,zj,Vj,Uj,Hj,jj,iH,tz,Qj,Zj,Kj,eq,sq,oq,rz,lq,uq,dq,xH];
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */for(const t of hq)id(t);
/**
    * @license
    * Copyright 2023 Google LLC. All Rights Reserved.
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *
    * http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    * =============================================================================
    */function pq(e,t,n,r){return new(n||(n=Promise))((function(a,s){function i(e){try{l(r.next(e))}catch(t){s(t)}}function o(e){try{l(r.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,o)}l((r=r.apply(e,t||[])).next())}))}function fq(e,t){var n,r,a,s,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(o){s=[6,o],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,o])}}}var mq={0:"tench, Tinca tinca",1:"goldfish, Carassius auratus",2:"great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",3:"tiger shark, Galeocerdo cuvieri",4:"hammerhead, hammerhead shark",5:"electric ray, crampfish, numbfish, torpedo",6:"stingray",7:"cock",8:"hen",9:"ostrich, Struthio camelus",10:"brambling, Fringilla montifringilla",11:"goldfinch, Carduelis carduelis",12:"house finch, linnet, Carpodacus mexicanus",13:"junco, snowbird",14:"indigo bunting, indigo finch, indigo bird, Passerina cyanea",15:"robin, American robin, Turdus migratorius",16:"bulbul",17:"jay",18:"magpie",19:"chickadee",20:"water ouzel, dipper",21:"kite",22:"bald eagle, American eagle, Haliaeetus leucocephalus",23:"vulture",24:"great grey owl, great gray owl, Strix nebulosa",25:"European fire salamander, Salamandra salamandra",26:"common newt, Triturus vulgaris",27:"eft",28:"spotted salamander, Ambystoma maculatum",29:"axolotl, mud puppy, Ambystoma mexicanum",30:"bullfrog, Rana catesbeiana",31:"tree frog, tree-frog",32:"tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",33:"loggerhead, loggerhead turtle, Caretta caretta",34:"leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",35:"mud turtle",36:"terrapin",37:"box turtle, box tortoise",38:"banded gecko",39:"common iguana, iguana, Iguana iguana",40:"American chameleon, anole, Anolis carolinensis",41:"whiptail, whiptail lizard",42:"agama",43:"frilled lizard, Chlamydosaurus kingi",44:"alligator lizard",45:"Gila monster, Heloderma suspectum",46:"green lizard, Lacerta viridis",47:"African chameleon, Chamaeleo chamaeleon",48:"Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",49:"African crocodile, Nile crocodile, Crocodylus niloticus",50:"American alligator, Alligator mississipiensis",51:"triceratops",52:"thunder snake, worm snake, Carphophis amoenus",53:"ringneck snake, ring-necked snake, ring snake",54:"hognose snake, puff adder, sand viper",55:"green snake, grass snake",56:"king snake, kingsnake",57:"garter snake, grass snake",58:"water snake",59:"vine snake",60:"night snake, Hypsiglena torquata",61:"boa constrictor, Constrictor constrictor",62:"rock python, rock snake, Python sebae",63:"Indian cobra, Naja naja",64:"green mamba",65:"sea snake",66:"horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",67:"diamondback, diamondback rattlesnake, Crotalus adamanteus",68:"sidewinder, horned rattlesnake, Crotalus cerastes",69:"trilobite",70:"harvestman, daddy longlegs, Phalangium opilio",71:"scorpion",72:"black and gold garden spider, Argiope aurantia",73:"barn spider, Araneus cavaticus",74:"garden spider, Aranea diademata",75:"black widow, Latrodectus mactans",76:"tarantula",77:"wolf spider, hunting spider",78:"tick",79:"centipede",80:"black grouse",81:"ptarmigan",82:"ruffed grouse, partridge, Bonasa umbellus",83:"prairie chicken, prairie grouse, prairie fowl",84:"peacock",85:"quail",86:"partridge",87:"African grey, African gray, Psittacus erithacus",88:"macaw",89:"sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",90:"lorikeet",91:"coucal",92:"bee eater",93:"hornbill",94:"hummingbird",95:"jacamar",96:"toucan",97:"drake",98:"red-breasted merganser, Mergus serrator",99:"goose",100:"black swan, Cygnus atratus",101:"tusker",102:"echidna, spiny anteater, anteater",103:"platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",104:"wallaby, brush kangaroo",105:"koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",106:"wombat",107:"jelly fish",108:"sea anemone, anemone",109:"brain coral",110:"flatworm, platyhelminth",111:"nematode, nematode worm, roundworm",112:"conch",113:"snail",114:"slug",115:"sea slug, nudibranch",116:"chiton, coat-of-mail shell, sea cradle, polyplacophore",117:"chambered nautilus, pearly nautilus, nautilus",118:"Dungeness crab, Cancer magister",119:"rock crab, Cancer irroratus",120:"fiddler crab",121:"king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",122:"American lobster, Northern lobster, Maine lobster, Homarus americanus",123:"spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",124:"crayfish, crawfish, crawdad, crawdaddy",125:"hermit crab",126:"isopod",127:"white stork, Ciconia ciconia",128:"black stork, Ciconia nigra",129:"spoonbill",130:"flamingo",131:"little blue heron, Egretta caerulea",132:"American egret, great white heron, Egretta albus",133:"bittern",134:"crane",135:"limpkin, Aramus pictus",136:"European gallinule, Porphyrio porphyrio",137:"American coot, marsh hen, mud hen, water hen, Fulica americana",138:"bustard",139:"ruddy turnstone, Arenaria interpres",140:"red-backed sandpiper, dunlin, Erolia alpina",141:"redshank, Tringa totanus",142:"dowitcher",143:"oystercatcher, oyster catcher",144:"pelican",145:"king penguin, Aptenodytes patagonica",146:"albatross, mollymawk",147:"grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",148:"killer whale, killer, orca, grampus, sea wolf, Orcinus orca",149:"dugong, Dugong dugon",150:"sea lion",151:"Chihuahua",152:"Japanese spaniel",153:"Maltese dog, Maltese terrier, Maltese",154:"Pekinese, Pekingese, Peke",155:"Shih-Tzu",156:"Blenheim spaniel",157:"papillon",158:"toy terrier",159:"Rhodesian ridgeback",160:"Afghan hound, Afghan",161:"basset, basset hound",162:"beagle",163:"bloodhound, sleuthhound",164:"bluetick",165:"black-and-tan coonhound",166:"Walker hound, Walker foxhound",167:"English foxhound",168:"redbone",169:"borzoi, Russian wolfhound",170:"Irish wolfhound",171:"Italian greyhound",172:"whippet",173:"Ibizan hound, Ibizan Podenco",174:"Norwegian elkhound, elkhound",175:"otterhound, otter hound",176:"Saluki, gazelle hound",177:"Scottish deerhound, deerhound",178:"Weimaraner",179:"Staffordshire bullterrier, Staffordshire bull terrier",180:"American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",181:"Bedlington terrier",182:"Border terrier",183:"Kerry blue terrier",184:"Irish terrier",185:"Norfolk terrier",186:"Norwich terrier",187:"Yorkshire terrier",188:"wire-haired fox terrier",189:"Lakeland terrier",190:"Sealyham terrier, Sealyham",191:"Airedale, Airedale terrier",192:"cairn, cairn terrier",193:"Australian terrier",194:"Dandie Dinmont, Dandie Dinmont terrier",195:"Boston bull, Boston terrier",196:"miniature schnauzer",197:"giant schnauzer",198:"standard schnauzer",199:"Scotch terrier, Scottish terrier, Scottie",200:"Tibetan terrier, chrysanthemum dog",201:"silky terrier, Sydney silky",202:"soft-coated wheaten terrier",203:"West Highland white terrier",204:"Lhasa, Lhasa apso",205:"flat-coated retriever",206:"curly-coated retriever",207:"golden retriever",208:"Labrador retriever",209:"Chesapeake Bay retriever",210:"German short-haired pointer",211:"vizsla, Hungarian pointer",212:"English setter",213:"Irish setter, red setter",214:"Gordon setter",215:"Brittany spaniel",216:"clumber, clumber spaniel",217:"English springer, English springer spaniel",218:"Welsh springer spaniel",219:"cocker spaniel, English cocker spaniel, cocker",220:"Sussex spaniel",221:"Irish water spaniel",222:"kuvasz",223:"schipperke",224:"groenendael",225:"malinois",226:"briard",227:"kelpie",228:"komondor",229:"Old English sheepdog, bobtail",230:"Shetland sheepdog, Shetland sheep dog, Shetland",231:"collie",232:"Border collie",233:"Bouvier des Flandres, Bouviers des Flandres",234:"Rottweiler",235:"German shepherd, German shepherd dog, German police dog, alsatian",236:"Doberman, Doberman pinscher",237:"miniature pinscher",238:"Greater Swiss Mountain dog",239:"Bernese mountain dog",240:"Appenzeller",241:"EntleBucher",242:"boxer",243:"bull mastiff",244:"Tibetan mastiff",245:"French bulldog",246:"Great Dane",247:"Saint Bernard, St Bernard",248:"Eskimo dog, husky",249:"malamute, malemute, Alaskan malamute",250:"Siberian husky",251:"dalmatian, coach dog, carriage dog",252:"affenpinscher, monkey pinscher, monkey dog",253:"basenji",254:"pug, pug-dog",255:"Leonberg",256:"Newfoundland, Newfoundland dog",257:"Great Pyrenees",258:"Samoyed, Samoyede",259:"Pomeranian",260:"chow, chow chow",261:"keeshond",262:"Brabancon griffon",263:"Pembroke, Pembroke Welsh corgi",264:"Cardigan, Cardigan Welsh corgi",265:"toy poodle",266:"miniature poodle",267:"standard poodle",268:"Mexican hairless",269:"timber wolf, grey wolf, gray wolf, Canis lupus",270:"white wolf, Arctic wolf, Canis lupus tundrarum",271:"red wolf, maned wolf, Canis rufus, Canis niger",272:"coyote, prairie wolf, brush wolf, Canis latrans",273:"dingo, warrigal, warragal, Canis dingo",274:"dhole, Cuon alpinus",275:"African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",276:"hyena, hyaena",277:"red fox, Vulpes vulpes",278:"kit fox, Vulpes macrotis",279:"Arctic fox, white fox, Alopex lagopus",280:"grey fox, gray fox, Urocyon cinereoargenteus",281:"tabby, tabby cat",282:"tiger cat",283:"Persian cat",284:"Siamese cat, Siamese",285:"Egyptian cat",286:"cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",287:"lynx, catamount",288:"leopard, Panthera pardus",289:"snow leopard, ounce, Panthera uncia",290:"jaguar, panther, Panthera onca, Felis onca",291:"lion, king of beasts, Panthera leo",292:"tiger, Panthera tigris",293:"cheetah, chetah, Acinonyx jubatus",294:"brown bear, bruin, Ursus arctos",295:"American black bear, black bear, Ursus americanus, Euarctos americanus",296:"ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",297:"sloth bear, Melursus ursinus, Ursus ursinus",298:"mongoose",299:"meerkat, mierkat",300:"tiger beetle",301:"ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",302:"ground beetle, carabid beetle",303:"long-horned beetle, longicorn, longicorn beetle",304:"leaf beetle, chrysomelid",305:"dung beetle",306:"rhinoceros beetle",307:"weevil",308:"fly",309:"bee",310:"ant, emmet, pismire",311:"grasshopper, hopper",312:"cricket",313:"walking stick, walkingstick, stick insect",314:"cockroach, roach",315:"mantis, mantid",316:"cicada, cicala",317:"leafhopper",318:"lacewing, lacewing fly",319:"dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",320:"damselfly",321:"admiral",322:"ringlet, ringlet butterfly",323:"monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",324:"cabbage butterfly",325:"sulphur butterfly, sulfur butterfly",326:"lycaenid, lycaenid butterfly",327:"starfish, sea star",328:"sea urchin",329:"sea cucumber, holothurian",330:"wood rabbit, cottontail, cottontail rabbit",331:"hare",332:"Angora, Angora rabbit",333:"hamster",334:"porcupine, hedgehog",335:"fox squirrel, eastern fox squirrel, Sciurus niger",336:"marmot",337:"beaver",338:"guinea pig, Cavia cobaya",339:"sorrel",340:"zebra",341:"hog, pig, grunter, squealer, Sus scrofa",342:"wild boar, boar, Sus scrofa",343:"warthog",344:"hippopotamus, hippo, river horse, Hippopotamus amphibius",345:"ox",346:"water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",347:"bison",348:"ram, tup",349:"bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",350:"ibex, Capra ibex",351:"hartebeest",352:"impala, Aepyceros melampus",353:"gazelle",354:"Arabian camel, dromedary, Camelus dromedarius",355:"llama",356:"weasel",357:"mink",358:"polecat, fitch, foulmart, foumart, Mustela putorius",359:"black-footed ferret, ferret, Mustela nigripes",360:"otter",361:"skunk, polecat, wood pussy",362:"badger",363:"armadillo",364:"three-toed sloth, ai, Bradypus tridactylus",365:"orangutan, orang, orangutang, Pongo pygmaeus",366:"gorilla, Gorilla gorilla",367:"chimpanzee, chimp, Pan troglodytes",368:"gibbon, Hylobates lar",369:"siamang, Hylobates syndactylus, Symphalangus syndactylus",370:"guenon, guenon monkey",371:"patas, hussar monkey, Erythrocebus patas",372:"baboon",373:"macaque",374:"langur",375:"colobus, colobus monkey",376:"proboscis monkey, Nasalis larvatus",377:"marmoset",378:"capuchin, ringtail, Cebus capucinus",379:"howler monkey, howler",380:"titi, titi monkey",381:"spider monkey, Ateles geoffroyi",382:"squirrel monkey, Saimiri sciureus",383:"Madagascar cat, ring-tailed lemur, Lemur catta",384:"indri, indris, Indri indri, Indri brevicaudatus",385:"Indian elephant, Elephas maximus",386:"African elephant, Loxodonta africana",387:"lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",388:"giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",389:"barracouta, snoek",390:"eel",391:"coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",392:"rock beauty, Holocanthus tricolor",393:"anemone fish",394:"sturgeon",395:"gar, garfish, garpike, billfish, Lepisosteus osseus",396:"lionfish",397:"puffer, pufferfish, blowfish, globefish",398:"abacus",399:"abaya",400:"academic gown, academic robe, judge's robe",401:"accordion, piano accordion, squeeze box",402:"acoustic guitar",403:"aircraft carrier, carrier, flattop, attack aircraft carrier",404:"airliner",405:"airship, dirigible",406:"altar",407:"ambulance",408:"amphibian, amphibious vehicle",409:"analog clock",410:"apiary, bee house",411:"apron",412:"ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",413:"assault rifle, assault gun",414:"backpack, back pack, knapsack, packsack, rucksack, haversack",415:"bakery, bakeshop, bakehouse",416:"balance beam, beam",417:"balloon",418:"ballpoint, ballpoint pen, ballpen, Biro",419:"Band Aid",420:"banjo",421:"bannister, banister, balustrade, balusters, handrail",422:"barbell",423:"barber chair",424:"barbershop",425:"barn",426:"barometer",427:"barrel, cask",428:"barrow, garden cart, lawn cart, wheelbarrow",429:"baseball",430:"basketball",431:"bassinet",432:"bassoon",433:"bathing cap, swimming cap",434:"bath towel",435:"bathtub, bathing tub, bath, tub",436:"beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",437:"beacon, lighthouse, beacon light, pharos",438:"beaker",439:"bearskin, busby, shako",440:"beer bottle",441:"beer glass",442:"bell cote, bell cot",443:"bib",444:"bicycle-built-for-two, tandem bicycle, tandem",445:"bikini, two-piece",446:"binder, ring-binder",447:"binoculars, field glasses, opera glasses",448:"birdhouse",449:"boathouse",450:"bobsled, bobsleigh, bob",451:"bolo tie, bolo, bola tie, bola",452:"bonnet, poke bonnet",453:"bookcase",454:"bookshop, bookstore, bookstall",455:"bottlecap",456:"bow",457:"bow tie, bow-tie, bowtie",458:"brass, memorial tablet, plaque",459:"brassiere, bra, bandeau",460:"breakwater, groin, groyne, mole, bulwark, seawall, jetty",461:"breastplate, aegis, egis",462:"broom",463:"bucket, pail",464:"buckle",465:"bulletproof vest",466:"bullet train, bullet",467:"butcher shop, meat market",468:"cab, hack, taxi, taxicab",469:"caldron, cauldron",470:"candle, taper, wax light",471:"cannon",472:"canoe",473:"can opener, tin opener",474:"cardigan",475:"car mirror",476:"carousel, carrousel, merry-go-round, roundabout, whirligig",477:"carpenter's kit, tool kit",478:"carton",479:"car wheel",480:"cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",481:"cassette",482:"cassette player",483:"castle",484:"catamaran",485:"CD player",486:"cello, violoncello",487:"cellular telephone, cellular phone, cellphone, cell, mobile phone",488:"chain",489:"chainlink fence",490:"chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",491:"chain saw, chainsaw",492:"chest",493:"chiffonier, commode",494:"chime, bell, gong",495:"china cabinet, china closet",496:"Christmas stocking",497:"church, church building",498:"cinema, movie theater, movie theatre, movie house, picture palace",499:"cleaver, meat cleaver, chopper",500:"cliff dwelling",501:"cloak",502:"clog, geta, patten, sabot",503:"cocktail shaker",504:"coffee mug",505:"coffeepot",506:"coil, spiral, volute, whorl, helix",507:"combination lock",508:"computer keyboard, keypad",509:"confectionery, confectionary, candy store",510:"container ship, containership, container vessel",511:"convertible",512:"corkscrew, bottle screw",513:"cornet, horn, trumpet, trump",514:"cowboy boot",515:"cowboy hat, ten-gallon hat",516:"cradle",517:"crane",518:"crash helmet",519:"crate",520:"crib, cot",521:"Crock Pot",522:"croquet ball",523:"crutch",524:"cuirass",525:"dam, dike, dyke",526:"desk",527:"desktop computer",528:"dial telephone, dial phone",529:"diaper, nappy, napkin",530:"digital clock",531:"digital watch",532:"dining table, board",533:"dishrag, dishcloth",534:"dishwasher, dish washer, dishwashing machine",535:"disk brake, disc brake",536:"dock, dockage, docking facility",537:"dogsled, dog sled, dog sleigh",538:"dome",539:"doormat, welcome mat",540:"drilling platform, offshore rig",541:"drum, membranophone, tympan",542:"drumstick",543:"dumbbell",544:"Dutch oven",545:"electric fan, blower",546:"electric guitar",547:"electric locomotive",548:"entertainment center",549:"envelope",550:"espresso maker",551:"face powder",552:"feather boa, boa",553:"file, file cabinet, filing cabinet",554:"fireboat",555:"fire engine, fire truck",556:"fire screen, fireguard",557:"flagpole, flagstaff",558:"flute, transverse flute",559:"folding chair",560:"football helmet",561:"forklift",562:"fountain",563:"fountain pen",564:"four-poster",565:"freight car",566:"French horn, horn",567:"frying pan, frypan, skillet",568:"fur coat",569:"garbage truck, dustcart",570:"gasmask, respirator, gas helmet",571:"gas pump, gasoline pump, petrol pump, island dispenser",572:"goblet",573:"go-kart",574:"golf ball",575:"golfcart, golf cart",576:"gondola",577:"gong, tam-tam",578:"gown",579:"grand piano, grand",580:"greenhouse, nursery, glasshouse",581:"grille, radiator grille",582:"grocery store, grocery, food market, market",583:"guillotine",584:"hair slide",585:"hair spray",586:"half track",587:"hammer",588:"hamper",589:"hand blower, blow dryer, blow drier, hair dryer, hair drier",590:"hand-held computer, hand-held microcomputer",591:"handkerchief, hankie, hanky, hankey",592:"hard disc, hard disk, fixed disk",593:"harmonica, mouth organ, harp, mouth harp",594:"harp",595:"harvester, reaper",596:"hatchet",597:"holster",598:"home theater, home theatre",599:"honeycomb",600:"hook, claw",601:"hoopskirt, crinoline",602:"horizontal bar, high bar",603:"horse cart, horse-cart",604:"hourglass",605:"iPod",606:"iron, smoothing iron",607:"jack-o'-lantern",608:"jean, blue jean, denim",609:"jeep, landrover",610:"jersey, T-shirt, tee shirt",611:"jigsaw puzzle",612:"jinrikisha, ricksha, rickshaw",613:"joystick",614:"kimono",615:"knee pad",616:"knot",617:"lab coat, laboratory coat",618:"ladle",619:"lampshade, lamp shade",620:"laptop, laptop computer",621:"lawn mower, mower",622:"lens cap, lens cover",623:"letter opener, paper knife, paperknife",624:"library",625:"lifeboat",626:"lighter, light, igniter, ignitor",627:"limousine, limo",628:"liner, ocean liner",629:"lipstick, lip rouge",630:"Loafer",631:"lotion",632:"loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",633:"loupe, jeweler's loupe",634:"lumbermill, sawmill",635:"magnetic compass",636:"mailbag, postbag",637:"mailbox, letter box",638:"maillot",639:"maillot, tank suit",640:"manhole cover",641:"maraca",642:"marimba, xylophone",643:"mask",644:"matchstick",645:"maypole",646:"maze, labyrinth",647:"measuring cup",648:"medicine chest, medicine cabinet",649:"megalith, megalithic structure",650:"microphone, mike",651:"microwave, microwave oven",652:"military uniform",653:"milk can",654:"minibus",655:"miniskirt, mini",656:"minivan",657:"missile",658:"mitten",659:"mixing bowl",660:"mobile home, manufactured home",661:"Model T",662:"modem",663:"monastery",664:"monitor",665:"moped",666:"mortar",667:"mortarboard",668:"mosque",669:"mosquito net",670:"motor scooter, scooter",671:"mountain bike, all-terrain bike, off-roader",672:"mountain tent",673:"mouse, computer mouse",674:"mousetrap",675:"moving van",676:"muzzle",677:"nail",678:"neck brace",679:"necklace",680:"nipple",681:"notebook, notebook computer",682:"obelisk",683:"oboe, hautboy, hautbois",684:"ocarina, sweet potato",685:"odometer, hodometer, mileometer, milometer",686:"oil filter",687:"organ, pipe organ",688:"oscilloscope, scope, cathode-ray oscilloscope, CRO",689:"overskirt",690:"oxcart",691:"oxygen mask",692:"packet",693:"paddle, boat paddle",694:"paddlewheel, paddle wheel",695:"padlock",696:"paintbrush",697:"pajama, pyjama, pj's, jammies",698:"palace",699:"panpipe, pandean pipe, syrinx",700:"paper towel",701:"parachute, chute",702:"parallel bars, bars",703:"park bench",704:"parking meter",705:"passenger car, coach, carriage",706:"patio, terrace",707:"pay-phone, pay-station",708:"pedestal, plinth, footstall",709:"pencil box, pencil case",710:"pencil sharpener",711:"perfume, essence",712:"Petri dish",713:"photocopier",714:"pick, plectrum, plectron",715:"pickelhaube",716:"picket fence, paling",717:"pickup, pickup truck",718:"pier",719:"piggy bank, penny bank",720:"pill bottle",721:"pillow",722:"ping-pong ball",723:"pinwheel",724:"pirate, pirate ship",725:"pitcher, ewer",726:"plane, carpenter's plane, woodworking plane",727:"planetarium",728:"plastic bag",729:"plate rack",730:"plow, plough",731:"plunger, plumber's helper",732:"Polaroid camera, Polaroid Land camera",733:"pole",734:"police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",735:"poncho",736:"pool table, billiard table, snooker table",737:"pop bottle, soda bottle",738:"pot, flowerpot",739:"potter's wheel",740:"power drill",741:"prayer rug, prayer mat",742:"printer",743:"prison, prison house",744:"projectile, missile",745:"projector",746:"puck, hockey puck",747:"punching bag, punch bag, punching ball, punchball",748:"purse",749:"quill, quill pen",750:"quilt, comforter, comfort, puff",751:"racer, race car, racing car",752:"racket, racquet",753:"radiator",754:"radio, wireless",755:"radio telescope, radio reflector",756:"rain barrel",757:"recreational vehicle, RV, R.V.",758:"reel",759:"reflex camera",760:"refrigerator, icebox",761:"remote control, remote",762:"restaurant, eating house, eating place, eatery",763:"revolver, six-gun, six-shooter",764:"rifle",765:"rocking chair, rocker",766:"rotisserie",767:"rubber eraser, rubber, pencil eraser",768:"rugby ball",769:"rule, ruler",770:"running shoe",771:"safe",772:"safety pin",773:"saltshaker, salt shaker",774:"sandal",775:"sarong",776:"sax, saxophone",777:"scabbard",778:"scale, weighing machine",779:"school bus",780:"schooner",781:"scoreboard",782:"screen, CRT screen",783:"screw",784:"screwdriver",785:"seat belt, seatbelt",786:"sewing machine",787:"shield, buckler",788:"shoe shop, shoe-shop, shoe store",789:"shoji",790:"shopping basket",791:"shopping cart",792:"shovel",793:"shower cap",794:"shower curtain",795:"ski",796:"ski mask",797:"sleeping bag",798:"slide rule, slipstick",799:"sliding door",800:"slot, one-armed bandit",801:"snorkel",802:"snowmobile",803:"snowplow, snowplough",804:"soap dispenser",805:"soccer ball",806:"sock",807:"solar dish, solar collector, solar furnace",808:"sombrero",809:"soup bowl",810:"space bar",811:"space heater",812:"space shuttle",813:"spatula",814:"speedboat",815:"spider web, spider's web",816:"spindle",817:"sports car, sport car",818:"spotlight, spot",819:"stage",820:"steam locomotive",821:"steel arch bridge",822:"steel drum",823:"stethoscope",824:"stole",825:"stone wall",826:"stopwatch, stop watch",827:"stove",828:"strainer",829:"streetcar, tram, tramcar, trolley, trolley car",830:"stretcher",831:"studio couch, day bed",832:"stupa, tope",833:"submarine, pigboat, sub, U-boat",834:"suit, suit of clothes",835:"sundial",836:"sunglass",837:"sunglasses, dark glasses, shades",838:"sunscreen, sunblock, sun blocker",839:"suspension bridge",840:"swab, swob, mop",841:"sweatshirt",842:"swimming trunks, bathing trunks",843:"swing",844:"switch, electric switch, electrical switch",845:"syringe",846:"table lamp",847:"tank, army tank, armored combat vehicle, armoured combat vehicle",848:"tape player",849:"teapot",850:"teddy, teddy bear",851:"television, television system",852:"tennis ball",853:"thatch, thatched roof",854:"theater curtain, theatre curtain",855:"thimble",856:"thresher, thrasher, threshing machine",857:"throne",858:"tile roof",859:"toaster",860:"tobacco shop, tobacconist shop, tobacconist",861:"toilet seat",862:"torch",863:"totem pole",864:"tow truck, tow car, wrecker",865:"toyshop",866:"tractor",867:"trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",868:"tray",869:"trench coat",870:"tricycle, trike, velocipede",871:"trimaran",872:"tripod",873:"triumphal arch",874:"trolleybus, trolley coach, trackless trolley",875:"trombone",876:"tub, vat",877:"turnstile",878:"typewriter keyboard",879:"umbrella",880:"unicycle, monocycle",881:"upright, upright piano",882:"vacuum, vacuum cleaner",883:"vase",884:"vault",885:"velvet",886:"vending machine",887:"vestment",888:"viaduct",889:"violin, fiddle",890:"volleyball",891:"waffle iron",892:"wall clock",893:"wallet, billfold, notecase, pocketbook",894:"wardrobe, closet, press",895:"warplane, military plane",896:"washbasin, handbasin, washbowl, lavabo, wash-hand basin",897:"washer, automatic washer, washing machine",898:"water bottle",899:"water jug",900:"water tower",901:"whiskey jug",902:"whistle",903:"wig",904:"window screen",905:"window shade",906:"Windsor tie",907:"wine bottle",908:"wing",909:"wok",910:"wooden spoon",911:"wool, woolen, woollen",912:"worm fence, snake fence, snake-rail fence, Virginia fence",913:"wreck",914:"yawl",915:"yurt",916:"web site, website, internet site, site",917:"comic book",918:"crossword puzzle, crossword",919:"street sign",920:"traffic light, traffic signal, stoplight",921:"book jacket, dust cover, dust jacket, dust wrapper",922:"menu",923:"plate",924:"guacamole",925:"consomme",926:"hot pot, hotpot",927:"trifle",928:"ice cream, icecream",929:"ice lolly, lolly, lollipop, popsicle",930:"French loaf",931:"bagel, beigel",932:"pretzel",933:"cheeseburger",934:"hotdog, hot dog, red hot",935:"mashed potato",936:"head cabbage",937:"broccoli",938:"cauliflower",939:"zucchini, courgette",940:"spaghetti squash",941:"acorn squash",942:"butternut squash",943:"cucumber, cuke",944:"artichoke, globe artichoke",945:"bell pepper",946:"cardoon",947:"mushroom",948:"Granny Smith",949:"strawberry",950:"orange",951:"lemon",952:"fig",953:"pineapple, ananas",954:"banana",955:"jackfruit, jak, jack",956:"custard apple",957:"pomegranate",958:"hay",959:"carbonara",960:"chocolate sauce, chocolate syrup",961:"dough",962:"meat loaf, meatloaf",963:"pizza, pizza pie",964:"potpie",965:"burrito",966:"red wine",967:"espresso",968:"cup",969:"eggnog",970:"alp",971:"bubble",972:"cliff, drop, drop-off",973:"coral reef",974:"geyser",975:"lakeside, lakeshore",976:"promontory, headland, head, foreland",977:"sandbar, sand bar",978:"seashore, coast, seacoast, sea-coast",979:"valley, vale",980:"volcano",981:"ballplayer, baseball player",982:"groom, bridegroom",983:"scuba diver",984:"rapeseed",985:"daisy",986:"yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",987:"corn",988:"acorn",989:"hip, rose hip, rosehip",990:"buckeye, horse chestnut, conker",991:"coral fungus",992:"agaric",993:"gyromitra",994:"stinkhorn, carrion fungus",995:"earthstar",996:"hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",997:"bolete",998:"ear, spike, capitulum",999:"toilet tissue, toilet paper, bathroom tissue"},gq=224,yq={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},bq={"1.00":{.25:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_025_224/classification/1",inputRange:[0,1]},"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_050_224/classification/1",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_075_224/classification/1",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1",inputRange:[0,1]}},"2.00":{"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_075_224/classification/2",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2",inputRange:[0,1]}}};function vq(e){return void 0===e&&(e={version:1,alpha:1}),pq(this,void 0,void 0,(function(){var t,n,r,a,s,i,o;return fq(this,(function(l){switch(l.label){case 0:if(null==$k)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");if(t=e.version.toFixed(2),n=e.alpha?e.alpha.toFixed(2):"",r=-1,a=1,null==e.modelUrl){if(!(t in bq))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys(bq));if(!(n in bq[t]))throw new Error("MobileNet constructed with invalid alpha "+e.alpha+". Valid multipliers for this version are: "+Object.keys(bq[t])+".");i=bq[t][n].inputRange,r=i[0],a=i[1]}return null!=e.inputRange&&(o=e.inputRange,r=o[0],a=o[1]),[4,(s=new Aq(t,n,e.modelUrl,r,a)).load()];case 1:return l.sent(),[2,s]}}))}))}var Aq=function(){function e(e,t,n,r,a){void 0===r&&(r=-1),void 0===a&&(a=1),this.version=e,this.alpha=t,this.modelUrl=n,this.inputMin=r,this.inputMax=a,this.normalizationConstant=(a-r)/255}return e.prototype.load=function(){return pq(this,void 0,void 0,(function(){var e,t,n,r,a=this;return fq(this,(function(s){switch(s.label){case 0:return this.modelUrl?(e=this,[4,tE(this.modelUrl)]):[3,2];case 1:return e.model=s.sent(),[3,4];case 2:return t=bq[this.version][this.alpha].url,n=this,[4,tE(t,{fromTFHub:!0})];case 3:n.model=s.sent(),s.label=4;case 4:return[4,(r=lp((function(){return a.model.predict(Zg([1,gq,gq,3]))}))).data()];case 5:return s.sent(),r.dispose(),[2]}}))}))},e.prototype.infer=function(e,t){var n=this;return void 0===t&&(t=!1),lp((function(){e instanceof fh||(e=rx(e));var r=pf(gf(cf(e,"float32"),n.normalizationConstant),n.inputMin),a=r;e.shape[0]===gq&&e.shape[1]===gq||(a=mA.resizeBilinear(r,[gq,gq],!0));var s,i=Hf(a,[-1,gq,gq,3]);if(t){var o=yq[n.version],l=n.model.execute(i,o);s=Eb(l,[1,2])}else{var u=n.model.predict(i);s=Kf(u,[0,1],[-1,1e3])}return s}))},e.prototype.classify=function(e,t){return void 0===t&&(t=3),pq(this,void 0,void 0,(function(){var n,r;return fq(this,(function(a){switch(a.label){case 0:return[4,xq(n=this.infer(e),t)];case 1:return r=a.sent(),n.dispose(),[2,r]}}))}))},e}();function xq(e,t){return pq(this,void 0,void 0,(function(){var n,r,a,s,i,o,l;return fq(this,(function(u){switch(u.label){case 0:return[4,(n=Sb(e)).data()];case 1:for(r=u.sent(),n.dispose(),a=[],l=0;l<r.length;l++)a.push({value:r[l],index:l});for(a.sort((function(e,t){return t.value-e.value})),s=new Float32Array(t),i=new Int32Array(t),l=0;l<t;l++)s[l]=a[l].value,i[l]=a[l].index;for(o=[],l=0;l<i.length;l++)o.push({className:mq[i[l]],probability:s[l]});return[2,o]}}))}))}const kq=["href"],wq={class:"left"},Sq={class:"sub-title"},Cq={key:0},Iq={key:1},Wq={class:"center"},_q=["src"],Tq={class:"right"},Nq={class:"btn-click"},Eq={key:0},Rq={key:1},$q=ye({__name:"temu-ad",props:{imgUrl:String},setup(t){const n=t,r=F(!1),a=F({list:[],score:100,total:100}),s=()=>{r.value=!1,localStorage.setItem("temu-search-image-ad",!0)},i=J((()=>n.imgUrl.startsWith("data:image")?"https://www.geekbi.com/data/goods/hot-sale":`https://www.geekbi.com/data/goods/search?imageUrl=${n.imgUrl}`));return(async()=>{if(localStorage.getItem("temu-search-image-ad"))return;const t=await fetch(n.imgUrl).then((e=>e.blob())).then((e=>new File([e],"image.jpg",{type:"image/jpeg"}))),s=new FormData;s.append("file",await k(t));const i=await e.post("/api/v1/union/search-image/temu",s);0===i.data.code&&(r.value=!0,a.value=i.data.data)})(),(e,t)=>Pe((Ae(),xe("a",{href:i.value,target:"_blank",class:"search-ad"},[ke("div",wq,[t[1]||(t[1]=ke("div",{class:"title"}," 立即升级到专业版 Temu图搜更精准 ",-1)),ke("div",Sq,[t[0]||(t[0]=Se(" 为您搜索到 ")),a.value.total>=80?(Ae(),xe("b",Cq,"100+")):(Ae(),xe("b",Iq,_e(a.value.total)+"个",1)),Se(" 同款商品,最高相似度:"+_e(a.value.score)+"% ",1)])]),ke("div",Wq,[(Ae(!0),xe(D,null,Ce(a.value.list,((e,t)=>(Ae(),xe("img",{key:t,class:"thumb",src:e+"?imageView2/2/w/500/q/60/format/webp"},null,8,_q)))),128))]),ke("div",Tq,[ke("span",Nq,[t[2]||(t[2]=ke("span",{style:{"margin-right":"3px"}},"查看更多同款",-1)),a.value.total>=80?(Ae(),xe("span",Eq,"(100+)")):(Ae(),xe("span",Rq,"("+_e(a.value.total)+")",1))])]),$(Ie(Ve),{class:"close-icon",onClick:Ge(s,["prevent","stop"])})],8,kq)),[[ze,r.value]])}},[["__scopeId","data-v-06c98a1a"]]),Oq={class:"1688-search"},Fq={class:"filter-wrap"},Dq={class:"filter-item"},Mq={class:"label"},Lq={class:"filter-item"},Bq={class:"filter-item"},Pq={class:"list-wrap"},zq=["href"],Gq={class:"info-wrap"},Vq=["src"],Uq={class:"title"},Hq=["innerHTML"],jq={class:"price-wrap"},qq={class:"price"},Qq={class:"prefix"},Xq={key:0,class:"sold"},Zq={key:0,class:"mall-wrap"},Kq=["innerHTML"],Jq=["innerHTML"],Yq={key:0,class:"error-tip"},eQ={class:"left"},tQ={class:"center"},nQ={class:"sub-title"},rQ={class:"right"},aQ=["href"],sQ={key:1,class:"error-tip"},iQ={class:"left"},oQ={class:"center"},lQ={class:"sub-title"},uQ={class:"right"},cQ={key:2,class:"loading-wrap"},dQ={class:"text"},hQ={key:3,style:{padding:"20px"}},pQ={key:4,class:"bottom-tip"},fQ=ye({__name:"temu",props:{imgUrl:{type:String,default:""},title:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(t,{emit:n}){let r=be();const a=t,s=n,d=F(""),h=F(""),p=F(""),f=F([]),m=F(""),g=F("https://www.temu.com/search_result.html?search_key=%E7%82%B9%E5%87%BB%E5%8F%B3%E4%BE%A7%E6%90%9C%E7%B4%A2%E6%8C%89%E9%92%AE%EF%BC%8C%E7%84%B6%E5%90%8E%E5%85%B3%E9%97%AD%E6%AD%A4%E9%A1%B5%E9%9D%A2&search_method=user"),y=F("正在图搜同款"),b=J((()=>p.value?f.value.filter((e=>e.title&&e.title.includes(p.value)||e.location&&e.location.includes(p.value)||e.mall&&e.mall.includes(p.value))):f.value)),v=F(""),A=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>t.similarity-e.similarity)):e.sort(((e,t)=>e.index-t.index)),e),x=e=>{f.value=A([...f.value],e)},k=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)};let w=0,I=120,W="",_=[];const T=async()=>{w=0,I=120,W="",_=[],f.value=[],d.value="",await z()},N=F(!1);"1"===localStorage.getItem("isAi")?N.value=!0:"0"===localStorage.getItem("isAi")&&(N.value=!1);const R=()=>{N.value=!N.value,N.value?(localStorage.setItem("isAi","1"),Ue.info("AI识别已启动,正在重新搜索"),w=0,I=120,W="",_=[],f.value=[],z()):localStorage.setItem("isAi","0")};async function O(e){const t=new Image;t.crossOrigin="anonymous",t.src=e,await t.decode();const n=document.createElement("canvas");n.width=50,n.height=50;n.getContext("2d").drawImage(t,0,0,n.width,n.height);return rx(n).toFloat().expandDims()}let M,L,B;N.value&&vq({version:1,alpha:1,modelUrl:"https://res.geekerp.com/model/mobilenet/model.json"}).then((e=>{M=e}));const P=async(e,t)=>{M||(y.value="正在加载AI模型",M=await vq()),y.value="正在图搜同款(0%)",!L&&(L=await O(e)),!B&&(B=M.infer(L));let n=0;return await Promise.all(t.map((async e=>{const r=await O(e.thumb+"?imageView2/2/w/50/q/50/format/webp"),a=M.infer(r),s=(i=B,o=a,WI(i,o)).dataSync()[0];var i,o;
/**
 * @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */e.similarity=-1*s,n++;const l=parseInt(n/t.length*100);y.value=`正在图搜同款(${l}%)`}))),t=(t=t.sort(((e,t)=>t.similarity-e.similarity))).filter((e=>e.similarity>.75))},z=async()=>{let t;if(d.value="loading",y.value="正在图搜同款",s("update:loading",!0),!r.query.title&&!a.title){let t="",n=1,i=await gn(a.imgUrl,200);i=i.split(",")[1];let l;t=(await e.post("/api/v1/union/search-image/1688-kuajing/upload-image",E.stringify({base64:i}))).data.data.imageId;for(let r=0;r<3;r++)try{if(l=await e.post("/api/v1/union/search-image/1688-kuajing",E.stringify({imageId:t,page:n,size:20})),l.data.data.list.length>0)break}catch(o){}return l?(r.query.title=l.data.data.list[0].subject,void z()):(d.value="error",h.value="受Temu网站限制,Temu图搜同款功能仅支持以下方式使用,请按照下列途径进行搜索:\n1.Temu选品助手插件-商品卡片右上角'图搜同款'\n2.Temu选品助手插件-Temu商品详情页-右上角'相似同款'和'图搜同款'\n3.Temu选品助手网页版-'图搜同款'",void s("update:loading",!1))}if(g.value=`https://www.temu.com/search_result.html?search_key=${r.query.title||a.title}&search_method=user`,t=await pn(r.query.title||a.title,w,I,W),54001===t.data.error_code)return g.value=`https://www.temu.com/bgn_verification.html?VerifyAuthToken=${t.data.verify_auth_token}`,d.value="error",h.value="请通过验证码认证,再返回进行搜索",void s("update:loading",!1);if(t.error_code&&0!==t.error_code||!t.data.success)return d.value="error",h.value="请点击右侧'打开Temu',确认Temu网站能正常搜索,且已通过验证码认证,再返回进行搜索",void s("update:loading",!1);if(!t.data.result.data.goods_list)return d.value="finish",void s("update:loading",!1);if(0===t.data.result.data.goods_list.length)return d.value="finish",void s("update:loading",!1);const n=t.data.result.data.goods_list.filter((e=>!_.find((t=>t==e.goods_id))));_=_.concat(n.map((e=>e.goods_id))),W=t.data.result.data.p_search.list_id;let i=n.map(((e,t)=>{var n,r;return{goods_id:e.goods_id,index:w+t,title:e.title,price:e.price_info.price_schema,currency:e.price_info.price_text[0],sold:e.soldQuantity||e.sold_quantity||C(e.sales_num)||C(e.salesNum)||0,thumb:e.thumb_url,url:`https://www.temu.com${e.seo_link_url}`,mall:"Temu",location:`评分:${(null==(n=null==e?void 0:e.comment)?void 0:n.goods_score)||0}(${(null==(r=null==e?void 0:e.comment)?void 0:r.comment_num_tips)||0})`}}));if(""===v.value||"similar"===v.value){if(N.value){try{i=await P(a.imgUrl,i)}catch(gQ){return d.value="error",h.value="1.浏览器版本过旧,请使用最新的谷歌浏览器重试\n2.如果仍无法解决,请关闭AI识别重试",void s("update:loading",!1)}i=i.map(((e,t)=>(e.index=w+t,e)))}}else i=A(i,v.value);f.value=f.value.concat(i),d.value="success",s("update:loading",!1)},G=async()=>{"visible"===document.visibilityState&&"error"===d.value&&await z()},V=()=>{if("loading"==d.value||"finish"==d.value||"error"==d.value)return;const e=document.documentElement.scrollTop||document.body.scrollTop,t=document.documentElement.scrollHeight||document.body.scrollHeight;if(e+(document.documentElement.clientHeight||document.body.clientHeight)>=t-600){w+=I;try{z()}catch(gQ){d.value="error",h.value="请重新尝试搜索,或稍后再试",s("update:loading",!1)}}};return ue((async()=>{const e=await fn();if(e.error_code)return d.value="install-error",void(h.value="您还没有安装插件,请点击'下载插件'进行安装");m.value=e.version,document.addEventListener("visibilitychange",G),window.addEventListener("scroll",V),m.value.localeCompare("1.0.9")>=0&&await yn({removeRuleIds:[9],addRules:[{condition:{resourceTypes:["xmlhttprequest"],urlFilter:"https://www.temu.com/api/poppy/v1/search"},action:{requestHeaders:[{header:"Referer",operation:"set",value:"https://www.temu.com/"},{header:"Origin",operation:"set",value:"https://www.temu.com"}],type:"modifyHeaders"},id:9}]}),await z()})),ve((()=>{document.removeEventListener("visibilitychange",G),window.removeEventListener("scroll",V)})),(e,n)=>{const r=He,a=St,s=i,f=o,m=l,A=Oe,w=Ne,C=Ke,I=Ee("router-link"),W=u,_=Re;return Ae(),xe("div",Oq,[ke("div",Fq,[ke("span",Dq,[ke("span",Mq,[n[3]||(n[3]=Se("AI识别 ")),$(r,null,{title:we((()=>n[2]||(n[2]=[Se("使用AI提高Temu图搜返回的精准度,但会减慢搜索速度")]))),default:we((()=>[$(Ie(S))])),_:1}),n[4]||(n[4]=Se(" :"))]),$(a,{checked:N.value,onChange:R},null,8,["checked"])]),ke("span",Lq,[n[11]||(n[11]=ke("span",{class:"label"},"排序:",-1)),$(f,{value:v.value,"onUpdate:value":n[0]||(n[0]=e=>v.value=e),style:{width:"130px"},onChange:x},{default:we((()=>[$(s,{value:""},{default:we((()=>n[5]||(n[5]=[Se("默认排序")]))),_:1}),$(s,{value:"similar"},{default:we((()=>n[6]||(n[6]=[Se("同款优先")]))),_:1}),$(s,{value:"price-min-max"},{default:we((()=>n[7]||(n[7]=[Se("价格从低到高")]))),_:1}),$(s,{value:"sold-max-min"},{default:we((()=>n[8]||(n[8]=[Se("销量从高到低")]))),_:1}),$(s,{value:"price-max-min"},{default:we((()=>n[9]||(n[9]=[Se("价格从高到低")]))),_:1}),$(s,{value:"sold-min-max"},{default:we((()=>n[10]||(n[10]=[Se("销量从低到高")]))),_:1})])),_:1},8,["value"])]),ke("span",Bq,[n[12]||(n[12]=ke("span",{class:"label"},"筛选:",-1)),$(m,{value:p.value,"onUpdate:value":n[1]||(n[1]=e=>p.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),$($q,{"img-url":t.imgUrl},null,8,["img-url"]),ke("div",Pq,[(Ae(!0),xe(D,null,Ce(b.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",Gq,[ke("img",{src:e.thumb+"?imageView2/2/w/624/q/70/format/webp",class:"thumb"},null,8,Vq),ke("div",Uq,[e.tag?(Ae(),$e(A,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:k(e.title,p.value)},null,8,Hq)]),ke("div",jq,[ke("span",qq,[ke("span",Qq,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",Xq,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",Zq,[ke("span",{class:"mall",innerHTML:k(e.mall,p.value)},null,8,Kq),ke("span",{class:"location",innerHTML:k(e.location,p.value)},null,8,Jq)])):Te("",!0)],8,zq)))),128))]),"error"===d.value?(Ae(),xe("div",Yq,[ke("div",eQ,[$(Ie(We),{class:"icon"})]),ke("div",tQ,[n[13]||(n[13]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",nQ,_e(h.value),1)]),ke("div",rQ,[$(C,null,{default:we((()=>[ke("a",{target:"_blank",href:g.value},[$(w,{type:"primary"},{default:we((()=>n[14]||(n[14]=[Se(" 打开Temu ")]))),_:1})],8,aQ),$(w,{onClick:T},{default:we((()=>n[15]||(n[15]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===d.value?(Ae(),xe("div",sQ,[ke("div",iQ,[$(Ie(We),{class:"icon"})]),ke("div",oQ,[n[16]||(n[16]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",lQ,_e(h.value),1)]),ke("div",uQ,[$(C,null,{default:we((()=>[$(I,{target:"_blank",to:"/download"},{default:we((()=>[$(w,{type:"primary"},{default:we((()=>n[17]||(n[17]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===d.value||""===d.value?(Ae(),xe("div",cQ,[$(W,{size:"large"}),ke("span",dQ,_e(y.value),1)])):Te("",!0),"success"!==d.value&&"finish"!==d.value||0!==b.value.length?Te("",!0):(Ae(),xe("div",hQ,[$(_,{description:"没有搜索到商品"})])),"finish"===d.value&&b.value.length>0?(Ae(),xe("div",pQ,n[18]||(n[18]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-ea83a69c"]]);var mQ,gQ;!function(){var e={297:function(e,t,n){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e=n.nmd(e);var s,i=(s="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var t,n;(e=void 0!==(e=e||{})?e:{}).ready=new Promise((function(e,r){t=e,n=r}));var r=Object.assign({},e),i="";"undefined"!=typeof document&&document.currentScript&&(i=document.currentScript.src),s&&(i=s),i=0!==i.indexOf("blob:")?i.substr(0,i.replace(/[?#].*/,"").lastIndexOf("/")+1):"",e.print||function(){}.bind();var o,l=e.printErr||function(){}.bind();Object.assign(e,r),r=null,e.arguments&&e.arguments,e.thisProgram&&e.thisProgram,e.quit&&e.quit,e.wasmBinary&&(o=e.wasmBinary),e.noExitRuntime;var u,c={Memory:function(e){this.buffer=new ArrayBuffer(65536*e.initial)},Module:function(e){},Instance:function(e,t){this.exports=function(e){for(var t,n=new Uint8Array(123),r=25;r>=0;--r)n[48+r]=52+r,n[65+r]=r,n[97+r]=26+r;function a(e,t,r){for(var a,s,i=0,o=t,l=r.length,u=t+(3*l>>2)-("="==r[l-2])-("="==r[l-1]);i<l;i+=4)a=n[r.charCodeAt(i+1)],s=n[r.charCodeAt(i+2)],e[o++]=n[r.charCodeAt(i)]<<2|a>>4,o<u&&(e[o++]=a<<4|s>>2),o<u&&(e[o++]=s<<6|n[r.charCodeAt(i+3)])}n[43]=62,n[47]=63;var s=new ArrayBuffer(16),i=new Int32Array(s),o=new Float64Array(s);function l(e){return i[e]}function u(e,t){i[e]=t}function c(){return o[0]}function d(e){o[0]=e}return function(e){var n=e.a.buffer,r=new Int8Array(n),s=new Int16Array(n),i=new Int32Array(n),o=new Uint8Array(n),h=new Uint16Array(n),p=new Uint32Array(n),f=new Float32Array(n),m=new Float64Array(n),g=Math.imul,y=Math.abs,b=Math.clz32,v=e.abort,A=e.b,x=e.c,k=e.d,w=e.e,S=e.f,C=e.g,I=e.h,W=e.i,_=e.j,T=e.k,N=e.l,E=e.m,R=e.n,$=e.o,O=e.p,F=e.q,D=284016,M=0;function L(e){var t,n=0,r=0,a=0,s=0,l=0,u=0,c=0,d=0,h=0,f=0;D=t=D-16|0;e:{t:{n:{r:{a:{s:{i:{o:{l:{u:{c:{if((e|=0)>>>0<=244){if(3&(n=(l=i[5342])>>>(r=(c=e>>>0<11?16:e+11&-8)>>>3|0)|0)){n=21408+(e=(r=r+(1&~n)|0)<<3)|0,a=i[e+21416>>2],(0|n)!=(0|(e=i[a+8>>2]))?(i[e+12>>2]=n,i[n+8>>2]=e):i[5342]=ft(r)&l,e=a+8|0,n=r<<3,i[a+4>>2]=3|n,i[4+(n=n+a|0)>>2]=1|i[n+4>>2];break e}if((f=i[5344])>>>0>=c>>>0)break c;if(n){r=e=(n=(e=(0-(e=2<<r)|e)&n<<r)-1&~e)>>>12&16,r|=e=(n=n>>>e|0)>>>5&8,r|=e=(n=n>>>e|0)>>>2&4,n=21408+(e=(a=((r|=e=(n=n>>>e|0)>>>1&2)|(e=(n=n>>>e|0)>>>1&1))+(n>>>e|0)|0)<<3)|0,u=i[e+21416>>2],(0|n)!=(0|(e=i[u+8>>2]))?(i[e+12>>2]=n,i[n+8>>2]=e):(l=ft(a)&l,i[5342]=l),i[u+4>>2]=3|c,a=(e=a<<3)-c|0,i[4+(r=u+c|0)>>2]=1|a,i[e+u>>2]=a,f&&(n=21408+(-8&f)|0,s=i[5347],(e=1<<(f>>>3))&l?e=i[n+8>>2]:(i[5342]=e|l,e=n),i[n+8>>2]=s,i[e+12>>2]=s,i[s+12>>2]=n,i[s+8>>2]=e),e=u+8|0,i[5347]=r,i[5344]=a;break e}if(!(h=i[5343]))break c;for(r=e=(n=h-1&~h)>>>12&16,r|=e=(n=n>>>e|0)>>>5&8,r|=e=(n=n>>>e|0)>>>2&4,n=i[21672+(((r|=e=(n=n>>>e|0)>>>1&2)|(e=(n=n>>>e|0)>>>1&1))+(n>>>e|0)<<2)>>2],s=(-8&i[n+4>>2])-c|0,r=n;(e=i[r+16>>2])||(e=i[r+20>>2]);)s=(a=(r=(-8&i[e+4>>2])-c|0)>>>0<s>>>0)?r:s,n=a?e:n,r=e;if(d=i[n+24>>2],(0|(a=i[n+12>>2]))!=(0|n)){e=i[n+8>>2],i[e+12>>2]=a,i[a+8>>2]=e;break t}if(!(e=i[(r=n+20|0)>>2])){if(!(e=i[n+16>>2]))break u;r=n+16|0}for(;u=r,a=e,(e=i[(r=e+20|0)>>2])||(r=a+16|0,e=i[a+16>>2]););i[u>>2]=0;break t}if(c=-1,!(e>>>0>4294967231)&&(c=-8&(e=e+11|0),h=i[5343])){s=0-c|0,l=0,c>>>0<256||(l=31,c>>>0>16777215||(e=e>>>8|0,e<<=u=e+1048320>>>16&8,l=28+((e=((e<<=r=e+520192>>>16&4)<<(n=e+245760>>>16&2)>>>15|0)-(n|r|u)|0)<<1|c>>>e+21&1)|0));d:{h:{if(r=i[21672+(l<<2)>>2])for(e=0,n=c<<(31!=(0|l)?25-(l>>>1|0):0);;){if(!((u=(-8&i[r+4>>2])-c|0)>>>0>=s>>>0||(a=r,s=u))){s=0,e=r;break h}if(u=i[r+20>>2],r=i[16+((n>>>29&4)+r|0)>>2],e=u?(0|u)==(0|r)?e:u:e,n<<=1,!r)break}else e=0;if(!(e|a)){if(a=0,!(e=(0-(e=2<<l)|e)&h))break c;r=e=(n=e-1&~e)>>>12&16,r|=e=(n=n>>>e|0)>>>5&8,r|=e=(n=n>>>e|0)>>>2&4,e=i[21672+(((r|=e=(n=n>>>e|0)>>>1&2)|(e=(n=n>>>e|0)>>>1&1))+(n>>>e|0)<<2)>>2]}if(!e)break d}for(;s=(r=(n=(-8&i[e+4>>2])-c|0)>>>0<s>>>0)?n:s,a=r?e:a,e=(n=i[e+16>>2])||i[e+20>>2];);}if(!(!a|i[5344]-c>>>0<=s>>>0)){if(l=i[a+24>>2],(0|a)!=(0|(n=i[a+12>>2]))){e=i[a+8>>2],i[e+12>>2]=n,i[n+8>>2]=e;break n}if(!(e=i[(r=a+20|0)>>2])){if(!(e=i[a+16>>2]))break l;r=a+16|0}for(;u=r,n=e,(e=i[(r=e+20|0)>>2])||(r=n+16|0,e=i[n+16>>2]););i[u>>2]=0;break n}}}if((r=i[5344])>>>0>=c>>>0){a=i[5347],(n=r-c|0)>>>0>=16?(i[5344]=n,e=a+c|0,i[5347]=e,i[e+4>>2]=1|n,i[r+a>>2]=n,i[a+4>>2]=3|c):(i[5347]=0,i[5344]=0,i[a+4>>2]=3|r,i[4+(e=r+a|0)>>2]=1|i[e+4>>2]),e=a+8|0;break e}if((d=i[5345])>>>0>c>>>0){n=d-c|0,i[5345]=n,e=(r=i[5348])+c|0,i[5348]=e,i[e+4>>2]=1|n,i[r+4>>2]=3|c,e=r+8|0;break e}if(e=0,n=h=c+47|0,i[5460]?r=i[5462]:(i[5463]=-1,i[5464]=-1,i[5461]=4096,i[5462]=4096,i[5460]=t+12&-16^1431655768,i[5465]=0,i[5453]=0,r=4096),(r=(u=n+r|0)&(s=0-r|0))>>>0<=c>>>0)break e;if((a=i[5452])&&a>>>0<(l=(n=i[5450])+r|0)>>>0|n>>>0>=l>>>0)break e;if(4&o[21812])break s;c:{d:{if(a=i[5348])for(e=21816;;){if((n=i[e>>2])>>>0<=a>>>0&a>>>0<n+i[e+4>>2]>>>0)break d;if(!(e=i[e+8>>2]))break}if(-1==(0|(n=$e(0))))break i;if(l=r,(e=(a=i[5461])-1|0)&n&&(l=(r-n|0)+(e+n&0-a)|0),l>>>0<=c>>>0|l>>>0>2147483646)break i;if((a=i[5452])&&a>>>0<(s=(e=i[5450])+l|0)>>>0|e>>>0>=s>>>0)break i;if((0|n)!=(0|(e=$e(l))))break c;break a}if((l=s&u-d)>>>0>2147483646)break i;if((0|(n=$e(l)))==(i[e>>2]+i[e+4>>2]|0))break o;e=n}if(!(-1==(0|e)|c+48>>>0<=l>>>0)){if((n=(n=i[5462])+(h-l|0)&0-n)>>>0>2147483646){n=e;break a}if(-1!=(0|$e(n))){l=n+l|0,n=e;break a}$e(0-l|0);break i}if(n=e,-1!=(0|e))break a;break i}a=0;break t}n=0;break n}if(-1!=(0|n))break a}i[5453]=4|i[5453]}if(r>>>0>2147483646)break r;s:{i:{if(!(r=r+7&-8)|(e=(n=i[5303])+r|0)>>>0>n>>>0){if(mn()>>>0>=e>>>0)break i;if(0|C(0|e))break i;e=i[5303]}else e=n;i[5341]=48,n=-1;break s}i[5303]=e}if(mn()>>>0<e>>>0&&!(0|C(0|e)))break r;if(i[5303]=e,-1==(0|n)|-1==(0|e)|e>>>0<=n>>>0)break r;if((l=e-n|0)>>>0<=c+40>>>0)break r}e=i[5450]+l|0,i[5450]=e,e>>>0>p[5451]&&(i[5451]=e);a:{s:{i:{if(u=i[5348]){for(e=21816;;){if(((a=i[e>>2])+(r=i[e+4>>2])|0)==(0|n))break i;if(!(e=i[e+8>>2]))break}break s}for((e=i[5346])>>>0<=n>>>0&&e||(i[5346]=n),e=0,i[5455]=l,i[5454]=n,i[5350]=-1,i[5351]=i[5460],i[5457]=0;r=21408+(a=e<<3)|0,i[a+21416>>2]=r,i[a+21420>>2]=r,32!=(0|(e=e+1|0)););r=(a=l-40|0)-(e=n+8&7?-8-n&7:0)|0,i[5345]=r,e=e+n|0,i[5348]=e,i[e+4>>2]=1|r,i[4+(n+a|0)>>2]=40,i[5349]=i[5464];break a}if(!(8&o[e+12|0]|a>>>0>u>>>0|n>>>0<=u>>>0)){i[e+4>>2]=r+l,r=(e=u+8&7?-8-u&7:0)+u|0,i[5348]=r,e=(n=i[5345]+l|0)-e|0,i[5345]=e,i[r+4>>2]=1|e,i[4+(n+u|0)>>2]=40,i[5349]=i[5464];break a}}p[5346]>n>>>0&&(i[5346]=n),a=n+l|0,r=21816;s:{for(;;){if((0|a)!=i[r>>2]){if(e=21816,r=i[r+8>>2])continue;break s}break}if(e=21816,!(8&o[r+12|0])){i[r>>2]=n,i[r+4>>2]=i[r+4>>2]+l,i[4+(h=(n+8&7?-8-n&7:0)+n|0)>>2]=3|c,e=(a=a+(a+8&7?-8-a&7:0)|0)-(d=c+h|0)|0;i:if((0|a)!=(0|u))if(i[5347]!=(0|a)){if(1==(3&(s=i[a+4>>2]))){l=-8&s;o:if(s>>>0<=255){if(n=s>>>3|0,s=i[a+8>>2],(0|(r=i[a+12>>2]))==(0|s)){i[5342]=i[5342]&ft(n);break o}i[s+12>>2]=r,i[r+8>>2]=s}else{if(c=i[a+24>>2],(0|a)==(0|(n=i[a+12>>2])))if((r=i[(s=a+20|0)>>2])||(r=i[(s=a+16|0)>>2])){for(;u=s,(r=i[(s=(n=r)+20|0)>>2])||(s=n+16|0,r=i[n+16>>2]););i[u>>2]=0}else n=0;else r=i[a+8>>2],i[r+12>>2]=n,i[n+8>>2]=r;if(c){s=i[a+28>>2];l:{if(i[(r=21672+(s<<2)|0)>>2]==(0|a)){if(i[r>>2]=n,n)break l;i[5343]=i[5343]&ft(s);break o}if(i[c+(i[c+16>>2]==(0|a)?16:20)>>2]=n,!n)break o}i[n+24>>2]=c,(r=i[a+16>>2])&&(i[n+16>>2]=r,i[r+24>>2]=n),(r=i[a+20>>2])&&(i[n+20>>2]=r,i[r+24>>2]=n)}}s=i[4+(a=a+l|0)>>2],e=e+l|0}if(i[a+4>>2]=-2&s,i[d+4>>2]=1|e,i[e+d>>2]=e,e>>>0<=255)n=21408+(-8&e)|0,(r=i[5342])&(e=1<<(e>>>3))?e=i[n+8>>2]:(i[5342]=e|r,e=n),i[n+8>>2]=d,i[e+12>>2]=d,i[d+12>>2]=n,i[d+8>>2]=e;else{s=31,e>>>0<=16777215&&(n=e>>>8|0,n<<=s=n+1048320>>>16&8,s=28+((n=((n<<=a=n+520192>>>16&4)<<(r=n+245760>>>16&2)>>>15|0)-(r|a|s)|0)<<1|e>>>n+21&1)|0),i[d+28>>2]=s,i[d+16>>2]=0,i[d+20>>2]=0,a=21672+(s<<2)|0;o:{if((r=i[5343])&(n=1<<s)){for(s=e<<(31!=(0|s)?25-(s>>>1|0):0),n=i[a>>2];;){if(r=n,(-8&i[n+4>>2])==(0|e))break o;if(n=s>>>29|0,s<<=1,!(n=i[16+(a=r+(4&n)|0)>>2]))break}i[a+16>>2]=d,i[d+24>>2]=r}else i[5343]=n|r,i[a>>2]=d,i[d+24>>2]=a;i[d+12>>2]=d,i[d+8>>2]=d;break i}e=i[r+8>>2],i[e+12>>2]=d,i[r+8>>2]=d,i[d+24>>2]=0,i[d+12>>2]=r,i[d+8>>2]=e}}else i[5347]=d,e=i[5344]+e|0,i[5344]=e,i[d+4>>2]=1|e,i[e+d>>2]=e;else i[5348]=d,e=i[5345]+e|0,i[5345]=e,i[d+4>>2]=1|e;e=h+8|0;break e}}for(;!((r=i[e>>2])>>>0<=u>>>0&&(s=r+i[e+4>>2]|0)>>>0>u>>>0);)e=i[e+8>>2];for(r=(a=l-40|0)-(e=n+8&7?-8-n&7:0)|0,i[5345]=r,e=e+n|0,i[5348]=e,i[e+4>>2]=1|r,i[4+(n+a|0)>>2]=40,i[5349]=i[5464],i[(r=(e=(s+(s-39&7?39-s&7:0)|0)-47|0)>>>0<u+16>>>0?u:e)+4>>2]=27,e=i[5457],i[r+16>>2]=i[5456],i[r+20>>2]=e,e=i[5455],i[r+8>>2]=i[5454],i[r+12>>2]=e,i[5456]=r+8,i[5455]=l,i[5454]=n,i[5457]=0,e=r+24|0;i[e+4>>2]=7,n=e+8|0,e=e+4|0,n>>>0<s>>>0;);if((0|r)!=(0|u))if(i[r+4>>2]=-2&i[r+4>>2],s=r-u|0,i[u+4>>2]=1|s,i[r>>2]=s,s>>>0<=255)n=21408+(-8&s)|0,(r=i[5342])&(e=1<<(s>>>3))?e=i[n+8>>2]:(i[5342]=e|r,e=n),i[n+8>>2]=u,i[e+12>>2]=u,i[u+12>>2]=n,i[u+8>>2]=e;else{e=31,s>>>0<=16777215&&(e=s>>>8|0,e<<=a=e+1048320>>>16&8,e=28+((e=((e<<=r=e+520192>>>16&4)<<(n=e+245760>>>16&2)>>>15|0)-(n|r|a)|0)<<1|s>>>e+21&1)|0),i[u+28>>2]=e,i[u+16>>2]=0,i[u+20>>2]=0,n=21672+(e<<2)|0;s:{if((a=i[5343])&(r=1<<e)){for(e=s<<(31!=(0|e)?25-(e>>>1|0):0),a=i[n>>2];;){if((0|s)==(-8&i[(n=a)+4>>2]))break s;if(r=e>>>29|0,e<<=1,!(a=i[16+(r=(4&r)+n|0)>>2]))break}i[r+16>>2]=u}else i[5343]=r|a,i[n>>2]=u;i[u+24>>2]=n,i[u+12>>2]=u,i[u+8>>2]=u;break a}e=i[n+8>>2],i[e+12>>2]=u,i[n+8>>2]=u,i[u+24>>2]=0,i[u+12>>2]=n,i[u+8>>2]=e}}if(!((e=i[5345])>>>0<=c>>>0)){n=e-c|0,i[5345]=n,e=(r=i[5348])+c|0,i[5348]=e,i[e+4>>2]=1|n,i[r+4>>2]=3|c,e=r+8|0;break e}}e=0,i[5341]=48;break e}n:if(l){r=i[a+28>>2];r:{if(i[(e=21672+(r<<2)|0)>>2]==(0|a)){if(i[e>>2]=n,n)break r;h=ft(r)&h,i[5343]=h;break n}if(i[l+(i[l+16>>2]==(0|a)?16:20)>>2]=n,!n)break n}i[n+24>>2]=l,(e=i[a+16>>2])&&(i[n+16>>2]=e,i[e+24>>2]=n),(e=i[a+20>>2])&&(i[n+20>>2]=e,i[e+24>>2]=n)}n:if(s>>>0<=15)e=s+c|0,i[a+4>>2]=3|e,i[4+(e=e+a|0)>>2]=1|i[e+4>>2];else if(i[a+4>>2]=3|c,i[4+(l=a+c|0)>>2]=1|s,i[s+l>>2]=s,s>>>0<=255)n=21408+(-8&s)|0,(r=i[5342])&(e=1<<(s>>>3))?e=i[n+8>>2]:(i[5342]=e|r,e=n),i[n+8>>2]=l,i[e+12>>2]=l,i[l+12>>2]=n,i[l+8>>2]=e;else{e=31,s>>>0<=16777215&&(e=s>>>8|0,e<<=u=e+1048320>>>16&8,e=28+((e=((e<<=r=e+520192>>>16&4)<<(n=e+245760>>>16&2)>>>15|0)-(n|r|u)|0)<<1|s>>>e+21&1)|0),i[l+28>>2]=e,i[l+16>>2]=0,i[l+20>>2]=0,n=21672+(e<<2)|0;r:{if((r=1<<e)&h){for(e=s<<(31!=(0|e)?25-(e>>>1|0):0),c=i[n>>2];;){if((-8&i[(n=c)+4>>2])==(0|s))break r;if(r=e>>>29|0,e<<=1,!(c=i[16+(r=(4&r)+n|0)>>2]))break}i[r+16>>2]=l}else i[5343]=r|h,i[n>>2]=l;i[l+24>>2]=n,i[l+12>>2]=l,i[l+8>>2]=l;break n}e=i[n+8>>2],i[e+12>>2]=l,i[n+8>>2]=l,i[l+24>>2]=0,i[l+12>>2]=n,i[l+8>>2]=e}e=a+8|0;break e}t:if(d){r=i[n+28>>2];n:{if(i[(e=21672+(r<<2)|0)>>2]==(0|n)){if(i[e>>2]=a,a)break n;i[5343]=ft(r)&h;break t}if(i[d+(i[d+16>>2]==(0|n)?16:20)>>2]=a,!a)break t}i[a+24>>2]=d,(e=i[n+16>>2])&&(i[a+16>>2]=e,i[e+24>>2]=a),(e=i[n+20>>2])&&(i[a+20>>2]=e,i[e+24>>2]=a)}s>>>0<=15?(e=s+c|0,i[n+4>>2]=3|e,i[4+(e=e+n|0)>>2]=1|i[e+4>>2]):(i[n+4>>2]=3|c,i[4+(a=n+c|0)>>2]=1|s,i[a+s>>2]=s,f&&(r=21408+(-8&f)|0,u=i[5347],(e=1<<(f>>>3))&l?e=i[r+8>>2]:(i[5342]=e|l,e=r),i[r+8>>2]=u,i[e+12>>2]=u,i[u+12>>2]=r,i[u+8>>2]=e),i[5347]=a,i[5344]=s),e=n+8|0}return D=t+16|0,0|e}function B(e,t){var n,r,a,s,o,l,u,c,d,h,p,f,m,g,y,b,v,A,x,k,w,S,C,I,W,_,T,N,E,R,$,O,F,M,L,B,P,z,G,V,U,H,j,q,Q,X,Z,K,J=0,Y=0,ee=0,te=0,ne=0,re=0,ae=0,se=0,ie=0,oe=0,le=0,ue=0,ce=0,de=0,he=0,pe=0,fe=0,me=0,ge=0,ye=0,be=0,ve=0,Ae=0;for(D=n=D-256|0,l=i[e+104>>2],pe=i[e+100>>2],de=i[e+96>>2],r=i[e+92>>2],u=i[e+88>>2],o=i[e+84>>2],s=i[e+80>>2],a=i[e+76>>2];16!=(0|J);)Y=i[(te=J<<2)+t>>2],i[te+n>>2]=Y<<8&16711680|Y<<24|Y>>>8&65280|Y>>>24,J=J+1|0;for(J=16,ie=i[n+60>>2],se=i[n+56>>2],le=i[n+52>>2],ue=i[n+48>>2],ce=i[n+44>>2],me=i[n+40>>2],fe=i[n+36>>2],ge=i[n+32>>2],ye=i[n+28>>2],be=i[n+24>>2],re=i[n+20>>2],ee=i[n+16>>2],ne=i[n+12>>2],te=i[n+8>>2],ae=i[n+4>>2],t=he=i[n>>2];24!=(0|J);)ve=(oe=i[(Y=(J<<2)+n|0)-28>>2]+t|0)+((t=i[Y-60>>2])>>>3^it(t,7)^it(t,18))|0,oe=Y,Y=i[Y-8>>2],i[oe>>2]=(Y>>>10^it(Y,17)^it(Y,19))+ve,J=J+1|0;for(t=24,ve=i[n+92>>2],h=i[n+88>>2],p=i[n+84>>2],f=i[n+80>>2],m=i[n+76>>2],g=i[n+72>>2],y=i[n+68>>2],b=i[n+64>>2];32!=(0|t);)Y=i[(J=(t<<2)+n|0)-60>>2],Y=(i[J-28>>2]+i[J+-64>>2]|0)+(Y>>>3^it(Y,7)^it(Y,18))|0,oe=J,J=i[J-8>>2],i[oe>>2]=(J>>>10^it(J,17)^it(J,19))+Y,t=t+1|0;for(t=32,v=i[n+124>>2],A=i[n+120>>2],x=i[n+116>>2],k=i[n+112>>2],w=i[n+108>>2],S=i[n+104>>2],C=i[n+100>>2],I=i[n+96>>2];40!=(0|t);)Y=i[(J=(t<<2)+n|0)-60>>2],Y=(i[J-28>>2]+i[J+-64>>2]|0)+(Y>>>3^it(Y,7)^it(Y,18))|0,oe=J,J=i[J-8>>2],i[oe>>2]=(J>>>10^it(J,17)^it(J,19))+Y,t=t+1|0;for(t=40,W=i[n+156>>2],_=i[n+152>>2],T=i[n+148>>2],N=i[n+144>>2],E=i[n+140>>2],R=i[n+136>>2],$=i[n+132>>2],O=i[n+128>>2];48!=(0|t);)Y=i[(J=(t<<2)+n|0)-60>>2],Y=(i[J-28>>2]+i[J+-64>>2]|0)+(Y>>>3^it(Y,7)^it(Y,18))|0,oe=J,J=i[J-8>>2],i[oe>>2]=(J>>>10^it(J,17)^it(J,19))+Y,t=t+1|0;for(t=48,F=i[n+188>>2],M=i[n+184>>2],L=i[n+180>>2],B=i[n+176>>2],P=i[n+172>>2],z=i[n+168>>2],G=i[n+164>>2],V=i[n+160>>2];56!=(0|t);)Y=i[(J=(t<<2)+n|0)-60>>2],Y=(i[J-28>>2]+i[J+-64>>2]|0)+(Y>>>3^it(Y,7)^it(Y,18))|0,oe=J,J=i[J-8>>2],i[oe>>2]=(J>>>10^it(J,17)^it(J,19))+Y,t=t+1|0;for(t=56,U=i[n+220>>2],H=i[n+216>>2],j=i[n+212>>2],q=i[n+208>>2],Q=i[n+204>>2],X=i[n+200>>2],Z=i[n+196>>2],K=i[n+192>>2];64!=(0|t);)Y=i[(J=(t<<2)+n|0)-60>>2],Y=(i[J-28>>2]+i[J+-64>>2]|0)+(Y>>>3^it(Y,7)^it(Y,18))|0,oe=J,J=i[J-8>>2],i[oe>>2]=(J>>>10^it(J,17)^it(J,19))+Y,t=t+1|0;Y=1116352408+(At(r,de,pe)+(he+l|0)|0)|0,ae=1899447441+(At(t=Y+u|0,r,de)+(ae+pe|0)|0)|0,he=At(J=ae+o|0,t,r),Y=xt(a,s,o)+Y|0,Ae=xt(Y,a,s),c=(At(te=(he=(he+(te+de|0)|0)-1245643825|0)+s|0,J,t)+(ne+r|0)|0)-373957723|0,ee=961987163+(At(ne=c+a|0,te,J)+(t+ee|0)|0)|0,d=1508970993+(At(t=Y+ee|0,ne,te)+(J+re|0)|0)|0,Ae=At(re=d+(J=ae+Ae|0)|0,t,ne),oe=ee,ee=xt(J,Y,a)+he|0,Y=xt(ee,J,Y)+c|0,J=oe+xt(Y,ee,J)|0,ae=xt(J,Y,ee)+d|0,he=xt(ae,J,Y),oe=Y,ye=(At(Y=(Y=ee)+(ee=(Ae+(te+be|0)|0)-1841331548|0)|0,re,t)+(ne+ye|0)|0)-1424204075|0,ge=(At(te=oe+ye|0,Y,re)+(t+ge|0)|0)-670586216|0,fe=310598401+(At(t=ge+J|0,te,Y)+(re+fe|0)|0)|0,be=At(ne=fe+ae|0,t,te),J=xt(re=ee+he|0,ae,J)+ye|0,ee=xt(J,re,ae)+ge|0,ae=xt(ee,J,re),ce=1426881987+(At(Y=(me=607225278+(be+(Y+me|0)|0)|0)+re|0,ne,t)+(te+ce|0)|0)|0,ue=1925078388+(At(te=ce+J|0,Y,ne)+(t+ue|0)|0)|0,le=(At(t=ue+ee|0,te,Y)+(ne+le|0)|0)-2132889090|0,fe=At(re=le+(ne=ae+fe|0)|0,t,te),J=xt(ne,ee,J)+me|0,ee=xt(J,ne,ee)+ce|0,ne=xt(ee,J,ne)+ue|0,ae=xt(ne,ee,J)+le|0,le=xt(ae,ne,ee),oe=ee,ie=(At(J=(ee=(fe+(Y+se|0)|0)-1680079193|0)+J|0,re,t)+(te+ie|0)|0)-1046744716|0,se=(At(Y=oe+ie|0,J,re)+(t+b|0)|0)-459576895|0,ue=(At(t=se+ne|0,Y,J)+(re+y|0)|0)-272742522|0,ce=At(te=ue+ae|0,t,Y),ne=xt(re=ee+le|0,ae,ne)+ie|0,ee=xt(ne,re,ae)+se|0,ae=xt(ee,ne,re),se=604807628+(At(J=(ie=264347078+(ce+(J+g|0)|0)|0)+re|0,te,t)+(Y+m|0)|0)|0,le=770255983+(At(Y=se+ne|0,J,te)+(t+f|0)|0)|0,ce=1249150122+(At(t=le+ee|0,Y,J)+(te+p|0)|0)|0,ue=At(re=ce+(te=ae+ue|0)|0,t,Y),ne=xt(te,ee,ne)+ie|0,ee=xt(ne,te,ee)+se|0,te=xt(ee,ne,te)+le|0,ae=xt(te,ee,ne)+ce|0,ie=xt(ae,te,ee),oe=ee,se=1996064986+(At(J=(ee=1555081692+(ue+(J+h|0)|0)|0)+ne|0,re,t)+(Y+ve|0)|0)|0,le=(At(Y=oe+se|0,J,re)+(t+I|0)|0)-1740746414|0,ue=(At(t=le+te|0,Y,J)+(re+C|0)|0)-1473132947|0,ce=At(ne=ue+ae|0,t,Y),te=xt(re=ee+ie|0,ae,te)+se|0,ee=xt(te,re,ae)+le|0,ae=xt(ee,te,re),se=(At(J=(ie=(ce+(J+S|0)|0)-1341970488|0)+re|0,ne,t)+(Y+w|0)|0)-1084653625|0,le=(At(Y=se+te|0,J,ne)+(t+k|0)|0)-958395405|0,ce=(At(t=le+ee|0,Y,J)+(ne+x|0)|0)-710438585|0,ue=At(re=ce+(ne=ae+ue|0)|0,t,Y),te=xt(ne,ee,te)+ie|0,ee=xt(te,ne,ee)+se|0,ne=xt(ee,te,ne)+le|0,ae=xt(ne,ee,te)+ce|0,ie=xt(ae,ne,ee),oe=ee,se=338241895+(At(J=(ee=113926993+(ue+(J+A|0)|0)|0)+te|0,re,t)+(Y+v|0)|0)|0,le=666307205+(At(Y=oe+se|0,J,re)+(t+O|0)|0)|0,ue=773529912+(At(t=le+ne|0,Y,J)+(re+$|0)|0)|0,ce=At(te=ue+ae|0,t,Y),ne=xt(re=ee+ie|0,ae,ne)+se|0,ee=xt(ne,re,ae)+le|0,ae=xt(ee,ne,re),se=1396182291+(At(J=(ie=1294757372+(ce+(J+R|0)|0)|0)+re|0,te,t)+(Y+E|0)|0)|0,le=1695183700+(At(Y=se+ne|0,J,te)+(t+N|0)|0)|0,ce=1986661051+(At(t=le+ee|0,Y,J)+(te+T|0)|0)|0,ue=At(re=ce+(te=ae+ue|0)|0,t,Y),ne=xt(te,ee,ne)+ie|0,ee=xt(ne,te,ee)+se|0,te=xt(ee,ne,te)+le|0,ae=xt(te,ee,ne)+ce|0,ie=xt(ae,te,ee),oe=ee,se=(At(J=(ee=(ue+(J+_|0)|0)-2117940946|0)+ne|0,re,t)+(Y+W|0)|0)-1838011259|0,le=(At(Y=oe+se|0,J,re)+(t+V|0)|0)-1564481375|0,ue=(At(t=le+te|0,Y,J)+(re+G|0)|0)-1474664885|0,ce=At(ne=ue+ae|0,t,Y),te=xt(re=ee+ie|0,ae,te)+se|0,ee=xt(te,re,ae)+le|0,ae=xt(ee,te,re),se=(At(J=(ie=(ce+(J+z|0)|0)-1035236496|0)+re|0,ne,t)+(Y+P|0)|0)-949202525|0,le=(At(Y=se+te|0,J,ne)+(t+B|0)|0)-778901479|0,ce=(At(t=le+ee|0,Y,J)+(ne+L|0)|0)-694614492|0,ue=At(re=ce+(ne=ae+ue|0)|0,t,Y),te=xt(ne,ee,te)+ie|0,ee=xt(te,ne,ee)+se|0,ne=xt(ee,te,ne)+le|0,ae=xt(ne,ee,te)+ce|0,ie=xt(ae,ne,ee),oe=ee,se=275423344+(At(J=(ee=(ue+(J+M|0)|0)-200395387|0)+te|0,re,t)+(Y+F|0)|0)|0,le=430227734+(At(Y=oe+se|0,J,re)+(t+K|0)|0)|0,ue=506948616+(At(t=le+ne|0,Y,J)+(re+Z|0)|0)|0,ce=At(te=ue+ae|0,t,Y),ne=xt(re=ee+ie|0,ae,ne)+se|0,ee=xt(ne,re,ae)+le|0,ae=xt(ee,ne,re),se=883997877+(At(J=(ie=659060556+(ce+(J+X|0)|0)|0)+re|0,te,t)+(Y+Q|0)|0)|0,le=958139571+(At(Y=se+ne|0,J,te)+(t+q|0)|0)|0,ce=1322822218+(At(t=le+ee|0,Y,J)+(te+j|0)|0)|0,ue=At(re=ce+(te=ae+ue|0)|0,t,Y),ne=xt(te,ee,ne)+ie|0,ee=xt(ne,te,ee)+se|0,te=xt(ee,ne,te)+le|0,ae=xt(te,ee,ne)+ce|0,ie=1537002063+(ue+(J+H|0)|0)|0,J=xt(ae,te,ee)+ie|0,se=xt(J,ae,te),oe=ee,ee=1747873779+(At(ne=ne+ie|0,re,t)+(Y+U|0)|0)|0,ie=At(Y=oe+ee|0,ne,re),se=xt(ee=ee+se|0,J,ae),ie=At(t=(oe=te)+(te=1955562222+(i[n+224>>2]+(t+ie|0)|0)|0)|0,Y,ne),se=xt(te=te+se|0,ee,J),ie=At(re=(oe=ae)+(ae=2024104815+(i[n+228>>2]+(re+ie|0)|0)|0)|0,t,Y),se=xt(ae=ae+se|0,te,ee),ie=At(J=(ne=(i[n+232>>2]+(ne+ie|0)|0)-2067236844|0)+J|0,re,t),se=xt(ne=ne+se|0,ae,te),ie=At(Y=(oe=ee)+(ee=(i[n+236>>2]+(Y+ie|0)|0)-1933114872|0)|0,J,re),se=xt(ee=ee+se|0,ne,ae),ie=At(t=(oe=te)+(te=(i[n+240>>2]+(t+ie|0)|0)-1866530822|0)|0,Y,J),le=i[n+244>>2],se=xt(te=te+se|0,ee,ne),ue=i[n+248>>2],ce=i[n+252>>2],i[e+104>>2]=t+l,oe=pe,pe=(re=(le+(re+ie|0)|0)-1538233109|0)+ae|0,i[e+100>>2]=oe+pe,oe=de,ne=(de=(ue+(At(pe,t,Y)+J|0)|0)-1090935817|0)+ne|0,i[e+96>>2]=oe+ne,i[e+88>>2]=te+u,J=re+se|0,i[e+84>>2]=J+o,de=xt(J,te,ee)+de|0,i[e+80>>2]=de+s,t=(ce+(At(ne,pe,t)+Y|0)|0)-965641998|0,i[e+92>>2]=t+(ee+r|0),i[e+76>>2]=t+(xt(de,J,te)+a|0),D=n+256|0}function P(e,t,n,a,l,u,c){var d,h,p,f=0,y=0,b=0,v=0,A=0,x=0,k=0,w=0,S=0,C=0,I=0,W=0,_=0,T=0,N=0,E=0,R=0;D=d=D-80|0,i[d+76>>2]=t,p=d+55|0,h=d+56|0;e:{t:{n:{r:{a:for(;;){if(v=t,(2147483647^w)<(0|f))break r;w=f+w|0;s:{i:{o:{if(y=o[0|(f=v)])for(;;){l:{u:if(t=255&y){if(37!=(0|t))break l;for(y=f;;){if(37!=o[y+1|0]){t=y;break u}if(f=f+1|0,b=o[y+2|0],y=t=y+2|0,37!=(0|b))break}}else t=f;if((0|(f=f-v|0))>(0|(N=2147483647^w)))break r;if(e&&ie(e,v,f),f)continue a;i[d+76>>2]=t,f=t+1|0,C=-1,!on(y=r[t+1|0])|36!=o[t+2|0]||(C=y-48|0,W=1,f=t+3|0),i[d+76>>2]=f,x=0;u:if((t=(y=r[0|f])-32|0)>>>0>31)b=f;else if(b=f,75913&(t=1<<t))for(;;){if(b=f+1|0,i[d+76>>2]=b,x|=t,(t=(y=r[f+1|0])-32|0)>>>0>=32)break u;if(f=b,!(75913&(t=1<<t)))break}u:if(42!=(0|y)){if((0|(I=_e(d+76|0)))<0)break r;y=i[d+76>>2]}else{if(!on(t=r[b+1|0])|36!=o[b+2|0]){if(W)break o;if(y=b+1|0,!e){i[d+76>>2]=y,W=0,I=0;break u}t=i[n>>2],i[n>>2]=t+4,W=0,t=i[t>>2]}else i[((t<<2)+l|0)-192>>2]=10,y=b+3|0,W=1,t=i[((r[b+1|0]<<3)+a|0)-384>>2];if(I=t,i[d+76>>2]=y,(0|I)>=0)break u;I=0-I|0,x|=8192}if(f=0,A=-1,46==o[0|y])if(42!=o[y+1|0])i[d+76>>2]=y+1,A=_e(d+76|0),t=i[d+76>>2],T=1;else{if(!on(t=r[y+2|0])|36!=o[y+3|0]){if(W)break o;t=y+2|0,A=0,e&&(y=i[n>>2],i[n>>2]=y+4,A=i[y>>2])}else i[((t<<2)+l|0)-192>>2]=10,t=y+4|0,A=i[((r[y+2|0]<<3)+a|0)-384>>2];i[d+76>>2]=t,T=~A>>>31|0}else t=y,T=0;for(;;){if(S=f,b=28,k=t,(f=r[0|t])-123>>>0<4294967238)break n;if(t=k+1|0,!((f=o[11743+(f+g(S,58)|0)|0])-1>>>0<8))break}i[d+76>>2]=t;u:{c:{if(27!=(0|f)){if(!f)break n;if((0|C)>=0){i[(C<<2)+l>>2]=f,y=i[4+(f=(C<<3)+a|0)>>2],i[d+64>>2]=i[f>>2],i[d+68>>2]=y;break c}if(!e)break s;Y(d- -64|0,f,n,c);break u}if((0|C)>=0)break n}if(f=0,!e)continue a}y=-65537&x,x=8192&x?y:x,C=0,_=1106,b=h;u:{c:{d:{h:{p:{f:{m:{g:{y:{b:{v:{A:{x:{k:{w:{switch(f=r[0|k],(f=S&&3==(15&f)?-33&f:f)-88|0){case 11:break u;case 9:case 13:case 14:case 15:break c;case 27:break m;case 12:case 17:break b;case 23:break v;case 0:case 32:break A;case 24:break x;case 22:break k;case 29:break w;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31:break i}switch(f-65|0){case 0:case 4:case 5:case 6:break c;case 2:break p;case 1:case 3:break i}if(83==(0|f))break f;break i}k=i[d+64>>2],y=i[d+68>>2],_=1106;break y}f=0;k:switch(255&S){case 0:case 1:case 6:i[i[d+64>>2]>>2]=w;continue a;case 2:v=i[d+64>>2],i[v>>2]=w,i[v+4>>2]=w>>31;continue a;case 3:s[i[d+64>>2]>>1]=w;continue a;case 4:r[i[d+64>>2]]=w;continue a;case 7:break k;default:continue a}v=i[d+64>>2],i[v>>2]=w,i[v+4>>2]=w>>31;continue a}A=A>>>0<=8?8:A,x|=8,f=120}if(v=h,E=32&f,(k=i[d+64>>2])|(y=i[d+68>>2]))for(;r[0|(v=v-1|0)]=E|o[12272+(15&k)|0],R=!y&k>>>0>15|!!(0|y),S=y,y=y>>>4|0,k=(15&S)<<28|k>>>4,R;);if(!(8&x)|!(i[d+64>>2]|i[d+68>>2]))break g;_=1106+(f>>>4|0)|0,C=2;break g}if(f=h,(y=v=i[d+68>>2])|(k=i[d+64>>2]))for(;r[0|(f=f-1|0)]=7&k|48,S=!y&k>>>0>7|!!(0|y),v=y,y=y>>>3|0,k=(7&v)<<29|k>>>3,S;);if(v=f,!(8&x))break g;A=(0|(f=h-v|0))<(0|A)?A:f+1|0;break g}y=f=i[d+68>>2],k=i[d+64>>2],(0|f)<0?(y=0-(y+!!(0|k)|0)|0,k=0-k|0,i[d+64>>2]=k,i[d+68>>2]=y,C=1,_=1106):2048&x?(C=1,_=1107):_=(C=1&x)?1108:1106}v=me(k,y,h)}if((0|A)<0&&T)break r;if(x=T?-65537&x:x,!(!!((f=i[d+64>>2])|(y=i[d+68>>2]))|A)){b=v=h,A=0;break i}A=(0|(f=!(f|y)+(h-v|0)|0))<(0|A)?A:f;break i}x=!!(0|(b=S=A>>>0>=2147483647?2147483647:A));m:{g:{y:{b:if(!(!(3&(f=v=(f=i[d+64>>2])||3813))|!b))for(;;){if(!o[0|f])break y;if(x=!!(0|(b=b-1|0)),!(3&(f=f+1|0)))break b;if(!b)break}if(!x)break g;if(!(!o[0|f]|b>>>0<4))for(;;){if(~(x=i[f>>2])&x-16843009&-2139062144)break y;if(f=f+4|0,!((b=b-4|0)>>>0>3))break}if(!b)break g}for(;;){if(!o[0|f])break m;if(f=f+1|0,!(b=b-1|0))break}}f=0}if(b=(f=f?f-v|0:S)+v|0,(0|A)>=0){x=y,A=f;break i}if(x=y,A=f,o[0|b])break r;break i}if(A){y=i[d+64>>2];break h}f=0,Se(e,32,I,0,x);break d}i[d+12>>2]=0,i[d+8>>2]=i[d+64>>2],y=d+8|0,i[d+64>>2]=y,A=-1}f=0;h:{for(;;){if(!(v=i[y>>2]))break h;if(!((b=(0|(v=Qe(d+4|0,v)))<0)|v>>>0>A-f>>>0)){if(y=y+4|0,A>>>0>(f=f+v|0)>>>0)continue;break h}break}if(b)break t}if(b=61,(0|f)<0)break n;if(Se(e,32,I,f,x),f)for(b=0,y=i[d+64>>2];;){if(!(v=i[y>>2]))break d;if((b=(v=Qe(d+4|0,v))+b|0)>>>0>f>>>0)break d;if(ie(e,d+4|0,v),y=y+4|0,!(f>>>0>b>>>0))break}else f=0}Se(e,32,I,f,8192^x),f=(0|f)<(0|I)?I:f;continue a}if((0|A)<0&&T)break r;if(b=61,(0|(f=0|Rn[0|u](e,m[d+64>>3],I,A,x,f)))>=0)continue a;break n}r[d+55|0]=i[d+64>>2],A=1,v=p,x=y;break i}y=o[f+1|0],f=f+1|0}if(e)break e;if(!W)break s;for(f=1;;){if(e=i[(f<<2)+l>>2]){if(Y((f<<3)+a|0,e,n,c),w=1,10!=(0|(f=f+1|0)))continue;break e}break}if(w=1,f>>>0>=10)break e;for(;;){if(i[(f<<2)+l>>2])break o;if(10==(0|(f=f+1|0)))break}break e}b=28;break n}if((0|(A=(0|A)>(0|(S=b-v|0))?A:S))>(2147483647^C))break r;if(b=61,(0|N)<(0|(f=(0|(y=A+C|0))<(0|I)?I:y)))break n;Se(e,32,f,y,x),ie(e,_,C),Se(e,48,f,y,65536^x),Se(e,48,A,S,0),ie(e,v,S),Se(e,32,f,y,8192^x);continue}break}w=0;break e}b=61}i[5341]=b}w=-1}return D=d+80|0,w}function z(e,t,n,a,s,l,u){var c,d=0,h=0,p=0,f=0,m=0,g=0,y=0,b=0,x=0,k=0,w=0,S=0,C=0,I=0,W=0,_=0;D=c=D-17024|0,d=(f=i[s+4>>2])>>>5|0,m=(31&f)<<27|(k=i[s>>2])>>>5,i[s>>2]=m,f=d,i[s+4>>2]=d,p=i[a>>2]-5|0,i[a>>2]=p;e:{if(p>>>0<=31){if((h=(d=i[n>>2])+4|0)>>>0>t>>>0)break e;g=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[n>>2]=h,h=31&p,(63&p)>>>0>=32?(d=g<<h,g=0):(d=(1<<h)-1&g>>>32-h,g<<=h),m|=g,p=i[a>>2]+32|0,f|=d}if(b=(31&f)<<27|m>>>5,f=d=f>>>5|0,i[s>>2]=b,i[s+4>>2]=d,p=p-5|0,i[a>>2]=p,p>>>0<=31){if((h=(d=i[n>>2])+4|0)>>>0>t>>>0)break e;g=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[n>>2]=h,h=31&p,(63&p)>>>0>=32?(d=g<<h,g=0):(d=(1<<h)-1&g>>>32-h,g<<=h),b|=g,p=i[a>>2]+32|0,f|=d}if(h=0,et(c+16704|0,0,320),g=(15&f)<<28|b>>>4,i[s>>2]=g,f=f>>>4|0,i[s+4>>2]=f,p=p-4|0,i[a>>2]=p,p>>>0<=31){if((x=(d=i[n>>2])+4|0)>>>0>t>>>0)break e;w=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,y=31&p,(63&p)>>>0>=32?(d=w<<y,y=0):(d=(1<<y)-1&w>>>32-y,y=w<<y),g|=y,i[s>>2]=g,f|=d,i[s+4>>2]=f,i[n>>2]=x,p=i[a>>2]+32|0,i[a>>2]=p}w=257+(I=31&k)|0,_=258+((W=31&m)+I|0)|0,r[c+16687|0]=0,r[c+16688|0]=0,r[c+16689|0]=0,r[c+16690|0]=0,i[c+16680>>2]=0,i[c+16684>>2]=0,i[c+16672>>2]=0,i[c+16676>>2]=0,k=4+(15&b)|0;t:{for(;(0|h)!=(0|k);){if(m=(7&f)<<29|g>>>3,i[s>>2]=m,f=f>>>3|0,i[s+4>>2]=f,p=p-3|0,i[a>>2]=p,p>>>0<=31){if((x=(d=i[n>>2])+4|0)>>>0>t>>>0)break t;y=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,b=31&p,(63&p)>>>0>=32?(d=y<<b,y=0):(d=(1<<b)-1&y>>>32-b,y<<=b),m|=y,i[s>>2]=m,f|=d,i[s+4>>2]=f,i[n>>2]=x,p=i[a>>2]+32|0,i[a>>2]=p}r[o[h+11200|0]+(c+16672|0)|0]=7&g,h=h+1|0,g=m}if(Q(19,c+16672|0,c+288|0)){k=15,b=0;n:{r:for(;;){if(b>>>0<_>>>0){if((h=i[(c+288|0)+((4095&g)<<2)>>2])>>>0<512)break t;if(h>>>0>=16896)break n;if(m=31&(d=y=h>>>9|0),(63&d)>>>0>=32?(d=0,g=f>>>m|0):(d=f>>>m|0,g=((1<<m)-1&f)<<32-m|g>>>m),i[s>>2]=g,f=d,i[s+4>>2]=d,p=p-y|0,i[a>>2]=p,p>>>0<=31){if((x=(d=i[n>>2])+4|0)>>>0>t>>>0)break t;y=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,m=31&p,(63&p)>>>0>=32?(d=y<<m,m=0):(d=(1<<m)-1&y>>>32-m,m=y<<m),g|=m,i[s>>2]=g,f|=d,i[s+4>>2]=f,i[n>>2]=x,p=i[a>>2]+32|0,i[a>>2]=p}if((d=511&h)>>>0<=15){if(d>>>0>12)break t;k=d?d>>>0>k>>>0?k:d:k,r[(c+16704|0)+b|0]=h,b=b+1|0;continue}y=0,h=0,S=0;a:{s:{i:switch(d-16|0){case 0:if(m=(3&f)<<30|g>>>2,i[s>>2]=m,f=f>>>2|0,i[s+4>>2]=f,p=p-2|0,i[a>>2]=p,p>>>0<=31){if((S=(d=i[n>>2])+4|0)>>>0>t>>>0)break t;x=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,h=31&p,(63&p)>>>0>=32?(d=x<<h,h=0):(d=(1<<h)-1&x>>>32-h,h=x<<h),m|=h,i[s>>2]=m,f|=d,i[s+4>>2]=f,i[n>>2]=S,p=i[a>>2]+32|0,i[a>>2]=p}if(!b)break t;h=3+(3&g)|0,S=o[16703+(b+c|0)|0],g=m;break a;case 1:if(m=(7&f)<<29|g>>>3,i[s>>2]=m,f=f>>>3|0,i[s+4>>2]=f,p=p-3|0,i[a>>2]=p,p>>>0<=31){if((C=(d=i[n>>2])+4|0)>>>0>t>>>0)break t;x=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,h=31&p,(63&p)>>>0>=32?(d=x<<h,h=0):(d=(1<<h)-1&x>>>32-h,h=x<<h),m|=h,i[s>>2]=m,f|=d,i[s+4>>2]=f,i[n>>2]=C,p=i[a>>2]+32|0,i[a>>2]=p}h=3+(7&g)|0;break s;case 2:break i;default:break a}if(m=(127&f)<<25|g>>>7,i[s>>2]=m,f=f>>>7|0,i[s+4>>2]=f,p=p-7|0,i[a>>2]=p,p>>>0<=31){if((C=(d=i[n>>2])+4|0)>>>0>t>>>0)break t;x=o[0|(d=e+d|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,h=31&p,(63&p)>>>0>=32?(d=x<<h,h=0):(d=(1<<h)-1&x>>>32-h,h=x<<h),m|=h,i[s>>2]=m,f|=d,i[s+4>>2]=f,i[n>>2]=C,p=i[a>>2]+32|0,i[a>>2]=p}h=11+(127&g)|0}g=m}if(h+b>>>0>_>>>0)break e;for(;;){if(!h)continue r;r[(c+16704|0)+b|0]=S,h=h-1|0,b=b+1|0}}break}for(b=0,et((e=Ze(c,c+16704|0,w))+w|0,0,31^I),t=W+1|0,h=0;;){if((0|t)==(0|h)){r:{if(y=0,b-3>>>0<4294967294)break e;if(1!=o[16703+((t=u+w|0)+e|0)|0]|2==(0|b)&1!=o[t+(e+16704|0)|0])break e;if(!Q(w,e,l))break e;for(;;){if(4096==(0|y)){y=1;break e}if(!(256&(t=i[(n=(y<<2)+l|0)>>2]))&&(e=t>>>9&15)){if(e>>>0>=13)break r;(a=12-e|0)>>>0<k>>>0||!(e=(s=i[(y>>>e<<2)+l>>2])>>>9&15)|e>>>0>a>>>0||(i[n>>2]=t|s<<16&33488896|e<<25)}y=y+1|0}}break}b=(1==o[e+16704+(h+w)|0])+b|0,h=h+1|0}A(2229,2025,2089,1737),v()}A(3605,2025,2001,1737),v()}}y=0}return D=c+17024|0,y}function G(e){var t=0,n=0,r=0,a=0,s=0,o=0,l=0;e:if(e|=0){s=(r=e-8|0)+(e=-8&(t=i[e-4>>2]))|0;t:if(!(1&t)){if(!(3&t))break e;if((r=r-(t=i[r>>2])|0)>>>0<p[5346])break e;if(e=e+t|0,i[5347]==(0|r)){if(!(3&~(t=i[s+4>>2])))return i[5344]=e,i[s+4>>2]=-2&t,i[r+4>>2]=1|e,void(i[e+r>>2]=e)}else{if(t>>>0<=255){if(a=i[r+8>>2],t=t>>>3|0,(0|(n=i[r+12>>2]))==(0|a)){i[5342]=i[5342]&ft(t);break t}i[a+12>>2]=n,i[n+8>>2]=a;break t}if(l=i[r+24>>2],(0|r)==(0|(t=i[r+12>>2])))if((n=i[(a=r+20|0)>>2])||(n=i[(a=r+16|0)>>2])){for(;o=a,(n=i[(a=(t=n)+20|0)>>2])||(a=t+16|0,n=i[t+16>>2]););i[o>>2]=0}else t=0;else n=i[r+8>>2],i[n+12>>2]=t,i[t+8>>2]=n;if(!l)break t;a=i[r+28>>2];n:{if(i[(n=21672+(a<<2)|0)>>2]==(0|r)){if(i[n>>2]=t,t)break n;i[5343]=i[5343]&ft(a);break t}if(i[l+(i[l+16>>2]==(0|r)?16:20)>>2]=t,!t)break t}if(i[t+24>>2]=l,(n=i[r+16>>2])&&(i[t+16>>2]=n,i[n+24>>2]=t),!(n=i[r+20>>2]))break t;i[t+20>>2]=n,i[n+24>>2]=t}}if(!(r>>>0>=s>>>0)&&1&(t=i[s+4>>2])){t:{if(!(2&t)){if(i[5348]==(0|s)){if(i[5348]=r,e=i[5345]+e|0,i[5345]=e,i[r+4>>2]=1|e,i[5347]!=(0|r))break e;return i[5344]=0,void(i[5347]=0)}if(i[5347]==(0|s))return i[5347]=r,e=i[5344]+e|0,i[5344]=e,i[r+4>>2]=1|e,void(i[e+r>>2]=e);e=(-8&t)+e|0;n:if(t>>>0<=255){if(a=i[s+8>>2],t=t>>>3|0,(0|(n=i[s+12>>2]))==(0|a)){i[5342]=i[5342]&ft(t);break n}i[a+12>>2]=n,i[n+8>>2]=a}else{if(l=i[s+24>>2],(0|s)==(0|(t=i[s+12>>2])))if((n=i[(a=s+20|0)>>2])||(n=i[(a=s+16|0)>>2])){for(;o=a,(n=i[(a=(t=n)+20|0)>>2])||(a=t+16|0,n=i[t+16>>2]););i[o>>2]=0}else t=0;else n=i[s+8>>2],i[n+12>>2]=t,i[t+8>>2]=n;if(l){a=i[s+28>>2];r:{if(i[(n=21672+(a<<2)|0)>>2]==(0|s)){if(i[n>>2]=t,t)break r;i[5343]=i[5343]&ft(a);break n}if(i[l+(i[l+16>>2]==(0|s)?16:20)>>2]=t,!t)break n}i[t+24>>2]=l,(n=i[s+16>>2])&&(i[t+16>>2]=n,i[n+24>>2]=t),(n=i[s+20>>2])&&(i[t+20>>2]=n,i[n+24>>2]=t)}}if(i[r+4>>2]=1|e,i[e+r>>2]=e,i[5347]!=(0|r))break t;return void(i[5344]=e)}i[s+4>>2]=-2&t,i[r+4>>2]=1|e,i[e+r>>2]=e}if(e>>>0<=255)return t=21408+(-8&e)|0,(n=i[5342])&(e=1<<(e>>>3))?e=i[t+8>>2]:(i[5342]=e|n,e=t),i[t+8>>2]=r,i[e+12>>2]=r,i[r+12>>2]=t,void(i[r+8>>2]=e);a=31,e>>>0<=16777215&&(t=e>>>8|0,t<<=o=t+1048320>>>16&8,a=28+((t=((t<<=a=t+520192>>>16&4)<<(n=t+245760>>>16&2)>>>15|0)-(n|a|o)|0)<<1|e>>>t+21&1)|0),i[r+28>>2]=a,i[r+16>>2]=0,i[r+20>>2]=0,o=21672+(a<<2)|0;t:{n:{if((n=i[5343])&(t=1<<a)){for(a=e<<(31!=(0|a)?25-(a>>>1|0):0),t=i[o>>2];;){if(n=t,(-8&i[t+4>>2])==(0|e))break n;if(t=a>>>29|0,a<<=1,!(t=i[16+(o=n+(4&t)|0)>>2]))break}i[o+16>>2]=r,i[r+24>>2]=n}else i[5343]=t|n,i[o>>2]=r,i[r+24>>2]=o;i[r+12>>2]=r,i[r+8>>2]=r;break t}e=i[n+8>>2],i[e+12>>2]=r,i[n+8>>2]=r,i[r+24>>2]=0,i[r+12>>2]=n,i[r+8>>2]=e}e=i[5350]-1|0,i[5350]=e||-1}}}function V(e,t){var n,r=0,a=0,s=0,o=0,l=0;n=e+t|0;e:{t:if(!(1&(r=i[e+4>>2]))){if(!(3&r))break e;t=(r=i[e>>2])+t|0;n:{if((0|(e=e-r|0))!=i[5347]){if(r>>>0<=255){if(s=i[e+8>>2],r=r>>>3|0,(0|(a=i[e+12>>2]))!=(0|s))break n;i[5342]=i[5342]&ft(r);break t}if(l=i[e+24>>2],(0|(r=i[e+12>>2]))==(0|e))if((a=i[(s=e+20|0)>>2])||(a=i[(s=e+16|0)>>2])){for(;o=s,(a=i[(s=(r=a)+20|0)>>2])||(s=r+16|0,a=i[r+16>>2]););i[o>>2]=0}else r=0;else a=i[e+8>>2],i[a+12>>2]=r,i[r+8>>2]=a;if(!l)break t;s=i[e+28>>2];r:{if(i[(a=21672+(s<<2)|0)>>2]==(0|e)){if(i[a>>2]=r,r)break r;i[5343]=i[5343]&ft(s);break t}if(i[l+(i[l+16>>2]==(0|e)?16:20)>>2]=r,!r)break t}if(i[r+24>>2]=l,(a=i[e+16>>2])&&(i[r+16>>2]=a,i[a+24>>2]=r),!(a=i[e+20>>2]))break t;i[r+20>>2]=a,i[a+24>>2]=r;break t}if(3&~(r=i[n+4>>2]))break t;return i[5344]=t,i[n+4>>2]=-2&r,i[e+4>>2]=1|t,void(i[n>>2]=t)}i[s+12>>2]=a,i[a+8>>2]=s}t:{if(!(2&(r=i[n+4>>2]))){if(i[5348]==(0|n)){if(i[5348]=e,t=i[5345]+t|0,i[5345]=t,i[e+4>>2]=1|t,i[5347]!=(0|e))break e;return i[5344]=0,void(i[5347]=0)}if(i[5347]==(0|n))return i[5347]=e,t=i[5344]+t|0,i[5344]=t,i[e+4>>2]=1|t,void(i[e+t>>2]=t);t=(-8&r)+t|0;n:if(r>>>0<=255){if(s=i[n+8>>2],r=r>>>3|0,(0|(a=i[n+12>>2]))==(0|s)){i[5342]=i[5342]&ft(r);break n}i[s+12>>2]=a,i[a+8>>2]=s}else{if(l=i[n+24>>2],(0|n)==(0|(r=i[n+12>>2])))if((s=i[(a=n+20|0)>>2])||(s=i[(a=n+16|0)>>2])){for(;o=a,(s=i[(a=(r=s)+20|0)>>2])||(a=r+16|0,s=i[r+16>>2]););i[o>>2]=0}else r=0;else a=i[n+8>>2],i[a+12>>2]=r,i[r+8>>2]=a;if(l){s=i[n+28>>2];r:{if(i[(a=21672+(s<<2)|0)>>2]==(0|n)){if(i[a>>2]=r,r)break r;i[5343]=i[5343]&ft(s);break n}if(i[l+(i[l+16>>2]==(0|n)?16:20)>>2]=r,!r)break n}i[r+24>>2]=l,(a=i[n+16>>2])&&(i[r+16>>2]=a,i[a+24>>2]=r),(a=i[n+20>>2])&&(i[r+20>>2]=a,i[a+24>>2]=r)}}if(i[e+4>>2]=1|t,i[e+t>>2]=t,i[5347]!=(0|e))break t;return void(i[5344]=t)}i[n+4>>2]=-2&r,i[e+4>>2]=1|t,i[e+t>>2]=t}if(t>>>0<=255)return r=21408+(-8&t)|0,(a=i[5342])&(t=1<<(t>>>3))?t=i[r+8>>2]:(i[5342]=t|a,t=r),i[r+8>>2]=e,i[t+12>>2]=e,i[e+12>>2]=r,void(i[e+8>>2]=t);s=31,t>>>0<=16777215&&(r=t>>>8|0,r<<=o=r+1048320>>>16&8,s=28+((r=((r<<=s=r+520192>>>16&4)<<(a=r+245760>>>16&2)>>>15|0)-(a|s|o)|0)<<1|t>>>r+21&1)|0),i[e+28>>2]=s,i[e+16>>2]=0,i[e+20>>2]=0,o=21672+(s<<2)|0;t:{if((a=i[5343])&(r=1<<s)){for(s=t<<(31!=(0|s)?25-(s>>>1|0):0),r=i[o>>2];;){if(a=r,(-8&i[r+4>>2])==(0|t))break t;if(r=s>>>29|0,s<<=1,!(r=i[16+(o=a+(4&r)|0)>>2]))break}i[o+16>>2]=e,i[e+24>>2]=a}else i[5343]=r|a,i[o>>2]=e,i[e+24>>2]=o;return i[e+12>>2]=e,void(i[e+8>>2]=e)}t=i[a+8>>2],i[t+12>>2]=e,i[a+8>>2]=e,i[e+24>>2]=0,i[e+12>>2]=a,i[e+8>>2]=t}}function U(e,t){var n,r,a,s=0,o=0,l=0,u=0,c=0,d=0,h=0,p=0;if(!e)return L(t);if(t>>>0>=4294967232)return i[5341]=48,0;n=t>>>0<11?16:t+11&-8,s=-8&(a=i[(r=e-4|0)>>2]);e:{t:if(3&a){if(l=s+(u=e-8|0)|0,s>>>0>=n>>>0){if((t=s-n|0)>>>0<16)break e;return i[r>>2]=1&a|n|2,i[4+(s=n+u|0)>>2]=3|t,i[l+4>>2]=1|i[l+4>>2],V(s,t),e}if(i[5348]==(0|l)){if((s=s+i[5345]|0)>>>0<=n>>>0)break t;return i[r>>2]=1&a|n|2,s=s-n|0,i[4+(t=n+u|0)>>2]=1|s,i[5345]=s,i[5348]=t,e}if(i[5347]==(0|l)){if((s=s+i[5344]|0)>>>0<n>>>0)break t;return(t=s-n|0)>>>0>=16?(i[r>>2]=1&a|n|2,i[4+(o=n+u|0)>>2]=1|t,i[(s=s+u|0)>>2]=t,i[s+4>>2]=-2&i[s+4>>2]):(i[r>>2]=s|1&a|2,i[4+(t=s+u|0)>>2]=1|i[t+4>>2],t=0),i[5347]=o,i[5344]=t,e}if(!(2&(o=i[l+4>>2])||(c=s+(-8&o)|0)>>>0<n>>>0)){h=c-n|0;n:if(o>>>0<=255){if(t=i[l+8>>2],o=o>>>3|0,(0|(s=i[l+12>>2]))==(0|t)){i[5342]=i[5342]&ft(o);break n}i[t+12>>2]=s,i[s+8>>2]=t}else{if(d=i[l+24>>2],(0|l)==(0|(s=i[l+12>>2])))if((o=i[(t=l+20|0)>>2])||(o=i[(t=l+16|0)>>2])){for(;p=t,(o=i[(t=(s=o)+20|0)>>2])||(t=s+16|0,o=i[s+16>>2]););i[p>>2]=0}else s=0;else t=i[l+8>>2],i[t+12>>2]=s,i[s+8>>2]=t;if(d){t=i[l+28>>2];r:{if(i[(o=21672+(t<<2)|0)>>2]==(0|l)){if(i[o>>2]=s,s)break r;i[5343]=i[5343]&ft(t);break n}if(i[(i[d+16>>2]==(0|l)?16:20)+d>>2]=s,!s)break n}i[s+24>>2]=d,(t=i[l+16>>2])&&(i[s+16>>2]=t,i[t+24>>2]=s),(t=i[l+20>>2])&&(i[s+20>>2]=t,i[t+24>>2]=s)}}return h>>>0<=15?(i[r>>2]=1&a|c|2,i[4+(t=u+c|0)>>2]=1|i[t+4>>2],e):(i[r>>2]=1&a|n|2,i[4+(t=n+u|0)>>2]=3|h,i[4+(s=u+c|0)>>2]=1|i[s+4>>2],V(t,h),e)}}else{if(n>>>0<256|s>>>0<(4|n)>>>0)break t;if(s-n>>>0<=i[5462]<<1>>>0)break e}if(!(s=L(t)))return 0;Ze(s,e,t>>>0>(o=(3&(o=i[r>>2])?-4:-8)+(-8&o)|0)>>>0?o:t),G(e),e=s}return e}function H(e,t,n,a){var s,l,u=0,c=0,d=0,h=0,p=0,f=0,m=0;for(D=s=D-48|0,p=yn(l=s+32|0),d=zt(i[t+4>>2],o[t+11|0]),c=zt(i[a+4>>2],o[a+11|0]),Fe(p,yt(t),d,c+d|0),Ie(p,yt(a),c),p=s+16|0,c=yt(n),f=zt(i[n+4>>2],o[n+11|0]),d=yt(l),n=zt(i[l+4>>2],o[l+11|0]),D=t=D-320|0,et(t+256|0,0,64),n>>>0<=64?Ze(t+256|0,d,n):(te(m=Ae(t+144|0),d,n),q(m,t+256|0));;){if(64==(0|u)){for(te(n=Ae(t+144|0),t+256|0,64),te(n,c,f),q(n,t+112|0),u=0;64!=(0|u);)r[0|(n=(t+256|0)+u|0)]=106^o[0|n],u=u+1|0;break}r[0|(n=(t+256|0)+u|0)]=54^o[0|n],u=u+1|0}for(te(n=Ae(t),t+256|0,64),te(n,t+112|0,32),D=u=D-32|0,q(n,u),ne(d=yn(p),64),n=0;32!=(0|n);)c=o[n+u|0],un(un(d,r[11776+(c>>>4|0)|0]),r[11776+(15&c)|0]),n=n+1|0;for(D=u+32|0,D=f=(D=t+320|0)-16|0,d=yt(t=m=ce(f,p)),n=dn(i[t+4>>2],o[t+11|0]),ne(t=yn(s),(n+2>>>0)/3<<2),u=0;n>>>0>u>>>0;){re(t,r[3642+(o[0|(c=u+d|0)]>>>2|0)|0]),c=o[0|c]<<4&48;e:if((h=u+1|0)>>>0<n>>>0){if(re(t,r[3642+(c|o[0|(h=d+h|0)]>>>4)|0]),c=o[0|h]<<2&60,(h=u+2|0)>>>0<n>>>0){re(t,r[3642+(c|o[0|(h=d+h|0)]>>>6)|0]),c=r[3642+(63&o[0|h])|0];break e}re(t,r[c+3642|0]),c=61}else re(t,r[c+3642|0]),re(t,61),c=61;re(t,c<<24>>24),u=u+3|0}Et(m),D=f+16|0,t=e,e=yt(a),n=zt(i[a+4>>2],o[a+11|0]),a=zt(i[s+4>>2],o[s+11|0]);e:if(n>>>0<=(u=bt(s))-a>>>0){if(!n)break e;u=yt(s),a&&(Vt(n+u|0,u,a),e=e+(e>>>0>=u>>>0&&e>>>0<a+u>>>0?n:0)|0),e=Vt(u,e,n),It(s,n=n+a|0),Cn(e+n|0,0)}else se(s,u,(n+a|0)-u|0,a,0,0,n,e);rt(t,s),Et(s),Et(p),Et(l),D=s+48|0}function j(e,t){var n=0,r=0,a=0,s=0,o=0,l=0;if((r=gn(n=i[e>>2],i[e+4>>2]))>>>0<t>>>0){if(D=o=D-32|0,(s=t-r|0)>>>0<=(t=i[kn(e)>>2])-(n=i[e+4>>2])>>>0)for(D=r=D-16|0,e=mt(r,e,s),t=i[e+4>>2],n=i[e+8>>2];;){if((0|t)==(0|n)){Ut(e),D=r+16|0;break}In(t),t=t+1|0,i[e+4>>2]=t}else{for(l=kn(e),r=o+8|0,a=gn(i[e>>2],n)+s|0,D=n=D-16|0,i[n+12>>2]=a,a>>>0<=(t=qe())>>>0?((a=i[kn(e)>>2]-i[e>>2]|0)>>>0<t>>>1>>>0&&(i[n+8>>2]=a<<1,t=i[Mt(n+8|0,n+12|0)>>2]),D=n+16|0):(Wn(),v()),a=gn(i[e>>2],i[e+4>>2]),rn(ln(r+12|0)+4|0,l),n=t?Ue(t):0,i[r>>2]=n,a=n+a|0,i[r+8>>2]=a,i[r+4>>2]=a,i[bn(r)>>2]=t+n,D=n=D-16|0,i[n>>2]=i[r+8>>2],t=i[r+8>>2],i[n+8>>2]=r+8,i[n+4>>2]=t+s,t=i[n>>2];i[n+4>>2]!=(0|t);)In(t),t=i[n>>2]+1|0,i[n>>2]=t;for(i[i[n+8>>2]>>2]=i[n>>2],D=n+16|0,t=r+4|0,s=i[e>>2],n=i[e+4>>2]-s|0,a=i[t>>2]-n|0,i[t>>2]=a,(0|n)>0&&Ze(a,s,n),Ct(e,t),Ct(e+4|0,r+8|0),Ct(kn(e),bn(r)),i[r>>2]=i[r+4>>2],t=i[r+4>>2],e=i[r+8>>2];(0|e)!=(0|t);)e=e-1|0,i[r+8>>2]=e;(e=i[r>>2])&&G(e)}D=o+32|0}else t>>>0<r>>>0&&An(e,t+n|0)}function q(e,t){var n,a=0,s=0,l=0,u=0,c=0,d=0,p=0;for(D=n=D-32|0;;){if(8==(0|a)){e:{for(D=c=D+-64|0,s=(d=(((l=505&(s=(a=i[e+8>>2])<<3|1))>>>0>448?960:448)-l|0)+s|0)>>>3|0,a>>>0<=63?(r[12+(e+a|0)|0]=128,a=i[e+8>>2]):r[0|c]=128;;){if((a=a+1|0)>>>0>63){for(;a>>>0<s>>>0;)r[(a+c|0)-64|0]=0,a=a+1|0;p=e+12|0,u=d>>>0<512?p+s|0:(s+c|0)-64|0,a=i[e+4>>2],l=65280&(l=(a=(l=(s=i[e+8>>2])+i[e>>2]|0)>>>0<s>>>0?a+1|0:a)<<27|(s=l)>>>5)|255&(a<<11|s>>>21)|s<<27|s<<11&16711680,a=-16777216&((31&a)<<27|s>>>5)|16711680&((2097151&a)<<11|s>>>21)|a>>>5&65280|(a=a<<3|s>>>29)>>>24,r[0|u]=a,r[u+1|0]=a>>>8,r[u+2|0]=a>>>16,r[u+3|0]=a>>>24,a=(s=l)|(l=0)|l,r[u+4|0]=a,r[u+5|0]=a>>>8,r[u+6|0]=a>>>16,r[u+7|0]=a>>>24,B(e,p),d>>>0>=513&&B(e,c),D=c- -64|0;break}r[12+(e+a|0)|0]=0}for(a=0;;){if(8==(0|a))break e;s=(l=a<<2)+e|0,r[0|t]=o[s+79|0],r[t+1|0]=h[s+78>>1],r[t+2|0]=i[s+76>>2]>>>8,r[t+3|0]=i[s+76>>2],i[s+76>>2]=i[l+n>>2],a=a+1|0,t=t+4|0}}break}i[(s=a<<2)+n>>2]=i[76+(e+s|0)>>2],a=a+1|0}D=n+32|0}function Q(e,t,n){var r,a=0,s=0,l=0,u=0,c=0;for(D=r=D-1296|0,et(r+1232|0,0,64);;){if((0|e)==(0|a)){e:for(i[r+1152>>2]=0,i[r+1156>>2]=0,s=0,a=1;;)if(16==(0|a)){if(65536!=(0|s)){a=15,s=0;t:{for(;;){if(!a)break t;if(l=a<<2,a=a-1|0,!((s=i[l+(r+1232|0)>>2]+s|0)>>>0<=1))break}a=0;break e}if(a=0,1!=(0|s))break e}for(a=0;;)if((0|e)==(0|a))for(l=0,c=et(n,0,16384);;){if((0|e)==(0|l)){a=1;break e}t:if(n=o[t+l|0])for(u=i[(l<<2)+r>>2],a=0,s=n;;)if(s)a=1&u|a<<1,s=s-1|0,u=u>>>1|0;else for(s=1<<n,n=n<<9|l;;){if(a>>>0>4095)break t;i[(a<<2)+c>>2]=n,a=a+s|0}l=l+1|0}else s=(r+1152|0)+(o[t+a|0]<<2)|0,l=i[s>>2],i[(a<<2)+r>>2]=l,i[s>>2]=l+1,a=a+1|0}else l=a<<2,a=a+1|0,s=i[l+(r+1232|0)>>2]+s<<1,i[(r+1152|0)+(a<<2)>>2]=s;break}s=(r+1232|0)+(o[t+a|0]<<2)|0,i[s>>2]=i[s>>2]+1,a=a+1|0}return D=r+1296|0,a}function X(e,t,n){var r=0,a=0,s=0,i=0,o=0,l=0,u=0,c=0,d=0;r=e;e:{t:{n:{r:{a:{s:{i:{o:{l:{u:{if(t){if(!n)break u;break l}e=(r>>>0)/(n>>>0)|0,M=0;break e}if(!r)break o;break i}if(!(n-1&n))break s;a=0-(i=(b(n)+33|0)-b(t)|0)|0;break r}e=(t>>>0)/0|0,M=0;break e}if((e=32-b(t)|0)>>>0<31)break a;break n}if(1==(0|n))break t;n=31&(e=n?31-b(n-1^n)|0:32),(63&e)>>>0>=32?(e=0,t=t>>>n|0):(e=t>>>n|0,t=((1<<n)-1&t)<<32-n|r>>>n),M=e,e=t;break e}i=e+1|0,a=63-e|0}if(s=31&(e=63&i),e>>>0>=32?(e=0,o=t>>>s|0):(e=t>>>s|0,o=((1<<s)-1&t)<<32-s|r>>>s),s=e,a=31&(e=63&a),e>>>0>=32?(e=r<<a,r=0):(e=(1<<a)-1&r>>>32-a|t<<a,r<<=a),t=e,i)for(d=-1==(0|(a=n-1|0))?-1:0;o=(e=o<<1|t>>>31)-(u=n&(l=d-((s=s<<1|o>>>31)+(e>>>0>a>>>0)|0)>>31))|0,s=s-(e>>>0<u>>>0)|0,t=t<<1|r>>>31,r=c|r<<1,c=1&l,i=i-1|0;);M=t<<1|r>>>31,e=c|r<<1;break e}r=0,t=0}M=t,e=r}return e}function Z(e,t,n,r){var a,s,l=0,u=0,c=0,d=0;D=a=D-48|0,Ot(e,n,t),s=e+4|0,i[a+12>>2]=0,i[a+16>>2]=0,i[a+8>>2]=a+44,t=a+12|0,i[a+4>>2]=t,i[a>>2]=t,i[a+20>>2]=0,i[a+24>>2]=0,i[a+28>>2]=0,i[a+32>>2]=0,i[a+36>>2]=0,i[a+40>>2]=0;e:{for(;;){if(t=i[s>>2],t=0|Rn[i[i[t>>2]+12>>2]](t,r),12!=o[t+4|0])break e;if(i[e+4>>2]=i[t+8>>2],t=t+12|0,i[e>>2]=i[(i[t>>2]<i[e>>2]?t:e)>>2],(0|(t=i[a+4>>2]))==i[a+8>>2]){t=(u=pn(i[a>>2],t)<<1)<<2,d=i[a+4>>2],c=i[a>>2];t:{n:{if(Qt(a)){if(!(t=L(t)))break n;(0|(l=i[a>>2]))!=(0|(n=i[a+4>>2]))&&Pe(t,l,n-l|0),i[a>>2]=t}else if(t=U(c,t),i[a>>2]=t,!t)break n;i[a+8>>2]=(u<<2)+t,i[a+4>>2]=(pn(c,d)<<2)+t;break t}Yt(),v()}t=i[a+4>>2]}if(n=i[s>>2],i[a+4>>2]=t+4,i[t>>2]=n,!((t=pn(n=i[a>>2],i[a+4>>2]))>>>0<2|i[s>>2]!=i[(t-1>>>1<<2)+n>>2]))break}i[s>>2]=0}Qt(a)||G(i[a>>2]),D=a+48|0}function K(e,t,n,a,s,i,l){var u,c,d=0,h=0,p=0,f=0,m=0,y=0,b=0;c=g(s,l),u=g(s,i)<<2,i=0,f=2;e:{t:{n:{for(;;){if((d=f+1|0)>>>0>t>>>0)break e;if(6&(m=o[0|(s=e+f|0)]))break e;if((y=f+5|0)>>>0>t>>>0)break e;if((0|(b=o[e+d|0]|o[s+2|0]<<8))!=(65535^(o[s+3|0]|o[s+4|0]<<8)))break e;if(s=0,(f=y+b|0)>>>0>t>>>0)break n;for(m&=1;(0|s)!=(0|b);){d=o[(s+y|0)+e|0];r:{if(!i){if(d)break e;if(d=0,!p)break r;A(1429,2025,2160,1384),v()}if(p>>>0<=3){if((0|h)==(0|u))break e;r[a+h|0]=d,h=h+1|0}if(d=(p=(0|(d=p+1|0))!=(0|l))?d:0,!(p|l>>>0>3)){if((0|h)==(0|u))break e;r[a+h|0]=255,h=h+1|0,d=0}}if((0|i)==(0|c)){if(i=0,d)break t}else i=i+1|0;s=s+1|0,p=d}if(m)break}s=!p&(f+4|0)==(0|n)&(0|h)==(0|u)}return s}A(1429,2025,2188,1384),v()}return 0}function J(){N(21332,2e3),T(21333,1668,1,1,0),k(21334,1494,1,-128,127),k(21335,1487,1,-128,127),k(21336,1485,1,0,255),k(21337,1241,2,-32768,32767),k(21338,1232,2,0,65535),k(21339,1265,4,-2147483648,2147483647),k(21340,1256,4,0,-1),k(21341,1808,4,-2147483648,2147483647),k(21342,1799,4,0,-1),Bt(21343,1358,-2147483648,2147483647),Bt(21344,1357,0,-1),_(21345,1304,4),_(21346,1969,8),I(21347,1844),I(21348,2828),w(21349,4,1813),w(21350,2,1856),w(21351,4,1871),$(21352,1680),x(21353,0,2759),x(21354,0,2861),x(21355,1,2789),x(21356,2,2381),x(21357,3,2412),x(21358,4,2452),x(21359,5,2481),x(21360,4,2898),x(21361,5,2928),x(21354,0,2583),x(21355,1,2550),x(21356,2,2649),x(21357,3,2615),x(21358,4,2716),x(21359,5,2682),x(21362,6,2519),x(21363,7,2967)}function Y(e,t,n,a){switch(t-9|0){case 0:return t=i[n>>2],i[n>>2]=t+4,void(i[e>>2]=i[t>>2]);case 6:return t=i[n>>2],i[n>>2]=t+4,t=s[t>>1],i[e>>2]=t,void(i[e+4>>2]=t>>31);case 7:return t=i[n>>2],i[n>>2]=t+4,i[e>>2]=h[t>>1],void(i[e+4>>2]=0);case 8:return t=i[n>>2],i[n>>2]=t+4,t=r[0|t],i[e>>2]=t,void(i[e+4>>2]=t>>31);case 9:return t=i[n>>2],i[n>>2]=t+4,i[e>>2]=o[0|t],void(i[e+4>>2]=0);case 16:return t=i[n>>2]+7&-8,i[n>>2]=t+8,void(m[e>>3]=m[t>>3]);case 17:Rn[0|a](e,n);default:return;case 1:case 4:case 14:return t=i[n>>2],i[n>>2]=t+4,t=i[t>>2],i[e>>2]=t,void(i[e+4>>2]=t>>31);case 2:case 5:case 11:case 15:return t=i[n>>2],i[n>>2]=t+4,i[e>>2]=i[t>>2],void(i[e+4>>2]=0);case 3:case 10:case 12:case 13:}t=i[n>>2]+7&-8,i[n>>2]=t+8,n=i[t+4>>2],i[e>>2]=i[t>>2],i[e+4>>2]=n}function ee(e,t,n,r,a){var s,o=0,l=0;if(D=s=D-208|0,i[s+204>>2]=n,et(n=s+160|0,0,40),i[s+200>>2]=i[s+204>>2],(0|P(0,t,s+200|0,s+80|0,n,r,a))<0)a=-1;else{i[e+76>>2],o=i[e>>2],i[e+72>>2]<=0&&(i[e>>2]=-33&o);e:{t:{if(i[e+48>>2]){if(i[e+16>>2])break t}else i[e+48>>2]=80,i[e+28>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,l=i[e+44>>2],i[e+44>>2]=s;if(n=-1,Ne(e))break e}n=P(e,t,s+200|0,s+80|0,s+160|0,r,a)}l&&(Rn[i[e+36>>2]](e,0,0),i[e+48>>2]=0,i[e+44>>2]=l,i[e+28>>2]=0,t=i[e+20>>2],i[e+16>>2]=0,i[e+20>>2]=0,n=t?n:-1),t=e,e=i[e>>2],i[t>>2]=e|32&o,a=32&e?-1:n}return D=s+208|0,a}function te(e,t,n){var a=0,s=0;e:if(!(!n|!(a=i[e+8>>2]))){for(;;){if(a>>>0>63)break e;if(s=o[0|t],i[e+8>>2]=a+1,r[12+(e+a|0)|0]=s,t=t+1|0,a=i[e+8>>2],!(n=n-1|0))break}n=0}64==(0|a)&&(B(e,e+12|0),i[e+8>>2]=0,a=i[e>>2],s=i[e+4>>2]-((a>>>0<4294967232)-1|0)|0,i[e>>2]=a- -64,i[e+4>>2]=s);e:if(n)for(;;)if(n>>>0<64)for(;;){if(!n)break e;a=o[0|t],s=i[e+8>>2],i[e+8>>2]=s+1,r[12+(e+s|0)|0]=a,n=n-1|0,t=t+1|0}else B(e,t),a=i[e>>2],s=i[e+4>>2]-((a>>>0<4294967232)-1|0)|0,i[e>>2]=a- -64,i[e+4>>2]=s,n=n+-64|0,t=t- -64|0}function ne(e,t){var n,r=0,a=0,s=0,l=0,u=0;if(D=n=D-16|0,i[n+12>>2]=t,t>>>0<4294967280)return bt(e)>>>0>=t>>>0||(i[n+8>>2]=zt(i[e+4>>2],o[e+11|0]),(0|(r=at(i[Mt(n+12|0,n+8|0)>>2])))!=(0|bt(e))&&(s=zt(i[e+4>>2],o[e+11|0]),10!=(0|r)?(t=Ue(r+1|0),u=an(a=o[e+11|0]),l=yt(e),a=zt(i[e+4>>2],a)):(l=i[e>>2],u=1,t=e,a=s),t=Gt(t,l,a+1|0),u&&G(l),10==(0|r)?vn(e,s):(Ht(e,r+1|0),An(e,s),Sn(e,t)))),void(D=n+16|0);Wn(),v()}function re(e,t){var n=0,r=0,a=0,s=0,l=0;e:{t:{n:{if(!an(n=o[e+11|0])){if(r=10,10==(0|(n=xn(n))))break n;vn(e,n+1|0),r=e;break e}if((0|(n=i[e+4>>2]))!=(0|(r=sn(i[e+8>>2])-1|0)))break t}D=n=D-16|0,s=yt(e),a=-17,r>>>0<=2147483622&&(i[n+8>>2]=r<<1,i[n+12>>2]=r+1,a=at(i[Mt(n+12|0,n+8|0)>>2])+1|0),l=Ue(a),r&&Gt(l,s,r),10!=(0|r)&&G(s),Sn(e,l),Ht(e,a),D=n+16|0,n=r}r=i[e>>2],An(e,n+1|0)}Cn(e=n+r|0,t),Cn(e+1|0,0)}function ae(e,t){e|=0;var n,r,a,s=0,o=0,l=0;D=n=D-48|0,r=ot(n+32|0,12+(t|=0)|0),a=ot(n+16|0,t+16|0),s=i[t+4>>2],lt(i[e+8>>2],t);e:{t:{n:{r:switch((o=i[t+16>>2])+1|0){case 0:break t;case 1:break r;default:break n}An(t,s);break e}for(s=1;;){if((0|s)==(0|o))break e;l=Ye(t,i[_t(n,4480)>>2],i[n+4>>2]),i[t+12>>2]=s,lt(i[e+8>>2],l),s=s+1|0}}e=_t(n+8|0,3708),Ye(t,i[e>>2],i[e+4>>2])}Rt(a),Rt(r),D=n+48|0}function se(e,t,n,r,a,s,o,l){var u,c=0,d=0,h=0;if(D=u=D-16|0,-18-t>>>0>=n>>>0)return c=yt(e),d=-17,t>>>0<=2147483622&&(i[u+8>>2]=t<<1,i[u+12>>2]=t+n,d=at(i[Mt(u+12|0,u+8|0)>>2])+1|0),n=Ue(d),a&&Gt(n,c,a),o&&Gt(n+a|0,l,o),l=r-(h=a+s|0)|0,(0|r)!=(0|h)&&Gt((n+a|0)+o|0,(a+c|0)+s|0,l),10!=(0|t)&&G(c),Sn(e,n),Ht(e,d),An(t=e,e=l+(a+o|0)|0),Cn(e+n|0,0),void(D=u+16|0);Wn(),v()}function ie(e,t,n){var r=0,a=0,s=0;if(!(32&o[0|e]))e:{r=t;t:{if(!(e=i[(t=e)+16>>2])){if(Ne(t))break t;e=i[t+16>>2]}if(e-(s=i[t+20>>2])>>>0<n>>>0){Rn[i[t+36>>2]](t,r,n);break e}n:if(!(i[t+80>>2]<0)){for(e=n;;){if(a=e,!e)break n;if(10==o[r+(e=a-1|0)|0])break}if(Rn[i[t+36>>2]](t,r,a)>>>0<a>>>0)break t;r=r+a|0,n=n-a|0,s=i[t+20>>2]}Ze(s,r,n),i[t+20>>2]=i[t+20>>2]+n}}}function oe(e,t,n,r,a,s){var o;D=o=D-48|0;e:{t:{n:switch(i[e+8>>2]){case 0:e=4|(n=o+40|0),n=_t(n,1456);break t;case 1:e=4|(n=o+32|0),n=_t(n,1826);break t;case 2:e=4|(n=o+24|0),n=_t(n,s);break t;case 3:e=4|(n=o+16|0),n=_t(n,a);break t;case 4:e=4|(n=o+8|0),n=_t(n,r);break t;case 5:break n;default:break e}e=4|o,n=_t(o,n)}Ye(t,i[n>>2],i[e>>2])}D=o+48|0}function le(e,t,n,a){r[e+53|0]=1;e:if(i[e+4>>2]==(0|n)){r[e+52|0]=1;t:{if(!(n=i[e+16>>2])){if(i[e+36>>2]=1,i[e+24>>2]=a,i[e+16>>2]=t,1!=(0|a))break e;if(1==i[e+48>>2])break t;break e}if((0|t)==(0|n)){if(2==(0|(n=i[e+24>>2]))&&(i[e+24>>2]=a,n=a),1!=i[e+48>>2])break e;if(1==(0|n))break t;break e}i[e+36>>2]=i[e+36>>2]+1}r[e+54|0]=1}}function ue(e,t){var n=0;for(n=-1;;){if(t>>>0<4){for(;t;)n=i[6240+((o[0|e]^255&n)<<2)>>2]^n>>>8,t=t-1|0,e=e+1|0;break}n=(o[0|e]|o[e+1|0]<<8|o[e+2|0]<<16|o[e+3|0]<<24)^n,n=i[7264+(n>>>14&1020)>>2]^i[6240+(n>>>22&1020)>>2]^i[8288+(n>>>6&1020)>>2]^i[9312+((255&n)<<2)>>2],t=t-4|0,e=e+4|0}return~n}function ce(e,t){var n,r=0,a=0,s=0;if(!an(o[t+11|0]))return r=i[t+4>>2],i[e>>2]=i[t>>2],i[e+4>>2]=r,i[e+8>>2]=i[t+8>>2],e;r=e,n=i[t>>2];e:{t:{if(fn(a=i[t+4>>2]))vn(r,a);else{if(a>>>0>=4294967280)break t;Sn(r,t=Ue(s=at(a)+1|0)),Ht(r,s),An(r,a),r=t}Gt(r,n,a+1|0);break e}Wn(),v()}return e}function de(e,t,n,r){var a=0,s=0;if(t=gn(e,t),(0|gn(n,r))==(0|t)){if(r=0,a=t,r=0,t){e:if(t=o[0|e]){for(;;){if((s=o[0|n])&&!(!(a=a-1|0)|(0|t)!=(0|s))){if(n=n+1|0,t=o[e+1|0],e=e+1|0,t)continue;break e}break}r=t}r=(255&r)-o[0|n]|0}}else r=1;return!r}function he(e){var t=0;e:if(!((255&(t=e-65|0))>>>0<=25)){if((e-97&255)>>>0<=25)return e-71|0;if((e-48&255)>>>0<=9)return e+4|0;t=62;t:{switch(e-43|0){default:if(95==(0|e))break t;break;case 0:case 2:break e;case 4:break t;case 1:case 3:}return 255}t=63}return t}function pe(e,t){var n,r=0,a=0;D=n=D-32|0,i[e+12>>2]&&(r=_t(n+24|0,3460),ge(e+8|0,r=Ye(t,i[r>>2],i[r+4>>2])),a=r,r=_t(n+16|0,3253),Ye(a,i[r>>2],i[r+4>>2])),a=e+16|0,e=_t(n+8|0,4053),ge(a,e=Ye(t,i[e>>2],i[e+4>>2])),t=e,e=_t(n,3946),Ye(t,i[e>>2],i[e+4>>2]),D=n+32|0}function fe(e,t,n){var r=0;if(!n)return i[e+4>>2]==i[t+4>>2];if((0|e)==(0|t))return 1;n=i[e+4>>2],e=o[0|n],t=i[t+4>>2];e:if(!(!e|(0|(r=o[0|t]))!=(0|e)))for(;;){if(r=o[t+1|0],!(e=o[n+1|0]))break e;if(t=t+1|0,n=n+1|0,(0|e)!=(0|r))break}return(0|e)==(0|r)}function me(e,t,n){var a=0,s=0,i=0;if(t)for(;s=We(a=X(e,t,10),i=M,246)+e|0,r[0|(n=n-1|0)]=48|s,s=t>>>0>9,e=a,t=i,s;);else a=e;if(a)for(;e=(a>>>0)/10|0,r[0|(n=n-1|0)]=g(e,246)+a|48,t=a>>>0>9,a=e,t;);return n}function ge(e,t){var n,r=0,a=0,s=0,o=0;for(D=n=D-16|0,a=1;(0|r)!=i[e+4>>2];)o=s=i[t+4>>2],a||(Ye(t,i[_t(n+8|0,4480)>>2],i[n+12>>2]),o=i[t+4>>2]),lt(i[i[e>>2]+(r<<2)>>2],t),r=r+1|0,i[t+4>>2]==(0|o)?An(t,s):a=0;D=n+16|0}function ye(e,t,n,a){var s,o;return D=o=D-16|0,i[o+12>>2]=a,D=s=D-160|0,i[s+148>>2]=t-1,i[s+144>>2]=e,t=et(s,0,144),i[t+76>>2]=-1,i[t+36>>2]=15,i[t+80>>2]=-1,i[t+44>>2]=t+159,i[t+84>>2]=t+144,r[0|e]=0,e=ee(t,n,a,13,14),D=t+160|0,D=o+16|0,e}function be(e){var t=0,n=0,r=0;e:{if(3&(t=e))for(;;){if(!o[0|t])break e;if(!(3&(t=t+1|0)))break}for(;n=t,t=t+4|0,!(~(r=i[n>>2])&r-16843009&-2139062144););for(;n=(t=n)+1|0,o[0|t];);}return t-e|0}function ve(e,t){var n,r,a=0;if(d(+e),n=0|l(1),r=0|l(0),2047!=(0|(a=n>>>20&2047))){if(!a)return 0==e?a=0:(e=ve(0x10000000000000000*e,t),a=i[t>>2]+-64|0),i[t>>2]=a,e;i[t>>2]=a-1022,u(0,0|r),u(1,-2146435073&n|1071644672),e=+c()}return e}function Ae(e){return i[e+76>>2]=1779033703,i[e+80>>2]=-1150833019,i[e+8>>2]=0,i[e>>2]=0,i[e+4>>2]=0,i[e+100>>2]=528734635,i[e+104>>2]=1541459225,i[e+92>>2]=1359893119,i[e+96>>2]=-1694144372,i[e+84>>2]=1013904242,i[e+88>>2]=-1521486534,e}function xe(e,t,n,r){var a,s=0;D=a=D-32|0,s=t,t=_t(a+24|0,4053),t=Ye(s,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),s=t,t=_t(a+16|0,r),t=Ye(s,i[t>>2],i[t+4>>2]),lt(i[e+12>>2],t),e=_t(a+8|0,n),Ye(t,i[e>>2],i[e+4>>2]),D=a+32|0}function ke(){F(21316,21317,21318,0,4498,2,4501,0,4501,0,1471,4503,3),O(21316,1,4508,4498,7,8),S(21316,1765,4,4512,4528,9,0|wt(4),0),S(21316,2005,2,4536,4544,10,0|wt(5),0),S(21316,1935,4,4560,4528,11,0|wt(6),0)}function we(e,t,n){var a;if(!(a=i[e+16>>2]))return i[e+36>>2]=1,i[e+24>>2]=n,void(i[e+16>>2]=t);e:{if((0|t)==(0|a)){if(2!=i[e+24>>2])break e;return void(i[e+24>>2]=n)}r[e+54|0]=1,i[e+24>>2]=2,i[e+36>>2]=i[e+36>>2]+1}}function Se(e,t,n,r,a){var s;if(D=s=D-256|0,!(73728&a|(0|n)<=(0|r))){if(et(s,255&t,(n=(r=n-r|0)>>>0<256)?r:256),!n)for(;ie(e,s,256),(r=r-256|0)>>>0>255;);ie(e,s,r)}D=s+256|0}function Ce(e,t,n){var a,s=0,i=0,l=0,u=0;for(a=e<<4;4!=(0|s);){for(u=(i=s<<2)+a|0,e=0;4!=(0|e);)r[0|(l=(t+i|0)+e|0)]=o[0|l]^o[(e+u|0)+n|0],e=e+1|0;s=s+1|0}}function Ie(e,t,n){var r,a=0;e:{if((a=bt(e))-(r=zt(i[e+4>>2],o[e+11|0]))>>>0>=n>>>0){if(!n)break e;return Gt((a=yt(e))+r|0,t,n),It(e,t=n+r|0),Cn(t+a|0,0),e}se(e,a,(n+r|0)-a|0,r,r,0,n,t)}return e}function We(e,t,n){var r,a,s,i,o=0;return i=g(r=n>>>16|0,o=e>>>16|0),e=(65535&(o=((s=g(a=65535&n,e&=65535))>>>16|0)+g(o,a)|0))+g(e,r)|0,M=i+g(t,n)+(o>>>16)+(e>>>16)|0,65535&s|e<<16}function _e(e){var t=0,n=0,a=0;for(a=i[e>>2];on(n=r[0|a]);)a=a+1|0,i[e>>2]=a,t=t>>>0<=214748364?(0|(n=n-48|0))>(2147483647^(t=g(t,10)))?-1:n+t|0:-1;return t}function Te(e){var t,n=0,r=0;return D=t=D-16|0,7==o[e+4|0]&&(n=i[e+12>>2],i[(r=t+8|0)>>2]=i[e+8>>2],i[r+4>>2]=n,e=_t(t,1292),n=de(i[t+8>>2],i[t+12>>2],i[e>>2],i[e+4>>2])),D=t+16|0,n}function Ne(e){var t=0;return t=i[e+72>>2],i[e+72>>2]=t-1|t,8&(t=i[e>>2])?(i[e>>2]=32|t,-1):(i[e+4>>2]=0,i[e+8>>2]=0,t=i[e+44>>2],i[e+28>>2]=t,i[e+20>>2]=t,i[e+16>>2]=t+i[e+48>>2],0)}function Ee(e,t,n,r){var a,s;D=a=D-16|0,lt(i[e+8>>2],t),s=t,t=_t(a+8|0,r),t=Ye(Ye(s,i[t>>2],i[t+4>>2]),i[e+12>>2],i[e+16>>2]),e=_t(a,n),Ye(t,i[e>>2],i[e+4>>2]),D=a+16|0}function Re(e,t){var n=0;(t=i[e+4>>2]+t|0)>>>0<(n=i[e+8>>2])>>>0||(t=t>>>0<(n<<=1)>>>0?n:t,i[e+8>>2]=t,n=e,e=U(i[e>>2],t),i[n>>2]=e,e||(Yt(),v()))}function $e(e){var t,n;return(e=(t=i[5303])+(n=e+7&-8)|0)>>>0<=t>>>0&&n||mn()>>>0<e>>>0&&!(0|C(0|e))?(i[5341]=48,-1):(i[5303]=e,t)}function Oe(e,t,n){var r=0,a=0;if(n>>>0<4294967280)return fn(n)?vn(e,n):(Sn(e,a=Ue(r=at(n)+1|0)),Ht(e,r),An(e,n),e=a),void Cn(Gt(e,t,n)+n|0,0);Wn(),v()}function Fe(e,t,n,r){var a=0;if(r>>>0<4294967280)return fn(r)?vn(e,n):(Sn(e,r=Ue(a=at(r)+1|0)),Ht(e,a),An(e,n),e=r),void Cn(Gt(e,t,n)+n|0,0);Wn(),v()}function De(e,t,n){var r=0,a=0;e:{for(;;){if((0|(r=o[0|e]))!=(0|(a=o[0|t])))break e;if(t=t+1|0,e=e+1|0,!(n=n-1|0))break}return 0}return r-a|0}function Me(e,t,n,r){var a,s;D=a=D-16|0,s=t,t=_t(a+8|0,r),t=Ye(s,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),e=_t(a,n),Ye(t,i[e>>2],i[e+4>>2]),D=a+16|0}function Le(e,t){var n=0;e:if((0|e)!=(0|t))for(;;){if((t=t-1|0)>>>0<=e>>>0)break e;n=o[0|e],r[0|e]=o[0|t],r[0|t]=n,e=e+1|0}}function Be(e,t){var n,r;t|=0,D=n=D-16|0,lt(i[8+(e|=0)>>2],t),r=t,t=_t(n+8|0,3484),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+12>>2],t),D=n+16|0}function Pe(e,t,n){if(e>>>0<t>>>0)Ze(e,t,n);else if(n)for(e=e+n|0,t=t+n|0;t=t-1|0,r[0|(e=e-1|0)]=o[0|t],n=n-1|0;);}function ze(e,t){var n;return an(o[e+11|0])&&G(i[e>>2]),n=i[t+4>>2],i[e>>2]=i[t>>2],i[e+4>>2]=n,i[e+8>>2]=i[t+8>>2],vn(t,0),Cn(t,0),e}function Ge(e){var t;return t=L(dn(i[e+4>>2],o[e+11|0])+4|0),i[t>>2]=dn(i[e+4>>2],o[e+11|0]),Ze(t+4|0,yt(e),dn(i[e+4>>2],o[e+11|0])),t}function Ve(e,t,n){var r;D=r=D-16|0,e=i[e+8>>2],Rn[i[i[e>>2]+16>>2]](e,t),e=_t(r+8|0,n),Ye(t,i[e>>2],i[e+4>>2]),D=r+16|0}function Ue(e){var t=0;e=e||1;e:{for(;;){if(t=L(e))break e;if(!(t=i[5466]))break;Rn[0|t]()}W(),v()}return t}function He(e,t,n,r){var a,s;D=a=D-16|0,s=e+8|0,e=_t(a+8|0,r),ge(s,e=Ye(t,i[e>>2],i[e+4>>2])),gt(e,n),D=a+16|0}function je(e){var t,n;D=t=D-16|0,n=i[e+4>>2],gt(i[e>>2],40),lt(Je(t,i[n+8>>2]),i[e>>2]),gt(i[e>>2],41),D=t+16|0}function qe(){var e,t;return D=e=D-16|0,i[e+12>>2]=-1,i[e+8>>2]=2147483647,t=Lt(e+12|0,e+8|0),D=e+16|0,i[t>>2]}function Qe(e,t){return e?(57216==(-128&t)|t>>>0<=127?(r[0|e]=t,e=1):(i[5341]=25,e=-1),e):0}function Xe(e,t,n){var r,a;D=r=D-16|0,a=t,t=_t(r+8|0,n),t=Ye(a,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),D=r+16|0}function Ze(e,t,n){var a=0;if(n)for(a=e;r[0|a]=o[0|t],a=a+1|0,t=t+1|0,n=n-1|0;);return e}function Ke(e){return(e=o[0|e]|o[e+1|0]<<8|o[e+2|0]<<16|o[e+3|0]<<24)<<24|e<<8&16711680|e>>>8&65280|e>>>24}function Je(e,t){return r[e+7|0]=1,r[e+6|0]=1,r[e+5|0]=1,r[e+4|0]=35,i[e>>2]=12840,i[e+8>>2]=t,i[e>>2]=15200,e}function Ye(e,t,n){return(n=gn(t,n))&&(Re(e,n),Pe(i[e>>2]+i[e+4>>2]|0,t,n),i[e+4>>2]=n+i[e+4>>2]),e}function et(e,t,n){var a=0;if(n)for(a=e;r[0|a]=t,a=a+1|0,n=n-1|0;);return e}function tt(e,t){var n;return 2!=(0|(n=o[e+7|0]))?!n:0|Rn[i[i[e>>2]+8>>2]](e,t)}function nt(e,t){var n;return 2!=(0|(n=o[e+6|0]))?!n:0|Rn[i[i[e>>2]+4>>2]](e,t)}function rt(e,t){var n;n=i[t+4>>2],i[e>>2]=i[t>>2],i[e+4>>2]=n,i[e+8>>2]=i[t+8>>2],ut(t)}function at(e){var t=0;return e>>>0>=11?11==(0|(e=(t=e+16&-16)-1|0))?t:e:10}function st(e,t){var n;return 2!=(0|(n=o[e+5|0]))?!n:0|Rn[i[i[e>>2]>>2]](e,t)}function it(e,t){var n=0;return(e&-1>>>(n=0-t&31))<<n|((n=e)&-1<<(e=31&t))>>>e}function ot(e,t){var n;return i[e>>2]=t,n=i[t>>2],r[e+8|0]=1,i[e+4>>2]=n,i[t>>2]=-1,e}function lt(e,t){Rn[i[i[e>>2]+16>>2]](e,t),1!=o[e+5|0]&&Rn[i[i[e>>2]+20>>2]](e,t)}function ut(e){for(var t=0;3!=(0|t);)i[(t<<2)+e>>2]=0,t=t+1|0}function ct(e,t){var n;return i[e>>2]=t,n=o[0|t],r[e+5|0]=1,r[e+4|0]=n,r[0|t]=1,e}function dt(e,t){var n;n=e|=0,e=i[12+(t|=0)>>2],Rn[i[i[e>>2]+24>>2]](n,e)}function ht(e,t){var n;n=e|=0,e=i[8+(t|=0)>>2],Rn[i[i[e>>2]+24>>2]](n,e)}function pt(e){var t;return D=t=D-16|0,e=i[rn(t+8|0,e)>>2],D=t+16|0,e}function ft(e){var t;return(-1>>>(t=31&e)&-2)<<t|(-1<<(e=0-e&31)&-2)>>>e}function mt(e,t,n){return i[e>>2]=t,t=i[t+4>>2],i[e+4>>2]=t,i[e+8>>2]=t+n,e}function gt(e,t){var n;Re(e,1),n=i[e+4>>2],i[e+4>>2]=n+1,r[i[e>>2]+n|0]=t}function yt(e){var t,n;return t=i[e>>2],n=e,an(o[e+11|0])?t:n}function bt(e){return an(o[e+11|0])?sn(i[e+8>>2])-1|0:10}function vt(e,t,n){1==i[e+28>>2]|i[e+4>>2]!=(0|t)||(i[e+28>>2]=n)}function At(e,t,n){return(~e&n|e&t)+(it(e,6)^it(e,11)^it(e,25))|0}function xt(e,t,n){return((e|t)&n|e&t)+(it(e,2)^it(e,13)^it(e,22))|0}function kt(e,t){-1==i[t+16>>2]&&(i[t+12>>2]=0,i[t+16>>2]=e)}function wt(e){var t;return t=Ue(8),i[t+4>>2]=0,i[t>>2]=e,t}function St(e,t,n){Ot(e,((e=gn(t,n))?1:e)+t|0,n)}function Ct(e,t){var n;n=i[e>>2],i[e>>2]=i[t>>2],i[t>>2]=n}function It(e,t){an(o[e+11|0])?An(e,t):vn(e,t)}function Wt(e,t){return t|=0,0|st(i[12+(e|=0)>>2],t)}function _t(e,t){return i[e>>2]=t,i[e+4>>2]=be(t)+t,e}function Tt(e){i[e>>2]&&(An(e,i[e>>2]),G(i[e>>2]))}function Nt(e,t){return t|=0,0|st(i[8+(e|=0)>>2],t)}function Et(e){return an(o[e+11|0])&&G(i[e>>2]),e}function Rt(e){o[e+8|0]&&(i[i[e>>2]>>2]=i[e+4>>2])}function $t(e,t){return(t?o[(e+t|0)-1|0]:0)<<24>>24}function Ot(e,t,n){return i[e+4>>2]=n,i[e>>2]=t,e}function Ft(e){o[e+5|0]&&(r[i[e>>2]]=o[e+4|0])}function Dt(e){return 255&(e<<24>>24>>>7&27^e<<1)}function Mt(e,t){return tn(i[e>>2],i[t>>2])?t:e}function Lt(e,t){return tn(i[t>>2],i[e>>2])?t:e}function Bt(e,t,n,r){R(0|e,0|t,8,0,0|n,-1,0|r)}function Pt(e,t){t|=0,lt(i[8+(e|=0)>>2],t)}function zt(e,t){return an(t)||(e=xn(t)),e}function Gt(e,t,n){return n&&Ze(e,t,n),e}function Vt(e,t,n){return n&&Pe(e,t,n),e}function Ut(e){i[i[e>>2]+4>>2]=i[e+4>>2]}function Ht(e,t){i[e+8>>2]=-2147483648|t}function jt(e,t){ge(8+(e|=0)|0,t|=0)}function qt(e,t){return Oe(e,t,be(t)),e}function Qt(e){return i[e>>2]==(e+12|0)}function Xt(e,t){return i[(t<<2)+e>>2]}function Zt(e,t){return 1}function Kt(e,t){return 0}function Jt(e,t){Oe(e,t+4|0,i[t>>2])}function Yt(){Rn[i[5304]](),_n(),v()}function en(e,t,n){return Ye(e,t,n)}function tn(e,t){return e>>>0<t>>>0}function nn(e,t){return(0|e)==(0|t)}function rn(e,t){return i[e>>2]=t,e}function an(e){return(128&e)>>>7|0}function sn(e){return 2147483647&e}function on(e){return e-48>>>0<10}function ln(e){return i[e>>2]=0,e}function un(e,t){return re(e,t),e}function cn(e,t){return yt(e)+t|0}function dn(e,t){return zt(e,t)}function hn(e){return 0|e}function pn(e,t){return t-e>>2}function fn(e){return e>>>0<11}function mn(){return n.byteLength/65536<<16}function gn(e,t){return t-e|0}function yn(e){return ut(e),e}function bn(e){return e+12|0}function vn(e,t){r[e+11|0]=t}function An(e,t){i[e+4>>2]=t}function xn(e){return 255&e}function kn(e){return e+8|0}function wn(e){G(e|=0)}function Sn(e,t){i[e>>2]=t}function Cn(e,t){r[0|e]=t}function In(e){r[0|e]=0}function Wn(){_n(),v()}function _n(){W(),v()}function Tn(e){ln(e)}function Nn(e){}a(t=o,1024,"b3BlcmF0b3J+AHsuLi59AG9wZXJhdG9yfHwAb3BlcmF0b3J8AGZwbmdfZGVjb2RlX21lbW9yeQAgaW1hZ2luYXJ5AFR5ACBjb21wbGV4AER4AC0rICAgMFgweAAtMFgrMFggMFgtMHgrMHggMHgAdGhyb3cAbncAb3BlcmF0b3IgbmV3AER3AGR2AGN2AER2AFR1ACBjb25zdABjb25zdF9jYXN0AHJlaW50ZXJwcmV0X2Nhc3QAc3RhdGljX2Nhc3QAZHluYW1pY19jYXN0AHVuc2lnbmVkIHNob3J0AG5vZXhjZXB0AHVuc2lnbmVkIGludABsdABndABzdHJ1Y3QAIHJlc3RyaWN0AG9iamNfb2JqZWN0AGZsb2F0AF9GbG9hdABzdGQ6Om51bGxwdHJfdAB3Y2hhcl90AGNoYXI4X3QAY2hhcjE2X3QAdWludDY0X3QAY2hhcjMyX3QAVXQAVHQAU3QAZnBuZ19waXhlbF96bGliX3Jhd19kZWNvbXByZXNzAHJzAGxzAHRoaXMAZ3MAIWNvbXBfb2ZzAGRzAFRzAG51bGxwdHIAc3IAc3RkOjphbGxvY2F0b3IAU2lnR2VuQnJvd3NlcgB1bnNpZ25lZCBjaGFyAGVxAGZwAFRwACVwAGF1dG8Ab2JqY3Byb3RvAG9vAGVvAERvAHlwdG4AdW5pb24AZG4AbmFuAGJhZCBtYW4AVG4AZW51bQBybQBjbQBpYW0AYmFzaWNfaW9zdHJlYW0Ac3RkOjppb3N0cmVhbQBiYXNpY19vc3RyZWFtAHN0ZDo6b3N0cmVhbQBiYXNpY19pc3RyZWFtAHN0ZDo6aXN0cmVhbQB1bABwbABib29sAG1sAHVsbABlbXNjcmlwdGVuOjp2YWwAc3RyaW5nIGxpdGVyYWwAZnBuZ19nZXRfaW5mb19pbnRlcm5hbABVbABwcmVwYXJlX2R5bmFtaWNfYmxvY2sAcGkAbWkAc2lnY2NfZ2V0X2hhc2gAdW5zaWduZWQgbG9uZyBsb25nAHVuc2lnbmVkIGxvbmcAc3RkOjp3c3RyaW5nAHN0ZDo6YmFzaWNfc3RyaW5nAHN0ZDo6c3RyaW5nAHN0ZDo6dTE2c3RyaW5nAHN0ZDo6dTMyc3RyaW5nAF9fdXVpZG9mAGluZgBoYWxmACVhZgB0cnVlAG9wZXJhdG9yIGRlbGV0ZQBmYWxzZQBjaGVja19zaWduYXR1cmUAbmUAIHZvbGF0aWxlAGxvbmcgZG91YmxlAF9ibG9ja19pbnZva2UAZ2UAVGUAc3RkAHZvaWQAZ2V0X2FwcF9pZAAndW5uYW1lZAAvcmVwby93YXNtL3NoYXJlZC9rZXkvaW50ZXJuYWwvZnBuZy5jYwBVYgBuYQAnbGFtYmRhAGFhACVhAG9wZXJhdG9yXgBvcGVyYXRvciBuZXdbXQBvcGVyYXRvcltdAG9wZXJhdG9yIGRlbGV0ZVtdAHBpeGVsIHZlY3RvclsAKVsAX19fX1oAZFYAZnBUACRUVABJREFUACRUAHJTAGxTAGFTAGJpdF9idWZfc2l6ZSA+PSBGUE5HX0RFQ09ERVJfVEFCTEVfQklUUwBzeW1fYml0cyA8PSBGUE5HX0RFQ09ERVJfVEFCTEVfQklUUwBvUgBlTwBETwBzck4AYU4AX0dMT0JBTF9fTgBOQU4AJE4Ack0AcEwAbUwAZkwAJUxhTABtSQBVYTllbmFibGVfaWZJAElORgB2RQBEbkUAUkUAT0UAYjFFAGIwRQBJRU5EAGZkRUMAREMAb3BlcmF0b3I/AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHNob3J0PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1bnNpZ25lZCBzaG9ydD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1bnNpZ25lZCBpbnQ+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGZsb2F0PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1aW50OF90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxpbnQ4X3Q+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHVpbnQxNl90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxpbnQxNl90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1aW50MzJfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50MzJfdD4Ab3BlcmF0b3I+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGNoYXI+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHVuc2lnbmVkIGNoYXI+AHN0ZDo6YmFzaWNfc3RyaW5nPHVuc2lnbmVkIGNoYXI+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHNpZ25lZCBjaGFyPgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxsb25nPgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1bnNpZ25lZCBsb25nPgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxkb3VibGU+AG9wZXJhdG9yPj4Ab3BlcmF0b3I8PT4Ab3BlcmF0b3ItPgBzdGQ6OmJhc2ljX2lvc3RyZWFtPGNoYXIsIHN0ZDo6Y2hhcl90cmFpdHM8Y2hhcj4gPgBzdGQ6OmJhc2ljX29zdHJlYW08Y2hhciwgc3RkOjpjaGFyX3RyYWl0czxjaGFyPiA+AHN0ZDo6YmFzaWNfaXN0cmVhbTxjaGFyLCBzdGQ6OmNoYXJfdHJhaXRzPGNoYXI+ID4Ac3RkOjpiYXNpY19zdHJpbmc8Y2hhciwgc3RkOjpjaGFyX3RyYWl0czxjaGFyPiwgc3RkOjphbGxvY2F0b3I8Y2hhcj4gPgBvcGVyYXRvcnw9AG9wZXJhdG9yPQBvcGVyYXRvcl49AG9wZXJhdG9yPj0Ab3BlcmF0b3I+Pj0Ab3BlcmF0b3I9PQBvcGVyYXRvcjw9AG9wZXJhdG9yPDw9AG9wZXJhdG9yLz0Ab3BlcmF0b3ItPQBvcGVyYXRvcis9AG9wZXJhdG9yKj0Ab3BlcmF0b3ImPQBvcGVyYXRvciU9AG9wZXJhdG9yIT0Ab3BlcmF0b3I8AHRlbXBsYXRlPABpZDwAb3BlcmF0b3I8PAAuPAAiPABbYWJpOgAgW2VuYWJsZV9pZjoAc3RkOjoAdW5zaWduZWQgX19pbnQxMjgAX19mbG9hdDEyOABkZWNpbWFsMTI4AGZwbmdfcGl4ZWxfemxpYl9kZWNvbXByZXNzXzQAZGVjaW1hbDY0AGZwbmdfcGl4ZWxfemxpYl9kZWNvbXByZXNzXzMAZGVjaW1hbDMyAGwgPD0gMzIAKHJ1bl9sZW4gJSAzKSA9PSAwAG9wZXJhdG9yLwBBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvACAuLi4Ab3BlcmF0b3ItAC1pbi0Ab3BlcmF0b3ItLQBvcGVyYXRvciwAb3BlcmF0b3IrAG9wZXJhdG9yKysAb3BlcmF0b3IqAG9wZXJhdG9yLT4qADo6KgAuKgBkZWNsdHlwZShhdXRvKQAobnVsbCkAbCA8PSAzMiAmJiAoYml0X2J1Zl9zaXplID49IGwpAGwgJiYgKGwgPD0gMzIpICYmIChiaXRfYnVmX3NpemUgPj0gbCkAKGFub255bW91cyBuYW1lc3BhY2UpAHNyY19sZW4gPj0gKHpsaWJfbGVuICsgNCkAb3BlcmF0b3IoKQB0aHJvdygAbm9leGNlcHQoAGRlY2x0eXBlKAA+KABzaXplb2YuLi4oACkoAG5vZXhjZXB0ICgAYWxpZ25vZiAoAHNpemVvZiAoAHR5cGVpZCAoACkgPyAoACkgOiAoAHNpemVvZi4uLiAoACdibG9jay1saXRlcmFsJwBvcGVyYXRvciYAb3BlcmF0b3ImJgAgJiYAICYAb3BlcmF0b3IlAD4iAG9wZXJhdG9yIQB0aHJvdyAAIGF0IG9mZnNldCAAOjpvcGVyYXRvciAAcmVmZXJlbmNlIHRlbXBvcmFyeSBmb3IgAHRlbXBsYXRlIHBhcmFtZXRlciBvYmplY3QgZm9yIAB0eXBlaW5mbyBmb3IgAHRocmVhZC1sb2NhbCB3cmFwcGVyIHJvdXRpbmUgZm9yIAB0aHJlYWQtbG9jYWwgaW5pdGlhbGl6YXRpb24gcm91dGluZSBmb3IgAHR5cGVpbmZvIG5hbWUgZm9yIABjb25zdHJ1Y3Rpb24gdnRhYmxlIGZvciAAZ3VhcmQgdmFyaWFibGUgZm9yIABWVFQgZm9yIABjb3ZhcmlhbnQgcmV0dXJuIHRodW5rIHRvIABub24tdmlydHVhbCB0aHVuayB0byAAaW52b2NhdGlvbiBmdW5jdGlvbiBmb3IgYmxvY2sgaW4gAD4gdHlwZW5hbWUgAFtdIAAgPSAAIC4uLiAALCAAKSAAb3BlcmF0b3IiIiAAaWkAdgB2aQAAAEVTAABjUwAARVMAAGNTAABjUwAAaWlpaWkAAABjUwAARVMAAGlpaQ=="),a(t,4560,"VVMAAEVTAABjUwAAY1MAAGlp"),a(t,4592,"KGZ1bmN0aW9uICgpIHsKICAgIHRyeSB7CiAgICAgICAgcmVxdWlyZSgnb3MnKS5jcHVzKCk7CiAgICAgICAgcmV0dXJuIC0xMDAwOwogICAgfSBjYXRjaCAoZSkgewogICAgICAgIGlmICh0eXBlb2Ygd2luZG93ID09PSAndW5kZWZpbmVkJykgewogICAgICAgICAgICByZXR1cm4gLTEwMDA7CiAgICAgICAgfQogICAgICAgIHRyeSB7CiAgICAgICAgICAgIHZhciBlbGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdhJyk7CiAgICAgICAgICAgIGVsZS5ocmVmID0gJy9pbmRleGVkZGInOwogICAgICAgICAgICB2YXIgZXhwUmVzdWx0ID0gbG9jYXRpb24ub3JpZ2luICsgJy9pbmRleGVkZGInOwogICAgICAgICAgICBpZiAoZXhwUmVzdWx0ID09PSBlbGUuaHJlZikgewogICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5pbm5lcldpZHRoID4gMCAmJiB3aW5kb3cuaW5uZXJXaWR0aCA8IDgwODApIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTAwOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIC0xMDsKICAgICAgICAgICAgfQogICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgcmV0dXJuIC0xMDAwOwogICAgICAgIH0KICAgIH0KfSkoKQ=="),a(t,5296,"eGpxSFI1MlVXSmRqS0oweDZRckNzdXM2NnJOWFI5QDIuMC4xMwCJUE5HDQoaCgAAAA1JSERSAAAAIAAAACAIBgAAAHN6evQAAAAFZmRFQ1Ikk+MA5atimQAAAvRJREFUeAHlxGO0JWfagOH7eatq89jntG3EtjMzSQbJ2LZt27YRjGLbZts8fazNqnqfb9WPs9ZevTqZaKZnvvfHdfGus971svd84LDDTnzpB1/4hnedcMQpZ534ljesePFJrz/pRWec9sHnf/SIAw/50NnveMFHXnbg4ccATDoAAJjU9J3nGoBTzjrxLW9Y8eKTXn/Si8447YPP/yhA4rsAwKSm7zzXAJjVPNowcc3Mull9m4vb003HT+wYb+g/JjykNLxj4qqv//3Ld9x/z9f++YO/feVP9995C8CkBwCASSPvudQCXHPx9T/5xUPnX/fL6y664qqv//3LAIl3AwCT5L2XWgBzzcXX/+QXD51/3V+fV77qqq///ct1U+vH2m8J7sk2T6077YPP/+gRBx7yobPf8YKPvOzAw48BeLYMKwAYgMTIey61ANdcfP1PfvHQ+df98rqLrrjq63//8h333/O1f/7gb1/50/133gLwbDMAiWYDAJOavvNcA3DKWSe+5Q0rXnzS60960RmnffD5Hz3iwEM+dPY7XvCRlx14+DEAz5QBSAxbAJg08p5LLcA1F1//k188dP51v7zuoiuu+vrfv3zH/fd87Z8/+NtX/nT/nbcAPFMGYH8yAPuTAdiXZh8AJjV957kG4JSzTnzLG1a8+KTXn/SiM0774PM/esSBh3zo7He84CMvO/DwYwCeKgOwL8MRAEwaec+lFuCai6//yS8eOv+6X1530RVXff3vX77j/nu+9s8f/O0rf7r/zlsAnioDsD8ZgP3JAOxPBmB/MgD7kwHYnwzAk9GcAYAH33PIsZd9Gh58zyHHXvZp2HLN8wzAlmueZwCOOPCQD539jhd85GUHHn4MwL9iAJ6M4TIArPzOPTc/57Ow8jv33Pycz8LMUy6xADNPucQC3HH/PV/75w/+9pU/3X/nLQD/igHYnwzA/mQA9icDsD8ZgP3JAOxPBmB/MgD7kwHYnwzA/mQA9icDsD8ZgP3JAOxP/wexJ9Q/1vGclgAAAABJRU5ErkJggg=="),a(t,6176,"SkNTZTgxYUNEcngxZUhDbjd3dUwwem0xcnc4SWViAAA0ODU5NzIyZmMzOGM0YjIw"),a(t,6244,"ljAHdyxhDu66UQmZGcRtB4/0anA1pWPpo5VknjKI2w6kuNx5HunV4IjZ0pcrTLYJvXyxfgctuOeRHb+QZBC3HfIgsGpIcbnz3kG+hH3U2hrr5N1tUbXU9MeF04NWmGwTwKhrZHr5Yv3syWWKT1wBFNlsBmNjPQ/69Q0IjcggbjteEGlM5EFg1XJxZ6LR5AM8R9QES/2FDdJrtQql+qi1NWyYskLWybvbQPm8rONs2DJ1XN9Fzw3W3Fk90ausMNkmOgDeUYBR18gWYdC/tfS0ISPEs1aZlbrPD6W9uJ64AigIiAVfstkMxiTpC7GHfG8vEUxoWKsdYcE9LWa2kEHcdgZx2wG8INKYKhDV74mFsXEftbYGpeS/nzPUuOiiyQd4NPkAD46oCZYYmA7huw1qfy09bQiXbGSRAVxj5vRRa2tiYWwc2DBlhU4AYvLtlQZse6UBG8H0CIJXxA/1xtmwZVDptxLquL6LfIi5/N8d3WJJLdoV83zTjGVM1PtYYbJNzlG1OnQAvKPiMLvUQaXfSteV2D1txNGk+/TW02rpaUP82W40RohnrdC4YNpzLQRE5R0DM19MCqrJfA3dPHEFUKpBAicQEAu+hiAMySW1aFezhW8gCdRmuZ/kYc4O+d5emMnZKSKY0LC0qNfHFz2zWYENtC47XL23rWy6wCCDuO22s7+aDOK2A5rSsXQ5R9Xqr3fSnRUm2wSDFtxzEgtj44Q7ZJQ+am0NqFpqegvPDuSd/wmTJ64ACrGeB31Ekw/w0qMIh2jyAR7+wgZpXVdi98tnZYBxNmwZ5wZrbnYb1P7gK9OJWnraEMxK3Wdv37n5+e++jkO+txfVjrBg6KPW1n6T0aHEwtg4UvLfT/Fnu9FnV7ym3Qa1P0s2skjaKw3YTBsKr/ZKAzZgegRBw+9g31XfZ6jvjm4xeb5pRoyzYcsag2a8oNJvJTbiaFKVdwzMA0cLu7kWAiIvJgVVvju6xSgLvbKSWrQrBGqzXKf/18Ixz9C1i57ZLB2u3luwwmSbJvJj7JyjanUKk20CqQYJnD82DuuFZwdyE1cABYJKv5UUerjiriuxezgbtgybjtKSDb7V5bfv3Hwh39sL1NLThkLi1PH4s91oboPaH80WvoFbJrn24Xewb3dHtxjmWgiIcGoP/8o7BmZcCwER/55lj2muYvjT/2thRc9sFnjiCqDu0g3XVIMETsKzAzlhJmen9xZg0E1HaUnbd24+SmrRrtxa1tlmC99A8DvYN1OuvKnFnrvef8+yR+n/tTAc8r29isK6yjCTs1Omo7QkBTbQupMG180pV95Uv2fZIy56ZrO4SmHEAhtoXZQrbyo3vgu0oY4MwxvfBVqN7wItAAAAAEExGxmCYjYyw1MtKwTFbGRF9Hd9hqdaVseWQU8IitnISbvC0Yro7/rL2fTjDE+1rE1+rrWOLYOezxyYh1ESwkoQI9lT03D0eJJB72FV164uFOa1N9e1mByWhIMFWZgbghipAJvb+i2wmss2qV1dd+YcbGz/3z9B1J4OWs2iJISV4xWfjCBGsqdhd6m+puHo8efQ8+gkg97DZbLF2qquXV3rn0ZEKMxrb2n9cHauazE571oqICwJBwttOBwS8zZG37IHXcZxVHDtMGVr9PfzKru2wjGidZEciTSgB5D7vJ8Xuo2EDnneqSU477I8/3nzc75I6Gp9G8VBPCreWAVPefBEfmLphy1PwsYcVNsBihWUQLsOjYPoI6bC2Ti/DcWgOEz0uyGPp5YKzpaNEwkAzFxIMddFi2L6bspT4XdUXbu6FWygo9Y/jYiXDpaRUJjX3hGpzMfS+uHsk8v69VzXYnId5nlr3rVUQJ+ET1lYEg4WGSMVD9pwOCSbQSM9p2v9ZeZa5nwlCctXZDjQTqOukQHin4oYIcynM2D9vCqv4SSt7tA/tC2DEp9ssgmGqyRIyeoVU9ApRn77aHdl4vZ5Py+3SCQ2dBsJHTUqEgTyvFNLs41IUnDeZXkx735g/vPm57/C/f58kdDVPaDLzPo2ioO7B5GaeFS8sTllp6hLmIM7CqmYIsn6tQmIy64QT13vXw5s9EbNP9ltjA7CdEMSWvMCI0HqwXBswYBBd9hH1zaXBuYtjsW1AKWEhBu8GopBcVu7WmiY6HdD2dlsWh5PLRVffjYMnC0bJ90cAD4SAJi5UzGDoJBirovRU7WSFsX03Vf078SUp8Lv1ZbZ9um8B66ojRy3a94xnCrvKoXteWvKrEhw028bXfguKkbh4TbeZqAHxX9jVOhUImXzTeXzsgKkwqkbZ5GEMCagnym4rsXk+Z/e/TrM89Z7/ejPvGupgP1aspk+CZ+yfziEq7AkHCzxFQc1MkYqHnN3MQe04XBI9dBrUTaDRnp3sl1jTtf6yw/m4dLMtcz5jYTX4EoSlq8LI422yHCgnYlBu4RGXSMDB2w4GsQ/FTGFDg4oQphPZwOpVH7A+nlVgctiTB/FOIFe9COYnacOs9yWFaobAFTlWjFP/JliYtfYU3nOF0/hSVZ++lCVLdd71BzMYhOKjS1Su5Y0kei7H9DZoAbs835ercJlR26RSGwvoFN16DYSOqkHCSNqVCQIK2U/EeR5p5alSLyPZhuRpCcqir3gvMvyoY3Q62Le/cAj7+bZveG8FPzQpw0/g4omfrKRP7kk0HD4FctpO0bmQnp3/Vu1a2Xc9Fp+xTcJU+52OEj3sa4JuPCfEqEzzD+Kcv0kkwAAAAA3asIBbtSEA1m+RgLcqAkH68LLBrJ8jQSFFk8FuFETDo870Q/WhZcN4e9VDGT5GglTk9gICi2eCj1HXAtwoyYcR8nkHR53oh8pHWAerAsvG5th7RrC36sY9bVpGcjyNRL/mPcTpiaxEZFMcxAUWjwVIzD+FHqOuBZN5HoX4EZNONcsjzmOksk7ufgLOjzuRD8LhIY+UjrAPGVQAj1YF142b32cNzbD2jUBqRg0hL9XMbPVlTDqa9My3QERM5DlaySnj6kl/jHvJ8lbLSZMTWIjeyegIiKZ5iAV8yQhKLR4Kh/euitGYPwpcQo+KPQccS3DdrMsmsj1Lq2iNy/AjZpw9+dYca5ZHnOZM9xyHCWTdytPUXZy8Rd0RZvVdXjciX5Ptkt/FggNfSFiz3ykdIB5kx5CeMqgBHr9ysZ7sC68bIdEfm3e+jhv6ZD6bmyGtWtb7HdqAlIxaDU482kIf69iPxVtY2arK2FRwelg1NemZeO9ZGS6AyJmjWngZyDL10gXoRVJTh9TS3l1kUr8Y95PywkcTpK3Wkyl3ZhNmJrERq/wBkf2TkBFwSSCREQyzUFzWA9AKuZJQh2Mi0NQaPFUZwIzVT68dVcJ1rdWjMD4U7uqOlLiFHxQ1X6+Ueg54lrfUyBbhu1mWbGHpFg0ketdA/spXFpFb15tL61fgBs14bdx9+Duz7Hi2aVz41yzPOZr2f7nMme45QUNeuQ4SibvDyDk7laeouxh9GDt5OIv6NOI7emKNqvrvVxp6vC4E/3H0tH8nmyX/qkGVf8sEBr6G3rY+0LEnvl1rlz4SOkA83+DwvImPYTwEVdG8ZRBCfSjK8v1+pWN983/T/ZgXXjZVze62A6J/No54z7bvPVx3oufs9/SIfXd5Us33NgMa9fvZqnWttjv1IGyLdUEpGLQM86g0Wpw5tNdGiTSEP5exSeUnMR+KtrGSUAYx8xWV8L7PJXDooLTwZXoEcCor03Ln8WPysZ7ycjxEQvJdAdEzENths0a08DPLbkCzkCWr5F3/G2QLkIrkhko6ZOcPqaWq1Rkl/LqIpXFgOCU+Me8n8+tfp6WEzicoXn6nSRvtZgTBXeZSrsxm33R85owNYmNB19LjF7hDY5pi8+P7J2Aitv3QouCSQSJtSPGiIhkmoO/DliC5rAegNHa3IFUzJOEY6ZRhToYF4cNctWGoNDiqZe6IKjOBGaq+W6kq3x4665LEimvEqxvrSXGrawYgfGnL+szpnZVdaRBP7elxCn4oPNDOqGq/XyjnZe+otBzxLXnGQa0vqdAtonNgrcM282yO7EPs2IPSbFVZYuwaCLXu19IFboG9lO4MZyRubSK3ryD4By92l5av+00mL4AAAAAZWe8uIvICarur7USV5dijzLw3jfcX2sluTjXne8otMWKTwh9ZOC9bwGHAde4v9ZK3dhq8jN33+BWEGNYn1cZUPowpegUnxD6cfisQsjAe9+tp8dnQwhydSZvzs1wf62VFRgRLfu3pD+e0BiHJ+jPGkKPc6KsIMawyUd6CD6vMqBbyI4YtWc7CtAAh7JpOFAvDF/sl+LwWYWHl+U90YeGZbTgOt1aT4/PPygzd4YQ5Orjd1hSDdjtQGi/Ufih+CvwxJ+XSCowIlpPV57i9m9Jf5MI9cd9p0DVGMD8bU7QnzUrtyONxRiWn6B/KicZR/26fCBBApKP9BD36EioPVgUm1g/qCO2kB0x0/ehiWrPdhQPqMqs4Qd/voRgwwbScKBetxcc5lm4qfQ83xVMhefC0eCAfmkOL8t7a0h3w6IPDcvHaLFzKccEYUyguNn1mG9EkP/T/H5QZu4bN9pWTSe5DihABbbG77Cko4gMHBqw24F/12c5kXjSK/QfbpMD9yY7ZpCag4g/L5HtWJMpVGBEtDEH+AzfqE0eus/xpuzfkv6JuC5GZxebVAJwJ+y7SPBx3i9MyTCA+dtV50VjnKA/a/nHg9MXaDbBcg+Kecs3XeSuUOFcQP9UTiWY6PZziIuuFu83FvhAggSdJz68JB/pIUF4VZmv1+CLyrBcMzu2We1e0eVVsH5QR9UZ7P9sITtiCUaH2ufpMsiCjo5w1J7tKLH5UZBfVuSCOjFYOoMJj6fmbjMfCMGGDW2mOrWk4UC9wYb8BS8pSRdKTvWv83YiMpYRnop4viuYHdmXIEvJ9HgurkjAwAH90qVmQWocXpb3eTkqT5eWn13y8SPlBRlrTWB+1/WO0WLn67beX1KOCcI36bV62UYAaLwhvNDqMd+Ij1ZjMGH51iIEnmqavaa9B9jBAb82brStUwkIFZpOch3/Kc6lEYZ7t3Thxw/N2RCSqL6sKkYRGTgjdqWAdWbG2BABemD+rs9ym8lzyiLxpFdHlhjvqTmt/cxeEUUG7k12Y4nxzo0mRNzoQfhkUXkv+TQek0HasSZTv9aa6+nG+bOMoUULYg7wGQdpTKG+UZs82zYnhDWZkpZQ/i4umblUJvze6J4ScV2MdxbhNM4uNqmrSYoRReY/AyCBg7t2keDjE/ZcW/1Z6UmYPlXxIQaCbERhPtSqzovGz6k3fjhBf9ZdJsNus4l2fNbuysRv1h1ZCrGh4eQeFPOBeahL12nLE7IOd6tcocK5OcZ+AYD+qZzlmRUkCzagNm5RHI6nFmaGwnHaPizebyxJudOU8IEECZXmuLF7SQ2jHi6xG0g+0kMtWW77w/bb6aaRZ1EfqbDMes4MdJRhuWbxBgXeAAAAAAEAAAADAAAABwAAAA8AAAAfAAAAPwAAAH8AAAD/AAAA/wEAAP8DAAD/BwAA/w8AAP8fAAD/PwAA/38AAP//AACJUE5HDQoaCgAAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAANAAAADwAAABEAAAATAAAAFwAAABsAAAAfAAAAIwAAACsAAAAzAAAAOwAAAEMAAABTAAAAYwAAAHMAAACDAAAAowAAAMMAAADjAAAAAgE="),a(t,10576,"AQAAAAEAAAABAAAAAQAAAAIAAAACAAAAAgAAAAIAAAADAAAAAwAAAAMAAAADAAAABAAAAAQAAAAEAAAABAAAAAUAAAAFAAAABQAAAAU="),a(t,10678,"BAAAAAAACAAAAAAADAAAAAAAEAAAAAAAFAAAAAAAGAAAAAAAHAAAAAAAIAAAAAAAJAAAAAAAKAAAAAAALAAAAAAAMAAAAAAANAAAAAAAOAAAAAAAPAAAAAAAQAAAAAAARAAAAAAASAAAAAAATAAAAAAAUAAAAAAAVAAAAAAAWAAAAAAAXAAAAAAAYAAAAAAAZAAAAAAAaAAAAAAAbAAAAAAAcAAAAAAAdAAAAAAAeAAAAAAAfAAAAAAAgAAAAAAAhAAAAAAAiAAAAAAAjAAAAAAAkAAAAAAAlAAAAAAAmAAAAAAAnAAAAAAAoAAAAAAApAAAAAAAqAAAAAAArAAAAAAAsAAAAAAAtAAAAAAAuAAAAAAAvAAAAAAAwAAAAAAAxAAAAAAAyAAAAAAAzAAAAAAA0AAAAAAA1AAAAAAA2AAAAAAA3AAAAAAA4AAAAAAA5AAAAAAA6AAAAAAA7AAAAAAA8AAAAAAA9AAAAAAA+AAAAAAA/AAAAAAAAAEAAAAABAEAAAAACAEAAAAADAEAAAAAEAEAAAAAFAEAAAAAGAEAAAAAHAEAAAAAIAEAAAAAJAEAAAAAKAEAAAAALAEAAAAAMAEAAAAANAEAAAAAOAEAAAAAPAEAAAAAQAEAAAAARAEAAAAASAEAAAAATAEAAAAAUAEAAAAAVAEAAAAAWAE="),a(t,11200,"EBESAAgHCQYKBQsEDAMNAg4BDw=="),a(t,11232,"cSEhaW10NXJlc3RuXmchIWN8d3vya2/FMAFnK/7Xq3bKgsl9+llH8K3Uoq+cpHLAt/2TJjY/98w0peXxcdgxFQTHI8MYlgWaBxKA4usnsnUJgywaG25aoFI71rMp4y+EU9EA7SD8sVtqy745SkxYz9DvqvtDTTOFRfkCf1A8n6hRo0CPkp049by22iEQ//PSzQwT7F+XRBfEp349ZF0Zc2CBT9wiKpCIRu64FN5eC9vgMjoKSQYkXMLTrGKRleR558g3bY3VTqlsVvTqZXquCLp4JS4cprTG6N10H0u9i4pwPrVmSAP2DmE1V7mGwR2e4fiYEWnZjpSbHofpzlUo34yhiQ2/5kJoQZktD7BUuxaNAQIECBAgQIAbNgAAAAAAUglq1TA2pTi/QKOegfPX+3zjOYKbL/+HNI5DRMTe6ctUe5QypsIjPe5MlQtC+sNOCC6hZijZJLJ2W6JJbYvRJXL49mSGaJgW1KRczF1ltpJscEhQ/e252l4VRlenjZ2EkNirAIy80wr35FgFuLNFBtAsHo/KPw8Cwa+9AwETims6kRFBT2fc6pfyz87wtOZzlqx0IuetNYXi+TfoHHXfbkfxGnEdKcWJb7diDqoYvhv8Vj5LxtJ5IJrbwP54zVr0H92oM4gHxzGxEhBZJ4DsX2BRf6kZtUoNLeV6n5PJnO+g4DtNrir1sMjruzyDU5lhFysEfrp31ibhaRRjVSEMfTAxMjM0NTY3ODlhYmNkZWY="),a(t,11808,"GQAKABkZGQAAAAAFAAAAAAAACQAAAAALAAAAAAAAAAAZABEKGRkZAwoHAAEACQsYAAAJBgsAAAsABhkAAAAZGRk="),a(t,11889,"DgAAAAAAAAAAGQAKDRkZGQANAAACAAkOAAAACQAOAAAO"),a(t,11947,"DA=="),a(t,11959,"EwAAAAATAAAAAAkMAAAAAAAMAAAM"),a(t,12005,"EA=="),a(t,12017,"DwAAAAQPAAAAAAkQAAAAAAAQAAAQ"),a(t,12063,"Eg=="),a(t,12075,"EQAAAAARAAAAAAkSAAAAAAASAAASAAAaAAAAGhoa"),a(t,12130,"GgAAABoaGgAAAAAAAAk="),a(t,12179,"FA=="),a(t,12191,"FwAAAAAXAAAAAAkUAAAAAAAUAAAU"),a(t,12237,"Fg=="),a(t,12249,"FQAAAAAVAAAAAAkWAAAAAAAWAAAWAAAwMTIzNDU2Nzg5QUJDREVG"),a(t,12324,"Dw=="),a(t,12364,"//////////8="),a(t,12432,"U3Q5dHlwZV9pbmZvAE4xMF9fY3h4YWJpdjExNl9fc2hpbV90eXBlX2luZm9FAAAAxDEAAJAwAABsMQAAnTAAAMAwAABOMTBfX2N4eGFiaXYxMTdfX2NsYXNzX3R5cGVfaW5mb0UAAABsMQAA1DAAAMgwAABOMTBfX2N4eGFiaXYxMjBfX3NpX2NsYXNzX3R5cGVfaW5mb0UAAAAAbDEAAAQxAAD4MAAAAAAAABQyAAARAAAAEgAAABMAAAAUAAAAFQAAABYAAAAXAAAAGAAAABkAAAAAAAAALDEAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAACAAAAAhAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTFTcGVjaWFsTmFtZUUAAAAAAPgwAAAaAAAAIgAAABwAAAAdAAAAHgAAACMAAAAkAAAAJQAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTROb2RlRQDEMQAA5DEAAGwxAACMMQAADDIAAAAAAAAMMgAAEQAAABIAAAATAAAAFAAAACYAAAAWAAAAFwAAABgAAAAnAAAAAAAAALQyAAARAAAAEgAAABMAAAAUAAAAKAAAABYAAAAXAAAAGAAAACkAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUyMUN0b3JWdGFibGVTcGVjaWFsTmFtZUUAAABsMQAAeDIAAAwyAAAAAAAAGDMAABEAAAASAAAAEwAAABQAAAAqAAAAFgAAACsAAAAYAAAALAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZThOYW1lVHlwZUUAbDEAAOwyAAAMMgAAAAAAAIAzAAARAAAAEgAAABMAAAAUAAAALQAAABYAAAAuAAAAGAAAAC8AAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxME5lc3RlZE5hbWVFAABsMQAAUDMAAAwyAAAAAAAA+DMAADAAAAAxAAAAMgAAADMAAAA0AAAANQAAABcAAAAYAAAANgAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTI0Rm9yd2FyZFRlbXBsYXRlUmVmZXJlbmNlRQAAAABsMQAAuDMAAAwyAAAAAAAAZDQAABEAAAASAAAAEwAAABQAAAA3AAAAFgAAABcAAAAYAAAAOAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTE0SW50ZWdlckxpdGVyYWxFAABsMQAAMDQAAAwyAAAAAAAAyDQAABEAAAASAAAAEwAAABQAAAA5AAAAFgAAABcAAAAYAAAAOgAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZThCb29sRXhwckUAbDEAAJw0AAAMMgAAAAAAADg1AAARAAAAEgAAABMAAAAUAAAAOwAAABYAAAAXAAAAGAAAADwAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxNkZsb2F0TGl0ZXJhbEltcGxJZkVFAGwxAAAANQAADDIAAAAAAACoNQAAEQAAABIAAAATAAAAFAAAAD0AAAAWAAAAFwAAABgAAAA+AAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTZGbG9hdExpdGVyYWxJbXBsSWRFRQBsMQAAcDUAAAwyAAAAAAAAGDYAABEAAAASAAAAEwAAABQAAAA/AAAAFgAAABcAAAAYAAAAQAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTE2RmxvYXRMaXRlcmFsSW1wbEllRUUAbDEAAOA1AAAMMgAAAAAAAIQ2AAARAAAAEgAAABMAAAAUAAAAQQAAABYAAAAXAAAAGAAAAEIAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxM1N0cmluZ0xpdGVyYWxFAAAAbDEAAFA2AAAMMgAAAAAAAPA2AAARAAAAEgAAABMAAAAUAAAAQwAAABYAAAAXAAAAGAAAAEQAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxNVVubmFtZWRUeXBlTmFtZUUAbDEAALw2AAAMMgAAAAAAAGg3AAARAAAAEgAAABMAAAAUAAAARQAAABYAAAAXAAAAGAAAAEYAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUyNlN5bnRoZXRpY1RlbXBsYXRlUGFyYW1OYW1lRQAAbDEAACg3AAAMMgAAAAAAANw3AAARAAAAEgAAABMAAAAUAAAARwAAAEgAAAAXAAAAGAAAAEkAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUyMVR5cGVUZW1wbGF0ZVBhcmFtRGVjbEUAAABsMQAAoDcAAAwyAAAAAAAAVDgAABEAAAASAAAAEwAAABQAAABKAAAASwAAABcAAAAYAAAATAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTI0Tm9uVHlwZVRlbXBsYXRlUGFyYW1EZWNsRQAAAABsMQAAFDgAAAwyAAAAAAAAzDgAABEAAAASAAAAEwAAABQAAABNAAAATgAAABcAAAAYAAAATwAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTI1VGVtcGxhdGVUZW1wbGF0ZVBhcmFtRGVjbEUAAABsMQAAjDgAAAwyAAAAAAAAQDkAABEAAAASAAAAEwAAABQAAABQAAAAUQAAABcAAAAYAAAAUgAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTIxVGVtcGxhdGVQYXJhbVBhY2tEZWNsRQAAAGwxAAAEOQAADDIAAAAAAACsOQAAEQAAABIAAAATAAAAFAAAAFMAAAAWAAAAFwAAABgAAABUAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTVDbG9zdXJlVHlwZU5hbWVFAGwxAAB4OQAADDIAAAAAAAAUOgAAEQAAABIAAAATAAAAFAAAAFUAAAAWAAAAFwAAABgAAABWAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTBMYW1iZGFFeHByRQAAbDEAAOQ5AAAMMgAAAAAAAHw6AAARAAAAEgAAABMAAAAUAAAAVwAAABYAAAAXAAAAGAAAAFgAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxMUVudW1MaXRlcmFsRQBsMQAATDoAAAwyAAAAAAAA6DoAABEAAAASAAAAEwAAABQAAABZAAAAFgAAABcAAAAYAAAAWgAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEzRnVuY3Rpb25QYXJhbUUAAABsMQAAtDoAAAwyAAAAAAAATDsAABEAAAASAAAAEwAAABQAAABbAAAAFgAAABcAAAAYAAAAXAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZThGb2xkRXhwckUAbDEAACA7AAAMMgAAAAAAAMA7AAARAAAAEgAAABMAAAAUAAAAXQAAABYAAAAXAAAAGAAAAF4AAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUyMlBhcmFtZXRlclBhY2tFeHBhbnNpb25FAABsMQAAhDsAAAwyAAAAAAAAKDwAABEAAAASAAAAEwAAABQAAABfAAAAFgAAABcAAAAYAAAAYAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEwQmluYXJ5RXhwckUAAGwxAAD4OwAADDIAAAAAAACQPAAAEQAAABIAAAATAAAAFAAAAGEAAAAWAAAAFwAAABgAAABiAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTBQcmVmaXhFeHByRQAAbDEAAGA8AAAMMgAAAAAAAPQ8AAARAAAAEgAAABMAAAAUAAAAYwAAABYAAAAXAAAAGAAAAGQAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGU4Q2FzdEV4cHJFAGwxAADIPAAADDIAAAAAAABYPQAAEQAAABIAAAATAAAAFAAAAGUAAAAWAAAAFwAAABgAAABmAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlOENhbGxFeHByRQBsMQAALD0AAAwyAAAAAAAAxD0AABEAAAASAAAAEwAAABQAAABnAAAAFgAAABcAAAAYAAAAaAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTE0Q29udmVyc2lvbkV4cHJFAABsMQAAkD0AAAwyAAAAAAAALD4AABEAAAASAAAAEwAAABQAAABpAAAAFgAAABcAAAAYAAAAagAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEwRGVsZXRlRXhwckUAAGwxAAD8PQAADDIAAAAAAACYPgAAEQAAABIAAAATAAAAFAAAAGsAAAAWAAAAbAAAABgAAABtAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTNRdWFsaWZpZWROYW1lRQAAAGwxAABkPgAADDIAAAAAAAD8PgAAEQAAABIAAAATAAAAFAAAAG4AAAAWAAAAFwAAABgAAABvAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlOER0b3JOYW1lRQBsMQAA0D4AAAwyAAAAAAAAcD8AABEAAAASAAAAEwAAABQAAABwAAAAFgAAABcAAAAYAAAAcQAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTIyQ29udmVyc2lvbk9wZXJhdG9yVHlwZUUAAGwxAAA0PwAADDIAAAAAAADcPwAAEQAAABIAAAATAAAAFAAAAHIAAAAWAAAAFwAAABgAAABzAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTVMaXRlcmFsT3BlcmF0b3JFAGwxAACoPwAADDIAAAAAAABMQAAAEQAAABIAAAATAAAAFAAAAHQAAAAWAAAAdQAAABgAAAB2AAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTlHbG9iYWxRdWFsaWZpZWROYW1lRQBsMQAAFEAAAAwyAAAAAAAAtEAAABEAAAASAAAAEwAAABQAAAB3AAAAFgAAABcAAAAYAAAAeAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEwTWVtYmVyRXhwckUAAGwxAACEQAAADDIAAAAAAAAkQQAAEQAAABIAAAATAAAAFAAAAHkAAAAWAAAAFwAAABgAAAB6AAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMThBcnJheVN1YnNjcmlwdEV4cHJFAABsMQAA7EAAAAwyAAAAAAAAjEEAABEAAAASAAAAEwAAABQAAAB7AAAAFgAAABcAAAAYAAAAfAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEwQnJhY2VkRXhwckUAAGwxAABcQQAADDIAAAAAAAD4QQAAEQAAABIAAAATAAAAFAAAAH0AAAAWAAAAFwAAABgAAAB+AAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTVCcmFjZWRSYW5nZUV4cHJFAGwxAADEQQAADDIAAAAAAABkQgAAEQAAABIAAAATAAAAFAAAAH8AAAAWAAAAFwAAABgAAACAAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTJJbml0TGlzdEV4cHJFAAAAAGwxAAAwQgAADDIAAAAAAADgQgAAEQAAABIAAAATAAAAFAAAAIEAAAAWAAAAFwAAABgAAACCAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMjlQb2ludGVyVG9NZW1iZXJDb252ZXJzaW9uRXhwckUAAABsMQAAnEIAAAwyAAAAAAAASEMAABEAAAASAAAAEwAAABQAAACDAAAAFgAAABcAAAAYAAAAhAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTExUG9zdGZpeEV4cHJFAGwxAAAYQwAADDIAAAAAAACsQwAAEQAAABIAAAATAAAAFAAAAIUAAAAWAAAAFwAAABgAAACGAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlN05ld0V4cHJFAABsMQAAgEMAAAwyAAAAAAAAGEQAABEAAAASAAAAEwAAABQAAACHAAAAFgAAABcAAAAYAAAAiAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEzRW5jbG9zaW5nRXhwckUAAABsMQAA5EMAAAwyAAAAAAAAhEQAABEAAAASAAAAEwAAABQAAACJAAAAFgAAABcAAAAYAAAAigAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTE1Q29uZGl0aW9uYWxFeHByRQBsMQAAUEQAAAwyAAAAAAAA8EQAABEAAAASAAAAEwAAABQAAACLAAAAFgAAABcAAAAYAAAAjAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEzU3Vib2JqZWN0RXhwckUAAABsMQAAvEQAAAwyAAAAAAAAYEUAABEAAAASAAAAEwAAABQAAACNAAAAFgAAABcAAAAYAAAAjgAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTE5U2l6ZW9mUGFyYW1QYWNrRXhwckUAbDEAAChFAAAMMgAAAAAAAMxFAAARAAAAEgAAABMAAAAUAAAAjwAAABYAAAAXAAAAGAAAAJAAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxM05vZGVBcnJheU5vZGVFAAAAbDEAAJhFAAAMMgAAAAAAADRGAAARAAAAEgAAABMAAAAUAAAAkQAAABYAAAAXAAAAGAAAAJIAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGU5VGhyb3dFeHByRQAAAABsMQAABEYAAAwyAAAAAAAArEYAABEAAAASAAAAEwAAABQAAACTAAAAFgAAAJQAAAAYAAAAlQAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTI3RXhwYW5kZWRTcGVjaWFsU3Vic3RpdHV0aW9uRQBsMQAAbEYAAAwyAAAAAAAAGEcAABEAAAASAAAAEwAAABQAAACWAAAAFgAAABcAAAAYAAAAlwAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEyQ3RvckR0b3JOYW1lRQAAAABsMQAA5EYAAAwyAAAAAAAAgEcAABEAAAASAAAAEwAAABQAAACYAAAAFgAAABcAAAAYAAAAmQAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEwQWJpVGFnQXR0ckUAAGwxAABQRwAADDIAAAAAAAD0RwAAEQAAABIAAAATAAAAFAAAAJoAAAAWAAAAFwAAABgAAACbAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMjFTdHJ1Y3R1cmVkQmluZGluZ05hbWVFAAAAbDEAALhHAAAMMgAAAAAAAFxIAAARAAAAEgAAABMAAAAUAAAAnAAAABYAAAAXAAAAGAAAAJ0AAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGU5TG9jYWxOYW1lRQAAAABsMQAALEgAAAwyAAAAAAAAzEgAABEAAAASAAAAEwAAABQAAACeAAAAFgAAAJ8AAAAYAAAAoAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTE5U3BlY2lhbFN1YnN0aXR1dGlvbkUAbDEAAJRIAAAMMgAAAAAAADxJAAARAAAAEgAAABMAAAAUAAAAoQAAABYAAACiAAAAGAAAAKMAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxNlN0ZFF1YWxpZmllZE5hbWVFAAAAAGwxAAAESQAADDIAAAAAAACoSQAApAAAAKUAAACmAAAApwAAAKgAAACpAAAAFwAAABgAAACqAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTNQYXJhbWV0ZXJQYWNrRQAAAGwxAAB0SQAADDIAAAAAAAAUSgAAEQAAABIAAAATAAAAFAAAAKsAAAAWAAAAFwAAABgAAACsAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTJUZW1wbGF0ZUFyZ3NFAAAAAGwxAADgSQAADDIAAAAAAACISgAAEQAAABIAAAATAAAAFAAAAK0AAAAWAAAArgAAABgAAACvAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMjBOYW1lV2l0aFRlbXBsYXRlQXJnc0UAAAAAbDEAAExKAAAMMgAAAAAAAPxKAAARAAAAEgAAABMAAAAUAAAAsAAAABYAAAAXAAAAGAAAALEAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUyMFRlbXBsYXRlQXJndW1lbnRQYWNrRQAAAABsMQAAwEoAAAwyAAAAAAAAaEsAABEAAAASAAAAEwAAABQAAACyAAAAFgAAABcAAAAYAAAAswAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEyRW5hYmxlSWZBdHRyRQAAAABsMQAANEsAAAwyAAAAAAAA2EsAALQAAAASAAAAtQAAABQAAAC2AAAAtwAAABcAAAAYAAAAuAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTE2RnVuY3Rpb25FbmNvZGluZ0UAAAAAbDEAAKBLAAAMMgAAAAAAAEBMAAARAAAAEgAAABMAAAAUAAAAuQAAABYAAAAXAAAAGAAAALoAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGU5RG90U3VmZml4RQAAAABsMQAAEEwAAAwyAAAAAAAArEwAABEAAAASAAAAEwAAABQAAAC7AAAAFgAAABcAAAAYAAAAvAAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTEyTm9leGNlcHRTcGVjRQAAAABsMQAAeEwAAAwyAAAAAAAAIE0AABEAAAASAAAAEwAAABQAAAC9AAAAFgAAABcAAAAYAAAAvgAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTIwRHluYW1pY0V4Y2VwdGlvblNwZWNFAAAAAGwxAADkTAAADDIAAAAAAACMTQAAvwAAABIAAADAAAAAFAAAAMEAAADCAAAAFwAAABgAAADDAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTJGdW5jdGlvblR5cGVFAAAAAGwxAABYTQAADDIAAAAAAAD4TQAAEQAAABIAAAATAAAAFAAAAMQAAAAWAAAAFwAAABgAAADFAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTNPYmpDUHJvdG9OYW1lRQAAAGwxAADETQAADDIAAAAAAABoTgAAEQAAABIAAAATAAAAFAAAAMYAAAAWAAAAFwAAABgAAADHAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTdWZW5kb3JFeHRRdWFsVHlwZUUAAABsMQAAME4AAAwyAAAAAAAAzE4AAMgAAADJAAAAygAAABQAAADLAAAAzAAAABcAAAAYAAAAzQAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZThRdWFsVHlwZUUAbDEAAKBOAAAMMgAAAAAAADhPAAARAAAAEgAAABMAAAAUAAAAzgAAABYAAAAXAAAAGAAAAM8AAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxMkJpbmFyeUZQVHlwZUUAAAAAbDEAAARPAAAMMgAAAAAAAKRPAAARAAAAEgAAABMAAAAUAAAA0AAAABYAAAAXAAAAGAAAANEAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxNVBpeGVsVmVjdG9yVHlwZUUAbDEAAHBPAAAMMgAAAAAAAAxQAAARAAAAEgAAABMAAAAUAAAA0gAAABYAAAAXAAAAGAAAANMAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxMFZlY3RvclR5cGVFAABsMQAA3E8AAAwyAAAAAAAAdFAAANQAAADVAAAAEwAAABQAAADWAAAA1wAAABcAAAAYAAAA2AAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTlBcnJheVR5cGVFAAAAAGwxAABEUAAADDIAAAAAAADkUAAA2QAAABIAAAATAAAAFAAAANoAAADbAAAAFwAAABgAAADcAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTlQb2ludGVyVG9NZW1iZXJUeXBlRQBsMQAArFAAAAwyAAAAAAAAWFEAABEAAAASAAAAEwAAABQAAADdAAAAFgAAABcAAAAYAAAA3gAAAE4xMl9HTE9CQUxfX05fMTE2aXRhbml1bV9kZW1hbmdsZTIyRWxhYm9yYXRlZFR5cGVTcGVmVHlwZUUAAGwxAAAcUQAADDIAAAAAAADAUQAA3wAAABIAAAATAAAAFAAAAOAAAADhAAAAFwAAABgAAADiAAAATjEyX0dMT0JBTF9fTl8xMTZpdGFuaXVtX2RlbWFuZ2xlMTFQb2ludGVyVHlwZUUAbDEAAJBRAAAMMgAAAAAAACxSAADjAAAAEgAAABMAAAAUAAAA5AAAAOUAAAAXAAAAGAAAAOYAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUxM1JlZmVyZW5jZVR5cGVFAAAAbDEAAPhRAAAMMgAAAAAAAKBSAAARAAAAEgAAABMAAAAUAAAA5wAAABYAAAAXAAAAGAAAAOgAAABOMTJfR0xPQkFMX19OXzExNml0YW5pdW1fZGVtYW5nbGUyMFBvc3RmaXhRdWFsaWZpZWRUeXBlRQAAAABsMQAAZFIAAAwyAAC1BQAAJwcAACcHAABjBgAASAYAACsGAAC1BQAAJwcAAFcHAAB2BgAAWwYAAD8G"),a(t,21212,"cFUEABA=");var En,Rn=((En=[null,ke,function(e){return 21316},function(e){(e|=0)&&G(Et(e))},function(e,t,n,r){e|=0,t|=0,r|=0;var a,s=0,l=0,u=0;D=a=D-48|0,n=ce(a+32|0,n|=0),D=s=D-16|0,i[s+4>>2]=691,i[s>>2]=4592,l=0|E(21220,4576,0|s),D=s+16|0,(0|l)<=0&&(Fe(s=yn(a),1575,l=be(1575),l+(u=zt(i[n+4>>2],o[n+11|0]))|0),Ie(s,yt(n),u),rt(s=a+16|0,Ie(a,1553,be(1553))),ze(n,s),Et(s),Et(a)),H(e,t,n,r),Et(n),D=a+48|0},function(e,t){qt(e|=0,5296)},function(e,t,n){e|=0,t|=0,n|=0;var r,a,s=0,l=0,u=0;D=s=(D=r=D-32|0)-16|0,i[s+12>>2]=5,l=zt(i[n+4>>2],o[n+11|0]),a=yt(n),i[s+8>>2]=l,Oe(l=r+16|0,a,i[Lt(s+12|0,s+8|0)>>2]),D=s+16|0,H(r,e,t,l),s=o[r+11|0];e:if((0|(e=zt(i[r+4>>2],s)))==(0|zt(i[n+4>>2],o[n+11|0]))){if(t=yt(r),n=yt(n),!an(s))for(;;){if(u=!e,!e|o[0|t]!=o[0|n])break e;n=n+1|0,t=t+1|0,e=e-1|0}u=!(e=e?De(t,n,e):0)}return Et(r),Et(l),D=r+32|0,0|u},function(e){return 0|Rn[0|(e|=0)]()},function(){var e,t,n,a,s,l,u,c,d=0,p=0,f=0,m=0,y=0,b=0,x=0,k=0,w=0,S=0,C=0,I=0,W=0,_=0,T=0,N=0,E=0,R=0,$=0,O=0,F=0,L=0,B=0,P=0,G=0,V=0,U=0,H=0;if(p=Ue(12),D=d=(D=n=D-32|0)-16|0,p=yn(p),qt(d,6176),p=ze(p,d),Et(d),D=y=(D=d+16|0)-832|0,Ze(m=y+2|0,5334,830),i[(d=a=n+16|0)>>2]=0,i[d+4>>2]=0,Tn(d+8|0),qe()>>>0<830&&(Wn(),v()),k=Ue(830),i[d>>2]=k,i[d+4>>2]=k,i[kn(d)>>2]=k+830,D=k=D-16|0,d=mt(k,d,830),(0|(b=(m+830|0)-m|0))>0&&(Ze(i[d+4>>2],m,b),i[d+4>>2]=b+i[d+4>>2]),Ut(d),D=k+16|0,u=p,D=e=(D=y+832|0)-16|0,c=yn(n),p=i[a>>2],m=i[a+4>>2],s=32+(t=D-48|0)|0,D=R=(D=t)-32|0,i[(d=B=R+16|0)>>2]=0,i[d+4>>2]=0,Tn(d+8|0),y=gn(p,m),D=F=D-16|0,j(d,0),i[R+8>>2]=0,i[R+4>>2]=0,i[R+12>>2]=0,!p|!y)A(3630,2025,3094,1061),v();else{i[F+12>>2]=0,i[F+8>>2]=0,D=m=(D=d=D-16|0)-16|0,i[m+12>>2]=0,r[m+12|0]=205,r[m+13|0]=171,r[m+14|0]=52,r[m+15|0]=18,D=m+16|0;e:{t:{if(205==o[m+12|0]){if(i[R+8>>2]=0,i[R+4>>2]=0,i[R+12>>2]=0,i[F+12>>2]=0,i[F+8>>2]=0,W=3,y>>>0<58)break e;if(De(p,10404,8))break e;if(13!=(0|Ke(p+8|0)))break e;if(W=4,(0|ue(p+12|0,17))!=(0|Ke(p+29|0)))break e;if(i[R+8>>2]=Ke(p+16|0),m=Ke(p+20|0),i[R+4>>2]=m,W=5,m-16777217>>>0<4278190080)break e;if(x=(k=i[R+8>>2])-16777217>>>0<4278190080,m=We(k,0,m),x|!(k=M)&m>>>0>1073741824|k)break e;if(W=1,o[p+26|0]|o[p+27|0]|o[p+28|0]|8!=o[p+24|0])break e;m=3;n:{switch(o[p+25|0]-2|0){default:if(i[R+12>>2])break n;break e;case 4:m=4;case 0:}i[R+12>>2]=m}for(m=p+33|0;;){if((b=m-p|0)>>>0>=y>>>0|y-b>>>0<12)break t;if(W=0,y>>>0<8+((k=Ke(m))+b|0)>>>0)break t;for(;;){if(4!=(0|W)){if(f=m+W|0,W=W+1|0,((223&o[f+4|0])-65&255)>>>0<26)continue;break t}break}if(f=Ke(k+(m+8|0)|0),I=o[m+4|0],r[d+11|0]=I,r[d+12|0]=o[m+5|0],r[d+13|0]=o[m+6|0],C=o[m+7|0],r[d+15|0]=0,r[d+14|0]=C,(C=De(d+11|0,2172,5))&&(W=4,(0|ue(m+4|0,k+4|0))!=(0|f)))break e;n:{if(De(d+11|0,2358,5)){if(!C){if(W=1,i[F+12>>2]|!w)break e;if(i[F+12>>2]=b,i[F+8>>2]=k,k>>>0>=7)break n;W=8;break e}if(!De(d+11|0,2363,5)){if(W=1,5!=(0|k)|w|82!=o[m+8|0]|36!=o[m+9|0]|147!=o[m+10|0])break e;if(227!=o[m+11|0])break e;if(w=1,o[m+12|0])break e;break n}if(32&I)break n;W=1;break e}W=1&(!i[F+12>>2]|~w);break e}m=12+(m+k|0)|0}}A(3630,2025,2936,1711),v()}W=7}if(D=d+16|0,!((m=W)||(m=6,k=We(i[R+8>>2],0,i[R+4>>2]),!(d=M<<2|k>>>30)&(k<<=2)>>>0>2147483647|d))){if(j(B,k),d=(y-(m=i[F+12>>2])|0)-8|0,m=8+(p+m|0)|0,G=i[R+4>>2],f=i[R+8>>2],y=i[B>>2],p=i[F+8>>2],3!=i[R+12>>2]){T=m,m=0,W=0,D=k=D-16416|0,L=p;e:{t:{n:{r:{a:{s:{i:{o:{l:{u:{if(_=d,d>>>0>=p+4>>>0){c:if(!(120!=o[0|T]|L>>>0<7|1!=o[T+1|0]))if(6&o[T+2|0]){if(!(_>>>0<6|_>>>0<10)&&(b=o[T+2|0]|o[T+3|0]<<8|o[T+4|0]<<16|o[T+5|0]<<24,p=o[T+6|0]|o[T+7|0]<<8|o[T+8|0]<<16|o[T+9|0]<<24,i[k+16412>>2]=10,i[k+16396>>2]=61,d=p>>>3|0,x=p<<29,p=b,i[k+16400>>2]=x|p>>>3,i[k+16404>>2]=d,5==(7&p)&&z(T,_,k+16412|0,k+16396|0,k+16400|0,k,4))){for(P=f<<2,b=i[k+16396>>2];(0|W)!=(0|G);){if(b>>>0<=11)break u;if(O=0,p=i[k+16404>>2],d=i[k+16400>>2],!(f=(I=i[k+((4095&d)<<2)>>2])>>>9&15))break c;if(C=d,w=31&f,(63&f)>>>0>=32?(d=0,x=p>>>w|0):(d=p>>>w|0,x=((1<<w)-1&p)<<32-w|C>>>w),p=d,(b=b-f|0)>>>0<=31){if((w=(d=i[k+16412>>2])+4|0)>>>0>_>>>0)break c;f=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=w,w=31&b,(63&b)>>>0>=32?(d=f<<w,f=0):(d=(1<<w)-1&f>>>32-w,f<<=w),x|=f,p|=d,b=b+32|0}if((511&I)!=!!(0|W)<<1)break c;for(I=y,C=0,S=0,$=0,w=0,y=0;;){if(b>>>0<=11)break l;if(O=0,!(f=(E=i[k+((4095&x)<<2)>>2])>>>9&15))break c;if(N=x,x=31&f,(63&f)>>>0>=32?(d=0,x=p>>>x|0):(d=p>>>x|0,x=((1<<x)-1&p)<<32-x|N>>>x),p=d,(b=b-f|0)>>>0<=31){if((N=(d=i[k+16412>>2])+4|0)>>>0>_>>>0)break c;f=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=N,N=31&b,(63&b)>>>0>=32?(d=f<<N,f=0):(d=(1<<N)-1&f>>>32-N,f<<=N),x|=f,p|=d,b=b+32|0}d:if(256&E){if(256==(0|(d=511&E)))break c;if(f=i[10416+(E=d-257<<2)>>2],d>>>0>=265){if(d-285>>>0<4294967276)break o;if((d=i[E+10544>>2])>>>0>b>>>0)break o;if(!(b=b-d|0))break i;f=(x&i[10336+(d<<2)>>2])+f|0,E=x,x=31&d,(63&d)>>>0>=32?(d=0,x=p>>>x|0):(d=p>>>x|0,x=((1<<x)-1&p)<<32-x|E>>>x),p=d}if(b=b-1|0,i[k+16396>>2]=b,x=(1&p)<<31|x>>>1,i[k+16400>>2]=x,p=p>>>1|0,i[k+16404>>2]=p,3&f)break c;if((d=y+f|0)>>>0>P>>>0)break c;if(m){if(!(255&(S|C|$|w))){Ze(y+I|0,m+y|0,f),y=d;break d}for(;r[y+I|0]=o[m+y|0]+w,r[(f=y+1|0)+I|0]=o[m+f|0]+$,r[(f=y+2|0)+I|0]=o[m+f|0]+S,r[(f=y+3|0)+I|0]=o[m+f|0]+C,d>>>0>(y=y+4|0)>>>0;);break d}for(;r[0|(f=y+I|0)]=w,r[f+3|0]=C,r[f+2|0]=S,r[f+1|0]=$,d>>>0>(y=y+4|0)>>>0;);}else{h:{p:{f:{m:{if(E>>>0>=33554432){if(E>>>0>1107296255)break s;if((d=E>>>25|0)>>>0>b>>>0)break s;if((w=b-d|0)>>>0<=11)break a;if(C=x,f=31&d,(63&d)>>>0>=32?(d=0,x=p>>>f|0):(d=p>>>f|0,x=((1<<f)-1&p)<<32-f|C>>>f),p=d,!(C=(S=i[((4095&x)<<2)+(b=k)>>2])>>>9&15))break c;$=E>>>16&511}else{if(!(d=($=i[k+((4095&x)<<2)>>2])>>>9&15))break c;if(w=b-d|0,f=x,b=31&d,(63&d)>>>0>=32?(d=0,x=p>>>b|0):(d=p>>>b|0,x=((1<<b)-1&p)<<32-b|f>>>b),p=d,$>>>0>33554431)break m;if(!(C=(S=i[k+((4095&x)<<2)>>2])>>>9&15))break c}if(S>>>0<33554432)break f;if((d=(S>>>25|0)+C|0)>>>0>=33)break r;if(C=S>>>16|0,f=w-d|0,i[k+16396>>2]=f,w=31&d,b=k,(63&d)>>>0>=32?(d=0,x=p>>>w|0):(d=p>>>w|0,x=((1<<w)-1&p)<<32-w|x>>>w),i[k+16400>>2]=x,p=d,i[b+16404>>2]=d,f>>>0>31){b=f;break h}if((b=(d=i[k+16412>>2])+4|0)>>>0>_>>>0)break c;w=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=b,b=f+32|0,i[k+16396>>2]=b,N=31&f,(63&f)>>>0>=32?(d=w<<N,f=0):(d=(1<<N)-1&w>>>32-N,f=w<<N),x|=f,d|=p;break p}if($>>>0>=1107296256)break n;S=$>>>16|0,C=$>>>25|0}if(f=x,b=31&C,(63&C)>>>0>=32?(d=0,x=p>>>b|0):(d=p>>>b|0,x=((1<<b)-1&p)<<32-b|f>>>b),p=d,(b=w-C|0)>>>0<=31){if((w=(d=i[k+16412>>2])+4|0)>>>0>_>>>0)break c;f=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=w,w=31&b,(63&b)>>>0>=32?(d=f<<w,f=0):(d=(1<<w)-1&f>>>32-w,f<<=w),x|=f,p|=d,b=b+32|0}if(!(d=(C=i[k+((4095&x)<<2)>>2])>>>9&15))break c;b=b-d|0,i[k+16396>>2]=b,w=x,f=31&d,(63&d)>>>0>=32?(d=0,x=p>>>f|0):(d=p>>>f|0,x=((1<<f)-1&p)<<32-f|w>>>f)}p=d,i[k+16400>>2]=x,i[k+16404>>2]=p}if(256&(S|$|C))break c;m?(r[y+I|0]=E+o[m+y|0],r[(d=y+1|0)+I|0]=o[d+m|0]+$,r[(d=y+2|0)+I|0]=o[d+m|0]+S,d=o[(O=y+3|0)+m|0]+C|0):(r[0|(d=y+I|0)]=E,r[d+2|0]=S,r[d+1|0]=$,O=y+3|0,d=C),r[I+O|0]=d,y=y+4|0,w=E}if(!(y>>>0<P>>>0))break}W=W+1|0,y=I+P|0,m=I}if(b>>>0<=11)break t;O=0,!(d=(p=i[k+((4095&i[k+16400>>2])<<2)>>2])>>>9&15)|256!=(511&p)||(p=i[k+16412>>2])>>>0<(d=b-d>>>3|0)>>>0||(O=(0|L)==(4+(p-d|0)|0))}}else O=K(T,_,L,y,f,G,4);D=k+16416|0,p=O;break e}A(3911,2025,2592,3527),v()}A(2189,2025,2634,3527),v()}A(2189,2025,2650,3527),v()}A(3851,2025,2672,3527),v()}A(3820,2025,2678,3527),v()}A(3820,2025,2771,3527),v()}A(2189,2025,2773,3527),v()}A(3605,2025,2807,3527),v()}A(3605,2025,2811,3527),v()}A(2189,2025,2876,3527),v()}}else{T=m,w=0,W=0,D=k=D-16416|0,O=p;e:{t:{n:{r:{if(E=d,d>>>0>=p+4>>>0){if(120!=o[0|T]|O>>>0<7|1!=o[T+1|0])break n;if(!(6&o[T+2|0])){W=K(T,E,O,y,f,G,3);break n}if(E>>>0<6|E>>>0<10)break n;if(m=o[T+2|0]|o[T+3|0]<<8|o[T+4|0]<<16|o[T+5|0]<<24,p=o[T+6|0]|o[T+7|0]<<8|o[T+8|0]<<16|o[T+9|0]<<24,i[k+16412>>2]=10,i[k+16396>>2]=61,d=p>>>3|0,x=p<<29,p=m,i[k+16400>>2]=x|p>>>3,i[k+16404>>2]=d,5!=(7&p))break n;if(!z(T,E,k+16412|0,k+16396|0,k+16400|0,k,3))break n;for(L=f<<2,f=i[k+16396>>2];;){if((0|$)==(0|G))break r;if(I=y,!(f>>>0>11))break;if(W=0,p=i[k+16404>>2],d=i[k+16400>>2],!(m=(C=i[k+((4095&d)<<2)>>2])>>>9&15))break n;if(b=d,y=31&m,(63&m)>>>0>=32?(d=0,x=p>>>y|0):(d=p>>>y|0,x=((1<<y)-1&p)<<32-y|b>>>y),p=d,(m=f-m|0)>>>0<=31){if((b=(d=i[k+16412>>2])+4|0)>>>0>E>>>0)break n;y=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=b,b=31&m,(63&m)>>>0>=32?(d=y<<b,b=0):(d=(1<<b)-1&y>>>32-b,b=y<<b),x|=b,p|=d,m=m+32|0}if(f=m,(511&C)!=!!(0|$)<<1)break n;for(b=0,C=0,m=0,y=0;;){a:{s:{i:{o:{l:{u:{c:{d:{h:{p:{f:{if(f>>>0>11){if(W=0,!(_=(S=i[k+((4095&x)<<2)>>2])>>>9&15))break n;if(N=x,x=31&_,(63&_)>>>0>=32?(d=0,x=p>>>x|0):(d=p>>>x|0,x=((1<<x)-1&p)<<32-x|N>>>x),p=d,(f=f-_|0)>>>0<=31){if((N=(d=i[k+16412>>2])+4|0)>>>0>E>>>0)break n;_=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=N,N=31&f,(63&f)>>>0>=32?(d=_<<N,_=0):(d=(1<<N)-1&_>>>32-N,_<<=N),x|=_,p|=d,f=f+32|0}if(256&S){if(256==(0|(d=511&S)))break n;if(S=i[10416+(_=d-257<<2)>>2],d>>>0>=265){if(d-285>>>0<4294967276)break f;if((d=i[_+10544>>2])>>>0>f>>>0)break f;if(!(f=f-d|0))break p;S=(x&i[10336+(d<<2)>>2])+S|0,_=x,x=31&d,(63&d)>>>0>=32?(d=0,x=p>>>x|0):(d=p>>>x|0,x=((1<<x)-1&p)<<32-x|_>>>x),p=d}if(f=f-1|0,i[k+16396>>2]=f,x=(1&p)<<31|x>>>1,i[k+16400>>2]=x,p=p>>>1|0,i[k+16404>>2]=p,(S>>>0)%3|0)break h;if(!(S=h[10672+(S<<1)>>1]))break n;if((d=y+S|0)>>>0>L>>>0)break n;if(w){if(!(255&(b|C|m))){Ze(y+I|0,y+w|0,S),y=d;break a}for(;r[0|(W=y+I|0)]=o[y+w|0]+m,r[(S=y+1|0)+I|0]=o[w+S|0]+C,_=o[(S=y+2|0)+w|0],r[W+3|0]=255,r[S+I|0]=b+_,d>>>0>(y=y+4|0)>>>0;);break a}for(;r[0|(W=y+I|0)]=m,r[W+3|0]=255,r[W+2|0]=b,r[W+1|0]=C,d>>>0>(y=y+4|0)>>>0;);break a}m:if(S>>>0>=33554432){if(S>>>0>1107296255)break d;if((d=S>>>25|0)>>>0>f>>>0)break d;if((b=f-d|0)>>>0<=11)break c;if(f=x,m=31&d,(63&d)>>>0>=32?(d=0,x=p>>>m|0):(d=p>>>m|0,x=((1<<m)-1&p)<<32-m|f>>>m),p=d,!(f=(m=i[((4095&x)<<2)+k>>2])>>>9&15))break n;C=S>>>16&511}else{if(!(d=(C=i[k+((4095&x)<<2)>>2])>>>9&15))break n;if(b=f-d|0,f=x,m=31&d,(63&d)>>>0>=32?(d=0,x=p>>>m|0):(d=p>>>m|0,x=((1<<m)-1&p)<<32-m|f>>>m),p=d,C>>>0<=33554431){if(f=(m=i[k+((4095&x)<<2)>>2])>>>9&15)break m;break n}if(C>>>0>=1107296256)break u;m=C>>>16|0,f=C>>>25|0}if(b=b-f|0,i[k+16396>>2]=b,_=x,x=31&f,(63&f)>>>0>=32?(d=0,x=p>>>x|0):(d=p>>>x|0,x=((1<<x)-1&p)<<32-x|_>>>x),i[k+16400>>2]=x,p=d,i[k+16404>>2]=d,b>>>0>31)f=b;else{if((f=(d=i[k+16412>>2])+4|0)>>>0>E>>>0)break n;_=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=f,f=b+32|0,i[k+16396>>2]=f,N=31&b,(63&b)>>>0>=32?(d=_<<N,b=0):(d=(1<<N)-1&_>>>32-N,b=_<<N),x|=b,i[k+16400>>2]=x,p|=d,i[k+16404>>2]=p}if(256&(m|C))break n;if(w?(r[y+I|0]=S+o[y+w|0],r[(d=y+1|0)+I|0]=o[d+w|0]+C,d=o[w+(b=y+2|0)|0]+m|0):(r[0|(d=y+I|0)]=S,r[d+1|0]=C,b=y+2|0,d=m),r[b+I|0]=d,r[3+(N=y+I|0)|0]=255,16777216&m|m>>>0<33554432|(_=y+4|0)>>>0>=L>>>0)break s;if(m>>>0>1107296255)break l;if((d=m>>>25|0)>>>0>f>>>0)break l;if((S=f-d|0)>>>0<=11)break o;if(f=x,b=31&d,(63&d)>>>0>=32?(d=0,f=p>>>b|0):(d=p>>>b|0,f=((1<<b)-1&p)<<32-b|f>>>b),!(b=(C=i[((4095&f)<<2)+k>>2])>>>9&15))break n;if(p=d,x=f,f=31&b,(63&b)>>>0>=32?(d=0,x=p>>>f|0):(d=p>>>f|0,x=((1<<f)-1&p)<<32-f|x>>>f),p=d,(b=S-b|0)>>>0<=31){if((S=(d=i[k+16412>>2])+4|0)>>>0>E>>>0)break n;f=o[0|(d=d+T|0)]|o[d+1|0]<<8|o[d+2|0]<<16|o[d+3|0]<<24,i[k+16412>>2]=S,S=31&b,(63&b)>>>0>=32?(d=f<<S,f=0):(d=(1<<S)-1&f>>>32-S,f<<=S),x|=f,p|=d,b=b+32|0}if(d=b,C>>>0>=33554432)b=C>>>16|0,S=C>>>25|0;else if(!(S=(b=i[k+((4095&x)<<2)>>2])>>>9&15))break n;if(d>>>0<S>>>0|S>>>0>32)break i;if(f=d-S|0,i[k+16396>>2]=f,P=x,x=31&S,(63&S)>>>0>=32?(d=0,x=p>>>x|0):(d=p>>>x|0,x=((1<<x)-1&p)<<32-x|P>>>x),i[k+16400>>2]=x,p=d,i[k+16404>>2]=d,256&(b|C))break n;m=m>>>16|0,w?(r[I+_|0]=o[w+_|0]+m,r[(d=y+5|0)+I|0]=o[d+w|0]+C,d=o[(W=y+6|0)+w|0]+b|0):(r[I+_|0]=m,r[N+5|0]=C,W=y+6|0,d=b),r[I+W|0]=d,r[N+7|0]=255,y=y+8|0;break a}A(2189,2025,2272,3566),v()}A(3851,2025,2294,3566),v()}A(3820,2025,2300,3566),v()}A(3613,2025,2303,3566),v()}A(3820,2025,2399,3566),v()}A(2189,2025,2401,3566),v()}A(3605,2025,2429,3566),v()}A(3820,2025,2481,3566),v()}A(2189,2025,2483,3566),v()}A(3820,2025,2502,3566),v()}b=m,m=S,y=_}if(!(y>>>0<L>>>0))break}$=$+1|0,y=I+L|0,w=I}A(2189,2025,2256,3566),v()}A(3911,2025,2214,3566),v()}if(f>>>0<=11)break t;W=0,!(d=(p=i[k+((4095&i[k+16400>>2])<<2)>>2])>>>9&15)|256!=(511&p)||(p=i[k+16412>>2])>>>0<(d=f-d>>>3|0)>>>0||(W=(0|O)==(4+(p-d|0)|0))}D=k+16416|0,p=W;break e}A(2189,2025,2560,3566),v()}}m=1^p}D=F+16|0}e:if(m)qt(s,4497);else for(p=yn(s),i[R>>2]=pt(i[B>>2]),d=pt(i[B+4>>2]);;){if(!(1^nn(m=i[R>>2],d)))break e;if(!(m=o[0|m]))break e;re(p,m<<24>>24),i[R>>2]=i[R>>2]+1}Tt(B),y=W=t+16|0,m=0,D=b=(D=R+32|0)-16|0;e:if(p=ce(b,s),zt(d=i[p+4>>2],k=o[p+11|0]))for(d=dn(d,k),ne(y=yn(y),g(d>>>2|0,3));;){if(d>>>0<=m>>>0)break e;re(y,((f=he(o[0|cn(p,1|m)]))>>>4&3|he(o[0|cn(p,m)])<<2)<<24>>24),(k=2|m)>>>0>=d>>>0||61!=o[0|cn(p,k)]&&46!=o[0|cn(p,k)]&&(re(y,((w=he(o[0|cn(p,k)]))>>>2&15|f<<4)<<24>>24),(k=3|m)>>>0>=d>>>0||61!=o[0|cn(p,k)]&&46!=o[0|cn(p,k)]&&re(y,he(o[0|cn(p,k)])+(w<<6)<<24>>24)),m=m+4|0}else yn(y);for(Et(p),D=b+16|0,p=l=qt(t,6208),D=f=D-192|0,b=yt(W),w=yt(p),d=zt(i[W+4>>2],o[W+11|0]),y=0,m=zt(i[p+4>>2],o[p+11|0]),D=p=f-(15+(C=d+((p=(0|d)%16|0)?16-p|0:0)|0)&-16)|0,D=x=p-(15+(I=m+((k=(0|m)%16|0)?16-k|0:0)|0)&-16)|0,k=et(p,0,C),p=et(x,0,I),d=(0|d)>0?d:0;;){if((0|d)==(0|y)){for(y=0,d=(0|m)>0?m:0;(0|d)!=(0|y);)r[p+y|0]=o[y+w|0],y=y+1|0;break}r[y+k|0]=o[y+b|0],y=y+1|0}for(m=0;;){if(w=4,4==(0|m)){for(;44!=(0|w);)p=o[(I=(x=w<<2)+f|0)-1|0],y=o[I-2|0],S=o[I-3|0],b=o[I-4|0],3&w?(d=b,m=p):(d=o[11504+(w>>>2|0)|0]^o[S+11248|0],S=o[y+11248|0],y=o[p+11248|0],m=o[b+11248|0]),r[0|I]=o[I-16|0]^d,r[f+(1|x)|0]=o[I-15|0]^S,r[f+(2|x)|0]=y^o[I-14|0],r[f+(3|x)|0]=o[I-13|0]^m,w=w+1|0;break}r[(d=m<<2)+f|0]=o[d+p|0],r[(y=1|d)+f|0]=o[p+y|0],r[(y=2|d)+f|0]=o[p+y|0],r[(d|=3)+f|0]=o[d+p|0],m=m+1|0}for(p=i[2811],d=i[2810],r[f+184|0]=d,r[f+185|0]=d>>>8,r[f+186|0]=d>>>16,r[f+187|0]=d>>>24,r[f+188|0]=p,r[f+189|0]=p>>>8,r[f+190|0]=p>>>16,r[f+191|0]=p>>>24,p=i[2809],d=i[2808],r[f+176|0]=d,r[f+177|0]=d>>>8,r[f+178|0]=d>>>16,r[f+179|0]=d>>>24,r[f+180|0]=p,r[f+181|0]=p>>>8,r[f+182|0]=p>>>16,r[f+183|0]=p>>>24,y=k,d=0,D=b=D-16|0,p=f+176|0;d>>>0<C>>>0;){for(m=o[y+4|0]|o[y+5|0]<<8|o[y+6|0]<<16|o[y+7|0]<<24,i[b>>2]=o[0|y]|o[y+1|0]<<8|o[y+2|0]<<16|o[y+3|0]<<24,i[b+4>>2]=m,m=o[y+12|0]|o[y+13|0]<<8|o[y+14|0]<<16|o[y+15|0]<<24,i[b+8>>2]=o[y+8|0]|o[y+9|0]<<8|o[y+10|0]<<16|o[y+11|0]<<24,i[b+12>>2]=m,Ce(10,y,f),_=9;;){for(m=o[y+13|0],r[y+13|0]=o[y+9|0],w=o[y+5|0],r[y+5|0]=o[y+1|0],r[y+9|0]=w,r[y+1|0]=m,m=o[y+2|0],r[y+2|0]=o[y+10|0],r[y+10|0]=m,m=o[y+6|0],r[y+6|0]=o[y+14|0],r[y+14|0]=m,m=o[y+3|0],r[y+3|0]=o[y+7|0],r[y+7|0]=o[y+11|0],w=o[y+15|0],r[y+15|0]=m,r[y+11|0]=w,w=0;m=0,4!=(0|w);){for(;4!=(0|m);)r[0|(I=((m<<2)+y|0)+w|0)]=o[o[0|I]+11520|0],m=m+1|0;w=w+1|0}if(Ce(w=255&_,y,f),!w)break;for(;4!=(0|m);)R=(G=o[1+(w=(m<<2)+y|0)|0])^(L=o[0|w]),I=o[w+2|0],$=Dt(L),F=Dt($),x=Dt(F),B=Dt(G),N=Dt(B),S=Dt(N),P=Dt(I),V=Dt(P),T=Dt(V),U=Dt(O=o[w+3|0]),H=Dt(U),E=Dt(H),r[w+3|0]=E^T^S^x^$^I^R^N^U^H,r[w+2|0]=E^T^S^x^F^R^O^P^V^U,r[w+1|0]=E^T^S^B^x^O^I^L^N^P^H,r[0|w]=E^T^S^B^x^F^$^O^I^G^V,m=m+1|0;_=_-1|0}for(;16!=(0|m);)r[0|(w=m+y|0)]=o[0|w]^o[p+m|0],m=m+1|0;m=i[b+12>>2],w=i[b+8>>2],r[p+8|0]=w,r[p+9|0]=w>>>8,r[p+10|0]=w>>>16,r[p+11|0]=w>>>24,r[p+12|0]=m,r[p+13|0]=m>>>8,r[p+14|0]=m>>>16,r[p+15|0]=m>>>24,m=i[b+4>>2],w=i[b>>2],r[0|p]=w,r[p+1|0]=w>>>8,r[p+2|0]=w>>>16,r[p+3|0]=w>>>24,r[p+4|0]=m,r[p+5|0]=m>>>8,r[p+6|0]=m>>>16,r[p+7|0]=m>>>24,d=d+16|0,y=y+16|0}D=b+16|0;e:{if(!(15&C|C>>>0<16||((p=o[k+(y=C-1|0)|0])-1&255)>>>0>15|p>>>0>=C>>>0))for(d=1;;){if(p>>>0<=(255&d)>>>0)break e;if(d=d+1|0,(0|p)!=o[k+(y=y-1|0)|0])break}y=0}return(m=bt(p=yn(e)))>>>0>=(d=y||C)>>>0?(m=Vt(yt(p),k,d),It(p,d),Cn(d+m|0,0)):se(x=p,m,d-m|0,p=zt(i[p+4>>2],o[p+11|0]),0,p,d,k),D=f+192|0,Et(l),Et(W),Et(s),D=t+48|0,p=ze(c,e),Et(e),D=e+16|0,d=ze(u,p),Et(p),Tt(a),D=n+32|0,0|d},function(e,t,n,r){t|=0,n|=0,r|=0;var a,s=0;return D=a=D-48|0,t=((s=i[4+(e|=0)>>2])>>1)+t|0,e=i[e>>2],e=1&s?i[i[t>>2]+e>>2]:e,Jt(s=a+16|0,n),Jt(a,r),n=a+32|0,Rn[0|e](n,t,s,a),e=Ge(n),Et(n),Et(a),Et(s),D=a+48|0,0|e},function(e,t){t|=0;var n,r=0;return D=n=D-16|0,r=i[(e|=0)>>2],t=((e=i[e+4>>2])>>1)+t|0,1&e&&(r=i[r+i[t>>2]>>2]),Rn[0|r](n,t),e=Ge(n),Et(n),D=n+16|0,0|e},function(e,t,n,r){t|=0,n|=0,r|=0;var a,s=0;return D=a=D-32|0,t=((s=i[4+(e|=0)>>2])>>1)+t|0,e=i[e>>2],e=1&s?i[i[t>>2]+e>>2]:e,Jt(s=a+16|0,n),Jt(a,r),e=0|Rn[0|e](t,s,a),Et(a),Et(s),D=a+32|0,0|e},J,function(e,t,n,a,s,u){e|=0,t=+t,n|=0,a|=0,s|=0,u|=0;var c,h=0,p=0,f=0,m=0,b=0,v=0,A=0,x=0,k=0,w=0,S=0,C=0,I=0,W=0,_=0,T=0,N=0,E=0;D=c=D-560|0,i[c+44>>2]=0,d(+t),h=0|l(1),l(0),(0|h)<0?(C=1,_=1116,d(+(t=-t)),h=0|l(1),l(0)):2048&s?(C=1,_=1119):(_=(C=1&s)?1122:1117,E=!C);e:if(2146435072&~h){W=c+16|0;t:{n:{r:{if(t=ve(t,c+44|0),0!=(t+=t)){if(h=i[c+44>>2],i[c+44>>2]=h-1,97!=(0|(S=32|u)))break r;break t}if(97==(0|(S=32|u)))break t;b=i[c+44>>2],v=(0|a)<0?6:a;break n}b=h-29|0,i[c+44>>2]=b,t*=268435456,v=(0|a)<0?6:a}for(p=k=(c+48|0)+((0|b)>=0?288:0)|0;a=t<4294967296&t>=0?~~t>>>0:0,i[p>>2]=a,p=p+4|0,0!=(t=1e9*(t-+(a>>>0))););if((0|b)<=0)a=b,h=p,m=k;else for(m=k,a=b;;){if(a=(0|a)>=29?29:a,!(m>>>0>(h=p-4|0)>>>0)){for(f=0;x=i[h>>2],A=31&a,T=f,(63&a)>>>0>=32?(f=x<<A,x=0):(f=(1<<A)-1&x>>>32-A,x<<=A),f=f+N|0,x=We(f=X(A=T+x|0,f=A>>>0<x>>>0?f+1|0:f,1e9),M,-1e9)+A|0,i[h>>2]=x,m>>>0<=(h=h-4|0)>>>0;);f&&(i[(m=m-4|0)>>2]=f)}for(;m>>>0<(h=p)>>>0&&!i[(p=h-4|0)>>2];);if(a=i[c+44>>2]-a|0,i[c+44>>2]=a,p=h,!((0|a)>0))break}if((0|a)<0)for(I=1+((v+25>>>0)/9|0)|0,A=102==(0|S);;){if(f=(0|(a=0-a|0))>=9?9:a,h>>>0<=m>>>0)p=i[m>>2];else{for(x=1e9>>>f|0,N=~(-1<<f),a=0,p=m;T=a,a=i[p>>2],i[p>>2]=T+(a>>>f|0),a=g(x,a&N),(p=p+4|0)>>>0<h>>>0;);p=i[m>>2],a&&(i[h>>2]=a,h=h+4|0)}if(a=f+i[c+44>>2]|0,i[c+44>>2]=a,m=(!p<<2)+m|0,h=h-(p=A?k:m)>>2>(0|I)?p+(I<<2)|0:h,!((0|a)<0))break}if(a=0,!(h>>>0<=m>>>0||(a=g(k-m>>2,9),p=10,(f=i[m>>2])>>>0<10)))for(;a=a+1|0,f>>>0>=(p=g(p,10))>>>0;);if((0|(p=(v-(102!=(0|S)?a:0)|0)-(103==(0|S)&!!(0|v))|0))<(g(h-k>>2,9)-9|0)){if(b=((((0|b)<0?4:292)+c|0)+((A=(0|(f=p+9216|0))/9|0)<<2)|0)-4048|0,p=10,(0|(f=f+g(A,-9)|0))<=7)for(;p=g(p,10),8!=(0|(f=f+1|0)););if(A=i[b>>2],!((0|(f=g(I=(A>>>0)/(p>>>0)|0,p)))==(0|A)&(0|(x=b+4|0))==(0|h))&&(A=A-f|0,!(1&I)&&(t=9007199254740992,!(1&r[b-4|0])|1e9!=(0|p)|m>>>0>=b>>>0)||(t=9007199254740994),w=(0|h)==(0|x)?1:1.5,w=A>>>0<(x=p>>>1|0)>>>0?.5:(0|x)==(0|A)?w:1.5,45!=o[0|_]|E||(w=-w,t=-t),i[b>>2]=f,t+w!=t)){if(a=p+f|0,i[b>>2]=a,a>>>0>=1e9)for(;i[b>>2]=0,(b=b-4|0)>>>0<m>>>0&&(i[(m=m-4|0)>>2]=0),a=i[b>>2]+1|0,i[b>>2]=a,a>>>0>999999999;);if(a=g(k-m>>2,9),p=10,!((f=i[m>>2])>>>0<10))for(;a=a+1|0,f>>>0>=(p=g(p,10))>>>0;);}h=h>>>0>(p=b+4|0)>>>0?p:h}for(;p=h,!(f=h>>>0<=m>>>0)&&!i[(h=p-4|0)>>2];);if(103==(0|S)){if(v=((b=(0|(h=v||1))>(0|a)&(0|a)>-5)?~a:-1)+h|0,u=(b?-1:-2)+u|0,!(b=8&s)){if(h=-9,!f&&(A=i[p-4>>2])&&(f=10,h=0,!((A>>>0)%10|0))){for(;b=h,h=h+1|0,!((A>>>0)%((f=g(f,10))>>>0)|0););h=~b}f=g(p-k>>2,9),70!=(-33&u)?(b=0,v=(0|(h=(0|(h=((a+f|0)+h|0)-9|0))>0?h:0))>(0|v)?v:h):(b=0,v=(0|(h=(0|(h=(h+f|0)-9|0))>0?h:0))>(0|v)?v:h)}}else b=8&s;if(f=-1,(0|((S=b|v)?2147483645:2147483646))<(0|v))break e;if(A=1+(!!(0|S)+v|0)|0,70!=(0|(x=-33&u))){if((W-(h=me(((h=a>>31)^a)-h|0,0,W))|0)<=1)for(;r[0|(h=h-1|0)]=48,(W-h|0)<2;);if(r[0|(I=h-2|0)]=u,r[h-1|0]=(0|a)<0?45:43,(0|(h=W-I|0))>(2147483647^A))break e}else{if((2147483647^A)<(0|a))break e;h=(0|a)>0?a:0}if((0|(a=h+A|0))>(2147483647^C))break e;Se(e,32,n,u=a+C|0,s),ie(e,_,C),Se(e,48,n,u,65536^s);n:{r:{a:{if(70==(0|x)){for(a=8|(h=c+16|0),b=9|h,m=f=m>>>0>k>>>0?k:m;;){h=me(i[m>>2],0,b);s:if((0|f)==(0|m))(0|h)==(0|b)&&(r[c+24|0]=48,h=a);else{if(c+16>>>0>=h>>>0)break s;for(;r[0|(h=h-1|0)]=48,c+16>>>0<h>>>0;);}if(ie(e,h,b-h|0),!(k>>>0>=(m=m+4|0)>>>0))break}if(S&&ie(e,3710,1),(0|v)<=0|p>>>0<=m>>>0)break a;for(;;){if((h=me(i[m>>2],0,b))>>>0>c+16>>>0)for(;r[0|(h=h-1|0)]=48,c+16>>>0<h>>>0;);if(ie(e,h,(0|v)>=9?9:v),h=v-9|0,p>>>0<=(m=m+4|0)>>>0)break r;if(a=(0|v)>9,v=h,!a)break}break r}s:if(!((0|v)<0))for(f=p>>>0>m>>>0?p:m+4|0,a=8|(h=c+16|0),k=9|h,p=m;;){(0|k)==(0|(h=me(i[p>>2],0,k)))&&(r[c+24|0]=48,h=a);i:if((0|p)==(0|m))ie(e,h,1),h=h+1|0,b|v&&ie(e,3710,1);else{if(c+16>>>0>=h>>>0)break i;for(;r[0|(h=h-1|0)]=48,c+16>>>0<h>>>0;);}if(ie(e,T=h,(0|(h=k-h|0))>(0|v)?v:h),v=v-h|0,f>>>0<=(p=p+4|0)>>>0)break s;if(!((0|v)>=0))break}Se(e,48,v+18|0,18,0),ie(e,I,W-I|0);break n}h=v}Se(e,48,h+9|0,9,0)}Se(e,32,n,u,8192^s),f=(0|n)<(0|u)?u:n;break e}if(v=(u<<26>>31&9)+_|0,!(a>>>0>11)){for(h=12-a|0,w=16;w*=16,h=h-1|0;);t=45!=o[0|v]?t+w-w:-(w+(-t-w))}for(b=2|C,m=32&u,(0|W)==(0|(h=me(((h=(p=i[c+44>>2])>>31)^p)-h|0,0,W)))&&(r[c+15|0]=48,h=c+15|0),r[0|(k=h-2|0)]=u+15,r[h-1|0]=(0|p)<0?45:43,f=8&s,p=c+16|0;u=p,h=y(t)<2147483648?~~t:-2147483648,r[0|p]=m|o[h+12272|0],!(f|(0|a)>0)&0==(t=16*(t-+(0|h)))|1!=((p=u+1|0)-(c+16|0)|0)||(r[u+1|0]=46,p=u+2|0),0!=t;);f=-1,(2147483645-(u=(A=W-k|0)+b|0)|0)<(0|a)||(Se(e,32,n,a=(h=!a||((m=p-(c+16|0)|0)-2|0)>=(0|a)?m=p-(c+16|0)|0:a+2|0)+u|0,s),ie(e,v,b),Se(e,48,n,a,65536^s),ie(e,c+16|0,m),Se(e,48,h-m|0,0,0),ie(e,k,A),Se(e,32,n,a,8192^s),f=(0|n)<(0|a)?a:n)}else Se(e,32,n,a=C+3|0,-65537&s),ie(e,_,C),u&=32,ie(e,t!=t?u?1549:2292:u?1895:2333,3),Se(e,32,n,a,8192^s),f=(0|n)<(0|a)?a:n;return D=c+560|0,0|f},function(e,t){e|=0;var n,r,a,s=0,o=0,l=0,d=0,h=0,p=0,f=0,g=0,y=0,b=0,v=0;o=t|=0,t=i[t>>2]+7&-8,i[o>>2]=t+16,a=e,g=i[(e=t)>>2],t=i[e+4>>2],r=l=i[e+12>>2],D=n=D-32|0;e:if((0|(s=(l&=2147483647)-1006698496|0))==(0|(d=l-1140785152|0))&(o=i[e+8>>2])>>>0<o>>>0|s>>>0<d>>>0){if(s=(e=o)<<4|t>>>28,l=o=r<<4|e>>>28,t=e=268435455&t,134217728==(0|e)&!!(0|g)|e>>>0>134217728){e=l+1073741824|0,e=(t=s+1|0)?e:e+1|0,s=t;break e}if(e=l+1073741824|0,g|134217728!=(0|t))break e;e=(t=1&s)>>>0>(s=l=t+s|0)>>>0?e+1|0:e}else(!o&2147418112==(0|l)?!(t|g):l>>>0<2147418112)?(s=0,e=2146435072,l>>>0>1140785151||(e=0,(b=l>>>16|0)>>>0<15249||(s=g,e=t,l=d=65535&r|65536,y=o,h=o,64&(f=b-15233|0)?(d=s,s=31&(o=f+-64|0),(63&o)>>>0>=32?(e=d<<s,h=0):(e=(1<<s)-1&d>>>32-s|e<<s,h=d<<s),d=e,s=0,e=0):f&&(p=31&(o=f),(63&o)>>>0>=32?(o=h<<p,h=0):(o=(1<<p)-1&h>>>32-p|d<<p,h<<=p),d=o,v=h,h=s,p=31&(o=64-f|0),(63&o)>>>0>=32?(o=0,h=e>>>p|0):(o=e>>>p|0,h=((1<<p)-1&e)<<32-p|h>>>p),h|=v,d|=o,p=31&f,(63&f)>>>0>=32?(o=s<<p,s=0):(o=(1<<p)-1&s>>>32-p|e<<p,s<<=p),e=o),i[n+16>>2]=s,i[n+20>>2]=e,i[n+24>>2]=h,i[n+28>>2]=d,64&(o=15361-b|0)?(t=y,d=31&(e=o+-64|0),(63&e)>>>0>=32?(o=0,g=l>>>d|0):(o=l>>>d|0,g=((1<<d)-1&l)<<32-d|t>>>d),t=o,y=0,l=0):o&&(d=y,s=31&(e=64-o|0),(63&e)>>>0>=32?(e=d<<s,s=0):(e=(1<<s)-1&d>>>32-s|l<<s,s=d<<s),d=e,h=s,s=g,f=31&(e=o),(63&e)>>>0>=32?(o=0,t=t>>>f|0):(o=t>>>f|0,t=((1<<f)-1&t)<<32-f|s>>>f),g=h|t,t=o|d,o=y,d=31&e,(63&e)>>>0>=32?(e=0,y=l>>>d|0):(e=l>>>d|0,y=((1<<d)-1&l)<<32-d|o>>>d),l=e),i[n>>2]=g,i[n+4>>2]=t,i[n+8>>2]=y,i[n+12>>2]=l,s=(t=i[n+8>>2])<<4|(l=i[n+4>>2])>>>28,e=i[n+12>>2]<<4|t>>>28,134217728==(0|(l&=268435455))&!!(0|(t=i[n>>2]|!!(i[n+16>>2]|i[n+24>>2]|i[n+20>>2]|i[n+28>>2])))|l>>>0>134217728?(e=(t=s+1|0)?e:e+1|0,s=t):t|134217728!=(0|l)||(e=(t=s+(1&s)|0)>>>0<s>>>0?e+1|0:e,s=t)))):(s=(e=o)<<4|t>>>28,e=524287&(o=r<<4|e>>>28)|2146959360);D=n+32|0,u(0,0|s),u(1,-2147483648&r|e),m[a>>3]=c()},function(e,t,n){t|=0,n|=0;var a,s,o=0,l=0,u=0;return a=i[84+(e|=0)>>2],l=i[a>>2],o=i[a+4>>2],s=i[e+28>>2],(u=o>>>0<(u=i[e+20>>2]-s|0)>>>0?o:u)&&(Ze(l,s,u),l=u+i[a>>2]|0,i[a>>2]=l,o=i[a+4>>2]-u|0,i[a+4>>2]=o),(o=n>>>0>o>>>0?o:n)&&(Ze(l,t,o),l=o+i[a>>2]|0,i[a>>2]=l,i[a+4>>2]=i[a+4>>2]-o),r[0|l]=0,t=i[e+44>>2],i[e+28>>2]=t,i[e+20>>2]=t,0|n},Wn,Kt,Kt,Kt,function(e,t){return 0|e},function(e,t){t=Ye(t|=0,i[8+(e|=0)>>2],i[e+12>>2]),lt(i[e+16>>2],t)},function(e,t){},function(e,t){i[(e|=0)>>2]=0,i[e+4>>2]=0},hn,wn,hn,wn,Nn,Nn,function(e,t,n){n|=0;var a,s=0,o=0,l=0,u=0;if(D=a=D+-64|0,s=1,!fe(e|=0,t|=0,0)&&(s=0,t)){D=s=D+-64|0,o=i[t>>2],l=i[o-4>>2],u=i[o-8>>2],i[s+28>>2]=0,i[s+32>>2]=0,i[s+36>>2]=0,i[s+40>>2]=0,i[s+44>>2]=0,i[s+48>>2]=0,i[s+52>>2]=0,i[s+56>>2]=0,o=0,r[s+59|0]=0,r[s+60|0]=0,r[s+61|0]=0,r[s+62|0]=0,i[s+20>>2]=0,i[s+24>>2]=0,i[s+16>>2]=12488,i[s+12>>2]=t,i[s+8>>2]=12536,t=t+u|0;e:if(fe(l,12536,0))i[s+56>>2]=1,Rn[i[i[l>>2]+20>>2]](l,s+8|0,t,t,1,0),o=1==i[s+32>>2]?t:0;else{Rn[i[i[l>>2]+24>>2]](l,s+8|0,t,1,0);t:switch(i[s+44>>2]){case 0:o=1==i[s+48>>2]&&1==i[s+36>>2]&&1==i[s+40>>2]?i[s+28>>2]:0;break e;case 1:break t;default:break e}1!=i[s+32>>2]&&i[s+48>>2]|1!=i[s+36>>2]|1!=i[s+40>>2]||(o=i[s+24>>2])}D=s- -64|0,s=0,o&&(et(4|(t=a+8|0),0,52),i[a+56>>2]=1,i[a+20>>2]=-1,i[a+16>>2]=e,i[a+8>>2]=o,Rn[i[i[o>>2]+28>>2]](o,t,i[n>>2],1),1==(0|(e=i[a+32>>2]))&&(i[n>>2]=i[a+24>>2]),s=1==(0|e))}return D=a- -64|0,0|s},function(e,t,n,r,a,s){n|=0,r|=0,a|=0,s|=0,fe(e|=0,i[8+(t|=0)>>2],s)?le(t,n,r,a):(e=i[e+8>>2],Rn[i[i[e>>2]+20>>2]](e,t,n,r,a,s))},function(e,t,n,a,l){if(n|=0,a|=0,l|=0,fe(e|=0,i[8+(t|=0)>>2],l))vt(t,n,a);else e:{if(fe(e,i[t>>2],l)){if(!(i[t+16>>2]!=(0|n)&i[t+20>>2]!=(0|n))){if(1!=(0|a))break e;return void(i[t+32>>2]=1)}i[t+32>>2]=a;t:if(4!=i[t+44>>2]){if(s[t+52>>1]=0,e=i[e+8>>2],Rn[i[i[e>>2]+20>>2]](e,t,n,n,1,l),o[t+53|0]){if(i[t+44>>2]=3,!o[t+52|0])break t;break e}i[t+44>>2]=4}if(i[t+20>>2]=n,i[t+40>>2]=i[t+40>>2]+1,1!=i[t+36>>2]|2!=i[t+24>>2])break e;return void(r[t+54|0]=1)}e=i[e+8>>2],Rn[i[i[e>>2]+24>>2]](e,t,n,a,l)}},function(e,t,n,r){n|=0,r|=0,fe(e|=0,i[8+(t|=0)>>2],0)?we(t,n,r):(e=i[e+8>>2],Rn[i[i[e>>2]+28>>2]](e,t,n,r))},wn,function(e,t,n,r,a,s){n|=0,r|=0,a|=0,s|=0,fe(e|=0,i[8+(t|=0)>>2],s)&&le(t,n,r,a)},function(e,t,n,a,s){if(n|=0,a|=0,s|=0,fe(e|=0,i[8+(t|=0)>>2],s))vt(t,n,a);else e:if(fe(e,i[t>>2],s)){if(!(i[t+16>>2]!=(0|n)&i[t+20>>2]!=(0|n))){if(1!=(0|a))break e;return void(i[t+32>>2]=1)}i[t+20>>2]=n,i[t+32>>2]=a,i[t+40>>2]=i[t+40>>2]+1,1!=i[t+36>>2]|2!=i[t+24>>2]||(r[t+54|0]=1),i[t+44>>2]=4}},function(e,t,n,r){n|=0,r|=0,fe(e|=0,i[8+(t|=0)>>2],0)&&we(t,n,r)},Wn,function(e){v()},function(e,t){e|=0;var n,r=0;D=n=D-16|0,r=t|=0,t=_t(n+8|0,4317),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),r=t,t=_t(n,3722),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+12>>2],t),D=n+16|0},wn,function(e,t){Ye(t|=0,i[8+(e|=0)>>2],i[e+12>>2])},function(e,t){var n;e|=0,n=i[12+(t|=0)>>2],i[e>>2]=i[t+8>>2],i[e+4>>2]=n},wn,Be,dt,wn,function(e,t){t|=0;var n,r=0,a=0;return D=n=D-16|0,o[16+(e|=0)|0]||(r=ct(n+8|0,e+16|0),a=st(i[e+12>>2],t),Ft(r)),D=n+16|0,0|a},function(e,t){t|=0;var n,r=0,a=0;return D=n=D-16|0,o[16+(e|=0)|0]||(r=ct(n+8|0,e+16|0),a=nt(i[e+12>>2],t),Ft(r)),D=n+16|0,0|a},function(e,t){t|=0;var n,r=0,a=0;return D=n=D-16|0,o[16+(e|=0)|0]||(r=ct(n+8|0,e+16|0),a=tt(i[e+12>>2],t),Ft(r)),D=n+16|0,0|a},function(e,t){t|=0;var n,r=0;return D=n=D-16|0,o[16+(e|=0)|0]||(r=ct(n+8|0,e+16|0),e=i[e+12>>2],e=0|Rn[i[i[e>>2]+12>>2]](e,t),Ft(r)),D=n+16|0,0|e},function(e,t){t|=0;var n,r=0;D=n=D-16|0,o[16+(e|=0)|0]||(r=ct(n+8|0,e+16|0),e=i[e+12>>2],Rn[i[i[e>>2]+16>>2]](e,t),Ft(r)),D=n+16|0},function(e,t){t|=0;var n,r=0;D=n=D-16|0,o[16+(e|=0)|0]||(r=ct(n+8|0,e+16|0),e=i[e+12>>2],Rn[i[i[e>>2]+20>>2]](e,t),Ft(r)),D=n+16|0},wn,function(e,t){t|=0;var n,r=0,a=0;D=n=D-32|0,gn(i[8+(e|=0)>>2],i[e+12>>2])>>>0>=4&&(r=_t(n+24|0,4053),a=Ye(Ye(t,i[r>>2],i[r+4>>2]),i[e+8>>2],i[e+12>>2]),r=_t(n+16|0,3946),Ye(a,i[r>>2],i[r+4>>2])),r=i[e+16>>2],110!=o[0|r]?a=i[e+20>>2]:(r=_t(n+8|0,3736),Ye(t,i[r>>2],i[r+4>>2]),St(n,i[e+16>>2],i[e+20>>2]),r=i[n>>2],a=i[n+4>>2]),t=Ye(t,r,a),gn(r=i[e+8>>2],e=i[e+12>>2])>>>0<=3&&Ye(t,r,e),D=n+32|0},wn,function(e,t){var n;t|=0,D=n=D-16|0,e=_t(n+8|0,o[8+(e|=0)|0]?1908:1929),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},wn,function(e,t){t|=0;var n,a,s=0,o=0,l=0;if(D=n=D-48|0,a=i[8+(e|=0)>>2],1+(i[e+12>>2]-a|0)>>>0>=9){for(o=n+40|0,e=0;8!=(0|e);)l=((s=r[(1|e)+a|0])-48>>>0<10?-48:-87)+s|0,s=r[e+a|0],r[0|o]=l+((s-48>>>0>=10?9:0)+s<<4),o=o+1|0,e=e+2|0;Le(n+40|0,o),i[n+32>>2]=0,i[n+36>>2]=0,i[n+24>>2]=0,i[n+28>>2]=0,i[n+16>>2]=0,i[n+20>>2]=0,m[n>>3]=f[n+40>>2],e=Ot(n+8|0,e=n+16|0,ye(e,24,1904,n)+e|0),Ye(t,i[e>>2],i[e+4>>2])}D=n+48|0},wn,function(e,t){t|=0;var n,a,s=0,o=0,l=0;if(D=n=D+-64|0,a=i[8+(e|=0)>>2],1+(i[e+12>>2]-a|0)>>>0>=17){for(o=n+56|0,e=0;16!=(0|e);)l=((s=r[(1|e)+a|0])-48>>>0<10?-48:-87)+s|0,s=r[e+a|0],r[0|o]=l+((s-48>>>0>=10?9:0)+s<<4),o=o+1|0,e=e+2|0;Le(n+56|0,o),i[n+40>>2]=0,i[n+44>>2]=0,i[n+32>>2]=0,i[n+36>>2]=0,i[n+24>>2]=0,i[n+28>>2]=0,i[n+16>>2]=0,i[n+20>>2]=0,m[n>>3]=m[n+56>>3],e=Ot(n+8|0,e=n+16|0,ye(e,32,2081,n)+e|0),Ye(t,i[e>>2],i[e+4>>2])}D=n- -64|0},wn,function(e,t){t|=0;var n,a,s=0,o=0,l=0;if(D=n=D-96|0,a=i[8+(e|=0)>>2],1+(i[e+12>>2]-a|0)>>>0>=33){for(s=n+80|0,e=0;32!=(0|e);)l=((o=r[(1|e)+a|0])-48>>>0<10?-48:-87)+o|0,o=r[e+a|0],r[0|s]=l+((o-48>>>0>=10?9:0)+o<<4),s=s+1|0,e=e+2|0;Le(n+80|0,s),et(e=n+32|0,0,42),s=i[n+84>>2],i[n>>2]=i[n+80>>2],i[n+4>>2]=s,s=i[n+92>>2],i[n+8>>2]=i[n+88>>2],i[n+12>>2]=s,e=Ot(n+24|0,e,ye(e,42,2311,n)+e|0),Ye(t,i[e>>2],i[e+4>>2])}D=n+96|0},wn,function(e,t){Me(e|=0,t|=0,4109,3459)},wn,function(e,t){var n,r;e|=0,D=n=D-16|0,r=t|=0,t=_t(n+8|0,2016),t=Ye(Ye(r,i[t>>2],i[t+4>>2]),i[e+8>>2],i[e+12>>2]),e=_t(n,4069),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},wn,function(e,t){t|=0;var n,a=0,s=0,o=0,l=0,u=0;D=n=D-32|0;e:{t:{n:switch(i[8+(e|=0)>>2]){case 0:s=4|(a=n+24|0),o=_t(a,2177);break t;case 1:s=4|(a=n+16|0),o=_t(a,2296);break t;case 2:break n;default:break e}s=4|(a=n+8|0),o=_t(a,2168)}Ye(t,i[o>>2],i[s>>2])}if(e=i[e+12>>2]){if(D=l=D-32|0,a=0,e=e-1|0){for(s=u=l+29|0;e|a;)o=e,o=We(e=X(e,a,10),a=M,246)+o|0,r[0|(s=s-1|0)]=48|o;e=Ot(l,s,u),en(t,i[e>>2],i[e+4>>2])}else gt(t,48);D=l+32|0}D=n+32|0},wn,function(e,t){var n;e|=0,D=e=D-16|0,n=t|=0,t=_t(e+8|0,4456),Ye(n,i[t>>2],i[t+4>>2]),D=e+16|0},Pt,wn,function(e,t){var n,r;t|=0,D=n=D-16|0,r=i[12+(e|=0)>>2],Rn[i[i[r>>2]+16>>2]](r,t),st(i[e+12>>2],t)||(e=_t(n+8|0,4496),Ye(t,i[e>>2],i[e+4>>2])),D=n+16|0},function(e,t){t|=0,lt(i[8+(e|=0)>>2],t),e=i[e+12>>2],Rn[i[i[e>>2]+20>>2]](e,t)},wn,function(e,t){var n,r;t|=0,D=n=D-16|0,r=12+(e|=0)|0,e=_t(n+8|0,3431),ge(r,e=Ye(t,i[e>>2],i[e+4>>2])),t=e,e=_t(n,4454),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},Pt,wn,function(e,t){Ve(e|=0,t|=0,3708)},function(e,t){t|=0,e=i[8+(e|=0)>>2],Rn[i[i[e>>2]+20>>2]](e,t)},wn,function(e,t){var n,r,a;D=n=D-16|0,r=e|=0,a=t|=0,t=_t(n+8|0,2070),t=Ye(Ye(a,i[t>>2],i[t+4>>2]),i[e+24>>2],i[e+28>>2]),e=_t(n,4069),pe(r,Ye(t,i[e>>2],i[e+4>>2])),D=n+16|0},wn,function(e,t){var n,r;e|=0,D=n=D-16|0,r=t|=0,t=_t(n+8|0,2135),t=Ye(r,i[t>>2],i[t+4>>2]),e=i[e+8>>2],46==o[e+4|0]&&pe(e,t),e=_t(n,1034),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},wn,function(e,t){e|=0;var n,r=0,a=0;D=n=D-32|0,r=t|=0,t=_t(n+24|0,4053),t=en(r,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),r=t,t=_t(n+16|0,3946),r=t=en(r,i[t>>2],i[t+4>>2]),110!=o[i[e+12>>2]]?e=e+12|0:(a=t,t=_t(n+8|0,3736),en(a,i[t>>2],i[t+4>>2]),St(n,i[e+12>>2],i[e+16>>2]),e=n),en(r,i[e>>2],i[e+4>>2]),D=n+32|0},wn,function(e,t){var n,r;e|=0,D=n=D-16|0,r=t|=0,t=_t(n+8|0,1502),Ye(Ye(r,i[t>>2],i[t+4>>2]),i[e+8>>2],i[e+12>>2]),D=n+16|0},wn,function(e,t){e|=0,t|=0;var n,r=0,a=0;D=n=D-32|0,i[n+28>>2]=e,i[n+24>>2]=t,gt(t,40),o[e+24|0]?((r=i[e+12>>2])&&(lt(r,t),gt(t,32),gt(Ye(t,i[e+16>>2],i[e+20>>2]),32)),r=_t(n+16|0,4475),gt(Ye(Ye(t,i[r>>2],i[r+4>>2]),i[e+16>>2],i[e+20>>2]),32),je(n+24|0)):(je(n+24|0),gt(t,32),a=Ye(t,i[e+16>>2],i[e+20>>2]),r=_t(n+8|0,3707),r=Ye(a,i[r>>2],i[r+4>>2]),i[e+12>>2]&&(gt(r,32),gt(r=Ye(r,i[e+16>>2],i[e+20>>2]),32),lt(i[e+12>>2],r))),gt(t,41),D=n+32|0},wn,ae,wn,function(e,t){e|=0,t|=0;var n,r=0;D=n=D+-64|0,r=_t(n+56|0,3253),de(i[e+12>>2],i[e+16>>2],i[r>>2],i[r+4>>2])&&(r=_t(n+48|0,4053),Ye(t,i[r>>2],i[r+4>>2])),r=t,t=_t(n+40|0,4053),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),r=t,t=_t(n+32|0,4483),r=Ye(Ye(r,i[t>>2],i[t+4>>2]),i[e+12>>2],i[e+16>>2]),t=_t(n+24|0,4052),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+20>>2],t),r=t,t=_t(n+16|0,3946),r=Ye(r,i[t>>2],i[t+4>>2]),t=_t(n+56|0,3253),de(i[e+12>>2],i[e+16>>2],i[t>>2],i[t+4>>2])&&(e=_t(n+8|0,3946),Ye(r,i[e>>2],i[e+4>>2])),D=n- -64|0},wn,function(e,t){var n,r;D=n=D-16|0,r=Ye(t|=0,i[8+(e|=0)>>2],i[e+12>>2]),t=_t(n+8|0,4053),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+16>>2],t),e=_t(n,3946),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},wn,function(e,t){var n,r=0;D=n=D-32|0,r=Ye(t|=0,i[8+(e|=0)>>2],i[e+12>>2]),t=_t(n+24|0,3460),t=Ye(r,i[t>>2],i[t+4>>2]),r=i[e+16>>2],Rn[i[i[r>>2]+16>>2]](r,t),r=t,t=_t(n+16|0,3975),t=Ye(r,i[t>>2],i[t+4>>2]),e=i[e+20>>2],Rn[i[i[e>>2]+16>>2]](e,t),e=_t(n+8|0,3946),Ye(t,i[e>>2],i[e+4>>2]),D=n+32|0},wn,function(e,t){var n,r;t|=0,D=n=D-16|0,lt(i[8+(e|=0)>>2],t),r=e+12|0,e=_t(n+8|0,4053),ge(r,e=Ye(t,i[e>>2],i[e+4>>2])),t=e,e=_t(n,3946),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},wn,function(e,t){e|=0;var n,r=0;D=n=D-32|0,r=t|=0,t=_t(n+24|0,4053),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),r=e+12|0,e=_t(n+16|0,3989),ge(r,e=Ye(t,i[e>>2],i[e+4>>2])),t=e,e=_t(n+8|0,3946),Ye(t,i[e>>2],i[e+4>>2]),D=n+32|0},wn,function(e,t){t|=0;var n,r=0;D=n=D-32|0,o[12+(e|=0)|0]&&(r=_t(n+24|0,3484),Ye(t,i[r>>2],i[r+4>>2])),r=t,t=_t(n+16|0,1922),t=Ye(r,i[t>>2],i[t+4>>2]),o[e+13|0]&&(r=_t(n+8|0,4466),Ye(t,i[r>>2],i[r+4>>2])),lt(i[e+8>>2],t),D=n+32|0},wn,Be,dt,wn,function(e,t){var n,r;e|=0,D=n=D-16|0,r=t|=0,t=_t(n+8|0,1032),t=Ye(r,i[t>>2],i[t+4>>2]),e=i[e+8>>2],Rn[i[i[e>>2]+16>>2]](e,t),D=n+16|0},wn,function(e,t){Xe(e|=0,t|=0,4143)},wn,function(e,t){Xe(e|=0,t|=0,4486)},wn,function(e,t){Xe(e|=0,t|=0,3484)},ht,wn,function(e,t){t|=0,lt(i[8+(e|=0)>>2],t),t=Ye(t,i[e+12>>2],i[e+16>>2]),lt(i[e+20>>2],t)},wn,function(e,t){xe(e|=0,t|=0,2136,2152)},wn,function(e,t){t|=0;var n,r=0;D=n=D-16|0,o[16+(e|=0)|0]?(gt(t,91),lt(i[e+8>>2],t),gt(t,93)):(gt(t,46),lt(i[e+8>>2],t)),r=i[e+12>>2],(o[r+4|0]-75&255)>>>0>=2&&(r=_t(n+8|0,4470),Ye(t,i[r>>2],i[r+4>>2]),r=i[e+12>>2]),lt(r,t),D=n+16|0},wn,function(e,t){e|=0;var n,r=0;D=n=D-16|0,gt(t|=0,91),lt(i[e+8>>2],t),r=t,t=_t(n+8|0,4474),r=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+12>>2],r),gt(r,93),t=i[e+16>>2],(o[t+4|0]-75&255)>>>0>=2&&(t=_t(n,4470),Ye(r,i[t>>2],i[t+4>>2]),t=i[e+16>>2]),lt(t,r),D=n+16|0},wn,function(e,t){var n;t|=0,(n=i[8+(e|=0)>>2])&&lt(n,t),gt(t,123),ge(e+12|0,t),gt(t,125)},wn,function(e,t){xe(e|=0,t|=0,3946,3989)},wn,function(e,t){e|=0;var n,r=0;D=n=D-16|0,r=t|=0,t=_t(n+8|0,4053),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),r=t,t=_t(n,3946),Ye(Ye(r,i[t>>2],i[t+4>>2]),i[e+12>>2],i[e+16>>2]),D=n+16|0},wn,function(e,t){t|=0;var n,r=0,a=0;D=n=D+-64|0,o[28+(e|=0)|0]&&(r=_t(n+56|0,4141),Ye(t,i[r>>2],i[r+4>>2])),a=t,t=_t(n+48|0,1153),t=Ye(a,i[t>>2],i[t+4>>2]),o[e+29|0]&&(r=_t(n+40|0,2135),Ye(t,i[r>>2],i[r+4>>2])),gt(t,32),i[e+12>>2]&&(r=_t(n+32|0,4053),ge(e+8|0,r=Ye(t,i[r>>2],i[r+4>>2])),a=r,r=_t(n+24|0,3946),Ye(a,i[r>>2],i[r+4>>2])),lt(i[e+16>>2],t),i[e+24>>2]&&(a=e+20|0,e=_t(n+16|0,4053),ge(a,e=Ye(t,i[e>>2],i[e+4>>2])),t=e,e=_t(n+8|0,3946),Ye(t,i[e>>2],i[e+4>>2])),D=n- -64|0},wn,function(e,t){t=Ye(t|=0,i[8+(e|=0)>>2],i[e+12>>2]),lt(i[e+16>>2],t),Ye(t,i[e+20>>2],i[e+24>>2])},wn,function(e,t){e|=0;var n,r=0;D=n=D-32|0,r=t|=0,t=_t(n+24|0,4053),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),r=t,t=_t(n+16|0,4031),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+12>>2],t),r=t,t=_t(n+8|0,4037),t=Ye(r,i[t>>2],i[t+4>>2]),lt(i[e+16>>2],t),e=_t(n,3946),Ye(t,i[e>>2],i[e+4>>2]),D=n+32|0},wn,function(e,t){t|=0;var n,r,a=0;D=n=D-48|0,lt(i[12+(e|=0)>>2],t),a=t,t=_t(n+40|0,3456),t=Ye(a,i[t>>2],i[t+4>>2]),lt(i[e+8>>2],t),a=t,t=_t(n+32|0,4129),r=Ye(a,i[t>>2],i[t+4>>2]),nn(t=i[e+16>>2],a=i[e+20>>2])?(t=i[_t(n+24|0,3630)>>2],a=i[n+28>>2]):110==o[0|t]&&(t=_t(n+16|0,3736),Ye(r,i[t>>2],i[t+4>>2]),St(n+8|0,i[e+16>>2],i[e+20>>2]),t=i[n+8>>2],a=i[n+12>>2]),t=Ye(r,t,a),e=_t(n,3253),Ye(t,i[e>>2],i[e+4>>2]),D=n+48|0},wn,function(e,t){var n,r;e|=0,D=n=D-32|0,r=t|=0,t=_t(n+24|0,3978),t=Ye(r,i[t>>2],i[t+4>>2]),ae(Je(n+8|0,i[e+8>>2]),t),e=_t(n,3946),Ye(t,i[e>>2],i[e+4>>2]),D=n+32|0},wn,jt,wn,function(e,t){Xe(e|=0,t|=0,4122)},wn,function(e,t){oe(e|=0,t|=0,3033,3084,3134,3184)},function(e,t){_t(e|=0,i[21164+(i[8+(t|=0)>>2]<<2)>>2])},wn,function(e,t){t|=0;var n,r=0;D=n=D-16|0,o[12+(e|=0)|0]&&(r=_t(n+8|0,1032),Ye(t,i[r>>2],i[r+4>>2])),e=i[e+8>>2],Rn[i[i[e>>2]+24>>2]](n,e),Ye(t,i[n>>2],i[n+4>>2]),D=n+16|0},wn,function(e,t){t|=0;var n,r=0;D=n=D-16|0,r=i[8+(e|=0)>>2],Rn[i[i[r>>2]+16>>2]](r,t),r=t,t=_t(n+8|0,3462),t=Ye(Ye(r,i[t>>2],i[t+4>>2]),i[e+12>>2],i[e+16>>2]),e=_t(n,2136),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},wn,function(e,t){e|=0,gt(t|=0,91),ge(e+8|0,t),gt(t,93)},wn,Be,wn,function(e,t){oe(e|=0,t|=0,1594,1622,1649,1844)},function(e,t){_t(e|=0,i[21188+(i[8+(t|=0)>>2]<<2)>>2])},wn,function(e,t){Xe(e|=0,t|=0,3481)},ht,wn,function(e,t){var n;return t|=0,kt(i[12+(e|=0)>>2],t),0|((n=i[t+12>>2])>>>0<p[e+12>>2]?st(Xt(i[e+8>>2],n),t):0)},function(e,t){var n;return t|=0,kt(i[12+(e|=0)>>2],t),0|((n=i[t+12>>2])>>>0<p[e+12>>2]?nt(Xt(i[e+8>>2],n),t):0)},function(e,t){var n;return t|=0,kt(i[12+(e|=0)>>2],t),0|((n=i[t+12>>2])>>>0<p[e+12>>2]?tt(Xt(i[e+8>>2],n),t):0)},function(e,t){var n;return t|=0,kt(i[12+(e|=0)>>2],t),(n=i[t+12>>2])>>>0<p[e+12>>2]&&(e=Xt(i[e+8>>2],n),e=0|Rn[i[i[e>>2]+12>>2]](e,t)),0|e},function(e,t){var n;t|=0,kt(i[12+(e|=0)>>2],t),(n=i[t+12>>2])>>>0<p[e+12>>2]&&(e=Xt(i[e+8>>2],n),Rn[i[i[e>>2]+16>>2]](e,t))},function(e,t){var n;t|=0,kt(i[12+(e|=0)>>2],t),(n=i[t+12>>2])>>>0<p[e+12>>2]&&(e=Xt(i[e+8>>2],n),Rn[i[i[e>>2]+20>>2]](e,t))},wn,function(e,t){var n,r;t|=0,D=n=D-32|0,r=8+(e|=0)|0,e=_t(n+24|0,3460),ge(r,e=Ye(t,i[e>>2],i[e+4>>2])),62==(0|$t(i[e>>2],i[e+4>>2]))&&(t=_t(n+16|0,4496),Ye(e,i[t>>2],i[t+4>>2])),t=e,e=_t(n+8|0,3253),Ye(t,i[e>>2],i[e+4>>2]),D=n+32|0},wn,function(e,t){t|=0,lt(i[8+(e|=0)>>2],t),lt(i[e+12>>2],t)},ht,wn,jt,wn,function(e,t){He(e|=0,t|=0,93,3468)},wn,Zt,Zt,function(e,t){t|=0;var n,r=0;D=n=D-16|0,(r=i[8+(e|=0)>>2])&&(Rn[i[i[r>>2]+16>>2]](r,t),st(i[e+8>>2],t)||(r=_t(n+8|0,4496),Ye(t,i[r>>2],i[r+4>>2]))),lt(i[e+12>>2],t),D=n+16|0},function(e,t){e|=0;var n,r=0,a=0;D=n=D+-64|0,r=t|=0,t=_t(n+56|0,4053),ge(e+16|0,t=Ye(r,i[t>>2],i[t+4>>2])),r=t,t=_t(n+48|0,3946),r=Ye(r,i[t>>2],i[t+4>>2]),(t=i[e+8>>2])&&Rn[i[i[t>>2]+20>>2]](t,r),1&(t=i[e+28>>2])&&(t=_t(n+40|0,1172),Ye(r,i[t>>2],i[t+4>>2]),t=i[e+28>>2]),2&t&&(t=_t(n+32|0,1954),Ye(r,i[t>>2],i[t+4>>2]),t=i[e+28>>2]),4&t&&(t=_t(n+24|0,1282),Ye(r,i[t>>2],i[t+4>>2]));e:{t:{n:switch(o[e+32|0]-1|0){case 0:t=4|(a=n+16|0),a=_t(a,4096);break t;case 1:break n;default:break e}t=4|(a=n+8|0),a=_t(a,4092)}Ye(r,i[a>>2],i[t>>2])}(e=i[e+24>>2])&&lt(e,r),D=n- -64|0},wn,function(e,t){Ee(e|=0,t|=0,3946,4052)},wn,function(e,t){Me(e|=0,t|=0,3946,3955)},wn,function(e,t){He(e|=0,t|=0,41,3948)},wn,Zt,Zt,function(e,t){Ve(e|=0,t|=0,4496)},function(e,t){e|=0;var n,r=0,a=0;D=n=D+-64|0,r=t|=0,t=_t(n+56|0,4053),ge(e+12|0,t=Ye(r,i[t>>2],i[t+4>>2])),r=t,t=_t(n+48|0,3946),t=Ye(r,i[t>>2],i[t+4>>2]),r=i[e+8>>2],Rn[i[i[r>>2]+20>>2]](r,t),1&(r=i[e+20>>2])&&(r=_t(n+40|0,1172),Ye(t,i[r>>2],i[r+4>>2]),r=i[e+20>>2]),2&r&&(r=_t(n+32|0,1954),Ye(t,i[r>>2],i[r+4>>2]),r=i[e+20>>2]),4&r&&(r=_t(n+24|0,1282),Ye(t,i[r>>2],i[r+4>>2]));e:{t:{n:switch(o[e+24|0]-1|0){case 0:r=4|(a=n+16|0),a=_t(a,4096);break t;case 1:break n;default:break e}r=4|(a=n+8|0),a=_t(a,4092)}Ye(t,i[a>>2],i[r>>2])}i[e+28>>2]&&(gt(t,32),lt(i[e+28>>2],t)),D=n- -64|0},wn,function(e,t){Ee(e|=0,t|=0,3253,3460)},wn,function(e,t){var n,r;t|=0,D=n=D-16|0,lt(i[8+(e|=0)>>2],t),r=t,t=_t(n+8|0,4496),t=Ye(Ye(r,i[t>>2],i[t+4>>2]),i[e+12>>2],i[e+16>>2]),(e=i[e+20>>2])&&lt(e,t),D=n+16|0},wn,Wt,function(e,t){return t|=0,0|nt(i[12+(e|=0)>>2],t)},function(e,t){return t|=0,0|tt(i[12+(e|=0)>>2],t)},function(e,t){t|=0;var n,r=0;r=i[12+(e|=0)>>2],Rn[i[i[r>>2]+16>>2]](r,t),D=n=D-32|0,1&(r=i[e+8>>2])&&(r=_t(n+24|0,1172),Ye(t,i[r>>2],i[r+4>>2]),r=i[e+8>>2]),2&r&&(r=_t(n+16|0,1954),Ye(t,i[r>>2],i[r+4>>2]),r=i[e+8>>2]),4&r&&(e=_t(n+8|0,1282),Ye(t,i[e>>2],i[e+4>>2])),D=n+32|0},function(e,t){t|=0,e=i[12+(e|=0)>>2],Rn[i[i[e>>2]+20>>2]](e,t)},wn,function(e,t){Xe(e|=0,t|=0,1310)},wn,function(e,t){Me(e|=0,t|=0,2136,2138)},wn,function(e,t){var n,r;t|=0,D=n=D-16|0,lt(i[8+(e|=0)>>2],t),r=t,t=_t(n+8|0,2143),t=Ye(r,i[t>>2],i[t+4>>2]),(e=i[e+12>>2])&&lt(e,t),e=_t(n,2136),Ye(t,i[e>>2],i[e+4>>2]),D=n+16|0},wn,Zt,Zt,function(e,t){t|=0,e=i[8+(e|=0)>>2],Rn[i[i[e>>2]+16>>2]](e,t)},function(e,t){e|=0;var n,r=0;D=n=D-32|0,93!=(0|$t(i[(t|=0)>>2],i[t+4>>2]))&&(r=_t(n+24|0,4496),Ye(t,i[r>>2],i[r+4>>2])),r=t,t=_t(n+16|0,2153),t=Ye(r,i[t>>2],i[t+4>>2]),(r=i[e+12>>2])&&lt(r,t),r=t,t=_t(n+8|0,2136),t=Ye(r,i[t>>2],i[t+4>>2]),e=i[e+8>>2],Rn[i[i[e>>2]+20>>2]](e,t),D=n+32|0},wn,Wt,function(e,t){t|=0;var n,r,a=0;D=n=D-32|0,a=i[12+(e|=0)>>2],Rn[i[i[a>>2]+16>>2]](a,t),r=t,nt(i[e+12>>2],t)||tt(i[e+12>>2],t)?(a=4|(t=n+24|0),t=_t(t,4053)):(a=4|(t=n+16|0),t=_t(t,4496)),t=Ye(r,i[t>>2],i[a>>2]),lt(i[e+8>>2],t),e=_t(n+8|0,3791),Ye(t,i[e>>2],i[e+4>>2]),D=n+32|0},function(e,t){t|=0;var n,r=0;D=n=D-16|0,(nt(i[12+(e|=0)>>2],t)||tt(i[e+12>>2],t))&&(r=_t(n+8|0,3946),Ye(t,i[r>>2],i[r+4>>2])),e=i[e+12>>2],Rn[i[i[e>>2]+20>>2]](e,t),D=n+16|0},wn,function(e,t){gt(t=Ye(t|=0,i[8+(e|=0)>>2],i[e+12>>2]),32),lt(i[e+16>>2],t)},wn,Nt,function(e,t){var n,r,a=0,s=0,l=0;D=n=D-48|0,r=t|=0,a=i[8+(e|=0)>>2],10==o[a+4|0]&&Te(i[a+8>>2])?(e=4|(s=n+8|0),l=t,t=_t(n+16|0,3441),Ye(Ye(l,i[t>>2],i[t+4>>2]),i[a+12>>2],i[a+16>>2]),t=_t(s,3253)):(Rn[i[i[a>>2]+16>>2]](a,t),nt(i[e+8>>2],t)&&(a=_t(n+40|0,4496),Ye(t,i[a>>2],i[a+4>>2])),(nt(i[e+8>>2],t)||tt(i[e+8>>2],t))&&(e=_t(n+32|0,4053),Ye(t,i[e>>2],i[e+4>>2])),e=4|(a=n+24|0),t=_t(a,3796)),Ye(r,i[t>>2],i[e>>2]),D=n+48|0},function(e,t){t|=0;var n,r=0;D=n=D-16|0,r=i[8+(e|=0)>>2],10==o[r+4|0]&&Te(i[r+8>>2])||((nt(r,t)||tt(i[e+8>>2],t))&&(r=_t(n+8|0,3946),Ye(t,i[r>>2],i[r+4>>2])),e=i[e+8>>2],Rn[i[i[e>>2]+20>>2]](e,t)),D=n+16|0},wn,Nt,function(e,t){t|=0;var n,r=0;D=n=D-48|0,o[16+(e|=0)|0]||(r=ct(n+40|0,e+16|0),Z(n+32|0,i[e+8>>2],i[e+12>>2],t),(e=i[n+36>>2])&&(Rn[i[i[e>>2]+16>>2]](e,t),nt(i[n+36>>2],t)&&(e=_t(n+24|0,4496),Ye(t,i[e>>2],i[e+4>>2])),(nt(i[n+36>>2],t)||tt(i[n+36>>2],t))&&(e=_t(n+16|0,4053),Ye(t,i[e>>2],i[e+4>>2])),e=_t(n+8|0,i[n+32>>2]?4093:4097),Ye(t,i[e>>2],i[e+4>>2])),Ft(r)),D=n+48|0},function(e,t){t|=0;var n,r=0;D=n=D-32|0,o[16+(e|=0)|0]||(r=ct(n+24|0,e+16|0),Z(n+16|0,i[e+8>>2],i[e+12>>2],t),(e=i[n+20>>2])&&((nt(e,t)||tt(i[n+20>>2],t))&&(e=_t(n+8|0,3946),Ye(t,i[e>>2],i[e+4>>2])),e=i[n+20>>2],Rn[i[i[e>>2]+20>>2]](e,t)),Ft(r)),D=n+32|0},wn,function(e,t){var n;t|=0,n=i[8+(e|=0)>>2],Rn[i[i[n>>2]+16>>2]](n,t),Ye(t,i[e+12>>2],i[e+16>>2])},wn]).set=function(e,t){this[e]=t},En.get=function(e){return this[e]},En);return{r:function(){i[5327]=1,i[5328]=0,ke(),i[5328]=i[5330],i[5330]=21308,i[5331]=12,i[5332]=0,J(),i[5332]=i[5330],i[5330]=21324},s:L,t:function(e){e|=0;var t,n,a,s=0,o=0;return D=t=D-96|0,i[t>>2]=e,D=o=D-16|0,i[o+12>>2]=t,D=e=D-144|0,e=Ze(e,12288,144),n=t+16|0,i[e+44>>2]=n,i[e+20>>2]=n,s=(s=-2-n|0)>>>0>=2147483647?2147483647:s,i[e+48>>2]=s,a=s+n|0,i[e+28>>2]=a,i[e+16>>2]=a,ee(e,1508,t,0,0),s&&(s=i[e+20>>2],r[s-((0|s)==i[e+16>>2])|0]=0),D=e+144|0,D=o+16|0,e=(o=L(e=be(n)+1|0))?Ze(o,n,e):0,D=t+96|0,0|e},u:function(){var e=0;if(e=i[5330])for(;Rn[i[e>>2]](),e=i[e+4>>2];);},v:G,w:Rn}}(e)}(He)},instantiate:function(e,t){return{then:function(t){var n=new c.Module(e);t({instance:new c.Instance(n)})}}},RuntimeError:Error};o=[],"object"!=a(c)&&E("no native wasm support detected");var d=!1;var h,p,f,m,g,y,b,v,A,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(e,t){return e?function(e,t,n){for(var r=t+n,a=t;e[a]&&!(a>=r);)++a;if(a-t>16&&e.buffer&&x)return x.decode(e.subarray(t,a));for(var s="";t<a;){var i=e[t++];if(128&i){var o=63&e[t++];if(192!=(224&i)){var l=63&e[t++];if((i=224==(240&i)?(15&i)<<12|o<<6|l:(7&i)<<18|o<<12|l<<6|63&e[t++])<65536)s+=String.fromCharCode(i);else{var u=i-65536;s+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else s+=String.fromCharCode((31&i)<<6|o)}else s+=String.fromCharCode(i)}return s}(f,e,t):""}var w,S,C=e.INITIAL_MEMORY||1048576;(u=e.wasmMemory?e.wasmMemory:new c.Memory({initial:C/65536,maximum:C/65536}))&&(h=u.buffer),C=h.byteLength,h=w=h,e.HEAP8=p=new Int8Array(w),e.HEAP16=m=new Int16Array(w),e.HEAP32=y=new Int32Array(w),e.HEAPU8=f=new Uint8Array(w),e.HEAPU16=g=new Uint16Array(w),e.HEAPU32=b=new Uint32Array(w),e.HEAPF32=v=new Float32Array(w),e.HEAPF64=A=new Float64Array(w);var I=[],W=[],_=[],T=0,N=null;function E(t){e.onAbort&&e.onAbort(t),l(t="Aborted("+t+")"),d=!0,t+=". Build with -sASSERTIONS for more info.";var r=new c.RuntimeError(t);throw n(r),r}var R,$,O="data:application/octet-stream;base64,";function F(e){return e.startsWith(O)}function D(e){try{if(e==R&&o)return new Uint8Array(o);var t=function(e){if(F(e))return function(e){try{for(var t=Ve(e),n=new Uint8Array(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}catch(a){throw new Error("Converting base64 string to bytes failed.")}}(e.slice(37))}(e);if(t)return t;throw"both async and sync fetching of the wasm failed"}catch(n){E(n)}}F(R="<<< WASM_BINARY_FILE >>>")||($=R,R=e.locateFile?e.locateFile($,i):i+$);var M={21220:function(t,n){var r=e.UTF8ToString(t,n);return new Function("return "+r)()}};function L(t){for(;t.length>0;)t.shift()(e)}function B(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var P=void 0;function z(e){for(var t="",n=e;f[n];)t+=P[f[n++]];return t}var G={},V={},U={};function H(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function j(e,t){return e=H(e),new Function("body","return function "+e+'() {\n    "use strict";    return body.apply(this, arguments);\n};\n')(t)}function q(e,t){var n=j(t,(function(e){this.name=t,this.message=e;var n=new Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))}));return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var Q=void 0;function X(e){throw new Q(e)}var Z=void 0;function K(e){throw new Z(e)}function J(e,t,n){function r(t){var r=n(t);r.length!==e.length&&K("Mismatched type converter count");for(var a=0;a<e.length;++a)Y(e[a],r[a])}e.forEach((function(e){U[e]=t}));var a=new Array(t.length),s=[],i=0;t.forEach((function(e,t){V.hasOwnProperty(e)?a[t]=V[e]:(s.push(e),G.hasOwnProperty(e)||(G[e]=[]),G[e].push((function(){a[t]=V[e],++i===s.length&&r(a)})))})),0===s.length&&r(a)}function Y(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var r=t.name;if(e||X('type "'+r+'" must have a positive integer typeid pointer'),V.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;X("Cannot register type '"+r+"' twice")}if(V[e]=t,delete U[e],G.hasOwnProperty(e)){var a=G[e];delete G[e],a.forEach((function(e){return e()}))}}function ee(e){X(e.$$.ptrType.registeredClass.name+" instance already deleted")}var te=!1;function ne(e){}function re(e){var t;e.count.value-=1,0===e.count.value&&((t=e).smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr))}function ae(e,t,n){if(t===n)return e;if(void 0===n.baseClass)return null;var r=ae(e,t,n.baseClass);return null===r?null:n.downcast(r)}var se={};var ie=[];function oe(){for(;ie.length;){var e=ie.pop();e.$$.deleteScheduled=!1,e.delete()}}var le=void 0;var ue={};function ce(e,t){return t.ptrType&&t.ptr||K("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&K("Both smartPtrType and smartPtr must be specified"),t.count={value:1},de(Object.create(e,{$$:{value:t}}))}function de(e){return"undefined"==typeof FinalizationRegistry?(de=function(e){return e},e):(te=new FinalizationRegistry((function(e){re(e.$$)})),ne=function(e){return te.unregister(e)},(de=function(e){var t=e.$$;if(t.smartPtr){var n={$$:t};te.register(e,n,e)}return e})(e))}function he(){}function pe(e,t,n){if(void 0===e[t].overloadTable){var r=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||X("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[r.argCount]=r}}function fe(e,t,n,r,a,s,i,o){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=r,this.baseClass=a,this.getActualType=s,this.upcast=i,this.downcast=o,this.pureVirtualFunctions=[]}function me(e,t,n){for(;t!==n;)t.upcast||X("Expected null or instance of "+n.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function ge(e,t){if(null===t)return this.isReference&&X("null is not a valid "+this.name),0;t.$$||X('Cannot pass "'+Re(t)+'" as a '+this.name),t.$$.ptr||X("Cannot pass deleted object as a pointer of type "+this.name);var n=t.$$.ptrType.registeredClass;return me(t.$$.ptr,n,this.registeredClass)}function ye(e,t){var n;if(null===t)return this.isReference&&X("null is not a valid "+this.name),this.isSmartPointer?(n=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,n),n):0;t.$$||X('Cannot pass "'+Re(t)+'" as a '+this.name),t.$$.ptr||X("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&X("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;if(n=me(t.$$.ptr,r,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&X("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:X("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var a=t.clone();n=this.rawShare(n,Ee.toHandle((function(){a.delete()}))),null!==e&&e.push(this.rawDestructor,n)}break;default:X("Unsupporting sharing policy")}return n}function be(e,t){if(null===t)return this.isReference&&X("null is not a valid "+this.name),0;t.$$||X('Cannot pass "'+Re(t)+'" as a '+this.name),t.$$.ptr||X("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&X("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;return me(t.$$.ptr,n,this.registeredClass)}function ve(e){return this.fromWireType(y[e>>2])}function Ae(e,t,n,r,a,s,i,o,l,u,c){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=r,this.isSmartPointer=a,this.pointeeType=s,this.sharingPolicy=i,this.rawGetPointee=o,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,a||void 0!==t.baseClass?this.toWireType=ye:r?(this.toWireType=ge,this.destructorFunction=null):(this.toWireType=be,this.destructorFunction=null)}function xe(e){return S.get(e)}function ke(t,n){var r,a,s,i=(t=z(t)).includes("j")?(r=t,a=n,s=[],function(){return s.length=0,Object.assign(s,arguments),function(t,n,r){return t.includes("j")?(a=n,s=r,i=e["dynCall_"+t],s&&s.length?i.apply(null,[a].concat(s)):i.call(null,a)):xe(n).apply(null,r);var a,s,i}(r,a,s)}):xe(n);return"function"!=typeof i&&X("unknown function pointer with signature "+t+": "+n),i}var we=void 0;function Se(e){var t=qe(e),n=z(t);return Qe(t),n}function Ce(e,t){var n=[],r={};throw t.forEach((function e(t){r[t]||V[t]||(U[t]?U[t].forEach(e):(n.push(t),r[t]=!0))})),new we(e+": "+n.map(Se).join([", "]))}function Ie(e,t){for(var n=[],r=0;r<e;r++)n.push(b[t+4*r>>2]);return n}function We(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function _e(e,t,n,r,s){var i=t.length;i<2&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==n,l=!1,u=1;u<t.length;++u)if(null!==t[u]&&void 0===t[u].destructorFunction){l=!0;break}var c="void"!==t[0].name,d="",h="";for(u=0;u<i-2;++u)d+=(0!==u?", ":"")+"arg"+u,h+=(0!==u?", ":"")+"arg"+u+"Wired";var p="return function "+H(e)+"("+d+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+e+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";l&&(p+="var destructors = [];\n");var f=l?"destructors":"null",m=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],g=[X,r,s,We,t[0],t[1]];for(o&&(p+="var thisWired = classParam.toWireType("+f+", this);\n"),u=0;u<i-2;++u)p+="var arg"+u+"Wired = argType"+u+".toWireType("+f+", arg"+u+"); // "+t[u+2].name+"\n",m.push("argType"+u),g.push(t[u+2]);if(o&&(h="thisWired"+(h.length>0?", ":"")+h),p+=(c?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",l)p+="runDestructors(destructors);\n";else for(u=o?1:2;u<t.length;++u){var y=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==t[u].destructorFunction&&(p+=y+"_dtor("+y+"); // "+t[u].name+"\n",m.push(y+"_dtor"),g.push(t[u].destructorFunction))}return c&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),p+="}\n",m.push(p),function(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+a(e)+" which is not a function");var n=j(e.name||"unknownFunctionName",(function(){}));n.prototype=e.prototype;var r=new n,s=e.apply(r,t);return s instanceof Object?s:r}(Function,m).apply(null,g)}var Te=[],Ne=[{},{value:void 0},{value:null},{value:!0},{value:!1}];var Ee={toValue:function(e){return e||X("Cannot use deleted val. handle = "+e),Ne[e].value},toHandle:function(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=Te.length?Te.pop():Ne.length;return Ne[t]={refcount:1,value:e},t}}};function Re(e){if(null===e)return"null";var t=a(e);return"object"===t||"array"===t||"function"===t?e.toString():""+e}function $e(e,t){switch(t){case 2:return function(e){return this.fromWireType(v[e>>2])};case 3:return function(e){return this.fromWireType(A[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Oe(e,t,n){switch(t){case 0:return n?function(e){return p[e]}:function(e){return f[e]};case 1:return n?function(e){return m[e>>1]}:function(e){return g[e>>1]};case 2:return n?function(e){return y[e>>2]}:function(e){return b[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var Fe="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function De(e,t){for(var n=e,r=n>>1,a=r+t/2;!(r>=a)&&g[r];)++r;if((n=r<<1)-e>32&&Fe)return Fe.decode(f.subarray(e,n));for(var s="",i=0;!(i>=t/2);++i){var o=m[e+2*i>>1];if(0==o)break;s+=String.fromCharCode(o)}return s}function Me(e,t,n){if(void 0===n&&(n=2147483647),n<2)return 0;for(var r=t,a=(n-=2)<2*e.length?n/2:e.length,s=0;s<a;++s){var i=e.charCodeAt(s);m[t>>1]=i,t+=2}return m[t>>1]=0,t-r}function Le(e){return 2*e.length}function Be(e,t){for(var n=0,r="";!(n>=t/4);){var a=y[e+4*n>>2];if(0==a)break;if(++n,a>=65536){var s=a-65536;r+=String.fromCharCode(55296|s>>10,56320|1023&s)}else r+=String.fromCharCode(a)}return r}function Pe(e,t,n){if(void 0===n&&(n=2147483647),n<4)return 0;for(var r=t,a=r+n-4,s=0;s<e.length;++s){var i=e.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),y[t>>2]=i,(t+=4)+4>a)break}return y[t>>2]=0,t-r}function ze(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&++n,t+=4}return t}var Ge=[];!function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);P=e}(),Q=e.BindingError=q(Error,"BindingError"),Z=e.InternalError=q(Error,"InternalError"),he.prototype.isAliasOf=function(e){if(!(this instanceof he))return!1;if(!(e instanceof he))return!1;for(var t=this.$$.ptrType.registeredClass,n=this.$$.ptr,r=e.$$.ptrType.registeredClass,a=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;r.baseClass;)a=r.upcast(a),r=r.baseClass;return t===r&&n===a},he.prototype.clone=function(){if(this.$$.ptr||ee(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=de(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},he.prototype.delete=function(){this.$$.ptr||ee(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),ne(this),re(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},he.prototype.isDeleted=function(){return!this.$$.ptr},he.prototype.deleteLater=function(){return this.$$.ptr||ee(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),ie.push(this),1===ie.length&&le&&le(oe),this.$$.deleteScheduled=!0,this},e.getInheritedInstanceCount=function(){return Object.keys(ue).length},e.getLiveInheritedInstances=function(){var e=[];for(var t in ue)ue.hasOwnProperty(t)&&e.push(ue[t]);return e},e.flushPendingDeletes=oe,e.setDelayFunction=function(e){le=e,ie.length&&le&&le(oe)},Ae.prototype.getPointee=function(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},Ae.prototype.destructor=function(e){this.rawDestructor&&this.rawDestructor(e)},Ae.prototype.argPackAdvance=8,Ae.prototype.readValueFromPointer=ve,Ae.prototype.deleteObject=function(e){null!==e&&e.delete()},Ae.prototype.fromWireType=function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=function(e,t){return t=function(e,t){for(void 0===t&&X("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),ue[t]}(this.registeredClass,t);if(void 0!==n){if(0===n.$$.count.value)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var r=n.clone();return this.destructor(e),r}function a(){return this.isSmartPointer?ce(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ce(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,i=this.registeredClass.getActualType(t),o=se[i];if(!o)return a.call(this);s=this.isConst?o.constPointerType:o.pointerType;var l=ae(t,this.registeredClass,s.registeredClass);return null===l?a.call(this):this.isSmartPointer?ce(s.registeredClass.instancePrototype,{ptrType:s,ptr:l,smartPtrType:this,smartPtr:e}):ce(s.registeredClass.instancePrototype,{ptrType:s,ptr:l})},we=e.UnboundTypeError=q(Error,"UnboundTypeError"),e.count_emval_handles=function(){for(var e=0,t=5;t<Ne.length;++t)void 0!==Ne[t]&&++e;return e},e.get_first_emval=function(){for(var e=5;e<Ne.length;++e)if(void 0!==Ne[e])return Ne[e];return null};var Ve="function"==typeof atob?atob:function(e){var t,n,r,a,s,i,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",u=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=o.indexOf(e.charAt(u++))<<2|(a=o.indexOf(e.charAt(u++)))>>4,n=(15&a)<<4|(s=o.indexOf(e.charAt(u++)))>>2,r=(3&s)<<6|(i=o.indexOf(e.charAt(u++))),l+=String.fromCharCode(t),64!==s&&(l+=String.fromCharCode(n)),64!==i&&(l+=String.fromCharCode(r))}while(u<e.length);return l};var Ue,He={b:function(e,t,n,r){E("Assertion failed: "+k(e)+", at: "+[t?k(t):"unknown filename",n,r?k(r):"unknown function"])},n:function(e,t,n,r,a){},k:function(e,t,n,r,a){var s=B(n);Y(e,{name:t=z(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:a},argPackAdvance:8,readValueFromPointer:function(e){var r;if(1===n)r=p;else if(2===n)r=m;else{if(4!==n)throw new TypeError("Unknown boolean type size: "+t);r=y}return this.fromWireType(r[e>>s])},destructorFunction:null})},q:function(t,n,r,a,s,i,o,l,u,c,d,h,p){d=z(d),i=ke(s,i),l&&(l=ke(o,l)),c&&(c=ke(u,c)),p=ke(h,p);var f,m,g,y=H(d);f=y,m=function(){Ce("Cannot construct "+d+" due to unbound types",[a])},e.hasOwnProperty(f)?(X("Cannot register public name '"+f+"' twice"),pe(e,f,f),e.hasOwnProperty(g)&&X("Cannot register multiple overloads of a function with the same number of arguments ("+g+")!"),e[f].overloadTable[g]=m):e[f]=m,J([t,n,r],a?[a]:[],(function(n){var r,s;n=n[0],s=a?(r=n.registeredClass).instancePrototype:he.prototype;var o=j(y,(function(){if(Object.getPrototypeOf(this)!==u)throw new Q("Use 'new' to construct "+d);if(void 0===h.constructor_body)throw new Q(d+" has no accessible constructor");var e=h.constructor_body[arguments.length];if(void 0===e)throw new Q("Tried to invoke ctor of "+d+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(h.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),u=Object.create(s,{constructor:{value:o}});o.prototype=u;var h=new fe(d,o,u,p,r,i,l,c),f=new Ae(d,h,!0,!1,!1),m=new Ae(d+"*",h,!1,!1,!1),g=new Ae(d+" const*",h,!1,!0,!1);return se[t]={pointerType:m,constPointerType:g},function(t,n,r){e.hasOwnProperty(t)||K("Replacing nonexistant public symbol"),e[t].overloadTable,e[t]=n,e[t].argCount=r}(y,o),[f,m,g]}))},p:function(e,t,n,r,a,s){!function(e,t){e||E(t)}(t>0);var i=Ie(t,n);a=ke(r,a),J([],[e],(function(e){var n="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Q("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=function(){Ce("Cannot construct "+e.name+" due to unbound types",i)},J([],i,(function(r){return r.splice(1,0,null),e.registeredClass.constructor_body[t-1]=_e(n,r,null,a,s),[]})),[]}))},f:function(e,t,n,r,a,s,i,o){var l=Ie(n,r);t=z(t),s=ke(a,s),J([],[e],(function(e){var r=(e=e[0]).name+"."+t;function a(){Ce("Cannot call "+r+" due to unbound types",l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,c=u[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===n-2?(a.argCount=n-2,a.className=e.name,u[t]=a):(pe(u,t,r),u[t].overloadTable[n-2]=a),J([],l,(function(a){var o=_e(r,a,e,s,i);return void 0===u[t].overloadTable?(o.argCount=n-2,u[t]=o):u[t].overloadTable[n-2]=o,[]})),[]}))},o:function(e,t){Y(e,{name:t=z(t),fromWireType:function(e){var t,n=Ee.toValue(e);return(t=e)>4&&0==--Ne[t].refcount&&(Ne[t]=void 0,Te.push(t)),n},toWireType:function(e,t){return Ee.toHandle(t)},argPackAdvance:8,readValueFromPointer:ve,destructorFunction:null})},j:function(e,t,n){var r=B(n);Y(e,{name:t=z(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:$e(t,r),destructorFunction:null})},d:function(e,t,n,r,a){t=z(t);var s=B(n),i=function(e){return e};if(0===r){var o=32-8*n;i=function(e){return e<<o>>>o}}var l=t.includes("unsigned");Y(e,{name:t,fromWireType:i,toWireType:l?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Oe(t,s,0!==r),destructorFunction:null})},c:function(e,t,n){var r=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function a(e){var t=b,n=t[e>>=2],a=t[e+1];return new r(h,a,n)}Y(e,{name:n=z(n),fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},h:function(e,t){var n="std::string"===(t=z(t));Y(e,{name:t,fromWireType:function(e){var t,r=b[e>>2],a=e+4;if(n)for(var s=a,i=0;i<=r;++i){var o=a+i;if(i==r||0==f[o]){var l=k(s,o-s);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),s=o+1}}else{var u=new Array(r);for(i=0;i<r;++i)u[i]=String.fromCharCode(f[a+i]);t=u.join("")}return Qe(e),t},toWireType:function(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var a="string"==typeof t;a||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||X("Cannot pass non-string to std::string"),r=n&&a?function(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t}(t):t.length;var s=je(4+r+1),i=s+4;if(b[s>>2]=r,n&&a)!function(e,t,n,r){if(!(r>0))return 0;for(var a=n+r-1,s=0;s<e.length;++s){var i=e.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),i<=127){if(n>=a)break;t[n++]=i}else if(i<=2047){if(n+1>=a)break;t[n++]=192|i>>6,t[n++]=128|63&i}else if(i<=65535){if(n+2>=a)break;t[n++]=224|i>>12,t[n++]=128|i>>6&63,t[n++]=128|63&i}else{if(n+3>=a)break;t[n++]=240|i>>18,t[n++]=128|i>>12&63,t[n++]=128|i>>6&63,t[n++]=128|63&i}}t[n]=0}(t,f,i,r+1);else if(a)for(var o=0;o<r;++o){var l=t.charCodeAt(o);l>255&&(Qe(i),X("String has UTF-16 code units that do not fit in 8 bits")),f[i+o]=l}else for(o=0;o<r;++o)f[i+o]=t[o];return null!==e&&e.push(Qe,s),s},argPackAdvance:8,readValueFromPointer:ve,destructorFunction:function(e){Qe(e)}})},e:function(e,t,n){var r,a,s,i,o;n=z(n),2===t?(r=De,a=Me,i=Le,s=function(){return g},o=1):4===t&&(r=Be,a=Pe,i=ze,s=function(){return b},o=2),Y(e,{name:n,fromWireType:function(e){for(var n,a=b[e>>2],i=s(),l=e+4,u=0;u<=a;++u){var c=e+4+u*t;if(u==a||0==i[c>>o]){var d=r(l,c-l);void 0===n?n=d:(n+=String.fromCharCode(0),n+=d),l=c+t}}return Qe(e),n},toWireType:function(e,r){"string"!=typeof r&&X("Cannot pass non-string to C++ string type "+n);var s=i(r),l=je(4+s+t);return b[l>>2]=s>>o,a(r,l+4,s+t),null!==e&&e.push(Qe,l),l},argPackAdvance:8,readValueFromPointer:ve,destructorFunction:function(e){Qe(e)}})},l:function(e,t){Y(e,{isVoid:!0,name:t=z(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},i:function(){E("")},m:function(e,t,n){var r=function(e,t){var n;for(Ge.length=0,t>>=2;n=f[e++];)t+=105!=n&t,Ge.push(105==n?y[t]:A[t++>>1]),++t;return Ge}(t,n);return M[e].apply(null,r)},g:function(e){f.length,E("OOM")},a:u},je=(function(){var t={a:He};function r(t,n){var r,a=t.exports;e.asm=a,S=e.asm.w,r=e.asm.r,W.unshift(r),function(){if(T--,e.monitorRunDependencies&&e.monitorRunDependencies(T),0==T&&N){var t=N;N=null,t()}}()}function a(e){r(e.instance)}function s(e){return(o||"function"!=typeof fetch?Promise.resolve().then((function(){return D(R)})):fetch(R,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+R+"'";return e.arrayBuffer()})).catch((function(){return D(R)}))).then((function(e){return c.instantiate(e,t)})).then((function(e){return e})).then(e,(function(e){l("failed to asynchronously prepare wasm: "+e),E(e)}))}if(T++,e.monitorRunDependencies&&e.monitorRunDependencies(T),e.instantiateWasm)try{return e.instantiateWasm(t,r)}catch(i){l("Module.instantiateWasm callback failed with error: "+i),n(i)}(o||"function"!=typeof c.instantiateStreaming||F(R)||"function"!=typeof fetch?s(a):fetch(R,{credentials:"same-origin"}).then((function(e){return c.instantiateStreaming(e,t).then(a,(function(e){return l("wasm streaming compile failed: "+e),l("falling back to ArrayBuffer instantiation"),s(a)}))}))).catch(n)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.r).apply(null,arguments)},e._malloc=function(){return(je=e._malloc=e.asm.s).apply(null,arguments)}),qe=e.___getTypeName=function(){return(qe=e.___getTypeName=e.asm.t).apply(null,arguments)},Qe=(e.__embind_initialize_bindings=function(){return(e.__embind_initialize_bindings=e.asm.u).apply(null,arguments)},e._free=function(){return(Qe=e._free=e.asm.v).apply(null,arguments)});function Xe(n){function r(){Ue||(Ue=!0,e.calledRun=!0,d||(L(W),t(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),_.unshift(t);var t;L(_)}()))}T>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),I.unshift(t);var t;L(I)}(),T>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),r()}),1)):r()))}if(e.UTF8ToString=k,N=function e(){Ue||Xe(),Ue||(N=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return Xe(),e.ready});"object"===a(t)&&"object"===a(e)?e.exports=i:void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)},365:function(e,t,n){var r;!function(){function a(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function s(e,t,n,r,s,i){return a((o=a(a(t,e),a(r,i)))<<(l=s)|o>>>32-l,n);var o,l}function i(e,t,n,r,a,i,o){return s(t&n|~t&r,e,t,a,i,o)}function o(e,t,n,r,a,i,o){return s(t&r|n&~r,e,t,a,i,o)}function l(e,t,n,r,a,i,o){return s(t^n^r,e,t,a,i,o)}function u(e,t,n,r,a,i,o){return s(n^(t|~r),e,t,a,i,o)}function c(e,t){var n,r,s,c,d;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,p=-271733879,f=-1732584194,m=271733878;for(n=0;n<e.length;n+=16)r=h,s=p,c=f,d=m,h=i(h,p,f,m,e[n],7,-680876936),m=i(m,h,p,f,e[n+1],12,-389564586),f=i(f,m,h,p,e[n+2],17,606105819),p=i(p,f,m,h,e[n+3],22,-1044525330),h=i(h,p,f,m,e[n+4],7,-176418897),m=i(m,h,p,f,e[n+5],12,1200080426),f=i(f,m,h,p,e[n+6],17,-1473231341),p=i(p,f,m,h,e[n+7],22,-45705983),h=i(h,p,f,m,e[n+8],7,1770035416),m=i(m,h,p,f,e[n+9],12,-1958414417),f=i(f,m,h,p,e[n+10],17,-42063),p=i(p,f,m,h,e[n+11],22,-1990404162),h=i(h,p,f,m,e[n+12],7,1804603682),m=i(m,h,p,f,e[n+13],12,-40341101),f=i(f,m,h,p,e[n+14],17,-1502002290),h=o(h,p=i(p,f,m,h,e[n+15],22,1236535329),f,m,e[n+1],5,-165796510),m=o(m,h,p,f,e[n+6],9,-1069501632),f=o(f,m,h,p,e[n+11],14,643717713),p=o(p,f,m,h,e[n],20,-373897302),h=o(h,p,f,m,e[n+5],5,-701558691),m=o(m,h,p,f,e[n+10],9,38016083),f=o(f,m,h,p,e[n+15],14,-660478335),p=o(p,f,m,h,e[n+4],20,-405537848),h=o(h,p,f,m,e[n+9],5,568446438),m=o(m,h,p,f,e[n+14],9,-1019803690),f=o(f,m,h,p,e[n+3],14,-187363961),p=o(p,f,m,h,e[n+8],20,1163531501),h=o(h,p,f,m,e[n+13],5,-1444681467),m=o(m,h,p,f,e[n+2],9,-51403784),f=o(f,m,h,p,e[n+7],14,1735328473),h=l(h,p=o(p,f,m,h,e[n+12],20,-1926607734),f,m,e[n+5],4,-378558),m=l(m,h,p,f,e[n+8],11,-2022574463),f=l(f,m,h,p,e[n+11],16,1839030562),p=l(p,f,m,h,e[n+14],23,-35309556),h=l(h,p,f,m,e[n+1],4,-1530992060),m=l(m,h,p,f,e[n+4],11,1272893353),f=l(f,m,h,p,e[n+7],16,-155497632),p=l(p,f,m,h,e[n+10],23,-1094730640),h=l(h,p,f,m,e[n+13],4,681279174),m=l(m,h,p,f,e[n],11,-358537222),f=l(f,m,h,p,e[n+3],16,-722521979),p=l(p,f,m,h,e[n+6],23,76029189),h=l(h,p,f,m,e[n+9],4,-640364487),m=l(m,h,p,f,e[n+12],11,-421815835),f=l(f,m,h,p,e[n+15],16,530742520),h=u(h,p=l(p,f,m,h,e[n+2],23,-995338651),f,m,e[n],6,-198630844),m=u(m,h,p,f,e[n+7],10,1126891415),f=u(f,m,h,p,e[n+14],15,-1416354905),p=u(p,f,m,h,e[n+5],21,-57434055),h=u(h,p,f,m,e[n+12],6,1700485571),m=u(m,h,p,f,e[n+3],10,-1894986606),f=u(f,m,h,p,e[n+10],15,-1051523),p=u(p,f,m,h,e[n+1],21,-2054922799),h=u(h,p,f,m,e[n+8],6,1873313359),m=u(m,h,p,f,e[n+15],10,-30611744),f=u(f,m,h,p,e[n+6],15,-1560198380),p=u(p,f,m,h,e[n+13],21,1309151649),h=u(h,p,f,m,e[n+4],6,-145523070),m=u(m,h,p,f,e[n+11],10,-1120210379),f=u(f,m,h,p,e[n+2],15,718787259),p=u(p,f,m,h,e[n+9],21,-343485551),h=a(h,r),p=a(p,s),f=a(f,c),m=a(m,d);return[h,p,f,m]}function d(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function h(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function p(e){var t,n,r="0123456789abcdef",a="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),a+=r.charAt(t>>>4&15)+r.charAt(15&t);return a}function f(e){return unescape(encodeURIComponent(e))}function m(e){return d(c(h(t=f(e)),8*t.length));var t}function g(e,t){return function(e,t){var n,r,a=h(e),s=[],i=[];for(s[15]=i[15]=void 0,a.length>16&&(a=c(a,8*e.length)),n=0;n<16;n+=1)s[n]=909522486^a[n],i[n]=1549556828^a[n];return r=c(s.concat(h(t)),512+8*t.length),d(c(i.concat(r),640))}(f(e),f(t))}function y(e,t,n){return t?n?g(t,e):p(g(t,e)):n?m(e):p(m(e))}void 0===(r=function(){return y}.call(t,n,t,e))||(e.exports=r)}()}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var s=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},function(){var e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";function t(){for(var t="",n=0;n<5;n++)t+=e[Math.floor(62*Math.random())];return t}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(){a=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},i=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(_){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var a,s,i,o,l=t&&t.prototype instanceof p?t:p,u=Object.create(l.prototype),c=new C(r||[]);return u._invoke=(a=e,s=n,i=c,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(i.method=e,i.arg=t;;){var n=i.delegate;if(n){var r=k(n,i);if(r){if(r===h)continue;return r}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===o)throw o="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o="executing";var l=d(a,s,i);if("normal"===l.type){if(o=i.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(o="completed",i.method="throw",i.arg=l.arg)}}),u}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}e.wrap=c;var h={};function p(){}function f(){}function m(){}var g={};u(g,i,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(I([])));b&&b!==t&&n.call(b,i)&&(g=b);var v=m.prototype=p.prototype=Object.create(g);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function a(s,i,o,l){var u=d(e[s],e,i);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==r(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){a("next",e,o,l)}),(function(e){a("throw",e,o,l)})):t.resolve(h).then((function(e){c.value=e,o(c)}),(function(e){return a("throw",e,o,l)}))}l(u.arg)}var s;this._invoke=function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return s=s?s.then(r,r):r()}}function k(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=d(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,h;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function I(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:W}}function W(){return{value:void 0,done:!0}}return f.prototype=m,u(v,"constructor",m),u(m,"constructor",f),f.displayName=u(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,l,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},A(x.prototype),u(x.prototype,o,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,a,s){void 0===s&&(s=Promise);var i=new x(c(t,n,r,a),s);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},A(v),u(v,l,"Generator"),u(v,i,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=I,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var o=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;S(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function s(e,t,n,r,a,s,i){try{var o=e[s](i),l=o.value}catch(u){return void n(u)}o.done?t(l):Promise.resolve(l).then(r,a)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){s(i,r,a,o,l,"next",e)}function l(e){s(i,r,a,o,l,"throw",e)}o(void 0)}))}}var o=n(297),l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sig=void 0,this.waitPromise=void 0}var n,r,s,l,u,c,d,h;return n=e,r=[{key:"getSig",value:(h=i(a().mark((function e(){var t=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===this.waitPromise&&(this.waitPromise=o().then((function(e){t.sig=new e.SigGenBrowser}))),e.next=3,this.waitPromise;case 3:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"calRaw",value:(d=i(a().mark((function e(n,r,s){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSig();case 2:return e.abrupt("return",this.sig.sigcc_get_hash("".concat(n,"&").concat(r,"&").concat(s),t()));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"cal",value:(c=i(a().mark((function e(n,r,s,i){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSig();case 2:return e.abrupt("return",this.sig.sigcc_get_hash("x-app-id=".concat(n,"&timestamp=").concat(r,"&url=").concat(s,"&client-id=").concat(i),t()));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return c.apply(this,arguments)})},{key:"getAppId",value:(u=i(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSig();case 2:return e.abrupt("return",this.sig.get_app_id());case 3:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"checkSignature",value:(l=i(a().mark((function e(t,n,r,s){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSig();case 2:return e.abrupt("return",this.sig.check_signature("".concat(t,"&").concat(n,"&").concat(r),s));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return l.apply(this,arguments)})},{key:"checkSignatureLow",value:(s=i(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSig();case 2:return e.abrupt("return",this.sig.check_signature(t,n));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})}],r&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),e}();function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(){c=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(_){o=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var a,s,i,o,l=t&&t.prototype instanceof p?t:p,u=Object.create(l.prototype),c=new C(r||[]);return u._invoke=(a=e,s=n,i=c,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(i.method=e,i.arg=t;;){var n=i.delegate;if(n){var r=k(n,i);if(r){if(r===h)continue;return r}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===o)throw o="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o="executing";var l=d(a,s,i);if("normal"===l.type){if(o=i.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(o="completed",i.method="throw",i.arg=l.arg)}}),u}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}e.wrap=l;var h={};function p(){}function f(){}function m(){}var g={};o(g,a,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(I([])));b&&b!==t&&n.call(b,a)&&(g=b);var v=m.prototype=p.prototype=Object.create(g);function A(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(a,s,i,o){var l=d(e[a],e,s);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==u(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,i,o)}),(function(e){r("throw",e,i,o)})):t.resolve(h).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,o)}))}o(l.arg)}var a;this._invoke=function(e,n){function s(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(s,s):s()}}function k(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=d(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,h;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return s.next=s}}return{next:W}}function W(){return{value:void 0,done:!0}}return f.prototype=m,o(v,"constructor",m),o(m,"constructor",f),f.displayName=o(m,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,o(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},A(x.prototype),o(x.prototype,s,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,a,s){void 0===s&&(s=Promise);var i=new x(l(t,n,r,a),s);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},A(v),o(v,i,"Generator"),o(v,a,(function(){return this})),o(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=I,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var o=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;S(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function d(e,t,n,r,a,s,i){try{var o=e[s](i),l=o.value}catch(u){return void n(u)}o.done?t(l):Promise.resolve(l).then(r,a)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var s=e.apply(t,n);function i(e){d(s,r,a,i,o,"next",e)}function o(e){d(s,r,a,i,o,"throw",e)}i(void 0)}))}}var p=0,f="a_fjeqhrkj23nrk",m="as_fjeqhrkj23nrk";function g(e){return y.apply(this,arguments)}function y(){return(y=h(c().mark((function e(t){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new XMLHttpRequest).open("GET",t),n.send(),e.abrupt("return",new Promise((function(e,t){n.onreadystatechange=function(){4===n.readyState&&(200===n.status?e(n.responseText):t(n))}})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return(b=h(c().mark((function e(t){var n,r,a,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=localStorage.getItem(f),r=parseInt(n,10),a=localStorage.getItem(m),e.next=6,t.checkSignature(n,0,"/",a);case 6:s=e.sent,r&&s&&(p=r),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(0);case 12:case"end":return e.stop()}}),e,null,[[0,10]])})))).apply(this,arguments)}function v(e,t){return A.apply(this,arguments)}function A(){return(A=h(c().mark((function e(n,r){var a,s,i,o,l,u,d,h,y,b;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getAppId();case 2:return a=e.sent,s=t(),i=Date.now(),o="".concat(n,"?app=").concat(a,"&t0=").concat(i,"&nonce=").concat(s),e.next=8,g(o);case 8:if(l=e.sent,u=Date.now(),!(d=JSON.parse(l)).signature||d.nonce!==s){e.next=25;break}return h=Number(d.timestamp),e.next=15,r.checkSignatureLow("app=".concat(a,"&t0=").concat(i,"&t1=").concat(h),s+d.signature);case 15:if(!e.sent){e.next=24;break}return y=Math.floor(h-((u-i)/2+i)),localStorage.setItem(f,y.toString()),e.next=21,r.calRaw(p.toString(),0,"/");case 21:b=e.sent,localStorage.setItem(m,b),p=y;case 24:return e.abrupt("return",p);case 25:return e.abrupt("return",0);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var x=n(365),k=n.n(x),w=!1,S=k()(Math.random().toString());function C(e){try{var t="a_vndfsigb2jhqgrjvfhjreg",n="a_fkjerwhgkjhrewktjreterwt",r=localStorage.getItem(t),a=localStorage.getItem(n);if(r&&a&&e.checkSignature(r,0,"/",a))return r;w||(w=!0,r=k()("unknown:unknown"),a=e.calRaw(r,0,"/"),localStorage.setItem(t,r),localStorage.setItem(n,a))}catch(s){}return S}var I=new l,W=function(e){return b.apply(this,arguments)}(I);function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function T(){T=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(I){o=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var a,s,i,o,l=t&&t.prototype instanceof d?t:d,h=Object.create(l.prototype),p=new w(r||[]);return h._invoke=(a=e,s=n,i=p,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(i.method=e,i.arg=t;;){var n=i.delegate;if(n){var r=A(n,i);if(r){if(r===c)continue;return r}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===o)throw o="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o="executing";var l=u(a,s,i);if("normal"===l.type){if(o=i.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(o="completed",i.method="throw",i.arg=l.arg)}}),h}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}e.wrap=l;var c={};function d(){}function h(){}function p(){}var f={};o(f,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(S([])));g&&g!==t&&n.call(g,a)&&(f=g);var y=p.prototype=d.prototype=Object.create(f);function b(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){function r(a,s,i,o){var l=u(e[a],e,s);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==_(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,o)}),(function(e){r("throw",e,i,o)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,o)}))}o(l.arg)}var a;this._invoke=function(e,n){function s(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(s,s):s()}}function A(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,A(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return s.next=s}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=p,o(y,"constructor",p),o(p,"constructor",h),h.displayName=o(p,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,o(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(v.prototype),o(v.prototype,s,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,r,a,s){void 0===s&&(s=Promise);var i=new v(l(t,n,r,a),s);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),o(y,i,"Generator"),o(y,a,(function(){return this})),o(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=S,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var o=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function N(e,t,n,r,a,s,i){try{var o=e[s](i),l=o.value}catch(u){return void n(u)}o.done?t(l):Promise.resolve(l).then(r,a)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var s=e.apply(t,n);function i(e){N(s,r,a,i,o,"next",e)}function o(e){N(s,r,a,i,o,"throw",e)}i(void 0)}))}}var R;function $(){return($=E(T().mark((function e(t){var n,r,a,s;return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,W;case 2:return e.next=4,I.getAppId();case 4:return n=e.sent,r=Date.now()+p,e.next=8,C(I);case 8:return a=e.sent,e.next=11,I.cal(n,r,t,a);case 11:return s=e.sent,e.abrupt("return",["a="+n,"b="+r,"d="+a,"e="+encodeURIComponent(s)].join("&"));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}window._SHEIN_CALC_SIGNATURE_=function(e){return $.apply(this,arguments)},window._SHEIN_SYNC_TIMESTAMP_=(R=E(T().mark((function e(t){return T().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,W;case 2:return e.abrupt("return",v(t,I));case 3:case"end":return e.stop()}}),e)}))),function(e){return R.apply(this,arguments)})}()}(),mQ=self,gQ=function(){return function(){var e={200:function(e,t,n){var r;e.exports=(r=n(403),n(315),n(378),n(365),n(534),function(){var e=r,t=e.lib.BlockCipher,n=e.algo,a=[],s=[],i=[],o=[],l=[],u=[],c=[],d=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var f=r^r<<1^r<<2^r<<3^r<<4;f=f>>>8^255&f^99,a[n]=f,s[f]=n;var m=e[n],g=e[m],y=e[g],b=257*e[f]^16843008*f;i[n]=b<<24|b>>>8,o[n]=b<<16|b>>>16,l[n]=b<<8|b>>>24,u[n]=b,b=16843009*y^65537*g^257*m^16843008*n,c[f]=b<<24|b>>>8,d[f]=b<<16|b>>>16,h[f]=b<<8|b>>>24,p[f]=b,n?(n=m^e[e[e[y^m]]],r^=e[e[r]]):n=r=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),s=this._keySchedule=[],i=0;i<r;i++)i<n?s[i]=t[i]:(u=s[i-1],i%n?n>6&&i%n==4&&(u=a[u>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u]):(u=a[(u=u<<8|u>>>24)>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u],u^=f[i/n|0]<<24),s[i]=s[i-n]^u);for(var o=this._invKeySchedule=[],l=0;l<r;l++){if(i=r-l,l%4)var u=s[i];else u=s[i-4];o[l]=l<4||i<=4?u:c[a[u>>>24]]^d[a[u>>>16&255]]^h[a[u>>>8&255]]^p[a[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,o,l,u,a)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,c,d,h,p,s),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,a,s,i,o){for(var l=this._nRounds,u=e[t]^n[0],c=e[t+1]^n[1],d=e[t+2]^n[2],h=e[t+3]^n[3],p=4,f=1;f<l;f++){var m=r[u>>>24]^a[c>>>16&255]^s[d>>>8&255]^i[255&h]^n[p++],g=r[c>>>24]^a[d>>>16&255]^s[h>>>8&255]^i[255&u]^n[p++],y=r[d>>>24]^a[h>>>16&255]^s[u>>>8&255]^i[255&c]^n[p++],b=r[h>>>24]^a[u>>>16&255]^s[c>>>8&255]^i[255&d]^n[p++];u=m,c=g,d=y,h=b}m=(o[u>>>24]<<24|o[c>>>16&255]<<16|o[d>>>8&255]<<8|o[255&h])^n[p++],g=(o[c>>>24]<<24|o[d>>>16&255]<<16|o[h>>>8&255]<<8|o[255&u])^n[p++],y=(o[d>>>24]<<24|o[h>>>16&255]<<16|o[u>>>8&255]<<8|o[255&c])^n[p++],b=(o[h>>>24]<<24|o[u>>>16&255]<<16|o[c>>>8&255]<<8|o[255&d])^n[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=b},keySize:8});e.AES=t._createHelper(m)}(),r.AES)},534:function(e,t,n){var r,a,s,i,o,l,u,c,d,h,p,f,m,g,y,b,v,A,x;e.exports=(x=n(403),n(365),void(x.lib.Cipher||(r=x,a=r.lib,s=a.Base,i=a.WordArray,o=a.BufferedBlockAlgorithm,l=r.enc,l.Utf8,u=l.Base64,c=r.algo.EvpKDF,d=a.Cipher=o.extend({cfg:s.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?A:b}return function(t){return{encrypt:function(n,r,a){return e(r).encrypt(t,n,r,a)},decrypt:function(n,r,a){return e(r).decrypt(t,n,r,a)}}}}()}),a.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),h=r.mode={},p=a.BlockCipherMode=s.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=h.CBC=function(){var e=p.extend();function t(e,t,n){var r,a=this._iv;a?(r=a,this._iv=void 0):r=this._prevBlock;for(var s=0;s<n;s++)e[t+s]^=r[s]}return e.Encryptor=e.extend({processBlock:function(e,n){var r=this._cipher,a=r.blockSize;t.call(this,e,n,a),r.encryptBlock(e,n),this._prevBlock=e.slice(n,n+a)}}),e.Decryptor=e.extend({processBlock:function(e,n){var r=this._cipher,a=r.blockSize,s=e.slice(n,n+a);r.decryptBlock(e,n),t.call(this,e,n,a),this._prevBlock=s}}),e}(),m=(r.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,r=n-e.sigBytes%n,a=r<<24|r<<16|r<<8|r,s=[],o=0;o<r;o+=4)s.push(a);var l=i.create(s,r);e.concat(l)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},a.BlockCipher=d.extend({cfg:d.cfg.extend({mode:f,padding:m}),reset:function(){var e;d.reset.call(this);var t=this.cfg,n=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(r,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),g=a.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?i.create([1398893684,1701076831]).concat(n).concat(t):t).toString(u)},parse:function(e){var t,n=u.parse(e),r=n.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=i.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),g.create({ciphertext:n,salt:t})}},b=a.SerializableCipher=s.extend({cfg:s.extend({format:y}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var a=e.createEncryptor(n,r),s=a.finalize(t),i=a.cfg;return g.create({ciphertext:s,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),v=(r.kdf={}).OpenSSL={execute:function(e,t,n,r,a){if(r||(r=i.random(8)),a)s=c.create({keySize:t+n,hasher:a}).compute(e,r);else var s=c.create({keySize:t+n}).compute(e,r);var o=i.create(s.words.slice(t),4*n);return s.sigBytes=4*t,g.create({key:s,iv:o,salt:r})}},A=a.PasswordBasedCipher=b.extend({cfg:b.cfg.extend({kdf:v}),encrypt:function(e,t,n,r){var a=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=a.iv;var s=b.encrypt.call(this,e,t,a.key,r);return s.mixIn(a),s},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var a=r.kdf.execute(n,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=a.iv,b.decrypt.call(this,e,t,a.key,r)}}))))},403:function(e,t,n){var r;e.exports=(r=r||function(e){var t;if("undefined"!=typeof window&&window.crypto&&(t=window.crypto),"undefined"!=typeof self&&self.crypto&&(t=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(t=globalThis.crypto),!t&&"undefined"!=typeof window&&window.msCrypto&&(t=window.msCrypto),!t&&void 0!==n.g&&n.g.crypto&&(t=n.g.crypto),!t)try{t=n(91)}catch(m){}var r=function(){if(t){if("function"==typeof t.getRandomValues)try{return t.getRandomValues(new Uint32Array(1))[0]}catch(m){}if("function"==typeof t.randomBytes)try{return t.randomBytes(4).readInt32LE()}catch(m){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),s={},i=s.lib={},o=i.Base={extend:function(e){var t=a(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,a=e.sigBytes;if(this.clamp(),r%4)for(var s=0;s<a;s++){var i=n[s>>>2]>>>24-s%4*8&255;t[r+s>>>2]|=i<<24-(r+s)%4*8}else for(var o=0;o<a;o+=4)t[r+o>>>2]=n[o>>>2];return this.sigBytes+=a,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new l.init(t,e)}}),u=s.enc={},c=u.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],a=0;a<n;a++){var s=t[a>>>2]>>>24-a%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],a=0;a<n;a++){var s=t[a>>>2]>>>24-a%4*8&255;r.push(String.fromCharCode(s))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},h=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,a=r.words,s=r.sigBytes,i=this.blockSize,o=s/(4*i),u=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*i,c=e.min(4*u,s);if(u){for(var d=0;d<u;d+=i)this._doProcessBlock(a,d);n=a.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(i.Hasher=p.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new f.HMAC.init(e,n).finalize(t)}}}),s.algo={});return s}(Math),r)},315:function(e,t,n){var r,a,s;e.exports=(r=n(403),s=(a=r).lib.WordArray,a.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var a=[],s=0;s<n;s+=3)for(var i=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<n;o++)a.push(r.charAt(i>>>6*(3-o)&63));var l=r.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var a=0;a<n.length;a++)r[n.charCodeAt(a)]=a}var i=n.charAt(64);if(i){var o=e.indexOf(i);-1!==o&&(t=o)}return function(e,t,n){for(var r=[],a=0,i=0;i<t;i++)if(i%4){var o=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;r[a>>>2]|=o<<24-a%4*8,a++}return s.create(r,a)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)},215:function(e,t,n){var r,a,s;e.exports=(r=n(403),s=(a=r).lib.WordArray,a.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var n=e.words,r=e.sigBytes,a=t?this._safe_map:this._map;e.clamp();for(var s=[],i=0;i<r;i+=3)for(var o=(n[i>>>2]>>>24-i%4*8&255)<<16|(n[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|n[i+2>>>2]>>>24-(i+2)%4*8&255,l=0;l<4&&i+.75*l<r;l++)s.push(a.charAt(o>>>6*(3-l)&63));var u=a.charAt(64);if(u)for(;s.length%4;)s.push(u);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var n=e.length,r=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var i=0;i<r.length;i++)a[r.charCodeAt(i)]=i}var o=r.charAt(64);if(o){var l=e.indexOf(o);-1!==l&&(n=l)}return function(e,t,n){for(var r=[],a=0,i=0;i<t;i++)if(i%4){var o=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;r[a>>>2]|=o<<24-a%4*8,a++}return s.create(r,a)}(e,n,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},r.enc.Base64url)},28:function(e,t,n){e.exports=n(403).enc.Hex},162:function(e,t,n){e.exports=n(403).enc.Utf8},365:function(e,t,n){var r,a,s,i,o,l,u,c;e.exports=(c=n(403),n(457),n(203),s=(a=(r=c).lib).Base,i=a.WordArray,l=(o=r.algo).MD5,u=o.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:l,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,r=this.cfg,a=r.hasher.create(),s=i.create(),o=s.words,l=r.keySize,u=r.iterations;o.length<l;){n&&a.update(n),n=a.update(e).finalize(t),a.reset();for(var c=1;c<u;c++)n=a.finalize(n),a.reset();s.concat(n)}return s.sigBytes=4*l,s}}),r.EvpKDF=function(e,t,n){return u.create(n).compute(e,t)},c.EvpKDF)},203:function(e,t,n){var r,a,s;e.exports=(a=(r=n(403)).lib.Base,s=r.enc.Utf8,void(r.algo.HMAC=a.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),i=this._iKey=t.clone(),o=a.words,l=i.words,u=0;u<n;u++)o[u]^=1549556828,l[u]^=909522486;a.sigBytes=i.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},378:function(e,t,n){var r;e.exports=(r=n(403),function(e){var t=r,n=t.lib,a=n.WordArray,s=n.Hasher,i=t.algo,o=[];!function(){for(var t=0;t<64;t++)o[t]=4294967296*e.abs(e.sin(t+1))|0}();var l=i.MD5=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,a=e[r];e[r]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var s=this._hash.words,i=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],b=e[t+7],v=e[t+8],A=e[t+9],x=e[t+10],k=e[t+11],w=e[t+12],S=e[t+13],C=e[t+14],I=e[t+15],W=s[0],_=s[1],T=s[2],N=s[3];W=u(W,_,T,N,i,7,o[0]),N=u(N,W,_,T,l,12,o[1]),T=u(T,N,W,_,p,17,o[2]),_=u(_,T,N,W,f,22,o[3]),W=u(W,_,T,N,m,7,o[4]),N=u(N,W,_,T,g,12,o[5]),T=u(T,N,W,_,y,17,o[6]),_=u(_,T,N,W,b,22,o[7]),W=u(W,_,T,N,v,7,o[8]),N=u(N,W,_,T,A,12,o[9]),T=u(T,N,W,_,x,17,o[10]),_=u(_,T,N,W,k,22,o[11]),W=u(W,_,T,N,w,7,o[12]),N=u(N,W,_,T,S,12,o[13]),T=u(T,N,W,_,C,17,o[14]),W=c(W,_=u(_,T,N,W,I,22,o[15]),T,N,l,5,o[16]),N=c(N,W,_,T,y,9,o[17]),T=c(T,N,W,_,k,14,o[18]),_=c(_,T,N,W,i,20,o[19]),W=c(W,_,T,N,g,5,o[20]),N=c(N,W,_,T,x,9,o[21]),T=c(T,N,W,_,I,14,o[22]),_=c(_,T,N,W,m,20,o[23]),W=c(W,_,T,N,A,5,o[24]),N=c(N,W,_,T,C,9,o[25]),T=c(T,N,W,_,f,14,o[26]),_=c(_,T,N,W,v,20,o[27]),W=c(W,_,T,N,S,5,o[28]),N=c(N,W,_,T,p,9,o[29]),T=c(T,N,W,_,b,14,o[30]),W=d(W,_=c(_,T,N,W,w,20,o[31]),T,N,g,4,o[32]),N=d(N,W,_,T,v,11,o[33]),T=d(T,N,W,_,k,16,o[34]),_=d(_,T,N,W,C,23,o[35]),W=d(W,_,T,N,l,4,o[36]),N=d(N,W,_,T,m,11,o[37]),T=d(T,N,W,_,b,16,o[38]),_=d(_,T,N,W,x,23,o[39]),W=d(W,_,T,N,S,4,o[40]),N=d(N,W,_,T,i,11,o[41]),T=d(T,N,W,_,f,16,o[42]),_=d(_,T,N,W,y,23,o[43]),W=d(W,_,T,N,A,4,o[44]),N=d(N,W,_,T,w,11,o[45]),T=d(T,N,W,_,I,16,o[46]),W=h(W,_=d(_,T,N,W,p,23,o[47]),T,N,i,6,o[48]),N=h(N,W,_,T,b,10,o[49]),T=h(T,N,W,_,C,15,o[50]),_=h(_,T,N,W,g,21,o[51]),W=h(W,_,T,N,w,6,o[52]),N=h(N,W,_,T,f,10,o[53]),T=h(T,N,W,_,x,15,o[54]),_=h(_,T,N,W,l,21,o[55]),W=h(W,_,T,N,v,6,o[56]),N=h(N,W,_,T,I,10,o[57]),T=h(T,N,W,_,y,15,o[58]),_=h(_,T,N,W,S,21,o[59]),W=h(W,_,T,N,m,6,o[60]),N=h(N,W,_,T,k,10,o[61]),T=h(T,N,W,_,p,15,o[62]),_=h(_,T,N,W,A,21,o[63]),s[0]=s[0]+W|0,s[1]=s[1]+_|0,s[2]=s[2]+T|0,s[3]=s[3]+N|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,a=8*t.sigBytes;n[a>>>5]|=128<<24-a%32;var s=e.floor(r/4294967296),i=r;n[15+(a+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(a+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var o=this._hash,l=o.words,u=0;u<4;u++){var c=l[u];l[u]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,a,s,i){var o=e+(t&n|~t&r)+a+i;return(o<<s|o>>>32-s)+t}function c(e,t,n,r,a,s,i){var o=e+(t&r|n&~r)+a+i;return(o<<s|o>>>32-s)+t}function d(e,t,n,r,a,s,i){var o=e+(t^n^r)+a+i;return(o<<s|o>>>32-s)+t}function h(e,t,n,r,a,s,i){var o=e+(n^(t|~r))+a+i;return(o<<s|o>>>32-s)+t}t.MD5=s._createHelper(l),t.HmacMD5=s._createHmacHelper(l)}(Math),r.MD5)},733:function(e,t,n){var r,a;e.exports=(a=n(403),n(534),a.mode.ECB=((r=a.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),r.Decryptor=r.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),r),a.mode.ECB)},794:function(e,t,n){var r;e.exports=(r=n(403),n(534),r.pad.Pkcs7)},457:function(e,t,n){var r,a,s,i,o,l,u,c;e.exports=(a=(r=c=n(403)).lib,s=a.WordArray,i=a.Hasher,o=r.algo,l=[],u=o.SHA1=i.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],a=n[1],s=n[2],i=n[3],o=n[4],u=0;u<80;u++){if(u<16)l[u]=0|e[t+u];else{var c=l[u-3]^l[u-8]^l[u-14]^l[u-16];l[u]=c<<1|c>>>31}var d=(r<<5|r>>>27)+o+l[u];d+=u<20?1518500249+(a&s|~a&i):u<40?1859775393+(a^s^i):u<60?(a&s|a&i|s&i)-1894007588:(a^s^i)-899497514,o=i,i=s,s=a<<30|a>>>2,a=r,r=d}n[0]=n[0]+r|0,n[1]=n[1]+a|0,n[2]=n[2]+s|0,n[3]=n[3]+i|0,n[4]=n[4]+o|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=i._createHelper(u),r.HmacSHA1=i._createHmacHelper(u),c.SHA1)},610:function(e,t,n){var r=n(21),a=n(29),s=n(629),i=n(495),o=n(943),l=Object.prototype.toString,u=n(110),c=u.Z_NO_FLUSH,d=u.Z_SYNC_FLUSH,h=u.Z_FULL_FLUSH,p=u.Z_FINISH,f=u.Z_OK,m=u.Z_STREAM_END,g=u.Z_DEFAULT_COMPRESSION,y=u.Z_DEFAULT_STRATEGY,b=u.Z_DEFLATED;function v(e){this.options=a.assign({level:g,method:b,chunkSize:16384,windowBits:15,memLevel:8,strategy:y},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==f)throw new Error(i[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var u;if(u="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(n=r.deflateSetDictionary(this.strm,u))!==f)throw new Error(i[n]);this._dict_set=!0}}v.prototype.push=function(e,t){var n,a,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;for(a=t===~~t?t:!0===t?p:c,"string"==typeof e?i.input=s.string2buf(e):"[object ArrayBuffer]"===l.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(o),i.next_out=0,i.avail_out=o),(a===d||a===h)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if((n=r.deflate(i,a))===m)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===f;if(0!==i.avail_out){if(a>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},v.prototype.onData=function(e){this.chunks.push(e)},v.prototype.onEnd=function(e){e===f&&(this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.exports.Wt=function(e,t){var n=new v(t);if(n.push(e,!0),n.err)throw n.msg||i[n.err];return n.result},n(110)},29:function(e){var t=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};e.exports.assign=function(e){for(var n=Array.prototype.slice.call(arguments,1);n.length;){var r=n.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var a in r)t(r,a)&&(e[a]=r[a])}}return e},e.exports.flattenChunks=function(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=e[n].length;for(var a=new Uint8Array(t),s=0,i=0,o=e.length;s<o;s++){var l=e[s];a.set(l,i),i+=l.length}return a}},629:function(e){var t=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(a){t=!1}for(var n=new Uint8Array(256),r=0;r<256;r++)n[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;n[254]=n[254]=1,e.exports.string2buf=function(e){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);var t,n,r,a,s,i=e.length,o=0;for(a=0;a<i;a++)55296==(64512&(n=e.charCodeAt(a)))&&a+1<i&&56320==(64512&(r=e.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(r-56320),a++),o+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(o),s=0,a=0;s<o;a++)55296==(64512&(n=e.charCodeAt(a)))&&a+1<i&&56320==(64512&(r=e.charCodeAt(a+1)))&&(n=65536+(n-55296<<10)+(r-56320),a++),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|63&n):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|63&n):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|63&n);return t},e.exports.buf2string=function(e,r){var a,s,i=r||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,r));var o=new Array(2*i);for(s=0,a=0;a<i;){var l=e[a++];if(l<128)o[s++]=l;else{var u=n[l];if(u>4)o[s++]=65533,a+=u-1;else{for(l&=2===u?31:3===u?15:7;u>1&&a<i;)l=l<<6|63&e[a++],u--;u>1?o[s++]=65533:l<65536?o[s++]=l:(l-=65536,o[s++]=55296|l>>10&1023,o[s++]=56320|1023&l)}}}return function(e,n){if(n<65534&&e.subarray&&t)return String.fromCharCode.apply(null,e.length===n?e:e.subarray(0,n));for(var r="",a=0;a<n;a++)r+=String.fromCharCode(e[a]);return r}(o,s)},e.exports.utf8border=function(e,t){(t=t||e.length)>e.length&&(t=e.length);for(var r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+n[e[r]]>t?r:t}},600:function(e){e.exports=function(e,t,n,r){for(var a=65535&e,s=e>>>16&65535,i=0;0!==n;){n-=i=n>2e3?2e3:n;do{s=s+(a=a+t[r++]|0)|0}while(--i);a%=65521,s%=65521}return a|s<<16}},110:function(e){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},155:function(e){var t=new Uint32Array(function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}());e.exports=function(e,n,r,a){var s=t,i=a+r;e^=-1;for(var o=a;o<i;o++)e=e>>>8^s[255&(e^n[o])];return~e}},21:function(e,t,n){var r=n(672),a=r._tr_init,s=r._tr_stored_block,i=r._tr_flush_block,o=r._tr_tally,l=r._tr_align,u=n(600),c=n(155),d=n(495),h=n(110),p=h.Z_NO_FLUSH,f=h.Z_PARTIAL_FLUSH,m=h.Z_FULL_FLUSH,g=h.Z_FINISH,y=h.Z_BLOCK,b=h.Z_OK,v=h.Z_STREAM_END,A=h.Z_STREAM_ERROR,x=h.Z_DATA_ERROR,k=h.Z_BUF_ERROR,w=h.Z_DEFAULT_COMPRESSION,S=h.Z_FILTERED,C=h.Z_HUFFMAN_ONLY,I=h.Z_RLE,W=h.Z_FIXED,_=h.Z_DEFAULT_STRATEGY,T=h.Z_UNKNOWN,N=h.Z_DEFLATED,E=258,R=262,$=42,O=113,F=666,D=function(e,t){return e.msg=d[t],t},M=function(e){return 2*e-(e>4?9:0)},L=function(e){for(var t=e.length;--t>=0;)e[t]=0},B=function(e){var t,n,r,a=e.w_size;r=t=e.hash_size;do{n=e.head[--r],e.head[r]=n>=a?n-a:0}while(--t);r=t=a;do{n=e.prev[--r],e.prev[r]=n>=a?n-a:0}while(--t)},P=function(e,t,n){return(t<<e.hash_shift^n)&e.hash_mask},z=function(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},G=function(e,t){i(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,z(e.strm)},V=function(e,t){e.pending_buf[e.pending++]=t},U=function(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},H=function(e,t,n,r){var a=e.avail_in;return a>r&&(a=r),0===a?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),1===e.state.wrap?e.adler=u(e.adler,t,a,n):2===e.state.wrap&&(e.adler=c(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},j=function(e,t){var n,r,a=e.max_chain_length,s=e.strstart,i=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-R?e.strstart-(e.w_size-R):0,u=e.window,c=e.w_mask,d=e.prev,h=e.strstart+E,p=u[s+i-1],f=u[s+i];e.prev_length>=e.good_match&&(a>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(n=t)+i]===f&&u[n+i-1]===p&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do{}while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<h);if(r=E-(h-s),s=h-E,r>i){if(e.match_start=t,i=r,r>=o)break;p=u[s+i-1],f=u[s+i]}}}while((t=d[t&c])>l&&0!=--a);return i<=e.lookahead?i:e.lookahead},q=function(e){var t,n,r,a=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-R)&&(e.window.set(e.window.subarray(a,a+a-n),0),e.match_start-=a,e.strstart-=a,e.block_start-=a,e.insert>e.strstart&&(e.insert=e.strstart),B(e),n+=a),0===e.strm.avail_in)break;if(t=H(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=t,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=P(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=P(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<R&&0!==e.strm.avail_in)},Q=function(e,t){var n,r,a,i=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,l=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a)break;if(a=e.strm.avail_out-a,n>(r=e.strstart-e.block_start)+e.strm.avail_in&&(n=r+e.strm.avail_in),n>a&&(n=a),n<i&&(0===n&&t!==g||t===p||n!==r+e.strm.avail_in))break;o=t===g&&n===r+e.strm.avail_in?1:0,s(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,z(e.strm),r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(H(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o);return(l-=e.strm.avail_in)&&(l>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=l&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-l,e.strm.next_in),e.strstart),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==p&&t!==g&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(H(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,i=(a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a)>e.w_size?e.w_size:a,((r=e.strstart-e.block_start)>=i||(r||t===g)&&t!==p&&0===e.strm.avail_in&&r<=a)&&(n=r>a?a:r,o=t===g&&0===e.strm.avail_in&&n===r?1:0,s(e,e.block_start,n,o),e.block_start+=n,z(e.strm)),o?3:1)},X=function(e,t){for(var n,r;;){if(e.lookahead<R){if(q(e),e.lookahead<R&&t===p)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=P(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-R&&(e.match_length=j(e,n)),e.match_length>=3)if(r=o(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=P(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=P(e,e.ins_h,e.window[e.strstart+1]);else r=o(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(G(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===g?(G(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(G(e,!1),0===e.strm.avail_out)?1:2},Z=function(e,t){for(var n,r,a;;){if(e.lookahead<R){if(q(e),e.lookahead<R&&t===p)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=P(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-R&&(e.match_length=j(e,n),e.match_length<=5&&(e.strategy===S||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,r=o(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=P(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(G(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=o(e,0,e.window[e.strstart-1]))&&G(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=o(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===g?(G(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(G(e,!1),0===e.strm.avail_out)?1:2};function K(e,t,n,r,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=a}var J=[new K(0,0,0,0,Q),new K(4,4,8,4,X),new K(4,5,16,8,X),new K(4,6,32,32,X),new K(4,4,16,16,Z),new K(8,16,32,32,Z),new K(8,16,128,128,Z),new K(8,32,128,256,Z),new K(32,128,258,1024,Z),new K(32,258,258,4096,Z)];function Y(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=N,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),L(this.dyn_ltree),L(this.dyn_dtree),L(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),L(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),L(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var ee=function(e){if(!e)return 1;var t=e.state;return!t||t.strm!==e||t.status!==$&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==O&&t.status!==F?1:0},te=function(e){if(ee(e))return D(e,A);e.total_in=e.total_out=0,e.data_type=T;var t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?$:O,e.adler=2===t.wrap?0:1,t.last_flush=-2,a(t),b},ne=function(e){var t,n=te(e);return n===b&&((t=e.state).window_size=2*t.w_size,L(t.head),t.max_lazy_match=J[t.level].max_lazy,t.good_match=J[t.level].good_length,t.nice_match=J[t.level].nice_length,t.max_chain_length=J[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n},re=function(e,t,n,r,a,s){if(!e)return A;var i=1;if(t===w&&(t=6),r<0?(i=0,r=-r):r>15&&(i=2,r-=16),a<1||a>9||n!==N||r<8||r>15||t<0||t>9||s<0||s>W||8===r&&1!==i)return D(e,A);8===r&&(r=9);var o=new Y;return e.state=o,o.strm=e,o.status=$,o.wrap=i,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=a+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<a+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=s,o.method=n,ne(e)};e.exports.deflateInit=function(e,t){return re(e,t,N,15,8,_)},e.exports.deflateInit2=re,e.exports.deflateReset=ne,e.exports.deflateResetKeep=te,e.exports.deflateSetHeader=function(e,t){return ee(e)||2!==e.state.wrap?A:(e.state.gzhead=t,b)},e.exports.deflate=function(e,t){if(ee(e)||t>y||t<0)return e?D(e,A):A;var n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===F&&t!==g)return D(e,0===e.avail_out?k:A);var r=n.last_flush;if(n.last_flush=t,0!==n.pending){if(z(e),0===e.avail_out)return n.last_flush=-1,b}else if(0===e.avail_in&&M(t)<=M(r)&&t!==g)return D(e,k);if(n.status===F&&0!==e.avail_in)return D(e,k);if(n.status===$&&0===n.wrap&&(n.status=O),n.status===$){var a=N+(n.w_bits-8<<4)<<8;if(a|=(n.strategy>=C||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),U(n,a+=31-a%31),0!==n.strstart&&(U(n,e.adler>>>16),U(n,65535&e.adler)),e.adler=1,n.status=O,z(e),0!==n.pending)return n.last_flush=-1,b}if(57===n.status)if(e.adler=0,V(n,31),V(n,139),V(n,8),n.gzhead)V(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),V(n,255&n.gzhead.time),V(n,n.gzhead.time>>8&255),V(n,n.gzhead.time>>16&255),V(n,n.gzhead.time>>24&255),V(n,9===n.level?2:n.strategy>=C||n.level<2?4:0),V(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(V(n,255&n.gzhead.extra.length),V(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=c(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(V(n,0),V(n,0),V(n,0),V(n,0),V(n,0),V(n,9===n.level?2:n.strategy>=C||n.level<2?4:0),V(n,3),n.status=O,z(e),0!==n.pending)return n.last_flush=-1,b;if(69===n.status){if(n.gzhead.extra){for(var i=n.pending,u=(65535&n.gzhead.extra.length)-n.gzindex;n.pending+u>n.pending_buf_size;){var d=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+d),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=c(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=d,z(e),0!==n.pending)return n.last_flush=-1,b;i=0,u-=d}var h=new Uint8Array(n.gzhead.extra);n.pending_buf.set(h.subarray(n.gzindex,n.gzindex+u),n.pending),n.pending+=u,n.gzhead.hcrc&&n.pending>i&&(e.adler=c(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){var x,w=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>w&&(e.adler=c(e.adler,n.pending_buf,n.pending-w,w)),z(e),0!==n.pending)return n.last_flush=-1,b;w=0}x=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,V(n,x)}while(0!==x);n.gzhead.hcrc&&n.pending>w&&(e.adler=c(e.adler,n.pending_buf,n.pending-w,w)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){var S,W=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>W&&(e.adler=c(e.adler,n.pending_buf,n.pending-W,W)),z(e),0!==n.pending)return n.last_flush=-1,b;W=0}S=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,V(n,S)}while(0!==S);n.gzhead.hcrc&&n.pending>W&&(e.adler=c(e.adler,n.pending_buf,n.pending-W,W))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(z(e),0!==n.pending))return n.last_flush=-1,b;V(n,255&e.adler),V(n,e.adler>>8&255),e.adler=0}if(n.status=O,z(e),0!==n.pending)return n.last_flush=-1,b}if(0!==e.avail_in||0!==n.lookahead||t!==p&&n.status!==F){var _=0===n.level?Q(n,t):n.strategy===C?function(e,t){for(var n;;){if(0===e.lookahead&&(q(e),0===e.lookahead)){if(t===p)return 1;break}if(e.match_length=0,n=o(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(G(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===g?(G(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(G(e,!1),0===e.strm.avail_out)?1:2}(n,t):n.strategy===I?function(e,t){for(var n,r,a,s,i=e.window;;){if(e.lookahead<=E){if(q(e),e.lookahead<=E&&t===p)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=i[a=e.strstart-1])===i[++a]&&r===i[++a]&&r===i[++a]){s=e.strstart+E;do{}while(r===i[++a]&&r===i[++a]&&r===i[++a]&&r===i[++a]&&r===i[++a]&&r===i[++a]&&r===i[++a]&&r===i[++a]&&a<s);e.match_length=E-(s-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=o(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=o(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(G(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===g?(G(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(G(e,!1),0===e.strm.avail_out)?1:2}(n,t):J[n.level].func(n,t);if(3!==_&&4!==_||(n.status=F),1===_||3===_)return 0===e.avail_out&&(n.last_flush=-1),b;if(2===_&&(t===f?l(n):t!==y&&(s(n,0,0,!1),t===m&&(L(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),z(e),0===e.avail_out))return n.last_flush=-1,b}return t!==g?b:n.wrap<=0?v:(2===n.wrap?(V(n,255&e.adler),V(n,e.adler>>8&255),V(n,e.adler>>16&255),V(n,e.adler>>24&255),V(n,255&e.total_in),V(n,e.total_in>>8&255),V(n,e.total_in>>16&255),V(n,e.total_in>>24&255)):(U(n,e.adler>>>16),U(n,65535&e.adler)),z(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?b:v)},e.exports.deflateEnd=function(e){if(ee(e))return A;var t=e.state.status;return e.state=null,t===O?D(e,x):b},e.exports.deflateSetDictionary=function(e,t){var n=t.length;if(ee(e))return A;var r=e.state,a=r.wrap;if(2===a||1===a&&r.status!==$||r.lookahead)return A;if(1===a&&(e.adler=u(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){0===a&&(L(r.head),r.strstart=0,r.block_start=0,r.insert=0);var s=new Uint8Array(r.w_size);s.set(t.subarray(n-r.w_size,n),0),t=s,n=r.w_size}var i=e.avail_in,o=e.next_in,l=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,q(r);r.lookahead>=3;){var c=r.strstart,d=r.lookahead-2;do{r.ins_h=P(r,r.ins_h,r.window[c+3-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++}while(--d);r.strstart=c,r.lookahead=2,q(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=o,e.input=l,e.avail_in=i,r.wrap=a,b},e.exports.deflateInfo="pako deflate (from Nodeca project)"},495:function(e){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},672:function(e){function t(e){for(var t=e.length;--t>=0;)e[t]=0}var n=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),r=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),s=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),i=new Array(576);t(i);var o=new Array(60);t(o);var l=new Array(512);t(l);var u=new Array(256);t(u);var c=new Array(29);t(c);var d,h,p,f=new Array(30);function m(e,t,n,r,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=a,this.has_stree=e&&e.length}function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(f);var y=function(e){return e<256?l[e]:l[256+(e>>>7)]},b=function(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},v=function(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,b(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},A=function(e,t,n){v(e,n[2*t],n[2*t+1])},x=function(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},k=function(e,t,n){var r,a,s=new Array(16),i=0;for(r=1;r<=15;r++)i=i+n[r-1]<<1,s[r]=i;for(a=0;a<=t;a++){var o=e[2*a+1];0!==o&&(e[2*a]=x(s[o]++,o))}},w=function(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},S=function(e){e.bi_valid>8?b(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},C=function(e,t,n,r){var a=2*t,s=2*n;return e[a]<e[s]||e[a]===e[s]&&r[t]<=r[n]},I=function(e,t,n){for(var r=e.heap[n],a=n<<1;a<=e.heap_len&&(a<e.heap_len&&C(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!C(t,r,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=r},W=function(e,t,a){var s,i,o,l,d=0;if(0!==e.sym_next)do{s=255&e.pending_buf[e.sym_buf+d++],s+=(255&e.pending_buf[e.sym_buf+d++])<<8,i=e.pending_buf[e.sym_buf+d++],0===s?A(e,i,t):(o=u[i],A(e,o+256+1,t),0!==(l=n[o])&&(i-=c[o],v(e,i,l)),s--,o=y(s),A(e,o,a),0!==(l=r[o])&&(s-=f[o],v(e,s,l)))}while(d<e.sym_next);A(e,256,t)},_=function(e,t){var n,r,a,s=t.dyn_tree,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,l=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<l;n++)0!==s[2*n]?(e.heap[++e.heap_len]=u=n,e.depth[n]=0):s[2*n+1]=0;for(;e.heap_len<2;)s[2*(a=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[a]=0,e.opt_len--,o&&(e.static_len-=i[2*a+1]);for(t.max_code=u,n=e.heap_len>>1;n>=1;n--)I(e,s,n);a=l;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],I(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,s[2*a]=s[2*n]+s[2*r],e.depth[a]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,s[2*n+1]=s[2*r+1]=a,e.heap[1]=a++,I(e,s,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,a,s,i,o,l=t.dyn_tree,u=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,m=0;for(s=0;s<=15;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(s=l[2*l[2*(r=e.heap[n])+1]+1]+1)>f&&(s=f,m++),l[2*r+1]=s,r>u||(e.bl_count[s]++,i=0,r>=p&&(i=h[r-p]),o=l[2*r],e.opt_len+=o*(s+i),d&&(e.static_len+=o*(c[2*r+1]+i)));if(0!==m){do{for(s=f-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[f]--,m-=2}while(m>0);for(s=f;0!==s;s--)for(r=e.bl_count[s];0!==r;)(a=e.heap[--n])>u||(l[2*a+1]!==s&&(e.opt_len+=(s-l[2*a+1])*l[2*a],l[2*a+1]=s),r--)}}(e,t),k(s,u,e.bl_count)},T=function(e,t,n){var r,a,s=-1,i=t[1],o=0,l=7,u=4;for(0===i&&(l=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)a=i,i=t[2*(r+1)+1],++o<l&&a===i||(o<u?e.bl_tree[2*a]+=o:0!==a?(a!==s&&e.bl_tree[2*a]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,s=a,0===i?(l=138,u=3):a===i?(l=6,u=3):(l=7,u=4))},N=function(e,t,n){var r,a,s=-1,i=t[1],o=0,l=7,u=4;for(0===i&&(l=138,u=3),r=0;r<=n;r++)if(a=i,i=t[2*(r+1)+1],!(++o<l&&a===i)){if(o<u)do{A(e,a,e.bl_tree)}while(0!=--o);else 0!==a?(a!==s&&(A(e,a,e.bl_tree),o--),A(e,16,e.bl_tree),v(e,o-3,2)):o<=10?(A(e,17,e.bl_tree),v(e,o-3,3)):(A(e,18,e.bl_tree),v(e,o-11,7));o=0,s=a,0===i?(l=138,u=3):a===i?(l=6,u=3):(l=7,u=4)}},E=!1,R=function(e,t,n,r){v(e,0+(r?1:0),3),S(e),b(e,n),b(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};e.exports._tr_init=function(e){E||(function(){var e,t,s,g,y,b=new Array(16);for(s=0,g=0;g<28;g++)for(c[g]=s,e=0;e<1<<n[g];e++)u[s++]=g;for(u[s-1]=g,y=0,g=0;g<16;g++)for(f[g]=y,e=0;e<1<<r[g];e++)l[y++]=g;for(y>>=7;g<30;g++)for(f[g]=y<<7,e=0;e<1<<r[g]-7;e++)l[256+y++]=g;for(t=0;t<=15;t++)b[t]=0;for(e=0;e<=143;)i[2*e+1]=8,e++,b[8]++;for(;e<=255;)i[2*e+1]=9,e++,b[9]++;for(;e<=279;)i[2*e+1]=7,e++,b[7]++;for(;e<=287;)i[2*e+1]=8,e++,b[8]++;for(k(i,287,b),e=0;e<30;e++)o[2*e+1]=5,o[2*e]=x(e,5);d=new m(i,n,257,286,15),h=new m(o,r,0,30,15),p=new m(new Array(0),a,0,19,7)}(),E=!0),e.l_desc=new g(e.dyn_ltree,d),e.d_desc=new g(e.dyn_dtree,h),e.bl_desc=new g(e.bl_tree,p),e.bi_buf=0,e.bi_valid=0,w(e)},e.exports._tr_stored_block=R,e.exports._tr_flush_block=function(e,t,n,r){var a,l,u=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),_(e,e.l_desc),_(e,e.d_desc),u=function(e){var t;for(T(e,e.dyn_ltree,e.l_desc.max_code),T(e,e.dyn_dtree,e.d_desc.max_code),_(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*s[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),a=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=a&&(a=l)):a=l=n+5,n+4<=a&&-1!==t?R(e,t,n,r):4===e.strategy||l===a?(v(e,2+(r?1:0),3),W(e,i,o)):(v(e,4+(r?1:0),3),function(e,t,n,r){var a;for(v(e,t-257,5),v(e,n-1,5),v(e,r-4,4),a=0;a<r;a++)v(e,e.bl_tree[2*s[a]+1],3);N(e,e.dyn_ltree,t-1),N(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,u+1),W(e,e.dyn_ltree,e.dyn_dtree)),w(e),r&&S(e)},e.exports._tr_tally=function(e,t,n){return e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(u[n]+256+1)]++,e.dyn_dtree[2*y(t)]++),e.sym_next===e.sym_end},e.exports._tr_align=function(e){var t;v(e,2,3),A(e,256,i),16===(t=e).bi_valid?(b(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},943:function(e){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},91:function(){}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){n.r(r),n.d(r,{Channel:function(){return A},getAllEncrypted:function(){return Ue},syncGetAllEncrypted:function(){return He}});var e,t=n(200),a=n.n(t),s=n(162),i=n.n(s),o=n(794),l=n.n(o),u=n(215),c=n.n(u),d=n(733),h=n.n(d),p=n(378),f=n.n(p),m="1.2.0",g=function(){return(new Date).getTime()},y=function(){return v},b=function(){return g()-v},v=g(),A=((e={})[e.PC=0]="PC",e[e.M=1]="M",e[e.H5=4]="H5",e),x=function(e){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,n,r){var a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.a1=m,this.a2=y(),this.a3=void 0,this.a4=void 0,this.a5=void 0,this.a6=void 0,this.a7=void 0,this.a8=void 0,this.a9=void 0,this.a10=void 0,this.a11=void 0,this.a12=void 0,this.a13=void 0,this.a14=void 0,this.a15=void 0,this.a16=void 0,this.a17=void 0,this.a18=void 0,this.a19=void 0,this.a21=void 0,this.a22=void 0,this.a20=void 0,this.a1=m,this.a2=y(),this.a3=(null==t?void 0:t.m_mouse_track)||[],this.a4=(null==t?void 0:t.m_click_track)||[],this.a5=(null==t?void 0:t.mouse_track)||[],this.a6=(null==t?void 0:t.action_track)||[],this.a7=(null==t?void 0:t.click_track)||[],this.a8=(null==t?void 0:t.key_track)||[],this.a9=(null==t?void 0:t.onclick_track)||[],this.a10=(null==t?void 0:t.oninput_track)||[],this.a11=(null==t?void 0:t.clipboard_track)||[],this.a12=(null==t?void 0:t.m_origin_mouse_track_length)||0,this.a13=(null==t?void 0:t.origin_mouse_track_length)||0,this.a14=(null==n?void 0:n.requestTime)||0,this.a15=(null==n||null===(a=n.userAgent)||void 0===a?void 0:a.slice(0,300))||"",this.a16=(null==n?void 0:n.screen)||[],this.a17=(null==n?void 0:n.dev)||[],this.a18=(null==n?void 0:n.env)||[],this.a19=(null==n?void 0:n.lang)||[],this.a21=(null==n?void 0:n.site)||"",this.a22=n.is_init_suceess||0,this.a20=[(null==t?void 0:t.error_trap)||"",(null==n?void 0:n.error_trap)||"",r||""].filter((function(e){return""!=e})).join(";").slice(0,50)})),k=n(28),w=n.n(k),S=function(e){return e.replace(/^\s*|\s*$/g,"")},C=function(){var e,t=null===(e=window.Intl)||void 0===e?void 0:e.DateTimeFormat;if(t){var n=(new t).resolvedOptions().timeZone;if(n)return n}return""},I=function(){var e=(new Date).getFullYear();return Math.max(parseFloat(String(new Date(e,0,1).getTimezoneOffset())),parseFloat(String(new Date(e,6,1).getTimezoneOffset())))},W=function(){var e;if(null===(e=document.body)||void 0===e||!e.appendChild)return!1;var t=document.createElement("div");t.innerHTML="&nbsp;",t.className="adsbox";try{document.body.appendChild(t);var n=document.querySelector(".adsbox");return!n||0===n.offsetHeight}finally{var r;null===(r=t.parentNode)||void 0===r||r.removeChild(t)}},_=function(){var e,t=0;void 0!==navigator.maxTouchPoints?t=parseInt(String(navigator.maxTouchPoints)):void 0!==navigator.msMaxTouchPoints&&(t=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),e=!0}catch(n){e=!1}return{maxTouchPoints:t,touchEvent:e,touchStart:"ontouchstart"in window}},T=function(){var e=document.createElement("canvas");return e&&e.getContext&&!!e.getContext("2d")};function N(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var R,$=function(e){var t,n;return function(e,t){return function(e){for(var t={},n=(e||"").split(";"),r=0;r<n.length;r++){var a=N(S(n[r]||"").split("=")),s=a[0],i=a.slice(1),o=S(s||""),l=S((i||[]).join("="));o&&(t[o]=l)}return t}(e)[t]||""}((n=(null===(t=document)||void 0===t?void 0:t.cookie)||"",decodeURIComponent?decodeURIComponent(n):n),e)},O=function(){var e;try{var t,n;e=void 0!==(null===(t=window)||void 0===t?void 0:t.ActiveXObject)?new ActiveXObject("ShockwaveFlash.ShockwaveFlash"):null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.plugins["Shockwave Flash"]}catch(r){}return!!e},F=function(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=-1!==e.cookie.indexOf("cookietest=");return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch(n){return!1}};function D(){D=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},i=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(R){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var s=t&&t.prototype instanceof y?t:y,i=Object.create(s.prototype),o=new N(r||[]);return a(i,"_invoke",{value:I(e,n,o)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}t.wrap=c;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",g={};function y(){}function b(){}function v(){}var A={};u(A,i,(function(){return this}));var x=Object.getPrototypeOf,k=x&&x(x(E([])));k&&k!==n&&r.call(k,i)&&(A=k);var w=v.prototype=y.prototype=Object.create(A);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(a,s,i,o){var l=d(e[a],e,s);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,i,o)}),(function(e){n("throw",e,i,o)})):t.resolve(c).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,o)}))}o(l.arg)}var s;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return s=s?s.then(a,a):a()}})}function I(t,n,r){var a=h;return function(s,i){if(a===f)throw new Error("Generator is already running");if(a===m){if("throw"===s)throw i;return{value:e,done:!0}}for(r.method=s,r.arg=i;;){var o=r.delegate;if(o){var l=W(o,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=f;var u=d(t,n,r);if("normal"===u.type){if(a=r.done?m:p,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=m,r.method="throw",r.arg=u.arg)}}}function W(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,W(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var s=d(a,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,g;var i=s.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,s=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=v,a(w,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:b,configurable:!0}),b.displayName=u(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},S(C.prototype),u(C.prototype,o,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,a,s){void 0===s&&(s=Promise);var i=new C(c(e,n,r,a),s);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(w),u(w,l,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=E,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],o=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:E(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function M(e,t,n,r,a,s,i){try{var o=e[s](i),l=o.value}catch(u){return void n(u)}o.done?t(l):Promise.resolve(l).then(r,a)}var L,B,P,z=function(){return(R=R||function(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var s=e.apply(t,n);function i(e){M(s,r,a,i,o,"next",e)}function o(e){M(s,r,a,i,o,"throw",e)}i(void 0)}))}}(D().mark((function e(){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var t;(null===(t=navigator.permissions)||void 0===t?void 0:t.query({name:"notifications"}).then((function(t){"denied"===Notification.permission&&"prompt"===t.state?e(1):e(0)})).catch((function(){return e(-1)})))||e(-1)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)},G={"shein.com":"SHEIN","romwe.com":"ROMWE"};function V(){var e,t=(null===(e=window)||void 0===e||null===(e=e.location)||void 0===e?void 0:e.host)||"";for(var n in G)if(t.endsWith(n))return G[n];return t}function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t,n){return(t="symbol"==typeof(r=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e;var r}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,s,i,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return o}}(e,t)||Z(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(){Q=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},i=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(R){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var s=t&&t.prototype instanceof y?t:y,i=Object.create(s.prototype),o=new N(r||[]);return a(i,"_invoke",{value:I(e,n,o)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}t.wrap=c;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",g={};function y(){}function b(){}function v(){}var A={};u(A,i,(function(){return this}));var x=Object.getPrototypeOf,k=x&&x(x(E([])));k&&k!==n&&r.call(k,i)&&(A=k);var w=v.prototype=y.prototype=Object.create(A);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(a,s,i,o){var l=d(e[a],e,s);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,i,o)}),(function(e){n("throw",e,i,o)})):t.resolve(c).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,o)}))}o(l.arg)}var s;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return s=s?s.then(a,a):a()}})}function I(t,n,r){var a=h;return function(s,i){if(a===f)throw new Error("Generator is already running");if(a===m){if("throw"===s)throw i;return{value:e,done:!0}}for(r.method=s,r.arg=i;;){var o=r.delegate;if(o){var l=W(o,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=f;var u=d(t,n,r);if("normal"===u.type){if(a=r.done?m:p,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=m,r.method="throw",r.arg=u.arg)}}}function W(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,W(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var s=d(a,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,g;var i=s.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,s=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=v,a(w,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:b,configurable:!0}),b.displayName=u(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},S(C.prototype),u(C.prototype,o,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,a,s){void 0===s&&(s=Promise);var i=new C(c(e,n,r,a),s);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(w),u(w,l,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=E,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],o=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:E(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function X(e){return function(e){if(Array.isArray(e))return K(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Z(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){if(e){if("string"==typeof e)return K(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?K(e,t):void 0}}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function J(e,t,n,r,a,s,i){try{var o=e[s](i),l=o.value}catch(u){return void n(u)}o.done?t(l):Promise.resolve(l).then(r,a)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var s=e.apply(t,n);function i(e){J(s,r,a,i,o,"next",e)}function o(e){J(s,r,a,i,o,"throw",e)}i(void 0)}))}}var ee=g(),te=function(){return(L=L||Y(Q().mark((function e(){var t,n,r,a,s,i,o,l,u,c,d,h,p,f,m,y,b,v,A;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v=g(),A={start_time:ee,timestamp:v,timezone:I(),timezoneName:C(),cookieId:$("cookieId"),is_cookie:F()?1:0,fonts:[],touchSupport:_(),browserLanguage:(null===(t=window)||void 0===t||null===(t=t.navigator)||void 0===t?void 0:t.language)||(null===(n=window)||void 0===n||null===(n=n.navigator)||void 0===n?void 0:n.userLanguage)||"",browserLanguages:X((null===(r=window)||void 0===r||null===(r=r.navigator)||void 0===r?void 0:r.languages)||[]),maxTouchPoints:(null===(a=window)||void 0===a||null===(a=a.navigator)||void 0===a?void 0:a.maxTouchPoints)||(null===(s=window)||void 0===s||null===(s=s.navigator)||void 0===s?void 0:s.msMaxTouchPoints)||0,userAgent:(null===(i=window)||void 0===i||null===(i=i.navigator)||void 0===i?void 0:i.userAgent)||"",platform:(null===(o=window)||void 0===o||null===(o=o.navigator)||void 0===o?void 0:o.platform)||"",product:(null===(l=window)||void 0===l||null===(l=l.navigator)||void 0===l?void 0:l.product)||"",productSub:(null===(u=window)||void 0===u||null===(u=u.navigator)||void 0===u?void 0:u.productSub)||"",vendor:(null===(c=window)||void 0===c||null===(c=c.navigator)||void 0===c?void 0:c.vendor)||"",vendorSub:(null===(d=window)||void 0===d||null===(d=d.navigator)||void 0===d?void 0:d.vendorSub)||"",deviceMemory:null===(h=window)||void 0===h||null===(h=h.navigator)||void 0===h?void 0:h.deviceMemory,hardwareConcurrency:null===(p=window)||void 0===p||null===(p=p.navigator)||void 0===p?void 0:p.hardwareConcurrency,osCpu:(null===(f=window)||void 0===f||null===(f=f.navigator)||void 0===f?void 0:f.osCpu)||"",cpuClass:(null===(m=window)||void 0===m||null===(m=m.navigator)||void 0===m?void 0:m.cpuClass)||"",addBehavior:!(null===(y=document)||void 0===y||null===(y=y.body)||void 0===y||!y.addBehavior),flash:O()?1:0,webdriver:null!==(b=window)&&void 0!==b&&null!==(b=b.navigator)&&void 0!==b&&b.webdriver?1:0},e.abrupt("return",A);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)},ne=function(){var e;return{netEnabled:null===(e=window)||void 0===e||null===(e=e.navigator)||void 0===e?void 0:e.onLine}},re=function(){var e,t,n,r,a,s,i;return{innerWidth:window.innerWidth,innerHeight:window.innerHeight,outerWidth:window.outerWidth,outerHeight:window.outerHeight,devicePixelRatio:window.devicePixelRatio,screenX:window.screenX,screenY:window.screenY,screenLeft:window.screenLeft,screenTop:window.screenTop,screenWidth:null===(e=window)||void 0===e||null===(e=e.screen)||void 0===e?void 0:e.width,screenHeight:null===(t=window)||void 0===t||null===(t=t.screen)||void 0===t?void 0:t.height,screenAvailWidth:null===(n=window)||void 0===n||null===(n=n.screen)||void 0===n?void 0:n.availWidth,screenAvailHeight:null===(r=window)||void 0===r||null===(r=r.screen)||void 0===r?void 0:r.availHeight,screenAvailLeft:null===(a=window)||void 0===a||null===(a=a.screen)||void 0===a?void 0:a.availLeft,screenAvailTop:null===(s=window)||void 0===s||null===(s=s.screen)||void 0===s?void 0:s.availTop,colorDepth:null===(i=window)||void 0===i||null===(i=i.screen)||void 0===i?void 0:i.colorDepth}},ae=function(){var e,t,n,r,a,s,i,o,l,u,c,d,h,p,f,m,g,y,b,v,A=(g={isOpen:!1,orientation:void 0},y=window.outerWidth-window.innerWidth>160,b=window.outerHeight-window.innerHeight>160,v=y?"vertical":"horizontal",b&&y||!(null!==(f=window)&&void 0!==f&&null!==(f=f.Firebug)&&void 0!==f&&f.chrome&&null!==(m=window)&&void 0!==m&&null!==(m=m.Firebug)&&void 0!==m&&null!==(m=m.chrome)&&void 0!==m&&m.isInitialized||y||b)?(g.isOpen=!1,g.orientation=void 0):(g.isOpen=!0,g.orientation=v),g).isOpen,x=!(null===(e=window)||void 0===e||null===(e=e.Promise)||void 0===e||!e.allSettled),k=!(null===(t=window)||void 0===t||!t.BigInt),w=!(null===(n=window)||void 0===n||null===(n=n.Promise)||void 0===n||!n.prototype.finally),S=function(){for(var e,t=(null===(e=window)||void 0===e||null===(e=e.navigator)||void 0===e?void 0:e.plugins)||[],n=[],r=0;r<t.length;++r){var a=t[r];if(a){for(var s=[],i=0;i<a.length;++i){var o=a[i];s.push({type:o.type,suffixes:o.suffixes})}n.push({name:a.name,description:a.description,mimeTypes:s})}}return n}();return{console:A,canvas2DFP:T(),canvas3DFP:!1,functionAllSettled:x,functionBigInt:k,functionFinally:w,adBlock:W(),storageLocal:!(null===(r=navigator)||void 0===r||!r.cookieEnabled||null===(a=window)||void 0===a||!a.localStorage),storageSession:!(null===(s=navigator)||void 0===s||!s.cookieEnabled||null===(i=window)||void 0===i||!i.sessionStorage),storageIndexedDB:!(null===(o=window)||void 0===o||!o.indexedDB),openDatabase:!(null===(l=window)||void 0===l||!l.openDatabase),webglVendorAndRenderer:"",cookieEnabled:!(null===(u=window)||void 0===u||null===(u=u.navigator)||void 0===u||!u.cookieEnabled),javaEnabled:!(null===(c=window)||void 0===c||null===(c=c.navigator)||void 0===c||!c.javaEnabled)&&(null===(d=window)||void 0===d||null===(d=d.navigator)||void 0===d?void 0:d.javaEnabled()),pluginsLength:S.length,doNotTrack:(null===(h=window)||void 0===h||null===(h=h.navigator)||void 0===h?void 0:h.doNotTrack)||"unspecified",performanceTiming:null===(p=window)||void 0===p||null===(p=p.performance)||void 0===p?void 0:p.timing}},se=function(){return(B=B||Y(Q().mark((function e(){var t;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,z();case 2:return t=e.sent,e.abrupt("return",{isContradiction:t});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)},ie=function(){return(P=P||Y(Q().mark((function e(){var t,n,r,a,s,i,o,l,u,c,d,h,p,f,m,g,y,b,v,A;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,te();case 3:t=e.sent,e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),n=`getBasicInfo-${e.t0.message}}`;case 9:return r=oe((function(){return ne()}),"networkInfo"),a=q(r,2),s=a[0],i=a[1],o=oe((function(){return re()}),"displayInfo"),l=q(o,2),u=l[0],c=l[1],d=oe((function(){return ae()}),"featureInfo"),h=q(d,2),p=h[0],f=h[1],m=oe((function(){return{site:V()}}),"siteInfo"),g=q(m,2),y=g[0],b=g[1],v={isContradiction:-1},A="",e.prev=14,e.next=17,se();case 17:v=e.sent,e.next=23;break;case 20:e.prev=20,e.t1=e.catch(14),A=`permissionInfo-${e.t1.message}}`;case 23:return e.abrupt("return",H(H(H(H(H(H(H({},y),t),s),u),p),v),{},{error_trap:[b,n,i,c,f,,A].filter(Boolean).join(";")}));case 24:case"end":return e.stop()}}),e,null,[[0,6],[14,20]])})))).apply(this,arguments)},oe=function(e,t){var n,r;try{n=e()}catch(a){r=`${t}-${a.message}`}return[n,r]};function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ue(e,t){return(e||[]).slice(-1*t)}var ce=function(e,t){if((e||[]).length<=100)return e||[];var n=0,r=[];return(e||[]).forEach((function(e){var a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,s,i,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e,1)[0];(0===n||n&&a-n>t)&&(r.push(e),n=a)})),r};function de(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,he(r.key),r)}}function he(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function pe(e,t){return n=e,(r=me(e,t,"get")).get?r.get.call(n):r.value;var n,r}function fe(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,me(e,t,"set"),n),n}function me(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}var ge,ye=new WeakMap,be=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.maxLen=void 0,this.list=void 0,function(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}(this,ye,{writable:!0,value:void 0}),this.maxLen=t,this.list=ue(n,t),fe(this,ye,0)}return t=e,n=[{key:"items",get:function(){return this.list}},{key:"originLength",get:function(){return pe(this,ye)||0}},{key:"push",value:function(e){return this.list.length>=this.maxLen&&this.list.shift(),this.list.push(e),fe(this,ye,pe(this,ye)+1),this.list}},{key:"clear",value:function(){this.list=[],fe(this,ye,0)}}],n&&de(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e;var t,n}(),ve=function(e){return e[e.ClickLink=1]="ClickLink",e[e.ClickButton=2]="ClickButton",e[e.ClickInput=3]="ClickInput",e[e.ClickDropdown=4]="ClickDropdown",e[e.ClickElement=5]="ClickElement",e}({}),Ae=function(e){return e[e.copy=1]="copy",e[e.cut=2]="cut",e[e.paste=3]="paste",e}({}),xe=function(e){return e[e.KeyUp=1]="KeyUp",e[e.KeyDown=2]="KeyDown",e}({}),ke=function(e){return e[e.LeftClick=1]="LeftClick",e[e.RightClick=2]="RightClick",e[e.LeftDoubleClick=3]="LeftDoubleClick",e[e.WheelClick=4]="WheelClick",e}({}),we=100,Se=function(e){switch((e.target.nodeName||"").toLowerCase()){case"a":return ve.ClickLink;case"button":return ve.ClickButton;case"input":case"textarea":return ve.ClickInput;case"select":case"option":return ve.ClickDropdown;default:return ve.ClickElement}};function Ce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ie(r.key),r)}}function Ie(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var We=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,n=[{key:"init",value:function(){this.m_mouseMoveBehaviorData=new be(we),this.m_clickBehaviorData=new be(we),this.mouseMoveBehaviorData=new be(we),this.mouseActionBehaviorData=new be(we),this.clickBehaviorData=new be(we),this.keyboardBehaviorData=new be(we),this.onClickBehaviorData=new be(we),this.onInputBehaviorData=new be(we),this.clipboardBehaviorData=new be(we),this.addListeners()}},{key:"getBehaviorData",value:function(){try{var e=this.m_mouseMoveBehaviorData.originLength,t=this.mouseMoveBehaviorData.originLength;return{m_mouse_track:ue(ce(this.m_mouseMoveBehaviorData.items,50),40),m_click_track:ue(this.m_clickBehaviorData.items,30),mouse_track:ue(ce(this.mouseMoveBehaviorData.items,50),40),action_track:ue(this.mouseActionBehaviorData.items,2),click_track:ue(this.clickBehaviorData.items,30),key_track:ue(this.keyboardBehaviorData.items,2),onclick_track:ue(this.onClickBehaviorData.items,30),oninput_track:ue(this.onInputBehaviorData.items,30),clipboard_track:ue(this.clipboardBehaviorData.items,30),m_origin_mouse_track_length:e,origin_mouse_track_length:t,error_trap:""}}catch(n){return{m_mouse_track:[],m_click_track:[],mouse_track:[],action_track:[],click_track:[],key_track:[],onclick_track:[],oninput_track:[],clipboard_track:[],m_origin_mouse_track_length:0,origin_mouse_track_length:0,error_trap:n.message||"getBehaviorData"}}}},{key:"destroy",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchmove",this.m_mouseMoveEventListener),document.removeEventListener("touchstart",this.m_clickEventListener),document.removeEventListener("mousemove",this.mouseMoveEventListener),document.removeEventListener("mousedown",this.mouseDownEventListener),document.removeEventListener("dblclick",this.mouseDblclickEventListener),document.removeEventListener("keyup",this.keyUpEventListener),document.removeEventListener("keydown",this.keyDownEventListener),document.removeEventListener("click",this.onClickEventListener),document.removeEventListener("input",this.keyDownEventListener),document.removeEventListener("copy",this.onCopyEventListener),document.removeEventListener("cut",this.onCutEventListener),document.removeEventListener("paste",this.onPasteEventListener)),this.m_mouseMoveBehaviorData.clear(),this.m_clickBehaviorData.clear(),this.mouseMoveBehaviorData.clear(),this.mouseActionBehaviorData.clear(),this.clickBehaviorData.clear(),this.keyboardBehaviorData.clear(),this.onClickBehaviorData.clear(),this.onInputBehaviorData.clear(),this.clipboardBehaviorData.clear()}},{key:"addListeners",value:function(){this.add_m_mouseMoveEventListener(),this.add_m_clickEventListener(),this.addMouseMoveEventListener(),this.addMouseClickEventListener(),this.addKeyEventListener(),this.addOnClickEventListener(),this.addOnInputEventListener(),this.addClipboardEventListener()}},{key:"add_m_mouseMoveEventListener",value:function(){document&&document.addEventListener&&document.addEventListener("touchmove",this.m_mouseMoveEventListener)}},{key:"addMouseMoveEventListener",value:function(){document&&document.addEventListener&&document.addEventListener("mousemove",this.mouseMoveEventListener)}},{key:"add_m_clickEventListener",value:function(){document&&document.addEventListener&&document.addEventListener("touchstart",this.m_clickEventListener)}},{key:"addMouseClickEventListener",value:function(){document&&document.addEventListener&&(document.addEventListener("mousedown",this.mouseDownEventListener),document.addEventListener("dblclick",this.mouseDblclickEventListener))}},{key:"addOnClickEventListener",value:function(){document&&document.addEventListener&&document.addEventListener("click",this.onClickEventListener)}},{key:"addOnInputEventListener",value:function(){document&&document.addEventListener&&document.addEventListener("input",this.onInputEventListener)}},{key:"addClipboardEventListener",value:function(){document&&document.addEventListener&&(document.addEventListener("copy",this.onCopyEventListener),document.addEventListener("cut",this.onCutEventListener),document.addEventListener("paste",this.onPasteEventListener))}},{key:"addKeyEventListener",value:function(){document&&document.addEventListener&&(document.addEventListener("keyup",this.keyUpEventListener),document.addEventListener("keydown",this.keyDownEventListener))}},{key:"add_m_mouseMoveBehavior",value:function(e,t,n){var r=Math.round(t),a=Math.round(n);this.m_mouseMoveBehaviorData.push([e,r,a])}},{key:"add_m_clickBehavior",value:function(e,t,n,r){var a=Math.round(n),s=Math.round(r);this.m_clickBehaviorData.push([t,e,a,s])}},{key:"addMouseMoveBehavior",value:function(e,t,n){var r=Math.round(t),a=Math.round(n);this.mouseMoveBehaviorData.push([e,r,a])}},{key:"addMouseActionBehavior",value:function(e,t,n,r){var a=Math.round(n),s=Math.round(r);this.mouseActionBehaviorData.push([t,e,a,s])}},{key:"addClickBehavior",value:function(e,t,n,r){var a=Math.round(n),s=Math.round(r);this.clickBehaviorData.push([t,e,a,s])}},{key:"addOnClickBehavior",value:function(e,t,n){var r=Math.round(t),a=Math.round(n);this.onClickBehaviorData.push([e,r,a])}},{key:"addOnInputBehavior",value:function(e,t){this.onInputBehaviorData.push([e,t])}},{key:"addKeyboardBehavior",value:function(e,t){this.keyboardBehaviorData.push([t,e])}},{key:"addClipboardBehavior",value:function(e,t){this.clipboardBehaviorData.push([e,t])}}],n&&Ce(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e;var t,n}();ge=We,We.m_mouseMoveBehaviorData=void 0,We.m_clickBehaviorData=void 0,We.mouseMoveBehaviorData=void 0,We.mouseActionBehaviorData=void 0,We.clickBehaviorData=void 0,We.keyboardBehaviorData=void 0,We.onClickBehaviorData=void 0,We.onInputBehaviorData=void 0,We.clipboardBehaviorData=void 0,We.m_mouseMoveEventListener=function(e){if(e.touches&&e.touches.length>0){var t=b(),n=e.touches[0],r=n.clientX,a=n.clientY;ge.add_m_mouseMoveBehavior(t,r,a)}},We.m_clickEventListener=function(e){if(e.touches&&e.touches.length>0){var t=b(),n=e.touches[0],r=n.clientX,a=n.clientY,s=Se(e);ge.add_m_clickBehavior(s,t,r,a)}},We.mouseMoveEventListener=function(e){var t=b(),n=e.clientX,r=e.clientY;ge.addMouseMoveBehavior(t,n,r)},We.mouseDownEventListener=function(e){var t=b(),n=e.clientX,r=e.clientY,a=function(e){switch(e.which){case 3:return ke.RightClick;case 2:return ke.WheelClick;default:return ke.LeftClick}}(e);ge.addMouseActionBehavior(a,t,n,r);var s=Se(e);ge.addClickBehavior(s,t,n,r)},We.mouseDblclickEventListener=function(e){var t=b(),n=e.clientX,r=e.clientY;ge.addMouseActionBehavior(ke.LeftDoubleClick,t,n,r)},We.onClickEventListener=function(e){var t=b(),n=e.clientX,r=e.clientY;ge.addOnClickBehavior(t,n,r)},We.onInputEventListener=function(e){var t,n=b();ge.addOnInputBehavior(n,(null==e||null===(t=e.target)||void 0===t||null===(t=t.value)||void 0===t?void 0:t.length)||0)},We.onCopyEventListener=function(e){var t=b();ge.addClipboardBehavior(t,Ae.copy)},We.onCutEventListener=function(e){var t=b();ge.addClipboardBehavior(t,Ae.cut)},We.onPasteEventListener=function(e){var t=b();ge.addClipboardBehavior(t,Ae.paste)},We.keyUpEventListener=function(){var e=b();ge.addKeyboardBehavior(xe.KeyUp,e)},We.keyDownEventListener=function(){var e=b();ge.addKeyboardBehavior(xe.KeyDown,e)},We.init();var _e,Te=n(610);function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){Re(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Re(e,t,n){return(t=Me(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $e(){$e=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},i=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(R){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var s=t&&t.prototype instanceof y?t:y,i=Object.create(s.prototype),o=new N(r||[]);return a(i,"_invoke",{value:I(e,n,o)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}t.wrap=c;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",g={};function y(){}function b(){}function v(){}var A={};u(A,i,(function(){return this}));var x=Object.getPrototypeOf,k=x&&x(x(E([])));k&&k!==n&&r.call(k,i)&&(A=k);var w=v.prototype=y.prototype=Object.create(A);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(a,s,i,o){var l=d(e[a],e,s);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,i,o)}),(function(e){n("throw",e,i,o)})):t.resolve(c).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,o)}))}o(l.arg)}var s;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return s=s?s.then(a,a):a()}})}function I(t,n,r){var a=h;return function(s,i){if(a===f)throw new Error("Generator is already running");if(a===m){if("throw"===s)throw i;return{value:e,done:!0}}for(r.method=s,r.arg=i;;){var o=r.delegate;if(o){var l=W(o,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=f;var u=d(t,n,r);if("normal"===u.type){if(a=r.done?m:p,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=m,r.method="throw",r.arg=u.arg)}}}function W(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,W(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var s=d(a,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,g;var i=s.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,s=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=v,a(w,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:b,configurable:!0}),b.displayName=u(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},S(C.prototype),u(C.prototype,o,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,a,s){void 0===s&&(s=Promise);var i=new C(c(e,n,r,a),s);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(w),u(w,l,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=E,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],o=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:E(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Oe(e,t,n,r,a,s,i){try{var o=e[s](i),l=o.value}catch(u){return void n(u)}o.done?t(l):Promise.resolve(l).then(r,a)}function Fe(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var s=e.apply(t,n);function i(e){Oe(s,r,a,i,o,"next",e)}function o(e){Oe(s,r,a,i,o,"throw",e)}i(void 0)}))}}function De(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Me(r.key),r)}}function Me(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Le(e,t,n,r){return ze(e,t),Pe(n,"set"),function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,n,r),r}function Be(e,t,n){return ze(e,t),Pe(n,"get"),r=e,(a=n).get?a.get.call(r):a.value;var r,a}function Pe(e,t){if(void 0===e)throw new TypeError("attempted to "+t+" private static field before its declaration")}function ze(e,t){if(e!==t)throw new TypeError("Private static access of wrong provenance")}var Ge=function(e,t){function n(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n)}return r=n,s=[{key:"getAllEncrypted",value:function(t){return(e=e||Fe($e().mark((function e(t){var n;return $e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.collectBrowserInfo();case 2:return e.next=4,this.getAll();case 4:return n=e.sent,e.abrupt("return",this.doEncrypt(t,n));case 6:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}},{key:"syncGetAllEncrypted",value:function(e){var t=this.getAll();return this.doEncrypt(e,t)}},{key:"collectBrowserInfo",value:function(){return(t=t||Fe($e().mark((function e(){var t;return $e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Be(n,n,Ve)){e.next=11;break}return e.prev=1,e.next=4,ie();case 4:t=e.sent,Le(this,n,Ve,Ee({},t)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),Le(this,n,Ve,{error_trap:`${e.t0.name}/${e.t0.message}`});case 11:case"end":return e.stop()}}),e,this,[[1,8]])})))).apply(this,arguments)}},{key:"doEncrypt",value:function(e,t){var n=JSON.stringify(t),r=f()(n).toString().slice(-6),s=function(e){for(var t="",n=0;n<e.length;n++){var r=(255&e[n]).toString(16);t+=r=1===r.length?"0"+r:r}return w().parse(t)}((0,Te.Wt)(n)),o=i().parse("Yp22&mqMv#3t28Zh"),u=a().encrypt(s,o,{mode:h(),padding:l()}).ciphertext;return[e,m,r,c().stringify(u)].join("_")}},{key:"getBrowserInfoCompact",value:function(){var e,t,r,a;return Be(n,n,Ve)?{is_init_suceess:1,requestTime:b(),userAgent:null===(e=Be(n,n,Ve))||void 0===e?void 0:e.userAgent,screen:[Be(n,n,Ve).screenWidth,Be(n,n,Ve).screenHeight,Be(n,n,Ve).screenAvailWidth,Be(n,n,Ve).screenAvailHeight,Be(n,n,Ve).screenTop,Be(n,n,Ve).screenLeft,Be(n,n,Ve).screenX,Be(n,n,Ve).screenY,Be(n,n,Ve).screenAvailLeft,Be(n,n,Ve).screenAvailTop,Be(n,n,Ve).outerWidth,Be(n,n,Ve).outerHeight,Be(n,n,Ve).innerWidth,Be(n,n,Ve).innerHeight],dev:[Be(n,n,Ve).platform,Be(n,n,Ve).vendor,Be(n,n,Ve).product,Be(n,n,Ve).productSub,(null===(t=Be(n,n,Ve).devicePixelRatio)||void 0===t?void 0:t.toString())||""],env:[Be(n,n,Ve).fonts.length,Be(n,n,Ve).browserLanguages.length,Be(n,n,Ve).pluginsLength,Be(n,n,Ve).timezone,null!==(r=Be(n,n,Ve).deviceMemory)&&void 0!==r?r:-1,null!==(a=Be(n,n,Ve).hardwareConcurrency)&&void 0!==a?a:-1,Be(n,n,Ve).touchSupport.maxTouchPoints,Be(n,n,Ve).touchSupport.touchEvent?1:0,Be(n,n,Ve).touchSupport?1:0,Be(n,n,Ve).netEnabled?1:0,Be(n,n,Ve).javaEnabled?1:0,Be(n,n,Ve).cookieEnabled?1:0,Be(n,n,Ve).is_cookie,Be(n,n,Ve).isContradiction,Be(n,n,Ve).functionAllSettled?1:0,Be(n,n,Ve).functionBigInt?1:0,Be(n,n,Ve).functionFinally?1:0,Be(n,n,Ve).adBlock?1:0,Be(n,n,Ve).addBehavior?1:0,Be(n,n,Ve).console?1:0,Be(n,n,Ve).canvas2DFP?1:0,Be(n,n,Ve).canvas3DFP?1:0,Be(n,n,Ve).openDatabase?1:0,Be(n,n,Ve).storageLocal?1:0,Be(n,n,Ve).storageSession?1:0,Be(n,n,Ve).storageIndexedDB?1:0,Be(n,n,Ve).doNotTrack?1:0,Be(n,n,Ve).webdriver?1:0,Be(n,n,Ve).flash?1:0],lang:[Be(n,n,Ve).timezoneName,Be(n,n,Ve).browserLanguage],site:Be(n,n,Ve).site,error_trap:Be(n,n,Ve).error_trap||""}:{is_init_suceess:0,requestTime:b()}}},{key:"getAll",value:function(){try{var e=We.getBehaviorData(),t=this.getBrowserInfoCompact();return new x(e,t)}catch(n){return{a1:m,a2:y(),a14:b(),a20:`${n.name}/${n.message}`}}}}],s&&De(r,s),Object.defineProperty(r,"prototype",{writable:!1}),n;var r,s}(),Ve={writable:!0,value:void 0};function Ue(e){return(_e=_e||Fe($e().mark((function e(t){return $e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ge.getAllEncrypted(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function He(e){return Ge.syncGetAllEncrypted(e)}Fe($e().mark((function e(){return $e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ge.collectBrowserInfo();case 2:(0,Te.Wt)("{}");case 3:case"end":return e.stop()}}),e)})))()}(),r}()},"object"==typeof exports&&"object"==typeof module?module.exports=gQ():"function"==typeof define&&define.amd?define([],gQ):"object"==typeof exports?exports.AntiIn=gQ():mQ.AntiIn=gQ();const yQ={class:"1688-search"},bQ={class:"filter-wrap"},vQ={class:"filter-item"},AQ={class:"filter-item"},xQ={key:0,class:"ad-wrap"},kQ={class:"list-wrap"},wQ=["href"],SQ={class:"info-wrap"},CQ=["src"],IQ={class:"title"},WQ=["innerHTML"],_Q={class:"price-wrap"},TQ={class:"price"},NQ={class:"prefix"},EQ={key:0,class:"sold"},RQ={key:0,class:"mall-wrap"},$Q=["innerHTML"],OQ=["innerHTML"],FQ={key:1,class:"error-tip"},DQ={class:"left"},MQ={class:"center"},LQ={class:"sub-title"},BQ={class:"right"},PQ=["href"],zQ={key:2,class:"error-tip"},GQ={class:"left"},VQ={class:"center"},UQ={class:"sub-title"},HQ={class:"right"},jQ={key:3,class:"loading-wrap"},qQ={class:"text"},QQ={key:4,style:{padding:"20px"}},XQ={key:5,class:"bottom-tip"},ZQ=ye({__name:"shein",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(e,{emit:t}){be();const n=e,a=t,s=F(""),d=F(""),h=F(""),p=F([]),f=F(""),m=F("https://m.shein.com/us"),g=F("正在图搜同款"),y=J((()=>h.value?p.value.filter((e=>e.title&&e.title.includes(h.value)||e.location&&e.location.includes(h.value)||e.mall&&e.mall.includes(h.value))):p.value)),b=F(""),v=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),A=e=>{p.value=v([...p.value],e)},x=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)},k=F(!localStorage.getItem("shein-search-image-ad")),w=()=>{k.value=!1,localStorage.setItem("shein-search-image-ad",!0)};let S="";function C(){const{traceID:e}=function(){const e=`ff${function(e,t="0123456789"){let n="";for(let r=e;r>0;--r)n+=t[Math.floor(Math.random()*t.length)];return n}(14,"0123456789abcdef")}`.toString();return{traceID:e,spanID:e}}();return`${e}:${e}:0:${Math.random()<.5?1:0}`}const T=async e=>{const t=new URL(e.url),n=await window._SHEIN_CALC_SIGNATURE_(t.pathname+t.search),a=await(async e=>{const t=r();return window.postMessage({type:"getStorage",uuid:t,key:e}),await new Promise((e=>{window.addEventListener("message",(function(n){"getStorageSuccess"===n.data.type&&n.data.uuid===t&&e(n.data.data)})),setTimeout((()=>{e({error_code:1,error_msg:"请求超时"})}),3e3)}))})("sheinSignature")||{},s=(new Date).getTimezoneOffset()/60,i=`GMT${s>0?"-":"+"}${Math.abs(s)}`;return await mn({...e,timeout:6e4,headers:{accept:"application/json, text/plain, */*","X-Gw-Auth":n,"Anti-In":a["Anti-In"],"x-csrf-token":a["x-csrf-token"],armortoken:a.armortoken,SmDeviceId:a.SmDeviceId,"Uber-Trace-Id":C(),timezone:i,"x-requested-with":"XMLHttpRequest"}})},N=async()=>{if("loading"==s.value||"finish"==s.value)return;a("update:loading",!0),s.value="loading",g.value="正在图搜同款",await yn({removeRuleIds:[3001],addRules:[{condition:{resourceTypes:["xmlhttprequest"],urlFilter:"https://m.shein.com/us"},action:{requestHeaders:[{header:"sec-fetch-site",operation:"set",value:"same-origin"},{header:"Referer",operation:"set",value:"https://m.shein.com/us/presearch?ref=m&ref=m&rep=dir&rep=dir"},{header:"Origin",operation:"set",value:"https://m.shein.com"}],type:"modifyHeaders"},id:3001}]});const e=await T({method:"POST",url:"https://m.shein.com/us/bff-api/setting/upload_image?_ver=1.1.8&_lang=en",credentials:"same-origin",form:{image:{url:n.imgUrl,filename:"image.jpeg",type:"image/jpeg"}}});return e.error_code&&0!==e.error_code||"0"!=e.code?(s.value="error",d.value="1.Shein必须国外网络访问,请启动VPN\n2.点击右侧[打开Shein],进入页面后,随便打开几个商品,然后返回本页面",a("update:loading",!1),!1):(S=e.info.path.replace(/https?:/,""),!0)},E=async()=>{let e;if(a("update:loading",!0),s.value="loading",g.value="正在图搜同款",e=await T({url:"https://m.shein.com/us/api/recommend/camera/get?_ver=1.1.8&_lang=en",method:"POST",credentials:"same-origin",form:{image:S,req_num:300,scene_id:80,rule_id:"rec_ver:S80T6.3A",ignore_goods_list:"",result_type:""}}),e.error_code&&0!==e.error_code||0!==e.code)return s.value="error",d.value="1.Shein必须国外网络访问,请启动VPN\n2.点击右侧[打开Shein],进入页面后,随便打开几个商品,然后返回本页面",void a("update:loading",!1);if(0===e.info.products.length)return s.value="finish",void a("update:loading",!1);let t=[];for(const r of e.info.products)t=t.concat(...r.ads);let n=t.map(((e,t)=>{var n;return{index:t,title:e.goods_name,price:W(e.salePrice.amountWithSymbol),currency:_(e.salePrice.amountWithSymbol),thumb:e.goods_img,url:`https://www.shein.com/temushuju-com-p-${e.goods_id}-cat-${e.cat_id}.html`,mall:"Shein",location:`${(null==(n=null==e?void 0:e.starComment)?void 0:n.comment_num)||0}人评价`}}));n=v(n,b.value),p.value=p.value.concat(n),s.value="finish",a("update:loading",!1)},R=async()=>{"visible"===document.visibilityState&&"error"===s.value&&await N()&&await E()},O=async()=>{p.value=[],s.value="",await N()&&await E()};return ue((async()=>{const e=await I();if(e.error_code)return s.value="install-error",void(d.value="您还没有安装插件,请点击'下载插件'进行安装");f.value=e.version,await N()&&await E(),document.addEventListener("visibilitychange",R)})),ve((()=>{document.removeEventListener("visibilitychange",R)})),(e,t)=>{const n=i,r=o,a=l,p=Oe,f=Ne,v=Ke,S=Ee("router-link"),C=u,I=Re;return Ae(),xe("div",yQ,[ke("div",bQ,[ke("span",vQ,[t[5]||(t[5]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:b.value,"onUpdate:value":t[0]||(t[0]=e=>b.value=e),style:{width:"130px"},onChange:A},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[4]||(t[4]=[Se("价格从高到低")]))),_:1})])),_:1},8,["value"])]),ke("span",AQ,[t[6]||(t[6]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题",style:{width:"200px"}},null,8,["value"])])]),k.value?(Ae(),xe("div",xQ,[t[7]||(t[7]=ke("a",{href:"https://www.sheinshuju.com/download",target:"_blank"},[ke("img",{src:"/assets/shein-banner-919d23d5.jpg"})],-1)),$(Ie(Ve),{class:"close-icon",onClick:Ge(w,["prevent","stop"])})])):Te("",!0),ke("div",kQ,[(Ae(!0),xe(D,null,Ce(y.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",SQ,[ke("img",{src:e.thumb,class:"thumb"},null,8,CQ),ke("div",IQ,[e.tag?(Ae(),$e(p,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:x(e.title,h.value)},null,8,WQ)]),ke("div",_Q,[ke("span",TQ,[ke("span",NQ,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",EQ,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",RQ,[ke("span",{class:"mall",innerHTML:x(e.mall,h.value)},null,8,$Q),ke("span",{class:"location",innerHTML:x(e.location,h.value)},null,8,OQ)])):Te("",!0)],8,wQ)))),128))]),"error"===s.value?(Ae(),xe("div",FQ,[ke("div",DQ,[$(Ie(We),{class:"icon"})]),ke("div",MQ,[t[8]||(t[8]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",LQ,_e(d.value),1)]),ke("div",BQ,[$(v,null,{default:we((()=>[ke("a",{target:"_blank",href:m.value},[$(f,{type:"primary"},{default:we((()=>t[9]||(t[9]=[Se(" 打开Shein ")]))),_:1})],8,PQ),$(f,{onClick:O},{default:we((()=>t[10]||(t[10]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===s.value?(Ae(),xe("div",zQ,[ke("div",GQ,[$(Ie(We),{class:"icon"})]),ke("div",VQ,[t[11]||(t[11]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",UQ,_e(d.value),1)]),ke("div",HQ,[$(v,null,{default:we((()=>[$(S,{target:"_blank",to:"/download"},{default:we((()=>[$(f,{type:"primary"},{default:we((()=>t[12]||(t[12]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===s.value||""===s.value?(Ae(),xe("div",jQ,[$(C,{size:"large"}),ke("span",qQ,_e(g.value),1)])):Te("",!0),"success"!==s.value&&"finish"!==s.value||0!==y.value.length?Te("",!0):(Ae(),xe("div",QQ,[$(I,{description:"没有搜索到商品"})])),"finish"===s.value&&y.value.length>0?(Ae(),xe("div",XQ,t[13]||(t[13]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-5ed42ea0"]]),KQ={class:"1688-search"},JQ={class:"filter-wrap"},YQ={class:"filter-item"},eX={class:"filter-item"},tX={class:"filter-item"},nX={class:"list-wrap"},rX=["href"],aX={class:"info-wrap"},sX=["src"],iX={class:"title"},oX=["innerHTML"],lX={class:"price-wrap"},uX={class:"price"},cX={class:"prefix"},dX={key:0,class:"sold"},hX={key:0,class:"mall-wrap"},pX=["innerHTML"],fX=["innerHTML"],mX={key:0,class:"error-tip"},gX={class:"left"},yX={class:"center"},bX={class:"sub-title"},vX={class:"right"},AX=["href"],xX={key:1,class:"error-tip"},kX={class:"left"},wX={class:"center"},SX={class:"sub-title"},CX={class:"right"},IX={key:2,class:"loading-wrap"},WX={class:"text"},_X={key:3,style:{padding:"20px"}},TX={key:4,class:"bottom-tip"},NX=ye({__name:"amazon",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(e,{emit:t}){be();const n=e,r=t,a=F(""),s=F(""),d=F(""),h=F([]),p=F(""),f=F("正在图搜同款"),m=J((()=>d.value?h.value.filter((e=>e.title&&e.title.includes(d.value)||e.location&&e.location.includes(d.value)||e.mall&&e.mall.includes(d.value))):h.value)),g=F(""),y=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),b=e=>{h.value=y([...h.value],e)},v=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)};let A=F("https://www.amazon.com"),x=[];const k=async()=>{if("loading"!=a.value&&"finish"!=a.value){r("update:loading",!0),a.value="loading",f.value="正在图搜同款";try{const e=await mn({method:"GET",url:`${A.value}/shopthelook`,credentials:"same-origin",contentType:"text",headers:{accept:"application/json, text/plain, */*","content-type":"application/json;charset=UTF-8"}}),t=/(<input type='hidden' name='stylesnap' value=')(.*)(' \/>)/,r=e.match(t)[2],a=await mn({method:"POST",url:`${A.value}/stylesnap/upload?stylesnapToken=${encodeURIComponent(r)}`,credentials:"same-origin",form:{"explore-looks.jpg":{url:n.imgUrl,filename:"explore-looks.jpg"}}});x=[];for(const n of a.searchResults)x=x.concat(n.bbxAsinMetadataList);return!0}catch(e){return a.value="error",s.value="1.请登录亚马逊后再进行搜索\n2.可能搜索频繁,请稍后再试\n3.需要输入验证码,请登录亚马逊网站进行验证",r("update:loading",!1),!1}}},w=async()=>{r("update:loading",!0),a.value="loading",f.value="正在图搜同款";let e=x.map(((e,t)=>({index:t,title:e.title,price:e.price?W(e.price):"-",currency:e.price?_(e.price):"-",thumb:e.imageUrl,url:`${A.value}/dp/${e.asin}`,mall:"亚马逊",location:e.byLine||"-"})));e=y(e,g.value),h.value=h.value.concat(e),a.value="finish",r("update:loading",!1)},S=async()=>{"visible"===document.visibilityState&&"error"===a.value&&await k()&&await w()},C=async()=>{h.value=[],a.value="",await k()&&await w()};return ue((async()=>{const e=await fn();if(e.error_code)return a.value="install-error",void(s.value="您还没有安装插件,请点击'下载插件'进行安装");p.value=e.version,await k()&&await w(),document.addEventListener("visibilitychange",S)})),ve((()=>{document.removeEventListener("visibilitychange",S)})),(e,t)=>{const n=i,r=o,h=l,p=Oe,y=Ne,x=Ke,k=Ee("router-link"),w=u,S=Re;return Ae(),xe("div",KQ,[ke("div",JQ,[ke("span",YQ,[t[9]||(t[9]=ke("span",{class:"label"},"站点:",-1)),$(r,{value:Ie(A),"onUpdate:value":t[0]||(t[0]=e=>je(A)?A.value=e:A=e),style:{width:"100px"},onChange:C},{default:we((()=>[$(n,{value:"https://www.amazon.com"},{default:we((()=>t[3]||(t[3]=[Se("美国")]))),_:1}),$(n,{value:"https://www.amazon.co.uk"},{default:we((()=>t[4]||(t[4]=[Se("英国")]))),_:1}),$(n,{value:"https://www.amazon.co.jp"},{default:we((()=>t[5]||(t[5]=[Se("日本")]))),_:1}),$(n,{value:"https://www.amazon.es"},{default:we((()=>t[6]||(t[6]=[Se("西班牙")]))),_:1}),$(n,{value:"https://www.amazon.fr"},{default:we((()=>t[7]||(t[7]=[Se("法国")]))),_:1}),$(n,{value:"https://www.amazon.it"},{default:we((()=>t[8]||(t[8]=[Se("意大利")]))),_:1})])),_:1},8,["value"])]),ke("span",eX,[t[13]||(t[13]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:g.value,"onUpdate:value":t[1]||(t[1]=e=>g.value=e),style:{width:"130px"},onChange:b},{default:we((()=>[$(n,{value:""},{default:we((()=>t[10]||(t[10]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[11]||(t[11]=[Se("价格从低到高")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[12]||(t[12]=[Se("价格从高到低")]))),_:1})])),_:1},8,["value"])]),ke("span",tX,[t[14]||(t[14]=ke("span",{class:"label"},"筛选:",-1)),$(h,{value:d.value,"onUpdate:value":t[2]||(t[2]=e=>d.value=e),placeholder:"商品标题",style:{width:"200px"}},null,8,["value"])])]),ke("div",nX,[(Ae(!0),xe(D,null,Ce(m.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",aX,[ke("img",{src:e.thumb,class:"thumb"},null,8,sX),ke("div",iX,[e.tag?(Ae(),$e(p,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:v(e.title,d.value)},null,8,oX)]),ke("div",lX,[ke("span",uX,[ke("span",cX,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",dX,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",hX,[ke("span",{class:"mall",innerHTML:v(e.mall,d.value)},null,8,pX),ke("span",{class:"location",innerHTML:v(e.location,d.value)},null,8,fX)])):Te("",!0)],8,rX)))),128))]),"error"===a.value?(Ae(),xe("div",mX,[ke("div",gX,[$(Ie(We),{class:"icon"})]),ke("div",yX,[t[15]||(t[15]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",bX,_e(s.value),1)]),ke("div",vX,[$(x,null,{default:we((()=>[ke("a",{target:"_blank",href:Ie(A)},[$(y,{type:"primary"},{default:we((()=>t[16]||(t[16]=[Se(" 登录亚马逊 ")]))),_:1})],8,AX),$(y,{onClick:C},{default:we((()=>t[17]||(t[17]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===a.value?(Ae(),xe("div",xX,[ke("div",kX,[$(Ie(We),{class:"icon"})]),ke("div",wX,[t[18]||(t[18]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",SX,_e(s.value),1)]),ke("div",CX,[$(x,null,{default:we((()=>[$(k,{target:"_blank",to:"/download"},{default:we((()=>[$(y,{type:"primary"},{default:we((()=>t[19]||(t[19]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===a.value||""===a.value?(Ae(),xe("div",IX,[$(w,{size:"large"}),ke("span",WX,_e(f.value),1)])):Te("",!0),"success"!==a.value&&"finish"!==a.value||0!==m.value.length?Te("",!0):(Ae(),xe("div",_X,[$(S,{description:"没有搜索到商品"})])),"finish"===a.value&&m.value.length>0?(Ae(),xe("div",TX,t[20]||(t[20]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-388cb41e"]]),EX={class:"1688xunyuantong-search"},RX={class:"filter-wrap"},$X={class:"filter-item"},OX={class:"filter-item"},FX={class:"list-wrap"},DX=["href"],MX={class:"info-wrap"},LX=["src"],BX={class:"title"},PX=["innerHTML"],zX={class:"price-wrap"},GX={class:"price"},VX={class:"prefix"},UX={key:0,class:"sold"},HX={key:0,class:"mall-wrap"},jX=["innerHTML"],qX=["innerHTML"],QX={key:0,class:"error-tip"},XX={class:"left"},ZX={class:"center"},KX={class:"sub-title"},JX={class:"right"},YX={key:1,class:"error-tip"},eZ={class:"left"},tZ={class:"center"},nZ={class:"sub-title"},rZ={class:"right"},aZ={key:2,class:"loading-wrap"},sZ={class:"text"},iZ={key:3,style:{padding:"20px"}},oZ={key:4,class:"bottom-tip"},lZ=ye({__name:"aliexpress",props:{imgUrl:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["update:loading"],setup(t,{emit:n}){be();const r=t,a=n,s=F(""),d=F(""),h=F(""),p=F([]),f=F("正在图搜同款"),m=J((()=>h.value?p.value.filter((e=>e.title&&e.title.includes(h.value)||e.location&&e.location.includes(h.value)||e.mall&&e.mall.includes(h.value))):p.value)),g=F(""),y=(e,t)=>("price-min-max"===t?e.sort(((e,t)=>e.price-t.price)):"sold-max-min"===t?e.sort(((e,t)=>t.sold-e.sold)):"price-max-min"===t?e.sort(((e,t)=>t.price-e.price)):"sold-min-max"===t?e.sort(((e,t)=>e.sold-t.sold)):"similar"===t?e.sort(((e,t)=>e.similarity-t.similarity)):e.sort(((e,t)=>e.index-t.index)),e),b=e=>{p.value=y([...p.value],e)},v=(e,t)=>{if(!t)return e;const n=new RegExp(t,"gi");return e.replace(n,`<span class="mark">${t}</span>`)};let A="";const x=async()=>{A=1,p.value=[],s.value="",await w()&&await S()},w=async()=>{if("loading"==s.value||"finish"==s.value)return;a("update:loading",!0),s.value="loading",f.value="正在图搜同款";const e=await fetch(r.imgUrl),t=await e.blob(),n=new File([t],"filename.jpg",{type:"image/jpeg"});return A=await k(n),!0},S=async()=>{a("update:loading",!0),s.value="loading",f.value="正在图搜同款";const t=new FormData;let n;t.append("file",A);for(let r=0;r<3&&(n=await e.post("/api/v1/union/search-image/aliexpress",t),1==n.data.code);r++);if(0!==n.data.code)return 1===n.data.code?(s.value="finish",void a("update:loading",!1)):(s.value="error",d.value=n.data.msg,void a("update:loading",!1));{let e=n.data.data.map(((e,t)=>({index:t,title:e.product_title,price:e.sale_price,currency:"$",sold:W(e.lastest_volume),thumb:e.product_main_image_url,url:e.product_detail_url,mall:"速卖通",location:e.second_level_category_name})));e=y(e,g.value),p.value=p.value.concat(e),s.value="finish",a("update:loading",!1)}},C=async()=>{"visible"===document.visibilityState&&"error"===s.value&&await w()&&await S()};return ue((async()=>{document.addEventListener("visibilitychange",C),await w()&&await S()})),ve((()=>{document.removeEventListener("visibilitychange",C)})),(e,t)=>{const n=i,r=o,a=l,p=Oe,y=Ne,A=Ke,k=Ee("router-link"),w=u,S=Re;return Ae(),xe("div",EX,[ke("div",RX,[ke("span",$X,[t[5]||(t[5]=ke("span",{class:"label"},"排序:",-1)),$(r,{value:g.value,"onUpdate:value":t[0]||(t[0]=e=>g.value=e),style:{width:"130px"},onChange:b},{default:we((()=>[$(n,{value:""},{default:we((()=>t[2]||(t[2]=[Se("默认排序")]))),_:1}),$(n,{value:"price-min-max"},{default:we((()=>t[3]||(t[3]=[Se("价格从低到高")]))),_:1}),$(n,{value:"price-max-min"},{default:we((()=>t[4]||(t[4]=[Se("价格从高到低")]))),_:1})])),_:1},8,["value"])]),ke("span",OX,[t[6]||(t[6]=ke("span",{class:"label"},"筛选:",-1)),$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 / 品类",style:{width:"200px"}},null,8,["value"])])]),ke("div",FX,[(Ae(!0),xe(D,null,Ce(m.value,((e,t)=>(Ae(),xe("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[ke("div",MX,[ke("img",{src:e.thumb,class:"thumb"},null,8,LX),ke("div",BX,[e.tag?(Ae(),$e(p,{key:0,color:"orange"},{default:we((()=>[Se(_e(e.tag),1)])),_:2},1024)):Te("",!0),ke("span",{innerHTML:v(e.title,h.value)},null,8,PX)]),ke("div",zX,[ke("span",GX,[ke("span",VX,_e(e.currency),1),Se(_e(e.price),1)]),e.sold?(Ae(),xe("span",UX,"已售出 "+_e(Ie(c)(e.sold))+" 件",1)):Te("",!0)])]),e.mall||e.location?(Ae(),xe("div",HX,[ke("span",{class:"mall",innerHTML:v(e.mall,h.value)},null,8,jX),ke("span",{class:"location",innerHTML:v(e.location,h.value)},null,8,qX)])):Te("",!0)],8,DX)))),128))]),"error"===s.value?(Ae(),xe("div",QX,[ke("div",XX,[$(Ie(We),{class:"icon"})]),ke("div",ZX,[t[7]||(t[7]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",KX,_e(d.value),1)]),ke("div",JX,[$(A,null,{default:we((()=>[$(y,{onClick:x},{default:we((()=>t[8]||(t[8]=[Se(" 重新搜索 ")]))),_:1})])),_:1})])])):Te("",!0),"install-error"===s.value?(Ae(),xe("div",YX,[ke("div",eZ,[$(Ie(We),{class:"icon"})]),ke("div",tZ,[t[9]||(t[9]=ke("div",{class:"title"}," 提示 ",-1)),ke("div",nZ,_e(d.value),1)]),ke("div",rZ,[$(A,null,{default:we((()=>[$(k,{target:"_blank",to:"/download"},{default:we((()=>[$(y,{type:"primary"},{default:we((()=>t[10]||(t[10]=[Se(" 下载插件 ")]))),_:1})])),_:1})])),_:1})])])):Te("",!0),"loading"===s.value||""===s.value?(Ae(),xe("div",aZ,[$(w,{size:"large"}),ke("span",sZ,_e(f.value),1)])):Te("",!0),"success"!==s.value&&"finish"!==s.value||0!==m.value.length?Te("",!0):(Ae(),xe("div",iZ,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&m.value.length>0?(Ae(),xe("div",oZ,t[11]||(t[11]=[ke("span",null,"没有更多了",-1)]))):Te("",!0)])}}},[["__scopeId","data-v-aafe3dda"]]),uZ={class:"search-image-wrap"},cZ={class:"content-wrap"},dZ={class:"info-card"},hZ={class:"price-info"},pZ={key:0,class:"item"},fZ={class:"label"},mZ={class:"value"},gZ={key:0},yZ={key:1},bZ={key:1,class:"item"},vZ={class:"label"},AZ={class:"value"},xZ={key:2,class:"item"},kZ={class:"label"},wZ={class:"value"},SZ={key:3,class:"item"},CZ={class:"label"},IZ={class:"value"},WZ={style:{"margin-top":"5px"}},_Z={class:"tab-wrap"},TZ={key:0,class:"search-result"},NZ={__name:"index",setup(t){let n=be();const r=F(null),a=F(""),s=F(!0),i=F(!1),o=()=>{const t=document.createElement("input");t.type="file",t.accept="image/*",t.onchange=async t=>{const n=t.target.files[0];if(!n)return;if(!n.type.includes("image"))return void Ue.error("请选择图片文件");i.value=!0;const r=new FormData;r.append("file",await k(n));const a=await e.post("/api/v1/goods/upload-image",r);0===a.data.code?location.href=`/plugin/search-image?url=${a.data.data.url}`:Ue.error(a.data.msg),i.value=!1},t.click()},l=F(!1),u=async()=>{if(r.value.startsWith("data:image")){const t=await fetch(r.value).then((e=>e.blob())),a=new File([t],"image.png",{type:"image/png"});l.value=!0;const s=new FormData;s.append("file",await k(a,500));const i=await e.post("/api/v1/goods/upload-image",s);0===i.data.code?window.open(`https://www.alisold.com/plugin/search-infringement/result?url=${encodeURIComponent(i.data.data.url)}&text=${encodeURIComponent(n.query.title||"")}`):Ue.error(i.data.msg),l.value=!1}else window.open(`https://www.alisold.com/plugin/search-infringement/result?url=${encodeURIComponent(r.value)}&text=${encodeURIComponent(n.query.title||"")}`)},c=F(null),d=F(null),h=F(null),p=F(null),f=F(null),m=F(null),g=F(null);let y=F(null);const b=e=>{if(1===e.page&&e.list.length>0){y.value=e.list[0].title;let t=e.list.slice(0,10);t.sort(((e,t)=>e.price-t.price)),p.value=t[parseInt(t.length/2)].price,h.value=Math.min(...t.map((e=>e.price))),f.value=Math.max(...t.map((e=>e.price))),(!c.value||c.value>h.value)&&(c.value=h.value),(!d.value||d.value<f.value)&&(d.value=f.value)}},v=e=>{1===e.page&&e.list.length>0&&(m.value=Math.min(...e.list.map((e=>e.price))),g.value=Math.max(...e.list.map((e=>e.price))),(!c.value||c.value>m.value)&&(c.value=m.value),(!d.value||d.value<g.value)&&(d.value=g.value))},A=e=>{a.value=e,localStorage.setItem("search-image-platform",e)};return(async()=>{const e=await I();if("base64"===n.query.from)await new Promise((e=>{const t=n=>{var a;(null==(a=null==n?void 0:n.data)?void 0:a.base64)&&(r.value=n.data.base64,window.removeEventListener("message",t),e())};window.addEventListener("message",t)}));else{const t=new Image;t.crossOrigin="Anonymous";let a=n.query.url;a.startsWith("https://")||a.startsWith("http://")||(a="https://"+a),await new Promise((n=>{t.onload=function(){r.value=a,n()},t.onerror=async function(){if(e.error_code)r.value=`https://api.temushuju.com/api/v1/plugin/image?url=${encodeURIComponent(a)}`;else{const e=await mn({url:a,contentType:"base64"});r.value=e}n()},t.src=a}))}let t=localStorage.getItem("search-image-platform")||"1688xunyuantong";e.error_code&&(t="1688fenxiao"),A(t)})(),(e,t)=>{const n=T,x=He,k=Me,w=Ne,C=Ke,I=Ye,W=Je;return Ae(),xe("div",uZ,[$(qe),ke("div",cZ,[ke("div",dZ,[$(n,{width:80,src:r.value},null,8,["src"]),ke("div",hZ,[ke("div",null,[c.value&&d.value?(Ae(),xe("span",pZ,[ke("span",fZ,[t[12]||(t[12]=Se(" 供货价参考 ")),$(x,null,{title:we((()=>t[11]||(t[11]=[Se("综合1688和拼多多同款货源Top10的价格范围,基本可以参考为供货价")]))),default:we((()=>[$(Ie(S))])),_:1}),t[13]||(t[13]=Se(" : "))]),ke("span",mZ,[c.value==p.value?(Ae(),xe("span",gZ,"¥"+_e(c.value),1)):(Ae(),xe("span",yZ,"¥"+_e(c.value)+"-"+_e(p.value),1))]),$(k,{type:"vertical"})])):Te("",!0),h.value&&p.value?(Ae(),xe("span",bZ,[ke("span",vZ,[t[15]||(t[15]=Se(" 1688货源价 ")),$(x,null,{title:we((()=>t[14]||(t[14]=[Se("1688同款货源Top10的价格范围")]))),default:we((()=>[$(Ie(S))])),_:1}),t[16]||(t[16]=Se(" : "))]),ke("span",AZ,"¥"+_e(h.value)+"-"+_e(f.value),1),$(k,{type:"vertical"})])):Te("",!0),p.value?(Ae(),xe("span",xZ,[ke("span",kZ,[t[18]||(t[18]=Se(" 1688中位价 ")),$(x,null,{title:we((()=>t[17]||(t[17]=[Se("1688同款货源Top10的中位价,Temu要求供货价不得高于此价格")]))),default:we((()=>[$(Ie(S))])),_:1}),t[19]||(t[19]=Se(" : "))]),ke("span",wZ," ¥"+_e(p.value),1),$(k,{type:"vertical"})])):Te("",!0),m.value&&g.value?(Ae(),xe("span",SZ,[ke("span",CZ,[t[21]||(t[21]=Se(" 拼多多货源价 ")),$(x,null,{title:we((()=>t[20]||(t[20]=[Se("拼多多同款货源Top10的价格范围,Temu要求供货价不得高于最低价格")]))),default:we((()=>[$(Ie(S))])),_:1}),t[22]||(t[22]=Se(" : "))]),ke("span",IZ,"¥"+_e(m.value)+"-"+_e(g.value),1)])):Te("",!0)]),ke("div",WZ,[$(C,null,{default:we((()=>[$(w,{icon:De(Ie(N)),loading:i.value,onClick:o},{default:we((()=>t[23]||(t[23]=[Se(" 上传图片 ")]))),_:1},8,["icon","loading"]),$(k,{type:"vertical"}),$(w,{icon:De(Ie(Tt)),loading:l.value,onClick:u},{default:we((()=>t[24]||(t[24]=[Se(" 侵权检测 ")]))),_:1},8,["icon","loading"])])),_:1})])])]),ke("div",_Z,[$(W,{"active-key":a.value,size:"large",class:"tab",onChange:A},{default:we((()=>[$(I,{key:"1688xunyuantong",tab:"1688"}),$(I,{key:"1688",tab:"1688官网"}),$(I,{key:"1688fenxiao",tab:"1688分销"}),$(I,{key:"1688kuajing",tab:"1688跨境"}),$(I,{key:"pdd-pifa",tab:"拼多多批发"}),$(I,{key:"pdd",tab:"拼多多","force-render":""}),$(I,{key:"taobao",tab:"淘宝"}),$(I,{key:"temu",tab:"Temu"}),$(I,{key:"shein",tab:"Shein"}),$(I,{key:"amazon",tab:"亚马逊"}),$(I,{key:"aliexpress",tab:"速卖通"})])),_:1},8,["active-key"])]),r.value?(Ae(),xe("div",TZ,["1688"===a.value?(Ae(),$e(Kn,{key:0,loading:s.value,"onUpdate:loading":t[0]||(t[0]=e=>s.value=e),"img-url":r.value,onSearch:b},null,8,["loading","img-url"])):Te("",!0),"1688xunyuantong"===a.value?(Ae(),$e(Lr,{key:1,loading:s.value,"onUpdate:loading":t[1]||(t[1]=e=>s.value=e),"img-url":r.value,onSearch:b},null,8,["loading","img-url"])):Te("",!0),"1688fenxiao"===a.value?(Ae(),$e(ga,{key:2,loading:s.value,"onUpdate:loading":t[2]||(t[2]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Te("",!0),"1688kuajing"===a.value?(Ae(),$e(Xa,{key:3,loading:s.value,"onUpdate:loading":t[3]||(t[3]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Te("",!0),"pdd"===a.value?(Ae(),$e(_s,{key:4,loading:s.value,"onUpdate:loading":t[4]||(t[4]=e=>s.value=e),"img-url":r.value,onSearch:v},null,8,["loading","img-url"])):Te("",!0),"pdd-pifa"===a.value?(Ae(),$e(li,{key:5,loading:s.value,"onUpdate:loading":t[5]||(t[5]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Te("",!0),"taobao"===a.value?(Ae(),$e(Pi,{key:6,loading:s.value,"onUpdate:loading":t[6]||(t[6]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Te("",!0),"temu"===a.value?(Ae(),$e(fQ,{key:7,loading:s.value,"onUpdate:loading":t[7]||(t[7]=e=>s.value=e),"img-url":r.value,title:Ie(y)},null,8,["loading","img-url","title"])):Te("",!0),"shein"===a.value?(Ae(),$e(ZQ,{key:8,loading:s.value,"onUpdate:loading":t[8]||(t[8]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Te("",!0),"amazon"===a.value?(Ae(),$e(NX,{key:9,loading:s.value,"onUpdate:loading":t[9]||(t[9]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Te("",!0),"aliexpress"===a.value?(Ae(),$e(lZ,{key:10,loading:s.value,"onUpdate:loading":t[10]||(t[10]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Te("",!0)])):Te("",!0)]),$(Ze),$(Xe)])}}},EZ=ye(NZ,[["__scopeId","data-v-15cf22eb"]]);export{EZ as default};