import{h as e}from"./http-aa5b3f77.js";import{a as n,W as r,X as a,Y as s,Z as i,_ as o,I as l,t as u,P as c,E as d,G as h,H as p,J as f,K as m,M as g,$ as y,a0 as b,S as v,a1 as A,a2 as x,T as k,a3 as w,Q as S,a4 as C,a5 as I,a6 as W,a7 as _,V as T,O as N}from"./installCanvasRenderer-53aca79b.js";import{q as E,r as R}from"./index-21a31385.js";import{c as $,aW 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,bc as V,r as U,P as H,h as j,u as q,ca as Q,H as X,aV as Z,a$ as K,l as J,g as Y,f as ee,b as te,t as ne,bd as re,aI as ae,w as se,bu as ie,b9 as oe,W as le,I as ue,aZ as ce,bv as de,cb as he,cc as pe,aX as fe,Z as me,aR as ge,$ as ye,c2 as be,ay as ve,cd as Ae,a0 as xe,a1 as ke,a2 as we,a3 as Se,e as Ce,ce as Ie,X as We,cf as _e,c5 as Te,c0 as Ne,D as Ee,bY as Re,c3 as $e,a5 as Oe,a6 as Fe,bC as De,aS as Me,c4 as Le,c7 as Be,cg as Pe,aQ as ze,bp as Ge,bq as Ve,ch as Ue,C as He,c6 as je,bk as qe,Y as Qe,a4 as Xe}from"./index-5e8bdb09.js";import{_ as Ze,F as Ke}from"./footer-faa9e355.js";import{G as Je}from"./group-qrcode-3b9f9090.js";import{_ as Ye,T as et,a as tt}from"./index-d2b1d6ce.js";import{u as nt,r as rt}from"./RightOutlined-5a77d6c1.js";import{o as at}from"./omit-9e999427.js";import"./axios-5d9d9809.js";import"./index-21dd52ed.js";import"./isPlainObject-82fea0fb.js";function st(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 it(e){return null!=e}const ot=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`]:it(o),[`${t}-item-content`]:it(l)}],colSpan:r},{default:()=>[it(o)&&$("span",{style:a},[o]),it(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])])]})},lt=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?$(ot,{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):[$(ot,{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),$(ot,{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(mt,{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})])},ut=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}}}}},ct=e=>{const{componentCls:t,descriptionsExtraColor:n,descriptionItemPaddingBottom:r,descriptionsItemLabelColonMarginRight:a,descriptionsItemLabelColonMarginLeft:s,descriptionsTitleMarginBottom:i}=e;return{[t]:P(P(P({},U(e)),ut(e)),{"&-rtl":{direction:"rtl"},[`${t}-header`]:{display:"flex",alignItems:"center",marginBottom:i},[`${t}-title`]:P(P({},V),{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}}}})}},dt=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[ct(c)]}));H.any;const ht=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)}}}),pt={xxxl:3,xxl:3,xl:3,lg:3,md:3,sm:2,xs:1};function ft(e,t,n){let r=e;return(void 0===n||n>t)&&(r=te(e,{span:t}),ne()),r}const mt=Symbol("descriptionsContext"),gt=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:()=>pt},layout:String,colon:{type:Boolean,default:void 0},labelStyle:{type:Object,default:void 0},contentStyle:{type:Object,default:void 0}},slots:Object,Item:ht,setup(e,t){let{slots:n,attrs:r}=t;const{prefixCls:a,direction:s}=q("descriptions",e);let i;const o=F({}),[l,u]=dt(a),c=nt();Q((()=>{i=c.value.subscribe((t=>{"object"==typeof e.column&&(o.value=t)}))})),X((()=>{c.value.unsubscribe(i)})),Z(mt,{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<rt.length;n++){const r=rt[n];if(t[r]&&void 0!==e[r])return e[r]||pt[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(ft(e,s,l)),void r.push(a);u<s?(s-=u,a.push(e)):(a.push(ft(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)=>$(lt,{key:t,index:t,colon:f,prefixCls:a.value,vertical:"vertical"===p,bordered:h,row:e},null)))])])])]))}}});gt.install=function(e){return e.component(gt.name,gt),e.component(gt.Item.name,gt.Item),e};const yt=gt,bt=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}}}}}}},vt=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}}}},At=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}}}}},xt=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}}}}}},kt=e=>{const{componentCls:t}=e;return{[t]:P(P(P(P({},U(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"}})}},wt=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[kt(s),xt(s),At(s),vt(s),bt(s)]})),St=ie("small","default"),Ct=j({compatConfig:{MODE:3},name:"ASwitch",__ANT_SWITCH:!0,inheritAttrs:!1,props:{id:String,prefixCls:String,size:H.oneOf(St),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]=wt(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({},at(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")])])])]}))}}}),It=se(Ct);const Wt={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 _t(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){Tt(e,t,n[t])}))}return e}function Tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Nt=function(e,t){var n=_t({},e,t.attrs);return $(me,_t({},n,{icon:Wt}),null)};Nt.displayName="BugOutlined",Nt.inheritAttrs=!1;const Et=Nt;const Rt={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 $t(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){Ot(e,t,n[t])}))}return e}function Ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ft=function(e,t){var n=$t({},e,t.attrs);return $(me,$t({},n,{icon:Rt}),null)};Ft.displayName="FrownOutlined",Ft.inheritAttrs=!1;const Dt=Ft;const Mt={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 Lt(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){Bt(e,t,n[t])}))}return e}function Bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pt=function(e,t){var n=Lt({},e,t.attrs);return $(me,Lt({},n,{icon:Mt}),null)};Pt.displayName="MehOutlined",Pt.inheritAttrs=!1;const zt=Pt;const Gt={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 Vt(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){Ut(e,t,n[t])}))}return e}function Ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ht=function(e,t){var n=Vt({},e,t.attrs);return $(me,Vt({},n,{icon:Gt}),null)};Ht.displayName="SmileOutlined",Ht.inheritAttrs=!1;const jt=Ht;const qt={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 Qt(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){Xt(e,t,n[t])}))}return e}function Xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Zt=function(e,t){var n=Qt({},e,t.attrs);return $(me,Qt({},n,{icon:qt}),null)};Zt.displayName="StockOutlined",Zt.inheritAttrs=!1;const Kt=Zt;var Jt,Yt,en={exports:{}},tn={exports:{}};Jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yt={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&Yt.rotl(e,8)|4278255360&Yt.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=Yt.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(Jt.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((Jt.indexOf(e.charAt(n-1))&Math.pow(2,-2*r+8)-1)<<2*r|Jt.indexOf(e.charAt(n))>>>6-2*r);return t}},tn.exports=Yt;var nn,rn,an,sn,on,ln=tn.exports,un={utf8:{stringToBytes:function(e){return un.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(un.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("")}}},cn=un,dn=function(e){return null!=e&&(hn(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&hn(e.slice(0,0))}(e)||!!e._isBuffer)};function hn(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}nn=ln,rn=cn.utf8,an=dn,sn=cn.bin,(on=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?sn.stringToBytes(e):rn.stringToBytes(e):an(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=nn.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=on._ff,c=on._gg,d=on._hh,h=on._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 nn.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},on._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},on._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},on._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},on._blocksize=16,on._digestsize=16,en.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=nn.wordsToBytes(on(e,t));return t&&t.asBytes?n:t&&t.asString?sn.bytesToString(n):nn.bytesToHex(n)};const pn=ge(en.exports),fn=async e=>{const t=await gn();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 bn(e,200);let s=[];const i=await An({url:"https://www.1688.com"});i.error_code||s.push(...i);let o=await An({domain:"1688.com",partitionKey:{topLevelSite:"https://1688.com"}});o.error_code||s.push(...o);let l=await An({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 vn({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=pn(`${d}&${h}&${f.params.appKey}&${p}`);return f.params.sign=m.trim(),{data:await yn(f)}},mn=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"}}),gn=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)}))},yn=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)}))},bn=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)}))},vn=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)}))},An=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)}))},xn=e=>(Oe("data-v-ee557608"),e=e(),Fe(),e),kn={class:"1688-search"},wn={class:"filter-wrap"},Sn={class:"filter-item"},Cn=xn((()=>we("span",{class:"label"},"排序:",-1))),In={class:"filter-item"},Wn=xn((()=>we("span",{class:"label"},"筛选:",-1))),_n={class:"list-wrap"},Tn=["href"],Nn={class:"info-wrap"},En=["src"],Rn={class:"title"},$n=["innerHTML"],On={class:"price-wrap"},Fn={class:"price"},Dn={class:"prefix"},Mn={key:0,class:"sold"},Ln={key:0,class:"mall-wrap"},Bn=["innerHTML"],Pn=["innerHTML"],zn={key:0,class:"error-tip"},Gn={class:"left"},Vn={class:"center"},Un=xn((()=>we("div",{class:"title"}," 提示 ",-1))),Hn={class:"sub-title"},jn={class:"right"},qn={href:"https://www.1688.com",target:"_blank"},Qn={key:1,class:"error-tip"},Xn={class:"left"},Zn={class:"center"},Kn=xn((()=>we("div",{class:"title"}," 提示 ",-1))),Jn={class:"sub-title"},Yn={class:"right"},er={key:2,class:"loading-wrap"},tr={class:"text"},nr={key:3,style:{padding:"20px"}},rr={key:4,class:"bottom-tip"},ar=[xn((()=>we("span",null,"没有更多了",-1)))],sr=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 fn(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 fn(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(_X){p.value="error",f.value="请重新尝试搜索,或稍后再试",h("update:loading",!1)}}};return ue((async()=>{const e=await gn();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=De,d=Ee,h=Ye,g=Ae("router-link"),y=u,x=Re;return xe(),ke("div",kn,[we("div",wn,[we("span",Sn,[Cn,$(r,{value:A.value,"onUpdate:value":t[0]||(t[0]=e=>A.value=e),style:{width:"130px"},onChange:k},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"sold-max-min"},{default:Se((()=>[Ce("销量从高到低")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1}),$(n,{value:"sold-min-max"},{default:Se((()=>[Ce("销量从低到高")])),_:1})])),_:1},8,["value"])]),we("span",In,[Wn,$(a,{value:m.value,"onUpdate:value":t[1]||(t[1]=e=>m.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),we("div",_n,[(xe(!0),ke(D,null,Ie(v.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",Nn,[we("img",{src:e.thumb,class:"thumb"},null,8,En),we("div",Rn,[e.tag?(xe(),$e(s,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:w(e.title,m.value)},null,8,$n)]),we("div",On,[we("span",Fn,[we("span",Dn,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",Mn,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",Ln,[we("span",{class:"mall",innerHTML:w(e.mall,m.value)},null,8,Bn),we("span",{class:"location",innerHTML:w(e.location,m.value)},null,8,Pn)])):Ne("",!0)],8,Tn)))),128))]),"error"===p.value?(xe(),ke("div",zn,[we("div",Gn,[$(We(_e),{class:"icon"})]),we("div",Vn,[Un,we("div",Hn,Te(f.value),1)]),we("div",jn,[$(h,null,{default:Se((()=>[we("a",qn,[$(d,{type:"primary"},{default:Se((()=>[Ce(" 打开1688 ")])),_:1})]),$(d,{onClick:_},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===p.value?(xe(),ke("div",Qn,[we("div",Xn,[$(We(_e),{class:"icon"})]),we("div",Zn,[Kn,we("div",Jn,Te(f.value),1)]),we("div",Yn,[$(h,null,{default:Se((()=>[$(g,{target:"_blank",to:"/download"},{default:Se((()=>[$(d,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===p.value||""===p.value?(xe(),ke("div",er,[$(y,{size:"large"}),we("span",tr,Te(b.value),1)])):Ne("",!0),"success"!==p.value&&"finish"!==p.value||0!==v.value.length?Ne("",!0):(xe(),ke("div",nr,[$(x,{description:"没有搜索到商品"})])),"finish"===p.value&&v.value.length>0?(xe(),ke("div",rr,ar)):Ne("",!0)])}}},[["__scopeId","data-v-ee557608"]]);d([h,p,f,m,g]);let ir=null;const or={components:{StockOutlined:Kt},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:(ir=y(this.$refs.chart),ir.setOption({xAxis:{type:"category",data:n.map((e=>Me(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)"}])}}]}))}}},lr={key:1,class:"empty-tip"},ur=(e=>(Oe("data-v-23b065e7"),e=e(),Fe(),e))((()=>we("span",null,"收录中",-1)));const cr=ye(or,[["render",function(e,t,n,r,a,s){const i=Ae("stock-outlined");return a.emptyTip?(xe(),ke("div",lr,[$(i,{class:"icon"}),ur])):(xe(),ke("div",{ref:"chart",key:n.offerId,class:"sold-line-chart-wrap"}))}],["__scopeId","data-v-23b065e7"]]),dr={class:"icon-wrap"},hr=ye({__name:"face",props:{value:{type:Number,default:0}},setup(e){const t=e;return(e,n)=>(xe(),ke("span",dr,[t.value?t.value>=4?(xe(),$e(We(jt),{key:1,class:"icon green"})):t.value>=3?(xe(),$e(We(zt),{key:2,class:"icon yellow"})):t.value<3?(xe(),$e(We(Dt),{key:3,class:"icon red"})):Ne("",!0):(xe(),$e(We(zt),{key:0,class:"icon gray"}))]))}},[["__scopeId","data-v-913dac04"]]),pr=e=>(Oe("data-v-32c7583c"),e=e(),Fe(),e),fr={class:"1688xunyuantong-search"},mr={class:"filter-wrap"},gr={class:"filter-item"},yr=pr((()=>we("span",{class:"label"},"排序:",-1))),br={class:"filter-item"},vr=pr((()=>we("span",{class:"label"},"筛选:",-1))),Ar={class:"filter-item"},xr={class:"filter-item"},kr={class:"filter-item"},wr={class:"list-wrap"},Sr=["href"],Cr={class:"info-wrap"},Ir=["src"],Wr={class:"title"},_r=["innerHTML"],Tr={class:"price-wrap"},Nr={class:"price"},Er={class:"prefix"},Rr={key:0,class:"sold"},$r={key:0,class:"mall-wrap"},Or=["innerHTML"],Fr={class:"location"},Dr=["innerHTML"],Mr={key:0,class:"error-tip"},Lr={class:"left"},Br={class:"center"},Pr=pr((()=>we("div",{class:"title"}," 提示 ",-1))),zr={class:"sub-title"},Gr={class:"right"},Vr={key:1,class:"error-tip"},Ur={class:"left"},Hr={class:"center"},jr=pr((()=>we("div",{class:"title"}," 提示 ",-1))),qr={class:"sub-title"},Qr={class:"right"},Xr={key:2,class:"loading-wrap"},Zr={class:"text"},Kr={key:3,style:{padding:"20px"}},Jr={key:4,class:"bottom-tip"},Yr=[pr((()=>we("span",null,"没有更多了",-1)))],ea=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 bn(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(_X){c.value="error",d.value="请重新尝试搜索,或稍后再试",l("update:loading",!1)}}};return ue((async()=>{if((await gn()).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=Be,l=Ee,S=De,C=ht,W=yt,_=Ze,T=Ye,N=Ae("router-link"),E=u,R=Re;return xe(),ke("div",fr,[we("div",mr,[we("span",gr,[yr,$(r,{value:f.value,"onUpdate:value":t[0]||(t[0]=e=>f.value=e),"dropdown-match-select-width":140,onChange:I},{default:Se((()=>[(xe(!0),ke(D,null,Ie(m.value,((e,t)=>(xe(),$e(n,{key:t,value:t},{default:Se((()=>[Ce(Te(e.label),1)])),_:2},1032,["value"])))),128))])),_:1},8,["value"])]),we("span",br,[vr,$(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"}}),we("span",Ar,[$(r,{value:b.value,"onUpdate:value":t[2]||(t[2]=e=>b.value=e),"dropdown-match-select-width":150,placeholder:"综合体验分","allow-clear":!0},{default:Se((()=>[$(n,{value:"totalEpScoreLv1"},{default:Se((()=>[Ce("综合体验分:5分")])),_:1}),$(n,{value:"totalEpScoreLv2"},{default:Se((()=>[Ce("综合体验分:≥4.5分")])),_:1}),$(n,{value:"totalEpScoreLv3"},{default:Se((()=>[Ce("综合体验分:≥4分")])),_:1}),$(n,{value:"totalEpScoreLv4"},{default:Se((()=>[Ce("综合体验分:>4分")])),_:1})])),_:1},8,["value"])]),we("span",xr,[$(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:Se((()=>[$(n,{value:"getRate24HLv3"},{default:Se((()=>[Ce("24小时揽收率:≥99%")])),_:1}),$(n,{value:"getRate24HLv2"},{default:Se((()=>[Ce("24小时揽收率:≥95%")])),_:1}),$(n,{value:"getRate24HLv1"},{default:Se((()=>[Ce("24小时揽收率:<95%")])),_:1}),$(n,{value:"getRate48HLv3"},{default:Se((()=>[Ce("48小时揽收率:≥99%")])),_:1}),$(n,{value:"getRate48HLv2"},{default:Se((()=>[Ce("48小时揽收率:≥95%")])),_:1}),$(n,{value:"getRate48HLv1"},{default:Se((()=>[Ce("48小时揽收率:<95%")])),_:1})])),_:1},8,["value"])]),we("span",kr,[$(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:Se((()=>[$(n,{value:"certifiedFactory"},{default:Se((()=>[Ce("认证工厂")])),_:1}),$(n,{value:"shipInToday"},{default:Se((()=>[Ce("当日发货")])),_:1}),$(n,{value:"shipIn24Hours"},{default:Se((()=>[Ce("24小时发货")])),_:1}),$(n,{value:"shipIn48Hours"},{default:Se((()=>[Ce("48小时发货")])),_:1}),$(n,{value:"noReason7DReturn"},{default:Se((()=>[Ce("7天无理由")])),_:1}),$(n,{value:"isOnePsale"},{default:Se((()=>[Ce("支持一件代发")])),_:1}),$(n,{value:"isOnePsaleFreePost"},{default:Se((()=>[Ce("支持包邮")])),_:1})])),_:1},8,["value"])]),$(s,{type:"vertical",style:{"margin-left":"10px"}}),$(l,{icon:Le(We(v)),onClick:I},{default:Se((()=>[Ce(" 搜索 ")])),_:1},8,["icon"])]),we("div",wr,[(xe(!0),ke(D,null,Ie(h.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",Cr,[we("img",{src:e.thumb,class:"thumb"},null,8,Ir),we("div",Wr,[e.isUnion?(xe(),$e(S,{key:0,color:"orange"},{default:Se((()=>[Ce("精选货源")])),_:1})):e.data.isJxhy?(xe(),$e(S,{key:1,color:"orange"},{default:Se((()=>[Ce("精选货源")])),_:1})):Ne("",!0),we("span",{innerHTML:y(e.title,g.value)},null,8,_r)]),we("div",Tr,[we("span",Nr,[we("span",Er,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",Rr,"已售出 "+Te(We(x)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",$r,[we("span",{class:"mall",innerHTML:y(e.mall,g.value)},null,8,Or),we("span",Fr,[$(_,{placement:"right",title:"日销量走势 / 店铺评价"},{content:Se((()=>[$(cr,{"offer-id":e.id},null,8,["offer-id"]),$(W,{size:"small",bordered:""},{default:Se((()=>[$(C,{label:"综合服务",style:{"font-weight":"bold"}},{default:Se((()=>[$(hr,{value:parseFloat(e.data.sellerDataInfo.compositeServiceScore)},null,8,["value"]),we("span",null,Te(e.data.sellerDataInfo.compositeServiceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"客服评价"},{default:Se((()=>[$(hr,{value:parseFloat(e.data.sellerDataInfo.consultingExperienceScore)},null,8,["value"]),we("span",null,Te(e.data.sellerDataInfo.consultingExperienceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"售后体验"},{default:Se((()=>[$(hr,{value:parseFloat(e.data.sellerDataInfo.afterSalesExperienceScore)},null,8,["value"]),we("span",null,Te(e.data.sellerDataInfo.afterSalesExperienceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"商品品质"},{default:Se((()=>[$(hr,{value:parseFloat(e.data.sellerDataInfo.offerExperienceScore)},null,8,["value"]),we("span",null,Te(e.data.sellerDataInfo.offerExperienceScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"纠纷处理"},{default:Se((()=>[$(hr,{value:parseFloat(e.data.sellerDataInfo.disputeComplaintScore)},null,8,["value"]),we("span",null,Te(e.data.sellerDataInfo.disputeComplaintScore||"-")+" 分",1)])),_:2},1024),$(C,{label:"物流时效"},{default:Se((()=>[$(hr,{value:parseFloat(e.data.sellerDataInfo.logisticsExperienceScore)},null,8,["value"]),we("span",null,Te(e.data.sellerDataInfo.logisticsExperienceScore||"-")+" 分",1)])),_:2},1024)])),_:2},1024)])),default:Se((()=>[we("span",null,[we("span",{innerHTML:y(e.location,g.value)},null,8,Dr),$(We(Pe),{class:"icon"})])])),_:2},1024)])])):Ne("",!0)],8,Sr)))),128))]),"error"===c.value?(xe(),ke("div",Mr,[we("div",Lr,[$(We(_e),{class:"icon"})]),we("div",Br,[Pr,we("div",zr,Te(d.value),1)]),we("div",Gr,[$(T,null,{default:Se((()=>[$(l,{onClick:I},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===c.value?(xe(),ke("div",Vr,[we("div",Ur,[$(We(_e),{class:"icon"})]),we("div",Hr,[jr,we("div",qr,Te(d.value),1)]),we("div",Qr,[$(T,null,{default:Se((()=>[$(N,{target:"_blank",to:"/download"},{default:Se((()=>[$(l,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===c.value||""===c.value?(xe(),ke("div",Xr,[$(E,{size:"large"}),we("span",Zr,Te(p.value),1)])):Ne("",!0),"success"!==c.value&&"finish"!==c.value||0!==h.value.length?Ne("",!0):(xe(),ke("div",Kr,[$(R,{description:"没有搜索到商品"})])),"finish"===c.value&&h.value.length>0?(xe(),ke("div",Jr,Yr)):Ne("",!0)])}}},[["__scopeId","data-v-32c7583c"]]),ta=e=>(Oe("data-v-b60df303"),e=e(),Fe(),e),na={class:"1688xunyuantong-search"},ra={class:"filter-wrap"},aa={class:"filter-item"},sa=ta((()=>we("span",{class:"label"},"排序:",-1))),ia={class:"filter-item"},oa=ta((()=>we("span",{class:"label"},"筛选:",-1))),la={class:"list-wrap"},ua=["href"],ca={class:"info-wrap"},da=["src"],ha={class:"title"},pa=["innerHTML"],fa={class:"price-wrap"},ma={class:"price"},ga={class:"prefix"},ya={key:0,class:"sold"},ba={key:0,class:"mall-wrap"},va=["innerHTML"],Aa=["innerHTML"],xa={key:0,class:"error-tip"},ka={class:"left"},wa={class:"center"},Sa=ta((()=>we("div",{class:"title"}," 提示 ",-1))),Ca={class:"sub-title"},Ia={class:"right"},Wa={key:1,class:"error-tip"},_a={class:"left"},Ta={class:"center"},Na=ta((()=>we("div",{class:"title"}," 提示 ",-1))),Ea={class:"sub-title"},Ra={class:"right"},$a={key:2,class:"loading-wrap"},Oa={class:"text"},Fa={key:3,style:{padding:"20px"}},Da={key:4,class:"bottom-tip"},Ma=[ta((()=>we("span",null,"没有更多了",-1)))],La=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=De,f=Ee,b=Ye,x=Ae("router-link"),k=u,S=Re;return xe(),ke("div",na,[we("div",ra,[we("span",aa,[sa,$(r,{value:y.value,"onUpdate:value":t[0]||(t[0]=e=>y.value=e),style:{width:"130px"},onChange:v},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1})])),_:1},8,["value"])]),we("span",ia,[oa,$(a,{value:p.value,"onUpdate:value":t[1]||(t[1]=e=>p.value=e),placeholder:"商品标题 / 发货地",style:{width:"200px"}},null,8,["value"])])]),we("div",la,[(xe(!0),ke(D,null,Ie(g.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",ca,[we("img",{src:e.thumb,class:"thumb"},null,8,da),we("div",ha,[e.tag?(xe(),$e(s,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:A(e.title,p.value)},null,8,pa)]),we("div",fa,[we("span",ma,[we("span",ga,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",ya,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",ba,[we("span",{class:"mall",innerHTML:A(e.mall,p.value)},null,8,va),we("span",{class:"location",innerHTML:A(e.location,p.value)},null,8,Aa)])):Ne("",!0)],8,ua)))),128))]),"error"===d.value?(xe(),ke("div",xa,[we("div",ka,[$(We(_e),{class:"icon"})]),we("div",wa,[Sa,we("div",Ca,Te(h.value),1)]),we("div",Ia,[$(b,null,{default:Se((()=>[$(f,{onClick:w},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===d.value?(xe(),ke("div",Wa,[we("div",_a,[$(We(_e),{class:"icon"})]),we("div",Ta,[Na,we("div",Ea,Te(h.value),1)]),we("div",Ra,[$(b,null,{default:Se((()=>[$(x,{target:"_blank",to:"/download"},{default:Se((()=>[$(f,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===d.value||""===d.value?(xe(),ke("div",$a,[$(k,{size:"large"}),we("span",Oa,Te(m.value),1)])):Ne("",!0),"success"!==d.value&&"finish"!==d.value||0!==g.value.length?Ne("",!0):(xe(),ke("div",Fa,[$(S,{description:"没有搜索到商品"})])),"finish"===d.value&&g.value.length>0?(xe(),ke("div",Da,Ma)):Ne("",!0)])}}},[["__scopeId","data-v-b60df303"]]),Ba=e=>(Oe("data-v-2489faf1"),e=e(),Fe(),e),Pa={class:"1688-search"},za={class:"filter-wrap"},Ga={class:"filter-item"},Va=Ba((()=>we("span",{class:"label"},"排序:",-1))),Ua={class:"filter-item"},Ha=Ba((()=>we("span",{class:"label"},"筛选:",-1))),ja={class:"list-wrap"},qa=["href"],Qa={class:"info-wrap"},Xa=["src"],Za={class:"title"},Ka=["innerHTML"],Ja={class:"price-wrap"},Ya={class:"price"},es={class:"prefix"},ts={key:0,class:"sold"},ns={key:0,class:"mall-wrap"},rs=["innerHTML"],as=["innerHTML"],ss={key:0,class:"error-tip"},is={class:"left"},os={class:"center"},ls=Ba((()=>we("div",{class:"title"}," 提示 ",-1))),us={class:"sub-title"},cs={class:"right"},ds={href:"https://www.1688.com",target:"_blank"},hs={key:1,class:"error-tip"},ps={class:"left"},fs={class:"center"},ms=Ba((()=>we("div",{class:"title"}," 提示 ",-1))),gs={class:"sub-title"},ys={class:"right"},bs={key:2,class:"loading-wrap"},vs={class:"text"},As={key:3,style:{padding:"20px"}},xs={key:4,class:"bottom-tip"},ks=[Ba((()=>we("span",null,"没有更多了",-1)))],ws=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 bn(r.imgUrl,200),t=await yn({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 yn({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 yn({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(_X){s.value="error",d.value="请重新尝试搜索,或稍后再试",a("update:loading",!1)}}};return ue((async()=>{const e=await gn();if(e.error_code)return s.value="install-error",void(d.value="您还没有安装插件,请点击'下载插件'进行安装");f.value=e.version;const t=await An({domain:"1688.com"});let n=[];try{let e=await An({domain:"1688.com",partitionKey:{topLevelSite:"https://1688.com"}});e.error_code||(n=e)}catch(o){}const r=await An({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 vn({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=De,f=Ee,b=Ye,k=Ae("router-link"),w=u,S=Re;return xe(),ke("div",Pa,[we("div",za,[we("span",Ga,[Va,$(r,{value:y.value,"onUpdate:value":t[0]||(t[0]=e=>y.value=e),style:{width:"130px"},onChange:v},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1})])),_:1},8,["value"])]),we("span",Ua,[Ha,$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),we("div",ja,[(xe(!0),ke(D,null,Ie(g.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",Qa,[we("img",{src:e.thumb,class:"thumb"},null,8,Xa),we("div",Za,[e.tag?(xe(),$e(p,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:A(e.title,h.value)},null,8,Ka)]),we("div",Ja,[we("span",Ya,[we("span",es,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",ts,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",ns,[we("span",{class:"mall",innerHTML:A(e.mall,h.value)},null,8,rs),we("span",{class:"location",innerHTML:A(e.location,h.value)},null,8,as)])):Ne("",!0)],8,qa)))),128))]),"error"===s.value?(xe(),ke("div",ss,[we("div",is,[$(We(_e),{class:"icon"})]),we("div",os,[ls,we("div",us,Te(d.value),1)]),we("div",cs,[$(b,null,{default:Se((()=>[we("a",ds,[$(f,{type:"primary"},{default:Se((()=>[Ce(" 打开1688 ")])),_:1})]),$(f,{onClick:x},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===s.value?(xe(),ke("div",hs,[we("div",ps,[$(We(_e),{class:"icon"})]),we("div",fs,[ms,we("div",gs,Te(d.value),1)]),we("div",ys,[$(b,null,{default:Se((()=>[$(k,{target:"_blank",to:"/download"},{default:Se((()=>[$(f,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===s.value||""===s.value?(xe(),ke("div",bs,[$(w,{size:"large"}),we("span",vs,Te(m.value),1)])):Ne("",!0),"success"!==s.value&&"finish"!==s.value||0!==g.value.length?Ne("",!0):(xe(),ke("div",As,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&g.value.length>0?(xe(),ke("div",xs,ks)):Ne("",!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=15,i=[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],o=[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],l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);a(c);var d=new Array(60);a(d);var h=new Array(512);a(h);var p=new Array(256);a(p);var f=new Array(29);a(f);var m,g,y,b=new Array(30);function v(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 A(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function x(e){return e<256?h[e]:h[256+(e>>>7)]}function k(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function w(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,k(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 S(e,t,n){w(e,n[2*t],n[2*t+1])}function C(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function I(e,t,n){var r,a,i=new Array(16),o=0;for(r=1;r<=s;r++)i[r]=o=o+n[r-1]<<1;for(a=0;a<=t;a++){var l=e[2*a+1];0!==l&&(e[2*a]=C(i[l]++,l))}}function W(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 _(e){e.bi_valid>8?k(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 T(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 N(e,t,n){for(var r=e.heap[n],a=n<<1;a<=e.heap_len&&(a<e.heap_len&&T(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!T(t,r,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=r}function E(e,t,n){var r,a,s,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?S(e,a,t):(S(e,(s=p[a])+256+1,t),0!==(l=i[s])&&w(e,a-=f[s],l),S(e,s=x(--r),n),0!==(l=o[s])&&w(e,r-=b[s],l))}while(u<e.last_lit);S(e,256,t)}function R(e,t){var n,r,a,i=t.dyn_tree,o=t.stat_desc.static_tree,l=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<u;n++)0!==i[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):i[2*n+1]=0;for(;e.heap_len<2;)i[2*(a=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[a]=0,e.opt_len--,l&&(e.static_len-=o[2*a+1]);for(t.max_code=c,n=e.heap_len>>1;n>=1;n--)N(e,i,n);a=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,i,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,i[2*a]=i[2*n]+i[2*r],e.depth[a]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,i[2*n+1]=i[2*r+1]=a,e.heap[1]=a++,N(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,a,i,o,l,u=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(i=0;i<=s;i++)e.bl_count[i]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(i=u[2*u[2*(r=e.heap[n])+1]+1]+1)>m&&(i=m,g++),u[2*r+1]=i,r>c||(e.bl_count[i]++,o=0,r>=f&&(o=p[r-f]),l=u[2*r],e.opt_len+=l*(i+o),h&&(e.static_len+=l*(d[2*r+1]+o)));if(0!==g){do{for(i=m-1;0===e.bl_count[i];)i--;e.bl_count[i]--,e.bl_count[i+1]+=2,e.bl_count[m]--,g-=2}while(g>0);for(i=m;0!==i;i--)for(r=e.bl_count[i];0!==r;)(a=e.heap[--n])>c||(u[2*a+1]!==i&&(e.opt_len+=(i-u[2*a+1])*u[2*a],u[2*a+1]=i),r--)}}(e,t),I(i,c,e.bl_count)}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))}function O(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{S(e,a,e.bl_tree)}while(0!=--o);else 0!==a?(a!==s&&(S(e,a,e.bl_tree),o--),S(e,16,e.bl_tree),w(e,o-3,2)):o<=10?(S(e,17,e.bl_tree),w(e,o-3,3)):(S(e,18,e.bl_tree),w(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(b);var F=!1;function D(e,t,n,a){var s,i,o;w(e,0+(a?1:0),3),i=t,o=n,_(s=e),k(s,o),k(s,~o),r.arraySet(s.pending_buf,s.window,i,o,s.pending),s.pending+=o}t._tr_init=function(e){F||(function(){var e,t,n,r,a,u=new Array(16);for(n=0,r=0;r<28;r++)for(f[r]=n,e=0;e<1<<i[r];e++)p[n++]=r;for(p[n-1]=r,a=0,r=0;r<16;r++)for(b[r]=a,e=0;e<1<<o[r];e++)h[a++]=r;for(a>>=7;r<30;r++)for(b[r]=a<<7,e=0;e<1<<o[r]-7;e++)h[256+a++]=r;for(t=0;t<=s;t++)u[t]=0;for(e=0;e<=143;)c[2*e+1]=8,e++,u[8]++;for(;e<=255;)c[2*e+1]=9,e++,u[9]++;for(;e<=279;)c[2*e+1]=7,e++,u[7]++;for(;e<=287;)c[2*e+1]=8,e++,u[8]++;for(I(c,287,u),e=0;e<30;e++)d[2*e+1]=5,d[2*e]=C(e,5);m=new v(c,i,257,286,s),g=new v(d,o,0,30,s),y=new v(new Array(0),l,0,19,7)}(),F=!0),e.l_desc=new A(e.dyn_ltree,m),e.d_desc=new A(e.dyn_dtree,g),e.bl_desc=new A(e.bl_tree,y),e.bi_buf=0,e.bi_valid=0,W(e)},t._tr_stored_block=D,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)),R(e,e.l_desc),R(e,e.d_desc),i=function(e){var t;for($(e,e.dyn_ltree,e.l_desc.max_code),$(e,e.dyn_dtree,e.d_desc.max_code),R(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*u[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?D(e,t,n,r):4===e.strategy||s===a?(w(e,2+(r?1:0),3),E(e,c,d)):(w(e,4+(r?1:0),3),function(e,t,n,r){var a;for(w(e,t-257,5),w(e,n-1,5),w(e,r-4,4),a=0;a<r;a++)w(e,e.bl_tree[2*u[a]+1],3);O(e,e.dyn_ltree,t-1),O(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,i+1),E(e,e.dyn_ltree,e.dyn_dtree)),W(e),r&&_(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*(p[n]+256+1)]++,e.dyn_dtree[2*x(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){var t;w(e,2,3),S(e,256,c),16===(t=e).bi_valid?(k(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|0,s=e>>>16&65535|0,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|0}},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-1^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(-1^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 Ss=e=>(Oe("data-v-4ebdb38b"),e=e(),Fe(),e),Cs={class:"1688xunyuantong-search"},Is={class:"filter-wrap"},Ws={class:"filter-item"},_s=Ss((()=>we("span",{class:"label"},"排序:",-1))),Ts={class:"filter-item"},Ns=Ss((()=>we("span",{class:"label"},"筛选:",-1))),Es={class:"list-wrap"},Rs=["href"],$s={class:"info-wrap"},Os=["src"],Fs={class:"title"},Ds=["innerHTML"],Ms={class:"price-wrap"},Ls={class:"price"},Bs={class:"prefix"},Ps={key:0,class:"sold"},zs={key:0,class:"mall-wrap"},Gs=["innerHTML"],Vs=["innerHTML"],Us={key:0,class:"error-tip"},Hs={class:"left"},js={class:"center"},qs=Ss((()=>we("div",{class:"title"}," 提示 ",-1))),Qs={class:"sub-title"},Xs={class:"right"},Zs={target:"_blank",href:"https://mobile.yangkeduo.com"},Ks={key:1,class:"error-tip"},Js={class:"left"},Ys={class:"center"},ei=Ss((()=>we("div",{class:"title"}," 提示 ",-1))),ti={class:"sub-title"},ni={class:"right"},ri={key:2,class:"loading-wrap"},ai={class:"text"},si={key:3,style:{padding:"20px"}},ii={key:4,class:"bottom-tip"},oi=[Ss((()=>we("span",null,"没有更多了",-1)))],li=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 An({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 yn({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 yn({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 yn({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 gn();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=De,f=Ee,m=Ye,v=Ae("router-link"),k=u,w=Re;return xe(),ke("div",Cs,[we("div",Is,[we("span",Ws,[_s,$(r,{value:b.value,"onUpdate:value":t[0]||(t[0]=e=>b.value=e),style:{width:"130px"},onChange:A},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"sold-max-min"},{default:Se((()=>[Ce("销量从高到低")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1}),$(n,{value:"sold-min-max"},{default:Se((()=>[Ce("销量从低到高")])),_:1})])),_:1},8,["value"])]),we("span",Ts,[Ns,$(s,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题",style:{width:"200px"}},null,8,["value"])])]),we("div",Es,[(xe(!0),ke(D,null,Ie(y.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",$s,[we("img",{src:e.thumb,class:"thumb"},null,8,Os),we("div",Fs,[e.tag?(xe(),$e(p,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:x(e.title,h.value)},null,8,Ds)]),we("div",Ms,[we("span",Ls,[we("span",Bs,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",Ps,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",zs,[we("span",{class:"mall",innerHTML:x(e.mall,h.value)},null,8,Gs),we("span",{class:"location",innerHTML:x(e.location,h.value)},null,8,Vs)])):Ne("",!0)],8,Rs)))),128))]),"error"===a.value?(xe(),ke("div",Us,[we("div",Hs,[$(We(_e),{class:"icon"})]),we("div",js,[qs,we("div",Qs,Te(d.value),1)]),we("div",Xs,[$(m,null,{default:Se((()=>[we("a",Zs,[$(f,{type:"primary"},{default:Se((()=>[Ce(" 登录拼多多 ")])),_:1})]),$(f,{onClick:C},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===a.value?(xe(),ke("div",Ks,[we("div",Js,[$(We(_e),{class:"icon"})]),we("div",Ys,[ei,we("div",ti,Te(d.value),1)]),we("div",ni,[$(m,null,{default:Se((()=>[$(v,{target:"_blank",to:"/download"},{default:Se((()=>[$(f,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===a.value||""===a.value?(xe(),ke("div",ri,[$(k,{size:"large"}),we("span",ai,Te(g.value),1)])):Ne("",!0),"success"!==a.value&&"finish"!==a.value||0!==y.value.length?Ne("",!0):(xe(),ke("div",si,[$(w,{description:"没有搜索到商品"})])),"finish"===a.value&&y.value.length>0?(xe(),ke("div",ii,oi)):Ne("",!0)])}}},[["__scopeId","data-v-4ebdb38b"]]);let ui;!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(),ui=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(e,t){var n=h();function r(e,t){return o(e- -416,t)}function a(e,t){return o(t- -209,e)}for(;;)try{if(-parseInt(a("@b)w",489))/1*(-parseInt(a("iU!(",188))/2)+parseInt(a("ea1u",389))/3*(parseInt(a("(5h(",478))/4)+-parseInt(r(258,"IUs7"))/5*(parseInt(a("K)F[",473))/6)+-parseInt(a("#FdB",477))/7*(parseInt(a("M#pd",336))/8)+-parseInt(a("ea1u",227))/9*(-parseInt(a("iSBn",363))/10)+-parseInt(r(305,"d2&5"))/11*(-parseInt(a("bmAe",361))/12)+parseInt(a("hAY8",375))/13==763712)break;n.push(n.shift())}catch(s){n.push(n.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(e,t){function n(e,t){return ee(t-107,e)}function r(e,t){return ee(t-903,e)}for(var a=ae();;)try{if(parseInt(n("S@lO",757))/1+parseInt(r("QovG",1661))/2*(parseInt(r("(meS",1154))/3)+-parseInt(r("hIzm",1453))/4*(parseInt(r("3(AN",1761))/5)+parseInt(r("C6fO",1444))/6*(-parseInt(r("$nFE",1498))/7)+-parseInt(r("Y]ar",1819))/8*(-parseInt(r("Pt@f",1181))/9)+parseInt(n("3(AN",770))/10+-parseInt(r("N)xu",1303))/11*(parseInt(r("AcT^",1284))/12)==866438)break;a.push(a.shift())}catch(s){a.push(a.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=15,i=[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],o=[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],l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);a(c);var d=new Array(60);a(d);var h=new Array(512);a(h);var p=new Array(256);a(p);var f=new Array(29);a(f);var m,g,y,b=new Array(30);function v(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 A(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function x(e){return e<256?h[e]:h[256+(e>>>7)]}function k(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function w(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,k(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 S(e,t,n){w(e,n[2*t],n[2*t+1])}function C(e,t){var n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1}function I(e,t,n){var r,a,i=new Array(16),o=0;for(r=1;r<=s;r++)i[r]=o=o+n[r-1]<<1;for(a=0;a<=t;a++){var l=e[2*a+1];0!==l&&(e[2*a]=C(i[l]++,l))}}function W(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 _(e){e.bi_valid>8?k(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 T(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 N(e,t,n){for(var r=e.heap[n],a=n<<1;a<=e.heap_len&&(a<e.heap_len&&T(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!T(t,r,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=r}function E(e,t,n){var r,a,s,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?S(e,a,t):(S(e,(s=p[a])+256+1,t),0!==(l=i[s])&&w(e,a-=f[s],l),S(e,s=x(--r),n),0!==(l=o[s])&&w(e,r-=b[s],l))}while(u<e.last_lit);S(e,256,t)}function R(e,t){var n,r,a,i=t.dyn_tree,o=t.stat_desc.static_tree,l=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<u;n++)0!==i[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):i[2*n+1]=0;for(;e.heap_len<2;)i[2*(a=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[a]=0,e.opt_len--,l&&(e.static_len-=o[2*a+1]);for(t.max_code=c,n=e.heap_len>>1;n>=1;n--)N(e,i,n);a=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,i,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,i[2*a]=i[2*n]+i[2*r],e.depth[a]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,i[2*n+1]=i[2*r+1]=a,e.heap[1]=a++,N(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,a,i,o,l,u=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(i=0;i<=s;i++)e.bl_count[i]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(i=u[2*u[2*(r=e.heap[n])+1]+1]+1)>m&&(i=m,g++),u[2*r+1]=i,r>c||(e.bl_count[i]++,o=0,r>=f&&(o=p[r-f]),l=u[2*r],e.opt_len+=l*(i+o),h&&(e.static_len+=l*(d[2*r+1]+o)));if(0!==g){do{for(i=m-1;0===e.bl_count[i];)i--;e.bl_count[i]--,e.bl_count[i+1]+=2,e.bl_count[m]--,g-=2}while(g>0);for(i=m;0!==i;i--)for(r=e.bl_count[i];0!==r;)(a=e.heap[--n])>c||(u[2*a+1]!==i&&(e.opt_len+=(i-u[2*a+1])*u[2*a],u[2*a+1]=i),r--)}}(e,t),I(i,c,e.bl_count)}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))}function O(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{S(e,a,e.bl_tree)}while(0!=--o);else 0!==a?(a!==s&&(S(e,a,e.bl_tree),o--),S(e,16,e.bl_tree),w(e,o-3,2)):o<=10?(S(e,17,e.bl_tree),w(e,o-3,3)):(S(e,18,e.bl_tree),w(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(b);var F=!1;function D(e,t,n,a){var s,i,o;w(e,0+(a?1:0),3),i=t,o=n,_(s=e),k(s,o),k(s,~o),r.arraySet(s.pending_buf,s.window,i,o,s.pending),s.pending+=o}t._tr_init=function(e){F||(function(){var e,t,n,r,a,u=new Array(16);for(n=0,r=0;r<28;r++)for(f[r]=n,e=0;e<1<<i[r];e++)p[n++]=r;for(p[n-1]=r,a=0,r=0;r<16;r++)for(b[r]=a,e=0;e<1<<o[r];e++)h[a++]=r;for(a>>=7;r<30;r++)for(b[r]=a<<7,e=0;e<1<<o[r]-7;e++)h[256+a++]=r;for(t=0;t<=s;t++)u[t]=0;for(e=0;e<=143;)c[2*e+1]=8,e++,u[8]++;for(;e<=255;)c[2*e+1]=9,e++,u[9]++;for(;e<=279;)c[2*e+1]=7,e++,u[7]++;for(;e<=287;)c[2*e+1]=8,e++,u[8]++;for(I(c,287,u),e=0;e<30;e++)d[2*e+1]=5,d[2*e]=C(e,5);m=new v(c,i,257,286,s),g=new v(d,o,0,30,s),y=new v(new Array(0),l,0,19,7)}(),F=!0),e.l_desc=new A(e.dyn_ltree,m),e.d_desc=new A(e.dyn_dtree,g),e.bl_desc=new A(e.bl_tree,y),e.bi_buf=0,e.bi_valid=0,W(e)},t._tr_stored_block=D,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)),R(e,e.l_desc),R(e,e.d_desc),i=function(e){var t;for($(e,e.dyn_ltree,e.l_desc.max_code),$(e,e.dyn_dtree,e.d_desc.max_code),R(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*u[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?D(e,t,n,r):4===e.strategy||s===a?(w(e,2+(r?1:0),3),E(e,c,d)):(w(e,4+(r?1:0),3),function(e,t,n,r){var a;for(w(e,t-257,5),w(e,n-1,5),w(e,r-4,4),a=0;a<r;a++)w(e,e.bl_tree[2*u[a]+1],3);O(e,e.dyn_ltree,t-1),O(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,i+1),E(e,e.dyn_ltree,e.dyn_dtree)),W(e),r&&_(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*(p[n]+256+1)]++,e.dyn_dtree[2*x(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){var t;w(e,2,3),S(e,256,c),16===(t=e).bi_valid?(k(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|0,s=e>>>16&65535|0,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|0}},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-1^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(-1^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(e,t){function n(e,t){return s(t-903,e)}var r=u();function a(e,t){return s(e-322,t)}for(;;)try{if(parseInt(n("o#BD",1357))/1+parseInt(a(736,"o#BD"))/2+parseInt(a(725,"iRCa"))/3*(parseInt(a(720,"v&9t"))/4)+-parseInt(a(731,"CYra"))/5+-parseInt(a(726,"6BJ9"))/6*(parseInt(a(786,"ZGHp"))/7)+parseInt(a(745,"w@1k"))/8*(-parseInt(n("ZGHp",1337))/9)+parseInt(n("$i(c",1360))/10*(parseInt(a(733,"7@@f"))/11)==891082)break;r.push(r.shift())}catch(i){r.push(r.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(ui(291))({serverTime:Date.now()}).messagePack();const ci=e=>(Oe("data-v-f5262ae2"),e=e(),Fe(),e),di={class:"pdd-pifa-search"},hi={class:"filter-wrap"},pi={class:"filter-item"},fi=ci((()=>we("span",{class:"label"},"排序:",-1))),mi={class:"filter-item"},gi=ci((()=>we("span",{class:"label"},"筛选:",-1))),yi={class:"list-wrap"},bi=["href"],vi={class:"info-wrap"},Ai=["src"],xi={class:"title"},ki=["innerHTML"],wi={class:"price-wrap"},Si={class:"price"},Ci={class:"prefix"},Ii={key:0,class:"sold"},Wi={key:0,class:"mall-wrap"},_i=["innerHTML"],Ti=["innerHTML"],Ni={key:0,class:"error-tip"},Ei={class:"left"},Ri={class:"center"},$i=ci((()=>we("div",{class:"title"}," 提示 ",-1))),Oi={class:"sub-title"},Fi={class:"right"},Di={href:"https://pifa.pinduoduo.com",target:"_blank"},Mi={key:1,class:"error-tip"},Li={class:"left"},Bi={class:"center"},Pi=ci((()=>we("div",{class:"title"}," 提示 ",-1))),zi={class:"sub-title"},Gi={class:"right"},Vi={key:2,class:"loading-wrap"},Ui={class:"text"},Hi={key:3,style:{padding:"20px"}},ji={key:4,class:"bottom-tip"},qi=[ci((()=>we("span",null,"没有更多了",-1)))],Qi=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 yn({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 yn({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(_X){s.value="error",d.value="请尝试登录拼多多批发,或稍后再试",r("update:loading",!1)}}};return ue((async()=>{const e=await gn();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=De,f=Ee,b=Ye,k=Ae("router-link"),w=u,S=Re;return xe(),ke("div",di,[we("div",hi,[we("span",pi,[fi,$(r,{value:y.value,"onUpdate:value":t[0]||(t[0]=e=>y.value=e),style:{width:"130px"},onChange:v},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"sold-max-min"},{default:Se((()=>[Ce("销量从高到低")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1}),$(n,{value:"sold-min-max"},{default:Se((()=>[Ce("销量从低到高")])),_:1})])),_:1},8,["value"])]),we("span",mi,[gi,$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),we("div",yi,[(xe(!0),ke(D,null,Ie(g.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",vi,[we("img",{src:e.thumb,class:"thumb"},null,8,Ai),we("div",xi,[e.tag?(xe(),$e(p,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:A(e.title,h.value)},null,8,ki)]),we("div",wi,[we("span",Si,[we("span",Ci,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",Ii,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",Wi,[we("span",{class:"mall",innerHTML:A(e.mall,h.value)},null,8,_i),we("span",{class:"location",innerHTML:A(e.location,h.value)},null,8,Ti)])):Ne("",!0)],8,bi)))),128))]),"error"===s.value?(xe(),ke("div",Ni,[we("div",Ei,[$(We(_e),{class:"icon"})]),we("div",Ri,[$i,we("div",Oi,Te(d.value),1)]),we("div",Fi,[$(b,null,{default:Se((()=>[we("a",Di,[$(f,{type:"primary"},{default:Se((()=>[Ce(" 打开拼多多批发 ")])),_:1})]),$(f,{onClick:x},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===s.value?(xe(),ke("div",Mi,[we("div",Li,[$(We(_e),{class:"icon"})]),we("div",Bi,[Pi,we("div",zi,Te(d.value),1)]),we("div",Gi,[$(b,null,{default:Se((()=>[$(k,{target:"_blank",to:"/download"},{default:Se((()=>[$(f,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===s.value||""===s.value?(xe(),ke("div",Vi,[$(w,{size:"large"}),we("span",Ui,Te(m.value),1)])):Ne("",!0),"success"!==s.value&&"finish"!==s.value||0!==g.value.length?Ne("",!0):(xe(),ke("div",Hi,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&g.value.length>0?(xe(),ke("div",ji,qi)):Ne("",!0)])}}},[["__scopeId","data-v-f5262ae2"]]),Xi=e=>(Oe("data-v-eec6ade3"),e=e(),Fe(),e),Zi={class:"1688xunyuantong-search"},Ki={class:"filter-wrap"},Ji={class:"filter-item"},Yi=Xi((()=>we("span",{class:"label"},"排序:",-1))),eo={class:"filter-item"},to=Xi((()=>we("span",{class:"label"},"筛选:",-1))),no={class:"list-wrap"},ro=["href"],ao={class:"info-wrap"},so=["src"],io={class:"title"},oo=["innerHTML"],lo={class:"price-wrap"},uo={class:"price"},co={class:"prefix"},ho={key:0,class:"sold"},po={key:0,class:"mall-wrap"},fo=["innerHTML"],mo=["innerHTML"],go={key:0,class:"error-tip"},yo={class:"left"},bo={class:"center"},vo=Xi((()=>we("div",{class:"title"}," 提示 ",-1))),Ao={class:"sub-title"},xo={class:"right"},ko={key:1,class:"error-tip"},wo={class:"left"},So={class:"center"},Co=Xi((()=>we("div",{class:"title"}," 提示 ",-1))),Io={class:"sub-title"},Wo={class:"right"},_o={key:2,class:"loading-wrap"},To={class:"text"},No={key:3,style:{padding:"20px"}},Eo={key:4,class:"bottom-tip"},Ro=[Xi((()=>we("span",null,"没有更多了",-1)))],$o=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(_X){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=De,y=Ee,A=Ye,x=Ae("router-link"),w=u,S=Re;return xe(),ke("div",Zi,[we("div",Ki,[we("span",Ji,[Yi,$(r,{value:g.value,"onUpdate:value":t[0]||(t[0]=e=>g.value=e),style:{width:"130px"},onChange:b},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"sold-max-min"},{default:Se((()=>[Ce("销量从高到低")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1}),$(n,{value:"sold-min-max"},{default:Se((()=>[Ce("销量从低到高")])),_:1})])),_:1},8,["value"])]),we("span",eo,[to,$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 /店铺名 / 发货地",style:{width:"200px"}},null,8,["value"])])]),we("div",no,[(xe(!0),ke(D,null,Ie(m.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",ao,[we("img",{src:e.thumb,class:"thumb"},null,8,so),we("div",io,[e.tag?(xe(),$e(p,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:v(e.title,h.value)},null,8,oo)]),we("div",lo,[we("span",uo,[we("span",co,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",ho,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",po,[we("span",{class:"mall",innerHTML:v(e.mall,h.value)},null,8,fo),we("span",{class:"location",innerHTML:v(e.location,h.value)},null,8,mo)])):Ne("",!0)],8,ro)))),128))]),"error"===s.value?(xe(),ke("div",go,[we("div",yo,[$(We(_e),{class:"icon"})]),we("div",bo,[vo,we("div",Ao,Te(d.value),1)]),we("div",xo,[$(A,null,{default:Se((()=>[$(y,{onClick:k},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===s.value?(xe(),ke("div",ko,[we("div",wo,[$(We(_e),{class:"icon"})]),we("div",So,[Co,we("div",Io,Te(d.value),1)]),we("div",Wo,[$(A,null,{default:Se((()=>[$(x,{target:"_blank",to:"/download"},{default:Se((()=>[$(y,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===s.value||""===s.value?(xe(),ke("div",_o,[$(w,{size:"large"}),we("span",To,Te(f.value),1)])):Ne("",!0),"success"!==s.value&&"finish"!==s.value||0!==m.value.length?Ne("",!0):(xe(),ke("div",No,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&m.value.length>0?(xe(),ke("div",Eo,Ro)):Ne("",!0)])}}},[["__scopeId","data-v-eec6ade3"]]);class Oo{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 Fo{refCount(e){return Do("refCount")}incRef(e){return Do("incRef")}timerAvailable(){return!0}time(e){return Do("time")}read(e){return Do("read")}readSync(e){return Do("readSync")}readToGPU(e,t){return Do("readToGPU")}numDataIds(){return Do("numDataIds")}disposeData(e,t){return Do("disposeData")}write(e,t,n){return Do("write")}move(e,t,n,r,a){return Do("move")}createTensorFromGPUData(e,t,n){return Do("createTensorFromGPUData")}memory(){return Do("memory")}floatPrecision(){return Do("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return Do("dispose")}}function Do(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 Mo(e){let t=e.length,n=0;for(;t>0;)n=Math.random()*t|0,t--,Po(e,t,n)}function Lo(e,t,n){return Math.max(e,Math.min(t,n))}function Bo(e){return e%2==0?e:e+1}function Po(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function zo(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t}function Go(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function Vo(e,t,n=""){Go(qo(e,t),(()=>n+` Shapes ${e} and ${t} must match`))}function Uo(e){Go(null!=e,(()=>"The input to the tensor constructor must be a non-null value."))}function Ho(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 jo(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 qo(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 Qo(e){return e%1==0}function Xo(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function Zo(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function Ko(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 Jo(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 Yo(e,t){const n=t.length;return Go((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}`)),Go(e.every((e=>Qo(e))),(()=>`All values in axis param must be integers but got axis ${e}`)),e.map((e=>e<0?n+e:e))}function el(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||a?null:Yo(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 tl(e,t){return nl(e,t)}function nl(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 rl(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 al(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e}function sl(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function il(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 ol(e){if(null==e)return 0;let t=0;return e.forEach((e=>t+=e.length)),t}function ll(e){return"string"==typeof e||e instanceof String}function ul(e){return"boolean"==typeof e}function cl(e){return"number"==typeof e}function dl(e){return Array.isArray(e)?dl(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":cl(e)?"float32":ll(e)?"string":ul(e)?"bool":"float32"}function hl(e){return!!(e&&e.constructor&&e.call&&e.apply)}function pl(e,t){for(let n=t;n<e;++n)if(e%n==0)return n;return e}function fl(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 ml(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]=ml(e+t*o,i,n,r)}return a}function gl(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 ml(0,e,t,n)}function yl(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 bl(e,t){const n=vl(e,t);for(let r=0;r<n.length;r++)n[r]=1;return n}function vl(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 Al(e,t){const n=e.reduce(((e,t)=>e*t),1);if(null==t||"float32"===t)return gl(e,new Float32Array(n));if("int32"===t)return gl(e,new Int32Array(n));if("bool"===t)return gl(e,new Uint8Array(n));throw new Error(`Unknown data type ${t}`)}function xl(e){e.forEach((t=>{Go(Number.isInteger(t)&&t>=0,(()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`))}))}function kl(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 wl(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 Sl(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 Cl="tfjsflags";class Il{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=Wl,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&!_l().getBool("IS_TEST")&&_l().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];!_l().getBool("IS_TEST")&&_l().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(Sl(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(Cl in e){e[Cl].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 Wl(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 _l(){return Nl}let Tl,Nl=null;function El(){if(null==Tl){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}Tl=e}return Tl}function Rl(e,t){const n=function(){const e=El();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 $l="Abs",Ol="Acos",Fl="Acosh",Dl="Add",Ml="AddN",Ll="All",Bl="Any",Pl="ArgMax",zl="ArgMin",Gl="Asin",Vl="Asinh",Ul="Atan",Hl="Atanh",jl="Atan2",ql="AvgPool",Ql="AvgPoolGrad",Xl="AvgPool3D",Zl="AvgPool3DGrad",Kl="BatchMatMul",Jl="BatchToSpaceND",Yl="Bincount",eu="BitwiseAnd",tu="BroadcastTo",nu="BroadcastArgs",ru="Cast",au="Ceil",su="ClipByValue",iu="Complex",ou="ComplexAbs",lu="Concat",uu="Conv2D",cu="Conv2DBackpropFilter",du="Conv2DBackpropInput",hu="Conv3D",pu="Conv3DBackpropFilterV2",fu="Conv3DBackpropInputV2",mu="Cos",gu="Cosh",yu="Cumprod",bu="Cumsum",vu="CropAndResize",Au="DenseBincount",xu="DepthToSpace",ku="DepthwiseConv2dNative",wu="DepthwiseConv2dNativeBackpropFilter",Su="DepthwiseConv2dNativeBackpropInput",Cu="Diag",Iu="Dilation2D",Wu="Dilation2DBackpropInput",_u="Dilation2DBackpropFilter",Tu="Draw",Nu="RealDiv",Eu="Einsum",Ru="Elu",$u="EluGrad",Ou="Erf",Fu="Equal",Du="Exp",Mu="ExpandDims",Lu="Expm1",Bu="FFT",Pu="Fill",zu="FlipLeftRight",Gu="Floor",Vu="FloorDiv",Uu="FusedBatchNorm",Hu="GatherV2",ju="GatherNd",qu="Greater",Qu="GreaterEqual",Xu="Identity",Zu="IFFT",Ku="Imag",Ju="IsFinite",Yu="IsInf",ec="IsNan",tc="LeakyRelu",nc="Less",rc="LessEqual",ac="LinSpace",sc="Log",ic="Log1p",oc="LogicalAnd",lc="LogicalNot",uc="LogicalOr",cc="LogSoftmax",dc="LRN",hc="LRNGrad",pc="Max",fc="Maximum",mc="MaxPool",gc="MaxPoolGrad",yc="MaxPool3D",bc="MaxPool3DGrad",vc="MaxPoolWithArgmax",Ac="Mean",xc="Min",kc="Minimum",wc="MirrorPad",Sc="Mod",Cc="Multinomial",Ic="Multiply",Wc="Neg",_c="NotEqual",Tc="NonMaxSuppressionV3",Nc="NonMaxSuppressionV4",Ec="NonMaxSuppressionV5",Rc="OnesLike",$c="OneHot",Oc="Pack",Fc="PadV2",Dc="Pow",Mc="Prelu",Lc="Prod",Bc="RaggedGather",Pc="RaggedRange",zc="RaggedTensorToTensor",Gc="Range",Vc="Real",Uc="Reciprocal",Hc="Relu",jc="Reshape",qc="ResizeNearestNeighbor",Qc="ResizeNearestNeighborGrad",Xc="ResizeBilinear",Zc="ResizeBilinearGrad",Kc="Relu6",Jc="Reverse",Yc="Round",ed="Rsqrt",td="ScatterNd",nd="TensorScatterUpdate",rd="SearchSorted",ad="Select",sd="Selu",id="Slice",od="Sin",ld="Sinh",ud="Sign",cd="Sigmoid",dd="Softplus",hd="Sqrt",pd="Sum",fd="SpaceToBatchND",md="SplitV",gd="Softmax",yd="SparseFillEmptyRows",bd="SparseReshape",vd="SparseSegmentMean",Ad="SparseSegmentSum",xd="SparseToDense",kd="SquaredDifference",wd="Square",Sd="StaticRegexReplace",Cd="StridedSlice",Id="StringNGrams",Wd="StringSplit",_d="StringToHashBucketFast",Td="Sub",Nd="Tan",Ed="Tanh",Rd="Tile",$d="TopK",Od="Transform",Fd="Transpose",Dd="Unique",Md="Unpack",Ld="UnsortedSegmentSum",Bd="ZerosLike",Pd="Step",zd="FromPixels",Gd="RotateWithOffset",Vd="_FusedMatMul",Ud="FusedConv2D",Hd="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 jd(...e){!_l().getBool("IS_TEST")&&_l().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 qd=Rl("kernelRegistry",(()=>new Map)),Qd=Rl("gradRegistry",(()=>new Map));function Xd(e,t){const n=eh(e,t);return qd.get(n)}function Zd(e){return Qd.get(e)}function Kd(e){const t=qd.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 Jd(e){const{kernelName:t,backendName:n}=e,r=eh(t,n);qd.has(r)&&jd(),qd.set(r,e)}function Yd(e){const{kernelName:t}=e;Qd.has(t)&&_l().getBool("DEBUG")&&jd(),Qd.set(t,e)}function eh(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 th(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}var nh=ah,rh=null;try{rh=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(_X){}function ah(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function sh(e){return!0===(e&&e.__isLong__)}ah.prototype.__isLong__,Object.defineProperty(ah.prototype,"__isLong__",{value:!0}),ah.isLong=sh;var ih={},oh={};function lh(e,t){var n,r,a;return t?(a=0<=(e>>>=0)&&e<256)&&(r=oh[e])?r:(n=ch(e,(0|e)<0?-1:0,!0),a&&(oh[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(r=ih[e])?r:(n=ch(e,e<0?-1:0,!1),a&&(ih[e]=n),n)}function uh(e,t){if(isNaN(e))return t?vh:bh;if(t){if(e<0)return vh;if(e>=mh)return Sh}else{if(e<=-gh)return Ch;if(e+1>=gh)return wh}return e<0?uh(-e,t).neg():ch(e%fh|0,e/fh|0,t)}function ch(e,t,n){return new ah(e,t,n)}ah.fromInt=lh,ah.fromNumber=uh,ah.fromBits=ch;var dh=Math.pow;function hh(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return bh;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 hh(e.substring(1),t,n).neg();for(var a=uh(dh(n,8)),s=bh,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=uh(dh(n,o));s=s.mul(u).add(uh(l))}else s=(s=s.mul(a)).add(uh(l))}return s.unsigned=t,s}function ph(e,t){return"number"==typeof e?uh(e,t):"string"==typeof e?hh(e,t):ch(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}ah.fromString=hh,ah.fromValue=ph;var fh=4294967296,mh=fh*fh,gh=mh/2,yh=lh(1<<24),bh=lh(0);ah.ZERO=bh;var vh=lh(0,!0);ah.UZERO=vh;var Ah=lh(1);ah.ONE=Ah;var xh=lh(1,!0);ah.UONE=xh;var kh=lh(-1);ah.NEG_ONE=kh;var wh=ch(-1,2147483647,!1);ah.MAX_VALUE=wh;var Sh=ch(-1,-1,!0);ah.MAX_UNSIGNED_VALUE=Sh;var Ch=ch(0,-2147483648,!1);ah.MIN_VALUE=Ch;var Ih=ah.prototype;Ih.toInt=function(){return this.unsigned?this.low>>>0:this.low},Ih.toNumber=function(){return this.unsigned?(this.high>>>0)*fh+(this.low>>>0):this.high*fh+(this.low>>>0)},Ih.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(Ch)){var t=uh(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=uh(dh(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}},Ih.getHighBits=function(){return this.high},Ih.getHighBitsUnsigned=function(){return this.high>>>0},Ih.getLowBits=function(){return this.low},Ih.getLowBitsUnsigned=function(){return this.low>>>0},Ih.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ch)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},Ih.isZero=function(){return 0===this.high&&0===this.low},Ih.eqz=Ih.isZero,Ih.isNegative=function(){return!this.unsigned&&this.high<0},Ih.isPositive=function(){return this.unsigned||this.high>=0},Ih.isOdd=function(){return 1==(1&this.low)},Ih.isEven=function(){return 0==(1&this.low)},Ih.equals=function(e){return sh(e)||(e=ph(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},Ih.eq=Ih.equals,Ih.notEquals=function(e){return!this.eq(e)},Ih.neq=Ih.notEquals,Ih.ne=Ih.notEquals,Ih.lessThan=function(e){return this.comp(e)<0},Ih.lt=Ih.lessThan,Ih.lessThanOrEqual=function(e){return this.comp(e)<=0},Ih.lte=Ih.lessThanOrEqual,Ih.le=Ih.lessThanOrEqual,Ih.greaterThan=function(e){return this.comp(e)>0},Ih.gt=Ih.greaterThan,Ih.greaterThanOrEqual=function(e){return this.comp(e)>=0},Ih.gte=Ih.greaterThanOrEqual,Ih.ge=Ih.greaterThanOrEqual,Ih.compare=function(e){if(sh(e)||(e=ph(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},Ih.comp=Ih.compare,Ih.negate=function(){return!this.unsigned&&this.eq(Ch)?Ch:this.not().add(Ah)},Ih.neg=Ih.negate,Ih.add=function(e){sh(e)||(e=ph(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,ch((c&=65535)<<16|(d&=65535),(l&=65535)<<16|(u&=65535),this.unsigned)},Ih.subtract=function(e){return sh(e)||(e=ph(e)),this.add(e.neg())},Ih.sub=Ih.subtract,Ih.multiply=function(e){if(this.isZero())return bh;if(sh(e)||(e=ph(e)),rh)return ch(rh.mul(this.low,this.high,e.low,e.high),rh.get_high(),this.unsigned);if(e.isZero())return bh;if(this.eq(Ch))return e.isOdd()?Ch:bh;if(e.eq(Ch))return this.isOdd()?Ch:bh;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(yh)&&e.lt(yh))return uh(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,ch((d&=65535)<<16|(h&=65535),(u&=65535)<<16|(c&=65535),this.unsigned)},Ih.mul=Ih.multiply,Ih.divide=function(e){if(sh(e)||(e=ph(e)),e.isZero())throw Error("division by zero");var t,n,r;if(rh)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?ch((this.unsigned?rh.div_u:rh.div_s)(this.low,this.high,e.low,e.high),rh.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?vh:bh;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return vh;if(e.gt(this.shru(1)))return xh;r=vh}else{if(this.eq(Ch))return e.eq(Ah)||e.eq(kh)?Ch:e.eq(Ch)?Ah:(t=this.shr(1).div(e).shl(1)).eq(bh)?e.isNegative()?Ah:kh:(n=this.sub(e.mul(t)),r=t.add(n.div(e)));if(e.eq(Ch))return this.unsigned?vh:bh;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=bh}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:dh(2,a-48),i=uh(t),o=i.mul(e);o.isNegative()||o.gt(n);)o=(i=uh(t-=s,this.unsigned)).mul(e);i.isZero()&&(i=Ah),r=r.add(i),n=n.sub(o)}return r},Ih.div=Ih.divide,Ih.modulo=function(e){return sh(e)||(e=ph(e)),rh?ch((this.unsigned?rh.rem_u:rh.rem_s)(this.low,this.high,e.low,e.high),rh.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},Ih.mod=Ih.modulo,Ih.rem=Ih.modulo,Ih.not=function(){return ch(~this.low,~this.high,this.unsigned)},Ih.and=function(e){return sh(e)||(e=ph(e)),ch(this.low&e.low,this.high&e.high,this.unsigned)},Ih.or=function(e){return sh(e)||(e=ph(e)),ch(this.low|e.low,this.high|e.high,this.unsigned)},Ih.xor=function(e){return sh(e)||(e=ph(e)),ch(this.low^e.low,this.high^e.high,this.unsigned)},Ih.shiftLeft=function(e){return sh(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?ch(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):ch(0,this.low<<e-32,this.unsigned)},Ih.shl=Ih.shiftLeft,Ih.shiftRight=function(e){return sh(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?ch(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):ch(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},Ih.shr=Ih.shiftRight,Ih.shiftRightUnsigned=function(e){if(sh(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?ch(this.low>>>e|t<<32-e,t>>>e,this.unsigned):ch(32===e?t:t>>>e-32,0,this.unsigned)},Ih.shru=Ih.shiftRightUnsigned,Ih.shr_u=Ih.shiftRightUnsigned,Ih.toSigned=function(){return this.unsigned?ch(this.low,this.high,!1):this},Ih.toUnsigned=function(){return this.unsigned?this:ch(this.low,this.high,!0)},Ih.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},Ih.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]},Ih.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]},ah.fromBytes=function(e,t,n){return n?ah.fromBytesLE(e,t):ah.fromBytesBE(e,t)},ah.fromBytesLE=function(e,t){return new ah(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},ah.fromBytesBE=function(e,t){return new ah(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};const Wh=ge(nh),_h=Wh||st({__proto__:null,default:Wh},[nh]);function Th(e){return _h.fromString(e,!0,16)}const Nh=Th("c3a5c85c97cb3127"),Eh=Th("b492b66fbe98f273"),Rh=Th("9ae16a3b2f90404f");function $h(e){return e.xor(e.shru(47))}function Oh(e,t,n){const r=e.slice(t,t+n);return _h.fromBytes(Array.from(r),!0,!0)}function Fh(e,t){return Oh(e,t,8)}function Dh(e,t){return Oh(e,t,4)}function Mh(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function Lh(e,t,n=Th("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 Bh(e,t,n,r){return function(e,t,n,r,a,s){a=a.add(e),s=Mh(s.add(a).add(r),21);const i=a;return a=(a=a.add(t)).add(n),s=s.add(Mh(a,44)),[a.add(r),s.add(i)]}(Fh(e,t),Fh(e,t+8),Fh(e,t+16),Fh(e,t+24),n,r)}function Ph(e,t=e.length){const n=_h.fromNumber(81,!0);if(t<=32)return t<=16?function(e,t=e.length){if(t>=8){const n=Rh.add(2*t),r=Fh(e,0).add(Rh),a=Fh(e,t-8);return Lh(Mh(a,37).mul(n).add(r),Mh(r,25).add(a).mul(n),n)}if(t>=4){const n=Rh.add(2*t);return Lh(Dh(e,0).shl(3).add(t),Dh(e,t-4),n)}if(t>0){const n=e[0]+(e[t>>1]<<8),r=t+(e[t-1]<<2);return $h(Rh.mul(n).xor(Nh.mul(r))).mul(Rh)}return Rh}(e,t):function(e,t=e.length){const n=Rh.add(2*t),r=Fh(e,0).mul(Eh),a=Fh(e,8),s=Fh(e,t-8).mul(n),i=Fh(e,t-16).mul(Rh);return Lh(Mh(r.add(a),43).add(Mh(s,30)).add(i),r.add(Mh(a.add(Rh),18)).add(s),n)}(e,t);if(t<=64)return function(e,t=e.length){const n=Rh.add(2*t),r=Fh(e,0).mul(Rh),a=Fh(e,8),s=Fh(e,t-8).mul(n),i=Fh(e,t-16).mul(Rh),o=Mh(r.add(a),43).add(Mh(s,30)).add(i),l=Lh(o,r.add(Mh(a.add(Rh),18)).add(s),n),u=Fh(e,16).mul(n),c=Fh(e,24),d=o.add(Fh(e,t-32)).mul(n),h=l.add(Fh(e,t-24)).mul(n);return Lh(Mh(u.add(c),43).add(Mh(d,30)).add(h),u.add(Mh(c.add(r),18)).add(d),n)}(e,t);let r=n,a=n.mul(Eh).add(113),s=$h(a.mul(Rh).add(113)).mul(Rh),i=[_h.UZERO,_h.UZERO],o=[_h.UZERO,_h.UZERO];r=r.mul(Rh).add(Fh(e,0));let l=0;const u=64*(t-1>>6),c=u+(t-1&63)-63;do{r=Mh(r.add(a).add(i[0]).add(Fh(e,l+8)),37).mul(Eh),a=Mh(a.add(i[1]).add(Fh(e,l+48)),42).mul(Eh),r=r.xor(o[1]),a=a.add(i[0]).add(Fh(e,l+40)),s=Mh(s.add(o[0]),33).mul(Eh),i=Bh(e,l,i[1].mul(Eh),r.add(o[0])),o=Bh(e,l+32,s.add(o[1]),a.add(Fh(e,l+16))),[s,r]=[r,s],l+=64}while(l!==u);const d=Eh.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=Mh(r.add(a).add(i[0]).add(Fh(e,l+8)),37).mul(d),a=Mh(a.add(i[1]).add(Fh(e,l+48)),42).mul(d),r=r.xor(o[1].mul(9)),a=a.add(i[0].mul(9).add(Fh(e,l+40))),s=Mh(s.add(o[0]),33).mul(d),i=Bh(e,l,i[1].mul(d),r.add(o[0])),o=Bh(e,l+32,s.add(o[1]),a.add(Fh(e,l+16))),[s,r]=[r,s],Lh(Lh(i[0],o[0],d).add($h(a).mul(Nh)).add(s),Lh(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 zh(e,t){return"string"===t?Uh(e):Gh([e],t)}function Gh(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=qh(e)),_l().getBool("DEBUG")&&rl(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 Vh(){return _l().platform.now()}function Uh(e,t="utf-8"){return t=t||"utf-8",_l().platform.encode(e,t)}function Hh(e,t="utf-8"){return t=t||"utf-8",_l().platform.decode(e,t)}function jh(e){return null!=_l().platform.isTypedArray?_l().platform.isTypedArray(e):th(e)}function qh(e,t=[],n=!1){if(null==t&&(t=[]),"boolean"==typeof e||"number"==typeof e||"string"==typeof e||Sl(e)||null==e||jh(e)&&n)t.push(e);else if(Array.isArray(e)||jh(e))for(let r=0;r<e.length;++r)qh(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++)qh(e[a],t,n)}return t}const Qh=Object.freeze(Object.defineProperty({__proto__:null,arraysEqual:qo,arraysEqualWithNull:jo,assert:Go,assertNonNegativeIntegerDimensions:xl,assertNonNull:Uo,assertShapesMatch:Vo,bytesFromStringArray:ol,bytesPerElement:il,checkConversionForErrors:rl,clamp:Lo,computeStrides:fl,convertBackendValuesAndArrayBuffer:yl,createScalarValue:zh,createShuffledIndices:function(e){const t=new Uint32Array(e);for(let n=0;n<e;++n)t[n]=n;return Mo(t),t},decodeString:Hh,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:Uh,fetch:function(e,t){return _l().platform.fetch(e,t)},fingerPrint64:Ph,flatten:qh,getArrayFromDType:nl,getTypedArrayFromDType:tl,hasEncodingLoss:sl,hexToLong:Th,indexToLoc:wl,inferDtype:dl,inferFromImplicitShape:Jo,isBoolean:ul,isFunction:hl,isInt:Qo,isNumber:cl,isPromise:Sl,isScalarShape:function(e){return 0===e.length},isString:ll,isTypedArray:jh,isValidDtype:al,locToIndex:kl,makeOnesTypedArray:bl,makeZerosNestedTypedArray:Al,makeZerosTypedArray:vl,nearestDivisor:pl,nearestLargerEven:Bo,now:Vh,parseAxisParam:Yo,randUniform:function(e,t){const n=Math.random();return t*n+(1-n)*e},repeatedTry:Ko,rightPad:Zo,shuffle:Mo,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--,Po(e,n,r),Po(t,n,r)},sizeFromShape:Ho,sizeToSquarishShape:Xo,squeezeShape:el,sum:zo,swap:Po,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:gl,toTypedArray:Gh},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 Xh{constructor(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new Kh)}profileKernel(e,t,n){let r;const a=()=>{r=n()};let s;const i=Vh();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(a);else{a();for(const e of r)e.dataSync();s=Promise.resolve({kernelMs:Vh()-i})}if(_l().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o<r.length;o++){const t=r[o];t.data().then((n=>{Zh(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 Zh(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 Kh{logKernelProfile(e,t,n,r,a,s){"number"==typeof r?Zo(`${r}ms`,9):r.error,Zo(e,25),t.rank,t.size,Zo(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.
 * =============================================================================
 */
/**
 * @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 Jh=20,Yh=3,ep=7;function tp(e,t,n,r){const a=fl(t),s=function(e,t,n,r){const a=Ho(t),s=r[r.length-1],i=new Array(s).fill(0),o=t.length,l="complex64"===n?sp(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],np(l[e+t],0,n).length)}return i}(e,t,n,a),i=t.length,o=ap(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 np(e,t,n){let r;return r=Array.isArray(e)?`${parseFloat(e[0].toFixed(ep))} + ${parseFloat(e[1].toFixed(ep))}j`:ll(e)?`'${e}'`:"bool"===n?rp(e):parseFloat(e.toFixed(ep)).toString(),Zo(r,t)}function rp(e){return 0===e?"false":"true"}function ap(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[np(sp(e)[0],0,n)]}return"bool"===n?[rp(e[0])]:[e[0].toString()]}if(1===l){if(o>Jh){const t=Yh*i;let r=Array.from(e.slice(0,t)),s=Array.from(e.slice((o-Yh)*i,o*i));return"complex64"===n&&(r=sp(r),s=sp(s)),["["+r.map(((e,t)=>np(e,a[t],n))).join(", ")+", ..., "+s.map(((e,t)=>np(e,a[o-Yh+t],n))).join(", ")+"]"]}return["["+("complex64"===n?sp(e):Array.from(e)).map(((e,t)=>np(e,a[t],n))).join(", ")+"]"]}const u=t.slice(1),c=r.slice(1),d=r[0]*i,h=[];if(o>Jh){for(let t=0;t<Yh;t++){const r=t*d,s=r+d;h.push(...ap(e.slice(r,s),u,n,c,a,!1))}h.push("...");for(let t=o-Yh;t<o;t++){const r=t*d,s=r+d;h.push(...ap(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(...ap(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 sp(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 ip{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=Ho(e),null!=n){const e=n.length;Go(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||nl(t,this.size),this.strides=fl(e)}set(e,...t){0===t.length&&(t=[0]),Go(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 op().makeTensor(this.values,this.shape,this.dtype)}}let op=null,lp=null;class up{constructor(e,t,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=Ho(e),this.strides=fl(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 lp.buffer(this.shape,this.dtype,e)}bufferSync(){return lp.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return gl(this.shape,e,"complex64"===this.dtype)}arraySync(){return gl(this.shape,this.dataSync(),"complex64"===this.dtype)}async data(){this.throwIfDisposed();const e=op().read(this.dataId);if("string"===this.dtype){const n=await e;try{return n.map((e=>Hh(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(),op().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=op().readSync(this.dataId);if("string"===this.dtype)try{return e.map((e=>Hh(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 op().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),op().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return lp.print(this,e)}clone(){return this.throwIfDisposed(),lp.clone(this)}toString(e=!1){return tp(this.dataSync(),this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),lp.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),op().makeVariable(this,e,t,n)}}function cp(){return Rl("Tensor",(()=>up))}Object.defineProperty(up,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}),cp();class dp extends up{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(!qo(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);op().disposeTensor(this),this.dataId=e.dataId,op().incRef(this,null)}dispose(){op().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 hp,pp,fp,mp,gp,yp,bp,vp,Ap,xp;Object.defineProperty(dp,Symbol.hasInstance,{value:e=>e instanceof up&&null!=e.assign&&e.assign instanceof Function}),(pp=hp||(hp={})).R0="R0",pp.R1="R1",pp.R2="R2",pp.R3="R3",pp.R4="R4",pp.R5="R5",pp.R6="R6",(mp=fp||(fp={})).float32="float32",mp.int32="int32",mp.bool="int32",mp.complex64="complex64",(yp=gp||(gp={})).float32="float32",yp.int32="int32",yp.bool="bool",yp.complex64="complex64",(vp=bp||(bp={})).float32="float32",vp.int32="float32",vp.bool="float32",vp.complex64="complex64",(xp=Ap||(Ap={})).float32="complex64",xp.int32="complex64",xp.bool="complex64",xp.complex64="complex64";const kp={float32:bp,int32:fp,bool:gp,complex64:Ap};function wp(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return kp[e][t]}function Sp(e){return wp(e,"int32")}function Cp(e){return null!=e&&"object"==typeof e&&"texture"in e&&e.texture instanceof WebGLTexture}function Ip(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 Wp(e,t){if(e.dtype===t.dtype)return[e,t];const n=wp(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function _p(e,t){Go(e.dtype===t.dtype,(()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`))}function Tp(e){const t=[];return Np(e,t,new Set),t}function Np(e,t,n){if(null==e)return;if(e instanceof up)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),Np(e,t,n))}}const Ep=Object.freeze(Object.defineProperty({__proto__:null,assertTypesMatch:_p,getTensorsInContainer:Tp,isTensorInList:function(e,t){return t.some((t=>t.id===e.id))},makeTypesMatch:Wp},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 Rp(e){return null!=e.kernelName}class $p{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 Op{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new $p}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?(jd(),!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 Xh(this.backendInstance),!0}setupRegisteredKernels(){Kd(this.backendName).forEach((e=>{null!=e.setupFunc&&e.setupFunc(this.backendInstance)}))}disposeRegisteredKernels(e){Kd(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 Fo||"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,jd(),jd(e.stack||e.message)),!1)));return this.pendingBackendInit=r,{success:r,asyncInit:!0}}}catch(n){return jd(),jd(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 Op.nextTensorId++}nextVariableId(){return Op.nextVariableId++}clone(e){const t=Dp.runKernel(Xu,{x:e}),n={x:e};return this.addTapeNode(this.state.activeScope.name,n,[t],(e=>({x:()=>{const t={x:e},n={dtype:"float32"};return Dp.runKernel(ru,t,n)}})),[],{}),t}runKernel(e,t,n){null==this.backendName&&this.backend;if(!(null!=Xd(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=Rp(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(Rp(e)){const{kernelName:t,inputs:a,attrs:s}=e;null==this.backendName&&this.backend;const l=Xd(t,this.backendName);Go(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=Rp(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=Zd(e);if(null!=r){const e=r.inputsToSave||[],a=r.outputsToSave||[];let s;r.saveAllInputs?(Go(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&&ll(e[0])&&(a=e.map((e=>Uh(e))));const s=r.write(a,t,n),i=new up(t,n,s,this.nextTensorId());if(this.trackTensor(i,r),"string"===n){const e=this.state.tensorInfo.get(s),t=ol(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 up(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 dp(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*il(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 dp||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*il(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=Zd(e);null!=o&&(r=o.gradFunc),null!=r&&(i.gradient=e=>(e=e.map(((e,t)=>{if(null==e){const e=n[t],r=vl(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=Tp(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(Go(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)));Go(a instanceof up,(()=>"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=bl(Ho(e),"float32");return Dp.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(!qo(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()}}}}(e,s,(e=>this.tidy(e)),Mp);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 Go(hl(e),(()=>"The f passed in customGrad(f) must be a function.")),(...t)=>{let n;Go(t.every((e=>e instanceof up)),(()=>"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),Go(n.value instanceof up,(()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor")),Go(hl(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];Go(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(...).")),Go(s.every((e=>e instanceof up)),(()=>"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=Vh(),n=await this.backend.time(e);return n.wallMs=Vh()-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 $p;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 Fp(){const e=El();if(null==e._tfengine){const t=new Il(e);e._tfengine=new Op(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,Nl=t,op=()=>e._tfengine,e._tfengine}Op.nextTensorId=0,Op.nextVariableId=0;const Dp=Fp();function Mp(e,t){const n={a:e,b:t};return Dp.runKernel(Dl,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 Lp;function Bp(e){if(void 0!==Lp)return Lp;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 Pp(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}const zp=Object.freeze(Object.defineProperty({__proto__:null,isBrowser:Pp,isMobile:Bp,mockIsMobile:function(e){Lp=e}},Symbol.toStringTag,{value:"Module"})),Gp=_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.
 * =============================================================================
 */
/**
 * @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 Vp(e,t){let n=e;if(jh(e))return"string"===t?[]:[e.length];if(Cp(e)){const t=e.channels||"RGBA";return[e.height,e.width*t.length]}if(Ip(e))return[e.buffer.size/(null==t?4:il(t))];if(!Array.isArray(e))return[];const r=[];for(;Array.isArray(n)||jh(n)&&"string"!==t;)r.push(n.length),n=n[0];return Array.isArray(e)&&_l().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Up(e,r,[]),r}function Up(e,t,n){if(n=n||[],!Array.isArray(e)&&!jh(e))return void Go(0===t.length,(()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`));Go(t.length>0,(()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`)),Go(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)Up(e[a],r,n.concat(a))}function Hp(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 jp(e,t,n,r="numeric"){if(e instanceof cp())return Hp(r,e.dtype,t,n),e;let a=dl(e);if("string"!==a&&["bool","int32","float32"].indexOf(r)>=0&&(a=r),Hp(r,a,t,n),null==e||!jh(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=Vp(e,a);jh(e)||Array.isArray(e)||(e=[e]);const i="string"!==a?Gh(e,a):qh(e,[],!0);return Dp.makeTensor(i,s,a)}function qp(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)=>jp(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.
 * =============================================================================
 */Gp.registerFlag("DEBUG",(()=>!1),(e=>{})),Gp.registerFlag("IS_BROWSER",(()=>Pp())),Gp.registerFlag("IS_NODE",(()=>"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node)),Gp.registerFlag("IS_CHROME",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))),Gp.registerFlag("IS_SAFARI",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor))),Gp.registerFlag("PROD",(()=>!1)),Gp.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(()=>Gp.getBool("DEBUG"))),Gp.registerFlag("DEPRECATION_WARNINGS_ENABLED",(()=>!0)),Gp.registerFlag("IS_TEST",(()=>!1)),Gp.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(()=>Gp.getBool("DEBUG"))),Gp.registerFlag("WRAP_TO_IMAGEBITMAP",(()=>!1)),Gp.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",(()=>!1)),Gp.registerFlag("USE_SETTIMEOUTCUSTOM",(()=>!1));const Qp="__op";function Xp(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+=Qp;const a=(...e)=>{Dp.startScope(n);try{const t=r(...e);return Sl(t),Dp.endScope(t),t}catch(t){throw Dp.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 Zp=Xp({complex_:function(e,t){const n=jp(e,"real","complex"),r=jp(t,"imag","complex");Vo(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 Dp.runKernel(iu,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 Kp(e,t,n,r){if(null==r)r=dl(e);else if("complex64"===r)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(Ip(e)||Cp(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 Dp.backend.createTensorFromGPUData(e,t||n,r)}if(!jh(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){xl(t);const e=Ho(t),r=Ho(n);Go(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!==Ho(t.slice(a));Go(n[a]===t[a]||!r,(()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `))}}return jh(e)||Array.isArray(e)||(e=[e]),t=t||n,e="string"!==r?Gh(e,r):qh(e,[],!0),Dp.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 Jp(e,t,n){return Kp(e,t,Vp(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 Yp={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};class ef{static join(e){return new ef(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,null==e)return;if(e instanceof Array||(e=[e]),0===(e=e.map((e=>jh(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 tf(){return Dp}function nf(){return Dp.memory()}function rf(e,t){return Dp.tidy(e,t)}function af(e){Tp(e).forEach((e=>e.dispose()))}function sf(e){return Dp.keep(e)}function of(){return Dp.backendName}function lf(e,t,n=1){return Dp.registerBackend(e,t,n)}function uf(){return Dp.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.
 * =============================================================================
 */
const cf=4;async function df(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)+cf*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+=cf,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:bf(await Promise.all(r)),specs:n}}function hf(e,t){const n=new ef(e),r={};let a=0;for(const s of t){const e=pf(s,((e,t)=>n.slice(a+e,a+t)));r[s.name]=mf(s,n.slice(a,a+e)),a+=e}return r}function pf(e,t){const n=Ho(e.shape);let r;if("quantization"in e){const t=e.quantization;r=Yp[t.dtype]}else{if("string"===e.dtype){let e=0;for(let r=0;r<n;r++)e+=cf+new Uint32Array(t(e,e+cf))[0];return e}r=Yp[e.dtype]}return n*r}async function ff(e,t){const n=Ho(e.shape);let r;if("quantization"in e){const t=e.quantization;r=Yp[t.dtype]}else{if("string"===e.dtype){let e=0;for(let r=0;r<n;r++)e+=cf+new Uint32Array(await t(e,e+cf))[0];return e}r=Yp[e.dtype]}return n*r}function mf(e,t){const n=e.name,r=e.dtype,a=e.shape,s=Ho(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=Yp[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(;0==(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=Ho(e.shape);i=[];for(let e=0;e<n;e++){const e=new Uint32Array(t.slice(o,o+cf))[0];o+=cf;const n=new Uint8Array(t.slice(o,o+e));i.push(n),o+=e}}else{const e=Yp[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=Jp(e,a,"float32"),s=Jp(n,a,"float32"),o=Zp(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 Jp(i,a,r)}async function gf(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 yf(e,t){const n={},r=e.getReader();let a=new ArrayBuffer(0);for(const s of t){const e=await ff(s,(async(e,t)=>(a=await gf(r,a,t),a.slice(e,t))));a=await gf(r,a,e);const t=a.slice(0,e);a=a.slice(e);const i=mf(s,t);if(n[s.name]=i,"webgpu"===of()){const e=uf();"uploadToGPU"in e&&Ho(i.shape)>=_l().get("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD")&&e.uploadToGPU(i.dataId)}}return n}function bf(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 vf="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function Af(e){return vf?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function xf(e){return ef.join(e)}function kf(e){for(e=e.trim();e.endsWith("/");)e=e.slice(0,e.length-1);const t=e.split("/");return t[t.length-1]}function wf(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 Sf(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 Cf(e,t){let n,r;return null!=e.weightsManifest&&([n,r]=await t(e.weightsManifest)),Sf(e,n,r)}function If(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:Af(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:Af(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:new ef(e.weightData).byteLength}}function Wf(e){const t=[];for(const n of e)t.push(...n.weights);return t}class _f{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==_f.instance&&(_f.instance=new _f),_f.instance}static registerSaveRouter(e){_f.getInstance().saveRouters.push(e)}static registerLoadRouter(e){_f.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return _f.getHandlers(e,"save")}static getLoadHandlers(e,t){return _f.getHandlers(e,"load",t)}static getHandlers(e,t,n){const r=[];return("load"===t?_f.getInstance().loadRouters:_f.getInstance().saveRouters).forEach((t=>{const a=t(e,n);null!==a&&r.push(a)})),r}}const Tf=e=>_f.getSaveHandlers(e),Nf="tensorflowjs",Ef="models_store",Rf="model_info_store";function $f(){if(!_l().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 Of(e){const t=e.result;t.createObjectStore(Ef,{keyPath:"modelPath"}),t.createObjectStore(Rf,{keyPath:"modelPath"})}class Ff{constructor(e){if(this.indexedDB=$f(),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(Nf,1);r.onupgradeneeded=()=>Of(r),r.onsuccess=()=>{const a=r.result;if(null==t){const t=a.transaction(Ef,"readonly"),r=t.objectStore(Ef).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=ef.join(t.weightData);const r=If(t),i=a.transaction(Rf,"readwrite");let o,l,u=i.objectStore(Rf);try{o=u.put({modelPath:this.modelPath,modelArtifactsInfo:r})}catch(s){return n(s)}o.onsuccess=()=>{l=a.transaction(Ef,"readwrite");const o=l.objectStore(Ef);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(Rf);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)}))}}Ff.URL_SCHEME="indexeddb://";const Df=e=>{return _l().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Ff.URL_SCHEME)?(t=e.slice(Ff.URL_SCHEME.length),new Ff(t)):null;var t};_f.registerSaveRouter(Df),_f.registerLoadRouter(Df);class Mf{constructor(){this.indexedDB=$f()}async listModels(){return new Promise(((e,t)=>{const n=this.indexedDB.open(Nf,1);n.onupgradeneeded=()=>Of(n),n.onsuccess=()=>{const r=n.result,a=r.transaction(Rf,"readonly"),s=a.objectStore(Rf).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(Ff.URL_SCHEME)?t.slice(Ff.URL_SCHEME.length):t,new Promise(((t,n)=>{const r=this.indexedDB.open(Nf,1);r.onupgradeneeded=()=>Of(r),r.onsuccess=()=>{const a=r.result,s=a.transaction(Rf,"readwrite"),i=s.objectStore(Rf),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(Ef,"readwrite");const r=l.objectStore(Ef).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 Lf="/",Bf="tensorflowjs_models",Pf="info",zf="model_topology",Gf="weight_specs",Vf="weight_data",Uf="model_metadata";function Hf(e){return{info:[Bf,e,Pf].join(Lf),topology:[Bf,e,zf].join(Lf),weightSpecs:[Bf,e,Gf].join(Lf),weightData:[Bf,e,Vf].join(Lf),modelMetadata:[Bf,e,Uf].join(Lf)}}function jf(e){for(const t of Object.values(e))window.localStorage.removeItem(t)}function qf(e){const t=e.split(Lf);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Lf)}class Qf{constructor(e){if(!_l().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=Hf(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=If(e),s=ef.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(vf)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 jf(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(vf){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}}Qf.URL_SCHEME="localstorage://";const Xf=e=>{return _l().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Qf.URL_SCHEME)?(t=e.slice(Qf.URL_SCHEME.length),new Qf(t)):null;var t};_f.registerSaveRouter(Xf),_f.registerLoadRouter(Xf);class Zf{constructor(){Go(_l().getBool("IS_BROWSER"),(()=>"Current environment is not a web browser")),Go("undefined"==typeof window||void 0!==window.localStorage,(()=>"Current browser does not appear to support localStorage")),this.LS=window.localStorage}async listModels(){const e={},t=Bf+Lf,n=Lf+Pf;for(let r=0;r<this.LS.length;++r){const a=this.LS.key(r);if(a.startsWith(t)&&a.endsWith(n)){e[qf(a)]=JSON.parse(this.LS.getItem(a))}}return e}async removeModel(e){var t;const n=Hf(e=(t=e).startsWith(Qf.URL_SCHEME)?t.slice(Qf.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 jf(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 Kf="://";class Jf{constructor(){this.managers={}}static getInstance(){return null==Jf.instance&&(Jf.instance=new Jf),Jf.instance}static registerManager(e,t){Go(null!=e,(()=>"scheme must not be undefined or null.")),e.endsWith(Kf)&&(e=e.slice(0,e.indexOf(Kf))),Go(e.length>0,(()=>"scheme must not be an empty string."));const n=Jf.getInstance();Go(null==n.managers[e],(()=>`A model store manager is already registered for scheme '${e}'.`)),n.managers[e]=t}static getManager(e){const t=Jf.getInstance().managers[e];if(null==t)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(Jf.getInstance().managers)}}function Yf(e){if(-1===e.indexOf(Kf))throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Jf.getSchemes().join(",")}`);return{scheme:e.split(Kf)[0],path:e.split(Kf)[1]}}async function em(e,t,n=!1){Go(e!==t,(()=>`Old path and new path are the same: '${e}'`));const r=_f.getLoadHandlers(e);Go(r.length>0,(()=>`Copying failed because no load handler is found for source URL ${e}.`)),Go(r.length<2,(()=>`Copying failed because more than one (${r.length}) load handlers for source URL ${e}.`));const a=r[0],s=_f.getSaveHandlers(t);Go(s.length>0,(()=>`Copying failed because no save handler is found for destination URL ${t}.`)),Go(s.length<2,(()=>`Copying failed because more than one (${r.length}) save handlers for destination URL ${t}.`));const i=s[0],o=Yf(e).scheme,l=Yf(e).path,u=o===Yf(e).scheme,c=await a.load();n&&u&&await Jf.getManager(o).removeModel(l);const d=await i.save(c);return n&&!u&&await Jf.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 tm{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&&_l().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 th(e)}}if(_l().get("IS_BROWSER")){_l().setPlatform("browser",new tm);try{Jf.registerManager(Qf.URL_SCHEME,new Zf)}catch(cJ){}try{Jf.registerManager(Ff.URL_SCHEME,new Mf)}catch(cJ){}}
/**
 * @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 nm=()=>require("node-fetch");let rm;class am{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return null!=_l().global.fetch?_l().global.fetch(e,t):(null==rm&&(rm=nm()),rm(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 sm(e,t="float32",n){return t=t||"float32",xl(e),new ip(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.
 * =============================================================================
 */_l().get("IS_NODE")&&!_l().get("IS_BROWSER")&&_l().setPlatform("node",new am);const im=Xp({cast_:function(e,t){const n=jp(e,"x","cast");if(!al(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 Dp.runKernel(ru,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 om=Xp({clone_:function(e){const t={x:jp(e,"x","clone","string_or_numeric")};return Dp.runKernel(Xu,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 lm(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.
 * =============================================================================
 */Fp();lp={buffer:sm,cast:im,clone:om,print:lm};const um=Xp({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=jp(e,"a","add"),r=jp(t,"b","add");[n,r]=Wp(n,r);const a={a:n,b:r};return Dp.runKernel(Dl,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 cm=Xp({floorDiv_:function(e,t){let n=jp(e,"a","floorDiv"),r=jp(t,"b","floorDiv");[n,r]=Wp(n,r);const a={a:n,b:r};return Dp.runKernel(Vu,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 dm=Xp({div_:function(e,t){let n=jp(e,"a","div"),r=jp(t,"b","div");if([n,r]=Wp(n,r),"int32"===n.dtype&&"int32"===r.dtype)return cm(n,r);const a={a:n,b:r};return Dp.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 hm=Xp({mul_:function(e,t){let n=jp(e,"a","mul"),r=jp(t,"b","mul");[n,r]=Wp(n,r);const a={a:n,b:r};return Dp.runKernel(Ic,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 pm=Xp({abs_:function(e){const t=jp(e,"x","abs");if("complex64"===t.dtype){const e={x:t};return Dp.runKernel(ou,e)}{const e={x:t};return Dp.runKernel($l,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 fm=Xp({acos_:function(e){const t={x:jp(e,"x","acos")};return Dp.runKernel(Ol,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 mm=Xp({acosh_:function(e){const t={x:jp(e,"x","acosh")};return Dp.runKernel(Fl,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=Xp({addN_:function(e){Go(Array.isArray(e),(()=>"The argument passed to tf.addN() must be a list of tensors")),Go(e.length>=1,(()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`));const t=e.map(((e,t)=>jp(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(!qo(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));const r=t;return Dp.runKernel(Ml,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 ym=Xp({all_:function(e,t=null,n=!1){const r={x:jp(e,"x","all","bool")},a={axis:t,keepDims:n};return Dp.runKernel(Ll,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 bm=Xp({any_:function(e,t=null,n=!1){const r={x:jp(e,"x","any","bool")},a={axis:t,keepDims:n};return Dp.runKernel(Bl,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 vm=Xp({argMax_:function(e,t=0){const n={x:jp(e,"x","argMax")},r={axis:t};return Dp.runKernel(Pl,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 Am=Xp({argMin_:function(e,t=0){const n={x:jp(e,"x","argMin")},r={axis:t};return Dp.runKernel(zl,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 xm=Xp({asin_:function(e){const t={x:jp(e,"x","asin")};return Dp.runKernel(Gl,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 km=Xp({asinh_:function(e){const t={x:jp(e,"x","asinh")};return Dp.runKernel(Vl,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 wm=Xp({atan_:function(e){const t={x:jp(e,"x","atan")};return Dp.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 Sm=Xp({atan2_:function(e,t){let n=jp(e,"a","atan2"),r=jp(t,"b","atan2");[n,r]=Wp(n,r);const a={a:n,b:r};return Dp.runKernel(jl,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 Cm=Xp({atanh_:function(e){const t={x:jp(e,"x","atanh")};return Dp.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 Im(e,t,n,r,a="NHWC",s){return Tm(e,[...t,e[3]],n,s,r,null,null,Bm(a))}function Wm(e,t,n,r,a,s,i="channelsLast"){const[o,l]=Rm(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 Tm(e,u,n,r,a,s,!1,i)}function _m(e,t,n,r,a,s,i="NDHWC"){const[o,l,u]=$m(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 Nm(e,c,n,r,a,!1,d,s)}function Tm(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]=Rm(n),[y,b]=Rm(r),v=Om(h,y),A=Om(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=Em(e,t,n));const s=e[0],i=e[1],o=Fm((s-t+2*r)/n+1,a),l=Fm((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=Fm((t-s+h+p)/r+1,o),d=Fm((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 Nm(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]=$m(n),[A,x,k]=$m(r),w=Om(p,A),S=Om(f,x),C=Om(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=Em(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]=Fm((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 Em(e,t,n,r=1){const a=Om(t,r);return Math.floor((e[0]*(n-1)-n+a)/2)}function Rm(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function $m(e){return"number"==typeof e?[e,e,e]:e}function Om(e,t){return t<=1?e:e+(e-1)*(t-1)}function Fm(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 Dm(e){const[t,n,r]=Rm(e);return 1===t&&1===n&&1===r}function Mm(e,t){return Dm(e)||Dm(t)}function Lm(e){return Rm(e).every((e=>e>0))}function Bm(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function Pm(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)Go(Qo(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=>{Go(Qo(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 zm=Xp({reshape_:function(e,t){const n={x:jp(e,"x","reshape","string_or_numeric")},r={shape:t};return Dp.runKernel(jc,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=Xp({avgPool_:function(e,t,n,r,a){const s=jp(e,"x","avgPool","float32");Go(Mm(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=zm(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Go(4===i.rank,(()=>`Error in avgPool: x must be rank 4 but got rank ${i.rank}.`)),Pm("avgPool",r,a);const l={x:i},u={filterSize:t,strides:n,pad:r,dimRoundingMode:a};let c=Dp.runKernel(ql,l,u);return c=im(c,s.dtype),o?zm(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 Vm=Xp({avgPool3d_:function(e,t,n,r,a,s="NDHWC"){const i=jp(e,"x","avgPool3d","float32");let o=i,l=!1;4===i.rank&&(l=!0,o=zm(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Go(5===o.rank,(()=>`Error in avgPool3d: x must be rank 5 but got rank ${o.rank}.`)),Go("NDHWC"===s,(()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`)),Go("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}'`)),Pm("avgPool3d",r,a);const u={x:o},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:s};let d=Dp.runKernel(Xl,u,c);return d=im(d,o.dtype),l?zm(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 Um=Xp({concat_:function(e,t=0){Go(e.length>=1,(()=>"Pass at least one tensor to concat"));const n=qp(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 om(n[0]);const r=n,a={axis:t};return Dp.runKernel(lu,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 Hm=Xp({matMul_:function(e,t,n=!1,r=!1){let a=jp(e,"a","matMul"),s=jp(t,"b","matMul");[a,s]=Wp(a,s);const i={a:a,b:s},o={transposeA:n,transposeB:r};return Dp.runKernel(Kl,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 jm=Xp({sigmoid_:function(e){const t={x:jp(e,"x","sigmoid","float32")};return Dp.runKernel(cd,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 qm=Xp({slice_:function(e,t,n){const r=jp(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 Dp.runKernel(id,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 Qm=Xp({tanh_:function(e){const t={x:jp(e,"x","tanh","float32")};return Dp.runKernel(Ed,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 Xm=Xp({basicLSTMCell_:function(e,t,n,r,a,s){const i=jp(e,"forgetBias","basicLSTMCell"),o=jp(t,"lstmKernel","basicLSTMCell"),l=jp(n,"lstmBias","basicLSTMCell"),u=jp(r,"data","basicLSTMCell"),c=jp(a,"c","basicLSTMCell"),d=jp(s,"h","basicLSTMCell"),h=Um([u,d],1),p=Hm(h,o),f=um(p,l),m=f.shape[0],g=f.shape[1]/4,y=[m,g],b=qm(f,[0,0],y),v=qm(f,[0,g],y),A=qm(f,[0,2*g],y),x=qm(f,[0,3*g],y),k=um(hm(jm(b),Qm(v)),hm(c,jm(um(i,A))));return[k,hm(Qm(k),jm(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 Zm=Xp({batchToSpaceND_:function(e,t,n){const r=jp(e,"x","batchToSpaceND"),a=t.reduce(((e,t)=>e*t));Go(r.rank>=1+t.length,(()=>`input rank is ${r.rank} but should be > than blockShape.length ${t.length}`)),Go(n.length===t.length,(()=>`crops.length is ${n.length} but should be equal to blockShape.length  ${t.length}`)),Go(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 Dp.runKernel(Jl,s,i)}});const Km=Xp({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=jp(e,"x","batchNorm"),o=jp(t,"mean","batchNorm"),l=jp(n,"variance","batchNorm");let u,c;null!=a&&(u=jp(a,"scale","batchNorm")),null!=r&&(c=jp(r,"offset","batchNorm")),Go(o.rank===l.rank,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),Go(null==c||o.rank===c.rank,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),Go(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?zm(e,[1,1,1,e.size]):2===e.rank?zm(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?zm(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=Dp.runKernel(Uu,d,h);return zm(p,i.shape)}});const Jm=Xp({batchNorm2d_:function(e,t,n,r,a,s){const i=jp(e,"x","batchNorm"),o=jp(t,"mean","batchNorm"),l=jp(n,"variance","batchNorm");let u,c;return null!=a&&(u=jp(a,"scale","batchNorm")),null!=r&&(c=jp(r,"offset","batchNorm")),Go(2===i.rank,(()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`)),Go(2===o.rank||1===o.rank,(()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${o.rank}.`)),Go(2===l.rank||1===l.rank,(()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`)),null!=u&&Go(2===u.rank||1===u.rank,(()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${u.rank}.`)),null!=c&&Go(2===c.rank||1===c.rank,(()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${c.rank}.`)),Km(i,o,l,c,u,s)}});const Ym=Xp({batchNorm3d_:function(e,t,n,r,a,s){const i=jp(e,"x","batchNorm"),o=jp(t,"mean","batchNorm"),l=jp(n,"variance","batchNorm");let u,c;return null!=a&&(u=jp(a,"scale","batchNorm")),null!=r&&(c=jp(r,"offset","batchNorm")),Go(3===i.rank,(()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`)),Go(3===o.rank||1===o.rank,(()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${o.rank}.`)),Go(3===l.rank||1===l.rank,(()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`)),null!=u&&Go(3===u.rank||1===u.rank,(()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${u.rank}.`)),null!=c&&Go(3===c.rank||1===c.rank,(()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${c.rank}.`)),Km(i,o,l,c,u,s)}});const eg=Xp({batchNorm4d_:function(e,t,n,r,a,s){const i=jp(e,"x","batchNorm"),o=jp(t,"mean","batchNorm"),l=jp(n,"variance","batchNorm");let u,c;return null!=a&&(u=jp(a,"scale","batchNorm")),null!=r&&(c=jp(r,"offset","batchNorm")),Go(4===i.rank,(()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`)),Go(4===o.rank||1===o.rank,(()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${o.rank}.`)),Go(4===l.rank||1===l.rank,(()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`)),null!=u&&Go(4===u.rank||1===u.rank,(()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${u.rank}.`)),null!=c&&Go(4===c.rank||1===c.rank,(()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${c.rank}.`)),Km(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 tg=Xp({bincount_:function(e,t,n){const r=jp(e,"x","bincount"),a=jp(t,"weights","bincount");Go("int32"===r.dtype,(()=>`Error in bincount: input dtype must be int32, but got ${r.dtype}`)),Go(n>=0,(()=>`size must be non-negative, but got ${n}.`)),Go(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 Dp.runKernel(Yl,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 ng=Xp({bitwiseAnd_:function(e,t){const n=jp(e,"x","bitwiseAnd"),r=jp(t,"y","bitwiseAnd");if(!qo(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 Dp.runKernel(eu,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 rg=Xp({broadcastArgs_:function(e,t){const n=jp(e,"s0","broadcastArgs","int32"),r=jp(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 Dp.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 ag=Xp({broadcastTo_:function(e,t){let n=jp(e,"broadcastTo","x");const r=n.shape;if(xl(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=zm(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 om(n);const i={x:n},o={reps:s};return Dp.runKernel(Rd,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 sg=Xp({ceil_:function(e){const t={x:jp(e,"x","ceil","float32")};return Dp.runKernel(au,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 ig(e,t,n){xl(e);const r={shape:e,value:t,dtype:n=n||dl(t)};return Dp.runKernel(Pu,{},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 og=Xp({clipByValue_:function(e,t,n){const r=jp(e,"x","clipByValue");if(Go(t<=n,(()=>`Error in clip: min (${t}) must be less than or equal to max (${n}).`)),t===n)return ig(r.shape,t,r.dtype);const a={x:r},s={clipValueMin:t,clipValueMax:n};return Dp.runKernel(su,a,s)}});const lg=Xp({concat1d_:function(e){return Um(e,0)}});const ug=Xp({concat2d_:function(e,t){return Um(e,t)}});const cg=Xp({concat3d_:function(e,t){return Um(e,t)}});const dg=Xp({concat4d_:function(e,t){return Um(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 hg=Xp({conv2d_:function(e,t,n,r,a="NHWC",s=[1,1],i){const o=jp(e,"x","conv2d","float32"),l=jp(t,"filter","conv2d","float32");let u=o,c=!1;3===o.rank&&(c=!0,u=zm(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Go(4===u.rank,(()=>`Error in conv2d: input must be rank 4, but got rank ${u.rank}.`)),Go(4===l.rank,(()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`)),Pm("conv2d",r,i);const d="NHWC"===a?u.shape[3]:u.shape[1];Go(d===l.shape[2],(()=>`Error in conv2d: depth of input (${d}) must match input depth for filter ${l.shape[2]}.`)),Go(Mm(n,s),(()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`)),Go(Lm(s),(()=>"Error in conv2D: Dilated rates should be larger than 0.")),Go(Lm(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=Dp.runKernel(uu,h,p);return c?zm(f,[f.shape[1],f.shape[2],f.shape[3]]):f}});const pg=Xp({conv1d_:function(e,t,n,r,a="NWC",s=1,i){const o=jp(e,"x","conv1d"),l=jp(t,"filter","conv1d");let u=o,c=!1;2===o.rank&&(c=!0,u=zm(o,[1,o.shape[0],o.shape[1]])),Go(3===u.rank,(()=>`Error in conv1d: input must be rank 3, but got rank ${u.rank}.`)),Go(3===l.rank,(()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`)),Pm("conv1d",r,i),Go(u.shape[2]===l.shape[1],(()=>`Error in conv1d: depth of input (${u.shape[2]}) must match input depth for filter ${l.shape[1]}.`)),Go(Mm(n,s),(()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${s}'`)),Go(Lm(s),(()=>"Error in conv1D: Dilated rates should be larger than 0.")),Go(Lm(n),(()=>"Error in conv1D: Stride should be larger than 0.")),Go("NWC"===a,(()=>`Error in conv1d: got dataFormat of ${a} but only NWC is currently supported.`));const d=zm(l,[1,l.shape[0],l.shape[1],l.shape[2]]),h=zm(u,[u.shape[0],1,u.shape[1],u.shape[2]]),p=hg(h,d,[1,n],r,"NHWC",[1,s],i);return zm(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 fg=Xp({conv2DBackpropInput_:function(e,t,n,r,a,s="NHWC",i){Go(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=zm(t,[1,t.shape[0],t.shape[1],t.shape[2]]),o=[1,e[0],e[1],e[2]]),Go(4===o.length,(()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${o.length}.`)),Go(4===l.rank,(()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`)),Go(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];Go(c===n.shape[2],(()=>`Error in conv2dDerInput: depth of input (${c}) must match input depth for filter ${n.shape[2]}.`)),Go(d===n.shape[3],(()=>`Error in conv2dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[3]}.`)),Pm("conv2dDerInput",a,i);const h={dy:l,filter:n},p={strides:r,pad:a,dataFormat:s,dimRoundingMode:i,inputShape:o},f=Dp.runKernel(du,h,p);return u?zm(f,[f.shape[1],f.shape[2],f.shape[3]]):f}});const mg=Xp({conv2dTranspose_:function(e,t,n,r,a,s){const i=jp(e,"x","conv2dTranspose"),o=jp(t,"filter","conv2dTranspose");return fg(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 gg=Xp({conv3d_:function(e,t,n,r,a="NDHWC",s=[1,1,1]){const i=jp(e,"x","conv3d"),o=jp(t,"filter","conv3d");let l=i,u=!1;4===i.rank&&(u=!0,l=zm(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Go(5===l.rank,(()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`)),Go(5===o.rank,(()=>`Error in conv3d: filter must be rank 5, but got rank ${o.rank}.`)),Go(l.shape[4]===o.shape[3],(()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${o.shape[3]}.`)),Go(Mm(n,s),(()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`)),Go("NDHWC"===a,(()=>`Error in conv3d: got dataFormat of ${a} but only NDHWC is currently supported.`)),Go(Lm(s),(()=>"Error in conv3D: Dilated rates should be larger than 0.")),Go(Lm(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=Dp.runKernel(hu,c,d);return u?zm(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 yg=Xp({conv3DBackpropInput_:function(e,t,n,r,a){Go(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=zm(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];Go(5===s.length,(()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${s.length}.`)),Go(5===i.rank,(()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`)),Go(5===n.rank,(()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${n.rank}`)),Go(l===n.shape[3],(()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${n.shape[3]}.`)),Go(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=Dp.runKernel(fu,c,d);return o?zm(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}});const bg=Xp({conv3dTranspose_:function(e,t,n,r,a){const s=jp(e,"x","conv3dTranspose"),i=jp(t,"filter","conv3dTranspose");return yg(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 vg=Xp({cos_:function(e){const t={x:jp(e,"x","cos","float32")};return Dp.runKernel(mu,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=Xp({cosh_:function(e){const t={x:jp(e,"x","cosh","float32")};return Dp.runKernel(gu,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 xg=Xp({cumprod_:function(e,t=0,n=!1,r=!1){const a={x:jp(e,"x","cumprod")},s={axis:t,exclusive:n,reverse:r};return Dp.runKernel(yu,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 kg=Xp({cumsum_:function(e,t=0,n=!1,r=!1){const a={x:jp(e,"x","cumsum")},s={axis:t,exclusive:n,reverse:r};return Dp.runKernel(bu,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 wg=Xp({denseBincount_:function(e,t,n,r=!1){const a=jp(e,"x","denseBincount"),s=jp(t,"weights","denseBincount");Go("int32"===a.dtype,(()=>`Error in denseBincount: input dtype must be int32, but got ${a.dtype}`)),Go(a.rank<=2,(()=>`Error in denseBincount: input must be at most rank 2, but got rank ${a.rank}.`)),Go(n>=0,(()=>`size must be non-negative, but got ${n}.`)),Go(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 Dp.runKernel(Au,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 Sg=Xp({depthToSpace_:function(e,t,n="NHWC"){const r=jp(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];Go(t>1,(()=>`blockSize should be > 1 for depthToSpace, but was: ${t}`)),Go(a*t>=0,(()=>`Negative dimension size caused by overflow when multiplying\n    ${a} and ${t}  for depthToSpace with input shape\n    ${r.shape}`)),Go(s*t>=0,(()=>`Negative dimension size caused by overflow when multiplying\n    ${s} and ${t} for depthToSpace with input shape\n        ${r.shape}`)),Go(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 Dp.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 Cg=Xp({depthwiseConv2d_:function(e,t,n,r,a="NHWC",s=[1,1],i){const o=jp(e,"x","depthwiseConv2d","float32"),l=jp(t,"filter","depthwiseConv2d","float32");let u=o,c=!1;3===o.rank&&(c=!0,u=zm(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Go(4===u.rank,(()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${u.rank}.`)),Go(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];Go(d===l.shape[2],(()=>`Error in depthwiseConv2d: number of input channels (${d}) must match the inChannels dimension in filter ${l.shape[2]}.`)),Pm("depthwiseConv2d",r,i);const h={x:u,filter:l},p={strides:n,pad:r,dataFormat:a,dilations:s,dimRoundingMode:i},f=Dp.runKernel(ku,h,p);return c?zm(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 Ig=Xp({diag_:function(e){const t={x:jp(e,"x","diag")};return Dp.runKernel(Cu,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 Wg=Xp({dilation2d_:function(e,t,n,r,a=[1,1],s="NHWC"){const i=jp(e,"x","dilation2d"),o=jp(t,"filter","dilation2d");Go(3===i.rank||4===i.rank,(()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`)),Go(3===o.rank,(()=>`Error in dilation2d: filter must be rank 3, but got rank ${o.rank}.`)),Go("NHWC"===s,(()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${s}`));let l=i,u=!1;3===i.rank&&(l=zm(i,[1,i.shape[0],i.shape[1],i.shape[2]]),u=!0),Go(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=Dp.runKernel(Iu,c,d);return u?zm(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 _g(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 Tg(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 Ng(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 Eg=Object.freeze(Object.defineProperty({__proto__:null,assertAndGetBroadcastShape:Ng,getBroadcastDims:_g,getReductionAxes:Tg},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 Rg=Xp({equal_:function(e,t){let n=jp(e,"a","equal","string_or_numeric"),r=jp(t,"b","equal","string_or_numeric");[n,r]=Wp(n,r),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(Fu,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 $g=Xp({where_:function(e,t,n){const r=jp(t,"a","where"),a=jp(n,"b","where"),s=jp(e,"condition","where","bool"),i=Ng(Ng(s.shape,r.shape),a.shape),o={condition:ag(s,i),t:ag(r,i),e:ag(a,i)};return Dp.runKernel(ad,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 Og=Xp({zerosLike_:function(e){const t={x:jp(e,"x","zerosLike")};return Dp.runKernel(Bd,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=Xp({divNoNan_:function(e,t){let n=jp(e,"a","div"),r=jp(t,"b","div");[n,r]=Wp(n,r);const a=dm(n,r),s=Og(a),i=Rg(r,s);return $g(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 Dg=Xp({dot_:function(e,t){const n=jp(e,"t1","dot"),r=jp(t,"t2","dot");Go(!(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(Go(a===s,(()=>`Error in dot: inner dimensions of inputs must match, but got ${a} and ${s}.`)),1===n.rank&&1===r.rank){const e=zm(n,[1,-1]),t=zm(r,[-1,1]),a=Hm(e,t);return zm(a,[])}if(1===n.rank&&2===r.rank){const e=zm(n,[1,-1]),t=zm(r,[r.shape[0],r.shape[1]]),a=Hm(e,t);return zm(a,[a.size])}if(2===n.rank&&1===r.rank){const e=zm(r,[-1,1]),t=Hm(n,e);return zm(t,[t.size])}{const e=zm(r,[r.shape[0],r.shape[1]]);return Hm(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 Mg=Xp({einsum_:function(e,...t){const n=t.map(((e,t)=>jp(e,`tensors${t}`,"einsum"))),r={equation:e};return Dp.runKernel(Eu,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 Lg=Xp({elu_:function(e){const t={x:jp(e,"x","elu","float32")};return Dp.runKernel(Ru,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 Bg=Xp({ensureShape_:function(e,t){const n=jp(e,"x","ensureShape","string_or_numeric");if(!jo(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 Pg=Xp({erf_:function(e){let t=jp(e,"x","erf");Go("int32"===t.dtype||"float32"===t.dtype,(()=>"Input dtype must be `int32` or `float32`.")),"int32"===t.dtype&&(t=im(t,"float32"));const n={x:t};return Dp.runKernel(Ou,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 zg(e,t){for(let n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function Gg(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 Vg(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 Ug(e,t){return Gg(e,t.map((e=>1)),t)}function Hg(e,t,n){Go(zg(t,n),(()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`))}function jg(e,t){if(zg(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 qg(e){return e.map(((e,t)=>[t,e])).sort(((e,t)=>e[1]-t[1])).map((e=>e[0]))}function Qg(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 Xg=Xp({max_:function(e,t=null,n=!1){const r={x:jp(e,"x","max")},a={reductionIndices:t,keepDims:n};return Dp.runKernel(pc,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 Zg=Xp({min_:function(e,t=null,n=!1){const r={x:jp(e,"x","min")},a={axis:t,keepDims:n};return Dp.runKernel(xc,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 Kg=Xp({pow_:function(e,t){let n=jp(e,"base","pow"),r=jp(t,"exp","pow");[n,r]=Wp(n,r);const a={a:n,b:r};return Dp.runKernel(Dc,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 Jg(e,t){if((jh(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&&jh(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Kp(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 Yg=Xp({sqrt_:function(e){const t={x:jp(e,"x","sqrt","float32")};return Dp.runKernel(hd,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 ey=Xp({square_:function(e){const t=jp(e,"x","square");return Dp.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 ty=Xp({sum_:function(e,t=null,n=!1){let r=jp(e,"x","sum");"bool"===r.dtype&&(r=im(r,"int32"));const a={x:r},s={axis:t,keepDims:n};return Dp.runKernel(pd,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 ny(e,t,n=null){if(0===e.rank)return pm(e);if(1!==e.rank&&null===n)return ny(zm(e,[-1]),t,n);if(1===e.rank||"number"==typeof n||Array.isArray(n)&&1===n.length){if(1===t)return ty(pm(e),n);if(t===1/0)return Xg(pm(e),n);if(t===-1/0)return Zg(pm(e),n);if("euclidean"===t||2===t)return Yg(ty(Kg(pm(e),Jg(2,"int32")),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}if(Array.isArray(n)&&2===n.length){if(1===t)return Xg(ty(pm(e),n[0]),n[1]-1);if(t===1/0)return Xg(ty(pm(e),n[1]),n[0]);if(t===-1/0)return Zg(ty(pm(e),n[1]),n[0]);if("fro"===t||"euclidean"===t)return Yg(ty(ey(e),n));throw new Error(`Error in norm: invalid ord value: ${t}`)}throw new Error(`Error in norm: invalid axis: ${n}`)}const ry=Xp({norm_:function(e,t="euclidean",n=null,r=!1){const a=ny(e=jp(e,"x","norm"),t,n);let s=a.shape;if(r){const t=Yo(n,e.shape);s=Ug(a.shape,t)}return zm(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 ay=Xp({euclideanNorm_:function(e,t=null,n=!1){return ry(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 sy=Xp({exp_:function(e){const t={x:jp(e,"x","exp")};return Dp.runKernel(Du,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 iy=Xp({expandDims_:function(e,t=0){const n=jp(e,"x","expandDims","string_or_numeric");Go(t<=n.rank,(()=>"Axis must be <= rank of the tensor"));const r={input:n},a={dim:t};return Dp.runKernel(Mu,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 oy=Xp({expm1_:function(e){const t={x:jp(e,"x","expm1")};return Dp.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 ly=Xp({tile_:function(e,t){const n=jp(e,"x","tile","string_or_numeric");Go(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 Dp.runKernel(Rd,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 uy=Xp({eye_:function(e,t,n,r="float32"){null==t&&(t=e);const a=sm([e,t],r),s=e<=t?e:t;for(let o=0;o<s;++o)a.set(1,o,o);const i=zm(a.toTensor(),[e,t]);if(null==n)return i;if(1===n.length)return ly(iy(i,0),[n[0],1,1]);if(2===n.length)return ly(iy(iy(i,0),0),[n[0],n[1],1,1]);if(3===n.length)return ly(iy(iy(iy(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 cy=Xp({floor_:function(e){const t={x:jp(e,"x","floor","float32")};return Dp.runKernel(Gu,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 dy=Xp({gather_:function(e,t,n=0,r=0){const a={x:jp(e,"x","gather"),indices:jp(t,"indices","gather","int32")},s={axis:n,batchDims:r};return Dp.runKernel(Hu,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 hy=Xp({greater_:function(e,t){let n=jp(e,"a","greater","string_or_numeric"),r=jp(t,"b","greater","string_or_numeric");[n,r]=Wp(n,r),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(qu,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 py=Xp({greaterEqual_:function(e,t){let n=jp(e,"a","greaterEqual","string_or_numeric"),r=jp(t,"b","greaterEqual","string_or_numeric");[n,r]=Wp(n,r),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(Qu,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 fy=Xp({imag_:function(e){const t={input:jp(e,"input","imag")};return Dp.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 my=Xp({isFinite_:function(e){const t={x:jp(e,"x","isFinite")};return Dp.runKernel(Ju,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 gy=Xp({isInf_:function(e){const t={x:jp(e,"x","isInf")};return Dp.runKernel(Yu,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 yy=Xp({isNaN_:function(e){const t={x:jp(e,"x","isNaN")};return Dp.runKernel(ec,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 by=Xp({leakyRelu_:function(e,t=.2){const n={x:jp(e,"x","leakyRelu")},r={alpha:t};return Dp.runKernel(tc,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 vy=Xp({less_:function(e,t){let n=jp(e,"a","less","string_or_numeric"),r=jp(t,"b","less","string_or_numeric");[n,r]=Wp(n,r),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.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 Ay=Xp({lessEqual_:function(e,t){let n=jp(e,"a","lessEqual","string_or_numeric"),r=jp(t,"b","lessEqual","string_or_numeric");[n,r]=Wp(n,r),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(rc,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 xy(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 Dp.runKernel(ac,{},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 ky=Xp({localResponseNormalization_:function(e,t=5,n=1,r=1,a=.5){const s=jp(e,"x","localResponseNormalization");Go(4===s.rank||3===s.rank,(()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got\n               rank ${s.rank}.`)),Go(Qo(t),(()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`));let i=s,o=!1;3===s.rank&&(o=!0,i=zm(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=Dp.runKernel(dc,l,u);return o?zm(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 wy=Xp({log_:function(e){const t={x:jp(e,"x","log","float32")};return Dp.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 Sy=Xp({log1p_:function(e){const t={x:jp(e,"x","log1p")};return Dp.runKernel(ic,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 Cy(e,t){Go(hl(e),(()=>"The f passed in variableGrads(f) must be a function")),Go(null==t||Array.isArray(t)&&t.every((e=>e instanceof dp)),(()=>"The varList passed in variableGrads(f, varList) must be an array of variables"));const n=null!=t;if(!n){t=[];for(const e in Dp.registeredVariables)t.push(Dp.registeredVariables[e])}const r=n?t.filter((e=>!e.trainable)):null,a=t.length;Go((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}=Dp.gradients(e,t,null,!0);Go(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().")),Go(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 Iy(e){return Dp.customGrad(e)}function Wy(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 _y=Xp({neg_:function(e){const t={x:jp(e,"x","neg")};return Dp.runKernel(Wc,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 Ty=Xp({softplus_:function(e){const t={x:jp(e,"x","softplus")};return Dp.runKernel(dd,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 Ny=Xp({logSigmoid_:function(e){const t=jp(e,"x","logSigmoid");return Iy((e=>({value:_y(Ty(_y(e))),gradFunc:t=>hm(t,jm(_y(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 Ey=Xp({sub_:function(e,t){let n=jp(e,"a","sub"),r=jp(t,"b","sub");[n,r]=Wp(n,r);const a={a:n,b:r};return Dp.runKernel(Td,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 Ry=Xp({logSoftmax_:function(e,t=-1){const n=jp(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 Iy(((e,n)=>{const r=Xg(e,t,!0),a=Ey(e,r),s=Ey(im(a,"float32"),wy(ty(sy(a),t,!0)));n([s]);return{value:s,gradFunc:(e,n)=>{const[r]=n,a=sy(r);return Ey(e,hm(ty(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 $y=Xp({logSumExp_:function(e,t=null,n=!1){const r=jp(e,"x","logSumExp"),a=Yo(t,r.shape),s=Xg(r,a,!0),i=Ey(r,s),o=sy(i),l=ty(o,a),u=wy(l),c=um(zm(s,u.shape),u);if(n){const e=Ug(c.shape,a);return zm(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 Oy=Xp({logicalAnd_:function(e,t){const n=jp(e,"a","logicalAnd","bool"),r=jp(t,"b","logicalAnd","bool");Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(oc,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 Fy=Xp({logicalNot_:function(e){const t={x:jp(e,"x","logicalNot","bool")};return Dp.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 Dy=Xp({logicalOr_:function(e,t){const n=jp(e,"a","logicalOr","bool"),r=jp(t,"b","logicalOr","bool");Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(uc,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 My=Xp({logicalXor_:function(e,t){const n=jp(e,"a","logicalXor","bool"),r=jp(t,"b","logicalXor","bool");return Ng(n.shape,r.shape),Oy(Dy(e,t),Fy(Oy(e,t)))}}),Ly=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 By=Xp({searchSorted_:function(e,t,n="left"){const r=jp(e,"sortedSequence","searchSorted"),a=jp(t,"values","searchSorted"),s=r.shape[r.shape.length-1],i=a.shape[a.shape.length-1],o=zm(r,[-1,s]),l=zm(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(Ho(l.shape)>=Ly)throw new Error("values tensor size must less than 2147483648");if(o.shape[1]>=Ly)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 Dp.runKernel(rd,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 Py(e,t){return By(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 zy=Xp({maxPool_:function(e,t,n,r,a){const s=jp(e,"x","maxPool");let i=s,o=!1;3===s.rank&&(o=!0,i=zm(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Go(4===i.rank,(()=>`Error in maxPool: input must be rank 4 but got rank ${i.rank}.`)),Go(Mm(n,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`)),Pm("maxPool",r,a);const l={x:i},u={filterSize:t,strides:n,pad:r,dimRoundingMode:a},c=Dp.runKernel(mc,l,u);return o?zm(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 Gy=Xp({maxPool3d_:function(e,t=[1,1,1],n,r,a,s="NDHWC"){const i=jp(e,"x","maxPool3d");let o=i,l=!1;4===i.rank&&(l=!0,o=zm(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),Go(5===o.rank,(()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`)),Go("NDHWC"===s,(()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`)),Pm("maxPool3d",r,a);const u={x:o},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:s},d=Dp.runKernel(yc,u,c);return l?zm(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 Vy=Xp({maxPoolWithArgmax_:function(e,t,n,r,a=!1){const s={x:jp(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:r,includeBatchInIndex:a},o=Dp.runKernel(vc,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 Uy=Xp({maximum_:function(e,t){let n=jp(e,"a","maximum"),r=jp(t,"b","maximum");[n,r]=Wp(n,r),"bool"===n.dtype&&(n=im(n,"int32"),r=im(r,"int32")),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(fc,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 Hy=Xp({mean_:function(e,t=null,n=!1){const r={x:jp(e,"x","mean")},a={axis:t,keepDims:n};return Dp.runKernel(Ac,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 jy(e,t="float32"){if(xl(e),"complex64"===t){const t=jy(e,"float32"),n=jy(e,"float32");return Zp(t,n)}const n=vl(Ho(e),t);return Dp.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 qy(e,t="float32"){if(xl(e),"complex64"===t){const t=qy(e,"float32"),n=jy(e,"float32");return Zp(t,n)}const n=bl(Ho(e),t);return Dp.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 Qy(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=jp(e,"x","meshgrid",e instanceof up?e.dtype:"float32");if(void 0===t)return[r];let a=jp(t,"y","meshgrid",t instanceof up?t.dtype:"float32");const s=Ho(r.shape),i=Ho(a.shape);return"xy"===n?(r=zm(r,[1,-1]),a=zm(a,[-1,1]),[Hm(qy([i,1],r.dtype),r),Hm(a,qy([1,s],a.dtype))]):(r=zm(r,[-1,1]),a=zm(a,[1,-1]),[Hm(r,qy([1,i],r.dtype)),Hm(qy([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 Xy=Xp({minimum_:function(e,t){let n=jp(e,"a","minimum"),r=jp(t,"b","minimum");[n,r]=Wp(n,r),"bool"===n.dtype&&(n=im(n,"int32"),r=im(r,"int32")),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(kc,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 Zy=Xp({mirrorPad_:function(e,t,n){Go("reflect"===n||"symmetric"===n,(()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`));const r=jp(e,"x","mirrorPad");if(0===r.rank)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");Go(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++)Go(2===t[o].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),Go(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 Dp.runKernel(wc,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 Ky=Xp({mod_:function(e,t){let n=jp(e,"a","mod"),r=jp(t,"b","mod");[n,r]=Wp(n,r);const a={a:n,b:r};return Dp.runKernel(Sc,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 Jy=Xp({moments_:function(e,t=null,n=!1){const r=Yo(t,(e=jp(e,"x","moments")).shape),a=Hy(e,r,n);let s=a.shape;n||(s=Ug(a.shape,r));const i=ey(Ey(im(e,"float32"),zm(a,s)));return{mean:a,variance:Hy(i,r,n)}}});const Yy=Xp({multiRNNCell_:function(e,t,n,r){const a=jp(t,"data","multiRNNCell"),s=qp(n,"c","multiRNNCell"),i=qp(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 eb=Xp({multinomial_:function(e,t,n,r=!1){const a=jp(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?zm(a,[1,-1]):a},l={numSamples:t,seed:n,normalized:r},u=Dp.runKernel(Cc,o,l);return 1===i?zm(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 tb=Xp({notEqual_:function(e,t){let n=jp(e,"a","notEqual","string_or_numeric"),r=jp(t,"b","notEqual","string_or_numeric");[n,r]=Wp(n,r),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(_c,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 nb=Xp({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:jp(e,"indices","oneHot","int32")},i={dtype:a,depth:t,onValue:n,offValue:r};return Dp.runKernel($c,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 rb=Xp({onesLike_:function(e){const t={x:jp(e,"x","onesLike")};return Dp.runKernel(Rc,t)}});const ab=Xp({outerProduct_:function(e,t){const n=jp(e,"v1","outerProduct"),r=jp(t,"v2","outerProduct");Go(1===n.rank&&1===r.rank,(()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${n.rank} and ${r.rank}.`));const a=zm(n,[-1,1]),s=zm(r,[1,-1]);return Hm(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 sb=Xp({pad_:function(e,t,n=0){const r=jp(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 Dp.runKernel(Fc,s,a)}});const ib=Xp({pad1d_:function(e,t,n=0){return Go(2===t.length,(()=>"Invalid number of paddings. Must be length of 2.")),sb(e,[t],n)}});const ob=Xp({pad2d_:function(e,t,n=0){return Go(2===t.length&&2===t[0].length&&2===t[1].length,(()=>"Invalid number of paddings. Must be length of 2 each.")),sb(e,t,n)}});const lb=Xp({pad3d_:function(e,t,n=0){return Go(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.")),sb(e,t,n)}});const ub=Xp({pad4d_:function(e,t,n=0){return Go(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.")),sb(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 cb=Xp({spaceToBatchND_:function(e,t,n){const r=jp(e,"x","spaceToBatchND");Go(r.rank>=1+t.length,(()=>`input rank ${r.rank} should be > than [blockShape] ${t.length}`)),Go(n.length===t.length,(()=>`paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`)),Go(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 Dp.runKernel(fd,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 db=Xp({pool_:function(e,t,n,r,a,s,i){null==a&&(a=[1,1]),null==s&&(s=1),0===r&&(r="valid");const o=jp(e,"x","maxPool");let l=o,u=!1;3===o.rank&&(u=!0,l=zm(o,[1,o.shape[0],o.shape[1],o.shape[2]])),Go(Mm(s,a),(()=>`Error in pool: Either strides or dilations must be 1. Got strides ${s} and dilations '${a}'`));const c=Wm(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:cb(l,d,f),b=("avg"===n?()=>Gm(y,t,s,g,i):()=>zy(y,t,s,g,i))(),v=p?b:Zm(b,d,m);return u?zm(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 hb=Xp({prelu_:function(e,t){const n={x:jp(e,"x","prelu"),alpha:jp(t,"alpha","prelu")};return Dp.runKernel(Mc,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 pb=Xp({prod_:function(e,t=null,n=!1){let r=jp(e,"x","prod");"bool"===r.dtype&&(r=im(r,"int32"));const a={x:r},s={axis:t,keepDims:n};return Dp.runKernel(Lc,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 fb=Xp({raggedGather_:function(e,t,n,r){const a={paramsNestedSplits:e.map(((e,t)=>jp(e,`tensors${t}`,"raggedGather","int32"))),paramsDenseValues:jp(t,"paramsDenseValues","raggedGather"),indices:jp(n,"indices","raggedGather","int32")},s={outputRaggedRank:r},i=Dp.runKernel(Bc,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 mb=Xp({raggedRange_:function(e,t,n){const r=jp(e,"starts","raggedRange"),a={starts:r,limits:jp(t,"limits","raggedRange",r.dtype),deltas:jp(n,"deltas","raggedRange",r.dtype)},s=Dp.runKernel(Pc,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 gb=Xp({raggedTensorToTensor_:function(e,t,n,r,a){const s=jp(e,"shape","raggedTensorToTensor","int32"),i=jp(t,"values","raggedTensorToTensor"),o={shape:s,values:i,defaultValue:jp(n,"defaultValue","raggedTensorToTensor",i.dtype),rowPartitionTensors:r.map(((e,t)=>jp(e,`tensors${t}`,"raggedTensorToTensor","int32")))},l={rowPartitionTypes:a};return Dp.runKernel(zc,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 yb=Xp({rand_:function(e,t,n){xl(e);const r=Ho(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 Dp.makeTensor(a,e,n)}});var bb={exports:{}};!function(e,t,n){function r(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 a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var n=new r(e),s=t&&t.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,s&&("object"==typeof s&&a(s,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=s:this.alea=s}(0,bb);var vb=bb.exports,Ab={exports:{}};!function(e,t,n){function r(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 a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function s(e,t){var n=new r(e),s=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,s&&("object"==typeof s&&a(s,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=s:this.xor128=s}(0,Ab);var xb=Ab.exports,kb={exports:{}};!function(e,t,n){function r(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 a(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 s(e,t){var n=new r(e),s=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,s&&("object"==typeof s&&a(s,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=s:this.xorwow=s}(0,kb);var wb=kb.exports,Sb={exports:{}};!function(e,t,n){function r(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 a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var n=new r(e),s=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,s&&(s.x&&a(s,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=s:this.xorshift7=s}(0,Sb);var Cb=Sb.exports,Ib={exports:{}};!function(e,t,n){function r(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 a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var n=new r(e),s=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,s&&(s.X&&a(s,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=s:this.xor4096=s}(0,Ib);var Wb=Ib.exports,_b={exports:{}};!function(e,t,n){function r(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 a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function s(e,t){var n=new r(e),s=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,s&&("object"==typeof s&&a(s,n),i.state=function(){return a(n,{})}),i}t&&t.exports?t.exports=s:this.tychei=s}(0,_b);var Tb,Nb=_b.exports,Eb={exports:{}};Tb=Eb,function(e,t,n){var r,a=256,s="random",i=n.pow(a,6),o=n.pow(2,52),l=2*o,u=a-1;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(_X){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(_X){}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),Tb.exports){Tb.exports=c;try{r=R}catch(g){}}else n["seed"+s]=c}("undefined"!=typeof self?self:ze,[],Math);var Rb=vb,$b=xb,Ob=wb,Fb=Cb,Db=Wb,Mb=Nb,Lb=Eb.exports;Lb.alea=Rb,Lb.xor128=$b,Lb.xorwow=Ob,Lb.xorshift7=Fb,Lb.xor4096=Db,Lb.tychei=Mb;var Bb=Lb;
/**
 * @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 Pb=.001,zb=.1;function Gb(){return 32===Dp.backend.floatPrecision()?Pb:zb}function Vb(e,t,n){let r=!0;if((jh(e)||jh(t))&&(r=!1),jh(e)&&jh(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=Vp(e),r=Vp(t);if(!qo(n,r))throw new Error(`Arrays have different shapes. Actual: [${n}]. Expected: [${r}]`)}const a=jh(e)?e:qh(e),s=jh(t)?t:qh(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 Ub(e,t,n){return!isFinite(e)&&!isFinite(t)||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}const Hb=Object.freeze(Object.defineProperty({__proto__:null,TEST_EPSILON_FLOAT16:zb,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]=Uh(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=Gb()),Vb(e,t,((e,t)=>Ub(e,t,n)))},expectArraysEqual:function(e,t){const n="string"==typeof t||"number"==typeof t||"boolean"==typeof t?[t]:t;return ll(e)||ll(e[0])||ll(t)||ll(t[0])?Vb(e,n,((e,t)=>e==t)):Vb(e,t,((e,t)=>Ub(e,t,0)))},expectNumbersClose:function(e,t,n){if(null==n&&(n=Gb()),!Ub(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:Gb},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 jb{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=Bb.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 qb{constructor(e,t,n,r){this.alpha=e,this.beta=1/t,this.dtype=n;const a=r||Math.random();this.randu=Bb.alea(a.toString()),this.randn=new jb(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 Qb{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=Bb.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 Xb=Xp({randomGamma_:function(e,t,n=1,r="float32",a){if(xl(e),null==n&&(n=1),null==r&&(r="float32"),"float32"!==r&&"int32"!==r)throw new Error(`Unsupported data type ${r}`);const s=new qb(t,n,r,a),i=sm(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 Zb=Xp({randomNormal_:function(e,t=0,n=1,r,a){if(xl(e),null!=r&&"bool"===r)throw new Error(`Unsupported data type ${r}`);const s=new jb(t,n,r,!1,a),i=sm(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 Kb=Xp({randomStandardNormal_:function(e,t,n){if(null!=t&&"bool"===t)throw new Error(`Unsupported data type ${t}`);return Zb(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 Jb=Xp({randomUniform_:function(e,t=0,n=1,r="float32",a){xl(e);const s=sm(e,r),i=new Qb(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 Yb=Xp({randomUniformInt_:function(e,t,n,r){return Jb(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 ev(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 Dp.runKernel(Gc,{},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 tv=Xp({real_:function(e){const t={input:jp(e,"input","real")};return Dp.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 nv=Xp({reciprocal_:function(e){const t={x:jp(e,"x","reciprocal")};return Dp.runKernel(Uc,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 rv=Xp({relu_:function(e){const t={x:jp(e,"x","relu")};return Dp.runKernel(Hc,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 av=Xp({relu6_:function(e){const t={x:jp(e,"x","relu6")};return Dp.runKernel(Kc,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 sv=Xp({reverse_:function(e,t){const n={x:jp(e,"x","reverse")},r={dims:t};return Dp.runKernel(Jc,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 iv=Xp({reverse1d_:function(e){const t=jp(e,"x","reverse");return Go(1===t.rank,(()=>`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`)),sv(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 ov=Xp({reverse2d_:function(e,t){const n=jp(e,"x","reverse");return Go(2===n.rank,(()=>`Error in reverse2D: x must be rank 2 but got rank ${n.rank}.`)),sv(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 lv=Xp({reverse3d_:function(e,t){const n=jp(e,"x","reverse");return Go(3===n.rank,(()=>`Error in reverse3D: x must be rank 3 but got rank ${n.rank}.`)),sv(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 uv=Xp({reverse4d_:function(e,t){const n=jp(e,"x","reverse");return Go(4===n.rank,(()=>`Error in reverse4D: x must be rank 4 but got rank ${n.rank}.`)),sv(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 cv=Xp({round_:function(e){const t={x:jp(e,"x","round")};return Dp.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 dv=Xp({rsqrt_:function(e){const t={x:jp(e,"x","rsqrt","float32")};return Dp.runKernel(ed,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 hv=Xp({selu_:function(e){const t={x:jp(e,"x","selu")};return Dp.runKernel(sd,t)}});const pv=Xp({separableConv2d_:function(e,t,n,r,a,s=[1,1],i="NHWC"){const o=jp(e,"x","separableConv2d"),l=jp(t,"depthwiseFilter","separableConv2d"),u=jp(n,"pointwiseFilter","separableConv2d");let c=o,d=!1;if(3===o.rank&&(d=!0,c=zm(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");Go(4===c.rank,(()=>`Error in separableConv2d: input must be rank 4, but got rank ${c.rank}.`)),Go(4===l.rank,(()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`)),Go(4===u.rank,(()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`)),Go(1===u.shape[0],(()=>`Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got ${u.shape[0]}.`)),Go(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];Go(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=Cg(c,l,r,a,i,s),m=hg(f,u,1,"valid",i);return d?zm(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 fv=async function(e,t){const n=jp(e,"x","setdiff1d"),r=jp(t,"y","setdiff1d");Go(n.dtype===r.dtype,(()=>`x and y should have the same dtype, but got x (${n.dtype}) and y (${r.dtype}).`)),Go(1===n.rank,(()=>`x should be 1D tensor, but got x (${n.shape}).`)),Go(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 ip([o],n.dtype),u=new ip([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 mv=Xp({sign_:function(e){const t={x:jp(e,"x","sign")};return Dp.runKernel(ud,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 gv=Xp({sin_:function(e){const t={x:jp(e,"x","sin","float32")};return Dp.runKernel(od,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 yv=Xp({sinh_:function(e){const t={x:jp(e,"x","sinh")};return Dp.runKernel(ld,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 bv=Xp({slice1d_:function(e,t,n){const r=jp(e,"x","slice1d");return Go(1===r.rank,(()=>`slice1d expects a rank-1 tensor, but got a rank-${r.rank} tensor`)),qm(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 vv=Xp({slice2d_:function(e,t,n){const r=jp(e,"x","slice2d");return Go(2===r.rank,(()=>`slice2d expects a rank-2 tensor, but got a rank-${r.rank} tensor`)),qm(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 Av=Xp({slice3d_:function(e,t,n){const r=jp(e,"x","slice3d");return Go(3===r.rank,(()=>`slice3d expects a rank-3 tensor, but got a rank-${r.rank} tensor`)),qm(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 xv=Xp({slice4d_:function(e,t,n){const r=jp(e,"x","slice4d");return Go(4===r.rank,(()=>`slice4d expects a rank-4 tensor, but got a rank-${r.rank} tensor`)),qm(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 kv=Xp({softmax_:function(e,t=-1){const n=jp(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 Dp.runKernel(gd,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 wv=Xp({fft_:function(e){Go("complex64"===e.dtype,(()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`));const t={input:e};return Dp.runKernel(Bu,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 Sv=Xp({ifft_:function(e){Go("complex64"===e.dtype,(()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`));const t={input:e};return Dp.runKernel(Zu,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 Cv=Xp({irfft_:function(e){const t=e.shape[e.shape.length-1],n=e.size/t;let r;if(t<=2){const a=zm(e,[n,t]);r=Sv(a)}else{const a=[n,2*(t-1)],s=zm(tv(e),[n,t]),i=zm(fy(e),[n,t]),o=sv(qm(s,[0,1],[n,t-2]),1),l=hm(sv(qm(i,[0,1],[n,t-2]),1),Jg(-1)),u=Um([s,o],1),c=Um([i,l],1),d=zm(Zp(u,c),[a[0],a[1]]);r=Sv(d)}if(r=tv(r),3===e.rank&&0!==e.shape[0]){const t=r,n=e.shape[0];r=zm(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 Iv=Xp({split_:function(e,t,n=0){const r={x:jp(e,"x","split")},a={numOrSizeSplits:t,axis:n};return Dp.runKernel(md,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 Wv=Xp({rfft_:function(e,t){Go("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=qm(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=Um([e,jy(r)],e.shape.length-1),n=t}else a=e;const s=Og(a),i=zm(Zp(a,s),[r,n]),o=wv(i),l=Math.floor(n/2)+1,u=tv(o),c=fy(o),d=Iv(u,[l,n-l],u.shape.length-1),h=Iv(c,[l,n-l],c.shape.length-1),p=a.shape.slice();return p[a.shape.length-1]=l,zm(Zp(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 _v=Xp({squaredDifference_:function(e,t){let n=jp(e,"a","squaredDifference"),r=jp(t,"b","squaredDifference");[n,r]=Wp(n,r),Ng(n.shape,r.shape);const a={a:n,b:r};return Dp.runKernel(kd,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 Tv=Xp({squeeze_:function(e,t){const n=jp(e,"x","squeeze","string_or_numeric");return zm(n,el(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 Nv=Xp({stack_:function(e,t=0){const n=qp(e,"tensors","stack","string_or_numeric");Go(n.length>=1,(()=>"Pass at least one tensor to tf.stack")),n.length>0&&Go(t<=n[0].rank,(()=>"Axis must be <= rank of the tensor"));const r=n,a={axis:t};return Dp.runKernel(Oc,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 Ev=Xp({step_:function(e,t=0){const n={x:jp(e,"x","step")},r={alpha:t};return Dp.runKernel(Pd,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 Rv=Xp({stridedSlice_:function(e,t,n,r,a=0,s=0,i=0,o=0,l=0){const u={x:jp(e,"x","stridedSlice","string_or_numeric")},c={begin:t,end:n,strides:r,beginMask:a,endMask:s,ellipsisMask:i,newAxisMask:o,shrinkAxisMask:l};return Dp.runKernel(Cd,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 $v=Xp({tan_:function(e){const t={x:jp(e,"x","tan","float32")};return Dp.runKernel(Nd,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 Ov(e,t){Uo(e);const n=Vp(e,t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Kp(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 Fv(e,t,n){if(Uo(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");const r=Vp(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 Kp(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 Dv(e,t,n){if(Uo(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");const r=Vp(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 Kp(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 Mv(e,t,n){if(Uo(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");const r=Vp(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 Kp(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 Lv(e,t,n){if(Uo(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");const r=Vp(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 Kp(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 Bv(e,t,n){if(Uo(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");const r=Vp(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 Kp(e,t=t||r,r,n)}function Pv(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 zv(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}`)}Pv(n,t,e)}function Gv(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:Ho(t.shape)/o,sliceSize:i,strides:[...fl(n.slice(0,a)),1],outputSize:Ho(n)}}const Vv=Object.freeze(Object.defineProperty({__proto__:null,calculateShapes:Gv,validateInput:zv,validateUpdateShape:Pv},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 Uv=Xp({tensorScatterUpdate_:function(e,t,n){const r=jp(e,"tensor","tensorScatterupdate"),a=jp(t,"indices","tensorScatterupdate","int32"),s=jp(n,"updates","tensorScatterupdate");if(zv(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 Dp.runKernel(nd,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 Hv=Xp({topk_:function(e,t=1,n=!0){const r=jp(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]=Dp.runKernel($d,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 jv=Xp({truncatedNormal_:function(e,t=0,n=1,r,a){if(xl(e),null!=r&&"bool"===r)throw new Error("Unsupported data type $ { dtype }");const s=new jb(t,n,r,!0,a),i=sm(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 qv=Xp({unique_:function(e,t=0){const n=jp(e,"x","unique","string_or_numeric");Go(n.rank>0,(()=>"The input tensor must be at least 1D"));const r={x:n},a={axis:t},[s,i]=Dp.runKernel(Dd,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 Qv=Xp({unsortedSegmentSum_:function(e,t,n){const r=jp(e,"x","unsortedSegmentSum"),a=jp(t,"segmentIds","unsortedSegmentSum","int32");Go(Qo(n),(()=>"numSegments must be of dtype int"));const s={x:r,segmentIds:a},i={numSegments:n};return Dp.runKernel(Ld,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 Xv=Xp({unstack_:function(e,t=0){const n=jp(e,"x","unstack","string_or_numeric");Go(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 Dp.runKernel(Md,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 Zv(e,t){return By(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 Kv(e,t=!0,n,r){return Dp.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 Jv(e,t){const n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(s);const r=sm(e,"int32"),a=sm([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 Yv=async function(e){const t=jp(e,"condition","whereAsync","bool"),n=await t.data(),r=Jv(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 eA=async function(e,t,n){const r=jp(e,"tensor","boolMask"),a=jp(t,"mask","boolMask","bool"),s=null==n?0:n,i=a.rank,o=r.shape;Go(i>0,(()=>"mask cannot be scalar")),Vo(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=zm(r,u),d=zm(a,[-1]),h=await Yv(d),p=Tv(h,[1]),f=dy(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 tA=Xp({transpose_:function(e,t,n){const r=jp(e,"x","transpose");if(null==t&&(t=r.shape.map(((e,t)=>t)).reverse()),Go(r.rank===t.length,(()=>`Error in transpose: rank of input ${r.rank} must match length of perm ${t}.`)),t.forEach((e=>{Go(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?rf((()=>{let e=tv(r),t=fy(r);return e=Dp.runKernel(Fd,{x:e},s),t=Dp.runKernel(Fd,{x:t},s),n&&(t=_y(t)),Zp(e,t)})):Dp.runKernel(Fd,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 nA=Xp({movingAverage_:function(e,t,n,r,a=!0){const s=jp(e,"v","movingAverage"),i=jp(t,"x","movingAverage"),o=jp(n,"decay","movingAverage");_p(s,i),Go(qo(s.shape,i.shape),(()=>"Shape mismatch in v and x"));const l=Jg(1),u=Ey(l,o);let c=hm(Ey(i,s),u);if(a){Go(null!=r,(()=>"When using zeroDebias: true, step is required."));const e=jp(r,"step","movingAverage");c=dm(c,Ey(l,Kg(o,e)))}return um(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 rA=Xp({scatterND_:function(e,t,n){xl(n);const r=jp(e,"indices","scatterND","int32"),a=jp(t,"updates","scatterND");zv(a,r,n);const s={indices:r,updates:a},i={shape:n};return Dp.runKernel(td,s,i)}});const aA=Xp({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){xl(n);const a=jp(e,"sparseIndices","sparseToDense","int32"),s=jp(t,"sparseValues","sparseToDense","string_or_numeric"),i=jp(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 Dp.runKernel(xd,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 sA=Xp({gatherND_:function(e,t){const n=jp(t,"indices","gatherND","int32"),r={params:jp(e,"x","gatherND","string_or_numeric"),indices:n};return Dp.runKernel(ju,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 iA=Xp({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=jp(e,"x","dropout");if(Go("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.`)),Go(t>=0&&t<1,(()=>`rate must be a float in the range [0, 1), but got ${t}.`)),0===t)return e instanceof up?a.clone():a;const s=function(e,t){if(null==t)return e.shape.slice();if(qo(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=dm(cy(um(Jb(s,0,1,"float32",r),i)),i);return hm(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 oA(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function lA(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 Ov(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 uA=async function(e,t,n=1){const r=jp(e,"predictions","inTopK"),a=jp(t,"targets","inTopK");Go(r.rank>1,(()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${r.rank}`)),Go(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}`)),Vo(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];Go(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=tl("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(),Jp(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 cA=Xp({conv2DBackpropFilter_:function(e,t,n,r,a,s="NHWC",i){let o=e;3===e.rank&&(o=zm(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;3===l.rank&&(l=zm(t,[1,t.shape[0],t.shape[1],t.shape[2]])),Go(4===o.rank,(()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${o.shape}.`)),Go(4===l.rank,(()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`)),Go(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];Go(u===n[2],(()=>`Error in conv2dDerFilter: depth of input ${u}) must match input depth in filter (${n[2]}.`)),Go(c===n[3],(()=>`Error in conv2dDerFilter: depth of dy (${c}) must match output depth for filter (${n[3]}).`)),Pm("conv2dDerFilter",a,i);const d={x:o,dy:l},h={strides:r,pad:a,dataFormat:s,dimRoundingMode:i,filterShape:n};return Dp.runKernel(cu,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 dA(e,t,n){if(null==n||"linear"===n)return e;if("relu"===n)return hm(e,Ev(t));throw new Error(`Cannot compute gradient for fused activation ${n}.`)}function hA(e,t){let n=t;const r=Tg(e.shape,t.shape);return r.length>0&&(n=ty(n,r)),zm(n,e.shape)}function pA(e,t,n,r){if("linear"===t)return e;if("relu"===t)return rv(e);if("elu"===t)return Lg(e);if("relu6"===t)return av(e);if("prelu"===t)return hb(e,n);if("leakyrelu"===t)return by(e,r);if("sigmoid"===t)return jm(e);throw new Error(`Unknown fused activation ${t}.`)}const fA=(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 mA=Xp({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===fA(Dp.state.gradientDepth,l)){Go("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=hg(e,t,n,r,a,s,i);return null!=o&&(d=um(d,o)),pA(d,l,u,c)}const d=jp(e,"x","conv2d","float32"),h=jp(t,"filter","conv2d","float32");let p=d,f=!1;3===d.rank&&(f=!0,p=zm(d,[1,d.shape[0],d.shape[1],d.shape[2]])),Go(4===p.rank,(()=>`Error in fused conv2d: input must be rank 4, but got rank ${p.rank}.`)),Go(4===h.rank,(()=>`Error in fused conv2d: filter must be rank 4, but got rank ${h.rank}.`)),Pm("fused conv2d",r,i);const m="NHWC"===a?p.shape[3]:p.shape[1];Go(h.shape[2]===m,(()=>`Error in conv2d: depth of input (${m}) must match input depth for filter ${h.shape[2]}.`)),Go(Mm(n,s),(()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`));const g=Tm(p.shape,h.shape,n,s,r,i);let y,b;if(null!=o&&(y=jp(o,"bias","fused conv2d"),[y]=Wp(y,d),"NHWC"===a?Ng(g.outShape,y.shape):(Go(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}.`)),Go(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(Go(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)Go(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{Ng(e,g.outShape)}catch(_X){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=jp(u,"prelu weights","fused conv2d")}const v=(e,t)=>{Go("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=dA(e,u,l);Go(Dm(s),(()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`));const h=[fg(o.shape,d,i,n,r),cA(o,d,i.shape,n,r)];if(null!=c){const e=hA(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 Iy(((e,t,n)=>{let r=Dp.runKernel(Ud,A,x);return n([t,e,r]),f&&(r=zm(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:v}}))(p,h)}return Iy(((e,t,n,r)=>{let a=Dp.runKernel(Ud,A,x);return r([t,e,a,n]),f&&(a=zm(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 gA=Xp({depthwiseConv2dNativeBackpropFilter_:function(e,t,n,r,a,s=[1,1],i){let o=e;3===e.rank&&(o=zm(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let l=t;3===l.rank&&(l=zm(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 Dp.runKernel(wu,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 yA=Xp({depthwiseConv2dNativeBackpropInput_:function(e,t,n,r,a,s=[1,1],i){let o=t,l=!1;3===t.rank&&(l=!0,o=zm(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=Dp.runKernel(Su,u,c);return l?zm(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 bA=Xp({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===fA(Dp.state.gradientDepth,l)){let d=Cg(e,t,n,r,a,s,i);return null!=o&&(d=um(d,o)),pA(d,l,u,c)}const d=jp(e,"x","depthwiseConv2d","float32"),h=jp(t,"filter","depthwiseConv2d","float32");let p=d,f=!1;3===d.rank&&(f=!0,p=zm(d,[1,d.shape[0],d.shape[1],d.shape[2]])),Go(4===p.rank,(()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${p.rank}.`)),Go(4===h.rank,(()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${h.rank}.`)),Go(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]),Go(Mm(n,s),(()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${n} and dilations '${s}'`)),Pm("fused depthwiseConv2d",r,i);const m=Tm(p.shape,h.shape,n,s,r,i,!0);let g,y;null!=o&&(g=jp(o,"bias","fused conv2d"),[g]=Wp(g,d),Ng(m.outShape,g.shape)),null!=u&&(y=jp(u,"prelu weights","fused depthwiseConv2d"));const b=(e,t)=>{Go(Dm(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=dA(e,u,l),h=yA(o.shape,d,a,n,r,s,i),p=gA(o,d,a.shape,n,r,s,i);if(null!=c){return[h,p,hA(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 Iy(((e,t,n)=>{let r=Dp.runKernel(Hd,v,A);return n([t,e,r]),f&&(r=zm(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:b}}))(p,h)}return Iy(((e,t,n,r)=>{let a=Dp.runKernel(Hd,v,A);return r([t,e,a,n]),f&&(a=zm(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 vA=Xp({fusedMatMul_:function({a:e,b:t,transposeA:n=!1,transposeB:r=!1,bias:a,activation:s="linear",preluActivationWeights:i,leakyreluAlpha:o=.2}){if(!1===fA(Dp.state.gradientDepth,s)){let l=Hm(e,t,n,r);return null!=a&&(l=um(l,a)),pA(l,s,i,o)}let l=jp(e,"a","fused matMul"),u=jp(t,"b","fused matMul");[l,u]=Wp(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=Ho(f),y=Ho(m);Go(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=Ng(l.shape.slice(0,-2),u.shape.slice(0,-2)).concat([h,p]),v=zm(l,n?[g,c,h]:[g,h,c]),A=zm(u,r?[y,p,d]:[y,d,p]);let x,k;null!=a&&(x=jp(a,"bias","fused matMul"),[x]=Wp(x,l),Ng(b,x.shape)),null!=i&&(k=jp(i,"prelu weights","fused matMul"));const w=(e,t)=>{const[i,o,l,u]=t,c=dA(zm(e,l.shape),l,s);let d,h;if(n||r?!n&&r?(d=Hm(c,o,!1,!1),h=Hm(c,i,!0,!1)):n&&!r?(d=Hm(o,c,!1,!0),h=Hm(i,c,!1,!1)):(d=Hm(o,c,!0,!0),h=Hm(c,i,!0,!0)):(d=Hm(c,o,!1,!0),h=Hm(i,c,!0,!1)),null!=a){return[d,h,hA(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 Iy(((e,t,n)=>{const r=Dp.runKernel(Vd,S,C);return n([e,t,r]),{value:zm(r,b),gradFunc:w}}))(v,A)}return Iy(((e,t,n,r)=>{const a=Dp.runKernel(Vd,S,C);return r([e,t,a,n]),{value:zm(a,b),gradFunc:w}}))(v,A,x)}}),AA=Object.freeze(Object.defineProperty({__proto__:null,conv2d:mA,depthwiseConv2d:bA,matMul:vA},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 xA=Xp({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 lA(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 kA=Xp({hannWindow_:function(e){return lA(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 wA=Xp({frame_:function(e,t,n,r=!1,a=0){let s=0;const i=[];for(;s+t<=e.size;)i.push(qm(e,s,t)),s+=n;if(r)for(;s<e.size;){const r=s+t-e.size,o=Um([qm(e,s,t-r),ig([r],a)]);i.push(o),s+=n}return 0===i.length?Fv([],[0,t]):zm(Um(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 SA=Xp({stft_:function(e,t,n,r,a=kA){null==r&&(r=oA(t));const s=wA(e,t,n),i=hm(s,a(t));return Wv(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 CA=Xp({cropAndResize_:function(e,t,n,r,a="bilinear",s=0){const i=jp(e,"image","cropAndResize"),o=jp(t,"boxes","cropAndResize","float32"),l=jp(n,"boxInd","cropAndResize","int32"),u=o.shape[0];Go(4===i.rank,(()=>`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`)),Go(2===o.rank&&4===o.shape[1],(()=>`Error in cropAndResize: boxes must be have size [${u},4] but had shape ${o.shape}.`)),Go(1===l.rank&&l.shape[0]===u,(()=>`Error in cropAndResize: boxInd must be have size [${u}] but had shape ${o.shape}.`)),Go(2===r.length,(()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`)),Go(r[0]>=1&&r[1]>=1,(()=>`cropSize must be atleast [1,1], but was ${r}`)),Go("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 Dp.runKernel(vu,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 IA=Xp({flipLeftRight_:function(e){const t=jp(e,"image","flipLeftRight","float32");Go(4===t.rank,(()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`));const n={image:t};return Dp.runKernel(zu,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 WA=Xp({grayscaleToRGB_:function(e){const t=jp(e,"image","grayscaleToRGB"),n=t.rank-1,r=t.shape[n];Go(t.rank>=2,(()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${t.rank}.`)),Go(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,ly(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 _A=Xp({rgbToGrayscale_:function(e){const t=jp(e,"image","RGBToGrayscale"),n=t.rank-1,r=t.shape[n];Go(t.rank>=2,(()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${t.rank}.`)),Go(3===r,(()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${r}.`));const a=t.dtype,s=im(t,"float32"),i=Ov([.2989,.587,.114]);let o;switch(t.rank){case 2:o=Mg("ij,j->i",s,i);break;case 3:o=Mg("ijk,k->ij",s,i);break;case 4:o=Mg("ijkl,l->ijk",s,i);break;case 5:o=Mg("ijklm,m->ijkl",s,i);break;case 6:o=Mg("ijklmn,n->ijklm",s,i);break;default:throw new Error("Not a valid tensor rank.")}return o=iy(o,-1),im(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 TA=Xp({rotateWithOffset_:function(e,t,n=0,r=.5){const a=jp(e,"image","rotateWithOffset","float32");Go(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 Dp.runKernel(Gd,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 NA(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),Go(0<=r&&r<=1,(()=>`iouThreshold must be in [0, 1], but was '${r}'`)),Go(2===e.rank,(()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`)),Go(4===e.shape[1],(()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`)),Go(1===t.rank,(()=>"scores must be a 1D tensor")),Go(t.shape[0]===i,(()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`)),Go(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 EA=Xp({nonMaxSuppression_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY){const s=jp(e,"boxes","nonMaxSuppression","float32"),i=jp(t,"scores","nonMaxSuppression","float32"),o=NA(s,i,n,r,a),l={maxOutputSize:n=o.maxOutputSize,iouThreshold:r=o.iouThreshold,scoreThreshold:a=o.scoreThreshold};return Dp.runKernel(Tc,{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 RA(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||$A)}(e,t,n),a=r<0?-(r+1):r;e.splice(a,0,t)}function $A(e,t){return e>t?1:e<t?-1:0}function OA(e,t,n,r,a){return MA(e,t,n,r,a,0)}function FA(e,t,n,r,a,s){return MA(e,t,n,r,a,0,!1,s,!0)}function DA(e,t,n,r,a,s){return MA(e,t,n,r,a,s,!0)}function MA(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(PA);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=LA(e,s,d[l]);if(n>=r){o=!0;break}if(t.score=t.score*BA(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&&RA(u,t,PA))}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 LA(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 BA(e,t,n){const r=Math.exp(t*n*n);return n<=e?r:0}function PA(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 zA=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY){const s=jp(e,"boxes","nonMaxSuppressionAsync"),i=jp(t,"scores","nonMaxSuppressionAsync"),o=NA(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}=OA(u,c,n,r,a);return s!==e&&s.dispose(),i!==t&&i.dispose(),Ov(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 GA=Xp({nonMaxSuppressionWithScore_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=0){const i=jp(e,"boxes","nonMaxSuppression"),o=jp(t,"scores","nonMaxSuppression"),l=NA(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=Dp.runKernel(Ec,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 VA=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=0){const i=jp(e,"boxes","nonMaxSuppressionAsync"),o=jp(t,"scores","nonMaxSuppressionAsync"),l=NA(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}=DA(c,d,n,r,a,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Ov(h,"int32"),selectedScores:Ov(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 UA=Xp({nonMaxSuppressionPadded_:function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=!1){const i=jp(e,"boxes","nonMaxSuppression"),o=jp(t,"scores","nonMaxSuppression"),l=NA(i,o,n,r,a,null),u={boxes:i,scores:o},c={maxOutputSize:l.maxOutputSize,iouThreshold:l.iouThreshold,scoreThreshold:l.scoreThreshold,padToMaxOutputSize:s},d=Dp.runKernel(Nc,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 HA=async function(e,t,n,r=.5,a=Number.NEGATIVE_INFINITY,s=!1){const i=jp(e,"boxes","nonMaxSuppressionAsync"),o=jp(t,"scores","nonMaxSuppressionAsync"),l=NA(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}=FA(h,p,u,c,d,s);return i!==e&&i.dispose(),o!==t&&o.dispose(),{selectedIndices:Ov(f,"int32"),validOutputs:Jg(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 jA=Xp({resizeBilinear_:function(e,t,n=!1,r=!1){const a=jp(e,"images","resizeBilinear");Go(3===a.rank||4===a.rank,(()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`)),Go(2===t.length,(()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`)),Go(!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=zm(a,[1,a.shape[0],a.shape[1],a.shape[2]]));const o={images:s},l={alignCorners:n,halfPixelCenters:r,size:t},u=Dp.runKernel(Xc,o,l);return i?zm(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 qA=Xp({resizeNearestNeighbor_:function(e,t,n=!1,r=!1){const a=jp(e,"images","resizeNearestNeighbor");Go(3===a.rank||4===a.rank,(()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${a.rank}.`)),Go(2===t.length,(()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`)),Go("float32"===a.dtype||"int32"===a.dtype,(()=>"`images` must have `int32` or `float32` as dtype")),Go(!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=zm(a,[1,a.shape[0],a.shape[1],a.shape[2]]));const o={images:s},l={alignCorners:n,halfPixelCenters:r,size:t},u=Dp.runKernel(qc,o,l);return i?zm(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 QA=Xp({threshold_:function(e,t="binary",n=!1,r=.5){const a=jp(e,"image","threshold"),s=a.shape[0]*a.shape[1];let i,o,l,u,c=hm(Ov([r]),255);if(Go(3===a.rank,(()=>`Error in threshold: image must be rank 3,but got rank ${a.rank}.`)),Go(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]}.`)),Go("int32"===a.dtype||"float32"===a.dtype,(()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${a.dtype}.`)),Go("otsu"===t||"binary"===t,(()=>`Method must be binary or otsu, but was ${t}`)),3===a.shape[2]){[i,o,l]=Iv(a,[1,1,1],-1);const e=hm(i,.2989),t=hm(o,.587),n=hm(l,.114);u=um(um(e,t),n)}else u=e;if("otsu"===t){c=function(e,t){let n,r,a,s,i,o,l=Ov([-1]),u=Ov([0]),c=Ov([0]);for(let d=0;d<e.size-1;d++){n=qm(e,0,d+1),r=qm(e,d+1),i=dm(ty(n),t),o=dm(ty(r),t);const h=ty(hm(n,ev(0,n.size)));a=dm(h,ty(n));const p=ig(r.shape,n.size),f=um(ev(0,r.size),p),m=hm(r,f);s=dm(ty(m),ty(r));const g=Ey(a,s),y=Ey(a,s),b=hm(i,o);c=hm(hm(b,g),y);const v=hy(c,u);u=$g(v,c,u),l=$g(v,Ov([d]),l)}return l}(tg(im(cv(u),"int32"),Jp([]),256),s)}const d=n?Ay(u,c):hy(u,c);return im(hm(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 XA=Xp({transform_:function(e,t,n="nearest",r="constant",a=0,s){const i=jp(e,"image","transform","float32"),o=jp(t,"transforms","transform","float32");Go(4===i.rank,(()=>`Error in transform: image must be rank 4,but got rank ${i.rank}.`)),Go(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")),Go(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 Dp.runKernel(Od,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 ZA=Xp({bandPart_:function(e,t,n){const r=jp(e,"a","bandPart");Go(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?(Go(t%1==0,(()=>`bandPart(): numLower must be an integer, got ${t}.`)),Go(t<=s,(()=>`bandPart(): numLower (${t}) must not be greater than the number of rows (${s}).`)),o=jp(t<0?s:t,"numLower","bandPart")):(Go("int32"===t.dtype,(()=>"bandPart(): numLower's dtype must be an int32.")),o=$g(vy(t,0),s,Xy(t,s))),"number"==typeof n?(Go(n%1==0,(()=>`bandPart(): numUpper must be an integer, got ${n}.`)),Go(n<=i,(()=>`bandPart(): numUpper (${n}) must not be greater than the number of columns (${i}).`)),l=jp(n<0?i:n,"numUpper","bandPart")):(Go("int32"===n.dtype,(()=>"bandPart(): numUpper's dtype must be an int32.")),l=$g(vy(n,0),i,Xy(n,i)));const u=zm(ev(0,s,1,"int32"),[-1,1]),c=ev(0,i,1,"int32"),d=Ey(u,c),h=Oy(Ay(d,o),py(d,_y(l))),p=jy([s,i],r.dtype);return zm(Nv(Xv(zm(r,[-1,s,i])).map((e=>$g(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 KA=Xp({gramSchmidt_:function(e){let t;if(Array.isArray(e)){t=!1,Go(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)Go(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=Iv(e,e.shape[0],0).map((e=>Tv(e,[0])));Go(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(Dp.tidy((()=>{let e=r[a];if(a>0)for(let t=0;t<a;++t){const r=hm(ty(hm(n[t],e)),n[t]);e=Ey(e,r)}return dm(e,ry(e,"euclidean"))})));return t?Nv(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 JA(e,t=!1){return Dp.tidy((()=>{Go(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=uy(n),s=om(e);const i=Fv([[1]],[1,1]);let o=om(i);const l=n>=r?r:n;for(let e=0;e<l;++e){const t=s,l=o,u=a;[o,s,a]=Dp.tidy((()=>{const t=qm(s,[e,e],[n-e,1]),l=ry(t),u=qm(s,[e,e],[1,1]),c=$g(hy(u,0),Fv([[-1]]),Fv([[1]])),d=Ey(u,hm(c,l)),h=dm(t,d);o=1===h.shape[0]?om(i):Um([i,qm(h,[1,0],[h.shape[0]-1,h.shape[1]])],0);const p=_y(dm(Hm(c,d),l)),f=qm(s,[e,0],[n-e,r]),m=hm(p,o),g=tA(o);if(0===e)s=Ey(f,Hm(m,Hm(g,f)));else{const t=Ey(f,Hm(m,Hm(g,f)));s=Um([qm(s,[0,0],[e,r]),t],0)}const y=tA(m),b=qm(a,[0,e],[n,a.shape[1]-e]);if(0===e)a=Ey(b,Hm(Hm(b,o),y));else{const t=Ey(b,Hm(Hm(b,o),y));a=Um([qm(a,[0,0],[n,e]),t],1)}return[o,s,a]})),af([t,l,u])}return!t&&n>r&&(a=qm(a,[0,0],[n,r]),s=qm(s,[0,0],[r,r])),[a,s]}))}const YA=Xp({qr_:function(e,t=!1){if(Go(e.rank>=2,(()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`)),2===e.rank)return JA(e,t);{const n=e.shape.slice(0,e.shape.length-2).reduce(((e,t)=>e*t)),r=Xv(zm(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),a=[],s=[];r.forEach((e=>{const[n,r]=JA(e,t);a.push(n),s.push(r)}));return[zm(Nv(a,0),e.shape),zm(Nv(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 ex,tx;(tx=ex||(ex={}))[tx.NONE=0]="NONE",tx[tx.MEAN=1]="MEAN",tx[tx.SUM=2]="SUM",tx[tx.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS";const nx=Xp({computeWeightedLoss_:function(e,t,n=ex.SUM_BY_NONZERO_WEIGHTS){const r=jp(e,"losses","computeWeightedLoss");let a=null;null!=t&&(a=jp(t,"weights","computeWeightedLoss"));const s=null==a?r:hm(r,a);if(n===ex.NONE)return s;if(n===ex.SUM)return ty(s);if(n===ex.MEAN){if(null==a)return Hy(s);{const e=r.size/a.size,t=dm(ty(s),ty(a));return e>1?dm(t,Jg(e)):t}}if(n===ex.SUM_BY_NONZERO_WEIGHTS){if(null==a)return dm(ty(s),Jg(r.size));{const e=hm(a,qy(r.shape)),t=im(ty(tb(e,Jg(0))),"float32");return dm(ty(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 rx=Xp({absoluteDifference_:function(e,t,n,r=ex.SUM_BY_NONZERO_WEIGHTS){const a=jp(e,"labels","absoluteDifference"),s=jp(t,"predictions","absoluteDifference");let i=null;null!=n&&(i=jp(n,"weights","absoluteDifference")),Vo(a.shape,s.shape,"Error in absoluteDifference: ");const o=pm(Ey(a,s));return nx(o,i,r)}});const ax=Xp({cosineDistance_:function(e,t,n,r,a=ex.SUM_BY_NONZERO_WEIGHTS){const s=jp(e,"labels","cosineDistance"),i=jp(t,"predictions","cosineDistance");let o=null;null!=r&&(o=jp(r,"weights","cosineDistance")),Vo(s.shape,i.shape,"Error in cosineDistance: ");const l=Jg(1),u=Ey(l,ty(hm(s,i),n,!0));return nx(u,o,a)}});const sx=Xp({hingeLoss_:function(e,t,n,r=ex.SUM_BY_NONZERO_WEIGHTS){let a=jp(e,"labels","hingeLoss");const s=jp(t,"predictions","hingeLoss");let i=null;null!=n&&(i=jp(n,"weights","hingeLoss")),Vo(a.shape,s.shape,"Error in hingeLoss: ");const o=Jg(1);a=Ey(hm(Jg(2),a),o);const l=rv(Ey(o,hm(a,s)));return nx(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 ix=Xp({huberLoss_:function(e,t,n,r=1,a=ex.SUM_BY_NONZERO_WEIGHTS){const s=jp(e,"labels","huberLoss"),i=jp(t,"predictions","huberLoss");let o=null;null!=n&&(o=jp(n,"weights","huberLoss")),Vo(s.shape,i.shape,"Error in huberLoss: ");const l=Jg(r),u=pm(Ey(i,s)),c=Xy(u,l),d=Ey(u,c),h=um(hm(Jg(.5),ey(c)),hm(l,d));return nx(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 ox=Xp({logLoss_:function(e,t,n,r=1e-7,a=ex.SUM_BY_NONZERO_WEIGHTS){const s=jp(e,"labels","logLoss"),i=jp(t,"predictions","logLoss");let o=null;null!=n&&(o=jp(n,"weights","logLoss")),Vo(s.shape,i.shape,"Error in logLoss: ");const l=Jg(1),u=Jg(r),c=_y(hm(s,wy(um(i,u)))),d=hm(Ey(l,s),wy(um(Ey(l,i),u))),h=Ey(c,d);return nx(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 lx=Xp({meanSquaredError_:function(e,t,n,r=ex.SUM_BY_NONZERO_WEIGHTS){const a=jp(e,"labels","meanSquaredError"),s=jp(t,"predictions","meanSquaredError");let i=null;null!=n&&(i=jp(n,"weights","meanSquaredError")),Vo(a.shape,s.shape,"Error in meanSquaredError: ");const o=_v(a,s);return nx(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 ux=Xp({sigmoidCrossEntropy_:function(e,t,n,r=0,a=ex.SUM_BY_NONZERO_WEIGHTS){let s=jp(e,"multiClassLabels","sigmoidCrossEntropy");const i=jp(t,"logits","sigmoidCrossEntropy");let o=null;if(null!=n&&(o=jp(n,"weights","sigmoidCrossEntropy")),Vo(s.shape,i.shape,"Error in sigmoidCrossEntropy: "),r>0){const e=Jg(r),t=Jg(1),n=Jg(.5);s=um(hm(s,Ey(t,e)),hm(n,e))}const l=function(e,t){const n=jp(e,"labels","sigmoidCrossEntropyWithLogits"),r=jp(t,"logits","sigmoidCrossEntropyWithLogits");Vo(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");const a=rv(r),s=hm(r,n),i=Sy(sy(_y(pm(r))));return um(Ey(a,s),i)}(s,i);return nx(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 cx=Xp({softmaxCrossEntropy_:function(e,t,n,r=0,a=ex.SUM_BY_NONZERO_WEIGHTS){let s=jp(e,"onehotLabels","softmaxCrossEntropy");const i=jp(t,"logits","softmaxCrossEntropy");let o=null;if(null!=n&&(o=jp(n,"weights","softmaxCrossEntropy")),Vo(s.shape,i.shape,"Error in softmaxCrossEntropy: "),r>0){const e=Jg(r),t=Jg(1),n=Jg(s.shape[1]);s=um(hm(s,Ey(t,e)),dm(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 Iy(((e,t,r)=>{const a=$y(t,[n],!0),s=Ey(im(t,"float32"),a);r([e,s]);const i=_y(hm(s,e));return{value:ty(i,[n]),gradFunc:(e,t)=>{const[r,a]=t,s=Ug(e.shape,[n]);return[hm(zm(e,s),Ey(im(r,"float32"),sy(a))),hm(zm(e,s),Ey(sy(a),im(r,"float32")))]}}}))(e,t)}(s,i);return nx(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 dx={fft:wv,ifft:Sv,rfft:Wv,irfft:Cv},hx={hammingWindow:xA,hannWindow:kA,frame:wA,stft:SA},px={flipLeftRight:IA,grayscaleToRGB:WA,resizeNearestNeighbor:qA,resizeBilinear:jA,rgbToGrayscale:_A,rotateWithOffset:TA,cropAndResize:CA,nonMaxSuppression:EA,nonMaxSuppressionAsync:zA,nonMaxSuppressionWithScore:GA,nonMaxSuppressionWithScoreAsync:VA,nonMaxSuppressionPadded:UA,nonMaxSuppressionPaddedAsync:HA,threshold:QA,transform:XA},fx={bandPart:ZA,gramSchmidt:KA,qr:YA},mx={absoluteDifference:rx,computeWeightedLoss:nx,cosineDistance:ax,hingeLoss:sx,huberLoss:ix,logLoss:ox,meanSquaredError:lx,sigmoidCrossEntropy:ux,softmaxCrossEntropy:cx},gx={sparseFillEmptyRows:Xp({sparseFillEmptyRows_:function(e,t,n,r){const a=jp(e,"indices","sparseFillEmptyRows","int32"),s=jp(t,"values","sparseFillEmptyRows"),i=jp(n,"denseShape","sparseFillEmptyRows","int32"),o=jp(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=Dp.runKernel(yd,l);return{outputIndices:u[0],outputValues:u[1],emptyRowIndicator:u[2],reverseIndexMap:u[3]}}}),sparseReshape:Xp({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=jp(e,"inputIndices","sparseReshape","int32"),a=jp(t,"inputShape","sparseReshape","int32"),s=jp(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=Dp.runKernel(bd,i);return{outputIndices:o[0],outputShape:o[1]}}}),sparseSegmentMean:Xp({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=jp(e,"data","sparseSegmentMean"),a=jp(t,"indices","sparseSegmentMean","int32"),s=jp(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 Dp.runKernel(vd,i)}}),sparseSegmentSum:Xp({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=jp(e,"data","sparseSegmentSum"),a=jp(t,"indices","sparseSegmentSum","int32"),s=jp(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 Dp.runKernel(Ad,i)}})},yx={stringNGrams:Xp({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=jp(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=jp(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=Dp.runKernel(Id,d,c);return{nGrams:h[0],nGramsSplits:h[1]}}}),stringSplit:Xp({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=jp(e,"input","stringSplit","string"),a=jp(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=Dp.runKernel(Wd,i,s);return{indices:o[0],values:o[1],shape:o[2]}}}),stringToHashBucketFast:Xp({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=jp(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 Dp.runKernel(_d,a,r)}}),staticRegexReplace:Xp({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=jp(e,"input","staticRegexReplace","string"),s={pattern:t,rewrite:n,replaceGlobal:r};return Dp.runKernel(Sd,{x:a},s)}})},bx=new Map,vx=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 Ax{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class xx{constructor(){this.classNameMap={}}static getMap(){return null==xx.instance&&(xx.instance=new xx),xx.instance}static register(e){xx.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function kx(e,t,n){Go(null!=e.className,(()=>"Class being registered does not have the static className property defined.")),Go("string"==typeof e.className,(()=>"className is required to be a string, but got type "+typeof e.className)),Go(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 xx.register(e),bx.set(r,e),vx.set(e,r),e}const wx=Object.freeze(Object.defineProperty({__proto__:null,Serializable:Ax,SerializationMap:xx,getRegisteredName:function(e){return vx.has(e)?vx.get(e):e.className},registerClass:kx},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 Sx extends Ax{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 af(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 Cy(e,t)}dispose(){null!=this.iterations_&&af(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:Jg(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(Sx,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 Cx extends Sx{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=Dp.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=Dp.registeredVariables[t];null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:rf((()=>Og(r).variable(false)))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:rf((()=>Og(r).variable(false)))});const a=Array.isArray(e)?e[n].tensor:e[t];if(null==a)return;const s=this.accumulatedGrads[n].variable,i=this.accumulatedUpdates[n].variable;rf((()=>{const e=um(hm(s,this.rho),hm(ey(a),1-this.rho)),t=hm(dm(Yg(um(i,this.epsilon)),Yg(um(s,this.epsilon))),a),n=um(hm(i,this.rho),hm(ey(t),1-this.rho));s.assign(e),i.assign(n);const o=um(hm(t,-this.learningRate),r);r.assign(o)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&(af(this.accumulatedGrads.map((e=>e.variable))),af(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;this.accumulatedGrads=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedUpdates=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}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 Ix extends Sx{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=Dp.registeredVariables[t];if(null==this.accumulatedGrads[n]){const e=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:rf((()=>ig(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;rf((()=>{const e=um(s,ey(a));s.assign(e);const t=um(hm(dm(a,Yg(um(e,Dp.backend.epsilon()))),-this.learningRate),r);r.assign(t)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&af(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 Wx extends Sx{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=[],rf((()=>{this.accBeta1=Jg(t).variable(),this.accBeta2=Jg(n).variable()})),null==r&&(this.epsilon=Dp.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);rf((()=>{const n=Ey(1,this.accBeta1),r=Ey(1,this.accBeta2);t.forEach(((t,a)=>{const s=Dp.registeredVariables[t];null==this.accumulatedFirstMoment[a]&&(this.accumulatedFirstMoment[a]={originalName:`${t}/m`,variable:rf((()=>Og(s).variable(false)))}),null==this.accumulatedSecondMoment[a]&&(this.accumulatedSecondMoment[a]={originalName:`${t}/v`,variable:rf((()=>Og(s).variable(false)))});const i=Array.isArray(e)?e[a].tensor:e[t];if(null==i)return;const o=this.accumulatedFirstMoment[a].variable,l=this.accumulatedSecondMoment[a].variable,u=um(hm(o,this.beta1),hm(i,1-this.beta1)),c=um(hm(l,this.beta2),hm(ey(i),1-this.beta2)),d=dm(u,n),h=dm(c,r);o.assign(u),l.assign(c);const p=um(hm(dm(d,um(Yg(h),this.epsilon)),-this.learningRate),s);s.assign(p)})),this.accBeta1.assign(hm(this.accBeta1,this.beta1)),this.accBeta2.assign(hm(this.accBeta2,this.beta2))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&af(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedSecondMoment&&af(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),rf((()=>{this.accBeta1.assign(Kg(this.beta1,this.iterations_+1)),this.accBeta2.assign(Kg(this.beta2,this.iterations_+1))}));const t=e.length/2;this.accumulatedFirstMoment=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedSecondMoment=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}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 _x extends Sx{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=[],rf((()=>{this.iteration=Jg(0).variable(),this.accBeta1=Jg(t).variable()})),null==r&&(this.epsilon=Dp.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);rf((()=>{const n=Ey(1,this.accBeta1),r=dm(-this.learningRate,um(hm(this.iteration,this.decay),1));t.forEach(((t,a)=>{const s=Dp.registeredVariables[t];null==this.accumulatedFirstMoment[a]&&(this.accumulatedFirstMoment[a]={originalName:`${t}/m`,variable:Og(s).variable(false)}),null==this.accumulatedWeightedInfNorm[a]&&(this.accumulatedWeightedInfNorm[a]={originalName:`${t}/v`,variable:Og(s).variable(false)});const i=Array.isArray(e)?e[a].tensor:e[t];if(null==i)return;const o=this.accumulatedFirstMoment[a].variable,l=this.accumulatedWeightedInfNorm[a].variable,u=um(hm(o,this.beta1),hm(i,1-this.beta1)),c=hm(l,this.beta2),d=pm(i),h=Uy(c,d);o.assign(u),l.assign(h);const p=um(hm(dm(r,n),dm(u,um(h,this.epsilon))),s);s.assign(p)})),this.iteration.assign(um(this.iteration,1)),this.accBeta1.assign(hm(this.accBeta1,this.beta1))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&af(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedWeightedInfNorm&&af(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 Tx extends Sx{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=Dp.registeredVariables[t];rf((()=>{const e=um(hm(this.c,r),a);a.assign(e)}))})),this.incrementIterations()}setLearningRate(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=sf(Jg(-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 Nx extends Tx{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=Jg(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const r=Dp.registeredVariables[t];if(null==this.accumulations[n]){const e=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:rf((()=>Og(r).variable(e)))}}const a=this.accumulations[n].variable,s=Array.isArray(e)?e[n].tensor:e[t];null!=s&&rf((()=>{let e;const t=um(hm(this.m,a),s);e=this.useNesterov?um(hm(this.c,um(s,hm(t,this.m))),r):um(hm(this.c,t),r),a.assign(t),r.assign(e)}))})),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&af(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 Ex extends Sx{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=Dp.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=Dp.registeredVariables[t],a=!1;null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:rf((()=>Og(r).variable(a)))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:rf((()=>Og(r).variable(a)))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:rf((()=>Og(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;rf((()=>{const e=um(hm(i,this.decay),hm(ey(s),1-this.decay));if(this.centered){const t=this.accumulatedMeanGrads[n].variable,a=um(hm(t,this.decay),hm(s,1-this.decay)),l=dm(hm(s,this.learningRate),Yg(Ey(e,um(ey(a),this.epsilon)))),u=um(hm(o,this.momentum),l);i.assign(e),t.assign(a),o.assign(u);const c=Ey(r,u);r.assign(c)}else{const e=um(hm(i,this.decay),hm(ey(s),1-this.decay)),t=um(hm(o,this.momentum),dm(hm(s,this.learningRate),Yg(um(e,this.epsilon))));i.assign(e),o.assign(t);const n=Ey(r,t);r.assign(n)}}))})),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&af(this.accumulatedMeanSquares.map((e=>e.variable))),null!=this.accumulatedMeanGrads&&this.centered&&af(this.accumulatedMeanGrads.map((e=>e.variable))),null!=this.accumulatedMoments&&af(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 Rx=[Cx,Ix,Wx,_x,Nx,Ex,Tx];function $x(e){return new Promise((e=>setTimeout(e))).then(e)}class Ox{constructor(e){if(!_l().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(Ox.URL_SCHEME)&&(e=e.slice(Ox.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=ef.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=wf(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 $x((()=>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 $x((()=>e.dispatchEvent(new MouseEvent("click"))))}return{modelArtifactsInfo:If(e)}}}}Ox.URL_SCHEME="downloads://";class Fx{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=Cf(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=>kf(e.name))),r={};for(const a of e)a.paths.forEach((e=>{const a=kf(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 Dx(e,t,n,r){var a,s,i;Go(null!=(a=e)&&Array.isArray(a)&&a.length>0,(()=>"promises must be a none empty array")),i=r=null==r?1:r,Go((s=n=null==n?0:n)>=0&&s<=1,(()=>`Progress fraction must be in range [0, 1], but got startFraction ${s}`)),Go(i>=0&&i<=1,(()=>`Progress fraction must be in range [0, 1], but got endFraction ${i}`)),Go(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 Mx(e,t){null==t&&(t={});const n=null==t.fetchFunc?_l().platform.fetch:t.fetchFunc,r=e.map((e=>n(e,t.requestInit,{isBinary:!0}))),a=(null==t.onProgress?await Promise.all(r):await Dx(r,t.onProgress,0,.5)).map((e=>e.arrayBuffer()));return null==t.onProgress?await Promise.all(a):await Dx(a,t.onProgress,.5,1)}function Lx(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=Yp[l]*Ho(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 ef(c.slice(h,h+n));s[e].forEach((e=>{const t=hf(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.
 * =============================================================================
 */_f.registerSaveRouter((e=>_l().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Ox.URL_SCHEME)?function(e="model"){return new Ox(e)}(e.slice(Ox.URL_SCHEME.length)):null));class Bx{constructor(e,t){if(this.DEFAULT_METHOD="POST",null==t&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.weightUrlConverter=t.weightUrlConverter,null!=t.fetchFunc?(Go("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=_l().platform.fetch,Go(null!=e&&e.length>0,(()=>"URL path for http must not be null, undefined or empty.")),Array.isArray(e)&&Go(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=wf(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=ef.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:If(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(_X){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 Cf(await this.loadModelJSON(),(e=>this.loadWeights(e)))}async loadStream(){const e=await this.loadModelJSON(),t=await this.getWeightUrls(e.weightsManifest),n=Wf(e.weightsManifest);return Object.assign(Object.assign({},e),{weightSpecs:n,getWeightStream:()=>function(e,t){var n;const r=null==t.fetchFunc?_l().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[Wf(e),await Mx(t,this.loadOptions)]}}function Px(e){return null!=e.match(Bx.URL_SCHEME_REGEX)}Bx.URL_SCHEME_REGEX=/^https?:\/\//;const zx=(e,t)=>{if("undefined"==typeof fetch&&(null==t||null==t.fetchFunc))return null;{let n=!0;if(n=Array.isArray(e)?e.every((e=>Px(e))):Px(e),n)return Gx(e,t)}return null};function Gx(e,t){return new Bx(e,t)}_f.registerSaveRouter(zx),_f.registerLoadRouter(zx);
/**
 * @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 Vx{constructor(e){this.modelArtifacts=e}load(){return this.modelArtifacts}}class Ux{constructor(e){this.saveHandler=e}save(e){return this.saveHandler(e)}}class Hx{constructor(e){e.load&&(this.load=()=>Promise.resolve(e.load())),e.save&&(this.save=t=>Promise.resolve(e.save(t)))}}function jx(e,t,n,r){if(1===arguments.length){const t=null!=e.modelTopology||null!=e.weightSpecs;return new Vx(t?e:{modelTopology:e})}return new Vx({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 qx=Object.freeze(Object.defineProperty({__proto__:null,CompositeArrayBuffer:ef,browserFiles:function(e){return new Fx(e)},browserHTTPRequest:function(e,t){return Gx(e,t)},concatenateArrayBuffers:xf,copyModel:async function(e,t){return em(e,t,!1)},decodeWeights:hf,decodeWeightsStream:yf,encodeWeights:df,fromMemory:function(e,t,n,r){return new Hx(jx(...arguments))},fromMemorySync:jx,getLoadHandlers:(e,t)=>_f.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:Cf,getModelArtifactsForJSONSync:Sf,getModelArtifactsInfoForJSON:If,getSaveHandlers:Tf,getWeightSpecs:Wf,http:Gx,isHTTPScheme:Px,listModels:async function(){const e=Jf.getSchemes(),t={};for(const n of e){const e=await Jf.getManager(n).listModels();for(const r in e){t[n+Kf+r]=e[r]}}return t},loadWeights:async function(e,t="",n,r){return Lx((e=>Mx(e,{requestInit:r})))(e,t,n)},moveModel:async function(e,t){return em(e,t,!0)},registerLoadRouter:e=>_f.registerLoadRouter(e),registerSaveRouter:e=>_f.registerSaveRouter(e),removeModel:async function(e){const t=Yf(e);return Jf.getManager(t.scheme).removeModel(t.path)},weightsLoaderFactory:Lx,withSaveHandler:function(e){return new Ux(e)},withSaveHandlerSync:function(e){return new Ux(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 Qx=Xp({confusionMatrix_:function(e,t,n){const r=jp(e,"labels","confusionMatrix"),a=jp(t,"predictions","confusionMatrix");Go(null==n||n>0&&Number.isInteger(n),(()=>`If provided, numClasses must be a positive integer, but got ${n}`)),Go(1===r.rank,(()=>`Expected the rank of labels to be 1, but got ${r.rank}`)),Go(1===a.rank,(()=>`Expected the rank of predictions to be 1, but got ${a.rank}`)),Go(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.`)),Go(n>0&&Number.isInteger(n),(()=>`numClasses is required to be a positive integer, but got ${n}`));const s=nb(im(r,"int32"),n),i=nb(im(a,"int32"),n),o=tA(s),l=Hm(o,i);return im(l,"int32")}}),Xx=Object.freeze(Object.defineProperty({__proto__:null,confusionMatrix:Qx},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 Zx,Kx=!1;function Jx(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!=Xd(zd,Dp.backendName)){const n={pixels:e},r={numChannels:t};return Dp.runKernel(zd,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==Zx)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.");Zx=new OffscreenCanvas(1,1).getContext("2d")}else Zx=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});Zx.canvas.width=l,Zx.canvas.height=u,Zx.drawImage(e,0,0,l,u),c=Zx.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 Dv(d,[u,l,t],"int32")}function Yx(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 ek(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 tk=Xp({fromPixels_:Jx}),nk=Object.freeze(Object.defineProperty({__proto__:null,draw:function(e,t,n){let r=jp(e,"img","draw");if(!(e instanceof up)){const e=r;r=im(e,"int32"),e.dispose()}ek(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};Dp.runKernel(Tu,a,s)},fromPixels:tk,fromPixelsAsync:async function(e,t=3){let n=null;if(_l().getBool("WRAP_TO_IMAGEBITMAP")&&Yx(e)){let t;try{t=await createImageBitmap(e,{premultiplyAlpha:"none"})}catch(_X){t=null}n=null!=t&&t.width===e.width&&t.height===e.height?t:e}else n=e;return Jx(n,t)},toPixels:async function(e,t){let n=jp(e,"img","toPixels");if(!(e instanceof up)){const e=n;n=im(e,"int32"),e.dispose()}ek(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(!Kx){null!=Xd(Tu,Dp.backendName)&&(Kx=!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 rk(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===Ho(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=[...fl(e.shape).map((e=>e/u)),1].slice(0,s);return[l,i,u,c]}const ak=Object.freeze(Object.defineProperty({__proto__:null,prepareAndValidate:rk},Symbol.toStringTag,{value:"Module"})),sk=-2,ik=-1;
/**
 * @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 ok(e,t,n){const r=e.shape.length;Go(r===t.length,(()=>`Error in slice${r}D: Length of begin ${t} must match the rank of the array (${r}).`)),Go(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)Go(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 lk(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 uk(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 ck(e,t,n){return n<=e?n:n-(t-1)}function dk(e,t){const n=[];for(let r=0;r<e;r++)n.push(t+r);return n}function hk(e,t,n,r,a){const s=[...a],i=dk(n,t);for(let o=0;o<s.length;o++)if(i.indexOf(o)>-1)s[o]=0;else{const a=ck(t,n,o);let i=r[a];e&1<<a&&(i=0),s[o]=i}return s}function pk(e,t,n,r,a){const s=[...a],i=dk(n,t);for(let o=0;o<s.length;o++)if(i.indexOf(o)>-1)s[o]=Number.MAX_SAFE_INTEGER;else{const a=ck(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]=Lo(0,s[o],a[o])}return s}function fk(e,t,n){let r=e[t];return(n&1<<t||null==r)&&(r=1),r}function mk(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=Lo(0,i,l-1),i}function gk(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?Lo(0,i,l):Lo(-1,i,l-1),i}function yk(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 bk(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 vk(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=>{Go(-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:(Go(-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 Ak(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&&0!=(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&&0!=(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(sk),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(ik),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]=xk(h.begin[b],0,h.strides[b],n,r,a),h.end[b]=xk(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]):e===sk&&y.push(1)}return{finalShapeSparse:y.filter(((e,t)=>h.finalShapeGatherIndices[t]!==sk)),finalShape:y,isIdentity:p,sliceDim0:f,isSimpleSlice:m,begin:h.begin,end:h.end,strides:h.strides}}function xk(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 kk=Object.freeze(Object.defineProperty({__proto__:null,assertParamsValid:ok,computeFlatOffset:bk,computeOutShape:lk,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=hk(i,l,u,r,e),d=pk(o,l,u,a,e),h=uk(s,l,u,e)}else for(let p=0;p<u;p++)c[p]=mk(i,r,s,e,p,l),d[p]=gk(o,a,s,e,p,l),h[p]=fk(s,p,l);return{begin:c,end:d,strides:h}},isSliceContinous:yk,maskToAxes:function(e){const t=[];let n=0;for(;e>0;)1&e&&t.push(n),e/=2,n++;return t},parseSliceParams:vk,sliceInfo:Ak,startForAxis:mk,startIndicesWithElidedDims:hk,stopForAxis:gk,stopIndicesWithElidedDims:pk,stridesForAxis:fk,stridesWithElidedDims:uk},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 wk{static sgd(e){return new Tx(e)}static momentum(e,t,n=!1){return new Nx(e,t,n)}static rmsprop(e,t=.9,n=0,r=null,a=!1){return new Ex(e,t,n,r,a)}static adam(e=.001,t=.9,n=.999,r=null){return new Wx(e,t,n,r)}static adadelta(e=.001,t=.95,n=null){return new Cx(e,t,n)}static adamax(e=.002,t=.9,n=.999,r=null,a=0){return new _x(e,t,n,r,a)}static adagrad(e,t=.1){return new Ix(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 Sk=wk,Ck="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 Ik(){return new Promise((e=>Ck((()=>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 Wk(e,t){const n=e[0].length;e.forEach(((e,t)=>{Go(e.length===n,(()=>`Error in concat${n}D: rank of tensors[${t}] must be the same as the rank of the rest (${n})`))})),Go(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++)Go(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 _k(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 Tk,Nk;function Ek(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 Rk(e){const t={FIRST_DIM_SIZE:Tk.FIRST_DIM_SIZE,VALUE_ROWIDS:Tk.VALUE_ROWIDS,ROW_LENGTHS:Tk.ROW_LENGTHS,ROW_SPLITS:Tk.ROW_SPLITS,ROW_LIMITS:Tk.ROW_LIMITS,ROW_STARTS:Tk.ROW_STARTS},n=[];for(const r of e){if(!(r in t))break;n.push(t[r])}return n}function $k(e){return 0===e.length?0:e[0]===Tk.FIRST_DIM_SIZE?e.length-1:e.length}function Ok(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.
 * =============================================================================
 */(Nk=Tk||(Tk={}))[Nk.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",Nk[Nk.VALUE_ROWIDS=1]="VALUE_ROWIDS",Nk[Nk.ROW_LENGTHS=2]="ROW_LENGTHS",Nk[Nk.ROW_SPLITS=3]="ROW_SPLITS",Nk[Nk.ROW_LIMITS=4]="ROW_LIMITS",Nk[Nk.ROW_STARTS=5]="ROW_STARTS";const Fk=30;function Dk(e){return e<=Fk?e:pl(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 Mk(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 Lk(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 Bk(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 Pk(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 zk(e,t){const n=[0];for(let r=0;r<t;++r)n.push(e[r][0]);return n}function Gk(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 Vk=1.7580993408473768,Uk=1.0507009873554805,Hk=.3275911,jk=.254829592,qk=-.284496736,Qk=1.421413741,Xk=-1.453152027,Zk=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 Kk(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 Jk(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 Yk(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 ew(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 tw(e,t){return{real:e[2*t],imag:e[2*t+1]}}function nw(e,t,n,r){e[2*r]=t,e[2*r+1]=n}function rw(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 aw(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 sw="->",iw=/->/g,ow=",",lw="...";function uw(e,t){const n=((e=e.replace(/\s/g,"")).length-e.replace(iw,"").length)/sw.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${sw}").`);const[r,a]=e.split(sw);Go(-1===r.indexOf(lw),(()=>`The ellipsis notation ("${lw}") is not supported yet.`));const s=r.split(ow),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!==ow&&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 cw(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 dw(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]:Go(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 hw(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=fw(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 pw(e){return e.every(((e,t)=>e===t))}function fw(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 mw(e,t,n=0){let r=[];if("number"==typeof t)Go(e.shape[n]%t==0,(()=>"Number of splits must evenly divide the axis.")),r=new Array(t).fill(e.shape[n]/t);else{Go(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}Go(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 gw(e){return`Received SparseTensor with denseShape[0] = 0 but\n  indices.shape[0] = ${e}`}function yw(e,t){return`indices(${e}, 0) is invalid: ${t} < 0`}function bw(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 vw(e,t){return`only one output dimension may be -1, not both ${e} and ${t}`}function Aw(e,t){return`size ${e} must be non-negative, not ${t}`}function xw(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function kw(e,t){return`Input to reshape is a SparseTensor with ${Ho(e)}\n  dense values, but the requested shape requires a multiple of ${Ho(t)}. inputShape=${e} outputShape= ${t}`}function ww(e,t){return`Input to reshape is a tensor with ${Ho(e)} dense values, but the requested shape has ${Ho(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 Sw(){return"segment ids must be >= 0"}function Cw(){return"segment ids are not increasing"}function Iw(e,t){return`Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`}function Ww(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 _w(e,t){let n,r=!1;for(e<=Fk?(n=e,r=!0):n=pl(e,Math.floor(Math.sqrt(e)));!r;)n>t||n===e?r=!0:n=pl(e,n+1);return n}function Tw(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 Nw(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 Ew=Object.freeze(Object.defineProperty({__proto__:null,collectGatherOpShapeInfo:Nw,computeOutShape:Tw,segOpComputeOptimalWindowSize:_w},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 Rw(e){try{return e.map((e=>Hh(e)))}catch(cJ){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${cJ}`)}}function $w(e){return e.map((e=>Uh(e)))}const Ow=Object.freeze(Object.defineProperty({__proto__:null,ERF_A1:jk,ERF_A2:qk,ERF_A3:Qk,ERF_A4:Xk,ERF_A5:Zk,ERF_P:Hk,PARALLELIZE_THRESHOLD:Fk,get RowPartitionType(){return Tk},SELU_SCALE:Uk,SELU_SCALEALPHA:Vk,applyActivation:pA,assertAndGetBroadcastShape:Ng,assertAxesAreInnerMostDims:Hg,assertParamsConsistent:Wk,assignToTypedArray:nw,axesAreInnerMostDims:zg,calculateShapes:Gv,checkEinsumDimSizes:dw,checkPadOnDimRoundingMode:Pm,combineLocations:Gg,combineRaggedTensorToTensorShapes:Ek,complexWithEvenIndex:Yk,complexWithOddIndex:ew,computeConv2DInfo:Tm,computeConv3DInfo:Nm,computeDefaultPad:Em,computeDilation2DInfo:Im,computeOptimalWindowSize:Dk,computeOutAndReduceShapes:Vg,computeOutShape:_k,computePool2DInfo:Wm,computePool3DInfo:_m,convertConv2DDataFormat:Bm,decodeEinsumEquation:uw,eitherStridesOrDilationsAreOne:Mm,expandShapeToKeepDim:Ug,exponent:aw,exponents:rw,fromStringArrayToUint8:$w,fromUint8ToStringArray:Rw,getAxesPermutation:jg,getBroadcastDims:_g,getComplexWithIndex:tw,getEinsumComputePath:hw,getEinsumPermutation:cw,getFusedBiasGradient:hA,getFusedDyActivation:dA,getImageCenter:Mk,getInnerMostAxes:Qg,getPermuted:Bk,getRaggedRank:$k,getReductionAxes:Tg,getReshaped:Lk,getReshapedPermuted:Pk,getRowPartitionTypesHelper:Rk,getSliceBeginCoords:zk,getSliceSize:Gk,getSparseFillEmptyRowsIndicesDenseShapeMismatch:gw,getSparseFillEmptyRowsNegativeIndexErrorMessage:yw,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:bw,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:xw,getSparseReshapeInputOutputMismatchErrorMessage:ww,getSparseReshapeInputOutputMultipleErrorMessage:kw,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:vw,getSparseReshapeNegativeOutputDimErrorMessage:Aw,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:Ww,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:Sw,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:Cw,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:Iw,getUndoAxesPermutation:qg,isIdentityPermutation:pw,log:function(...e){!_l().getBool("IS_TEST")&&_l().getBool("PROD")},mergeRealAndImagArrays:Kk,prepareAndValidate:rk,prepareSplitSize:mw,segment_util:Ew,shouldFuse:fA,slice_util:kk,splitRealAndImagArrays:Jk,stridesOrDilationsArePositive:Lm,tupleValuesAreOne:Dm,upcastType:wp,validateDefaultValueShape:Ok,validateInput:zv,validateUpdateShape:Pv,warn:jd},Symbol.toStringTag,{value:"Module"})),Fw=Object.freeze(Object.defineProperty({__proto__:null,nonMaxSuppressionV3Impl:OA,nonMaxSuppressionV4Impl:FA,nonMaxSuppressionV5Impl:DA,whereImpl:Jv},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 Rx)kx(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 Dw=Object.freeze(Object.defineProperty({__proto__:null,Abs:$l,Acos:Ol,Acosh:Fl,AdadeltaOptimizer:Cx,AdagradOptimizer:Ix,AdamOptimizer:Wx,AdamaxOptimizer:_x,Add:Dl,AddN:Ml,All:Ll,Any:Bl,ArgMax:Pl,ArgMin:zl,Asin:Gl,Asinh:Vl,Atan:Ul,Atan2:jl,Atanh:Hl,AvgPool:ql,AvgPool3D:Xl,AvgPool3DGrad:Zl,AvgPoolGrad:Ql,BatchMatMul:Kl,BatchToSpaceND:Jl,Bincount:Yl,BitwiseAnd:eu,BroadcastArgs:nu,BroadcastTo:tu,Cast:ru,Ceil:au,ClipByValue:su,Complex:iu,ComplexAbs:ou,Concat:lu,Conv2D:uu,Conv2DBackpropFilter:cu,Conv2DBackpropInput:du,Conv3D:hu,Conv3DBackpropFilterV2:pu,Conv3DBackpropInputV2:fu,Cos:mu,Cosh:gu,CropAndResize:vu,Cumprod:yu,Cumsum:bu,DataStorage:Oo,DenseBincount:Au,DepthToSpace:xu,DepthwiseConv2dNative:ku,DepthwiseConv2dNativeBackpropFilter:wu,DepthwiseConv2dNativeBackpropInput:Su,Diag:Cu,Dilation2D:Iu,Dilation2DBackpropFilter:_u,Dilation2DBackpropInput:Wu,Draw:Tu,get ENV(){return Nl},Einsum:Eu,Elu:Ru,EluGrad:$u,Environment:Il,Equal:Fu,Erf:Ou,Exp:Du,ExpandDims:Mu,Expm1:Lu,FFT:Bu,Fill:Pu,FlipLeftRight:zu,Floor:Gu,FloorDiv:Vu,FromPixels:zd,FusedBatchNorm:Uu,FusedConv2D:Ud,FusedDepthwiseConv2D:Hd,GatherNd:ju,GatherV2:Hu,Greater:qu,GreaterEqual:Qu,IFFT:Zu,Identity:Xu,Imag:Ku,IsFinite:Ju,IsInf:Yu,IsNan:ec,KernelBackend:Fo,LRN:dc,LRNGrad:hc,LeakyRelu:tc,Less:nc,LessEqual:rc,LinSpace:ac,Log:sc,Log1p:ic,LogSoftmax:cc,LogicalAnd:oc,LogicalNot:lc,LogicalOr:uc,LogicalXor:"LogicalXor",LowerBound:"LowerBound",MatrixBandPart:"MatrixBandPart",Max:pc,MaxPool:mc,MaxPool3D:yc,MaxPool3DGrad:bc,MaxPoolGrad:gc,MaxPoolWithArgmax:vc,Maximum:fc,Mean:Ac,Min:xc,Minimum:kc,MirrorPad:wc,Mod:Sc,MomentumOptimizer:Nx,Multinomial:Cc,Multiply:Ic,Neg:Wc,NonMaxSuppressionV3:Tc,NonMaxSuppressionV4:Nc,NonMaxSuppressionV5:Ec,NotEqual:_c,OP_SCOPE_SUFFIX:Qp,OneHot:$c,OnesLike:Rc,Optimizer:Sx,OptimizerConstructors:wk,Pack:Oc,PadV2:Fc,Pool:"Pool",Pow:Dc,Prelu:Mc,Prod:Lc,RMSPropOptimizer:Ex,RaggedGather:Bc,RaggedRange:Pc,RaggedTensorToTensor:zc,Range:Gc,get Rank(){return hp},Real:Vc,RealDiv:Nu,Reciprocal:Uc,get Reduction(){return ex},Relu:Hc,Relu6:Kc,Reshape:jc,ResizeBilinear:Xc,ResizeBilinearGrad:Zc,ResizeNearestNeighbor:qc,ResizeNearestNeighborGrad:Qc,Reverse:Jc,RotateWithOffset:Gd,Round:Yc,Rsqrt:ed,SGDOptimizer:Tx,ScatterNd:td,SearchSorted:rd,Select:ad,Selu:sd,Sigmoid:cd,Sign:ud,Sin:od,Sinh:ld,Slice:id,Softmax:gd,Softplus:dd,SpaceToBatchND:fd,SparseFillEmptyRows:yd,SparseReshape:bd,SparseSegmentMean:vd,SparseSegmentSum:Ad,SparseToDense:xd,SplitV:md,Sqrt:hd,Square:wd,SquaredDifference:kd,StaticRegexReplace:Sd,Step:Pd,StridedSlice:Cd,StringNGrams:Id,StringSplit:Wd,StringToHashBucketFast:_d,Sub:Td,Sum:pd,Tan:Nd,Tanh:Ed,Tensor:up,TensorBuffer:ip,TensorScatterUpdate:nd,Tile:Rd,TopK:$d,Transform:Od,Transpose:Fd,Unique:Dd,Unpack:Md,UnsortedSegmentSum:Ld,UpperBound:"UpperBound",Variable:dp,ZerosLike:Bd,_FusedMatMul:Vd,abs:pm,acos:fm,acosh:mm,add:um,addN:gm,all:ym,any:bm,argMax:vm,argMin:Am,asin:xm,asinh:km,atan:wm,atan2:Sm,atanh:Cm,avgPool:Gm,avgPool3d:Vm,backend:uf,backend_util:Ow,basicLSTMCell:Xm,batchNorm:Km,batchNorm2d:Jm,batchNorm3d:Ym,batchNorm4d:eg,batchToSpaceND:Zm,bincount:tg,bitwiseAnd:ng,booleanMaskAsync:eA,broadcastArgs:rg,broadcastTo:ag,broadcast_util:Eg,browser:nk,buffer:sm,cast:im,ceil:sg,clipByValue:og,clone:om,complex:Zp,concat:Um,concat1d:lg,concat2d:ug,concat3d:cg,concat4d:dg,conv1d:pg,conv2d:hg,conv2dTranspose:mg,conv3d:gg,conv3dTranspose:bg,copyRegisteredKernels:function(e,t){Kd(e).forEach((e=>{Jd(Object.assign({},e,{backendName:t}))}))},cos:vg,cosh:Ag,cosineWindow:lA,cumprod:xg,cumsum:kg,customGrad:Iy,denseBincount:wg,deprecationWarn:function(e){_l().getBool("DEPRECATION_WARNINGS_ENABLED")},depthToSpace:Sg,depthwiseConv2d:Cg,device_util:zp,diag:Ig,dilation2d:Wg,disableDeprecationWarnings:function(){_l().set("DEPRECATION_WARNINGS_ENABLED",!1)},dispose:af,disposeVariables:function(){Dp.disposeVariables()},div:dm,divNoNan:Fg,dot:Dg,dropout:iA,einsum:Mg,elu:Lg,enableDebugMode:function(){_l().set("DEBUG",!0)},enableProdMode:function(){_l().set("PROD",!0)},enclosingPowerOfTwo:oA,engine:tf,ensureShape:Bg,env:_l,equal:Rg,erf:Pg,euclideanNorm:ay,exp:sy,expandDims:iy,expm1:oy,eye:uy,fft:wv,fill:ig,findBackend:function(e){return Dp.findBackend(e)},findBackendFactory:function(e){return Dp.findBackendFactory(e)},floor:cy,floorDiv:cm,fused:AA,gather:dy,gatherND:sA,gather_util:ak,getBackend:of,getGradient:Zd,getKernel:Xd,getKernelsForBackend:Kd,grad:function(e){return Go(hl(e),(()=>"The f passed in grad(f) must be a function")),(t,n)=>{const r=jp(t,"x","tf.grad","string_or_numeric"),a=null!=n?jp(n,"dy","tf.grad"):null;return Dp.tidy((()=>{const{value:t,grads:n}=Dp.gradients((()=>e(r)),[r],a);return null!=a&&Vo(t.shape,a.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Wy(n),n[0]}))}},grads:function(e){return Go(hl(e),(()=>"The f passed in grads(f) must be a function")),(t,n)=>{Go(Array.isArray(t),(()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"));const r=qp(t,"args","tf.grads","string_or_numeric"),a=null!=n?jp(n,"dy","tf.grads"):null;return Dp.tidy((()=>{const{value:t,grads:n}=Dp.gradients((()=>e(...r)),r,a);return null!=a&&Vo(t.shape,a.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Wy(n),n}))}},greater:hy,greaterEqual:py,ifft:Sv,imag:fy,image:px,inTopKAsync:uA,io:qx,irfft:Cv,isFinite:my,isInf:gy,isNaN:yy,keep:sf,kernel_impls:Fw,leakyRelu:by,less:vy,lessEqual:Ay,linalg:fx,linspace:xy,localResponseNormalization:ky,log:wy,log1p:Sy,logSigmoid:Ny,logSoftmax:Ry,logSumExp:$y,logicalAnd:Oy,logicalNot:Fy,logicalOr:Dy,logicalXor:My,losses:mx,lowerBound:Py,matMul:Hm,math:Xx,max:Xg,maxPool:zy,maxPool3d:Gy,maxPoolWithArgmax:Vy,maximum:Uy,mean:Hy,memory:nf,meshgrid:Qy,min:Zg,minimum:Xy,mirrorPad:Zy,mod:Ky,moments:Jy,movingAverage:nA,mul:hm,multiRNNCell:Yy,multinomial:eb,neg:_y,nextFrame:Ik,norm:ry,notEqual:tb,oneHot:nb,ones:qy,onesLike:rb,op:Xp,outerProduct:ab,pad:sb,pad1d:ib,pad2d:ob,pad3d:lb,pad4d:ub,pool:db,pow:Kg,prelu:hb,print:lm,prod:pb,profile:function(e){return Dp.profile(e)},raggedGather:fb,raggedRange:mb,raggedTensorToTensor:gb,rand:yb,randomGamma:Xb,randomNormal:Zb,randomStandardNormal:Kb,randomUniform:Jb,randomUniformInt:Yb,range:ev,ready:function(){return Dp.ready()},real:tv,reciprocal:nv,registerBackend:lf,registerGradient:Yd,registerKernel:Jd,relu:rv,relu6:av,removeBackend:function(e){Dp.removeBackend(e)},reshape:zm,reverse:sv,reverse1d:iv,reverse2d:ov,reverse3d:lv,reverse4d:uv,rfft:Wv,round:cv,rsqrt:dv,scalar:Jg,scatterND:rA,scatter_util:Vv,searchSorted:By,selu:hv,separableConv2d:pv,serialization:wx,setBackend:function(e){return Dp.setBackend(e)},setPlatform:function(e,t){_l().setPlatform(e,t)},setdiff1dAsync:fv,sigmoid:jm,sign:mv,signal:hx,sin:gv,sinh:yv,slice:qm,slice1d:bv,slice2d:vv,slice3d:Av,slice4d:xv,slice_util:kk,softmax:kv,softplus:Ty,spaceToBatchND:cb,sparse:gx,sparseToDense:aA,spectral:dx,split:Iv,sqrt:Yg,square:ey,squaredDifference:_v,squeeze:Tv,stack:Nv,step:Ev,stridedSlice:Rv,string:yx,sub:Ey,sum:ty,sumOutType:Sp,tan:$v,tanh:Qm,tensor:Jp,tensor1d:Ov,tensor2d:Fv,tensor3d:Dv,tensor4d:Mv,tensor5d:Lv,tensor6d:Bv,tensorScatterUpdate:Uv,tensor_util:Ep,test_util:Hb,tidy:rf,tile:ly,time:function(e){return Dp.time(e)},topk:Hv,train:Sk,transpose:tA,truncatedNormal:jv,unique:qv,unregisterGradient:function(e){if(!Qd.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);Qd.delete(e)},unregisterKernel:function(e,t){const n=eh(e,t);if(!qd.has(n))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);qd.delete(n)},unsortedSegmentSum:Qv,unstack:Xv,upcastType:wp,upperBound:Zv,util:Qh,valueAndGrad:function(e){return Go(hl(e),(()=>"The f passed in valueAndGrad(f) must be a function")),(t,n)=>{Go(t instanceof up,(()=>"The x passed in valueAndGrad(f)(x) must be a tensor")),Go(null==n||n instanceof up,(()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"));const{grads:r,value:a}=Dp.gradients((()=>e(t)),[t],n);return Wy(r),{grad:r[0],value:a}}},valueAndGrads:function(e){return Go(hl(e),(()=>"The f passed in valueAndGrads(f) must be a function")),(t,n)=>{Go(Array.isArray(t)&&t.every((e=>e instanceof up)),(()=>"The args passed in valueAndGrads(f)(args) must be array of tensors")),Go(null==n||n instanceof up,(()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"));const r=Dp.gradients((()=>e(...t)),t,n);return null!=n&&Vo(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Wy(r.grads),r}},variable:Kv,variableGrads:Cy,version_core:"4.15.0",where:$g,whereAsync:Yv,zeros:jy,zerosLike:Og},Symbol.toStringTag,{value:"Module"})),Mw={kernelName:$l,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(e,Ev(im(n,"float32"),-1))}}},Lw={kernelName:Ol,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=ey(im(n,"float32")),r=Yg(Ey(Jg(1),t));return _y(dm(e,r))}}}},Bw={kernelName:Fl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=Yg(Ey(ey(im(n,"float32")),1));return dm(e,t)}}}},Pw={kernelName:Dl,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Ng(n.shape,r.shape);return{a:()=>{let t=e;const r=Tg(n.shape,a);return r.length>0&&(t=ty(t,r)),zm(t,n.shape)},b:()=>{let t=e;const n=Tg(r.shape,a);return n.length>0&&(t=ty(t,n)),zm(t,r.shape)}}}},zw={kernelName:Ml,saveAllInputs:!0,gradFunc:(e,t)=>{const n={};return t.forEach(((t,r)=>{n[r]=()=>e.clone()})),n}},Gw={kernelName:Pl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>Og(n)}}},Vw={kernelName:zl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>Og(n)}}},Uw={kernelName:Gl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,Yg(Ey(Jg(1),ey(im(n,"float32")))))}}},Hw={kernelName:Vl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=Yg(um(Jg(1),ey(im(n,"float32"))));return dm(e,t)}}}},jw={kernelName:jl,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Ng(n.shape,r.shape);return{a:()=>{const t=um(ey(n),ey(r));let s=hm(e,dm(r,t));const i=Tg(n.shape,a);return i.length>0&&(s=ty(s,i)),zm(s,n.shape)},b:()=>{const t=um(ey(n),ey(r));let s=_y(hm(e,dm(n,t)));const i=Tg(r.shape,a);return i.length>0&&(s=ty(s,i)),zm(s,r.shape)}}}},qw={kernelName:Ul,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,um(ey(im(n,"float32")),1))}}},Qw={kernelName:Hl,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,Ey(Jg(1),ey(im(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 Xw=Xp({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=jp(e,"dy","avgPool3dGrad"),o=jp(t,"input","avgPool3dGrad");let l=i,u=o,c=!1;4===o.rank&&(c=!0,l=zm(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),u=zm(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),Go(5===l.rank,(()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`)),Go(5===u.rank,(()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${u.rank}.`)),Pm("avgPool3dGrad",a,s);const d={dy:l,input:u},h={filterSize:n,strides:r,pad:a,dimRoundingMode:s},p=Dp.runKernel(Zl,d,h);return c?zm(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}}),Zw={kernelName:Xl,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{filterSize:a,strides:s,pad:i,dimRoundingMode:o}=n;return{x:()=>Xw(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 Kw=Xp({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=jp(e,"dy","avgPoolGrad"),i=jp(t,"input","avgPoolGrad");Go(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=zm(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=zm(s,[1,s.shape[0],s.shape[1],s.shape[2]])),Go(4===l.rank,(()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`)),Go(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=Dp.runKernel(Ql,c,d);return u?zm(h,[h.shape[1],h.shape[2],h.shape[3]]):h}}),Jw={kernelName:ql,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{filterSize:a,strides:s,pad:i}=n;return{x:()=>Kw(e,r,a,s,i)}}},Yw={kernelName:Kl,inputsToSave:["a","b"],gradFunc:(e,t,n)=>{const[r,a]=t,{transposeA:s,transposeB:i}=n;return s||i?!s&&i?{a:()=>Hm(e,a,!1,!1),b:()=>Hm(e,r,!0,!1)}:s&&!i?{a:()=>Hm(a,e,!1,!0),b:()=>Hm(r,e,!1,!1)}:{a:()=>Hm(a,e,!0,!0),b:()=>Hm(e,r,!0,!0)}:{a:()=>Hm(e,a,!1,!0),b:()=>Hm(r,e,!0,!1)}}},eS={kernelName:Jl,gradFunc:(e,t,n)=>{const{blockShape:r,crops:a}=n;return{x:()=>cb(e,r,a)}}},tS={kernelName:tu,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:()=>ty(e,o,!0)}}},nS={kernelName:ru,gradFunc:e=>({x:()=>e.clone()})},rS={kernelName:au,gradFunc:e=>({x:()=>Og(e)})},aS={kernelName:su,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{clipValueMin:a,clipValueMax:s}=n;return{x:()=>$g(Oy(py(r,a),Ay(r,s)),e,Og(e))}}},sS={kernelName:ou,inputsToSave:["x"],gradFunc:Mw.gradFunc},iS={kernelName:lu,saveAllInputs:!0,gradFunc:(e,t,n)=>{const r=t.map((e=>e.shape)),{axis:a}=n,s=Yo(a,t[0].shape)[0],i=r.map((e=>e[s]));return Iv(e,i,s).map((e=>()=>e))}},oS={kernelName:uu,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const[r,a]=t,{dilations:s,strides:i,pad:o,dataFormat:l}=n;return Go(Dm(s),(()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`)),{x:()=>fg(r.shape,e,a,i,o,l),filter:()=>cA(r,e,a.shape,i,o,l)}}},lS={kernelName:du,inputsToSave:["dy","filter"],gradFunc:(e,t,n)=>{const[r,a]=t,{strides:s,pad:i,dataFormat:o,dimRoundingMode:l}=n;return{dy:()=>hg(e,a,s,i,o,1,l),filter:()=>cA(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 uS=Xp({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=zm(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));let i=t;4===i.rank&&(i=zm(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),Go(5===s.rank,(()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${s.shape}.`)),Go(5===i.rank,(()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`)),Go(5===n.length,(()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${n}.`)),Go(s.shape[4]===n[3],(()=>`Error in conv3dDerFilter: depth of input ${s.shape[4]}) must match input depth in filter (${n[3]}.`)),Go(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 Dp.runKernel(pu,o,l)}}),cS={kernelName:hu,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:r,strides:a,pad:s}=n;Go(Dm(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:()=>yg(i.shape,e,o,a,s),filter:()=>uS(i,e,o.shape,a,s)}}},dS={kernelName:mu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(_y(gv(im(n,"float32"))),e)}}},hS={kernelName:gu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(yv(im(n,"float32")),e)}}},pS={kernelName:bu,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{axis:a,exclusive:s,reverse:i}=n;return{x:()=>{const t=jg([a],r.rank);let n=kg(e,a,s,!i);return null!=t&&(n=tA(n,t)),n}}}},fS={kernelName:ku,inputsToSave:["x","filter"],gradFunc:(e,t,n)=>{const{dilations:r,strides:a,pad:s,dimRoundingMode:i}=n,o=null==r?[1,1]:r;Go(Dm(o),(()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${o}'`));const[l,u]=t;return Go(4===l.rank,(()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`)),Go(4===u.rank,(()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${u.rank}.`)),Go(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]}.`)),Go(Mm(a,o),(()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be  1. Got strides ${a} and dilations '${o}'.`)),Pm("depthwiseConv2d",s,i),{x:()=>yA(l.shape,e,u,a,s,o,i),filter:()=>gA(l,e,u.shape,a,s,o,i)}}},mS={kernelName:Iu,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:()=>Dp.runKernel(Wu,s,n),filter:()=>Dp.runKernel(_u,i,n)}}},gS={kernelName:Ru,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t,r={dy:e,y:n};return{x:()=>Dp.runKernel($u,r)}}},yS={kernelName:Ou,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,r=hm(sy(_y(ey(n))),2/Math.sqrt(Math.PI));return{x:()=>hm(e,r)}}},bS={kernelName:Du,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(e,n)}}},vS={kernelName:Mu,inputsToSave:["input"],gradFunc:(e,t)=>{const[n]=t;return{input:()=>zm(e,n.shape)}}},AS={kernelName:Lu,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(e,sy(n))}}},xS={kernelName:Gu,gradFunc:e=>({x:()=>Og(e)})},kS={kernelName:Vu,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Ng(n.shape,r.shape);return{a:()=>{const t=dm(e,im(r,"float32")),s=Tg(n.shape,a);return s.length>0?zm(ty(t,s),n.shape):t},b:()=>{let t=hm(e,im(n,"float32"));const s=Tg(r.shape,a);s.length>0&&(t=zm(ty(t,s),r.shape));const i=ey(r);return _y(dm(t,im(i,"float32")))}}}},wS={kernelName:Uu,inputsToSave:["x","mean","variance","scale"],gradFunc:(e,t,n)=>{const{varianceEpsilon:r}=n,[a,s,i,o]=t,l=null==o?Jg(1):o,u=Tg(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=Ey(a,s),h=hm(e,l),p=dv(um(i,Jg(r))),f=hm(hm(hm(p,p),p),Jg(-.5));return{x:()=>1===s.rank?zm(hm(hm(e,ly(zm(p,[1,1,1,s.shape[0]]),c)),l),a.shape):zm(hm(hm(e,p),l),a.shape),mean:()=>{let e=hm(hm(p,Jg(-1)),h);return 1===s.rank&&(e=ty(e,u)),zm(e,s.shape)},variance:()=>{let e=hm(hm(f,d),h);return 1===s.rank&&(e=ty(e,u)),zm(e,s.shape)},scale:()=>{const t=hm(d,p);let n=hm(e,t);return 1===s.rank&&(n=ty(n,u)),zm(n,s.shape)},offset:()=>{let t=e;return 1===s.rank&&(t=ty(t,u)),zm(t,s.shape)}}}},SS={kernelName:Hu,inputsToSave:["x","indices"],gradFunc:(e,t,n)=>{const[r,a]=t,{axis:s,batchDims:i}=n,o=Yo(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=CS(0,l),h=CS(l+1,l+1+c),p=IS([i,[a],u]),f=zm(n,p),m=zm(t,[a]),g=IS([[l],d,h]),y=tA(f,g);let b=Qv(y,m,e.shape[o]);const v=qg(g);return b=tA(b,v),b};if(1===i){const t=r.shape[0],n=r.split(t,0);return{x:()=>Nv(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 CS(e,t){const n=[];for(let r=e;r<t;++r)n.push(r);return n}function IS(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 WS={kernelName:Qu,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>Og(n),b:()=>Og(r)}}},_S={kernelName:Xu,gradFunc:e=>({x:()=>im(e,"float32")})},TS={kernelName:Ju,gradFunc:e=>({x:()=>Og(e)})},NS={kernelName:Yu,gradFunc:e=>({x:()=>Og(e)})},ES={kernelName:ec,gradFunc:e=>({x:()=>Og(e)})},RS={kernelName:tc,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{alpha:a}=n,s=hy(r,0);return{x:()=>$g(s,e,hm(e,a))}}},$S={kernelName:ic,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,um(n,1))}}},OS={kernelName:sc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,im(n,"float32"))}}},FS={kernelName:cc,inputsToSave:[],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r]=t,{axis:a}=n;return{logits:()=>{const t=sy(r);return Ey(e,hm(ty(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 DS=Xp({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 Dp.runKernel(hc,o,l)}}),MS={kernelName:dc,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,a]=t,{depthRadius:s,bias:i,alpha:o,beta:l}=n;return{x:()=>DS(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 LS(e,t,n,r){return t.rank<n.rank&&(t=zm(t,Ug(t.shape,r))),e.rank<n.rank&&(e=zm(e,Ug(e.shape,r))),{x:()=>hm(e,im(Rg(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 BS={kernelName:pc,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const r=n,{reductionIndices:a}=r,s=t[0],i=LS(e,t[1],s,Yo(a,s.shape));return{x:()=>i.x()}}},PS={kernelName:fc,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>hm(e,im(py(n,r),"float32")),b:()=>hm(e,im(vy(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 zS=Xp({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=jp(e,"dy","maxPool3dGrad"),l=jp(t,"input","maxPool3dGrad"),u=jp(n,"output","maxPool3dGrad");let c=o,d=l,h=u,p=!1;4===l.rank&&(p=!0,c=zm(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),d=zm(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),h=zm(u,[1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]])),Go(5===c.rank,(()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${c.rank}.`)),Go(5===d.rank,(()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${d.rank}.`)),Go(5===h.rank,(()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${h.rank}.`)),Pm("maxPool3dGrad",s,i);const f={dy:c,input:d,output:h},m={filterSize:r,strides:a,pad:s,dimRoundingMode:i},g=Dp.runKernel(bc,f,m);return p?zm(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}}),GS={kernelName:yc,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,a]=t,{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=n;return{x:()=>zS(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 VS=Xp({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=jp(e,"dy","maxPoolGrad"),l=jp(t,"input","maxPoolGrad"),u=jp(n,"output","maxPoolGrad");Go(l.rank===o.rank,(()=>`Rank of input (${l.rank}) does not match rank of dy (${o.rank})`)),Go(4===o.rank,(()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${o.rank}.`)),Go(4===l.rank,(()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`)),Pm("maxPoolGrad",s,i);const c={dy:o,input:l,output:u},d={filterSize:r,strides:a,pad:s,dimRoundingMode:i};return Dp.runKernel(gc,c,d)}}),US={kernelName:Oc,saveAllInputs:!0,gradFunc:(e,t,n)=>{const{axis:r}=n;return Xv(e,r).map((e=>()=>e))}},HS={kernelName:Fc,inputsToSave:["x"],gradFunc:(e,t,n)=>{const r=t[0],{paddings:a}=n,s=a.map((e=>e[0]));return{x:()=>qm(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 jS(e,t,n){const r=e.shape.length,a=r-n.length,s=jg(n,r);let i=e;null!=s&&(i=tA(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=zm(t,r),s=xg(e,n,!0,!1),i=xg(e,n,!0,!0),o=hm(s,i);return hm(a,o)}(i.reshape(o),t,a);if(u=u.reshape(i.shape),null!=s){const e=qg(s);u=tA(u,e)}return u}const qS={kernelName:fd,gradFunc:(e,t,n)=>{const{blockShape:r,paddings:a}=n;return{x:()=>Zm(e,r,a)}}},QS={kernelName:md,gradFunc:(e,t,n)=>{const{axis:r}=n;return{x:()=>Um(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 XS=[Mw,Lw,Bw,Pw,zw,Gw,Vw,Uw,Hw,jw,qw,Qw,Zw,Jw,Yw,eS,tS,nS,rS,aS,sS,iS,lS,oS,cS,dS,hS,pS,fS,mS,{kernelName:Nu,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Ng(n.shape,r.shape);return{a:()=>{const t=dm(e,im(r,"float32")),s=Tg(n.shape,a);return s.length>0?zm(ty(t,s),n.shape):t},b:()=>{let t=hm(e,im(n,"float32"));const s=Tg(r.shape,a);s.length>0&&(t=zm(ty(t,s),r.shape));const i=ey(r);return _y(dm(t,im(i,"float32")))}}}},gS,yS,bS,vS,AS,kS,xS,wS,SS,WS,_S,TS,NS,ES,RS,$S,OS,FS,MS,BS,BS,PS,GS,{kernelName:mc,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r,a]=t,{filterSize:s,strides:i,pad:o}=n;return{x:()=>VS(e,r,a,s,i,o)}}},{kernelName:Ac,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{axis:a}=n,s=Yo(a,r.shape),i=Ho(Vg(r.shape,s)[1]);return{x:()=>{const t=r.shape.slice();s.forEach((e=>{t[e]=1}));const n=zm(e,t);return dm(hm(n,qy(r.shape,"float32")),i)}}}},{kernelName:xc,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(e,t,n)=>{const r=n,{axis:a}=r,[s,i]=t,o=LS(e,i,s,Yo(a,s.shape));return{x:()=>o.x()}}},{kernelName:kc,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t;return{a:()=>hm(e,im(Ay(n,r),"float32")),b:()=>hm(e,im(hy(n,r),"float32"))}}},{kernelName:wc,inputsToSave:["x"],gradFunc:(e,t,n)=>{const r=t[0],{paddings:a}=n,s=a.map((e=>e[0]));return{x:()=>qm(e,s,r.shape)}}},{kernelName:Sc,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Ng(n.shape,r.shape);return{a:()=>{const t=Tg(n.shape,a);return t.length>0?zm(ty(e,t),n.shape):e},b:()=>{const t=hm(e,_y(cy(dm(n,r)))),s=Tg(r.shape,a);return s.length>0?zm(ty(t,s),r.shape):t}}}},{kernelName:Ic,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Ng(n.shape,r.shape);return{a:()=>{const t=hm(e,im(r,"float32")),s=Tg(n.shape,a);return s.length>0?zm(ty(t,s),n.shape):t},b:()=>{const t=hm(e,im(n,"float32")),s=Tg(r.shape,a);return s.length>0?zm(ty(t,s),r.shape):t}}}},{kernelName:Wc,gradFunc:e=>({x:()=>_y(e)})},{kernelName:$c,inputsToSave:["indices"],gradFunc:(e,t)=>{const n=t[0];return{indices:()=>jy(n.shape,"float32")}}},{kernelName:Rc,gradFunc:e=>({x:()=>Og(e)})},US,HS,HS,{kernelName:Dc,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(e,t)=>{const[n,r,a]=t,s=n,i=r,o=Ng(s.shape,i.shape);return{a:()=>{const t=im(i,"float32");let n=hm(e,hm(t,Kg(s,Ey(t,Jg(1)))));const r=Tg(s.shape,o);return r.length>0&&(n=ty(n,r)),zm(n,s.shape)},b:()=>{const t=hy(s,0),n=$g(t,wy(s),Og(s));let r=hm(e,hm(a,n));const l=Tg(i.shape,o);return l.length>0&&(r=ty(r,l)),zm(r,i.shape)}}}},{kernelName:Mc,inputsToSave:["x","alpha"],gradFunc:(e,t)=>{const[n,r]=t,a=hy(n,0);return{x:()=>$g(a,e,hm(e,r)),alpha:()=>{let t=$g(a,Og(e),hm(e,n));const s=Tg(r.shape,e.shape);return s.length>0&&(t=ty(t,s)),zm(t,r.shape)}}}},{kernelName:Lc,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:()=>jS(r,e,s)}}},{kernelName:Uc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,_y(ey(n)))}}},{kernelName:Kc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t,r=hm(Ay(n,6),Ev(n));return{x:()=>hm(e,im(r,"float32"))}}},{kernelName:Hc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(e,im(Ev(n),"float32"))}}},{kernelName:jc,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>zm(e,n.shape)}}},{kernelName:Xc,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[r]=t,a={dy:e,images:r};return{images:()=>Dp.runKernel(Zc,a,n)}}},{kernelName:qc,inputsToSave:["images"],gradFunc:(e,t,n)=>{const[r]=t,a={dy:e,images:r};return{images:()=>Dp.runKernel(Qc,a,n)}}},{kernelName:Jc,gradFunc:(e,t,n)=>{const{dims:r}=n,a=Yo(r,e.shape);return{x:()=>sv(e,a)}}},{kernelName:Yc,gradFunc:e=>({x:()=>Og(e)})},{kernelName:ed,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>_y(dm(e,hm(Kg(n,1.5),2)))}}},{kernelName:ad,inputsToSave:["condition"],gradFunc:(e,t)=>{const[n]=t;return{condition:()=>im(Og(n),"float32"),t:()=>hm(e,im(n,e.dtype)),e:()=>hm(e,im(Fy(n),e.dtype))}}},{kernelName:sd,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>{const t=hy(n,Jg(0)),r=Jg(Vk),a=Jg(Uk),s=hm(e,a),i=hm(hm(e,r),sy(im(n,"float32")));return $g(t,s,i)}}}},{kernelName:cd,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(e,hm(n,Ey(Jg(1),n)))}}},{kernelName:ud,gradFunc:e=>({x:()=>Og(e)})},{kernelName:od,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(vg(im(n,"float32")),e)}}},{kernelName:ld,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(Ag(im(n,"float32")),e)}}},{kernelName:id,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{begin:a,size:s}=n,i=r.shape,[o,l]=vk(r,a,s),u=[];for(let c=0;c<e.rank;c++)u.push([o[c],i[c]-o[c]-l[c]]);return{x:()=>sb(e,u)}}},{kernelName:gd,outputsToSave:[!0],gradFunc:(e,t,n)=>{const[r]=t,{dim:a}=n,s=hm(e,r);return{logits:()=>Ey(s,hm(ty(s,[a],true),r))}}},{kernelName:dd,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(e,jm(n))}}},qS,qS,QS,QS,{kernelName:hd,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,hm(Yg(im(n,"float32")),2))}}},{kernelName:kd,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Jg(2);return{a:()=>hm(e,hm(a,Ey(n,r))),b:()=>hm(e,hm(a,Ey(r,n)))}}},{kernelName:wd,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(e,hm(im(n,"float32"),2))}}},{kernelName:Pd,gradFunc:e=>({x:()=>Og(e)})},{kernelName:Td,inputsToSave:["a","b"],gradFunc:(e,t)=>{const[n,r]=t,a=Ng(n.shape,r.shape);return{a:()=>{let t=e;const r=Tg(n.shape,a);return r.length>0&&(t=ty(t,r)),zm(t,n.shape)},b:()=>{let t=e;const n=Tg(r.shape,a);return n.length>0&&(t=ty(t,n)),zm(_y(t),r.shape)}}}},{kernelName:pd,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,a=r.shape.slice(),{axis:s}=n;Yo(s,r.shape).forEach((e=>{a[e]=1}));const i=zm(e,a),o=hm(i,qy(r.shape,"float32"));return{x:()=>o}}},{kernelName:Nd,inputsToSave:["x"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>dm(e,ey(vg(n)))}}},{kernelName:Ed,outputsToSave:[!0],gradFunc:(e,t)=>{const[n]=t;return{x:()=>hm(Ey(Jg(1),ey(n)),e)}}},{kernelName:Rd,inputsToSave:["x"],gradFunc:(e,t,n)=>{const[r]=t,{reps:a}=n;return{x:()=>{let t=Og(r);if(1===r.rank)for(let n=0;n<a[0];++n)t=um(t,qm(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=um(t,qm(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=um(t,qm(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=um(t,qm(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:Fd,gradFunc:(e,t,n)=>{const r=n,{perm:a}=r,s=qg(a);return{x:()=>tA(e,s)}}},{kernelName:Md,gradFunc:(e,t,n)=>{const r=n,{axis:a}=r;return{value:()=>Nv(e,a)}}},{kernelName:Ld,inputsToSave:["segmentIds"],gradFunc:(e,t)=>{const[n]=t;return{x:()=>function(e,t){const n=Uy(t,Og(t)),r=dy(e,n);let a=py(t,Jg(0,"int32"));const s=r.rank-a.rank;for(let o=0;o<s;++o)a=iy(a,o+1);a=Oy(a,qy(r.shape,"bool"));const i=Og(r);return $g(a,r,i)}(e,n)}}},{kernelName:Bd,gradFunc:e=>({x:()=>Og(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 XS)Yd(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.
 * =============================================================================
 */cp().prototype.abs=function(){return this.throwIfDisposed(),pm(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.
 * =============================================================================
 */
cp().prototype.acos=function(){return this.throwIfDisposed(),fm(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.
 * =============================================================================
 */
cp().prototype.acosh=function(){return this.throwIfDisposed(),mm(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.
 * =============================================================================
 */
cp().prototype.add=function(e){return this.throwIfDisposed(),um(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.
 * =============================================================================
 */
cp().prototype.all=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.
 * =============================================================================
 */
cp().prototype.any=function(e,t){return this.throwIfDisposed(),bm(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.
 * =============================================================================
 */
cp().prototype.argMax=function(e){return this.throwIfDisposed(),vm(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.
 * =============================================================================
 */
cp().prototype.argMin=function(e){return this.throwIfDisposed(),Am(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.
 * =============================================================================
 */
cp().prototype.asScalar=function(){return this.throwIfDisposed(),Go(1===this.size,(()=>"The array must have only 1 element.")),zm(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.
 * =============================================================================
 */
cp().prototype.asType=function(e){return this.throwIfDisposed(),im(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.
 * =============================================================================
 */
cp().prototype.as1D=function(){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.as2D=function(e,t){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.as4D=function(e,t,n,r){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.as5D=function(e,t,n,r,a){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.asin=function(){return this.throwIfDisposed(),xm(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.
 * =============================================================================
 */
cp().prototype.asinh=function(){return this.throwIfDisposed(),km(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.
 * =============================================================================
 */
cp().prototype.atan=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.
 * =============================================================================
 */
cp().prototype.atan2=function(e){return this.throwIfDisposed(),Sm(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.
 * =============================================================================
 */
cp().prototype.atanh=function(){return this.throwIfDisposed(),Cm(this)},cp().prototype.avgPool=function(e,t,n,r){return this.throwIfDisposed(),Gm(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.
 * =============================================================================
 */
cp().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),Zm(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.
 * =============================================================================
 */
cp().prototype.batchNorm=function(e,t,n,r,a){return this.throwIfDisposed(),Km(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.
 * =============================================================================
 */
cp().prototype.broadcastTo=function(e){return this.throwIfDisposed(),ag(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.
 * =============================================================================
 */
cp().prototype.cast=function(e){return this.throwIfDisposed(),im(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.
 * =============================================================================
 */
cp().prototype.ceil=function(){return this.throwIfDisposed(),sg(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.
 * =============================================================================
 */
cp().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),og(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.
 * =============================================================================
 */
cp().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof up&&(e=[e]),Um([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.
 * =============================================================================
 */
cp().prototype.conv1d=function(e,t,n,r,a,s){return this.throwIfDisposed(),pg(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.
 * =============================================================================
 */
cp().prototype.conv2dTranspose=function(e,t,n,r,a){return this.throwIfDisposed(),mg(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.
 * =============================================================================
 */
cp().prototype.conv2d=function(e,t,n,r,a,s){return this.throwIfDisposed(),hg(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.
 * =============================================================================
 */
cp().prototype.cos=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.
 * =============================================================================
 */
cp().prototype.cosh=function(){return this.throwIfDisposed(),Ag(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.
 * =============================================================================
 */
cp().prototype.cumprod=function(e,t,n){return this.throwIfDisposed(),xg(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.
 * =============================================================================
 */
cp().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),kg(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.
 * =============================================================================
 */
cp().prototype.depthToSpace=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.
 * =============================================================================
 */
cp().prototype.depthwiseConv2d=function(e,t,n,r,a,s){return this.throwIfDisposed(),Cg(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.
 * =============================================================================
 */
cp().prototype.dilation2d=function(e,t,n,r,a){return this.throwIfDisposed(),Wg(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.
 * =============================================================================
 */
cp().prototype.divNoNan=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.
 * =============================================================================
 */
cp().prototype.div=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.
 * =============================================================================
 */
cp().prototype.dot=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.
 * =============================================================================
 */
cp().prototype.elu=function(){return this.throwIfDisposed(),Lg(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.
 * =============================================================================
 */
cp().prototype.equal=function(e){return this.throwIfDisposed(),Rg(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.
 * =============================================================================
 */
cp().prototype.erf=function(){return this.throwIfDisposed(),Pg(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.
 * =============================================================================
 */
cp().prototype.euclideanNorm=function(e,t){return this.throwIfDisposed(),ay(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.
 * =============================================================================
 */
cp().prototype.exp=function(){return this.throwIfDisposed(),sy(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.
 * =============================================================================
 */
cp().prototype.expandDims=function(e){return this.throwIfDisposed(),iy(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.
 * =============================================================================
 */
cp().prototype.expm1=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.
 * =============================================================================
 */
cp().prototype.fft=function(){return this.throwIfDisposed(),wv(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.
 * =============================================================================
 */
cp().prototype.flatten=function(){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.floor=function(){return this.throwIfDisposed(),cy(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.
 * =============================================================================
 */
cp().prototype.floorDiv=function(e){return this.throwIfDisposed(),cm(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.
 * =============================================================================
 */
cp().prototype.gather=function(e,t,n){return this.throwIfDisposed(),dy(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.
 * =============================================================================
 */
cp().prototype.greaterEqual=function(e){return this.throwIfDisposed(),py(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.
 * =============================================================================
 */
cp().prototype.greater=function(e){return this.throwIfDisposed(),hy(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.
 * =============================================================================
 */
cp().prototype.ifft=function(){return this.throwIfDisposed(),Sv(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.
 * =============================================================================
 */
cp().prototype.irfft=function(){return this.throwIfDisposed(),Cv(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.
 * =============================================================================
 */
cp().prototype.isFinite=function(){return this.throwIfDisposed(),my(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.
 * =============================================================================
 */
cp().prototype.isInf=function(){return this.throwIfDisposed(),gy(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.
 * =============================================================================
 */
cp().prototype.isNaN=function(){return this.throwIfDisposed(),yy(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.
 * =============================================================================
 */
cp().prototype.leakyRelu=function(e){return this.throwIfDisposed(),by(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.
 * =============================================================================
 */
cp().prototype.lessEqual=function(e){return this.throwIfDisposed(),Ay(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.
 * =============================================================================
 */
cp().prototype.less=function(e){return this.throwIfDisposed(),vy(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.
 * =============================================================================
 */
cp().prototype.localResponseNormalization=function(e,t,n,r){return this.throwIfDisposed(),ky(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.
 * =============================================================================
 */
cp().prototype.logSigmoid=function(){return this.throwIfDisposed(),Ny(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.
 * =============================================================================
 */
cp().prototype.logSoftmax=function(e){return this.throwIfDisposed(),Ry(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.
 * =============================================================================
 */
cp().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),$y(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.
 * =============================================================================
 */
cp().prototype.log=function(){return this.throwIfDisposed(),wy(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.
 * =============================================================================
 */
cp().prototype.log1p=function(){return this.throwIfDisposed(),Sy(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.
 * =============================================================================
 */
cp().prototype.logicalAnd=function(e){return this.throwIfDisposed(),Oy(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.
 * =============================================================================
 */
cp().prototype.logicalNot=function(){return this.throwIfDisposed(),Fy(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.
 * =============================================================================
 */
cp().prototype.logicalOr=function(e){return this.throwIfDisposed(),Dy(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.
 * =============================================================================
 */
cp().prototype.logicalXor=function(e){return this.throwIfDisposed(),My(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.
 * =============================================================================
 */
cp().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),Hm(this,e,t,n)},cp().prototype.maxPool=function(e,t,n,r){return this.throwIfDisposed(),zy(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.
 * =============================================================================
 */
cp().prototype.max=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.
 * =============================================================================
 */
cp().prototype.maximum=function(e){return this.throwIfDisposed(),Uy(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.
 * =============================================================================
 */
cp().prototype.mean=function(e,t){return this.throwIfDisposed(),Hy(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.
 * =============================================================================
 */
cp().prototype.min=function(e,t){return this.throwIfDisposed(),Zg(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.
 * =============================================================================
 */
cp().prototype.minimum=function(e){return this.throwIfDisposed(),Xy(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.
 * =============================================================================
 */
cp().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),Zy(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.
 * =============================================================================
 */
cp().prototype.mod=function(e){return this.throwIfDisposed(),Ky(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.
 * =============================================================================
 */
cp().prototype.mul=function(e){return this.throwIfDisposed(),hm(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.
 * =============================================================================
 */
cp().prototype.neg=function(){return this.throwIfDisposed(),_y(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.
 * =============================================================================
 */
cp().prototype.norm=function(e,t,n){return this.throwIfDisposed(),ry(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.
 * =============================================================================
 */
cp().prototype.notEqual=function(e){return this.throwIfDisposed(),tb(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.
 * =============================================================================
 */
cp().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),nb(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.
 * =============================================================================
 */
cp().prototype.onesLike=function(){return this.throwIfDisposed(),rb(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.
 * =============================================================================
 */
cp().prototype.pad=function(e,t){return this.throwIfDisposed(),sb(this,e,t)},cp().prototype.pool=function(e,t,n,r,a,s){return this.throwIfDisposed(),db(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.
 * =============================================================================
 */
cp().prototype.pow=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.
 * =============================================================================
 */
cp().prototype.prelu=function(e){return this.throwIfDisposed(),hb(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.
 * =============================================================================
 */
cp().prototype.prod=function(e,t){return this.throwIfDisposed(),pb(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.
 * =============================================================================
 */
cp().prototype.reciprocal=function(){return this.throwIfDisposed(),nv(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.
 * =============================================================================
 */
cp().prototype.relu=function(){return this.throwIfDisposed(),rv(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.
 * =============================================================================
 */
cp().prototype.relu6=function(){return this.throwIfDisposed(),av(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.
 * =============================================================================
 */
cp().prototype.reshapeAs=function(e){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.reshape=function(e){return this.throwIfDisposed(),zm(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.
 * =============================================================================
 */
cp().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),jA(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.
 * =============================================================================
 */
cp().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),qA(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.
 * =============================================================================
 */
cp().prototype.reverse=function(e){return this.throwIfDisposed(),sv(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.
 * =============================================================================
 */
cp().prototype.rfft=function(){return this.throwIfDisposed(),Wv(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.
 * =============================================================================
 */
cp().prototype.round=function(){return this.throwIfDisposed(),cv(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.
 * =============================================================================
 */
cp().prototype.rsqrt=function(){return this.throwIfDisposed(),dv(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.
 * =============================================================================
 */
cp().prototype.selu=function(){return this.throwIfDisposed(),hv(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.
 * =============================================================================
 */
cp().prototype.separableConv2d=function(e,t,n,r,a,s){return this.throwIfDisposed(),pv(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.
 * =============================================================================
 */
cp().prototype.sigmoid=function(){return this.throwIfDisposed(),jm(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.
 * =============================================================================
 */
cp().prototype.sign=function(){return this.throwIfDisposed(),mv(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.
 * =============================================================================
 */
cp().prototype.sin=function(){return this.throwIfDisposed(),gv(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.
 * =============================================================================
 */
cp().prototype.sinh=function(){return this.throwIfDisposed(),yv(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.
 * =============================================================================
 */
cp().prototype.slice=function(e,t){return this.throwIfDisposed(),qm(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.
 * =============================================================================
 */
cp().prototype.softmax=function(e){return this.throwIfDisposed(),kv(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.
 * =============================================================================
 */
cp().prototype.softplus=function(){return this.throwIfDisposed(),Ty(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.
 * =============================================================================
 */
cp().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),cb(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.
 * =============================================================================
 */
cp().prototype.split=function(e,t){return this.throwIfDisposed(),Iv(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.
 * =============================================================================
 */
cp().prototype.sqrt=function(){return this.throwIfDisposed(),Yg(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.
 * =============================================================================
 */
cp().prototype.square=function(){return this.throwIfDisposed(),ey(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.
 * =============================================================================
 */
cp().prototype.squaredDifference=function(e){return this.throwIfDisposed(),_v(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.
 * =============================================================================
 */
cp().prototype.squeeze=function(e){return this.throwIfDisposed(),Tv(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.
 * =============================================================================
 */
cp().prototype.stack=function(e,t){this.throwIfDisposed();const n=e instanceof up?[this,e]:[this,...e];return Nv(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.
 * =============================================================================
 */
cp().prototype.step=function(e){return this.throwIfDisposed(),Ev(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.
 * =============================================================================
 */
cp().prototype.stridedSlice=function(e,t,n,r,a,s,i,o){return this.throwIfDisposed(),Rv(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.
 * =============================================================================
 */
cp().prototype.sub=function(e){return this.throwIfDisposed(),Ey(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.
 * =============================================================================
 */
cp().prototype.sum=function(e,t){return this.throwIfDisposed(),ty(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.
 * =============================================================================
 */
cp().prototype.tan=function(){return this.throwIfDisposed(),$v(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.
 * =============================================================================
 */
cp().prototype.tanh=function(){return this.throwIfDisposed(),Qm(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.
 * =============================================================================
 */
cp().prototype.tile=function(e){return this.throwIfDisposed(),ly(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.
 * =============================================================================
 */
cp().prototype.toBool=function(){return this.throwIfDisposed(),im(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.
 * =============================================================================
 */
cp().prototype.toFloat=function(){return this.throwIfDisposed(),im(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.
 * =============================================================================
 */
cp().prototype.toInt=function(){return this.throwIfDisposed(),im(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.
 * =============================================================================
 */
cp().prototype.topk=function(e,t){return this.throwIfDisposed(),Hv(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.
 * =============================================================================
 */
cp().prototype.transpose=function(e){return this.throwIfDisposed(),tA(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.
 * =============================================================================
 */
cp().prototype.unique=function(e){return this.throwIfDisposed(),qv(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.
 * =============================================================================
 */
cp().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),Qv(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.
 * =============================================================================
 */
cp().prototype.unstack=function(e){return this.throwIfDisposed(),Xv(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.
 * =============================================================================
 */
cp().prototype.where=function(e,t){return this.throwIfDisposed(),$g(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.
 * =============================================================================
 */
cp().prototype.zerosLike=function(){return this.throwIfDisposed(),Og(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 ZS extends Error{constructor(e){super(e),Object.setPrototypeOf(this,ZS.prototype)}}class KS extends Error{constructor(e){super(e),Object.setPrototypeOf(this,KS.prototype)}}class JS extends Error{constructor(e){super(e),Object.setPrototypeOf(this,JS.prototype)}}class YS extends Error{constructor(e){super(e),Object.setPrototypeOf(this,YS.prototype)}}class eC extends Error{constructor(e){super(e),Object.setPrototypeOf(this,eC.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 tC{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 nC(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 rC(e,t){if(!e)throw new eC(t)}function aC(e,t){let n=0;for(const r of e)r===t&&n++;return n}function sC(e){return 1===e.length?e[0]:e}function iC(e){return Array.isArray(e)?e:[e]}function oC(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 lC(e){return e.length<=1||-1===e.indexOf("_")?e:e.replace(/[_]+(\w|$)/g,((e,t)=>t.toUpperCase()))}let uC={};function cC(e){if(null==e)return null;const t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function dC(e){if(null!=e&&"object"==typeof e)if(Array.isArray(e))e.forEach((e=>dC(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?dC(t):e[n]=t.value)}}}function hC(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 uC)s=uC[a];else if(s=t[a],null==s)throw new JS(`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 JS(`${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 uC?[o,l]=uC.className:i in t&&([o,l]=t[i]),null==o)throw new JS(`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(uC))e[n]=uC[n];for(const a of Object.keys(n))e[a]=n[a];s.config.customObjects=e;const t=Object.assign({},uC);for(const a of Object.keys(n))uC[a]=n[a];dC(s.config);const r=l(o,s.config,n,a);return uC=Object.assign({},t),r}{const e=Object.assign({},uC);for(const r of Object.keys(n))uC[r]=n[r];const t=new o(s.config);return uC=Object.assign({},e),t}}}function pC(e,t){return-1*function(e,t){return e<t?-1:e>t?1:0}(e,t)}function fC(e){if(null==e)return e;const t=[];for(const n of e)-1===t.indexOf(n)&&t.push(n);return t}function mC(e){if(null==e)throw new JS(`Invalid value in obj: ${JSON.stringify(e)}`);for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}function gC(e,t,n){if(null!=n&&e.indexOf(n)<0)throw new JS(`${n} is not a valid ${t}.  Valid values are ${e} or null/undefined.`)}function yC(e,t,n=0,r=1/0){return rC(n>=0),rC(r>=n),Array.isArray(e)&&e.length>=n&&e.length<=r&&e.every((e=>typeof e===t))}function bC(e,t){Array.isArray(e)?(Go(e.length>0,(()=>`${t} is unexpectedly an empty array.`)),e.forEach(((e,n)=>bC(e,`element ${n+1} of ${t}`)))):Go(Number.isInteger(e)&&e>0,(()=>`Expected ${t} to be a positive integer, but got ${vC(e)}.`))}function vC(e){return null===e?"null":Array.isArray(e)?"["+e.map((e=>vC(e))).join(",")+"]":"string"==typeof e?`"${e}"`:`${e}`}function AC(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 xC=0;function kC(){return xC++}const wC={};function SC(e=""){return e in wC||(wC[e]=0),wC[e]+=1,e+wC[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 CC=["channelsFirst","channelsLast"],IC=["nearest","bilinear"],WC=["valid","same","causal"],_C=["max","avg"],TC=["sum","mul","concat","ave"],NC=new Map;function EC(e){gC(CC,"DataFormat",e)}function RC(e){gC(WC,"PaddingMode",e)}function $C(e){gC(_C,"PoolMode",e)}const OC=[],FC="/";function DC(e,t){OC.push(e);try{const e=t();return OC.pop(),e}catch(_X){throw OC.pop(),_X}}function MC(e){if(!PC(e))throw new Error("Not a valid tensor name: '"+e+"'");return(0===OC.length?"":OC.join(FC)+FC)+e}function LC(e){if(!PC(e))throw new Error("Not a valid tensor name: '"+e+"'");NC.has(e)||NC.set(e,0);const t=NC.get(e);if(NC.set(e,NC.get(e)+1),t>0){const n=`${e}_${t}`;return NC.set(n,1),n}return e}const BC=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function PC(e){return!!e.match(BC)}
/**
 * @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 zC(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 GC(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 VC(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 UC(e,t){if(t<e)throw new JS(`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 HC;function jC(){return null==HC&&(HC=uf().epsilon()),HC}
/**
 * @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 qC(e,t){return im(e,t)}function QC(e,t=-1){const n=e.shape.slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),zm(e,n)}function XC(e,t,n){return rf((()=>{switch(e.rank){case 1:return bv(e,t,n);case 2:return vv(e,[t,0],[n,e.shape[1]]);case 3:return Av(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return xv(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return qm(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return qm(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 JS(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}))}function ZC(e,t,n){return rf((()=>{switch(e.rank){case 1:return bv(e,t,n);case 2:return vv(e,[0,t],[e.shape[0],n]);case 3:return Av(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return xv(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new JS(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}}))}function KC(e,t,n,r){return rf((()=>{switch(e.rank){case 1:return bv(e,t,n);case 2:switch(r){case 1:return XC(e,t,n);case 2:return ZC(e,t,n);default:throw new JS(`The axis is not within the rank of the tensor ${r}`)}case 3:switch(r){case 1:return XC(e,t,n);case 2:return Av(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return ZC(e,t,n);default:throw new JS(`The axis is not within the rank of the tensor ${r}`)}case 4:switch(r){case 1:return XC(e,t,n);case 2:return xv(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return xv(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return ZC(e,t,n);default:throw new JS(`The axis is not within the rank of the tensor ${r}`)}default:throw new JS(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`)}}))}function JC(e,t=-1){let n;return t<0&&(n=e[0].rank,t=0!==n?n:0),t===e[0].rank&&(t=-1),Um(e,t)}function YC(e,t){switch(e.rank){case 1:return lg([e,t]);case 2:return ug([e,t],0);case 3:return cg([e,t],0);case 4:return dg([e,t],0);default:throw new JS(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`)}}function eI(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new JS(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);return ly(e,t)}function tI(e,t=0,n=1,r,a){return Zb(e,t,n,r,a)}function nI(e,t,n,r){if(e.rank<2||t.rank<2)throw new YS(`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 YS(`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 vA({a:e,b:t,transposeA:!1,transposeB:!1,bias:r?sI(e.rank,r,"channelsLast"):null,activation:n})}{const a=e.shape.slice(),s=a.pop();e=zm(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=zm(tA(t,c),[l,-1]);const d=[...a,...u];return zm(vA({a:e,b:t,transposeA:!1,transposeB:!1,bias:r?sI(e.rank,r,"channelsLast"):null,activation:n}),d)}}function rI(e,t,n){return rf((()=>(t=Array.isArray(t)?Ov(t,"int32"):im(t,"int32"),dy(e,t,n))))}function aI(e){return hm(e,e)}function sI(e,t,n){const r=t.shape;if(1!==t.rank&&t.rank!==e)throw new JS(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);if(5===e){if("channelsFirst"===n)return 1===r.length?zm(t,[1,r[0],1,1,1]):zm(t,[1,r[3],r[0],r[1],r[2]]);if("channelsLast"===n)return 1===r.length?zm(t,[1,1,1,1,r[0]]):zm(t,[1].concat(r))}else if(4===e){if("channelsFirst"===n)return 1===r.length?zm(t,[1,r[0],1,1]):zm(t,[1,r[2],r[0],r[1]]);if("channelsLast"===n)return 1===r.length?zm(t,[1,1,1,r[0]]):zm(t,[1].concat(r))}else if(3===e){if("channelsFirst"===n)return 1===r.length?zm(t,[1,r[0],1]):zm(t,[1,r[1],r[0]]);if("channelsLast"===n)return 1===r.length?zm(t,[1,1,r[0]]):zm(t,[1].concat(r))}else if(e<3)return t;throw new JS(`Unsupported input rank by biasAdd: ${t.rank}`)}function iI(e,t,n){return rf((()=>(null==n&&(n="channelsLast"),EC(n),um(e,sI(e.rank,t,n)))))}function oI(e,t,n,r){return rf((()=>iA(e,t,n,r)))}function lI(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 uI=["fanIn","fanOut","fanAvg"],cI=["normal","uniform","truncatedNormal"];class dI extends Ax{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}}class hI extends dI{apply(e,t){return jy(e,t)}}hI.className="Zeros",kx(hI);class pI extends dI{apply(e,t){return qy(e,t)}}pI.className="Ones",kx(pI);class fI extends dI{constructor(e){if(super(),"object"!=typeof e)throw new JS(`Expected argument of type ConstantConfig but got ${e}`);if(void 0===e.value)throw new JS(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return rf((()=>hm(Jg(this.value),qy(e,t))))}getConfig(){return{value:this.value}}}fI.className="Constant",kx(fI);class mI extends dI{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 Jb(e,this.minval,this.maxval,t,this.seed)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}}mI.className="RandomUniform",kx(mI);class gI extends dI{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 YS(`randomNormal does not support dType ${t}.`);return tI(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}gI.className="RandomNormal",kx(gI);class yI extends dI{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 YS(`truncatedNormal does not support dType ${t}.`);return jv(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}yI.className="TruncatedNormal",kx(yI);class bI extends dI{constructor(e){super(),this.gain=null!=e.gain?e.gain:1}apply(e,t){return rf((()=>{if(2!==e.length||e[0]!==e[1])throw new JS("Identity matrix initializer can only be used for 2D square matrices.");return hm(this.gain,uy(e[0]))}))}getConfig(){return{gain:this.gain}}}bI.className="Identity",kx(bI);class vI extends dI{constructor(e){if(super(),e.scale<0)throw new JS(`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,gC(uI,"FanMode",t),this.distribution=null==e.distribution?"normal":e.distribution,function(e){gC(cI,"Distribution",e)}(this.distribution),this.seed=e.seed}apply(e,t){const n=function(e,t="channelsLast"){let n,r;if(EC(t),2===e.length)n=e[0],r=e[1];else if(-1!==[3,4,5].indexOf(e.length)){if("channelsFirst"===t){const t=zC(e,2);n=e[1]*t,r=e[0]*t}else if("channelsLast"===t){const t=zC(e,0,e.length-2);n=e[e.length-2]*t,r=e[e.length-1]*t}}else{const t=zC(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 YS(`${this.getClassName()} does not support dType ${t}.`);return jv(e,0,n,t,this.seed)}{const n=Math.sqrt(3*s);return Jb(e,-n,n,t,this.seed)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}}vI.className="VarianceScaling",kx(vI);class AI extends vI{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return vI.className}}AI.className="GlorotUniform",kx(AI);class xI extends vI{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return vI.className}}xI.className="GlorotNormal",kx(xI);class kI extends vI{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return vI.className}}kI.className="HeNormal",kx(kI);class wI extends vI{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return vI.className}}wI.className="HeUniform",kx(wI);class SI extends vI{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}getClassName(){return vI.className}}SI.className="LeCunNormal",kx(SI);class CI extends vI{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}getClassName(){return vI.className}}CI.className="LeCunUniform",kx(CI);class II extends dI{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 rf((()=>{if(e.length<2)throw new YS("Shape must be at least 2D.");if("int32"!==t&&"float32"!==t&&void 0!==t)throw new TypeError(`Unsupported data type ${t}.`);const n=Ho(e.slice(0,-1)),r=e[e.length-1];this.ELEMENTS_WARN_SLOW;const a=tI([Math.max(r,n),Math.min(r,n)],0,1,t,this.seed),s=fx.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=hm(i,o.sign()),n<r&&(i=i.transpose()),hm(Jg(this.gain),i.reshape(e))}))}getConfig(){return{gain:this.gain,seed:this.seed}}}II.className="Orthogonal",kx(II);const WI={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 _I(e,t={}){return hC(e,xx.getMap().classNameMap,t,"initializer")}function TI(e){return cC(e)}function NI(e){if("string"==typeof e){const t=e in WI?WI[e]:e;if("GlorotNormal"===t)return new xI;if("GlorotUniform"===t)return new AI;if("HeNormal"===t)return new kI;if("HeUniform"===t)return new wI;if("LeCunNormal"===t)return new SI;if("LeCunUniform"===t)return new CI;{const e={};return e.className=t,e.config={},_I(e)}}return e instanceof dI?e:_I(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 EI(e){return Array.isArray(e)&&Array.isArray(e[0])}function RI(e){return 0===e.length?[]:Array.isArray(e[0])?e:[e]}function $I(e){let t;if(Array.isArray(e)){if(1!==e.length)throw new JS(`Expected Tensor length to be 1; got ${e.length}`);t=e[0]}else t=e;return t}function OI(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(1===e.length)return e[0];throw new JS(`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 FI(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 DI="Variable";class MI{constructor(e,t="float32",n=DI,r=!0,a=null){this.dtype=null==t?"float32":t,this.shape=e.shape,this.id=kC(),n=null==n?DI:n,this.originalName=MC(n),this.name=LC(this.originalName),this.trainable_=r,this.constraint=a,this.val=Kv(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 LI(e){return e.map((e=>e.read()))}function BI(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 PI{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 zI{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=kC(),null!=s&&(this.originalName=MC(s),this.name=LC(this.originalName)),this.rank=t.length}}let GI=0;class VI{constructor(e,t){this.callArgs=t,this.id=GI++,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 UI=0;class HI extends Ax{constructor(e={}){super(),this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=UI++,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=oC(e)+"_"+SC(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 KS(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new JS(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return sC(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return sC(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new ZS(`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 ZS(`Layer ${this.name} is not connected, no input to return.`);return sC(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(0===this.inboundNodes.length)throw new ZS(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new ZS(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return sC(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=iC(e);if(null==this.inputSpec||0===this.inputSpec.length)return;const n=iC(this.inputSpec);if(t.length!==n.length)throw new JS(`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 JS(`Input ${r} is incompatible with layer ${this.name}: expected ndim=${a.ndim}, found ndim=${s}`);if(null!=a.maxNDim&&s>a.maxNDim)throw new JS(`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 JS(`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 JS(`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 JS(`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 JS(`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=iC(e),r=function(e){let t=!0;for(const n of iC(e))if(!(n instanceof zI)){t=!1;break}return t}(e),a=function(e){let t=!0;for(const n of iC(e))if(n instanceof zI){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 JS("Arguments to apply() must be all SymbolicTensors or all Tensors");return DC(this.name,(()=>{if(!this.built){this.assertInputCompatibility(e);const t=[];for(const n of iC(e))t.push(n.shape);this.build(sC(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=iC(r),s=[];for(let e of a)-1!==n.indexOf(e)&&(e=e.clone()),s.push(e);if(r=sC(s),null!=this.activityRegularizer)throw new YS("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return r}{const n=function(e){e=iC(e);const t=[];for(const n of e)t.push(n.shape);return sC(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 zI(s,n,this,iC(e),t,this.name,r))):new zI(s,r,this,iC(e),t,this.name),this.addInboundNode(e,a,null,null,n,r,t),this._refCount++,null!=this.activityRegularizer)throw new YS("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 ZS(`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 ZS(`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 KS(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return FI(this.weights)}build(e){this.built=!0}getWeights(e=!1){return LI(e?this.trainableWeights:this.weights)}setWeights(e){rf((()=>{const t=this.weights;if(t.length!==e.length)throw new JS(`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=LI(t);for(let a=0;a<r.length;++a){const s=r[a],i=t[a],o=e[a];if(!qo(s.shape,o.shape))throw new JS(`Layer weight shape ${s.shape} not compatible with provided weight shape ${o.shape}`);n.push([i,o])}BI(n)}))}addWeight(e,t,n,r,a,s,i,o){if(-1!==this._addedWeightNames.indexOf(e))throw new JS(`Duplicate weight name ${e} for layer ${this.name}`);this._addedWeightNames.push(e),null==n&&(n="float32"),this.fastWeightInitDuringBuild&&(r=null!=o?o():NI("zeros"));const l=r.apply(t,n),u=new MI(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=iC(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=iC(t),s=iC(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=iC(e);t=iC(t),n=iC(n),r=iC(r),a=RI(a),s=RI(s);const l=[],u=[],c=[];for(const d of o)l.push(d.sourceLayer),u.push(d.nodeIndex),c.push(d.tensorIndex);new VI({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 jI(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=jI(e.inputTensors[n],e.inboundLayers[n],e.nodeIndices[n]);for(const e of r)-1===t.indexOf(e)&&t.push(e)}return t}}}class qI extends HI{constructor(e){if(super({dtype:e.dtype,name:null!=e.name?e.name:SC("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 JS("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 JS("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");t=[e.batchSize].concat(e.inputShape)}else if(null!=e.batchSize)throw new JS("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 zI(this.dtype,this.batchInputShape,this,[],{},this.name);r.nodeIndex=0,r.tensorIndex=0,new VI({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[r],outputTensors:[r],inputMasks:[null],outputMasks:[null],inputShapes:[t],outputShapes:[t]})}apply(e,t){throw new JS(`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}}}qI.className="InputLayer",kx(qI);class QI{constructor(e){if(this.id2Value={},this.id2Mask={},this.name2Id={},e instanceof QI)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 JS(`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 im(t,e.dtype)}catch(cJ){throw new JS(`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 zI){if(null==this.id2Value[e.id])throw new JS(`Nonexistent key: ${e.name}`);return this.id2Value[e.id]}{const t=this.name2Id[e];if(null==t)throw new JS(`Feed dict has no SymbolicTensor name: ${e}`);return this.id2Value[t]}}getMask(e){if(e instanceof zI){if(null==this.id2Value[e.id])throw new JS(`Nonexistent key: ${e.name}`);return this.id2Mask[e.id]}{const t=this.name2Id[e];if(null==t)throw new JS(`Feed dict has no SymbolicTensor name: ${e}`);return this.id2Mask[t]}}disposeMasks(){null!=this.id2Mask&&af(this.id2Mask)}}const XI=new tC,ZI=new tC;function KI(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=XI.get(c);if(null==h){const e=function(e,t){Go(null!=e&&e.length>0,(()=>"Expected at least one fetch, got none"));let n=[],r={};if(1===e.length){const a=YI(e[0],t);n=a.sorted,r=a.recipientMap}else{const a=new Set;for(const s of e){const{sorted:e,recipientMap:i}=YI(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:JI(r)}}(i,t);h=e.sorted,d=e.recipientCounts,XI.put(c,h),ZI.put(c,d)}d={},a||Object.assign(d,ZI.get(c));const p=new QI(t);for(let f=0;f<h.length;++f){if(null!=r){const e=nf().numTensors;e>r.maxNumTensors&&(r.maxNumTensors=e),e<r.minNumTensors&&(r.minNumTensors=e)}const e=h[f],s=e.sourceLayer;if(s instanceof qI)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=iC(s.apply(i,n));let y=null;s.supportsMasking&&(y=s.computeMask(i,u));const b=eW(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||af(c)}return p.disposeMasks(),s?l:l[0]}function JI(e){const t={};for(const n in e)t[n]=e[n].size;return t}function YI(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 eW(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 tW(e,t){return rf((()=>Yg(ty(hm(e,e),t,!0))))}_l().registerFlag("TOPOLOGICAL_SORT_CACHE_MAX_ENTRIES",(()=>100),(function(e){null!=XI&&XI.setMaxEntries(e),null!=ZI&&ZI.setMaxEntries(e)}));class nW extends Ax{getConfig(){return{}}}class rW extends nW{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 rf((()=>{const t=tW(e,this.axis),n=og(t,0,this.maxValue);return hm(e,dm(n,um(jC(),t)))}))}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}}rW.className="MaxNorm",kx(rW);class aW extends nW{constructor(e){super(),this.defaultAxis=0,this.axis=null!=e.axis?e.axis:this.defaultAxis}apply(e){return rf((()=>dm(e,um(jC(),tW(e,this.axis)))))}getConfig(){return{axis:this.axis}}}aW.className="UnitNorm",kx(aW);class sW extends nW{apply(e){return rv(e)}}sW.className="NonNeg",kx(sW);class iW extends nW{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 rf((()=>{const t=tW(e,this.axis),n=um(hm(this.rate,og(t,this.minValue,this.maxValue)),hm(1-this.rate,t));return hm(e,dm(n,um(jC(),t)))}))}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}}iW.className="MinMaxNorm",kx(iW);const oW={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function lW(e){return cC(e)}function uW(e,t={}){return hC(e,xx.getMap().classNameMap,t,"constraint")}function cW(e){if(null==e)return null;if("string"==typeof e){return uW({className:e in oW?oW[e]:e,config:{}})}return e instanceof nW?e:uW(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 dW(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];af(r)}}function hW(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 pW,fW;(fW=pW||(pW={}))[fW.SILENT=0]="SILENT",fW[fW.VERBOSE=1]="VERBOSE";class mW{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 gW{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 yW extends mW{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=rf((()=>um(this.totals[r],hm(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:rf((()=>{const e=hm(dm(1,this.seen),this.totals[n]);t[n]=e,this.totals[n].dispose(),sf(t[n])})))}}class bW extends mW{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 vW extends mW{constructor(e,t){if(super(),this.currentEpoch=0,this.nowFunc=e.nowFunc,this.nextFrameFunc=e.nextFrameFunc||Ik,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");cl(this.yieldEvery)&&(this.maybeWait=function(e,t,n){let r,a=null!=n?n():Vh();return(...s)=>{const i=null!=n?n():Vh();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 dW(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 dW(t),await this.epochBegin(e,t))}async onEpochEnd(e,t){const n=[];null!=this.epochEnd&&(await dW(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 dW(t),await this.batchBegin(e,t))}async onBatchEnd(e,t){const n=[];null!=this.batchEnd&&(await dW(t),n.push(this.batchEnd(e,t))),"batch"===this.yieldEvery?n.push(this.nextFrameFunc()):cl(this.yieldEvery)&&n.push(this.maybeWait(this.currentEpoch,e,t)),await Promise.all(n)}async onTrainBegin(e){null!=this.trainBegin&&(await dW(e),await this.trainBegin(e))}async onTrainEnd(e){null!=this.trainEnd&&(await dW(e),await this.trainEnd(e))}}function AW(e,t){if(null==e&&(e={}),e instanceof mW)return[e];if(Array.isArray(e)&&e[0]instanceof mW)return e;return iC(e).map((e=>new vW(e,t)))}class xW{constructor(){}static registerCallbackConstructor(e,t){Go(e>=0&&Number.isInteger(e),(()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`)),xW.checkForDuplicate(t),null==xW.constructors[e]&&(xW.constructors[e]=[]),xW.constructors[e].push(t)}static checkForDuplicate(e){for(const t in xW.constructors){xW.constructors[+t].forEach((t=>{if(t===e)throw new JS("Duplicate callback constructor.")}))}}static clear(){xW.constructors={}}static createCallbacks(e){const t=[];for(const n in xW.constructors){const r=+n;e>=r&&t.push(...xW.constructors[r])}return t.map((e=>new e))}}function kW(e,t,n,r,a,s,i,o,l){const u=new bW,c=[new yW,...xW.createCallbacks(t)];null!=e&&c.push(...e),c.push(u);const d=new gW(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 wW(e,t={},n=!1){return hC(e,xx.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 SW(e,t){return rf((()=>{"float32"!==e.dtype&&(e=im(e,"float32"));const n=ty(aI(e),t,!0),r=ig(n.shape,jC()),a=Yg(Uy(n,r));return dm(e,a)}))}function CW(e,t){return rf((()=>Hy(aI(Ey(t,e)),-1)))}function IW(e,t){return rf((()=>Hy(pm(Ey(t,e)),-1)))}function WW(e,t){return rf((()=>{const n=Ey(e,t),r=og(pm(e),jC(),Number.MAX_VALUE),a=pm(dm(n,r));return hm(100,Hy(a,-1))}))}function _W(e,t,n=!1){return rf((()=>{if(n)t=kv(t);else{const e=ty(t,t.shape.length-1,!0);t=dm(t,e)}return t=og(t,jC(),1-jC()),_y(ty(hm(im(e,"float32"),wy(t)),t.shape.length-1))}))}function TW(e,t,n=!1){return rf((()=>{const r=im(cy(function(e){const t=[zC(e.shape)];return zm(e,t)}(e)),"int32"),a=(t=og(t,jC(),1-jC())).shape;return _W(zm(nb(r,a[a.length-1]),a),t,n)}))}function NW(e,t){return rf((()=>{let n;return n=og(t,jC(),1-jC()),n=wy(dm(n,Ey(1,n))),Hy(function(e,t){if(!qo(e.shape,t.shape))throw new JS(`logits and labels must have the same shape, but got shapes ${JSON.stringify(e.shape)} and ${JSON.stringify(t.shape)}`);return rf((()=>{const n=rv(t),r=_y(pm(t));return um(Ey(n,hm(t,e)),Sy(sy(r)))}))}(e,n),-1)}))}function EW(e,t){return rf((()=>{const n=SW(e,-1),r=SW(t,-1),a=hm(n,r);return _y(ty(a,-1))}))}xW.constructors={};const RW={meanSquaredError:CW,meanAbsoluteError:IW,meanAbsolutePercentageError:WW,meanSquaredLogarithmicError:function(e,t){return rf((()=>{const n=og(t,jC(),Number.MAX_VALUE),r=wy(um(1,n)),a=og(e,jC(),Number.MAX_VALUE),s=wy(um(1,a));return Hy(aI(Ey(r,s)),-1)}))},squaredHinge:function(e,t){return rf((()=>{const n=Uy(0,Ey(1,hm(e,t)));return Hy(aI(n),-1)}))},hinge:function(e,t){return rf((()=>{const n=Uy(0,Ey(1,hm(e,t)));return Hy(n,-1)}))},categoricalHinge:function(e,t){return rf((()=>{const n=ty(hm(e,t),-1),r=Xg(hm(Ey(1,e),t),-1);return Uy(0,um(1,Ey(r,n)))}))},logcosh:function(e,t){return rf((()=>{const n=Math.log(2),r=Ey(t,e),a=Ey(um(r,Ty(hm(-2,r))),n);return Hy(a,-1)}))},categoricalCrossentropy:_W,sparseCategoricalCrossentropy:TW,binaryCrossentropy:NW,kullbackLeiblerDivergence:function(e,t){return rf((()=>{const n=og(e,jC(),1),r=og(t,jC(),1);return ty(hm(e,wy(dm(n,r))),-1)}))},poisson:function(e,t){return rf((()=>{const n=wy(um(jC(),t));return Hy(Ey(t,hm(e,n)),-1)}))},cosineProximity:EW};function $W(e){if("string"==typeof e){if(e in RW)return RW[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 JS(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 OW(e,t){return rf((()=>{const n=hm(.5,rb(t)),r=qC(hy(t,n),e.dtype);return Hy(Rg(e,r),-1)}))}function FW(e,t){return rf((()=>qC(Rg(vm(e,-1),vm(t,-1)),"float32")))}function DW(e,t){return NW(e,t)}function MW(e,t){return e.rank===t.rank&&(e=Tv(e,[e.rank-1])),(t=vm(t,-1)).dtype!==e.dtype&&(t=im(t,e.dtype)),im(Rg(e,t),"float32")}const LW=_W,BW=TW,PW={binaryAccuracy:OW,categoricalAccuracy:FW,precision:function(e,t){return rf((()=>{const n=function(e,t){return rf((()=>im(ty(Oy(Rg(e,1),Rg(t,1))),"float32")))}(e,t),r=function(e,t){return rf((()=>im(ty(Oy(Rg(e,0),Rg(t,1))),"float32")))}(e,t),a=um(n,r);return im($g(hy(a,0),dm(n,a),0),"float32")}))},categoricalCrossentropy:LW,sparseCategoricalCrossentropy:BW,mse:CW,MSE:CW,mae:IW,MAE:IW,mape:WW,MAPE:WW,cosine:EW};function zW(e){if("string"==typeof e&&e in PW)return PW[e];if("string"!=typeof e&&null!=e)return e;throw new JS(`Unknown metric ${e}`)}function GW(e){if(rC(null!==e,`Unknown LossOrMetricFn ${e}`),"string"==typeof e)return e;{let t;for(const n of Object.keys(RW))if(RW[n]===e){t=n;break}if(void 0!==t)return t;for(const n of Object.keys(PW))if(PW[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 VW(e,t,n=!1){if(null==e||"object"!=typeof e||Object.getPrototypeOf(e)!==Object.prototype||!UW(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){JSON.stringify(e).length}}function UW(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(!UW(e[n]))return!1}return!0}if(Array.isArray(e)){for(const t of e)if(!UW(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 HW(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)),jW(s,n,r),r("=".repeat(t));const o=e.layers;for(let c=0;c<o.length;++c)a?qW(o[c],n,r):QW(o[c],n,i,r),r((c===o.length-1?"=":"_").repeat(t));e.checkTrainableWeightsConsistency();const l=function(e){let t;t=null!=e.collectedTrainableWeights?FI(e.collectedTrainableWeights):FI(e.trainableWeights);return t}(e),u=FI(e.nonTrainableWeights);r(`Total params: ${l+u}`),r(`Trainable params: ${l}`),r(`Non-trainable params: ${u}`),r("_".repeat(t))}function jW(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 qW(e,t,n){let r,a;try{a=e.inboundNodes.map((e=>JSON.stringify(e.inputShapes))).join(",")}catch(cJ){a="multiple"}try{r=JSON.stringify(e.outputShape)}catch(cJ){r="multiple"}jW([`${e.name} (${e.getClassName()})`,a,r,e.countParams().toString()],t,n)}function QW(e,t,n,r){let a,s;try{s=e.inboundNodes.map((e=>JSON.stringify(e.inputShapes))).join(",")}catch(cJ){s="multiple"}try{a=JSON.stringify(e.outputShape)}catch(cJ){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];jW([`${o} (${l})`,s,a,e.countParams().toString(),u],t,r);for(let c=1;c<i.length;++c)jW(["","","","",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 XW(e,t,n){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof n}function ZW(e,t){if(null===e)return null;if("string"==typeof e)return lC(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];XW(t,a,r)?n.push(r):n.push(ZW(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=lC(n);t[e]=ZW(r,e)}}return t}}function KW(e,t){if(null==e)return null;if("string"==typeof e)return oC(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];XW(t,a,r)?n.push(r):n.push(KW(r,t))}return n}{const t={};for(const n of Object.keys(e)){const r=e[n],a=oC(n);t[a]="name"!==n&&"className"!==n||"string"!=typeof r?KW(r,n):r}return t}}
/** @license See the LICENSE file. */const JW="4.15.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 YW extends HI{constructor(e){if(super({}),this.containerNodes=new Set,this.name=e.name,null==this.name){const e=this.getClassName().toLowerCase();this.name=SC(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],fC(this.inputs).length!==this.inputs.length)throw new JS(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map((e=>e.name))}`);fC(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;rC(0===t,"input layer has >1 nodes"),rC(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 qI))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 KS(`The tensor ${e.name} at layer "${r.name}" is part of a cycle.`);if(-1!==t.indexOf(u))return;this.containerNodes.add(YW.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(pC);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 YW&&this.internalContainerRefs.push(t),this.layers.push(t)}this.layersByDepth=h,p=Object.keys(d).map((e=>parseInt(e,10))).sort(pC);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 KS(`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 KS(`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 VI({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 JS("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 JS(`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 JS(`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 JS(`${e.length} of ${r} weights are not set: ${e}`)}BI(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 ${JW}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){const n=KW(this.updatedConfig());return t?JSON.stringify(n):n}call(e,t){return rf((()=>{e=iC(e);const n=new QI;for(let t=0;t<this.inputs.length;++t)n.add(this.inputs[t],e[t]);return KI(this.outputs,n,t)}))}computeMask(e,t){return rf((()=>{let n;return e=iC(e),n=null==t?nC(null,e.length):iC(t),this.runInternalGraph(e,n)[1]}))}computeOutputShape(e){const t=RI(e);if(t.length!==this.inputLayers.length)throw new JS(`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(pC);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=RI(e.computeOutputShape(sC(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];rC(e in n),a.push(n[e])}return sC(a)}runInternalGraph(e,t){null==t&&(t=nC(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(pC);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=iC(e.call(t,u)),l=iC(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=iC(e.call(r,u)),l=iC(e.computeMask(r,i));if(e.activityRegularizer)throw new YS("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){rC(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 YW?1:0;for(let e=0;e<r.inboundNodes.length;e++){const a=YW.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 JS("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 JS(`No such layer: ${e}`)}findLayer(e){if(this.layers.length<=e)throw new JS(`Was asked to retrieve layer at index ${e}, but model only has ${this.layers.length} layer(s).`);return this.layers[e]}calculateLosses(){return rf((()=>{const e=[];for(const t of this.layers)for(let n=0;n<t.inboundNodes.length;++n){const r=YW.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=YW.nodeKey(s,n);let i={};if(this.containerNodes.has(r)){if(e.callArgs)try{JSON.stringify(e.callArgs),i=e.callArgs}catch(cJ){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[YW.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=YW.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=YW.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(sC(n),r)}function l(e){const n=e.name,s=wW(e,null!=t.customObjects?t.customObjects:{});s.setFastWeightInitDuringBuild(r),a[n]=s;e.inboundNodes.forEach((e=>{if(!(e instanceof Array))throw new JS(`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(;!mC(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];rC(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];rC(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 JS("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(){rf((()=>{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 e_(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 t_(e,t,n,r){if(null!=t||null!=r)throw new Error("Support sampleWeight is not implemented yet");if(null!=n){const t=rf((()=>{if(1===e.shape.length)return om(e);if(2===e.shape.length){if(e.shape[1]>1){return vm(e,1)}if(1===e.shape[1])return zm(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());af(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])})),Ov(a,"float32")}return null}function n_(e,t){return hm(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 r_(e,t){let n,r;const a=t;n=a.xs,r=a.ys,Go(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=a_("input",e.inputNames,n),i=a_("output",e.outputNames,r),o=s[0].shape[0];Go(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)})`)),Go(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++)Go(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++)Go(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 a_(e,t,n){if(n instanceof up)return[n];if(Array.isArray(n))return Go(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 JS(`The feature data generated by the dataset lacks the required ${e} key '${a}'.`);r.push(n[a])}return r}}async function s_(e,t,n){const r=null!=n.batchesPerEpoch;if(Go(null!=e.optimizer,(()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig).")),Go(null!=n,(()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call.")),Go(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}`)),Go(!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}`)),Go(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(i_(n.validationData))Go(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 YS("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=AW(n.callbacks,n.yieldEvery),d=null==n.verbose?1:n.verbose,{callbackList:h,history:p}=kW(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}=r_(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=e_(n.classWeight,e.outputNames);for(let e=0;e<t.length;++e)i.push(await t_(a[e],null,t[e]))}const u=r.concat(a).concat(i),p=o(u);af(u);for(let e=0;e<l.length;++e){const t=l[e],n=p[e];s[t]=n,sf(n)}await h.onBatchEnd(d,s),hW(s),d++,c++}if(r?c>=n.batchesPerEpoch:t.done){if(a){let t;t=i_(n.validationData)?iC(await e.evaluateDataset(n.validationData,{batches:n.validationBatches})):iC(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 i_(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 o_(e){Go(e>0&&Number.isInteger(e),(()=>`batchSize is required to be a positive integer, but got ${e}`))}function l_(e,t,n){return null==e?[null]:Array.isArray(e)?e.map((e=>XC(e,t,n-t))):XC(e,t,n-t)}function u_(e,t){return rf((()=>null==e?null:Array.isArray(e)?e.map((e=>u_(e,t))):rI(e,"int32"===t.dtype?t:im(t,"int32"))))}function c_(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 d_(e){const t=[];e instanceof up&&(e=[e]);for(let n=0;n<e.length;++n){const r=e[n];if(1===r.rank)t.push(QC(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 h_(e,t){if(null==e)return;const n=[];if(t instanceof up)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 up)-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 p_(e){return Array.isArray(e)}function f_(e){return!function(e){return e instanceof up}(e)&&!p_(e)}function m_(e,t,n,r=!0,a=""){if(null==t||0===t.length){if(null!=e){let t=!1;if(p_(e)&&e.length>0)t=!0;else if(f_(e)){for(const n in e)if(e.hasOwnProperty(n)){t=!0;break}}else t=!0;if(t)throw new JS(`Error when checking model ${a} expected no data, but got ${e}`)}return[]}if(null==e)return t.map((e=>null));let s;if(f_(e)){s=[];for(const n of t){if(null==e[n])throw new JS(`No data provided for "${n}". Need data for each key in: ${t}`);s.push(e[n])}}else if(p_(e)){if(e.length!==t.length)throw new JS(`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 JS(`The model ${a} expects ${t.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${e.shape}`);s=[e]}if(s=d_(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 JS(`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 JS(`${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 g_(e,t,n,r=!0,a=""){let s;if(Array.isArray(e)){if(e.length!==t.length)throw new JS(`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 JS(`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 JS(`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 JS(`Error when checking ${a}: expected ${t[i]} to have shape ${JSON.stringify(n[i])} but got array with shape ${JSON.stringify(e.shape)}.`)}}}class y_ extends YW{constructor(e){super(e),this.isTraining=!1}summary(e,t,n=console.log){if(!this.built)throw new JS("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).");HW(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:()=>Sk.adagrad(.01),Adadelta:()=>Sk.adadelta(1,.95,jC()),Adam:()=>Sk.adam(.001,.9,.999,jC()),Adamax:()=>Sk.adamax(.002,.9,.999,jC(),0),RMSProp:()=>Sk.rmsprop(.001,.9,0,jC()),SGD:()=>Sk.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 JS(`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 Sx))throw new JS("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 JS(`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=>$W(e)))}else{const n=$W(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 JS(`Unknown entry in loss dictionary: "${t}". Only expected the following keys: ${this.outputNames}`);for(const n of this.outputNames)e.loss[n],t.push($W(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=[],DC("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])};DC("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]===NW?-1!==["accuracy","acc"].indexOf(i)?r=OW:-1!==["crossentropy","ce"].indexOf(i)&&(r=DW):this.lossFunctions[e]===TW?-1!==["accuracy","acc"].indexOf(i)?r=MW:-1!==["crossentropy","ce"].indexOf(i)&&(r=BW):-1!==["accuracy","acc"].indexOf(i)?r=FW:-1!==["crossentropy","ce"].indexOf(i)&&(r=LW),-1!==["accuracy","acc"].indexOf(i)?a="acc":-1!==["crossentropy","ce"].indexOf(i)&&(a="ce"),s=r,n=""+a}else{const e=zW(i);s=e,n=""+GW(i)}let t;DC(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;o_(r);const a=this.standardizeUserDataXY(e,t,!0,r);try{const e=a[0].concat(a[1]);this.makeTestFunction();const t=this.testFunction;return sC(this.testLoop(t,e,r,n.verbose,n.steps))}finally{h_(a[0],e),h_(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 YS("Verbose mode is not implemented yet.");Go(!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=rf((()=>{if(t.value){const{xs:n,ys:r}=r_(e,t.value),i=n.concat(r),u=rf((()=>a(i)));if(af(i),0===l)for(let e=0;e<u.length;++e)s.push(Jg(0));const c=i[0].shape[0];for(let e=0;e<u.length;++e){const t=u[e],n=s[e];s[e]=rf((()=>um(s[e],hm(c,t)))),l>0&&af(n)}af(u),o+=c,++l}return s})),t.done)break}for(let u=0;u<s.length;++u){const e=s[u];s[u]=dm(s[u],o),af(e)}return sC(s)}(this,e,t)}checkNumSamples(e,t,n,r="steps"){let a;if(null!=n){if(a=null,null!=t)throw new JS(`If ${r} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else{if(null==e)throw new JS(`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 JS("`outputs` is an empty Array, which is not allowed.");const n=Array.isArray(t),r=n?t:[t],a=this.retrieveSymbolicTensors(r),s=new QI;if(e instanceof up&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new JS(`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 JS(`No value is provided for the model's input ${o.name}`);s.add(o,t)}const i=KI(a,s);return n?i:i[0]}retrieveSymbolicTensors(e){const t=nC(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 JS(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(n)}`)}return t}predictLoop(e,t=32,n=!1){return rf((()=>{const r=this.checkNumSamples(e);if(n)throw new YS("Verbose predictLoop() is not implemented yet.");const a=c_(r,t),s=this.outputs.map((e=>[]));for(let t=0;t<a.length;++t){rf((()=>{const n=a[t][0],r=a[t][1],s=l_(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 QI(i);return KI(this.outputs,o)})).forEach(((e,t)=>s[t].push(e)))}return sC(s.map((e=>Um(e,0))))}))}predict(e,t={}){const n=d_(e);g_(n,this.inputNames,this.feedInputShapes,!1);try{const e=null==t.batchSize?32:t.batchSize;return o_(e),this.predictLoop(n,e)}finally{h_(n,e)}}predictOnBatch(e){g_(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 KS("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]===TW?a.push(e.slice(0,e.length-1).concat([1])):a.push(e)}if(function(e,t,n){const r=fC(e.map((e=>e.shape[0])));r.sort();const a=fC(t.map((e=>e.shape[0])));if(a.sort(),r.length>1)throw new JS(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map((e=>e.shape)))}`);if(a.length>1)throw new JS(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(t.map((e=>e.shape)))}`);if(r.length>0&&a.length>0&&!qo(r,a))throw new JS(`Input Tensors should have the same number of samples as target Tensors. Found ${r[0]} input sample(s) and ${a[0]} target sample(s).`)}(e=m_(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=m_(t,this.feedOutputNames,a,!1,"target")),function(e,t,n){const r=[CW,NW,_W];for(let a=0;a<e.length;++a){const s=e[a],i=t[a],o=n[a];if(null!=i){if(i===_W&&1===s.shape[s.shape.length-1])throw new JS(`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 JS(`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 JS(`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=e_(r,this.outputNames);l=[];for(let t=0;t<e.length;++t)l.push(await t_(o[t],null,e[t]))}return[i,o,l]}testLoop(e,t,n,r=0,a){return rf((()=>{const s=this.checkNumSamples(t,n,a,"steps"),i=[];if(r>0)throw new YS("Verbose mode is not implemented yet.");if(null!=a)throw new YS("steps mode in testLoop() is not implemented yet");{const r=c_(s,n),a=Ov(UC(0,s));for(let n=0;n<r.length;++n){const s=r[n][0],o=r[n][1],l=XC(a,s,o-s),u=u_(t,l),c=e(u);if(0===n)for(let e=0;e<c.length;++e)i.push(Jg(0));for(let e=0;e<c.length;++e){const t=c[e];i[e]=um(i[e],hm(o-s,t))}}for(let e=0;e<i.length;++e)i[e]=dm(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(aC(e,r)>1){a+=`_${aC(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 QI(e),o=KI(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=n_(e,a[n]));const s=Hy(e);t.push(s),l=0===n?e:um(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=Hy(t(r[a],o[a]))}sf(e),s.push(e)}return l=Hy(l),this.calculateLosses().forEach((e=>{l=um(l,e)})),l}),!0,i)].concat(s)}}makeTestFunction(){this.testFunction=e=>rf((()=>{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 QI(s),o=KI(this.outputs,i);for(let e=0;e<this.lossFunctions.length;++e){const r=this.lossFunctions[e],s=Hy(r(a[e],o[e]));n=0===e?s:um(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=Hy(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;o_(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 YS("validationData including sample weights is not supported yet."):new JS(`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=l_(r,e,t),s=r,r=l_(r,0,e),c=l_(a,e,t),i=a,a=l_(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=AW(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,h_(r,e),h_(a,t),h_(s,e),h_(i,t),h_(u,o),h_(c,l),null!=d&&af(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 JS("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=UC(0,m)),null==s&&(s=1);const{callbackList:y,history:b}=kW(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 YS("stepsPerEpoch mode is not implemented yet.");{if("batch"===u)throw new YS("batch shuffling is not implemneted yet");u&&Mo(g);const s=Ov(g),i=c_(m,r);for(let u=0;u<i.length;++u){const c={};if(await y.onBatchBegin(u,c),rf((()=>{const d=i[u][0],h=i[u][1],p=XC(s,d,h-d);c.batch=u,c.size=h-d;const m=u_(t,p),g=e(m);for(let e=0;e<n.length;++e){const t=n[e],r=g[e];c[t]=r,sf(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];sf(s),a["val_"+r]=s}}})),await y.onBatchEnd(u,c),hW(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 s_(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 af(s),h_(n[0],e),h_(n[1],t),sC(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=nf().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=t-nf().numTensors}return e}getLossIdentifiers(){let e;if("string"==typeof this.loss)e=oC(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=>oC(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]=oC(n[r])}}return e}getMetricIdentifiers(){if("string"==typeof this.metrics||"function"==typeof this.metrics)return[oC(GW(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map((e=>oC(GW(e))));{const e={};for(const t in this.metrics)e[t]=oC(GW(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=wW(ZW(e.optimizer_config));let n,r;if("string"==typeof e.loss)n=lC(e.loss);else if(Array.isArray(e.loss))n=e.loss.map((e=>lC(e)));else if(null!=e.loss){n={};for(const t in e.loss)n[t]=lC(e.loss[t])}if(Array.isArray(e.metrics))r=e.metrics.map((e=>lC(e)));else if(null!=e.metrics){r={};for(const t in e.metrics)r[t]=lC(e.metrics[t])}this.compile({loss:n,metrics:r,optimizer:t})}async save(e,t){if("string"==typeof e){const t=Tf(e);if(0===t.length)throw new JS(`Cannot find any save handlers for URL '${e}'`);if(t.length>1)throw new JS(`Found more than one (${t.length}) save handlers for URL '${e}'`);e=t[0]}if(null==e.save)throw new JS("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const n=await df(this.getNamedWeights(t)),r={modelTopology:this.toJSON(null,!1),format:"layers-model",generatedBy:`TensorFlow.js tfjs-layers v${JW}`,convertedBy:null};if(null!=t&&t.includeOptimizer&&null!=this.optimizer){r.trainingConfig=this.getTrainingConfig();const e="optimizer",{data:t,specs:a}=await df(await this.optimizer.getWeights(),e);n.specs.push(...a),n.data=xf([n.data,t])}if(null!=this.userDefinedMetadata){const e=!0;VW(this.userDefinedMetadata,this.name,e),r.userDefinedMetadata=this.userDefinedMetadata}return r.weightData=n.data,r.weightSpecs=n.specs,e.save(r)}setUserDefinedMetadata(e){VW(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}}y_.className="Model",kx(y_);class b_ extends y_{}b_.className="Functional",kx(b_);
/**
 * @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 v_ extends y_{constructor(e){if(super({inputs:[],outputs:[]}),e=e||{},this.trainable=!0,this.built=!1,this.name=null!=e.name?e.name:SC("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 JS(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){const t=e instanceof v_||e instanceof y_;let n;if(t){if(n=e,1!==n.outputs.length)throw new JS("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 JS("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 JS("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 JS("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 qI({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 JS(`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 JS("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=jI(this.outputs[0])}this.inboundNodes=[],new VI({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:nC(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(OI(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 y_({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 KS("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 KS("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 KS("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 KS("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 JS("Legacy serialization format not supported yet.");a=t}else Go(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 v_))throw new YS(`Sequential.fromConfig called on non-Sequential input: ${i}`);for(const o of a){const e=wW(o,void 0,r);r&&e.setFastWeightInitDuringBuild(!0),i.add(e)}return i}set stopTraining(e){if(null==this.model)throw new JS("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 JS("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}}}v_.className="Sequential",kx(v_);
/**
 * @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 A_=class extends Ax{getConfig(){return{}}};class x_ extends A_{apply(e,t=1){return function(e,t=1){if(1!==t)throw new YS(`Support for alpha values other than 1 (${t}) is not implemented yet.`);return Lg(e)}(e,t)}}x_.className="elu",kx(x_);class k_ extends A_{apply(e){return hv(e)}}k_.className="selu",kx(k_);class w_ extends A_{apply(e){return rv(e)}}w_.className="relu",kx(w_);class S_ extends A_{apply(e){return rf((()=>Xy(6,rv(e))))}}S_.className="relu6",kx(S_);class C_ extends A_{apply(e){return e}}C_.className="linear",kx(C_);class I_ extends A_{apply(e){return jm(e)}}I_.className="sigmoid",kx(I_);class W_ extends A_{apply(e){return function(e){return rf((()=>{const t=um(.5,hm(.2,e));return og(t,0,1)}))}(e)}}W_.className="hardSigmoid",kx(W_);class __ extends A_{apply(e){return Ty(e)}}__.className="softplus",kx(__);class T_ extends A_{apply(e){return function(e){return rf((()=>dm(e,um(pm(e),1))))}(e)}}T_.className="softsign",kx(T_);class N_ extends A_{apply(e){return Qm(e)}}N_.className="tanh",kx(N_);let E_=class extends A_{apply(e,t=-1){return kv(e,t)}};E_.className="softmax",kx(E_);class R_ extends A_{apply(e,t=-1){return Ry(e,t)}}R_.className="logSoftmax",kx(R_);class $_ extends A_{apply(e,t=1){return rf((()=>hm(jm(hm(e,t)),e)))}}$_.className="swish",kx($_);class O_ extends A_{apply(e){return rf((()=>hm(e,Qm(Ty(e)))))}}function F_(e){return e.getClassName()}function D_(e,t={}){return hC(e,xx.getMap().classNameMap,t,"activation")}function M_(e){if(null==e){const e={className:"linear",config:{}};return D_(e)}if("string"==typeof e){const t={};return t.className=e,t.config={},D_(t)}return e instanceof A_?e:D_(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.
 * =============================================================================
 */O_.className="mish",kx(O_);class L_ extends Ax{}class B_ extends L_{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 rf((()=>{let t=jy([1]);return this.hasL1&&(t=um(t,ty(hm(this.l1,pm(e))))),this.hasL2&&(t=um(t,ty(hm(this.l2,aI(e))))),zm(t,[])}))}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}}B_.className="L1L2",kx(B_);const P_={l1l2:"L1L2"};function z_(e){return cC(e)}function G_(e,t={}){return hC(e,xx.getMap().classNameMap,t,"regularizer")}function V_(e){if(null==e)return null;if("string"==typeof e){return G_({className:e in P_?P_[e]:e,config:{}})}return e instanceof L_?e:G_(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 U_ extends HI{constructor(e){super(null==e?{}:e),this.supportsMasking=!0,null!=e&&(this.maxValue=e.maxValue)}call(e,t){e=$I(e);let n=rv(e);return null!=this.maxValue&&(n=og(n,0,this.maxValue)),n}computeOutputShape(e){return e}getConfig(){const e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}}U_.className="ReLU",kx(U_);class H_ extends HI{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=$I(e);return by(n,this.alpha)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}H_.className="LeakyReLU",kx(H_);class j_ extends HI{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA_INITIALIZER="zeros",null==e&&(e={}),this.supportsMasking=!0,this.alphaInitializer=NI(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=V_(e.alphaRegularizer),this.alphaConstraint=cW(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 JS(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`);this.sharedAxes=[e.sharedAxes]}}build(e){const t=(e=OI(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 PI({ndim:e.length,axes:n})],this.built=!0}call(e,t){return e=$I(e),hb(e,this.alpha.read())}getConfig(){const e={alphaInitializer:TI(this.alphaInitializer),alphaRegularizer:z_(this.alphaRegularizer),alphaConstraint:lW(this.alphaConstraint),sharedAxes:this.sharedAxes},t=super.getConfig();return Object.assign(e,t),e}}j_.className="PReLU",kx(j_);let q_=class extends HI{constructor(e){if(super(null==e?{}:e),this.DEFAULT_ALPHA=1,null==e&&(e={}),null!=e.alpha&&e.alpha!==this.DEFAULT_ALPHA)throw new YS(`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=$I(e);return Lg(n)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}};q_.className="ELU",kx(q_);class Q_ extends HI{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=$I(e);return hm(n,im(hy(n,this.theta),"float32"))}computeOutputShape(e){return e}getConfig(){const e={theta:this.theta},t=super.getConfig();return Object.assign(e,t),e}}Q_.className="ThresholdedReLU",kx(Q_);class X_ extends HI{constructor(e){super(null==e?{}:e),this.DEFAULT_AXIS=1,null==e&&(e={}),this.softmax=(new E_).apply,this.axis=null==e.axis?this.DEFAULT_AXIS:e.axis}call(e,t){return rf((()=>{let n=$I(e);const r=t.mask;if(null!=r){const e=hm(Ey(qy(n.shape),im(r,n.dtype)),Jg(-1e9));n=um(n,e)}return this.axis instanceof Array?this.axis.length>1?sy(Ey(n,$y(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 Z_(e,t,n){if("number"==typeof e)return nC(e,t);if(e.length!==t)throw new JS(`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 JS(`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 K_(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 J_(e,t,n,r){if(null==e)return null;if("valid"===r)e=e*t+VC([n-t,0]);else{if("same"!==r)throw new JS(`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 Y_(e,t){return rf((()=>(EC(t),"channelsFirst"===t?tA(e,[0,2,3,1]):e)))}function eT(e,t){return rf((()=>(EC(t),"channelsFirst"===t?tA(e,[0,2,3,4,1]):e)))}function tT(e,t,n,r=[1,1],a="valid",s,i,o=null){return rf((()=>{if(null==s&&(s="channelsLast"),EC(s),3!==e.rank&&4!==e.rank)throw new JS(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${e.rank}.`);if(3!==t.rank&&4!==t.rank)throw new JS(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${e.rank}.`);let l=Y_(e,s);if("causal"===a)throw new YS("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=mA({x:l,filter:t,strides:r,pad:"same"===a?"same":"valid",dilations:i,dataFormat:"NHWC",bias:n,activation:o}),"channelsFirst"===s&&(l=tA(l,[0,3,1,2])),l}))}X_.className="Softmax",kx(X_);class nT extends HI{constructor(e,t){if(super(t),this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",nT.verifyArgs(t),this.rank=e,bC(this.rank,"rank"),1!==this.rank&&2!==this.rank&&3!==this.rank)throw new YS(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=Z_(t.kernelSize,e,"kernelSize"),this.strides=Z_(null==t.strides?1:t.strides,e,"strides"),this.padding=null==t.padding?"valid":t.padding,RC(this.padding),this.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,EC(this.dataFormat),this.activation=M_(t.activation),this.useBias=null==t.useBias||t.useBias,this.biasInitializer=NI(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=cW(t.biasConstraint),this.biasRegularizer=V_(t.biasRegularizer),this.activityRegularizer=V_(t.activityRegularizer),this.dilationRate=Z_(null==t.dilationRate?1:t.dilationRate,e,"dilationRate"),1===this.rank&&Array.isArray(this.dilationRate)&&1!==this.dilationRate.length)throw new JS(`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 JS(`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 JS(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}static verifyArgs(e){if(rC("kernelSize"in e,"required key 'kernelSize' not in config"),"number"!=typeof e.kernelSize&&!yC(e.kernelSize,"number",1,3))throw new JS(`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:F_(this.activation),useBias:this.useBias,biasInitializer:TI(this.biasInitializer),biasRegularizer:z_(this.biasRegularizer),activityRegularizer:z_(this.activityRegularizer),biasConstraint:lW(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}class rT extends nT{constructor(e,t){super(e,t),this.kernel=null,rT.verifyArgs(t),this.filters=t.filters,bC(this.filters,"filters"),this.kernelInitializer=NI(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=cW(t.kernelConstraint),this.kernelRegularizer=V_(t.kernelRegularizer)}build(e){e=OI(e);const t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new JS(`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 rf((()=>{let t;e=$I(e);const n=null==this.bias?null:this.bias.read(),r=AC(this.activation.getClassName());if(null!=r&&2===this.rank)t=tT(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 rf((()=>{if(null==s&&(s="channelsLast"),EC(s),3!==e.shape.length)throw new JS(`The input of a conv1dWithBias operation should be 3, but is ${e.shape.length} instead.`);if(3!==t.shape.length)throw new JS(`The kernel for a conv1dWithBias operation should be 3, but is ${t.shape.length} instead`);if(null!=n&&1!==n.shape.length)throw new JS(`The bias for a conv1dWithBias operation should be 1, but is ${t.shape.length} instead`);if("channelsFirst"===s&&(e=tA(e,[0,2,1])),"causal"===a)throw new YS("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let o=pg(e,t,r,"same"===a?"same":"valid","NWC",i);return null!=n&&(o=iI(o,n)),o}))}(e,this.kernel.read(),n,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(2===this.rank)t=tT(e,this.kernel.read(),n,this.strides,this.padding,this.dataFormat,this.dilationRate);else{if(3!==this.rank)throw new YS("convolutions greater than 3D are not implemented yet.");t=function(e,t,n,r=[1,1,1],a="valid",s,i){return rf((()=>{if(null==s&&(s="channelsLast"),EC(s),4!==e.rank&&5!==e.rank)throw new JS(`conv3dWithBias expects input to be of rank 4 or 5, but received ${e.rank}.`);if(4!==t.rank&&5!==t.rank)throw new JS(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${e.rank}.`);let o=eT(e,s);if("causal"===a)throw new YS("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return o=gg(o,t,r,"same"===a?"same":"valid","NDHWC",i),null!=n&&(o=iI(o,n)),"channelsFirst"===s&&(o=tA(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=OI(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=K_(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:TI(this.kernelInitializer),kernelRegularizer:z_(this.kernelRegularizer),kernelConstraint:lW(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 JS(`Convolution layer expected config.filters to be a 'number' > 0 but got ${JSON.stringify(e.filters)}`)}}class aT extends rT{constructor(e){super(2,e),aT.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if("number"!=typeof e.kernelSize&&!yC(e.kernelSize,"number",1,2))throw new JS(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}}aT.className="Conv2D",kx(aT);class sT extends rT{constructor(e){super(3,e),sT.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 JS(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}}sT.className="Conv3D",kx(sT);class iT extends aT{constructor(e){if(super(e),this.inputSpec=[new PI({ndim:4})],"same"!==this.padding&&"valid"!==this.padding)throw new JS(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(4!==(e=OI(e)).length)throw new JS("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 JS("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 PI({ndim:4,axes:{[t]:n}})],this.built=!0}call(e,t){return rf((()=>{let t=$I(e);if(4!==t.shape.length)throw new JS(`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,J_(i,c,l,this.padding),J_(o,d,u,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=tA(t,[0,2,3,1]));let p=mg(t,this.kernel.read(),h,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(p=tA(p,[0,3,1,2])),null!=this.bias&&(p=iI(p,this.bias.read(),this.dataFormat)),null!=this.activation&&(p=this.activation.apply(p)),p}))}computeOutputShape(e){const t=(e=OI(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]=J_(t[r],o,s,this.padding),t[a]=J_(t[a],l,i,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}iT.className="Conv2DTranspose",kx(iT);class oT extends sT{constructor(e){if(super(e),this.inputSpec=[new PI({ndim:5})],"same"!==this.padding&&"valid"!==this.padding)throw new JS(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(5!==(e=OI(e)).length)throw new JS("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 JS("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 PI({ndim:5,axes:{[t]:n}})],this.built=!0}call(e,t){return rf((()=>{let t=$I(e);if(5!==t.shape.length)throw new JS(`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,J_(o,p,c,this.padding),J_(l,f,d,this.padding),J_(u,m,h,this.padding),this.filters];"channelsLast"!==this.dataFormat&&(t=tA(t,[0,2,3,4,1]));let y=bg(t,this.kernel.read(),g,this.strides,this.padding);return"channelsLast"!==this.dataFormat&&(y=tA(y,[0,4,1,2,3])),null!==this.bias&&(y=iI(y,this.bias.read(),this.dataFormat)),null!==this.activation&&(y=this.activation.apply(y)),y}))}computeOutputShape(e){const t=(e=OI(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]=J_(t[r],u,i,this.padding),t[a]=J_(t[a],c,o,this.padding),t[s]=J_(t[s],d,l,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}oT.className="Conv3DTranspose",kx(oT);class lT extends rT{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 JS("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=t.kernelInitializer||null!=t.kernelRegularizer||null!=t.kernelConstraint)throw new JS("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 JS(`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=NI(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=V_(t.depthwiseRegularizer),this.depthwiseConstraint=cW(t.depthwiseConstraint),this.pointwiseInitializer=NI(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=V_(t.pointwiseRegularizer),this.pointwiseConstraint=cW(t.pointwiseConstraint)}build(e){if((e=OI(e)).length<this.rank+2)throw new JS(`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 JS(`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 PI({ndim:this.rank+2,axes:{[t]:n}})],this.built=!0}call(e,t){return rf((()=>{let t;if(e=$I(e),1===this.rank)throw new YS("1D separable convolution is not implemented yet.");return 2===this.rank&&("channelsFirst"===this.dataFormat&&(e=tA(e,[0,2,3,1])),t=pv(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(t=iI(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),"channelsFirst"===this.dataFormat&&(t=tA(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=TI(this.depthwiseInitializer),e.pointwiseInitializer=TI(this.pointwiseInitializer),e.depthwiseRegularizer=z_(this.depthwiseRegularizer),e.pointwiseRegularizer=z_(this.pointwiseRegularizer),e.depthwiseConstraint=lW(this.depthwiseConstraint),e.pointwiseConstraint=lW(this.pointwiseConstraint),e}}lT.className="SeparableConv";class uT extends lT{constructor(e){super(2,e)}}uT.className="SeparableConv2D",kx(uT);class cT extends rT{constructor(e){super(1,e),cT.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&&!yC(e.kernelSize,"number",1,1))throw new JS(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}}cT.className="Conv1D",kx(cT);class dT extends HI{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 rf((()=>{if(e=$I(e),"channelsLast"===this.dataFormat){const t=KC(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return KC(t,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}{const t=KC(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return KC(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}}dT.className="Cropping2D",kx(dT);class hT extends HI{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,EC(this.dataFormat),this.interpolation=null==e.interpolation?"nearest":e.interpolation,t=this.interpolation,gC(IC,"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 rf((()=>{let t=$I(e);const n=t.shape;if("channelsFirst"===this.dataFormat){t=tA(t,[0,2,3,1]);const e=this.size[0]*n[2],r=this.size[1]*n[3],a="nearest"===this.interpolation?px.resizeNearestNeighbor(t,[e,r]):px.resizeBilinear(t,[e,r]);return tA(a,[0,3,1,2])}{const e=this.size[0]*n[1],r=this.size[1]*n[2];return"nearest"===this.interpolation?px.resizeNearestNeighbor(t,[e,r]):px.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}}hT.className="UpSampling2D",kx(hT);class pT extends nT{constructor(e){super(2,e),this.depthwiseKernel=null,this.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,this.depthwiseInitializer=NI(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=cW(e.depthwiseConstraint),this.depthwiseRegularizer=V_(e.depthwiseRegularizer)}build(e){if((e=OI(e)).length<4)throw new JS(`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 JS(`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 rf((()=>{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 rf((()=>{null==a&&(a="channelsLast"),EC(a);let i=Y_(e,a);if(4!==e.rank)throw new JS(`Input for depthwiseConv2d is required to be 4-D, but is instead ${e.rank}-D`);if(4!==t.rank)throw new JS(`depthwiseKernel is required to be 4-D, but is instead ${t.rank}-D`);return i=Cg(i,t,n,"same"===r?"same":"valid","NHWC",s),"channelsFirst"===a&&(i=tA(i,[0,3,1,2])),i}))}(e=$I(e),this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(t=iI(t,this.bias.read(),this.dataFormat)),null!=this.activation&&(t=this.activation.apply(t)),t}))}computeOutputShape(e){e=OI(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=K_(t,this.kernelSize[0],this.padding,this.strides[0]),s=K_(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=TI(this.depthwiseInitializer),e.depthwiseRegularizer=z_(this.depthwiseRegularizer),e.depthwiseConstraint=lW(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 fT(e,t,n,r){if(Array.isArray(e)){if(null!=t||null!=n)throw new JS("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 mT(e,t,n,r=!1,a,s,i=!1,o=!1){return rf((()=>{const i=t.shape.length;if(i<3)throw new JS(`Input should be at least 3D, but is ${i}D.`);const l=[1,0].concat(UC(2,i));if(t=tA(t,l),null!=s)throw new YS("The rnn() functoin of the deeplearn.js backend does not support constants yet.");null!=a&&((a=im(im(a,"bool"),"float32")).rank===i-1&&(a=iy(a,-1)),a=tA(a,l)),r&&(t=sv(t,0),null!=a&&(a=sv(a,0)));const u=[];let c,d=n;const h=t.shape[0],p=Xv(t);let f,m;null!=a&&(f=Xv(a));for(let t=0;t<h;++t){const n=p[t],r=rf((()=>e(n,d)));if(null==a)c=r[0],d=r[1];else{const e=rf((()=>{const e=f[t],n=Ey(rb(e),e);return{output:um(hm(r[0],e),hm(d[0],n)),newStates:d.map(((t,a)=>um(hm(r[1][a],e),hm(t,n))))}}));c=e.output,d=e.newStates}o&&u.push(c)}if(o){m=Nv(u,1)}return[c,m,d]}))}pT.className="DepthwiseConv2D",kx(pT);class gT extends HI{constructor(e){let t;if(super(e),null==e.cell)throw new JS("cell property is missing for the constructor of RNN.");if(t=Array.isArray(e.cell)?new ST({cells:e.cell}):e.cell,null==t.stateSize)throw new JS("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 PI({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(null==this.states_){return UC(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map((e=>null))}return this.states_}setStates(e){this.states_=e}computeOutputShape(e){EI(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 rf((()=>{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 YS("Constants support is not implemented in RNN yet.");EI(e)&&(e=e[0]);const t=this.stateful?e[0]:null,n=e.slice(2);this.inputSpec[0]=new PI({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(!qo(this.stateSpec.map((e=>e.shape[e.shape.length-1])),a))throw new JS(`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 PI({shape:[null,e]})));this.stateful&&this.resetStates()}resetStates(e,t=!1){rf((()=>{if(!this.stateful)throw new ZS("Cannot call resetStates() on an RNN Layer that is not stateful.");const n=this.inputSpec[0].shape[0];if(null==n)throw new JS("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=>jy([n,e]))):this.states_=[jy([n,this.cell.stateSize])];else if(null==e)af(this.states_),null!=this.keptStates&&(af(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((e=>jy([n,e]))):this.states_[0]=jy([n,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new JS(`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()):af(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(!qo(r.shape,s))throw new JS(`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=>sf(e.clone())))}))}apply(e,t){let n=null==t?null:t.initialState,r=null==t?null:t.constants;null==t&&(t={});const a=fT(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 PI({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 zI){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 rf((()=>{const n=null==t?null:t.mask,r=null==t?null:t.training;let a=null==t?null:t.initialState;e=$I(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 JS(`RNN Layer has ${s} state(s) but was passed ${a.length} initial state(s).`);this.unroll;const i={training:r},o=mT(((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 rf((()=>{let t=jy(e.shape);return t=ty(t,[1,2]),t=QC(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map((e=>e>1?eI(t,[1,e]):t)):this.cell.stateSize>1?[eI(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()===gT.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=wW(t.cell,n);return new e(Object.assign(t,{cell:r}))}}gT.className="RNN",kx(gT);class yT extends HI{}class bT extends yT{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,bC(this.units,"units"),this.activation=M_(null==e.activation?this.DEFAULT_ACTIVATION:e.activation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=NI(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=NI(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=NI(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=V_(e.kernelRegularizer),this.recurrentRegularizer=V_(e.recurrentRegularizer),this.biasRegularizer=V_(e.biasRegularizer),this.kernelConstraint=cW(e.kernelConstraint),this.recurrentConstraint=cW(e.recurrentConstraint),this.biasConstraint=cW(e.biasConstraint),this.dropout=GC([1,VC([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=GC([1,VC([0,null==e.recurrentDropout?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=OI(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 rf((()=>{if(2!==e.length)throw new JS(`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=CT({ones:()=>rb(e),rate:this.dropout,training:r,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=CT({ones:()=>rb(n),rate:this.recurrentDropout,training:r,dropoutFunc:this.dropoutFunc}));const s=this.dropoutMask,i=this.recurrentDropoutMask;a=nI(null!=s?hm(e,s):e,this.kernel.read()),null!=this.bias&&(a=iI(a,this.bias.read())),null!=i&&(n=hm(n,i));let o=um(a,nI(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:F_(this.activation),useBias:this.useBias,kernelInitializer:TI(this.kernelInitializer),recurrentInitializer:TI(this.recurrentInitializer),biasInitializer:TI(this.biasInitializer),kernelRegularizer:z_(this.kernelRegularizer),recurrentRegularizer:z_(this.recurrentRegularizer),biasRegularizer:z_(this.biasRegularizer),activityRegularizer:z_(this.activityRegularizer),kernelConstraint:lW(this.kernelConstraint),recurrentConstraint:lW(this.recurrentConstraint),biasConstraint:lW(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},e),t)}}bT.className="SimpleRNNCell",kx(bT);class vT extends gT{constructor(e){e.cell=new bT(e),super(e)}call(e,t){return rf((()=>{null!=this.cell.dropoutMask&&(af(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(af(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)}}vT.className="SimpleRNN",kx(vT);class AT extends yT{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 JS("GRUCell does not support reset_after parameter set to true.");this.units=e.units,bC(this.units,"units"),this.activation=M_(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=M_(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=NI(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=NI(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=NI(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=V_(e.kernelRegularizer),this.recurrentRegularizer=V_(e.recurrentRegularizer),this.biasRegularizer=V_(e.biasRegularizer),this.kernelConstraint=cW(e.kernelConstraint),this.recurrentConstraint=cW(e.recurrentConstraint),this.biasConstraint=cW(e.biasConstraint),this.dropout=GC([1,VC([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=GC([1,VC([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=OI(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 rf((()=>{if(2!==e.length)throw new JS(`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=CT({ones:()=>rb(e),rate:this.dropout,training:n,count:3,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=CT({ones:()=>rb(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=hm(e,a[0]));let u=nI(e,this.kernel.read());this.useBias&&(u=iI(u,this.bias.read())),0<this.recurrentDropout&&this.recurrentDropout<1&&(r=hm(r,s[0]));const c=this.recurrentKernel.read(),[d,h]=Iv(c,[2*this.units,this.units],c.rank-1),p=nI(r,d),[f,m,g]=Iv(u,3,u.rank-1),[y,b]=Iv(p,2,p.rank-1);i=this.recurrentActivation.apply(um(f,y)),o=this.recurrentActivation.apply(um(m,b));const v=nI(hm(o,r),h);l=this.activation.apply(um(g,v));const A=um(hm(i,r),hm(um(1,_y(i)),l));return[A,A]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:F_(this.activation),recurrentActivation:F_(this.recurrentActivation),useBias:this.useBias,kernelInitializer:TI(this.kernelInitializer),recurrentInitializer:TI(this.recurrentInitializer),biasInitializer:TI(this.biasInitializer),kernelRegularizer:z_(this.kernelRegularizer),recurrentRegularizer:z_(this.recurrentRegularizer),biasRegularizer:z_(this.biasRegularizer),activityRegularizer:z_(this.activityRegularizer),kernelConstraint:lW(this.kernelConstraint),recurrentConstraint:lW(this.recurrentConstraint),biasConstraint:lW(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation,resetAfter:!1};return Object.assign(Object.assign({},e),t)}}AT.className="GRUCell",kx(AT);class xT extends gT{constructor(e){e.implementation,e.cell=new AT(e),super(e)}call(e,t){return rf((()=>{null!=this.cell.dropoutMask&&(af(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(af(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)}}xT.className="GRU",kx(xT);class kT extends yT{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,bC(this.units,"units"),this.activation=M_(void 0===e.activation?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=M_(void 0===e.recurrentActivation?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=null==e.useBias||e.useBias,this.kernelInitializer=NI(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=NI(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=NI(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=V_(e.kernelRegularizer),this.recurrentRegularizer=V_(e.recurrentRegularizer),this.biasRegularizer=V_(e.biasRegularizer),this.kernelConstraint=cW(e.kernelConstraint),this.recurrentConstraint=cW(e.recurrentConstraint),this.biasConstraint=cW(e.biasConstraint),this.dropout=GC([1,VC([0,null==e.dropout?0:e.dropout])]),this.recurrentDropout=GC([1,VC([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=OI(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 dI{apply(t,r){const a=e.apply([n]),s=(new pI).apply([n]),i=e.apply([2*n]);return YC(YC(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 rf((()=>{const n=null!=t.training&&t.training;if(3!==e.length)throw new JS(`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=CT({ones:()=>rb(e),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc})),0<this.recurrentDropout&&this.recurrentDropout<1&&null==this.recurrentDropoutMask&&(this.recurrentDropoutMask=CT({ones:()=>rb(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=hm(e,s[0]));let d=nI(e,this.kernel.read());0<this.recurrentDropout&&this.recurrentDropout<1&&(r=hm(r,i[0])),d=um(d,nI(r,this.recurrentKernel.read())),this.useBias&&(d=iI(d,this.bias.read()));const[h,p,f,m]=Iv(d,4,d.rank-1);o=this.recurrentActivation.apply(h),l=this.recurrentActivation.apply(p),u=um(hm(l,a),hm(o,this.activation.apply(f))),c=this.recurrentActivation.apply(m);const g=hm(c,this.activation.apply(u));return[g,g,u]}))}getConfig(){const e=super.getConfig(),t={units:this.units,activation:F_(this.activation),recurrentActivation:F_(this.recurrentActivation),useBias:this.useBias,kernelInitializer:TI(this.kernelInitializer),recurrentInitializer:TI(this.recurrentInitializer),biasInitializer:TI(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:z_(this.kernelRegularizer),recurrentRegularizer:z_(this.recurrentRegularizer),biasRegularizer:z_(this.biasRegularizer),activityRegularizer:z_(this.activityRegularizer),kernelConstraint:lW(this.kernelConstraint),recurrentConstraint:lW(this.recurrentConstraint),biasConstraint:lW(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation};return Object.assign(Object.assign({},e),t)}}kT.className="LSTMCell",kx(kT);class wT extends gT{constructor(e){e.implementation,e.cell=new kT(e),super(e)}call(e,t){return rf((()=>{null!=this.cell.dropoutMask&&(af(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(af(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)}}wT.className="LSTM",kx(wT);class ST extends yT{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 rf((()=>{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;EI(e)&&(e=e[0]),this.cells.forEach(((n,r)=>{DC(`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(wW(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 LI(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]])}BI(t)}}function CT(e){const{ones:t,rate:n,training:r=!1,count:a=1,dropoutFunc:s}=e,i=()=>null!=s?s(t(),n):oI(t(),n),o=()=>lI(i,t,r);if(!a||a<=1)return sf(o().clone());return Array(a).fill(void 0).map(o).map((e=>sf(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.
 * =============================================================================
 */ST.className="StackedRNNCells",kx(ST);var IT=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 WT extends gT{constructor(e){if(e.unroll)throw new YS("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new YS("It is not possible at the moment to stack convolutional cells.");super(e),this.inputSpec=[new PI({ndim:5})]}call(e,t){return rf((()=>{if(null!=this.cell.dropoutMask&&(af(this.cell.dropoutMask),this.cell.dropoutMask=null),null!=this.cell.recurrentDropoutMask&&(af(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new JS("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 rf((()=>{const{stateSize:t}=this.cell,n=e.shape,r=this.computeSingleOutputShape(n),a=jy([r[0],...r.slice(2)]);return Array.isArray(t)?Array(t.length).fill(a):[a]}))}resetStates(e,t=!1){rf((()=>{if(!this.stateful)throw new ZS("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 JS("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((()=>jy(a))):this.states_=[jy(a)];else if(null==e)af(this.states_),null!=this.keptStates&&(af(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map((()=>jy(a))):this.states_[0]=jy(a);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new JS(`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()):af(this.states_);for(let t=0;t<this.states_.length;++t){const n=e[t],r=a;if(!qo(n.shape,r))throw new JS(`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=>sf(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=K_(l,r[0],a,s[0],i[0]),d=K_(u,r[1],a,s[1],i[1]);return[...e.slice(0,2),...o?[n,c,d]:[c,d,n]]}}WT.className="ConvRNN2D";class _T extends kT{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,bC(this.filters,"filters"),this.kernelSize=Z_(n,2,"kernelSize"),this.kernelSize.forEach((e=>bC(e,"kernelSize"))),this.strides=Z_(r||1,2,"strides"),this.strides.forEach((e=>bC(e,"strides"))),this.padding=a||"valid",RC(this.padding),this.dataFormat=s||"channelsLast",EC(this.dataFormat),this.dilationRate=Z_(i||1,2,"dilationRate"),this.dilationRate.forEach((e=>bC(e,"dilationRate")))}build(e){var t;e=OI(e);const n="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[n])throw new JS(`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 dI{apply(e,t){return JC([n.apply([r]),qy([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 rf((()=>{if(3!==e.length)throw new JS(`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=CT({ones:()=>rb(r),rate:this.dropout,training:n,count:4,dropoutFunc:this.dropoutFunc}));const i=this.dropoutMask,o=(e,t,n)=>t&&t[n]?hm(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=CT({ones:()=>rb(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]=Iv(this.kernel.read(),4,3),[x,k,w,S]=this.useBias?Iv(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,_]=Iv(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(um(l,p)),N=this.recurrentActivation.apply(um(u,f)),E=um(hm(N,s),hm(T,this.activation.apply(um(c,m)))),R=hm(this.recurrentActivation.apply(um(d,g)),this.activation.apply(E));return[R,R,E]}))}getConfig(){const e=super.getConfig(),t=IT(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=hg(e,t,this.strides,r||"valid","channelsFirst"===this.dataFormat?"NCHW":"NHWC",this.dilationRate);return n?iI(a,n,this.dataFormat):a}recurrentConv(e,t){return hg(e,t,1,"same","channelsFirst"===this.dataFormat?"NCHW":"NHWC")}}_T.className="ConvLSTM2DCell",kx(_T);class TT extends WT{constructor(e){const t=new _T(e);super(Object.assign(Object.assign({},e),{cell:t}))}static fromConfig(e,t){return new e(t)}}TT.className="ConvLSTM2D",kx(TT);
/**
 * @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 NT extends HI{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 rf((()=>{this.invokeCallHook(e,t);const n=$I(e);if(0<this.rate&&this.rate<1){const e=null!=t.training&&t.training,r=this.getNoiseShape(n);return lI((()=>oI(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()}}NT.className="Dropout",kx(NT);class ET extends NT{constructor(e){super(e),this.inputSpec=[{ndim:3}]}getNoiseShape(e){const t=e.shape;return[t[0],1,t[2]]}}ET.className="SpatialDropout1D",kx(ET);class RT extends HI{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,bC(this.units,"units"),this.activation=M_(e.activation),null!=e.useBias&&(this.useBias=e.useBias),this.kernelInitializer=NI(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=NI(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=cW(e.kernelConstraint),this.biasConstraint=cW(e.biasConstraint),this.kernelRegularizer=V_(e.kernelRegularizer),this.biasRegularizer=V_(e.biasRegularizer),this.activityRegularizer=V_(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){const t=(e=OI(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=OI(e)).slice();return t[t.length-1]=this.units,t}call(e,t){return rf((()=>{this.invokeCallHook(e,t);const n=$I(e),r=AC(this.activation.getClassName());let a;return null!=r?a=nI(n,this.kernel.read(),r,this.bias?this.bias.read():null):(a=nI(n,this.kernel.read()),null!=this.bias&&(a=iI(a,this.bias.read())),null!=this.activation&&(a=this.activation.apply(a))),a}))}getConfig(){const e={units:this.units,activation:F_(this.activation),useBias:this.useBias,kernelInitializer:TI(this.kernelInitializer),biasInitializer:TI(this.biasInitializer),kernelRegularizer:z_(this.kernelRegularizer),biasRegularizer:z_(this.biasRegularizer),activityRegularizer:z_(this.activityRegularizer),kernelConstraint:lW(this.kernelConstraint),biasConstraint:lW(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}RT.className="Dense",kx(RT);class $T extends HI{constructor(e){super(e=e||{}),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=OI(e);for(const t of e.slice(1))if(null==t)throw new JS(`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],zC(e,1)]}call(e,t){return rf((()=>{this.invokeCallHook(e,t);let n=$I(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=tA(n,e)}return function(e){if(e.rank<=1)throw new JS(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);const t=[e.shape[0],zC(e.shape,1)];return zm(e,t)}(n)}))}getConfig(){const e={};null!=this.dataFormat&&(e.dataFormat=this.dataFormat);const t=super.getConfig();return Object.assign(e,t),e}}$T.className="Flatten",kx($T);class OT extends HI{constructor(e){super(e),this.supportsMasking=!0,this.activation=M_(e.activation)}call(e,t){return rf((()=>{this.invokeCallHook(e,t);const n=$I(e);return this.activation.apply(n)}))}getConfig(){const e={activation:F_(this.activation)},t=super.getConfig();return Object.assign(e,t),e}}OT.className="Activation",kx(OT);class FT extends HI{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 rf((()=>{return e=$I(e),t=e,n=this.n,rf((()=>{if(2!==t.shape.length)throw new JS(`repeat() expects a rank-2 tensor, but received a rank-${t.shape.length} tensor.`);return eI(QC(t,1),[1,n,1])}));var t,n}))}getConfig(){const e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}}FT.className="RepeatVector",kx(FT);class DT extends HI{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 JS("Can only specifiy one unknown dimension.");s=o}else a*=e}const i=zC(e);if(null!==s){if(0===a||i%a!=0)throw new JS(n);r[s]=i/a}else if(i!==a)throw new JS(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 rf((()=>{this.invokeCallHook(e,t);const n=$I(e),r=n.shape,a=r.slice(0,1).concat(this.fixUnknownDimension(r.slice(1),this.targetShape));return zm(n,a)}))}getConfig(){const e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}}DT.className="Reshape",kx(DT);class MT extends HI{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=UC(1,e.dims.length+1);if(!qo(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 PI({ndim:this.dims.length+1})]}computeOutputShape(e){const t=(e=OI(e)).slice();return this.dims.forEach(((n,r)=>{t[r+1]=e[n]})),t}call(e,t){return tA($I(e),this.dimsIncludingBatch)}getConfig(){const e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}}MT.className="Permute",kx(MT);class LT extends HI{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=$I(e);return bm(tb(n,this.maskValue),-1)}call(e,t){return rf((()=>{this.invokeCallHook(e,t);const n=$I(e),r=bm(tb(n,this.maskValue),-1,!0);return hm(n,im(r,n.dtype))}))}}LT.className="Masking",kx(LT);
/**
 * @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 HI{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(iC(e.inputLength))}this.inputDim=e.inputDim,bC(this.inputDim,"inputDim"),this.outputDim=e.outputDim,bC(this.outputDim,"outputDim"),this.embeddingsInitializer=NI(e.embeddingsInitializer||this.DEFAULT_EMBEDDINGS_INITIALIZER),this.embeddingsRegularizer=V_(e.embeddingsRegularizer),this.activityRegularizer=V_(e.activityRegularizer),this.embeddingsConstraint=cW(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 rf((()=>this.maskZero?(e=$I(e),tb(e,Og(e))):null))}computeOutputShape(e){if(e=OI(e),null==this.inputLength)return[...e,this.outputDim];const t=iC(this.inputLength);if(t.length!==e.length-1)throw new JS(`"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 JS(`"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 rf((()=>{this.invokeCallHook(e,t);let n=$I(e);"int32"!==n.dtype&&(n=qC(n,"int32"));const r=rI(this.embeddings.read(),zm(n,[n.size]));return zm(r,OI(this.computeOutputShape(n.shape)))}))}getConfig(){const e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:TI(this.embeddingsInitializer),embeddingsRegularizer:z_(this.embeddingsRegularizer),activityRegularizer:z_(this.activityRegularizer),embeddingsConstraint:lW(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=super.getConfig();return Object.assign(e,t),e}}BT.className="Embedding",kx(BT);
/**
 * @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 PT extends HI{constructor(e){super(e||{}),this.supportsMasking=!0}mergeFunction(e){throw new YS}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 JS("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=[OI(e)]),e.length<2)throw new JS(`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=fC(t),t.length>1)throw new JS(`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===fC(r).length?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return rf((()=>{if(this.reshapeRequired){const t=[],n=e.map((e=>e.rank));if(-1===n.indexOf(null)){const r=VC(n);for(let n of e){const e=n.rank;for(let t=0;t<r-e;++t)n=QC(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=zm(s,[r].concat(zC(e.slice(1))));i=tA(i,[1,0]),i=zm(i,a),t.push(i),n=!0}else if(e>1){const r=UC(1,e).concat([0]);t.push(tA(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=zm(tA(zm(r,[-1,t]),[1,0]),n)}else if(a>1){const e=[a-1].concat(UC(0,a-1));r=tA(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=fC(n),t=1===n.length?n.concat(t):[null].concat(t),t}computeMask(e,t){return rf((()=>{if(null==t)return null;if(!Array.isArray(t))throw new JS("`mask` should be an Array");if(!Array.isArray(e))throw new JS("`inputs` should be an Array");if(t.length!==e.length)throw new JS(`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:iy(e,0))))[0];for(let e=1;e<t.length-1;++e)n=Oy(n,t[e]);return n}))}}class zT extends PT{constructor(e){super(e)}mergeFunction(e){return rf((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=um(t,e[n]);return t}))}}zT.className="Add",kx(zT);class GT extends PT{constructor(e){super(e)}mergeFunction(e){return rf((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=hm(t,e[n]);return t}))}}GT.className="Multiply",kx(GT);class VT extends PT{constructor(e){super(e)}mergeFunction(e){return rf((()=>{let t=e[0].clone();for(let n=1;n<e.length;++n)t=um(t,e[n]);return hm(1/e.length,t)}))}}VT.className="Average",kx(VT);class UT extends PT{constructor(e){super(e)}mergeFunction(e){return rf((()=>{let t=e[0];for(let n=1;n<e.length;++n)t=Uy(t,e[n]);return t}))}}UT.className="Maximum",kx(UT);class HT extends PT{constructor(e){super(e)}mergeFunction(e){return rf((()=>{let t=e[0];for(let n=1;n<e.length;++n)t=Xy(t,e[n]);return t}))}}HT.className="Minimum",kx(HT);class jT extends PT{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 JS("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(qo(e,t)){a=!0;break}a||n.push(t)}if(n.length>1)throw new JS("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return rf((()=>JC(e,this.axis)))}computeOutputShape(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new JS("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 JS("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new JS("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new JS(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return rf((()=>{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(im(rb(e[s]),"bool")):t[s].rank<e[s].rank?r.push(iy(t[s],-1)):r.push(t[s]);const a=Um(r,this.axis);return ym(a,-1,!1)}))}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}function qT(e,t){for(;e<0;)e+=t;return e}jT.className="Concatenate",kx(jT);class QT extends PT{constructor(e){super(e),this.axes=e.axes,this.normalize=null!=e.normalize&&e.normalize,this.supportsMasking=!0,this.reshapeRequired=!1}build(e){Go(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 YS("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 JS(`Dimension incompatibility: ${t[r[0]]} !== ${n[r[1]]}`)}mergeFunction(e){if(2!==e.length)throw new JS(`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)=>qT(t,e[n].shape.length))):[qT(this.axes,n.shape.length),qT(this.axes,r.shape.length)],this.normalize&&(n=SW(n,t[0]),r=SW(r,t[1])),function(e,t,n){if(e.shape.length>3||t.shape.length>3)throw new YS("batchDot is not implemented for tensors of 4D or higher rank yet");if(Go(e.shape.length>=2,(()=>`batchDot requires the rank of x to be >= 2, but got ${e.shape.length}`)),Go(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 YS("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 rf((()=>{let n,i;if(r>a){n=r-a;const e=[];for(let t=0;t<n;++t)e.push(1);t=zm(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=zm(e,e.shape.concat(t))}else n=0;if(2===e.shape.length&&2===t.shape.length)i=s[0]===s[1]?ty(hm(e,t),s[0]):ty(hm(tA(e,[1,0]),t),s[1]);else{const n=s[0]!==e.shape.length-1,r=s[1]===t.shape.length-1;i=Hm(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=Tv(i,t)}return 1===i.shape.length&&(i=iy(i,1)),i}))}(n,r,t)}interpretAxes(e,t){let n;return n=Array.isArray(this.axes)?this.axes:[qT(this.axes,e.length),qT(this.axes,t.length)],n}computeOutputShape(e){Go(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 YS("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}}QT.className="Dot",kx(QT);
/**
 * @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 XT extends HI{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 rf((()=>{this.invokeCallHook(e,t);const n=$I(e);return lI((()=>um(tI(n.shape,0,this.stddev),n)),(()=>n),t.training||!1)}))}}XT.className="GaussianNoise",kx(XT);class ZT extends HI{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 rf((()=>{this.invokeCallHook(e,t);const n=$I(e);if(this.rate>0&&this.rate<1){return lI((()=>{const e=Math.sqrt(this.rate/(1-this.rate));return hm(n,tI(n.shape,1,e))}),(()=>n),t.training||!1)}return n}))}}ZT.className="GaussianDropout",kx(ZT);class KT extends HI{constructor(e){super(e),this.supportsMasking=!0,this.rate=e.rate,this.noiseShape=e.noiseShape}_getNoiseShape(e){return this.noiseShape||$I(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 rf((()=>{if(this.rate<1&&this.rate>0){const n=this._getNoiseShape(e);return lI((()=>{const t=$I(e),r=-1.7580993408473766;let a=py(Jb(n),this.rate);a=qC(a,"float32");const s=((1-this.rate)*(1+this.rate*r**2))**-.5,i=-s*r*this.rate,o=um(hm(t,a),hm(um(a,-1),r));return um(hm(o,s),i)}),(()=>$I(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 JT(e,t,n,r,a,s=.001){let i;if(2===e.rank)i=Jm(e,t,n,r,a,s);else if(3===e.rank)i=Ym(e,t,n,r,a,s);else{if(4!==e.rank)throw new YS(`batchNormalization is not implemented for array of rank ${e.rank} yet`);i=eg(e,t,n,r,a,s)}return i}function YT(e,t,n,r,a=.001){return qo(r.slice().sort(),UC(0,e.rank-1))?function(e,t,n,r,a=.001){return rf((()=>{const s=Jy(e,r),i=s.mean,o=s.variance;return[JT(e,i,o,n,t,a),i,o]}))}(e,t,n,r,a):function(e,t,n,r,a=.001){return rf((()=>{const s=Jy(e,r),i=s.mean,o=s.variance,l=[];for(const t of UC(0,e.rank))-1!==r.indexOf(t)?l.push(1):l.push(e.shape[t]);const u=zm(i,l),c=zm(o,l),d=null==t?null:zm(t,l),h=null==n?null:zm(n,l);return[JT(e,u,c,h,d,a),i,o]}))}(e,t,n,r,a)}KT.className="AlphaDropout",kx(KT);class eN extends HI{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=NI(e.betaInitializer||"zeros"),this.gammaInitializer=NI(e.gammaInitializer||"ones"),this.movingMeanInitializer=NI(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=NI(e.movingVarianceInitializer||"ones"),this.betaConstraint=cW(e.betaConstraint),this.gammaConstraint=cW(e.gammaConstraint),this.betaRegularizer=V_(e.betaRegularizer),this.gammaRegularizer=V_(e.gammaRegularizer)}build(e){e=OI(e);const t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(null==n)throw new JS(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new PI({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 rf((()=>{const n=null!=t.training&&t.training,r=$I(e),a=r.shape,s=a.length,i=UC(0,s),o=this.axis>=0?this.axis:this.axis+s;i.splice(o,1);const l=nC(1,s);l[o]=a[o];const u=i.slice();u.sort();const c=!qo(u,UC(0,s).slice(0,s-1));if(!n)return(()=>{if(c){const e=zm(this.movingMean.read(),l),t=zm(this.movingVariance.read(),l),n=this.center?zm(this.beta.read(),l):null,a=this.scale?zm(this.gamma.read(),l):null;return JT(r,e,t,n,a,this.epsilon)}return JT(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]=YT(r,this.gamma.read(),this.beta.read(),i,this.epsilon),f=(e,t,n)=>{rf((()=>{const r=1-n,a=e.read(),s=hm(Ey(a,t),r);e.write(Ey(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:TI(this.betaInitializer),gammaInitializer:TI(this.gammaInitializer),movingMeanInitializer:TI(this.movingMeanInitializer),movingVarianceInitializer:TI(this.movingVarianceInitializer),betaRegularizer:z_(this.betaRegularizer),gammaRegularizer:z_(this.gammaRegularizer),betaConstraint:lW(this.betaConstraint),gammaConstraint:lW(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}}eN.className="BatchNormalization",kx(eN);class tN extends HI{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=NI(e.betaInitializer||"zeros"),this.gammaInitializer=NI(e.gammaInitializer||"ones"),this.betaRegularizer=V_(e.betaRegularizer),this.gammaRegularizer=V_(e.gammaRegularizer),this.supportsMasking=!0}build(e){const t=(e=OI(e)).length;"number"==typeof this.axis&&(this.axis=[this.axis]);for(let r=0;r<this.axis.length;++r)this.axis[r]<0&&(this.axis[r]+=t);for(const r of this.axis)if(r<0||r>=t)throw new Error(`Invalid axis: ${r}`);if(this.axis.length!==fC(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);const n=this.axis.map((t=>e[t]));this.scale?this.gamma=this.addWeight("gamma",n,"float32",this.gammaInitializer,this.gammaRegularizer,true):this.gamma=null,this.center?this.beta=this.addWeight("beta",n,"float32",this.betaInitializer,this.betaRegularizer,true):this.beta=null,this.built=!0}call(e,t){const n=$I(e),r=n.shape,a=r.length;return rf((()=>{let{mean:e,variance:t}=Jy(n,this.axis,!0);const s=nC(1,a);for(const n of this.axis)s[n]=r[n];const i=e=>null!=e&&e.shape.length!==a?zm(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=ly(e,u),t=ly(t,u),null!=o&&(o=ly(o,c)),null!=l&&(l=ly(l,c)),JT(n,e,t,l,o,this.epsilon)}))}getConfig(){const e={axis:this.axis,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:TI(this.betaInitializer),gammaInitializer:TI(this.gammaInitializer),betaRegularizer:z_(this.betaRegularizer),gammaRegularizer:z_(this.gammaRegularizer)},t=super.getConfig();return Object.assign(e,t),e}}tN.className="LayerNormalization",kx(tN);class nN extends HI{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 JS(`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 JS(`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 JS(`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 PI({ndim:4})]}computeOutputShape(e){let t,n;return e=OI(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 rf((()=>{return t=$I(e),n=this.padding,r=this.dataFormat,rf((()=>{if(4!==t.rank)throw new JS(`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 JS("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 JS(`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]],sb(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 rN(e,t,n,r,a,s){return rf((()=>{let i;EC(a),$C(s),RC(r),null==n&&(n=[1,1]),null==r&&(r="valid"),null==a&&(a="channelsLast"),null==s&&(s="max"),e=Y_(e,a);const o="same"===r?"same":"valid";return i="max"===s?zy(e,t,n,o):Gm(e,t,n,o),"channelsFirst"===a&&(i=tA(i,[0,3,1,2])),i}))}function aN(e,t,n,r,a,s){return rf((()=>{let i;EC(a),$C(s),RC(r),null==n&&(n=[1,1,1]),null==r&&(r="valid"),null==a&&(a="channelsLast"),null==s&&(s="max"),e=eT(e,a);const o="same"===r?"same":"valid";return i="max"===s?Gy(e,t,n,o):Vm(e,t,n,o),"channelsFirst"===a&&(i=tA(i,[0,4,1,2,3])),i}))}nN.className="ZeroPadding2D",kx(nN);class sN extends HI{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 JS(`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(bC(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 JS(`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}bC(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,RC(this.padding),this.inputSpec=[new PI({ndim:3})]}computeOutputShape(e){const t=K_((e=OI(e))[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return rf((()=>{this.invokeCallHook(e,t),e=QC($I(e),2);const n=this.poolingFunction($I(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return Tv(n,[2])}))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}}class iN extends sN{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return EC(a),RC(r),rN(e,t,n,r,a,"max")}}iN.className="MaxPooling1D",kx(iN);class oN extends sN{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return EC(a),RC(r),rN(e,t,n,r,a,"avg")}}oN.className="AveragePooling1D",kx(oN);class lN extends HI{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 JS(`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];bC(this.poolSize,"poolSize"),bC(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,EC(this.dataFormat),RC(this.padding),this.inputSpec=[new PI({ndim:4})]}computeOutputShape(e){e=OI(e);let t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2];return t=K_(t,this.poolSize[0],this.padding,this.strides[0]),n=K_(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 rf((()=>(this.invokeCallHook(e,t),this.poolingFunction($I(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 uN extends lN{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return EC(a),RC(r),rN(e,t,n,r,a,"max")}}uN.className="MaxPooling2D",kx(uN);class cN extends lN{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return EC(a),RC(r),rN(e,t,n,r,a,"avg")}}cN.className="AveragePooling2D",kx(cN);class dN extends HI{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 JS(`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];bC(this.poolSize,"poolSize"),bC(this.strides,"strides"),this.padding=null==e.padding?"valid":e.padding,this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,EC(this.dataFormat),RC(this.padding),this.inputSpec=[new PI({ndim:5})]}computeOutputShape(e){e=OI(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=K_(t,this.poolSize[0],this.padding,this.strides[0]),n=K_(n,this.poolSize[1],this.padding,this.strides[1]),r=K_(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 rf((()=>(this.invokeCallHook(e,t),this.poolingFunction($I(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 hN extends dN{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return EC(a),RC(r),aN(e,t,n,r,a,"max")}}hN.className="MaxPooling3D",kx(hN);class pN extends dN{constructor(e){super(e)}poolingFunction(e,t,n,r,a){return EC(a),RC(r),aN(e,t,n,r,a,"avg")}}pN.className="AveragePooling3D",kx(pN);class fN extends HI{constructor(e){super(e),this.inputSpec=[new PI({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new YS}}class mN extends fN{constructor(e){super(e||{})}call(e,t){return rf((()=>{const t=$I(e);return Hy(t,1)}))}}mN.className="GlobalAveragePooling1D",kx(mN);class gN extends fN{constructor(e){super(e||{})}call(e,t){return rf((()=>{const t=$I(e);return Xg(t,1)}))}}gN.className="GlobalMaxPooling1D",kx(gN);class yN extends HI{constructor(e){super(e),this.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,EC(this.dataFormat),this.inputSpec=[new PI({ndim:4})]}computeOutputShape(e){return"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new YS}getConfig(){const e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class bN extends yN{call(e,t){return rf((()=>{const t=$I(e);return"channelsLast"===this.dataFormat?Hy(t,[1,2]):Hy(t,[2,3])}))}}bN.className="GlobalAveragePooling2D",kx(bN);class vN extends yN{call(e,t){return rf((()=>{const t=$I(e);return"channelsLast"===this.dataFormat?Xg(t,[1,2]):Xg(t,[2,3])}))}}vN.className="GlobalMaxPooling2D",kx(vN);
/**
 * @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 AN extends HI{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=wW(t.layer,n);delete t.layer;const a={layer:r};return Object.assign(a,t),new e(a)}}class xN extends AN{constructor(e){super(e),this.supportsMasking=!0}build(e){if((e=OI(e)).length<3)throw new JS(`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=OI(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 rf((()=>mT(((e,n)=>[$I(this.layer.call(e,t)),[]]),e=$I(e),[],!1,null,null,!1,!0)[1]))}}xN.className="TimeDistributed",kx(xN);class kN extends AN{constructor(e){super(e);const t=e.layer.getConfig(),n={};n.className=e.layer.getClassName(),n.config=t,this.forwardLayer=wW(n),t.goBackwards=!0!==t.goBackwards;const r={};var a;if(r.className=e.layer.getClassName(),r.config=t,this.backwardLayer=wW(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,gC(TC,"BidirectionalMergeMode",a),e.weights)throw new YS("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()):sC(n)}apply(e,t){let n=null==t?null:t.initialState,r=null==t?null:t.constants;null==t&&(t={});const a=fT(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 JS("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 PI({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 YS("Support for constants in Bidirectional layers is not implemented yet.");const o=s[0]instanceof zI;for(const l of s)if(l instanceof zI!==o)throw new JS("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 rf((()=>{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=sv(a,1)),"concat"===this.mergeMode?i=JC([r,a]):"sum"===this.mergeMode?i=um(r,a):"ave"===this.mergeMode?i=hm(.5,um(r,a)):"mul"===this.mergeMode?i=hm(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){DC(this.forwardLayer.name,(()=>{this.forwardLayer.build(e)})),DC(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=wW(t.layer);if(delete t.layer,null!=t.numConstants)throw new YS("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");const r=t;return r.layer=n,new e(r)}}kN.className="Bidirectional",kx(kN);
/**
 * @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 wN extends HI{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 rf((()=>("float32"!==(e=$I(e)).dtype&&(e=qC(e,"float32")),um(hm(e,this.scale),this.offset))))}}wN.className="Rescaling",kx(wN);
/**
 * @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:SN,cropAndResize:CN}=px;class IN extends HI{constructor(e){super(e),this.height=e.height,this.width=e.width}centerCrop(e,t,n,r,a,s,i,o){return rf((()=>{let l,u=!1;const c=[t/s,n/i,(r+t)/s,(a+n)/i],d=[];3===e.rank?(u=!0,l=Nv([e])):l=e;for(let e=0;e<l.shape[0];e++)d.push(c);const h=Jp(d,[d.length,4]),p=ev(0,d.length,1,"int32"),f=CN(l,h,p,[r,a],"nearest");return qC(u?$I(Xv(f)):f,o)}))}upsize(e,t,n,r){return rf((()=>qC(SN(e,[t,n]),r)))}call(e,t){return rf((()=>{const t=$I(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=OI(e)).length-3,n=e.length-2;return e[t]=this.height,e[n]=this.width,e}}IN.className="CenterCrop",kx(IN);
/**
 * @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 WN extends HI{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=OI(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 rf((()=>{let n;if("int32"!==(e=$I(e)).dtype&&(e=qC(e,"int32")),void 0!==t.countWeights){if("count"!==this.outputMode)throw new JS(`countWeights is not used when outputMode !== count.\n              Received countWeights=${t.countWeights}`);n=$I(t.countWeights)}const r=Xg(e),a=Zg(e),s=hy(this.numTokens,r).bufferSync().get(0),i=py(a,0).bufferSync().get(0);if(!s||!i)throw new JS(`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=$I(e);if("int32"!==a.dtype&&(a=qC(a,"int32")),"int"===t)return a;const s=a.shape;if(0===a.rank&&(a=iy(a,-1)),"oneHot"===t&&1!==a.shape[a.shape.length-1]&&(a=iy(a,-1)),a.rank>2)throw new JS(`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=wg(a,void 0!==r&&"count"===t?r:[],n,i),"tfIdf"!==t)return o;if(r)return hm(o,r);throw new JS("When outputMode is 'tfIdf', weights must be provided.")}(e,this.outputMode,this.numTokens,n)}))}}WN.className="CategoryEncoding",kx(WN);
/**
 * @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 _N=new Set(["bilinear","nearest"]);class TN extends HI{constructor(e){if(super(e),this.height=e.height,this.width=e.width,e.interpolation){if(!_N.has(e.interpolation))throw new JS(`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=OI(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 rf((()=>{const t=[this.height,this.width];if("bilinear"===this.interpolation)return px.resizeBilinear(e,t,!this.cropToAspectRatio);if("nearest"===this.interpolation)return px.resizeNearestNeighbor(e,t,!this.cropToAspectRatio);throw new Error(`Interpolation is ${this.interpolation} but only ${[..._N]} are supported`)}))}}TN.className="Resizing",kx(TN);
/**
 * @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 NN{constructor(e){this.seed=e}next(){if(void 0!==this.seed)return this.seed++}}NN.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 EN extends HI{constructor(e){super(e),this.randomGenerator=new NN(e.seed)}getConfig(){const e={seed:this.randomGenerator.seed},t=super.getConfig();return Object.assign(e,t),e}}EN.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 RN=new Set(["bilinear","nearest"]);class $N extends EN{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 JS(`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 JS(`factor must have values larger than -1. Got: ${this.factor}`);if(this.widthUpper<this.widthLower)throw new JS(`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(!RN.has(n))throw new JS(`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=OI(e))[2];return[this.imgHeight,-1,t]}call(e,t){return rf((()=>{const t=$I(e);this.imgHeight=t.shape[t.shape.length-3];const n=t.shape[t.shape.length-2];this.widthFactor=Jb([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 px.resizeBilinear(e,a);case"nearest":return px.resizeNearestNeighbor(e,a);default:throw new Error(`Interpolation is ${this.interpolation}\n          but only ${[...RN]} are supported`)}}))}}$N.className="RandomWidth",kx($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.
 *
 * =============================================================================
 */
var ON,FN,DN,MN,LN;_l().registerFlag("KEEP_INTERMEDIATE_TENSORS",(()=>!1),(e=>{})),(FN=ON||(ON={}))[FN.DT_INVALID=0]="DT_INVALID",FN[FN.DT_FLOAT=1]="DT_FLOAT",FN[FN.DT_DOUBLE=2]="DT_DOUBLE",FN[FN.DT_INT32=3]="DT_INT32",FN[FN.DT_UINT8=4]="DT_UINT8",FN[FN.DT_INT16=5]="DT_INT16",FN[FN.DT_INT8=6]="DT_INT8",FN[FN.DT_STRING=7]="DT_STRING",FN[FN.DT_COMPLEX64=8]="DT_COMPLEX64",FN[FN.DT_INT64=9]="DT_INT64",FN[FN.DT_BOOL=10]="DT_BOOL",FN[FN.DT_QINT8=11]="DT_QINT8",FN[FN.DT_QUINT8=12]="DT_QUINT8",FN[FN.DT_QINT32=13]="DT_QINT32",FN[FN.DT_BFLOAT16=14]="DT_BFLOAT16",FN[FN.DT_QINT16=15]="DT_QINT16",FN[FN.DT_QUINT16=16]="DT_QUINT16",FN[FN.DT_UINT16=17]="DT_UINT16",FN[FN.DT_COMPLEX128=18]="DT_COMPLEX128",FN[FN.DT_HALF=19]="DT_HALF",FN[FN.DT_RESOURCE=20]="DT_RESOURCE",FN[FN.DT_VARIANT=21]="DT_VARIANT",FN[FN.DT_UINT32=22]="DT_UINT32",FN[FN.DT_UINT64=23]="DT_UINT64",FN[FN.DT_FLOAT_REF=101]="DT_FLOAT_REF",FN[FN.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",FN[FN.DT_INT32_REF=103]="DT_INT32_REF",FN[FN.DT_UINT8_REF=104]="DT_UINT8_REF",FN[FN.DT_INT16_REF=105]="DT_INT16_REF",FN[FN.DT_INT8_REF=106]="DT_INT8_REF",FN[FN.DT_STRING_REF=107]="DT_STRING_REF",FN[FN.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",FN[FN.DT_INT64_REF=109]="DT_INT64_REF",FN[FN.DT_BOOL_REF=110]="DT_BOOL_REF",FN[FN.DT_QINT8_REF=111]="DT_QINT8_REF",FN[FN.DT_QUINT8_REF=112]="DT_QUINT8_REF",FN[FN.DT_QINT32_REF=113]="DT_QINT32_REF",FN[FN.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",FN[FN.DT_QINT16_REF=115]="DT_QINT16_REF",FN[FN.DT_QUINT16_REF=116]="DT_QUINT16_REF",FN[FN.DT_UINT16_REF=117]="DT_UINT16_REF",FN[FN.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",FN[FN.DT_HALF_REF=119]="DT_HALF_REF",FN[FN.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",FN[FN.DT_VARIANT_REF=121]="DT_VARIANT_REF",FN[FN.DT_UINT32_REF=122]="DT_UINT32_REF",FN[FN.DT_UINT64_REF=123]="DT_UINT64_REF",MN=DN||(DN={}),(LN=MN.CheckpointFormatVersion||(MN.CheckpointFormatVersion={}))[LN.LEGACY=0]="LEGACY",LN[LN.V1=1]="V1",LN[LN.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 BN={};function PN(e){return BN[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 zN(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 GN(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=>GN(e,n,r,a)))}const l=GN(t.inputNames[o],n,r,a),u=l.dataSync();return"number"===s.type?u[0]:gl(l.shape,u)}const i=t.attrParams[e];return i&&i.value}function GN(e,t,n,r){const[a,s]=jN(e,n);if(null!=r){const e=r.getHashTableHandleByName(a);if(null!=e)return e}const i=n.currentContextIds.find((e=>!!t[HN(a,e)]));return void 0!==i?t[HN(a,i)][s]:void 0}function VN(e,t,n){return t[HN(e,n.currentContextId)]}function UN(e,t){const[n,r,a]=jN(e,t);return[HN(n,t&&t.currentContextId),r,a]}function HN(e,t){return t?`${e}-${t}`:e}function jN(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 qN(e,t,n){let r=zN("pad",e,t,n);if("explicit"===r){r=zN("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 QN(e){return e.kept?e:om(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 XN=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"})),ZN=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"})),KN=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"})),JN=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"})),YN=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"})),eE=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"})),tE=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"})),nE=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"})),rE=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"})),aE=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"})),sE=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"})),iE=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"})),oE=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"})),lE=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"})),uE=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"})),cE=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"})),dE=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"})),hE=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"})),pE=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 fE{static get Instance(){return this._instance||(this._instance=new this)}constructor(){const e=[].concat(...[XN,ZN,KN,JN,YN,eE,tE,nE,rE,aE,sE,iE,oE,lE,uE,cE,dE,hE,pE].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]=UN(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]=UN(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]=UN(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=PN(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=gE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=gE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"string[]":a=IE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=IE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number":a=bE(e.attr,n.tfName,n.defaultValue||0),void 0===a&&n.tfDeprecatedName&&(a=bE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number[]":a=CE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=CE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool":a=yE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=yE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool[]":a=_E(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=_E(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape":a=SE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=SE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape[]":a=WE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=WE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype":a=xE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=xE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype[]":a=kE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=kE(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"func":a=AE(e.attr,n.tfName,n.defaultValue),void 0===a&&n.tfDeprecatedName&&(a=AE(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]=UN(e.name),n={name:t,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:vE(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]=UN(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]=UN(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 mE(e,t){const n=Array.isArray(e)?String.fromCharCode.apply(null,e):function(e){const t=_l().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 gE(e,t,n,r=!1){const a=e[t];return null!=a?mE(a.s,r):n}function yE(e,t,n){const r=e[t];return r?r.b:n}function bE(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 vE(e){switch("string"==typeof e&&(e=ON[e]),e){case ON.DT_FLOAT:case ON.DT_HALF:return"float32";case ON.DT_INT32:case ON.DT_INT64:case ON.DT_INT8:case ON.DT_UINT8:return"int32";case ON.DT_BOOL:return"bool";case ON.DT_DOUBLE:return"float32";case ON.DT_STRING:return"string";default:return null}}function AE(e,t,n){const r=e[t];return r&&r.func?r.func.name:n}function xE(e,t,n){const r=e[t];return r&&r.type?vE(r.type):n}function kE(e,t,n){const r=e[t];return r&&r.list&&r.list.type?r.list.type.map((e=>vE(e))):n}function wE(e){if(!e.unknownRank)return null!=e.dim?e.dim.map((e=>"number"==typeof e.size?e.size:parseInt(e.size,10))):[]}function SE(e,t,n){const r=e[t];return r&&r.shape?wE(r.shape):n}function CE(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 IE(e,t,n,r=!1){const a=e[t];return a&&a.list&&a.list.s?a.list.s.map((e=>mE(e,r))):n}function WE(e,t,n){const r=e[t];return r&&r.list&&r.list.shape?r.list.shape.map((e=>wE(e))):n}function _E(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 TE{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 GN(e,this.tensorMap,this.context)}getAttr(e,t){const n=this.node.rawAttrs[e];if(null!=n.tensor)return GN(e,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return bE(this.node.rawAttrs,e,t);if(null!=n.s)return gE(this.node.rawAttrs,e,t);if(null!=n.b)return yE(this.node.rawAttrs,e,t);if(null!=n.shape)return SE(this.node.rawAttrs,e,t);if(null!=n.type)return xE(this.node.rawAttrs,e,t);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return CE(this.node.rawAttrs,e,t);if(null!=n.list.s)return IE(this.node.rawAttrs,e,t);if(null!=n.list.shape)return WE(this.node.rawAttrs,e,t);if(null!=n.list.b)return _E(this.node.rawAttrs,e,t);if(null!=n.list.type)return kE(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 NE=Object.freeze(Object.defineProperty({__proto__:null,OP_SCOPE_SUFFIX:Qp,abs:pm,acos:fm,acosh:mm,add:um,addN:gm,all:ym,any:bm,argMax:vm,argMin:Am,asin:xm,asinh:km,atan:wm,atan2:Sm,atanh:Cm,avgPool:Gm,avgPool3d:Vm,basicLSTMCell:Xm,batchNorm:Km,batchNorm2d:Jm,batchNorm3d:Ym,batchNorm4d:eg,batchToSpaceND:Zm,bincount:tg,bitwiseAnd:ng,booleanMaskAsync:eA,broadcastArgs:rg,broadcastTo:ag,buffer:sm,cast:im,ceil:sg,clipByValue:og,clone:om,complex:Zp,concat:Um,concat1d:lg,concat2d:ug,concat3d:cg,concat4d:dg,conv1d:pg,conv2d:hg,conv2dTranspose:mg,conv3d:gg,conv3dTranspose:bg,cos:vg,cosh:Ag,cosineWindow:lA,cumprod:xg,cumsum:kg,denseBincount:wg,depthToSpace:Sg,depthwiseConv2d:Cg,diag:Ig,dilation2d:Wg,div:dm,divNoNan:Fg,dot:Dg,dropout:iA,einsum:Mg,elu:Lg,enclosingPowerOfTwo:oA,ensureShape:Bg,equal:Rg,erf:Pg,euclideanNorm:ay,exp:sy,expandDims:iy,expm1:oy,eye:uy,fft:wv,fill:ig,floor:cy,floorDiv:cm,fused:AA,gather:dy,gatherND:sA,greater:hy,greaterEqual:py,ifft:Sv,imag:fy,image:px,inTopKAsync:uA,irfft:Cv,isFinite:my,isInf:gy,isNaN:yy,leakyRelu:by,less:vy,lessEqual:Ay,linalg:fx,linspace:xy,localResponseNormalization:ky,log:wy,log1p:Sy,logSigmoid:Ny,logSoftmax:Ry,logSumExp:$y,logicalAnd:Oy,logicalNot:Fy,logicalOr:Dy,logicalXor:My,losses:mx,lowerBound:Py,matMul:Hm,max:Xg,maxPool:zy,maxPool3d:Gy,maxPoolWithArgmax:Vy,maximum:Uy,mean:Hy,meshgrid:Qy,min:Zg,minimum:Xy,mirrorPad:Zy,mod:Ky,moments:Jy,movingAverage:nA,mul:hm,multiRNNCell:Yy,multinomial:eb,neg:_y,norm:ry,notEqual:tb,oneHot:nb,ones:qy,onesLike:rb,op:Xp,outerProduct:ab,pad:sb,pad1d:ib,pad2d:ob,pad3d:lb,pad4d:ub,pool:db,pow:Kg,prelu:hb,print:lm,prod:pb,raggedGather:fb,raggedRange:mb,raggedTensorToTensor:gb,rand:yb,randomGamma:Xb,randomNormal:Zb,randomStandardNormal:Kb,randomUniform:Jb,randomUniformInt:Yb,range:ev,real:tv,reciprocal:nv,relu:rv,relu6:av,reshape:zm,reverse:sv,reverse1d:iv,reverse2d:ov,reverse3d:lv,reverse4d:uv,rfft:Wv,round:cv,rsqrt:dv,scalar:Jg,scatterND:rA,searchSorted:By,selu:hv,separableConv2d:pv,setdiff1dAsync:fv,sigmoid:jm,sign:mv,signal:hx,sin:gv,sinh:yv,slice:qm,slice1d:bv,slice2d:vv,slice3d:Av,slice4d:xv,softmax:kv,softplus:Ty,spaceToBatchND:cb,sparse:gx,sparseToDense:aA,spectral:dx,split:Iv,sqrt:Yg,square:ey,squaredDifference:_v,squeeze:Tv,stack:Nv,step:Ev,stridedSlice:Rv,string:yx,sub:Ey,sum:ty,tan:$v,tanh:Qm,tensor:Jp,tensor1d:Ov,tensor2d:Fv,tensor3d:Dv,tensor4d:Mv,tensor5d:Lv,tensor6d:Bv,tensorScatterUpdate:Uv,tile:ly,topk:Hv,transpose:tA,truncatedNormal:jv,unique:qv,unsortedSegmentSum:Qv,unstack:Xv,upperBound:Zv,variable:Kv,where:$g,whereAsync:Yv,zeros:jy,zerosLike:Og},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 EE(e,t,n=""){if("number"!=typeof e&&"number"!=typeof t){Go(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];Go(a<0||s<0||a===s,(()=>n+` Shapes ${e} and ${t} must match`))}}}function RE(e){return"number"!=typeof e&&!e.some((e=>e<0))}function $E(e,t,n){let r=OE(e,n);const a=!RE(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=OE(e.shape,r)})),!RE(r))throw new Error(`Non-fully-defined elementShape: ${r}`);return r}function OE(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 FE{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=Jg(0),sf(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),EE(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,sf(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 Jp([],[0].concat(this.elementShape));const n=this.readMany(e);return EE(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),Nv(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 Jp([],[0].concat(this.elementShape));const t=[];for(let r=0;r<this.size();r++)t.push(r);const n=this.readMany(t);return EE(this.elementShape,n[0].shape,`TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${n[0].shape})`),Um(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,Xv(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=[];rf((()=>{t=zm(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]=zm(qm(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 DE{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}`);EE(t,e.shape,"TensorList shape mismatch: "),sf(e)})),this.idTensor=Jg(0),this.maxNumElements=r,sf(this.idTensor)}copy(){return new DE([...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.`);EE(e,this.elementShape,"TensorList shape mismatch: ");const r=$E(this.elementShape,this.tensors,e);return rf((()=>{const e=this.tensors.map((e=>zm(e,r)));return Nv(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=$E(this.elementShape,this.tensors,e),r=this.tensors.pop();return r.kept=!1,EE(r.shape,e,"TensorList shape mismatch: "),zm(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(EE(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");sf(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 DE([],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.`);EE(this.tensors[e].shape,t,"TensorList shape mismatch: ");const r=$E(this.elementShape,this.tensors,t);return zm(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.`);EE(this.elementShape,t.shape,"TensorList shape mismatch: "),sf(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}`);EE(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());const r=$E(this.elementShape,this.tensors,n);return 0===e.length?Jp([],[0].concat(r)):rf((()=>{const t=e.map((e=>zm(this.tensors[e],r)));return Nv(t,0)}))}concat(e,t){if(e&&e!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${e}`);EE(this.elementShape,t,"TensorList shape mismatch: ");const n=$E(this.elementShape,this.tensors,t);return 0===this.size()?Jp([],[0].concat(n)):rf((()=>{const e=this.tensors.map((e=>zm(e,n)));return Um(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 ME=async(e,t,n)=>{switch(e.op){case"If":case"StatelessIf":{const r=zN("thenBranch",e,t,n),a=zN("elseBranch",e,t,n),s=zN("cond",e,t,n),i=zN("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=zN("body",e,t,n),a=zN("cond",e,t,n),s=zN("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[QN(zN("pred",e,t,n))];case"Switch":{const r=zN("pred",e,t,n);let a=zN("data",e,t,n);return a.kept||(a=QN(a)),(await r.data())[0]?[void 0,a]:[a,void 0]}case"Merge":{const r=e.inputNames.find((e=>void 0!==GN(e,t,n)));if(r){return[QN(GN(r,t,n))]}return}case"Enter":{const r=zN("frameName",e,t,n),a=zN("tensor",e,t,n);return n.enterFrame(r),[QN(a)]}case"Exit":{const r=zN("tensor",e,t,n);return n.exitFrame(),[QN(r)]}case"NextIteration":{const r=zN("tensor",e,t,n);return n.nextIteration(),[QN(r)]}case"TensorArrayV3":{const r=zN("size",e,t,n),a=zN("dtype",e,t,n),s=zN("elementShape",e,t,n),i=zN("dynamicSize",e,t,n),o=zN("clearAfterRead",e,t,n),l=zN("identicalElementShapes",e,t,n),u=zN("name",e,t,n),c=new FE(u,a,r,s,l,i,o);return n.addTensorArray(c),[c.idTensor,Jg(1)]}case"TensorArrayWriteV3":{const r=zN("tensorArrayId",e,t,n),a=zN("index",e,t,n),s=zN("tensor",e,t,n),i=n.getTensorArray(r.id);return i.write(a,s),[i.idTensor]}case"TensorArrayReadV3":{const r=zN("tensorArrayId",e,t,n),a=zN("index",e,t,n);return[n.getTensorArray(r.id).read(a)]}case"TensorArrayGatherV3":{const r=zN("tensorArrayId",e,t,n),a=zN("indices",e,t,n),s=zN("dtype",e,t,n);return[n.getTensorArray(r.id).gather(a,s)]}case"TensorArrayScatterV3":{const r=zN("tensorArrayId",e,t,n),a=zN("indices",e,t,n),s=zN("tensor",e,t,n),i=n.getTensorArray(r.id);return i.scatter(a,s),[i.idTensor]}case"TensorArrayConcatV3":{const r=zN("tensorArrayId",e,t,n),a=n.getTensorArray(r.id),s=zN("dtype",e,t,n);return[a.concat(s)]}case"TensorArraySplitV3":{const r=zN("tensorArrayId",e,t,n),a=zN("tensor",e,t,n),s=zN("lengths",e,t,n),i=n.getTensorArray(r.id);return i.split(s,a),[i.idTensor]}case"TensorArraySizeV3":{const r=zN("tensorArrayId",e,t,n);return[Jg(n.getTensorArray(r.id).size(),"int32")]}case"TensorArrayCloseV3":{const r=zN("tensorArrayId",e,t,n),a=n.getTensorArray(r.id);return a.clearAndClose(),[a.idTensor]}case"TensorListSetItem":{const r=zN("tensorListId",e,t,n),a=zN("index",e,t,n),s=zN("tensor",e,t,n),i=n.getTensorList(r.id);return i.setItem(a,s),[i.idTensor]}case"TensorListGetItem":{const r=zN("tensorListId",e,t,n),a=zN("index",e,t,n),s=zN("elementShape",e,t,n),i=zN("elementDType",e,t,n);return[n.getTensorList(r.id).getItem(a,s,i)]}case"TensorListScatterV2":case"TensorListScatter":{const r=zN("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 DE([],n,e.dtype,r),i=Xv(e,0);return t.forEach(((e,t)=>{s.setItem(e,i[t])})),s}(zN("tensor",e,t,n),r,zN("elementShape",e,t,n),zN("numElements",e,t,n));return n.addTensorList(a),[a.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const r=zN("elementShape",e,t,n),a=zN("elementDType",e,t,n);let s;s="TensorListReserve"===e.op?"numElements":"maxNumElements";const i=zN(s,e,t,n),o=function(e,t,n,r){return new DE([],e,t,r)}(r,a,0,"TensorListReserve"===e.op?-1:i);return n.addTensorList(o),[o.idTensor]}case"TensorListGather":{const r=zN("tensorListId",e,t,n),a=zN("indices",e,t,n),s=zN("elementShape",e,t,n),i=zN("elementDType",e,t,n);return[n.getTensorList(r.id).gather(a,i,s)]}case"TensorListStack":{const r=zN("tensorListId",e,t,n),a=zN("elementShape",e,t,n),s=zN("elementDType",e,t,n),i=zN("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}`);EE(e.shape.slice(1),t,"TensorList shape mismatch: ");const a=Xv(e);return new DE(a,t,r)}(zN("tensor",e,t,n),zN("elementShape",e,t,n),zN("elementDType",e,t,n));return n.addTensorList(r),[r.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{const r=zN("tensorListId",e,t,n),a=n.getTensorList(r.id),s=zN("dtype",e,t,n),i=zN("elementShape",e,t,n);return[a.concat(s,i)]}case"TensorListPushBack":{const r=zN("tensorListId",e,t,n),a=zN("tensor",e,t,n),s=n.getTensorList(r.id);return s.pushBack(a),[s.idTensor]}case"TensorListPopBack":{const r=zN("tensorListId",e,t,n),a=zN("elementShape",e,t,n),s=zN("elementDType",e,t,n);return[n.getTensorList(r.id).popBack(a,s)]}case"TensorListSplit":{const r=zN("tensor",e,t,n),a=zN("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=OE(e.shape.slice(1),n),i=0===r?0:e.size/r,o=rf((()=>{const n=[];e=zm(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]=zm(qm(e,o,l),s)}return e.dispose(),n})),l=new DE([],n,e.dtype,t.length);for(let u=0;u<o.length;u++)l.setItem(u,o[u]);return l}(r,zN("lengths",e,t,n),a);return n.addTensorList(s),[s.idTensor]}case"TensorListLength":{const r=zN("tensorListId",e,t,n);return[Jg(n.getTensorList(r.id).size(),"int32")]}case"TensorListResize":{const r=zN("tensorListId",e,t,n),a=zN("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 LE(e,t,n){const[r,a]=zN("fusedOps",e,t,n),s="biasadd"===r,i=!s,o="prelu"===a,l="fusedbatchnorm"===r,u=zN("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=zN("strides",e,t,n),d=qN(e,t,n),h=zN("dataFormat",e,t,n).toUpperCase(),p=zN("dilations",e,t,n);let[f,m]=zN("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:zN("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 BE(e,t,n){return{boxes:zN("boxes",e,t,n),scores:zN("scores",e,t,n),maxOutputSize:zN("maxOutputSize",e,t,n),iouThreshold:zN("iouThreshold",e,t,n),scoreThreshold:zN("scoreThreshold",e,t,n),softNmsSigma:zN("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 PE{get id(){return this.handle.id}constructor(e,t){this.keyDType=e,this.valueDType=t,this.handle=Jg(0),this.tensorMap=new Map,sf(this.handle)}clearAndClose(){this.tensorMap.forEach((e=>e.dispose())),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return Jg(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(),rf((()=>{const e=Xv(t),r=n.length,a=e.length;Go(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];sf(a),this.tensorMap.set(r,a)}return this.handle}))}async find(e,t){this.checkKeyAndValueTensor(e,t);const n=await e.data();return rf((()=>{const e=[];for(let r=0;r<n.length;r++){const a=n[r],s=this.findWithDefault(a,t);e.push(s)}return Nv(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 zE(e,t,n,r,a=rf){const s=((e,t,n)=>{switch(e.category){case"arithmetic":return a((()=>((e,t,n,r=NE)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[r.add(zN("a",e,t,n),zN("b",e,t,n))];case"AddN":return[r.addN(zN("tensors",e,t,n))];case"FloorMod":case"Mod":return[r.mod(zN("a",e,t,n),zN("b",e,t,n))];case"Mul":return[r.mul(zN("a",e,t,n),zN("b",e,t,n))];case"RealDiv":case"Div":return[r.div(zN("a",e,t,n),zN("b",e,t,n))];case"DivNoNan":return[r.divNoNan(zN("a",e,t,n),zN("b",e,t,n))];case"FloorDiv":return[r.floorDiv(zN("a",e,t,n),zN("b",e,t,n))];case"Sub":return[r.sub(zN("a",e,t,n),zN("b",e,t,n))];case"Minimum":return[r.minimum(zN("a",e,t,n),zN("b",e,t,n))];case"Maximum":return[r.maximum(zN("a",e,t,n),zN("b",e,t,n))];case"Pow":return[r.pow(zN("a",e,t,n),zN("b",e,t,n))];case"SquaredDifference":return[r.squaredDifference(zN("a",e,t,n),zN("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=NE)=>{switch(e.op){case"Abs":case"ComplexAbs":return[r.abs(zN("x",e,t,n))];case"Acos":return[r.acos(zN("x",e,t,n))];case"Acosh":return[r.acosh(zN("x",e,t,n))];case"Asin":return[r.asin(zN("x",e,t,n))];case"Asinh":return[r.asinh(zN("x",e,t,n))];case"Atan":return[r.atan(zN("x",e,t,n))];case"Atan2":return[r.atan2(zN("x",e,t,n),zN("y",e,t,n))];case"Atanh":return[r.atanh(zN("x",e,t,n))];case"Ceil":return[r.ceil(zN("x",e,t,n))];case"Complex":return[r.complex(zN("real",e,t,n),zN("imag",e,t,n))];case"Cos":return[r.cos(zN("x",e,t,n))];case"Cosh":return[r.cosh(zN("x",e,t,n))];case"Elu":return[r.elu(zN("x",e,t,n))];case"Erf":return[r.erf(zN("x",e,t,n))];case"Exp":return[r.exp(zN("x",e,t,n))];case"Expm1":return[r.expm1(zN("x",e,t,n))];case"Floor":return[r.floor(zN("x",e,t,n))];case"Log":return[r.log(zN("x",e,t,n))];case"Log1p":return[r.log1p(zN("x",e,t,n))];case"Imag":return[r.imag(zN("x",e,t,n))];case"Neg":return[r.neg(zN("x",e,t,n))];case"Reciprocal":return[r.reciprocal(zN("x",e,t,n))];case"Real":return[r.real(zN("x",e,t,n))];case"Relu":return[r.relu(zN("x",e,t,n))];case"Round":return[r.round(zN("x",e,t,n))];case"Selu":return[r.selu(zN("x",e,t,n))];case"Sigmoid":return[r.sigmoid(zN("x",e,t,n))];case"Sin":return[r.sin(zN("x",e,t,n))];case"Sign":return[r.sign(zN("x",e,t,n))];case"Sinh":return[r.sinh(zN("x",e,t,n))];case"Softplus":return[r.softplus(zN("x",e,t,n))];case"Sqrt":return[r.sqrt(zN("x",e,t,n))];case"Square":return[r.square(zN("x",e,t,n))];case"Tanh":return[r.tanh(zN("x",e,t,n))];case"Tan":return[r.tan(zN("x",e,t,n))];case"ClipByValue":return[r.clipByValue(zN("x",e,t,n),zN("clipValueMin",e,t,n),zN("clipValueMax",e,t,n))];case"Relu6":return[r.relu6(zN("x",e,t,n))];case"Rsqrt":return[r.rsqrt(GN(e.inputNames[0],t,n))];case"LeakyRelu":return[r.leakyRelu(zN("x",e,t,n),zN("alpha",e,t,n))];case"Prelu":return[r.prelu(zN("x",e,t,n),zN("alpha",e,t,n))];case"IsNan":return[r.isNaN(GN(e.inputNames[0],t,n))];case"IsInf":return[r.isInf(GN(e.inputNames[0],t,n))];case"IsFinite":return[r.isFinite(GN(e.inputNames[0],t,n))];default:throw TypeError(`Node type ${e.op} is not implemented`)}})(e,t,n)));case"control":return ME(e,t,n);case"convolution":return a((()=>((e,t,n,r=NE)=>{switch(e.op){case"Conv1D":{const a=zN("stride",e,t,n),s=zN("pad",e,t,n),i=zN("dataFormat",e,t,n).toUpperCase(),o=zN("dilation",e,t,n);return[r.conv1d(zN("x",e,t,n),zN("filter",e,t,n),a,s,i,o)]}case"Conv2D":{const a=zN("strides",e,t,n),s=qN(e,t,n),i=zN("dataFormat",e,t,n).toUpperCase(),o=zN("dilations",e,t,n);return[r.conv2d(zN("x",e,t,n),zN("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}=LE(e,t,n);return[r.fused.conv2d({x:zN("x",e,t,n),filter:zN("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}=LE(e,t,n);return[r.fused.depthwiseConv2d({x:zN("x",e,t,n),filter:zN("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=zN("outputShape",e,t,n),s=zN("strides",e,t,n),i=qN(e,t,n);return[r.conv2dTranspose(zN("x",e,t,n),zN("filter",e,t,n),a,[s[1],s[2]],i)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const a=zN("strides",e,t,n),s=qN(e,t,n),i=zN("dilations",e,t,n),o=zN("dataFormat",e,t,n).toUpperCase();return[r.depthwiseConv2d(zN("input",e,t,n),zN("filter",e,t,n),[a[1],a[2]],s,o,[i[1],i[2]])]}case"Conv3D":{const a=zN("strides",e,t,n),s=zN("pad",e,t,n),i=zN("dataFormat",e,t,n).toUpperCase(),o=zN("dilations",e,t,n);return[r.conv3d(zN("x",e,t,n),zN("filter",e,t,n),[a[1],a[2],a[3]],s,i,[o[1],o[2],o[3]])]}case"AvgPool":{const a=zN("strides",e,t,n),s=zN("pad",e,t,n),i=zN("kernelSize",e,t,n);return[r.avgPool(zN("x",e,t,n),[i[1],i[2]],[a[1],a[2]],s)]}case"MaxPool":{const a=zN("strides",e,t,n),s=zN("pad",e,t,n),i=zN("kernelSize",e,t,n);return[r.maxPool(zN("x",e,t,n),[i[1],i[2]],[a[1],a[2]],s)]}case"MaxPoolWithArgmax":{const a=zN("strides",e,t,n),s=zN("pad",e,t,n),i=zN("kernelSize",e,t,n),o=zN("includeBatchInIndex",e,t,n),{result:l,indexes:u}=r.maxPoolWithArgmax(zN("x",e,t,n),[i[1],i[2]],[a[1],a[2]],s,o);return[l,u]}case"AvgPool3D":{const a=zN("strides",e,t,n),s=zN("pad",e,t,n),i=zN("kernelSize",e,t,n);return[r.avgPool3d(zN("x",e,t,n),[i[1],i[2],i[3]],[a[1],a[2],a[3]],s)]}case"MaxPool3D":{const a=zN("strides",e,t,n),s=zN("pad",e,t,n),i=zN("kernelSize",e,t,n);return[r.maxPool3d(zN("x",e,t,n),[i[1],i[2],i[3]],[a[1],a[2],a[3]],s)]}case"Dilation2D":{const a=zN("strides",e,t,n),s=zN("pad",e,t,n),i=zN("dilations",e,t,n),o=a[1],l=a[2],u=i[1],c=i[2];return[r.dilation2d(zN("x",e,t,n),zN("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=NE)=>{switch(e.op){case"Fill":{const a=zN("shape",e,t,n),s=zN("dtype",e,t,n),i=zN("value",e,t,n);return[r.fill(a,i,s)]}case"LinSpace":{const a=zN("start",e,t,n),s=zN("stop",e,t,n),i=zN("num",e,t,n);return[r.linspace(a,s,i)]}case"Multinomial":{const a=zN("logits",e,t,n),s=zN("numSamples",e,t,n),i=zN("seed",e,t,n);return[r.multinomial(a,s,i)]}case"OneHot":{const a=zN("indices",e,t,n),s=zN("depth",e,t,n),i=zN("onValue",e,t,n),o=zN("offValue",e,t,n),l=zN("dtype",e,t,n);return[r.oneHot(a,s,i,o,l)]}case"Ones":return[r.ones(zN("shape",e,t,n),zN("dtype",e,t,n))];case"OnesLike":return[r.onesLike(zN("x",e,t,n))];case"RandomStandardNormal":return[r.randomStandardNormal(zN("shape",e,t,n),zN("dtype",e,t,n),zN("seed",e,t,n))];case"RandomUniform":return[r.randomUniform(zN("shape",e,t,n),zN("minval",e,t,n),zN("maxval",e,t,n),zN("dtype",e,t,n))];case"RandomUniformInt":return[r.randomUniformInt(zN("shape",e,t,n),zN("minval",e,t,n),zN("maxval",e,t,n),zN("seed",e,t,n))];case"Range":{const a=zN("start",e,t,n),s=zN("stop",e,t,n),i=zN("step",e,t,n);return[r.range(a,s,i,zN("dtype",e,t,n))]}case"TruncatedNormal":{const a=zN("shape",e,t,n),s=zN("mean",e,t,n),i=zN("stdDev",e,t,n),o=zN("seed",e,t,n);return[r.truncatedNormal(a,s,i,zN("dtype",e,t,n),o)]}case"Zeros":return[r.zeros(zN("shape",e,t,n),zN("dtype",e,t,n))];case"ZerosLike":return[r.zerosLike(zN("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=NE)=>{switch(e.op){case"NonMaxSuppressionV5":{const{boxes:r,scores:s,maxOutputSize:i,iouThreshold:o,scoreThreshold:l,softNmsSigma:u}=BE(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}=BE(e,t,n),u=zN("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}=BE(e,t,n);return[await a.image.nonMaxSuppressionAsync(r,s,i,o,l)]}case"Where":{const r=a.cast(zN("condition",e,t,n),"bool"),s=[await a.whereAsync(r)];return r.dispose(),s}case"ListDiff":return a.setdiff1dAsync(zN("x",e,t,n),zN("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=NE)=>{switch(e.op){case"LowerBound":{const a=zN("sortedSequence",e,t,n),s=zN("values",e,t,n);return[r.lowerBound(a,s)]}case"TopKV2":{const a=zN("x",e,t,n),s=zN("k",e,t,n),i=zN("sorted",e,t,n),o=r.topk(a,s,i);return[o.values,o.indices]}case"UpperBound":{const a=zN("sortedSequence",e,t,n),s=zN("values",e,t,n);return[r.upperBound(a,s)]}case"Unique":{const a=zN("x",e,t,n),s=r.unique(a);return[s.values,s.indices]}case"UniqueV2":{const a=zN("x",e,t,n),s=zN("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=NE)=>{switch(e.op){case"ResizeBilinear":{const a=zN("images",e,t,n),s=zN("size",e,t,n),i=zN("alignCorners",e,t,n),o=zN("halfPixelCenters",e,t,n);return[r.image.resizeBilinear(a,[s[0],s[1]],i,o)]}case"ResizeNearestNeighbor":{const a=zN("images",e,t,n),s=zN("size",e,t,n),i=zN("alignCorners",e,t,n),o=zN("halfPixelCenters",e,t,n);return[r.image.resizeNearestNeighbor(a,[s[0],s[1]],i,o)]}case"CropAndResize":{const a=zN("image",e,t,n),s=zN("boxes",e,t,n),i=zN("boxInd",e,t,n),o=zN("cropSize",e,t,n),l=zN("method",e,t,n),u=zN("extrapolationValue",e,t,n);return[r.image.cropAndResize(a,s,i,o,l,u)]}case"ImageProjectiveTransformV3":{const a=zN("images",e,t,n),s=zN("transforms",e,t,n),i=zN("outputShape",e,t,n),o=zN("fillValue",e,t,n),l=zN("interpolation",e,t,n),u=zN("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=NE)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":const a=zN("default",e,t,n);return[GN(e.name,t,n)||a];case"Placeholder":return[GN(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":case"Snapshot":return[QN(zN("x",e,t,n))];case"IdentityN":return zN("x",e,t,n).map((e=>QN(e)));case"Shape":return[r.tensor1d(zN("x",e,t,n).shape,"int32")];case"ShapeN":return zN("x",e,t,n).map((e=>r.tensor1d(e.shape)));case"Size":return[r.scalar(zN("x",e,t,n).size,"int32")];case"Rank":return[r.scalar(zN("x",e,t,n).rank,"int32")];case"NoOp":return[r.scalar(1)];case"Print":const s=zN("x",e,t,n),i=zN("data",e,t,n);zN("message",e,t,n),zN("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=NE)=>{switch(e.op){case"Equal":return[r.equal(zN("a",e,t,n),zN("b",e,t,n))];case"NotEqual":return[r.notEqual(zN("a",e,t,n),zN("b",e,t,n))];case"Greater":return[r.greater(zN("a",e,t,n),zN("b",e,t,n))];case"GreaterEqual":return[r.greaterEqual(zN("a",e,t,n),zN("b",e,t,n))];case"Less":return[r.less(zN("a",e,t,n),zN("b",e,t,n))];case"LessEqual":return[r.lessEqual(zN("a",e,t,n),zN("b",e,t,n))];case"LogicalAnd":return[r.logicalAnd(zN("a",e,t,n),zN("b",e,t,n))];case"LogicalNot":return[r.logicalNot(zN("a",e,t,n))];case"LogicalOr":return[r.logicalOr(zN("a",e,t,n),zN("b",e,t,n))];case"Select":case"SelectV2":return[r.where(zN("condition",e,t,n),zN("a",e,t,n),zN("b",e,t,n))];case"BitwiseAnd":return[r.bitwiseAnd(zN("a",e,t,n),zN("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=NE)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[r.matMul(zN("a",e,t,n),zN("b",e,t,n),zN("transposeA",e,t,n),zN("transposeB",e,t,n))];case"Einsum":return[r.einsum(zN("equation",e,t,n),...zN("tensors",e,t,n))];case"Transpose":return[r.transpose(zN("x",e,t,n),zN("perm",e,t,n))];case"_FusedMatMul":const[a,s]=zN("fusedOps",e,t,n),i="biasadd"===a,o="prelu"===s,l=zN("numArgs",e,t,n),u=zN("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]=zN("args",e,t,n);return[r.fused.matMul({a:zN("a",e,t,n),b:zN("b",e,t,n),transposeA:zN("transposeA",e,t,n),transposeB:zN("transposeB",e,t,n),bias:c,activation:s,preluActivationWeights:d,leakyreluAlpha:u})];case"MatrixBandPart":return[r.linalg.bandPart(zN("a",e,t,n),zN("numLower",e,t,n),zN("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=NE)=>{switch(e.op){case"EuclideanNorm":return[r.euclideanNorm(zN("x",e,t,n),zN("axis",e,t,n),zN("keepDims",e,t,n))];case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[r.batchNorm(zN("x",e,t,n),zN("mean",e,t,n),zN("variance",e,t,n),zN("offset",e,t,n),zN("scale",e,t,n),zN("epsilon",e,t,n))];case"LRN":return[r.localResponseNormalization(zN("x",e,t,n),zN("radius",e,t,n),zN("bias",e,t,n),zN("alpha",e,t,n),zN("beta",e,t,n))];case"Softmax":return[r.softmax(zN("x",e,t,n))];case"LogSoftmax":return[r.logSoftmax(zN("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=NE)=>{switch(e.op){case"RaggedGather":{const{outputNestedSplits:a,outputDenseValues:s}=r.raggedGather(zN("paramsNestedSplits",e,t,n),zN("paramsDenseValues",e,t,n),zN("indices",e,t,n),zN("outputRaggedRank",e,t,n));return a.concat(s)}case"RaggedRange":{const{rtNestedSplits:a,rtDenseValues:s}=r.raggedRange(zN("starts",e,t,n),zN("limits",e,t,n),zN("splits",e,t,n));return[a,s]}case"RaggedTensorToTensor":return[r.raggedTensorToTensor(zN("shape",e,t,n),zN("values",e,t,n),zN("defaultValue",e,t,n),zN("rowPartitionTensors",e,t,n),zN("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=NE)=>{switch(e.op){case"Max":{const a=zN("axis",e,t,n),s=zN("keepDims",e,t,n);return[r.max(zN("x",e,t,n),a,s)]}case"Mean":{const a=zN("axis",e,t,n),s=zN("keepDims",e,t,n);return[r.mean(zN("x",e,t,n),a,s)]}case"Min":{const a=zN("axis",e,t,n),s=zN("keepDims",e,t,n);return[r.min(zN("x",e,t,n),a,s)]}case"Sum":{const a=zN("axis",e,t,n),s=zN("keepDims",e,t,n);return[r.sum(zN("x",e,t,n),a,s)]}case"All":{const a=zN("axis",e,t,n),s=zN("keepDims",e,t,n);return[r.all(zN("x",e,t,n),a,s)]}case"Any":{const a=zN("axis",e,t,n),s=zN("keepDims",e,t,n);return[r.any(zN("x",e,t,n),a,s)]}case"ArgMax":{const a=zN("axis",e,t,n);return[r.argMax(zN("x",e,t,n),a)]}case"ArgMin":{const a=zN("axis",e,t,n);return[r.argMin(zN("x",e,t,n),a)]}case"Prod":{const a=zN("axis",e,t,n),s=zN("keepDims",e,t,n);return[r.prod(zN("x",e,t,n),a,s)]}case"Cumprod":{const a=zN("axis",e,t,n),s=zN("exclusive",e,t,n),i=zN("reverse",e,t,n);return[r.cumprod(zN("x",e,t,n),a,s,i)]}case"Cumsum":{const a=zN("axis",e,t,n),s=zN("exclusive",e,t,n),i=zN("reverse",e,t,n);return[r.cumsum(zN("x",e,t,n),a,s,i)]}case"Bincount":const a=zN("x",e,t,n),s=zN("weights",e,t,n),i=zN("size",e,t,n);return[r.bincount(a,s,i)];case"DenseBincount":{const a=zN("x",e,t,n),s=zN("weights",e,t,n),i=zN("size",e,t,n),o=zN("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=NE)=>{switch(e.op){case"ConcatV2":case"Concat":{const a=zN("n",e,t,n),s=zN("axis",e,t,n);let i=zN("tensors",e,t,n);return i=i.slice(0,a),[r.concat(i,s)]}case"Gather":{const a=zN("x",e,t,n),s=zN("indices",e,t,n);return[r.gather(a,r.cast(s,"int32"),0)]}case"GatherV2":{const a=zN("axis",e,t,n),s=zN("batchDims",e,t,n),i=zN("x",e,t,n),o=zN("indices",e,t,n);return[r.gather(i,r.cast(o,"int32"),a,s)]}case"Reverse":{const a=zN("dims",e,t,n),s=[];for(let e=0;e<a.length;e++)a[e]&&s.push(e);const i=zN("x",e,t,n);return[r.reverse(i,s)]}case"ReverseV2":{const a=zN("axis",e,t,n),s=zN("x",e,t,n);return[r.reverse(s,a)]}case"Slice":{const a=zN("begin",e,t,n),s=zN("size",e,t,n);return[r.slice(zN("x",e,t,n),a,s)]}case"StridedSlice":{const a=zN("begin",e,t,n),s=zN("end",e,t,n),i=zN("strides",e,t,n),o=zN("beginMask",e,t,n),l=zN("endMask",e,t,n),u=zN("ellipsisMask",e,t,n),c=zN("newAxisMask",e,t,n),d=zN("shrinkAxisMask",e,t,n),h=zN("x",e,t,n);return[r.stridedSlice(h,a,s,i,o,l,u,c,d)]}case"Pack":return rf((()=>{const a=zN("axis",e,t,n),s=zN("tensors",e,t,n),i=s[0].shape,o=r.squeeze(s[0]).shape,l=s.map((e=>{const t=qo(e.shape,i);if(!t&&!qo(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=zN("axis",e,t,n),s=zN("tensor",e,t,n);return r.unstack(s,a)}case"Tile":{const a=zN("reps",e,t,n);return[r.tile(zN("x",e,t,n),a)]}case"Split":case"SplitV":{const a=zN("axis",e,t,n),s=zN("numOrSizeSplits",e,t,n),i=zN("x",e,t,n);return r.split(i,s,a)}case"ScatterNd":{const a=zN("indices",e,t,n),s=zN("values",e,t,n),i=zN("shape",e,t,n);return[r.scatterND(a,s,i)]}case"GatherNd":{const a=zN("x",e,t,n),s=zN("indices",e,t,n);return[r.gatherND(a,s)]}case"SparseToDense":{const a=zN("sparseIndices",e,t,n),s=zN("outputShape",e,t,n),i=zN("sparseValues",e,t,n),o=zN("defaultValue",e,t,n);return[r.sparseToDense(a,i,s,i.dtype===o.dtype?o:r.cast(o,i.dtype))]}case"TensorScatterUpdate":{const a=zN("indices",e,t,n),s=zN("values",e,t,n),i=zN("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=NE)=>{switch(e.op){case"SparseFillEmptyRows":{const{outputIndices:a,outputValues:s,emptyRowIndicator:i,reverseIndexMap:o}=r.sparse.sparseFillEmptyRows(zN("indices",e,t,n),zN("values",e,t,n),zN("denseShape",e,t,n),zN("defaultValue",e,t,n));return[a,s,i,o]}case"SparseReshape":{const{outputIndices:a,outputShape:s}=r.sparse.sparseReshape(zN("inputIndices",e,t,n),zN("inputShape",e,t,n),zN("newShape",e,t,n));return[a,s]}case"SparseSegmentMean":return[r.sparse.sparseSegmentMean(zN("data",e,t,n),zN("indices",e,t,n),zN("segmentIds",e,t,n))];case"SparseSegmentSum":return[r.sparse.sparseSegmentSum(zN("data",e,t,n),zN("indices",e,t,n),zN("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=NE)=>{switch(e.op){case"FFT":return[r.fft(zN("x",e,t,n))];case"IFFT":return[r.ifft(zN("x",e,t,n))];case"RFFT":return[r.rfft(zN("x",e,t,n))];case"IRFFT":return[r.irfft(zN("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=NE)=>{switch(e.op){case"StaticRegexReplace":return[r.string.staticRegexReplace(zN("input",e,t,n),zN("pattern",e,t,n),zN("rewrite",e,t,n),zN("replaceGlobal",e,t,n))];case"StringNGrams":{const{nGrams:a,nGramsSplits:s}=r.string.stringNGrams(zN("data",e,t,n),zN("dataSplits",e,t,n),zN("separator",e,t,n),zN("nGramWidths",e,t,n),zN("leftPad",e,t,n),zN("rightPad",e,t,n),zN("padWidth",e,t,n),zN("preserveShortSequences",e,t,n));return[a,s]}case"StringSplit":{const{indices:a,values:s,shape:i}=r.string.stringSplit(zN("input",e,t,n),zN("delimiter",e,t,n),zN("skipEmpty",e,t,n));return[a,s,i]}case"StringToHashBucketFast":return[r.string.stringToHashBucketFast(zN("input",e,t,n),zN("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=NE)=>{switch(e.op){case"Cast":return[r.cast(zN("x",e,t,n),zN("dtype",e,t,n))];case"ExpandDims":{const a=zN("axis",e,t,n);return[r.expandDims(zN("x",e,t,n),a)]}case"Squeeze":{const a=zN("axis",e,t,n);return[r.squeeze(zN("x",e,t,n),a)]}case"Reshape":return[r.reshape(zN("x",e,t,n),zN("shape",e,t,n))];case"EnsureShape":return[r.ensureShape(zN("x",e,t,n),zN("shape",e,t,n))];case"MirrorPad":return[r.mirrorPad(zN("x",e,t,n),zN("padding",e,t,n),zN("mode",e,t,n))];case"PadV2":case"Pad":return[r.pad(zN("x",e,t,n),zN("padding",e,t,n),zN("constantValue",e,t,n))];case"SpaceToBatchND":{const a=zN("blockShape",e,t,n),s=zN("paddings",e,t,n);return[r.spaceToBatchND(zN("x",e,t,n),a,s)]}case"BatchToSpaceND":{const a=zN("blockShape",e,t,n),s=zN("crops",e,t,n);return[r.batchToSpaceND(zN("x",e,t,n),a,s)]}case"DepthToSpace":{const a=zN("blockSize",e,t,n),s=zN("dataFormat",e,t,n).toUpperCase();return[r.depthToSpace(zN("x",e,t,n),a,s)]}case"BroadcastTo":return[r.broadcastTo(zN("x",e,t,n),zN("shape",e,t,n))];case"BroadcastArgs":return[r.broadcastArgs(zN("s0",e,t,n),zN("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=zN("keyDType",e,t,n),s=zN("valueDType",e,t,n),i=new PE(a,s);return r.addHashTable(e.name,i),[i.handle]}}case"InitializeTable":case"InitializeTableV2":case"LookupTableImport":case"LookupTableImportV2":{const a=zN("tableHandle",e,t,n,r),s=zN("keys",e,t,n),i=zN("values",e,t,n),o=r.getHashTableById(a.id);return[await o.import(s,i)]}case"LookupTableFind":case"LookupTableFindV2":{const a=zN("tableHandle",e,t,n,r),s=zN("keys",e,t,n),i=zN("defaultValue",e,t,n),o=r.getHashTableById(a.id);return[await o.find(s,i)]}case"LookupTableSize":case"LookupTableSizeV2":{const a=zN("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=PN(e.op);if(s&&s.customExecutor)return s.customExecutor(new TE(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 Sl(s)?s.then((e=>[].concat(e))):[].concat(s)}class GE{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 VE(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=>jN(e)[0])));r=r||[];const c=new Set(r.map((e=>jN(e.name)[0]))),d=[...t];for(;d.length>0;){const e=d.pop();(XE(e)||ZE(e)||KE(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 UE(e,t){const{usedNodes:n,inputs:r}=t,a=Object.keys(r).map((e=>jN(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 HE(`Child ${e.name} of node ${o.name} is unreachable.`);if(n.get(o.name)>n.get(e.name))throw new HE(`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 HE(`Input ${e.name} of node ${o.name} is unreachable.`);if(n.get(e.name)>n.get(o.name))throw new HE(`Node ${o.name} is scheduled to run before its input ${e.name}.`)}}}(f,l),f}class HE extends Error{constructor(e){super(`NodesExecutionOrderError: ${e}`)}}const jE=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),qE=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),QE=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function XE(e){return jE.has(e.op)}function ZE(e){return qE.has(e.op)}function KE(e){return QE.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 JE{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 JE(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=VE(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=UE(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)=>XE(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 sf(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[jN(e)[0]])),a=t.map((e=>jN(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=_l().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(_X){this.keepIntermediateTensors=!1}const u={},c={};return rf((()=>{const n=new GE(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]=jN(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=zE(e,r,n,this._resourceManager);if(Sl(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=>GN(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(!XE(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(XE(e))continue;const t=VN(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(!XE(e)&&null!=s)for(const o of s){if(XE(i=o)||a.has(i.name))continue;const e=VN(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=_l().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(_X){this.keepIntermediateTensors=!1}const s=new GE(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=>GN(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[jN(e)[0]])),i=n.map((e=>jN(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}=VE(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]=jN(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=>!XE(e)&&!GN(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&&zN("isConstant",e.node,r,n)&&([c]=UN(e.node.name,n)),null==r[e.node.name]){const d=zE(e.node,r,n,this._resourceManager);c||([c]=UN(e.node.name,n));const h=n.currentContext;Sl(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]=UN(e.name,n);!a[i]&&s.has(e.name)&&("Merge"===e.op?e.inputNames.some((e=>!!GN(e,r,n)))&&(a[i]=!0,t.push({contexts:n.currentContext,node:e})):e.inputNames.every((e=>!!GN(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]=jN(t),a=this.graph.nodes[r];if(a.attrParams.shape&&a.attrParams.shape.value){const e=a.attrParams.shape.value;Go(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&&Go(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]=jN(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]=jN(e);if(!this.graph.nodes[t])throw new Error(`The output '${e}' is not found in the graph`)}))}}class YE{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 eR="?tfjs-format=file",tR="model.json";class nR{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=qx){this.modelUrl=e,this.loadOptions=t,this.version="n/a",this.io=n,null==t&&(this.loadOptions={}),this.resourceManager=new YE}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 Sl(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 yf(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 JE(fE.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=fE.Instance.transformGraph(e.modelInitializer);this.initializer=new JE(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 up?[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 up||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&&af(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}}async function rR(e,t={},n=qx){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}${tR}${eR}`}
/**
 * @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 nR(e,t,n);return await r.load(),r}var aR,sR;
/**
 * @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 iR(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>{null!=e&&Go("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.
 * =============================================================================
 */(sR=aR||(aR={}))[sR.FAIL=0]="FAIL",sR[sR.SHORTEST=1]="SHORTEST",sR[sR.LONGEST=2]="LONGEST";const oR=Jv;class lR extends Fo{nextDataId(){return lR.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new Oo(this,tf())}write(e,t,n){this.firstUse&&(this.firstUse=!1,_l().get("IS_NODE")&&jd());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&&ll(n[0])){const a=n.map((e=>Uh(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 Kk(this.readSync(n.real.dataId),this.readSync(n.imag.dataId))}return yl(this.data.get(e).values,t)}bufferSync(e){const t=this.readSync(e.dataId);if("string"===e.dtype)try{const n=t.map((e=>Hh(e)));return sm(e.shape,e.dtype,n)}catch(n){throw new Error("Failed to decode encoded string bytes into utf-8")}return sm(e.shape,e.dtype,t)}makeOutput(e,t,n){return tf().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=Vh();e();return{kernelMs:Vh()-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){iR([e],"where");const t=this.readSync(e.dataId);return oR(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 uR(e){const t=new Float32Array(e.length);for(let n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}lR.nextDataId=0;const cR={kernelName:$l,backendName:"cpu",kernelFunc:e=>{const{x:t}=e.inputs,n=e.backend;iR(t,"abs");let r=new Float32Array(Ho(t.shape));return r=uR(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 dR(e){return(t,n,r,a,s)=>{const i=Ng(t,n),o=i.length,l=fl(i),u=tl(s,Ho(i)),c=t.length,d=n.length,h=fl(t),p=fl(n),f=_g(t,i),m=_g(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=wl(g,o,l),n=t.slice(-c);f.forEach((e=>n[e]=0));const s=kl(n,c,h),i=t.slice(-d);m.forEach((e=>i[e]=0));const y=kl(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 hR(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 pR={kernelName:iu,backendName:"cpu",kernelFunc:hR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 fR(e,t,n="float32"){if("complex64"===n){return hR({inputs:{real:fR(e,t,"float32"),imag:fR(e,t,"float32")},backend:e})}const r=vl(Ho(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 mR(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 gR={kernelName:Xu,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){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 bR={kernelName:Vc,backendName:"cpu",kernelFunc:yR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 vR(e,t,n,r){if("int32"===r){return[t,"int32",Int32Array.from(e)]}if("bool"===r){const r=Gh([0],n),[a,s]=dR(((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 AR(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dtype:s}=r;if("complex64"===s){if("complex64"===a.dtype)return mR({inputs:{x:a},backend:n});const e=fR(n,a.shape,a.dtype),t=AR({inputs:{x:a},backend:n,attrs:{dtype:"float32"}}),r=hR({inputs:{real:t,imag:e},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),r}if("complex64"===a.dtype){const e=yR({inputs:{input:a},backend:n}),t=AR({inputs:{x:e},backend:n,attrs:{dtype:s}});return n.disposeIntermediateTensorInfo(e),t}if(!sl(a.dtype,s)){const e=mR({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]=vR(i,a.shape,a.dtype,s);return n.makeTensorInfo(o,l,u)}const xR={kernelName:ru,backendName:"cpu",kernelFunc:AR};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 kR(e,t,n,r){return null==n?({inputs:n,backend:a})=>{const{a:s,b:i}=n,o=a;iR([s,i],e);const l=o.data.get(s.dataId).values,u=o.data.get(i.dataId).values,c="string"===s.dtype?Rw(l):l,d="string"===s.dtype?Rw(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=AR({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=AR({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=hR({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 wR(e){return(t,n,r,a,s,i)=>{const o=Ng(t,n),l=Ho(o),u=o.length,c=fl(o),d=tl("float32",l),h=tl("float32",l),p=_g(t,o),f=_g(n,o),m=Kk(r,a),g=Kk(s,i),y=t.length,b=fl(t),v=n.length,A=fl(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=wl(x,u,c),n=t.slice(-y);p.forEach((e=>n[e]=0));const r=kl(n,y,b),a=t.slice(-v);f.forEach((e=>a[e]=0));const s=kl(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 SR=dR(((e,t)=>e+t)),CR=wR(((e,t,n,r)=>({real:e+n,imag:t+r}))),IR=kR(Dl,SR,CR),WR={kernelName:Dl,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,r,a){const s=Ho(r),i=vl(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 TR(e,t,n,r=!1){const a=e.shape[0],s=e.shape[1],i=sm([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 NR=dR(((e,t)=>e&t)),ER=kR(eu,NR),RR={kernelName:eu,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.
 * =============================================================================
 */
function $R(e){return(t,n,r)=>{const a=nl(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 OR(e,t,n){return FR(e,$R(t),n)}function FR(e,t,n){return({inputs:r,attrs:a,backend:s})=>{const{x:i}=r;iR(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=Rw(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 DR=$R((e=>Math.ceil(e))),MR=FR(au,DR),LR={kernelName:au,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 BR(e,t,n,r){const a=nl(n,Ho(t));if(r&&"string"!==n){let t=0;e.forEach((e=>{const n=Ho(e.shape);a.set(e.vals,t),t+=n}))}else{let r=0;e.forEach((e=>{const s="string"===n?Rw(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 PR=dR(((e,t)=>e===t?1:0)),zR=kR(Fu,PR,null,"bool"),GR={kernelName:Fu,backendName:"cpu",kernelFunc:zR},VR=$R((e=>Math.exp(e))),UR=FR(Du,VR,"float32"),HR={kernelName:Du,backendName:"cpu",kernelFunc:UR},jR=$R((e=>Math.expm1(e))),qR=FR(Lu,jR),QR={kernelName:Lu,backendName:"cpu",kernelFunc:qR},XR=$R((e=>Math.floor(e))),ZR=FR(Gu,XR),KR={kernelName:Gu,backendName:"cpu",kernelFunc:ZR},JR=dR(((e,t)=>Math.floor(e/t))),YR=kR(Vu,JR,null,"int32"),e$={kernelName:Vu,backendName:"cpu",kernelFunc:YR};
/**
 * @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 t$(e,t,n,r,a,s,i,o,l){const u=sm([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 n$(e,t,n){const r=sm(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 r$=dR(((e,t)=>e>t?1:0)),a$=kR(qu,r$,null,"bool"),s$={kernelName:qu,backendName:"cpu",kernelFunc:a$},i$=dR(((e,t)=>e>=t?1:0)),o$=kR(Qu,i$,null,"bool"),l$={kernelName:Qu,backendName:"cpu",kernelFunc:o$},u$=dR(((e,t)=>e<t?1:0)),c$=kR(nc,u$,null,"bool"),d$={kernelName:nc,backendName:"cpu",kernelFunc:c$},h$=dR(((e,t)=>e<=t?1:0)),p$=kR(rc,h$,null,"bool"),f$={kernelName:rc,backendName:"cpu",kernelFunc: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 m$(e,t,n){const r=(t-e)/(n-1),a=vl(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 g$=$R((e=>Math.log(e))),y$=FR(sc,g$),b$={kernelName:sc,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.
 * =============================================================================
 */
function v$(e,t,n,r){const a=tl(r,Ho(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 A$=dR(((e,t)=>Math.max(e,t))),x$=kR(fc,A$),k$={kernelName:fc,backendName:"cpu",kernelFunc:x$},w$=dR(((e,t)=>Math.min(e,t))),S$=kR(kc,w$),C$={kernelName:kc,backendName:"cpu",kernelFunc:S$},I$=dR(((e,t)=>e*t)),W$=wR(((e,t,n,r)=>({real:e*n-t*r,imag:e*r+t*n}))),_$=kR(Ic,I$,W$),T$={kernelName:Ic,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 N$(e,t,n){const r=zh(-1,n);return I$([],t,r,e,n)}const E$={kernelName:Wc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t;iR(r,"neg");const a=n.data.get(r.dataId).values,[s,i]=N$(a,r.shape,r.dtype);return n.makeTensorInfo(i,r.dtype,s)}},R$=dR(((e,t)=>e!==t?1:0)),$$=kR(_c,R$,null,"bool"),O$={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.
 * =============================================================================
 */
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 F$(e,t,n,r,a){const s=t.length,i=Ho(t),o=fl(t),l=fl(a),u=tl(n,Ho(a));for(let c=0;c<i;++c){const t=wl(c,s,o),n=new Array(t.length);for(let e=0;e<n.length;e++)n[e]=t[r[e]];u[kl(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 D$(e){const{inputs:t,attrs:n,backend:r}=e,{x:a}=t,{perm:s}=n;iR(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=F$(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 M$={kernelName:Fd,backendName:"cpu",kernelFunc: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.
 * =============================================================================
 */function L$(e,t,n,r){const[a,s]=Vg(e,r),i=wp(t,"int32"),o=vl(Ho(a),i),l=Ho(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 B$={kernelName:Lc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;iR(a,"prod");const o=a.shape.length,l=Yo(s,a.shape),u=jg(l,o);let c=l,d=a;const h=[];null!=u&&(d=D$({inputs:{x:a},backend:n,attrs:{perm:u}}),h.push(d),c=Qg(c.length,o));const p=n.data.get(d.dataId).values,{outVals:f,outShape:m,outDtype:g}=L$(d.shape,d.dtype,p,c);let y=m;return i&&(y=Ug(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 P$(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 z$(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 G$(e,t,n,r,a){const s=t.slice();s[0]=a;const i=nl(n,Ho(s)),o=e.length;return function(e,t,n,r,a,s){const i=z$(t,2)[1],o=z$(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 V$(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=wl(r,t.length,fl(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}=P$(s,i,e,l),h=function(e){const t=[];for(let n=0;n<e.length;++n){const r=nl("int32",e[n].length);t.push(r),e[n].forEach(((e,t)=>r[t]=e))}return t}(u),p=G$(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 U$=2147483647;function H$(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=nl("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>U$)throw new Error(`Requires ((limit - start) / delta) <= ${U$}`);h[m+1]=h[m]+i}const p=nl(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 j$=Tk;class q${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=Rk(u),this.raggedRank=$k(this.rowPartitionTypes)}getRowPartitionTypeByDimension(e){return this.rowPartitionTypes[0]===j$.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}getRowPartitionTensor(e){return this.rowPartitionTypes[0]===j$.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}getMaxWidth(e){const t=this.getRowPartitionTensor(e-1);switch(this.getRowPartitionTypeByDimension(e-1)){case j$.VALUE_ROWIDS:return q$.getMaxWidthValueRowID(t);case j$.ROW_SPLITS:return q$.getMaxWidthRowSplit(t);default:throw new Error(`Cannot handle partition type ${j$[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 X$(e,n)}calculateOutputSize(e){const t=this.valuesShape;Ok(this.defaultValueShape,t);const n=this.tensorShapeFromTensor(this.shape,this.shapeShape),r=Ek(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 Go(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 j$.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(a,t,n,r);case j$.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: ${j$[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 j$.FIRST_DIM_SIZE:return e[0];case j$.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case j$.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${j$[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=X$(t,!1),a=nl(this.valuesDType,Ho(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=Ho(i),l=t.length;let u=this.defaultValue;if(u.length!==o&&1!==u.length){const e=this.defaultValueShape;rf((()=>{const t=zm(u,e),n=ag(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);Q$(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;){Q$(s.slice(h*o),u,o),++h}e<0?(c=p+1,d=h):(c=p,d=h,h=d+1)}else++h}}}function Q$(e,t,n){for(let r=0;r<n;r++)e[r]=t[r]}function X$(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 Z$(e,t,n,r,a,s,i,o,l,u){return new q$(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 K$(e,t,n,r){if(e===t||e<t&&n<0||t<e&&n>1)return vl(0,r);const a=vl(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 J$=$R((e=>1/Math.sqrt(e))),Y$=FR(ed,J$),eO={kernelName:ed,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.
 * =============================================================================
 */
function tO(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 sm(n,t.dtype);const p=l instanceof ip?l:sm(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 nO=$R((e=>1/(1+Math.exp(-e)))),rO=OR(cd,(e=>1/(1+Math.exp(-e)))),aO={kernelName:cd,backendName:"cpu",kernelFunc:rO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 sO(e,t,n,r,a){const s=yk(r,t,n),i=Ho(n),o=fl(r);if(s){const n=bk(t,o);return"string"===a?e.slice(n,n+i):e.subarray(n,n+i)}const l=sm(r,a,"string"===a?Rw(e):e),u=sm(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?$w(u.values):u.values}function iO(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,size:i}=r;iR(a,"slice");const[o,l]=vk(a,s,i);ok(a,o,l);const u=sO(n.data.get(a.dataId).values,o,l,a.shape,a.dtype);return n.makeTensorInfo(l,a.dtype,u)}const oO={kernelName:id,backendName:"cpu",kernelFunc:iO};
/**
 * @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 lO(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(gw(o));return[nl(n,0),[0,d],nl(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(yw(g,t));if(t>=l)throw new Error(bw(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=nl(n,t*d),h=nl(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 uO(e,t,n,r,a){const s=Ho(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(vw(c,m));c=m,l.push(1)}else{if(e<0)throw new Error(Aw(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(kw(r,l));l[c]=e}if(Ho(l)!==s)throw new Error(ww(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=nl(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 cO(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=nl(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(Iw(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(Ww(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 dO=$R((e=>Math.sqrt(e))),hO=OR(hd,(e=>Math.sqrt(e))),pO={kernelName:hd,backendName:"cpu",kernelFunc:hO},fO=dR(((e,t)=>{const n=e-t;return n*n})),mO=kR(kd,fO),gO={kernelName:kd,backendName:"cpu",kernelFunc:mO},yO=$R(((e,t)=>{const{pattern:n,replaceGlobal:r,rewrite:a}=t;return e.replace(new RegExp(n,r?"g":""),a)})),bO=FR(Sd,yO),vO={kernelName:Sd,backendName:"cpu",kernelFunc:bO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 AO(e,t,n,r){const a=sm(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 xO{constructor(e,t,n,r,a,s){this.separator=Uh(e),this.nGramWidths=t,this.leftPad=Uh(n),this.rightPad=Uh(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=nl("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 kO(e,t,n,r,a,s,i,o){return new xO(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 wO(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 SO(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;wO(e[h],t,n,a);const l=a.length-r;o[h]=l,s+=l,i=Math.max(i,l)}const l=nl("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 CO(e,t){const n=nl("int32",e.length);for(let r=0;r<e.length;++r)n[r]=Ph(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 IO=dR(((e,t)=>e-t)),WO=wR(((e,t,n,r)=>({real:e-n,imag:t-r}))),_O=kR(Td,IO,WO),TO={kernelName:Td,backendName:"cpu",kernelFunc:_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 NO(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=sm(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 EO=(e,t)=>{const n=t.value-e.value;return 0===n?e.index-t.index:n};function RO(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);RO(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(Po(e,n,t),EO(e[r],a)>0&&Po(e,n,r);s<i;){for(Po(e,s,i),s++,i--;EO(e[s],a)<0;)s+=1;for(;EO(e[i],a)>0;)i-=1}0===EO(e[n],a)?Po(e,n,i):(i+=1,Po(e,i,r)),i<=t&&(n=i+1),t<=i&&(r=i-1)}}function $O(e,t,n,r,a){const s=t[t.length-1],[i,o]=[e.length/s,s],l=tl(n,i*r),u=tl("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&&(RO(s,r),s=s.slice(0,r)),a&&s.sort(EO);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,[sm(c,n,l),sm(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 OO(e,t,n,r){const a=Yo(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 ip(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 ip(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 FO=Object.freeze(Object.defineProperty({__proto__:null,addImpl:SR,bincountImpl:_R,bincountReduceImpl:TR,bitwiseAndImpl:NR,castImpl:vR,ceilImpl:DR,concatImpl:BR,equalImpl:PR,expImpl:VR,expm1Impl:jR,floorDivImpl:JR,floorImpl:XR,gatherNdImpl:t$,gatherV2Impl:n$,greaterEqualImpl:i$,greaterImpl:r$,lessEqualImpl:h$,lessImpl:u$,linSpaceImpl:m$,logImpl:g$,maxImpl:v$,maximumImpl:A$,minimumImpl:w$,multiplyImpl:I$,negImpl:N$,notEqualImpl:R$,prodImpl:L$,raggedGatherImpl:V$,raggedRangeImpl:H$,raggedTensorToTensorImpl:Z$,rangeImpl:K$,rsqrtImpl:J$,scatterImpl:tO,sigmoidImpl:nO,simpleAbsImpl:uR,sliceImpl:sO,sparseFillEmptyRowsImpl:lO,sparseReshapeImpl:uO,sparseSegmentReductionImpl:cO,sqrtImpl:dO,squaredDifferenceImpl:fO,staticRegexReplaceImpl:yO,stridedSliceImpl:AO,stringNGramsImpl:kO,stringSplitImpl:SO,stringToHashBucketFastImpl:CO,subImpl:IO,tileImpl:NO,topKImpl:$O,transposeImpl:F$,uniqueImpl:OO},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.
 * =============================================================================
 */lf("cpu",(()=>new lR),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 DO=OR(Ru,(e=>e>=0?e:Math.exp(e)-1)),MO={kernelName:Ru,backendName:"cpu",kernelFunc:DO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 LO(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{alpha:s}=r;iR([a],"leakyRelu");const i=Ho(a.shape),o=n.data.get(a.dataId).values,l=tl("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 BO={kernelName:tc,backendName:"cpu",kernelFunc:LO},PO=dR(((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 zO(e){const{inputs:t,backend:n}=e,{x:r,alpha:a}=t;iR([r,a],"prelu");const s=n.data.get(r.dataId).values,i=n.data.get(a.dataId).values,[o,l]=PO(r.shape,a.shape,s,i,"float32");return n.makeTensorInfo(l,"float32",o)}const GO={kernelName:Mc,backendName:"cpu",kernelFunc:zO},VO=OR(Hc,(e=>Math.max(0,e))),UO={kernelName:Hc,backendName:"cpu",kernelFunc:VO},HO=OR(Kc,(e=>Math.min(Math.max(0,e),6))),jO={kernelName:Kc,backendName:"cpu",kernelFunc:HO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT 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 qO(e,t,n,r,a){if("linear"===n)return mR({inputs:{x:t},backend:e});if("relu"===n)return VO({inputs:{x:t},backend:e});if("elu"===n)return DO({inputs:{x:t},backend:e});if("relu6"===n)return HO({inputs:{x:t},backend:e});if("prelu"===n)return zO({inputs:{x:t,alpha:r},backend:e});if("leakyrelu"===n)return LO({inputs:{x:t},backend:e,attrs:{alpha:a}});if("sigmoid"===n)return rO({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 QO(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{shape:s}=r,i=Ho(a.shape),o=Jo(s,i),l=Ho(o);Go(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 XO={kernelName:jc,backendName:"cpu",kernelFunc:QO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT 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 ZO(e){const{inputs:t,backend:n,attrs:r}=e,{a:a,b:s}=t,{transposeA:i,transposeB:o}=r;iR([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=Ho(f),y=Ho(m),b=Ng(a.shape.slice(0,-2),s.shape.slice(0,-2)).concat([h,p]);Go(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=QO({inputs:{x:a},backend:n,attrs:{shape:i?[g,c,h]:[g,h,c]}}),x=QO({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,_=fl(A.shape),T=fl(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=sm([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 KO={kernelName:Kl,backendName:"cpu",kernelFunc:ZO};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES 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:Vd,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=ZO({inputs:{a:a,b:s},attrs:{transposeA:l,transposeB:u},backend:n}),i&&(p=IR({inputs:{a:h,b:i},backend:n}),m.push(h),h=p),c&&(f=qO(n,h,c,o,d),m.push(h),h=f);for(const g of m)n.disposeIntermediateTensorInfo(g);return h}},YO=OR(Ol,(e=>Math.acos(e))),eF={kernelName:Ol,backendName:"cpu",kernelFunc:YO},tF=OR(Fl,(e=>Math.acosh(e))),nF={kernelName:Fl,backendName:"cpu",kernelFunc:tF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES 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:Ml,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;iR(t,"addN");const a=r.map((e=>n.data.get(e.dataId).values)),s=sm(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 aF={kernelName:Ll,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;iR(a,"all");const o=Yo(s,a.shape);let l=o;const u=jg(l,a.shape.length);let c=a;null!=u&&(c=D$({inputs:{x:a},backend:n,attrs:{perm:u}}),l=Qg(l.length,a.shape.length)),Hg("all",l,c.shape.length);const[d,h]=Vg(c.shape,l),p=Ho(h),f=vl(Ho(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=QO({inputs:{x:g},backend:n,attrs:{shape:Ug(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 sF={kernelName:Bl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;iR(a,"any");const o=Yo(s,a.shape);let l=o;const u=jg(l,a.shape.length);let c=a;null!=u&&(c=D$({inputs:{x:a},backend:n,attrs:{perm:u}}),l=Qg(l.length,a.shape.length)),Hg("any",l,c.shape.length);const[d,h]=Vg(c.shape,l),p=Ho(h),f=vl(Ho(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=QO({inputs:{x:g},backend:n,attrs:{shape:Ug(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 iF={kernelName:Pl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;iR(a,"argMax");let i=Yo(s,a.shape);const o=jg(i,a.shape.length);let l=a;const u=[];null!=o&&(l=D$({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Qg(i.length,l.shape.length)),i=[i[0]],Hg("argMax",i,l.shape.length);const[c,d]=Vg(l.shape,i),h=vl(Ho(c),"int32"),p=Ho(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 oF={kernelName:zl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;iR(a,"argMin");let i=Yo(s,a.shape);const o=jg(i,a.shape.length);let l=a;const u=[];null!=o&&(l=D$({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Qg(i.length,l.shape.length)),i=[i[0]],Hg("argMin",i,l.shape.length);const[c,d]=Vg(l.shape,i),h=vl(Ho(c),"int32"),p=Ho(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)}},lF=OR(Gl,(e=>Math.asin(e))),uF={kernelName:Gl,backendName:"cpu",kernelFunc:lF},cF=OR(Vl,(e=>Math.asinh(e))),dF={kernelName:Vl,backendName:"cpu",kernelFunc:cF},hF=OR(Ul,(e=>Math.atan(e))),pF={kernelName:Ul,backendName:"cpu",kernelFunc:hF},fF=dR(((e,t)=>Math.atan2(e,t))),mF=kR(jl,fF),gF={kernelName:jl,backendName:"cpu",kernelFunc:mF},yF=OR(Hl,(e=>Math.atanh(e))),bF={kernelName:Hl,backendName:"cpu",kernelFunc:yF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT 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 vF(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=sm(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 AF(e,t,n,r,a=!1,s=!1){const i=sm(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=sm(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 xF(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=sm(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 kF={kernelName:ql,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;iR(a,"avgPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Go(Mm(i,1),(()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Wm(a.shape,s,i,1,o,l);let c;if(1===u.filterWidth&&1===u.filterHeight&&qo(u.inShape,u.outShape))c=mR({inputs:{x:a},backend:n});else{const e=n.data.get(a.dataId).values,t=fl(a.shape),r=vF(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 wF={kernelName:Xl,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;iR(a,"avgPool3d");const c=_m(a.shape,s,i,1,o,l,u),d=xF(n.data.get(a.dataId).values,a.shape,a.dtype,fl(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 SF={kernelName:Zl,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;iR([a,s],"avgPool3DGrad");const c=_m(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=sm(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 CF={kernelName:Ql,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s;iR([a,s],"avgPoolGrad");const{filterSize:o,strides:l,pad:u}=r,c=Wm(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=sm(i.shape,"float32"),k=1/(p*f),w=n.data.get(a.dataId).values,S=sm(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 IF={kernelName:Uu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,scale:s,offset:i,mean:o,variance:l}=t;Go(o.shape.length===l.shape.length,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),Go(null==i||o.shape.length===i.shape.length,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),Go(null==s||o.shape.length===s.shape.length,(()=>"Batch normalization gradient requires mean and scale to have equal ranks.")),iR([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 WF={kernelName:Jl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,crops:i}=r;iR([a],"batchToSpaceND");const o=s.reduce(((e,t)=>e*t)),l=Lk(a.shape,s,o),u=Bk(l.length,s.length),c=Pk(a.shape,s,o),d=zk(i,s.length),h=Gk(c,i,s.length),p=QO({inputs:{x:a},backend:n,attrs:{shape:l}}),f=D$({inputs:{x:p},backend:n,attrs:{perm:u}}),m=QO({inputs:{x:f},backend:n,attrs:{shape:c}}),g=iO({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 _F={kernelName:Yl,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,weights:s}=t,{size:i}=r,o=_R(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 TF={kernelName:nu,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=Ng(Array.from(s),Array.from(i));return n.makeTensorInfo([o.length],"int32",Int32Array.from(o))}},NF=OR(su,((e,t)=>{const n=t;return e>n.clipValueMax?n.clipValueMax:e<n.clipValueMin?n.clipValueMin:e})),EF={kernelName:su,backendName:"cpu",kernelFunc:NF},RF={kernelName:ou,backendName:"cpu",kernelFunc:e=>{const{x:t}=e.inputs,n=e.backend,r=new Float32Array(Ho(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 $F(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 OF={kernelName:Ku,backendName:"cpu",kernelFunc:$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.
 * =============================================================================
 */function FF(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r,s=Yo(a,t[0].shape)[0];Wk(t.map((e=>e.shape)),s);let i=_k(t.map((e=>e.shape)),s);if(0===Ho(i))return n.makeTensorInfo(i,t[0].dtype,[]);const o=t.filter((e=>Ho(e.shape)>0));if(1===o.length)return mR({inputs:{x:o[0]},backend:n});if("complex64"===o[0].dtype){const e=o.map((e=>yR({inputs:{input:e},backend:n}))),t=o.map((e=>$F({inputs:{input:e},backend:n}))),r=FF({inputs:e,backend:n,attrs:{axis:s}}),a=FF({inputs:t,backend:n,attrs:{axis:s}}),i=hR({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=Ho(e.shape.slice(s));return QO({inputs:{x:e},backend:n,attrs:{shape:[-1,t]}})})),u=l.map((e=>({vals:n.data.get(e.dataId).values,shape:e.shape})));i=_k(l.map((e=>e.shape)),1);const c=1===l[0].shape[0],d=BR(u,i,t[0].dtype,c),h=_k(o.map((e=>e.shape)),s),p=n.makeTensorInfo(h,t[0].dtype,d);return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),p}const DF={kernelName:lu,backendName:"cpu",kernelFunc:FF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 MF(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;iR([a,s],"conv2d");const d=Bm(l),h=Tm(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 ip(h.outShape,a.dtype),x=fl(a.shape),k=fl(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 LF={kernelName:uu,backendName:"cpu",kernelFunc:MF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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={kernelName:cu,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;iR([a,s],"conv2dBackpropFilter");const d=Bm(l),h=Tm(a.shape,c,i,1,o,u,!1,d),{strideHeight:p,strideWidth:f,filterHeight:m,filterWidth:g}=h,y="channelsLast"===h.dataFormat,b=new ip(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 ip(a.shape,a.dtype,x),S=new ip(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 PF={kernelName:du,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;iR([a,s],"conv2dBackpropInput");const d=fl(s.shape),h=fl(a.shape);let p=Bm(u);const f=Tm(i,s.shape,o,1,l,c,!1,p),m=new ip(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 zF={kernelName:hu,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;iR([a,s],"conv3d");const u=Nm(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 ip(u.outShape,a.dtype),x=n.data.get(a.dataId).values,k=n.data.get(s.dataId).values,w=A.values,S=fl(a.shape),C=fl(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 GF={kernelName:pu,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;iR([a,s],"conv3dBackpropFilterV2");const u=fl(a.shape),c=fl(s.shape),d=Nm(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 ip(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 VF={kernelName:fu,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;iR([a],"conv3dBackpropInputV2");const u=fl(a.shape),c=fl(s.shape),d=Nm(l,s.shape,o,1,i),h=new ip(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)}},UF=OR(mu,(e=>Math.cos(e))),HF={kernelName:mu,backendName:"cpu",kernelFunc:UF},jF=OR(gu,(e=>Math.cosh(e))),qF={kernelName:gu,backendName:"cpu",kernelFunc:jF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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={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,{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=sm([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=fl(a.shape),k=fl(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 XF={kernelName:yu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;iR(a,"cumprod");const l=jg([s],a.shape.length);let u=a;null!=l&&(u=D$({inputs:{x:a},backend:n,attrs:{perm:l}}));const c=Qg(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=wp(u.dtype,"int32"),h=bl(Ho(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=D$({inputs:{x:g},backend:n,attrs:{perm:qg(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 ZF={kernelName:bu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;iR(a,"cumsum");const l=jg([s],a.shape.length);let u=a;null!=l&&(u=D$({inputs:{x:a},backend:n,attrs:{perm:l}}));const c=Qg(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=wp(u.dtype,"int32"),h=vl(Ho(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=D$({inputs:{x:g},backend:n,attrs:{perm:qg(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 KF={kernelName:Au,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=_R(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=TR(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 JF={kernelName:xu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockSize:s,dataFormat:i}=r;Go("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 YF(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,filter:s}=t,{strides:i,pad:o,dilations:l,dimRoundingMode:u}=r;iR([a,s],"depthwiseConv2DNative");const c=fl(a.shape),d=fl(s.shape);let h=l;null==h&&(h=[1,1]),Go(Mm(i,h),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${h}'`));const p=Tm(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 ip(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 eD={kernelName:ku,backendName:"cpu",kernelFunc:YF};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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={kernelName:wu,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;iR([a,s],"depthwiseConv2dNativeBackpropFilter");const d=Tm(a.shape,c,i,o,l,u,!0),{strideHeight:h,strideWidth:p,filterHeight:f,filterWidth:m}=d,g=new ip(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 ip(a.shape,a.dtype,A),k=n.data.get(s.dataId).values,w=new ip(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 nD={kernelName:Su,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;iR([a,s],"depthwiseConv2DNativeBackpropInput");const d=fl(a.shape),h=fl(s.shape),p=Tm(c,s.shape,i,o,l,u,!0),f=new ip(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 rD={kernelName:Cu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=Ho(r.shape),s=n.data.get(r.dataId).values,i=sm([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)}},aD={kernelName:Iu,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}=Im(r.shape,a.shape,s,i,"NHWC",o),W=Ho(I),_=I.length,T=nl(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=kl([N,n,l,i],c,fl(r.shape)),p=kl([e,t,i],h,fl(a.shape)),f=u[s]+d[p];f>o&&(o=f)}}}T[kl([N,e,n,i],_,fl(I))]=o}}}return{dataId:l.write(Gh(T,r.dtype),I,r.dtype),shape:I,dtype:r.dtype}}},sD={kernelName:_u,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=gl(r.shape,u.data.get(r.dataId).values),d=gl(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}=Im(r.shape,a.shape,i,o,"NHWC",l);Go(s.rank===C.length,(()=>`Error in ${_u}, dy must have the same rank as output ${C.length}, but got ${s.rank}`));const I=gl(C,u.data.get(s.dataId).values),W=Al(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(Gh(W,r.dtype),a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}},iD={kernelName:Wu,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=gl(r.shape,u.data.get(r.dataId).values),d=gl(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}=Im(r.shape,a.shape,i,o,"NHWC",l);Go(s.rank===C.length,(()=>`Error in ${Wu}, dy must have the same rank as output ${C.length}, but got ${s.rank}`));const I=gl(C,u.data.get(s.dataId).values),W=Al(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(Gh(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 oD={kernelName:Tu,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 lD(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;let o;iR(a,"sum"),o="bool"===a.dtype?AR({inputs:{x:a},backend:n,attrs:{dtype:"int32"}}):mR({inputs:{x:a},backend:n});const l=o.shape.length,u=Yo(s,o.shape),c=jg(u,l);let d=u,h=o;null!=c&&(h=D$({inputs:{x:o},backend:n,attrs:{perm:c}}),d=Qg(d.length,l)),Hg("sum",d,h.shape.length);const[p,f]=Vg(h.shape,d);let m=fR(n,p,wp(h.dtype,"int32"));const g=Ho(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=QO({inputs:{x:m},backend:n,attrs:{shape:Ug(m.shape,u)}}),n.disposeIntermediateTensorInfo(e)}return n.disposeIntermediateTensorInfo(o),null!=c&&n.disposeIntermediateTensorInfo(h),m}const uD={kernelName:pd,backendName:"cpu",kernelFunc:lD};
/**
 * @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 cD={kernelName:Eu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{equation:a}=r,s=t,{allDims:i,summedDims:o,idDims:l}=uw(a,s.length);dw(i.length,l,s);const{path:u,steps:c}=hw(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}=cw(p,l[e]);let a;pw(t)?a=s[e]:(a=D$({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);qo(a.shape,i)||(a=QO({inputs:{x:a},backend:n,attrs:{shape:i}}),f.push(a)),null===h?h=a:(h=_$({inputs:{a:a,b:h},backend:n}),f.push(h))}m<d-1&&(u[m]>=0&&(h=lD({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 dD={kernelName:$u,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{dy:r,y:a}=t;iR([r,a],"eluGrad");const s=new Float32Array(Ho(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)}},hD=OR(Ou,(e=>{const t=Math.sign(e),n=Math.abs(e),r=1/(1+.3275911*n);return t*(1-((((1.061405429*r-1.453152027)*r+1.421413741)*r-.284496736)*r+.254829592)*r*Math.exp(-n*n))})),pD={kernelName:Ou,backendName:"cpu",kernelFunc:hD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT 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 fD(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&&(Go(-(i+1)<=s,(()=>`Axis must be in the interval [${-(i+1)}, ${i}]`)),l=i+s+1),o.splice(l,0,1),QO({inputs:{x:a},backend:n,attrs:{shape:o}})}const mD={kernelName:Mu,backendName:"cpu",kernelFunc:fD},gD=dR(((e,t)=>e/t)),yD=kR(Nu,gD),bD={kernelName:Nu,backendName:"cpu",kernelFunc:yD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 vD(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=Ho(u),d=tl("float32",c),h=tl("float32",c);for(let g=0;g<a;g++){const e=iO({inputs:{x:o},backend:n,attrs:{begin:[g,0],size:[1,s]}}),r=iO({inputs:{x:l},backend:n,attrs:{begin:[g,0],size:[1,s]}}),a=hR({inputs:{real:e,imag:r},backend:n}),{real:i,imag:u}=AD(a,t,n),c=Kk(i,u);for(let t=0;t<s;t++){const e=tw(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=hR({inputs:{real:p,imag:f},backend:n});return n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),m}function AD(e,t,n){const r=Ho(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(0==((o=r)&o-1)){const a=xD(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",zh(r,"float32")),i=mR({inputs:{x:s},backend:n}),l=bD.kernelFunc({inputs:{a:e,b:s},backend:n}),u=bD.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}{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=aw(a*r,t,n),l=tw(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),nw(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.
 * =============================================================================
 */(Kk(s,i),r,t);return Jk(e)}var o}function xD(e,t,n,r,a){if(1===n)return{real:e,imag:t};const s=Kk(e,t),i=n/2,o=Yk(s),l=o.real,u=o.imag,c=[l.length],d=a.makeTensorInfo(c,"float32",l),h=a.makeTensorInfo(c,"float32",u),p=hR({inputs:{real:d,imag:h},backend:a}),f=ew(s),m=f.real,g=f.imag,y=[m.length],b=a.makeTensorInfo(y,"float32",m),v=a.makeTensorInfo(y,"float32",g),A=hR({inputs:{real:b,imag:v},backend:a}),x=xD(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=hR({inputs:{real:C,imag:I},backend:a}),_=xD(m,g,i,r,a),T=_.real,N=_.imag,E=[T.length],R=a.makeTensorInfo(E,"float32",T),$=a.makeTensorInfo(E,"float32",N),O=hR({inputs:{real:R,imag:$},backend:a}),F=rw(n,r),D=[F.real.length],M=a.makeTensorInfo(D,"float32",F.real),L=a.makeTensorInfo(D,"float32",F.imag),B=hR({inputs:{real:M,imag:L},backend:a}),P=_$({inputs:{a:B,b:O},backend:a}),z=IR({inputs:{a:W,b:P},backend:a}),G=_O({inputs:{a:W,b:P},backend:a}),V=yR({inputs:{input:z},backend:a}),U=yR({inputs:{input:G},backend:a}),H=$F({inputs:{input:z},backend:a}),j=$F({inputs:{input:G},backend:a}),q=FF({inputs:[V,U],backend:a,attrs:{axis:0}}),Q=FF({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 kD={kernelName:Bu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t,a=Ho(r.shape),s=r.shape[r.shape.length-1],i=QO({inputs:{x:r},backend:n,attrs:{shape:[a/s,s]}}),o=vD(i,!1,n),l=QO({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 wD(e){const{backend:t,attrs:n}=e,{shape:r,value:a,dtype:s}=n,i=s||dl(a),o=nl(i,Ho(r));return function(e,t,n){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 SD={kernelName:Pu,backendName:"cpu",kernelFunc:wD};const CD={kernelName:zu,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:r}=e,a=n,s=tl(r.dtype,Ho(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 ID={kernelName:Ud,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=MF({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=QO({inputs:{x:i},backend:n,attrs:{shape:[i.shape[0],1,1]}});m=IR({inputs:{a:m,b:e},backend:n}),n.disposeIntermediateTensorInfo(e)}else m=IR({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=QO({inputs:{x:o},backend:n,attrs:{shape:[o.shape[0],1,1]}});m=qO(n,m,p,e,f),n.disposeIntermediateTensorInfo(e)}else m=qO(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 WD={kernelName:Hd,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=YF({inputs:{x:a,filter:s},backend:n,attrs:{strides:l,pad:u,dataFormat:c,dilations:d,dimRoundingMode:h}});if(i){const e=m;m=IR({inputs:{a:m,b:i},backend:n}),n.disposeIntermediateTensorInfo(e)}if(p){const e=m;m=qO(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 _D={kernelName:ju,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{params:r,indices:a}=t,s=Ho(r.shape),i=a.shape,o=i[i.length-1],[l,u,c,d]=rk(r,a);if(0===u)return n.makeTensorInfo(l,r.dtype,[]);const h=t$(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 TD={kernelName:Hu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,indices:s}=t,{axis:i,batchDims:o}=r;iR([a,s],"gatherV2");const l=Yo(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];Go(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=Ho(s.shape),p=Nw(a,s,l,d),f=QO({inputs:{x:a},backend:n,attrs:{shape:[p.batchSize,p.outerSize,p.dimSize,p.sliceSize]}}),m=QO({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=n$(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 ND={kernelName:Zu,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t,a=Ho(r.shape),s=r.shape[r.shape.length-1],i=QO({inputs:{x:r},backend:n,attrs:{shape:[a/s,s]}}),o=vD(i,!0,n),l=QO({inputs:{x:o},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),l}},ED=OR(Ju,(e=>Number.isFinite(e)?1:0),"bool"),RD={kernelName:Ju,backendName:"cpu",kernelFunc:ED},$D=OR(Yu,(e=>Math.abs(e)===1/0?1:0),"bool"),OD={kernelName:Yu,backendName:"cpu",kernelFunc:$D},FD=OR(ec,(e=>Number.isNaN(e)?1:0),"bool"),DD={kernelName:ec,backendName:"cpu",kernelFunc:FD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES 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:ac,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=m$(r,a,s);return t.makeTensorInfo([i.length],"float32",i)}},LD=OR(ic,(e=>Math.log1p(e))),BD={kernelName:ic,backendName:"cpu",kernelFunc:LD},PD=dR(((e,t)=>e&&t)),zD=kR(oc,PD,null,"bool"),GD={kernelName:oc,backendName:"cpu",kernelFunc:zD},VD=OR(lc,(e=>e?0:1),"bool"),UD={kernelName:lc,backendName:"cpu",kernelFunc:VD},HD=dR(((e,t)=>e||t)),jD=kR(uc,HD,null,"bool"),qD={kernelName:uc,backendName:"cpu",kernelFunc:jD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const QD={kernelName:dc,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;iR(a,"LRN");const u=a.shape[3],c=u-1,d=n.data.get(a.dataId).values,h=Ho(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 XD={kernelName:hc,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;iR(i,"LRNGrad");const d=Ho(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 ZD(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=Yo(s,l);let d=c;const h=jg(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=F$(p,l,a.dtype,h,e),d=Qg(d.length,u),l=e}iR(a,"max"),Hg("max",d,u);const[f,m]=Vg(l,d),g=v$(p,Ho(m),f,a.dtype),y=o.write(g,f,a.dtype);let b=f;if(i){b=Ug(f,c)}return{dataId:y,shape:b,dtype:a.dtype}}const KD={kernelName:pc,backendName:"cpu",kernelFunc:ZD};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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:mc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;iR(a,"maxPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Go(Mm(i,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Wm(a.shape,s,i,1,o,l);let c;if(1===u.filterWidth&&1===u.filterHeight&&qo(u.inShape,u.outShape))c=mR({inputs:{x:a},backend:n});else{const e=n.data.get(a.dataId).values,t=fl(a.shape),r=vF(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 YD={kernelName:yc,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;iR(a,"maxPool3d");const c=_m(a.shape,s,i,1,o,l,u),d=xF(n.data.get(a.dataId).values,a.shape,a.dtype,fl(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 eM={kernelName:bc,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;iR([a,s],"maxPool3DGrad");const c=_m(s.shape,i,o,1,l,u),d=function(e,t){const n=sm(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=sm(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 tM={kernelName:gc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s,output:i}=t,o=s;iR([s,i],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=r,h=Wm(o.shape,l,u,1,c,d),p=n.data.get(o.dataId).values,f=sm(h.outShape,o.dtype,AF(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=sm(o.shape,"float32"),S=n.data.get(a.dataId).values,C=sm(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 nM={kernelName:vc,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:r}=e,{filterSize:a,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;iR(r,"MaxPoolWithArgmax");const u=l.data.get(r.dataId).values,c=Wm(r.shape,a,s,[1,1],i),[d,h]=function(e,t,n,r,a){const s=vF(e,0,n,fl(t),a,"max"),i=AF(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 rM={kernelName:Ac,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r,o=Yo(s,a.shape),l=Ho(Vg(a.shape,o)[1]),u=[],c=n.makeTensorInfo([],"float32",new Float32Array([l]));u.push(c);const d=AR({inputs:{x:a},backend:n,attrs:{dtype:"float32"}});u.push(d);const h=yD({inputs:{a:d,b:c},backend:n});u.push(h);const p=lD({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 aM={kernelName:xc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,keepDims:i}=r;iR(a,"min");const o=Yo(s,a.shape);let l=o;const u=jg(l,a.shape.length);let c=a;null!=u&&(c=D$({inputs:{x:a},backend:n,attrs:{perm:u}}),l=Qg(l.length,a.shape.length)),Hg("min",l,c.shape.length);const[d,h]=Vg(c.shape,l),p=Ho(h),f=vl(Ho(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=QO({inputs:{x:g},backend:n,attrs:{shape:Ug(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 sM={kernelName:wc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{paddings:s,mode:i}=r;iR(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=fl(a.shape),f=Ho(o),m=o.length,g=fl(o),y=tl(a.dtype,f);for(let b=0;b<f;b++){let e=wl(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=kl(e,h,p);y[b]=d[t]}return{dataId:n.write(y,o,a.dtype),shape:o,dtype:a.dtype}}},iM=dR(((e,t)=>{const n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t})),oM=kR(Sc,iM),lM={kernelName:Sc,backendName:"cpu",kernelFunc:oM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 uM(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=Yo([o],a.shape),u=ZD({inputs:{x:a},backend:n,attrs:{reductionIndices:l,keepDims:!1}}),c=Ug(u.shape,l),d=QO({inputs:{x:u},backend:n,attrs:{shape:c}}),h=_O({inputs:{a:a,b:d},backend:n}),p=UR({inputs:{x:h},backend:n}),f=lD({inputs:{x:p},backend:n,attrs:{axis:l,keepDims:!1}}),m=QO({inputs:{x:f},backend:n,attrs:{shape:c}}),g=yD({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 cM={kernelName:gd,backendName:"cpu",kernelFunc:uM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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,attrs:r}=e,{logits:a}=t,{numSamples:s,seed:i,normalized:o}=r;iR(a,"multinomial");const l=o?a:uM({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=vl(Ho(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=Bb.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)}},hM=OA;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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:Tc,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;iR(a,"NonMaxSuppression");const u=n.data.get(a.dataId).values,c=n.data.get(s.dataId).values,{selectedIndices:d}=hM(u,c,i,o,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}},fM=FA;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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:Nc,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;iR(a,"NonMaxSuppressionPadded");const c=n.data.get(a.dataId).values,d=n.data.get(s.dataId).values,{selectedIndices:h,validOutputs:p}=fM(c,d,i,o,l,u);return[n.makeTensorInfo([h.length],"int32",new Int32Array(h)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}},gM=DA;
/**
 * @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 yM={kernelName:Ec,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;iR(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}=gM(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 bM={kernelName:$c,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;iR(a,"oneHot");const u=Ho(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 vM(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=yR({inputs:{input:r},backend:n}),t=vM({inputs:{x:e},backend:n}),a=$F({inputs:{input:r},backend:n}),s=vM({inputs:{x:a},backend:n}),i=hR({inputs:{real:t,imag:s},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),i}return wD({backend:n,attrs:{shape:r.shape,value:0,dtype:r.dtype}})}const AM={kernelName:Bd,backendName:"cpu",kernelFunc:vM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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:Rc,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=yR({inputs:{input:a},backend:r}),n=e({inputs:{x:t},backend:r}),s=$F({inputs:{input:a},backend:r}),i=vM({inputs:{x:s},backend:r}),o=hR({inputs:{real:n,imag:i},backend:r});return r.disposeIntermediateTensorInfo(t),r.disposeIntermediateTensorInfo(n),r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(i),o}return wD({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 kM(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r;if(1===t.length)return fD({inputs:{input:t[0]},backend:n,attrs:{dim:a}});const s=t[0].shape,i=t[0].dtype;t.forEach((e=>{Vo(s,e.shape,"All tensors passed to stack must have matching shapes"),Go(i===e.dtype,(()=>"All tensors passed to stack must have matching dtypes"))}));const o=[],l=FF({inputs:t.map((e=>{const t=fD({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 wM={kernelName:Oc,backendName:"cpu",kernelFunc:kM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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={kernelName:Fc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{paddings:s,constantValue:i}=r;iR(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=Ho(a.shape),d=a.shape.length,h=fl(a.shape),p=Ho(o),f=o.length,m=fl(o),g=tl(a.dtype,p);0!==i&&g.fill(i);for(let y=0;y<c;y++){g[kl(wl(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}}},CM=dR(((e,t)=>Math.pow(e,t))),IM=kR(Dc,CM),WM={kernelName:Dc,backendName:"cpu",kernelFunc:IM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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={kernelName:Bc,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]=V$(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 TM={kernelName:Pc,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]=H$(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 NM={kernelName:zc,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]=Z$(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 EM={kernelName:Gc,backendName:"cpu",kernelFunc:function(e){const{backend:t,attrs:n}=e,{start:r,stop:a,dtype:s,step:i}=n,o=K$(r,a,i,s);return t.makeTensorInfo([o.length],s,o)}},RM=OR(Uc,(e=>1/e)),$M={kernelName:Uc,backendName:"cpu",kernelFunc:RM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES 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={kernelName:Xc,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;iR(a,"resizeBilinear");const l=fl(a.shape),[u,c]=o,[d,h,p,f]=a.shape,m=n.data.get(a.dataId).values,g=new Float32Array(Ho([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 FM={kernelName:Zc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r;iR([s,a],"resizeBilinearGrad");const o=fl(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 DM={kernelName:qc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a}=t,{alignCorners:s,halfPixelCenters:i,size:o}=r;iR(a,"resizeNearestNeighbor");const l=fl(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 MM={kernelName:Qc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r;iR([s,a],"resizeNearestNeighborGrad");const o=fl(a.shape),l=fl(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 LM={kernelName:Jc,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dims:s}=r;iR(a,"reverse");const i=a.shape.length,o=Yo(s,a.shape);if(0===i)return mR({inputs:{x:a},backend:n});const l=new ip(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)}},BM={kernelName:Gd,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:r}=e,{radians:a,fillValue:s,center:i}=t,o=n,l=tl(r.dtype,Ho(r.shape)),[u,c,d,h]=r.shape,[p,f]=Mk(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}}},PM=OR(Yc,(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})),zM={kernelName:Yc,backendName:"cpu",kernelFunc:PM};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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:td,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}=Gv(0,a,i),h=tO(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 VM(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 UM(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 HM={kernelName:rd,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=nl("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?VM(n,t[e+l]):UM(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 jM={kernelName:ad,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n}=e,{condition:r,t:a,e:s}=t;iR([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=wp(a.dtype,s.dtype),d=vl(Ho(a.shape),c);let h=0;const p=0===i||i>1||1===a.shape.length?1:Ho(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)}},qM=OR(sd,(e=>e>=0?1.0507009873554805*e:1.7580993408473768*(Math.exp(e)-1))),QM={kernelName:sd,backendName:"cpu",kernelFunc:qM},XM=OR(ud,(e=>e<0?-1:e>0?1:0)),ZM={kernelName:ud,backendName:"cpu",kernelFunc:XM},KM=OR(od,(e=>Math.sin(e))),JM={kernelName:od,backendName:"cpu",kernelFunc:KM},YM=OR(ld,(e=>Math.sinh(e))),eL={kernelName:ld,backendName:"cpu",kernelFunc:YM},tL=Math.log(1.1920928955078125e-7)+2,nL=OR(dd,(e=>{const t=e>-tL,n=e<tL,r=Math.exp(e);let a;return a=n?r:t?e:Math.log(1+r),a})),rL={kernelName:dd,backendName:"cpu",kernelFunc:nL};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const aL={kernelName:fd,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;iR([a],"spaceToBatchND");const o=Ho(s),l=[[0,0]];l.push(...i);for(let g=1+s.length;g<a.shape.length;++g)l.push([0,0]);const u=SM.kernelFunc({inputs:{x:a},backend:n,attrs:{paddings:l,constantValue:0}}),c=Lk(u.shape,s,o,!1),d=Bk(c.length,s.length,!1),h=Pk(u.shape,s,o,!1),p=QO({inputs:{x:u},backend:n,attrs:{shape:c}}),f=D$({inputs:{x:p},backend:n,attrs:{perm:d}}),m=QO({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 sL={kernelName:yd,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]=lO(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 iL={kernelName:bd,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]=uO(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 oL={kernelName:vd,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]=cO(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 lL={kernelName:Ad,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]=cO(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 uL={kernelName:xd,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}=Gv(0,a,o),p=!1,f=n.bufferSync(a);let m;switch(s.dtype){case"bool":m=tO(f,n.bufferSync(s),o,h,c,u,l,d,Boolean(n.data.get(i.dataId).values[0]),p);break;case"float32":m=tO(f,n.bufferSync(s),o,h,c,u,l,d,n.data.get(i.dataId).values[0],p);break;case"int32":m=tO(f,n.bufferSync(s),o,h,c,u,l,d,n.data.get(i.dataId).values[0],p);break;case"string":m=tO(f,n.bufferSync(s),o,h,c,u,l,d,Hh(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 cL={kernelName:md,backendName:"cpu",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{numOrSizeSplits:s,axis:i}=r,o=Yo(i,a.shape)[0],l=mw(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=iO({inputs:{x:a},backend:n,attrs:{begin:u,size:t}});return u[o]+=e,r}))}},dL={kernelName:wd,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{const{x:n}=e,r=t;iR(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}}},hL=OR(Pd,((e,t)=>{const n=t;return isNaN(e)?NaN:e>0?1:n.alpha})),pL={kernelName:Pd,backendName:"cpu",kernelFunc:hL};
/**
 * @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 fL={kernelName:Cd,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;iR(a,"stridedSlice");const{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:y,begin:b,end:v,strides:A}=Ak(a.shape,s,i,o,l,u,c,d,h);let x;if(m)x=QO({inputs:{x:a},backend:n,attrs:{shape:f}});else if(g||y){Go(a.shape.length>=1,(()=>`Input must have rank at least 1, got: ${a.shape.length}`));const e=lk(b,v,A),t=iO({inputs:{x:a},backend:n,attrs:{begin:b,size:e}});x=QO({inputs:{x:t},backend:n,attrs:{shape:f}}),n.disposeIntermediateTensorInfo(t)}else{const e=AO(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 mL={kernelName:Id,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]=kO(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 gL={kernelName:Wd,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]=SO(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 yL={kernelName:_d,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=CO(n.data.get(s.dataId).values,a);return n.makeTensorInfo(s.shape,"int32",i)}},bL=OR(Nd,(e=>Math.tan(e))),vL={kernelName:Nd,backendName:"cpu",kernelFunc:bL},AL=OR(Ed,(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 xL(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 Lo(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 Lo(0,n,t-1)}(e,t);case"nearest":return function(e,t){return Lo(0,e,t-1)}(e,t);default:return function(e,t){return e}(e)}}function kL(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 wL(e,t,n,r,a,s,i,o,l,u,c){return kL(e,t,n,r,a,s,i,Math.round(o),Math.round(l),u,c)}function SL(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)*kL(e,t,n,r,a,s,i,d,h,u,c)+(l-h)*kL(e,t,n,r,a,s,i,d,f,u,c))+(o-d)*((f-l)*kL(e,t,n,r,a,s,i,p,h,u,c)+(l-h)*kL(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 CL={kernelName:Ld,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;iR(a,"unsortedSegmentSum");const o=[],l=[],u=a.shape.length-s.shape.length;let c=s;for(let h=0;h<u;++h){const e=fD({inputs:{input:c},backend:n,attrs:{dim:h+1}});c=e,l.push(e)}for(let h=0;h<i;++h){const e=zh(h,"int32"),t=n.makeTensorInfo([],"int32",e),r=zR({inputs:{a:t,b:c},backend:n}),s=AR({inputs:{x:r},backend:n,attrs:{dtype:"float32"}}),i=_$({inputs:{a:s,b:a},backend:n}),u=lD({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=kM({inputs:o,backend:n,attrs:{axis:0}});return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),d}},IL=[JO,cR,eF,nF,WR,rF,aF,sF,iF,oF,uF,dF,pF,gF,bF,kF,wF,SF,CF,KO,IF,WF,_F,RR,TF,xR,LR,EF,pR,RF,DF,LF,BF,PF,zF,GF,VF,HF,qF,QF,XF,ZF,KF,JF,eD,tD,nD,rD,aD,sD,iD,oD,cD,MO,dD,GR,pD,HR,mD,QR,kD,SD,CD,KR,e$,ID,WD,_D,TD,s$,l$,gR,ND,OF,RD,OD,DD,BO,d$,f$,MD,b$,BD,GD,UD,qD,QD,XD,KD,k$,JD,YD,eM,tM,nM,rM,aM,C$,sM,lM,dM,T$,E$,pM,mM,yM,O$,bM,xM,wM,SM,WM,GO,B$,_M,TM,NM,EM,bR,bD,$M,UO,jO,XO,OM,FM,DM,MM,LM,BM,zM,eO,GM,HM,jM,QM,aO,ZM,JM,eL,oO,cM,rL,aL,sL,iL,oL,lL,uL,cL,pO,dL,gO,vO,pL,fL,mL,gL,yL,TO,uD,vL,{kernelName:Ed,backendName:"cpu",kernelFunc:AL},{kernelName:nd,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}=Gv(0,a,r.shape),d=n.bufferSync(a),h=n.bufferSync(s),p=n.bufferSync(r),f=tO(d,h,r.shape,c,l,o,i,u,p,!1);return n.makeTensorInfo(r.shape,f.dtype,f.values)}},{kernelName:Rd,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;iR(a,"tile");const i=NO(n.bufferSync(a),s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}},{kernelName:$d,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;iR(a,"topk");const o=n.data.get(a.dataId).values,[l,u]=$O(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:Od,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=fl(a.shape),b=y[0],v=y[1],A=y[2],x=fl(g),k=x[0],w=x[1],S=x[2],C=tl(a.dtype,Ho(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=xL(u,h,o),f=xL(c,d,o);switch(i){case"nearest":a=wL(I,d,h,b,v,A,_,f,p,r,l);break;case"bilinear":a=SL(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}}},M$,{kernelName:Dd,backendName:"cpu",kernelFunc:function(e){const{inputs:t,attrs:n,backend:r}=e,{axis:a}=n,{x:s}=t;iR(s,"unique");const i=r.data.get(s.dataId).values,{outputValues:o,outputShape:l,indices:u}=OO(i,a,s.shape,s.dtype);return[r.makeTensorInfo(l,s.dtype,o),r.makeTensorInfo([u.length],"int32",u)]}},{kernelName:Md,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=iO({inputs:{x:a},backend:n,attrs:{begin:c,size:d}});h[p]=QO({inputs:{x:e},backend:n,attrs:{shape:l}}),n.disposeIntermediateTensorInfo(e)}return h}},CL,AM];
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 IL)Jd(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 WL={},_L={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function TL(e,t){if(!(e in WL)||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(_l().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 WL[e]}),!1),_l().getBool("SOFTWARE_WEBGL_ENABLED")&&(_L.failIfMajorPerformanceCaveat=!1);if(1===e)return n.getContext("webgl",_L)||n.getContext("experimental-webgl",_L);return n.getContext("webgl2",_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.
 * =============================================================================
 */(e,t);if(null===n)return null;WL[e]=n}const n=WL[e];return null==n||n.isContextLost()?(delete WL[e],TL(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),WL[e])}var NL,EL,RL,$L,OL,FL;function DL(e,t){return[t,e]}function ML(e){const t=Ho(e);return Xo(Math.ceil(t/4))}function LL(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function BL(e,t){const n=e;let r,a,s,i,o,l,u,c,d,h;return 2===_l().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 PL(e,t){const n=t();return _l().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}(EL=NL||(NL={}))[EL.DENSE=0]="DENSE",EL[EL.SHARED_BATCH=1]="SHARED_BATCH",($L=RL||(RL={}))[$L.RENDER=0]="RENDER",$L[$L.UPLOAD=1]="UPLOAD",$L[$L.PIXELS=2]="PIXELS",$L[$L.DOWNLOAD=3]="DOWNLOAD",(FL=OL||(OL={}))[FL.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",FL[FL.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",FL[FL.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",FL[FL.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",FL[FL.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16";function zL(e){return!!(_l().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===e||5.96e-8<Math.abs(e)&&Math.abs(e)<65504)}function GL(e,t){return KL(e,(()=>e.getExtension(t)),'Extension "'+t+'" not supported on this browser.')}const VL=/ERROR: [0-9]+:([0-9]+):/g;function UL(e,t){const n=VL.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)=>Zo((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 HL(e,t){if(PL(e,(()=>e.validateProgram(t))),!1===e.getProgramParameter(t,e.VALIDATE_STATUS))throw new Error("Shader program validation failed.")}function jL(e,t,n,r,a,s,i){const o=e.getAttribLocation(t,n);return-1!==o&&(PL(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,r))),PL(e,(()=>e.vertexAttribPointer(o,a,e.FLOAT,!1,s,i))),PL(e,(()=>e.enableVertexAttribArray(o))),!0)}function qL(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),PL(e,(()=>e.activeTexture(e.TEXTURE0+n))),PL(e,(()=>e.bindTexture(e.TEXTURE_2D,t)))}function QL(e,t,n){PL(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,n))),PL(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)))}function XL(e,t){PL(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,t))),PL(e,(()=>e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)))}function ZL(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 KL(e,t,n){const r=PL(e,(()=>t()));if(null==r)throw new Error(n);return r}function JL(e,t=2){return Ho(e.slice(0,e.length-t))}function YL(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 eB(e){let t=[1,1,1];return 0===e.length||1===e.length&&1===e[0]||(t=[JL(e),...YL(e)]),t}function tB(e){return e%2==0}function nB(e,t){if(qo(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(tB(n)&&tB(r)&&(1===e[0]||1===t[0]))return!0}return e[1]===t[1]&&tB(e[0])&&tB(t[0])}let rB,aB;function sB(e,t){return null!=e.getExtension(t)}function iB(e){try{if(null!=TL(e))return!0}catch(_X){return!1}return!1}function oB(e){if(0===e)return!1;const t=TL(e);if(1!==e){if(sB(t,"EXT_color_buffer_float"))return lB(t);const e="EXT_color_buffer_half_float";if(sB(t,e)){const n=t.getExtension(e);return function(e,t){const n=BL(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(!sB(t,"OES_texture_float"))return!1;if(!sB(t,"WEBGL_color_buffer_float"))return!1;return lB(t)}function lB(e){const t=BL(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 uB(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>{null!=e&&Go("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 cB=_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.
 * =============================================================================
 */
function dB(){let e,t,n,r,a,s,i,o,l,u;return 2===_l().getNumber("WEBGL_VERSION")?(e="#version 300 es",t="in",n="out",r="in",a="texture",s="outputColor",i="out vec4 outputColor;",o=_l().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 hB(e,t,n="index"){const r=fl(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 pB(e,t,n="index"){const r=fl(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 fB(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 mB(e){const t=fl(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`}cB.registerFlag("HAS_WEBGL",(()=>cB.getNumber("WEBGL_VERSION")>0)),cB.registerFlag("WEBGL_VERSION",(()=>iB(2)?2:iB(1)?1:0)),cB.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",(()=>!1)),cB.registerFlag("WEBGL_BUFFER_SUPPORTED",(()=>2===cB.get("WEBGL_VERSION"))),cB.registerFlag("WEBGL_CPU_FORWARD",(()=>!0)),cB.registerFlag("WEBGL_FORCE_F16_TEXTURES",(()=>!1)),cB.registerFlag("WEBGL_PACK",(()=>cB.getBool("HAS_WEBGL"))),cB.registerFlag("WEBGL_PACK_NORMALIZATION",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_CLIP",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_DEPTHWISECONV",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_REDUCE",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_LAZILY_UNPACK",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_CONV_IM2COL",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE",(()=>cB.getBool("WEBGL_PACK"))),cB.registerFlag("WEBGL_MAX_TEXTURE_SIZE",(()=>function(e){if(null==rB){const t=TL(e);rB=t.getParameter(t.MAX_TEXTURE_SIZE)}return rB}(cB.getNumber("WEBGL_VERSION")))),cB.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",(()=>function(e){if(null==aB){const t=TL(e);aB=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,aB)}(cB.getNumber("WEBGL_VERSION")))),cB.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",(()=>{const e=cB.getNumber("WEBGL_VERSION");return 0===e?0:function(e){if(0===e)return 0;let t;const n=TL(e);return t=sB(n,"EXT_disjoint_timer_query_webgl2")&&2===e?2:sB(n,"EXT_disjoint_timer_query")?1:0,t}(e)})),cB.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",(()=>cB.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!Bp())),cB.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",(()=>function(e){if(0===e)return!1;const t=TL(e);if(1===e){if(!sB(t,"OES_texture_float"))return!1}else if(!sB(t,"EXT_color_buffer_float"))return!1;return lB(t)}(cB.getNumber("WEBGL_VERSION")))),cB.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",(()=>!cB.getBool("WEBGL_FORCE_F16_TEXTURES")&&cB.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))),cB.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",(()=>oB(cB.getNumber("WEBGL_VERSION")))),cB.registerFlag("WEBGL_FENCE_API_ENABLED",(()=>{return 2===(e=cB.getNumber("WEBGL_VERSION"))&&null!=TL(e).fenceSync;var e})),cB.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",(()=>cB.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0)),cB.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}.`)})),cB.registerFlag("WEBGL_FLUSH_THRESHOLD",(()=>Bp()?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}.`)})),cB.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",(()=>128)),cB.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",(()=>!1)),cB.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",(()=>1e5)),cB.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",(()=>128)),cB.registerFlag("WEBGL_EXP_CONV",(()=>!1)),cB.registerFlag("SOFTWARE_WEBGL_ENABLED",(()=>cB.getBool("IS_TEST"))),cB.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",(()=>1/0)),cB.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",(()=>!1)),cB.registerFlag("WEBGL2_ISNAN_CUSTOM",(()=>!1)),cB.registerFlag("ENGINE_COMPILE_ONLY",(()=>!1));const gB="\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:yB}=Ow;
/**
 * @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 bB(e,t,n){const r=[];if(e.forEach((e=>{const t=Ho(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}=TB(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?AB(e,r):vB(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=yB(e.shapeInfo.logicalShape,t.logicalShape),l=_B(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===Ho(e.shapeInfo.logicalShape),m=Ho(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&&qo(i,s))return`\n      float ${a}() {\n        return sampleTexture(${n}, resultUV);\n      }\n    `;const u=_B(l),c=yB(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=dB(),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    ${xB}\n    ${kB}\n    ${wB}\n  `;return t}(o);t.isPacked?(u=function(e,t,n){switch(e.length){case 0:return CB();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(qo(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 CB();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(qo(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    ${pB(["r","c","d"],e)}\n    return ivec3(r, c, d);\n  }\n`}const r=hB(["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      ${pB(["r","c","d","d2"],e)}\n      return ivec4(r, c, d, d2);\n    }\n  `}const r=hB(["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=hB(["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=hB(["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+=SB);return[d,l,c,a,u,s,n.userCode].join("\n")}function vB(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=IB(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        ${WB(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=IB(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&&qo(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}=el(n),l=i;if(l.length<n.length){const n=["row","col"];return`\n      ${vB(NB(e,l),t)}\n      float ${a}(int row, int col) {\n        return ${a}(${EB(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        ${WB(e)}\n      }\n    `;const u=s[0],c=s[1],d=IB(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}=el(n),u=o;if(u.length<n.length){const n=["row","col","depth"];return`\n        ${vB(NB(e,u),t)}\n        float ${a}(int row, int col, int depth) {\n          return ${a}(${EB(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        ${WB(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=IB(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}=el(n);if(l.length<n.length){const n=["row","col","depth","depth2"];return`\n      ${vB(NB(e,l),t)}\n      float ${a}(int row, int col, int depth, int depth2) {\n        return ${a}(${EB(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        ${WB(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=IB(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}=el(t);if(l.length<t.length){const t=["row","col","depth","depth2","depth3"];return`\n      ${vB(NB(e,l))}\n      float ${r}(int row, int col, int depth, int depth2, int depth3) {\n        return ${r}(${EB(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        ${WB(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=IB(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}=el(t);if(a.length<t.length){const t=["row","col","depth","depth2","depth3","depth4"];return`\n      ${vB(NB(e,a))}\n      float ${r}(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        return ${r}(${EB(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        ${WB(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=IB(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 AB(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=dB();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=dB();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=dB();if(null!=s&&qo(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        ${AB(NB(e,n.slice(1)),t)}\n        vec4 ${a}(int b, int row, int col) {\n          return ${a}(${EB(s,r)});\n        }\n      `}const o=dB();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=dB();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 xB="\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",kB="\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",wB="\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",SB="\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 CB(){return"\n    int getOutputCoords() {\n      return 0;\n    }\n  "}function IB(e){return`offset${e}`}function WB(e){const t=e.name,n=Ho(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 _B(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 TB(e,t,n){const{newShape:r,keptDims:a}=el(t),s=t.length,i=e&&3===s&&1===t[0],o=i?t.slice(1):r,l=!e&&s>1&&!qo(t,n)&&r.length<s||i;return{useSqueezeShape:l,uniformShape:l?o:t,keptDims:a}}function NB(e,t){const n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function EB(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 RB(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=bB(a,i,t),l=function(e,t){const n=KL(e,(()=>e.createShader(e.FRAGMENT_SHADER)),"Unable to create fragment WebGLShader.");if(PL(e,(()=>e.shaderSource(n,t))),PL(e,(()=>e.compileShader(n))),_l().get("ENGINE_COMPILE_ONLY"))return n;if(!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw UL(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}(e.gl,o),u=e.createProgram(l);return _l().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},$B(e,t,u)))}function $B(e,t,n){const r=[],a=[];let s,i,o,l=null,u=null;u=e.getUniformLocation(n,"NAN",!1),1===_l().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 OB(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(!qo(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(!qo(i,o))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${i} and ${o} must match`)}))}function FB(e){return _l().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 DB{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=NL.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=dB();this.outputShape=e,this.enableShapeUniforms=FB(this.outputShape.length),this.userCode=`\n      ivec3 outCoordsFromFlatIndex(int index) {\n        ${this.enableShapeUniforms?pB(["r","c","d"],e):hB(["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 MB{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=NL.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=dB();this.outputShape=e,this.enableShapeUniforms=FB(this.outputShape.length),this.userCode=`\n      ivec3 outCoordsFromFlatIndex(int index) {\n        ${this.enableShapeUniforms?pB(["r","c","d"],e):hB(["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 LB{constructor(e){this.variableNames=["A"],this.outTexUsage=RL.DOWNLOAD;const t=dB();this.outputShape=e,this.userCode=`\n      ${gB}\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 BB{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=RL.DOWNLOAD;const t=dB();this.outputShape=e,this.userCode=`\n      ${gB}\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 PB={R:0,G:1,B:2,A:3};class zB{constructor(e,t=!1,n="RGBA"){this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];const r=dB();this.outputShape=e,this.enableShapeUniforms=FB(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[${PB[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":mB(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 GB{constructor(e,t=!1){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];const n=dB();this.outputShape=e,this.enableShapeUniforms=FB(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":mB(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 VB(e){const t=dB();return function(e,t){const n=KL(e,(()=>e.createShader(e.VERTEX_SHADER)),"Unable to create vertex WebGLShader.");if(PL(e,(()=>e.shaderSource(n,t))),PL(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 UB(e){return function(e,t){const n=KL(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return PL(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n))),PL(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 HB(e){return function(e,t){const n=KL(e,(()=>e.createBuffer()),"Unable to create WebGLBuffer");return PL(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n))),PL(e,(()=>e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW))),n}(e,new Uint16Array([0,1,2,2,1,3]))}function jB(e,t,n,r,a,s){!function(e,t){const n=_l().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 KL(e,(()=>e.createTexture()),"Unable to create WebGLTexture.")}(e),o=e.TEXTURE_2D;return PL(e,(()=>e.bindTexture(o,i))),PL(e,(()=>e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE))),PL(e,(()=>e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE))),PL(e,(()=>e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST))),PL(e,(()=>e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST))),1===_l().getNumber("WEBGL_VERSION")?PL(e,(()=>e.texImage2D(o,0,r,t,n,0,a,s,null))):PL(e,(()=>e.texStorage2D(o,1,r,t,n))),PL(e,(()=>e.bindTexture(e.TEXTURE_2D,null))),{texture:i,texShape:[n,t]}}function qB(e){return e.internalFormatFloat}function QB(e){return e.internalFormatHalfFloat}function XB(e){return e.downloadTextureFormat}function ZB(e){return e.internalFormatPackedFloat}function KB(e){return e.internalFormatPackedHalfFloat}function JB(e,t,n,r,a,s,i,o){const l=e,u=new Float32Array(function(e,t){const[n,r]=LL(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 YB{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.itemsToPoll=[];const t=_l().getNumber("WEBGL_VERSION");if(null!=e?(this.gl=e,function(e,t){WL[e]=t}(t,e)):this.gl=TL(t),e=this.gl,2===_l().getNumber("WEBGL_VERSION")){const t=e;this.createVertexArray=()=>PL(t,(()=>t.createVertexArray())),this.bindVertexArray=e=>PL(t,(()=>t.bindVertexArray(e))),this.deleteVertexArray=e=>PL(t,(()=>t.deleteVertexArray(e))),this.getVertexArray=()=>PL(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=()=>PL(e,(()=>t.createVertexArrayOES())),this.bindVertexArray=n=>PL(e,(()=>t.bindVertexArrayOES(n))),this.deleteVertexArray=n=>PL(e,(()=>t.deleteVertexArrayOES(n))),this.getVertexArray=()=>PL(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===_l().getNumber("WEBGL_VERSION")){const e="OES_texture_float",t="OES_texture_half_float";if(this.textureFloatExtension=GL(this.gl,e),sB(this.gl,t))this.textureHalfFloatExtension=GL(this.gl,t);else if(_l().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),sB(this.gl,r))this.colorBufferHalfFloatExtension=GL(this.gl,r);else if(_l().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",sB(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!sB(this.gl,r))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension(r)}this.vertexBuffer=UB(this.gl),this.indexBuffer=HB(this.gl),this.framebuffer=function(e){return KL(e,(()=>e.createFramebuffer()),"Unable to create WebGLFramebuffer.")}(this.gl),this.textureConfig=BL(this.gl,this.textureHalfFloatExtension)}get debug(){return _l().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program,this.outputTexture;const e=this.gl;PL(e,(()=>e.finish())),PL(e,(()=>e.bindFramebuffer(e.FRAMEBUFFER,null))),PL(e,(()=>e.deleteFramebuffer(this.framebuffer))),PL(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,null))),PL(e,(()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null))),PL(e,(()=>e.deleteBuffer(this.indexBuffer))),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),function(e,t,n,r){const[a,s]=DL(t,n);return jB(e,a,s,qB(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]=DL(t,n);return jB(e,a,s,QB(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]=DL(t,n);return jB(e,a,s,XB(r),e.RGBA,e.UNSIGNED_BYTE)}(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),function(e,t,n){PL(e,(()=>e.bindTexture(e.TEXTURE_2D,t))),n.data instanceof Uint8Array?2===_l().getNumber("WEBGL_VERSION")?PL(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,e.RGBA,e.UNSIGNED_BYTE,n.data))):PL(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data))):2===_l().getNumber("WEBGL_VERSION")?PL(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n))):PL(e,(()=>e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n))),PL(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;PL(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===_l().getNumber("WEBGL_VERSION")?PL(e,(()=>e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,r,e.RGBA,o,i))):PL(e,(()=>e.texImage2D(e.TEXTURE_2D,0,l,n,r,0,e.RGBA,o,i))),PL(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]=LL(t,n);return jB(e,a,s,KB(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]=LL(t,n);return jB(e,a,s,ZB(r),e.RGBA,e.FLOAT)}(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(XL(this.gl,this.framebuffer),this.outputTexture=null),PL(this.gl,(()=>this.gl.deleteTexture(e)))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,n){return this.downloadMatrixDriver(e,(()=>function(e,t,n,r){const[a,s]=DL(t,n),i=new Uint8Array(t*n*4);return PL(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 JB(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,r){const a=e.createBuffer();PL(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,a)));const s=16*t*n;return PL(e,(()=>e.bufferData(e.PIXEL_PACK_BUFFER,s,e.STREAM_READ))),PL(e,(()=>e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0))),PL(e,(()=>e.bindBuffer(e.PIXEL_PACK_BUFFER,null))),a}(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(_l().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 _l().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=()=>this.isQueryAvailable(t,_l().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 PL(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=VB(t));const n=function(e){return KL(e,(()=>e.createProgram()),"Unable to create WebGLProgram.")}(t);PL(t,(()=>t.attachShader(n,this.vertexShader))),PL(t,(()=>t.attachShader(n,e))),function(e,t){if(PL(e,(()=>e.linkProgram(t))),!_l().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&&HL(t,r),r}buildVao(e){this.setProgram(e),this.bindVertexArray(e.vao);const t=this.gl;PL(t,(()=>t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer))),function(e,t,n){PL(e,(()=>e.bindBuffer(e.ARRAY_BUFFER,n))),jL(e,t,"clipSpacePos",n,3,20,0)&&jL(e,t,"uv",n,2,20,12)}(t,e,this.vertexBuffer)}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&(PL(this.gl,(()=>this.gl.deleteProgram(e))),this.deleteVertexArray(e.vao))}setProgram(e){this.throwIfDisposed(),this.program=e,null!=this.program&&this.debug&&HL(this.gl,this.program),PL(this.gl,(()=>this.gl.useProgram(e)))}getUniformLocation(e,t,n=!0){return this.throwIfDisposed(),n?function(e,t,n){return KL(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(),PL(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){PL(e,(()=>qL(e,t,r))),PL(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]=LL(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&&HL(this.gl,this.program),ZL(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;if(this.debug){this.getVertexArray();this.debugValidate()}PL(e,(()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),PL(this.gl,(()=>this.gl.finish()))}getQueryTimerExtension(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=GL(this.gl,2===_l().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===_l().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===_l().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 Ko((()=>this.disposed||this.isQueryAvailable(e,_l().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")))),this.getQueryTime(e,_l().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 _l().platform&&(n=_l().platform.setTimeoutCustom.bind(_l().platform)),Ko((()=>(this.pollItems(),0===this.itemsToPoll.length)),(()=>0),null,n)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),QL(this.gl,e,this.framebuffer),this.debug&&ZL(this.gl)}unbindTextureToFrameBuffer(){null!=this.outputTexture?(QL(this.gl,this.outputTexture,this.framebuffer),this.debug&&ZL(this.gl)):XL(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;QL(r,e,this.framebuffer),this.debug&&ZL(r),this.outputTexture=e,PL(r,(()=>r.viewport(0,0,t,n))),PL(r,(()=>r.scissor(0,0,t,n)))}setOutputMatrixWriteRegionDriver(e,t,n,r){this.throwIfDisposed(),PL(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:eP,bincountImpl:tP,bincountReduceImpl:nP,bitwiseAndImpl:rP,castImpl:aP,ceilImpl:sP,concatImpl:iP,equalImpl:oP,expImpl:lP,expm1Impl:uP,floorImpl:cP,gatherNdImpl:dP,gatherV2Impl:hP,greaterImpl:pP,greaterEqualImpl:fP,lessImpl:mP,lessEqualImpl:gP,linSpaceImpl:yP,logImpl:bP,maxImpl:vP,maximumImpl:AP,minimumImpl:xP,multiplyImpl:kP,negImpl:wP,notEqualImpl:SP,prodImpl:CP,raggedGatherImpl:IP,raggedRangeImpl:WP,raggedTensorToTensorImpl:_P,rangeImpl:TP,rsqrtImpl:NP,scatterImpl:EP,sigmoidImpl:RP,simpleAbsImpl:$P,sliceImpl:OP,sparseFillEmptyRowsImpl:FP,sparseReshapeImpl:DP,sparseSegmentReductionImpl:MP,sqrtImpl:LP,staticRegexReplaceImpl:BP,stridedSliceImpl:PP,stringNGramsImpl:zP,stringSplitImpl:GP,stringToHashBucketFastImpl:VP,subImpl:UP,tileImpl:HP,topKImpl:jP,transposeImpl:qP,uniqueImpl:QP}=FO;
/**
 * @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 XP(e,t){return["x","y","z","w","u","v"].slice(0,t).map((t=>`${e}.${t}`))}function ZP(e,t){return 1===t?[e]:XP(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 KP{constructor(e){if(this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.enableShapeUniforms=FB(this.outputShape.length),0===this.rank)this.userCode="\n        void main() {\n          setOutput(vec4(getA(), 0., 0., 0.));\n        }\n      ";else{const e=ZP("rc",this.rank),t=_B(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 JP{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=FB(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?fB(["r","c","d"],"inputShape"):hB(["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":mB(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 YP{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=tz(t,n),a=nz(e,r,n);a in this.freeTextures||(this.freeTextures[a]=[]),a in this.usedTextures||(this.usedTextures[a]=[]);const s=ez(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===OL.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===OL.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):r===OL.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===OL.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===OL.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=tz(n,r),s=nz(t,a,r);s in this.freeTextures||(this.freeTextures[s]=[]);const i=ez(t,a,this.gpgpu.gl,this.gpgpu.textureConfig,r),o=_l().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 ez(e,t,n,r,a){const s=function(e,t){switch(e){case OL.PACKED_2X2_FLOAT32:return ZB(t);case OL.PACKED_2X2_FLOAT16:return KB(t);case OL.UNPACKED_FLOAT32:return qB(t);case OL.UNPACKED_FLOAT16:return QB(t);case OL.PACKED_4X1_UNSIGNED_BYTE:return XB(t);default:throw new Error(`Unknown physical texture type ${e}`)}}(t,r);let i;if(a){const[t,n]=LL(e[0],e[1]);i=t*n}else{const[t,n]=DL(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 tz(e,t){if(e===RL.UPLOAD)return OL.PACKED_2X2_FLOAT32;if(e===RL.RENDER||null==e)return function(e){return _l().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?OL.PACKED_2X2_FLOAT32:OL.UNPACKED_FLOAT32:e?OL.PACKED_2X2_FLOAT16:OL.UNPACKED_FLOAT16}(t);if(e===RL.DOWNLOAD||e===RL.PIXELS)return OL.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${e}`)}function nz(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 rz{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=FB(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 az="if (isnan(x)) return x;",sz="return x;",iz="return abs(x);",oz="return (x >= 0.0) ? x : (exp(x) - 1.0);",lz=az+"\n  return (x < 0.0) ? 0.0 : x;\n",uz=az+"\n  return (x < 0.0) ? 0.0 : min(6.0, x);\n",cz="return x;",dz="return 1.0 / (1.0 + exp(-1.0 * x));",hz="return x;",pz="\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",fz="\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",mz="\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",gz="return 1.0 / (1.0 + exp(-1.0 * x));";class yz{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=FB(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 bz{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=FB(this.outputShape.length);const t=e.length,n=ZP("rc",t),r=_B(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 vz=Jv,Az={};const xz=_l().getNumber("CPU_HANDOFF_SIZE_THRESHOLD");class kz extends Fo{nextDataId(){return kz.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,!_l().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let t;if(null!=e){if(e instanceof YB)t=e;else{const n=TL(_l().getNumber("WEBGL_VERSION"),e);t=new YB(n)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{const e=TL(_l().getNumber("WEBGL_VERSION"));t=new YB(e),this.binaryCache=((n=_l().getNumber("WEBGL_VERSION"))in Az||(Az[n]={}),Az[n]),this.gpgpuCreatedLocally=!0}var n;this.gpgpu=t,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new YP(this.gpgpu),this.numMBBeforeWarning=null==_l().global.screen?1024:_l().global.screen.height*_l().global.screen.width*window.devicePixelRatio*600/1024/1024,this.texData=new Oo(this,tf())}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=eB(t),u=new zB(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((_l().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||_l().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:RL.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(_l().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:RL.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 yz(i,cz):new rz(i,cz);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=Vh()),"complex64"===r){c=Kk(this.readSync(a.real.dataId),this.readSync(a.imag.dataId))}else c=this.getValuesFromTexture(e);return l&&(this.downloadWaitMs+=Vh()-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 yz(r,cz):new rz(r,cz);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(_l().getBool("DEBUG")&&!_l().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===_l().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&&_l().get("WEBGL_BUFFER_SUPPORTED")){l=this.decode(e);const t=this.texData.get(l.dataId);c=this.gpgpu.createBufferFromTexture(t.texture.texture,...ML(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=Kk(e[0],e[1])}else if(null==c)u=this.getValuesFromTexture(e);else{const e=Ho(r);u=this.gpgpu.downloadFloat32MatrixFromBuffer(c,e)}if(null!=l&&this.disposeIntermediateTensorInfo(l),null!=c){const e=this.gpgpu.gl;PL(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)&&tf().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 yz(a,cz):new rz(a,cz);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=tf().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=>Hh(e)));return sm(e.shape,e.dtype,n)}catch(n){throw new Error("Failed to decode encoded string bytes into utf-8")}return sm(e.shape,e.dtype,t)}checkNumericalProblems(e){if(null!=e)for(let t=0;t<e.length;t++){const n=e[t];if(!zL(n)){if(_l().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=Ho(t);if(_l().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){const n=this.decode(e),r=this.texData.get(n.dataId),s=this.gpgpu.downloadMatrixFromPackedTexture(r.texture.texture,...ML(t)).subarray(0,a);return this.disposeIntermediateTensorInfo(n),s}const s=_l().getBool("WEBGL_PACK")&&!0===r,i=s?eB(t):t,o=s?new BB(i):new LB(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 _l().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=qh(this.activeTimers.map((e=>e.query))).filter((e=>null!=e)),s=qh(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(_l().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const e=await Promise.all(a);i.kernelMs=zo(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 _l().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:Vh(),endMs:null}}endTimer(e){return _l().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=Vh(),e)}async getQueryTime(e){if(_l().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=xz){return _l().getBool("WEBGL_CPU_FORWARD")&&e.every((e=>null==this.texData.get(e.dataId).texture&&Ho(e.shape)<t))}getGPGPUContext(){return this.gpgpu}where(e){jd();const t=e.dataSync();return vz(e.shape,t)}packedUnaryOp(e,t,n){const r=new yz(e.shape,t),a=this.compileAndRun(r,[e],n);return tf().makeTensorFromTensorInfo(a)}abs(e){if(this.shouldExecuteOnCPU([e])&&"complex64"!==e.dtype){const t=$P(this.texData.get(e.dataId).values);return this.makeOutput(e.shape,e.dtype,t)}if(_l().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,iz,e.dtype);const t=new rz(e.shape,iz),n=this.compileAndRun(t,[e]);return tf().makeTensorFromTensorInfo(n)}makeTensorInfo(e,t,n){let r;if("string"===t&&null!=n&&n.length>0&&ll(n[0])){const a=n.map((e=>Uh(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 tf().makeTensorFromTensorInfo(this.makeTensorInfo(e,t,n),this)}unpackTensor(e){const t=new bz(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){const t=new KP(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}packedReshape(e,t){const n=[JL(e.shape),...YL(e.shape)],r={dtype:e.dtype,shape:n,dataId:e.dataId},a=[JL(t),...YL(t)],s=new JP(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){Go(Ho(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=eB(a);let o;o=r?new MB(i):new DB(i);const l=[null!=t?t:ML(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===NL.DENSE){const t=null!=s?s:ML(e.outputShape);o.texShape=t.map((e=>2*e))}if(null!=e.outTexUsage&&(o.usage=e.outTexUsage),0===Ho(i.shape))return o.values=tl(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&&Ho(t.shape)<=_l().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&&!nB(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}=TB(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=fl(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&&qo(t.shape,s),f=1===Ho(t.shape),m=_g(t.shape,n.shape),g=!e.packedInputs&&h===n.shape.length&&qo(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+`${_l().getNumber("WEBGL_VERSION")}`,s}(e,u,c),h=this.getAndSaveBinary(d,(()=>RB(this.gpgpu,e,u,c))),p=null!=this.activeTimers;let f;p&&(f=this.startTimer()),_l().get("ENGINE_COMPILE_ONLY")||function(e,t,n,r,a){t.program.enableShapeUniforms||(OB(t.inShapeInfos,n),OB([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===_l().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}=TB(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(Ho(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=fl(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=_l().getNumber("WEBGL_FLUSH_THRESHOLD");if(m>0){const e=Vh();e-this.lastGlFlushTime>m&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=e)}if(!_l().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(!_l().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=rf((()=>{if(!_l().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=_l().getBool("DEBUG");_l().set("DEBUG",!1);const t=this.abs(Jg(1e-8)).dataSync()[0];if(_l().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=Vh());let c=t.texShape;if(null==c&&(c=function(e,t=!1){let n=_l().getNumber("WEBGL_MAX_TEXTURE_SIZE"),r=_l().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");if(r===1/0&&_l().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?Bo(e[n]):e[n]))).length&&(e=[2,e[0]])),2!==e.length){const t=el(e);e=t.newShape}let a=Ho(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=JL(e);let n=2,r=2;e.length&&([n,r]=YL(e)),a=t*(n/2)*(r/2),s=Xo(a).map((e=>2*e))}else s=Xo(a);return s}(n,o),t.texShape=c),null!=a){const e=eB(n);let s,i=c[1],d=c[0];const h=a instanceof Uint8Array||a instanceof Uint8ClampedArray;!o&&h||([i,d]=LL(c[0],c[1])),s=o?new GB(e,h):new zB(e,h);const p=h?[d,i]:c,f=this.makeTensorInfo(p,r),m=this.texData.get(f.dataId);m.usage=h?RL.PIXELS:RL.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,_l().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+=Vh()-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]*il(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 Ik(),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 UL(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}=$B(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=tf().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 tf().makeTensorFromDataId(l,t,n,o)}}kz.nextDataId=0,Pp()&&lf("webgl",(()=>new kz),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 wz="\n  if (isnan(a)) return a;\n  if (isnan(b)) return b;\n";class Sz{constructor(e,t,n){this.variableNames=["A","B"],this.outputShape=Ng(t,n),this.enableShapeUniforms=FB(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 Cz="\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 Iz{constructor(e,t,n,r=!1){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Ng(t,n);const a=this.outputShape.length;this.enableShapeUniforms=FB(a);let s="";if(r)if(0===a||1===Ho(this.outputShape))s="\n          result.y = 0.;\n          result.z = 0.;\n          result.w = 0.;\n        ";else{if(s=`\n          ${_B(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=ZP("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 Wz(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 _z={kernelName:Xu,backendName:"webgl",kernelFunc:Wz};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 Tz(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=Wz({inputs:{x:r},backend:n}),l=Wz({inputs:{x:a},backend:n});return i.complexTensorInfos={real:o,imag:l},s}const Nz={kernelName:iu,backendName:"webgl",kernelFunc:Tz},Ez="return (a < 0.) ? b * a : a;",Rz="\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 $z={kernelName:tc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{alpha:s}=r,i=n.makeTensorInfo([],"float32",zh(s,"float32")),o=_l().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Iz(Rz,a.shape,i.shape):new Sz(Ez,a.shape,i.shape),l=n.runWebGLProgram(o,[a,i],"float32");return n.disposeIntermediateTensorInfo(i),l}},Oz="return (a < 0.) ? b * a : a;",Fz="\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 Dz={kernelName:Mc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r,alpha:a}=t,s=_l().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Iz(Fz,r.shape,a.shape):new Sz(Oz,r.shape,a.shape);return n.runWebGLProgram(s,[r,a],"float32")}},Mz="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 Lz({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=_l().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&null!=t?new yz(i.shape,t):new rz(i.shape,e),o.runWebGLProgram(u,[i],l)}}function Bz({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 Sz(e,l.shape,u.shape);return c.runWebGLProgram(i,[a,s],wp(n.dtype,r.dtype))})),s=Tz({inputs:{real:r,imag:a},backend:c});return c.disposeIntermediateTensorInfo(r),c.disposeIntermediateTensorInfo(a),s}const d=s||wp(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?Rw(e):e,r="string"===l.dtype?Rw(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=_l().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&null!=t?new Iz(t,l.shape,u.shape,n):new Sz(e,l.shape,u.shape),c.runWebGLProgram(h,[l,u],d)}}function Pz(e,t=!1){if("linear"===e)return t?hz:sz;if("relu"===e)return t?fz:lz;if("elu"===e)return t?pz:oz;if("relu6"===e)return t?mz:uz;if("prelu"===e)return t?Fz:Oz;if("leakyrelu"===e)return t?Rz:Ez;if("sigmoid"===e)return t?gz:dz;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 zz{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=FB(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 Gz={REAL:"return areal * breal - aimag * bimag;",IMAG:"return areal * bimag + aimag * breal;"};class Vz{constructor(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Ng(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 Uz="return a * b;";function Hz(e){const{inputs:t,backend:n}=e,{a:r,b:a}=t,s=wp(r.dtype,a.dtype);if("complex64"===r.dtype){const e=n.texData.get(r.dataId),t=n.texData.get(a.dataId),s=new Vz(Gz.REAL,r.shape,a.shape),i=new Vz(Gz.IMAG,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=Tz({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]=kP(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=_l().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Iz(Uz,r.shape,a.shape):new Sz(Uz,r.shape,a.shape),n.runWebGLProgram(i,[r,a],s)}const jz={kernelName:Ic,backendName:"webgl",kernelFunc:Hz};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 qz(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{shape:s}=r,i=n,o=Ho(a.shape),l=Jo(s,o),u=Ho(l);Go(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||nB(a.shape,l)||null!==c.texture&&nB(c.shape,l)?(i.incRef(a.dataId),{dataId:a.dataId,shape:l,dtype:a.dtype}):function(e,t,n){const r=[JL(e.shape),...YL(e.shape)],a={dtype:e.dtype,shape:r,dataId:e.dataId},s=[JL(t),...YL(t)],i=new JP(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 Qz={kernelName:jc,backendName:"webgl",kernelFunc:qz};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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){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 * ${Qo(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 Zz{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 Kz(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=Dk(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 Xz({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:u},o):new Xz({windowSize:l,inSize:o,batchSize:e.shape[0],outSize:u}):new Zz({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 Jz{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=_B(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 Yz{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=_B(this.rank),a=XP("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 eG(e,t,n){const r=_l().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Yz(e.shape,t):new Jz(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 tG(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=Yo(a,e.shape);let o=i;const l=jg(o,s),u=null!=l;let c=e;u&&(c=eG(e,l,r),o=Qg(o.length,s)),Hg("sum",o,s);const[d,h]=Vg(c.shape,o);let p=d;n&&(p=Ug(d,i));const f=Ho(h),m=qz({inputs:{x:c},attrs:{shape:[Ho(e.shape)/f,f]},backend:r}),g=Kz(m,Sp(e.dtype),"sum",r),y=qz({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 nG={kernelName:pd,backendName:"webgl",kernelFunc:tG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 rG(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=qP(e,a.shape,a.dtype,s,l);u=i.makeTensorInfo(l,a.dtype);i.texData.get(u.dataId).values=t}else u=eG(a,s,i);return u}const aG={kernelName:Fd,backendName:"webgl",kernelFunc:rG},sG=1e3;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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({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=Ho(m),b=Ho(g),v=Ng(e.shape.slice(0,-2),t.shape.slice(0,-2)).concat([p,f]);Go(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=qz({inputs:{x:e},backend:a,attrs:{shape:A}}),w=qz({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?Pz(l,!0):null;let E;if((1===p||1===f)&&I>sG&&!1===(W||_||T||null!=N)){let e=k,t=w;n&&(e=rG({inputs:{x:k},backend:a,attrs:{perm:[0,2,1]}}),S.push(e)),r&&(t=rG({inputs:{x:w},backend:a,attrs:{perm:[0,2,1]}}),S.push(t));const s=1===f;let i=e;1!==f&&(i=qz({inputs:{x:e},backend:a,attrs:{shape:[C,I,1]}}),S.push(i));const o=1===f?2:1;let l=t;s&&(l=qz({inputs:{x:t},backend:a,attrs:{shape:[C,1,I]}}),S.push(l));const u=Hz({inputs:{a:i,b:l},backend:a});E=tG({inputs:{x:u},backend:a,attrs:{axis:o,keepDims:!0}}),S.push(u)}else{const l=wp(e.dtype,t.dtype),u=new zz(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",zh(o,"float32"));c.push(e),S.push(e)}E=a.runWebGLProgram(u,c,l)}const R=qz({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 oG={kernelName:Vd,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 iG({a:a,b:s,transposeA:l,transposeB:u,backend:n,bias:i,preluActivationWeights:o,leakyreluAlpha:d,activation:c})}},lG="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 uG={kernelName:$l,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=$P(e.values);return n.makeTensorInfo(r.shape,r.dtype,t)}let a;return a=_l().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new yz(r.shape,lG):new rz(r.shape,lG),n.runWebGLProgram(a,[r],r.dtype)}},cG=Lz({opSnippet:az+"\n  if (abs(x) > 1.) {\n    return NAN;\n  }\n  return acos(x);\n"}),dG={kernelName:Ol,backendName:"webgl",kernelFunc:cG},hG=Lz({opSnippet:az+"\n  if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));"}),pG={kernelName:Fl,backendName:"webgl",kernelFunc:hG},fG="return a + b;",mG=Bz({opSnippet:fG,packedOpSnippet:fG,supportsComplex:!0,cpuKernelImpl:eP}),gG={kernelName:Dl,backendName:"webgl",kernelFunc:mG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 yG{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 bG{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 vG={kernelName:Ml,backendName:"webgl",kernelFunc:function e(t){const{inputs:n,backend:r}=t,a=n;if(1===a.length)return Wz({inputs:{x:a[0]},backend:r});if(a.length>_l().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)=>wp(e,t))),i=a.map((e=>e.shape)),o=_l().getBool("WEBGL_PACK")?new bG(a[0].shape,i):new yG(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 AG={kernelName:Ll,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=Yo(s,a.shape);let u=l;const c=jg(u,o);let d=a;null!=c&&(d=rG({inputs:{x:a},backend:n,attrs:{perm:c}}),u=Qg(u.length,o)),Hg("all",u,o);const[h,p]=Vg(d.shape,u),f=qz({inputs:{x:d},backend:n,attrs:{shape:[-1,Ho(p)]}}),m=Kz(f,f.dtype,"all",n);let g;if(i){g=qz({inputs:{x:m},backend:n,attrs:{shape:Ug(h,l)}})}else g=qz({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 xG={kernelName:Bl,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=Yo(s,a.shape);let u=l;const c=jg(u,o);let d=a;null!=c&&(d=rG({inputs:{x:a},backend:n,attrs:{perm:c}}),u=Qg(u.length,o)),Hg("any",u,o);const[h,p]=Vg(d.shape,u),f=qz({inputs:{x:d},backend:n,attrs:{shape:[-1,Ho(p)]}}),m=Kz(f,f.dtype,"any",n);let g;if(i){g=qz({inputs:{x:m},backend:n,attrs:{shape:Ug(h,l)}})}else g=qz({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 kG{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 wG{constructor(e,t,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,Go(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=_B(o),u=ZP("coords",o);let c,d;if(1===s){d=o+1;const e=_B(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=ZP("sourceLocR",d-1).concat("inIdx.r"),g=ZP("sourceLocG",d-1).concat("inIdx.g"),y=ZP("sourceLocB",d-1).concat("inIdx.b"),b=ZP("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 SG(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=Dk(s),o={windowSize:i,inSize:s,batchSize:a,outSize:Math.ceil(s/i)},l=new kG(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=SG(e,t,n,c);return e.disposeIntermediateTensorInfo(c),d}function CG(e,t,n,r=null){const a=null!=r?r.shape:t.shape,s=Dk(a[a.length-1]),i=new wG(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=CG(e,t,n,l);return e.disposeIntermediateTensorInfo(l),r}return l}function IG(e,t,n,r){const a=[n];if(Hg("arg"+r.charAt(0).toUpperCase()+r.slice(1),a,t.shape.length),!_l().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]=Vg(i.shape,a),u=Ho(l),c=qz({inputs:{x:i},backend:e,attrs:{shape:[-1,u]}});n.push(c);const d=SG(e,c,r);n.push(d);const h=qz({inputs:{x:d},backend:e,attrs:{shape:o}});return n.forEach((t=>e.disposeIntermediateTensorInfo(t))),h}return CG(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 WG={kernelName:Pl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;let i=Yo(s,a.shape);const o=jg(i,a.shape.length);let l=a;const u=[];null!=o&&(l=rG({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Qg(i.length,l.shape.length)),Hg("argMax",[i[0]],l.shape.length);const c=IG(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 _G={kernelName:zl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s}=r;let i=Yo(s,a.shape);const o=jg(i,a.shape.length);let l=a;const u=[];null!=o&&(l=rG({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(l),i=Qg(i.length,l.shape.length)),Hg("argMin",[i[0]],l.shape.length);const c=IG(n,l,i[0],"min");return u.forEach((e=>n.disposeIntermediateTensorInfo(e))),c}},TG=Lz({opSnippet:az+"\n  if (abs(x) > 1.) {\n    return NAN;\n  }\n  return asin(x);\n"}),NG={kernelName:Gl,backendName:"webgl",kernelFunc:TG},EG=Lz({opSnippet:az+"return log(x + sqrt(x * x + 1.0));"}),RG={kernelName:Vl,backendName:"webgl",kernelFunc:EG},$G=Lz({opSnippet:az+"\n  return atan(x);\n"}),OG={kernelName:Ul,backendName:"webgl",kernelFunc:$G},FG=Bz({opSnippet:wz+"\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  "+Cz+"\n  return result;\n"}),DG={kernelName:jl,backendName:"webgl",kernelFunc:FG},MG=Lz({opSnippet:az+"\n  if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;"}),LG={kernelName:Hl,backendName:"webgl",kernelFunc:MG};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 BG{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 PG{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 zG={kernelName:ql,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t;uB(a,"avgPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Go(Mm(i,1),(()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Wm(a.shape,s,i,1,o,l);if(1===u.filterWidth&&1===u.filterHeight&&qo(u.inShape,u.outShape))return Wz({inputs:{x:a},backend:n});const c=new BG(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 GG={kernelName:Xl,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=_m(a.shape,s,i,[1,1,1],o,l,u),d=new PG(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 VG{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 UG{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 HG={kernelName:Zl,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=_m(i.shape,o,l,[1,1,1],u,c),h=new UG(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 jG={kernelName:Ql,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s}=t,i=s;uB([a,s],"avgPoolGrad");const{filterSize:o,strides:l,pad:u}=r,c=Wm(i.shape,o,l,1,u),d=new VG(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 qG={kernelName:Kl,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{a:a,b:s}=t,{transposeA:i,transposeB:o}=r;return iG({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 QG{constructor(e,t,n,r,a,s){this.outputShape=[],this.variableNames=["x","mean","variance"],Ng(e,t),Ng(e,n);let i="0.0";null!=r&&(Ng(e,r),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="1.0";null!=a&&(Ng(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 XG{constructor(e,t,n,r,a,s){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Ng(e,t),Ng(e,n);let i="vec4(0.0)";null!=r&&(Ng(e,r),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");let o="vec4(1.0)";null!=a&&(Ng(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 ZG={kernelName:Uu,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r,mean:a,variance:s,offset:i,scale:o}=e;Go(a.shape.length===s.shape.length,(()=>"Batch normalization gradient requires mean and variance to have equal ranks.")),Go(null==i||a.shape.length===i.shape.length,(()=>"Batch normalization gradient requires mean and offset to have equal ranks.")),Go(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=_l().getBool("WEBGL_PACK_NORMALIZATION")?new XG(r.shape,a.shape,s.shape,c,d,l):new QG(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 KG{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const t=_B(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const n=function(e){if(1===e)return"sourceLoc";if(e<=6)return JG.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.${JG[t]} = start[${t}] + coords.${JG[t]};`)).join("\n")}\n      `,this.userCode=`\n      void main() {\n        ${r}\n        setOutput(getSource(${n}));\n      }\n    `}}const JG=["x","y","z","w","u","v"];class YG{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=_B(this.rank),n=ZP("coords",this.rank),r=ZP("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 eV(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{begin:s,size:i}=r,[o,l]=vk(a,s,i);if(ok(a,o,l),0===Ho(l))return n.makeTensorInfo(l,a.dtype,[]);if(n.shouldExecuteOnCPU([a])||"string"===a.dtype){const e=n.texData.get(a.dataId),t=OP(e.values,o,l,a.shape,a.dtype);return n.makeTensorInfo(l,a.dtype,t)}const{isPacked:u}=n.texData.get(a.dataId),c=yk(a.shape,o,l);if(u||!c){const e=_l().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new YG(l):new KG(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=bk(t,fl(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 tV={kernelName:id,backendName:"webgl",kernelFunc:eV},nV={kernelName:Jl,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,crops:i}=r;Go(a.shape.length<=4,(()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"));const o=s.reduce(((e,t)=>e*t)),l=Lk(a.shape,s,o),u=Bk(l.length,s.length),c=Pk(a.shape,s,o),d=zk(i,s.length),h=Gk(c,i,s.length),p=[],f=qz({inputs:{x:a},backend:n,attrs:{shape:l}}),m=rG({inputs:{x:f},backend:n,attrs:{perm:u}}),g=qz({inputs:{x:m},backend:n,attrs:{shape:c}}),y=eV({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 rV={kernelName:Yl,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=tP(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 aV={kernelName:eu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{a:r,b:a}=t,s=_l().getBool("WEBGL_PACK_BINARY_OPERATIONS"),i=_l().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]=rP(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 Iz("\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 Sz("\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 sV={kernelName:nu,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=Ng(Array.from(s),Array.from(i));return n.makeTensorInfo([o.length],"int32",Int32Array.from(o))}},iV=Bz({opSnippet:"return float(a != b);",cpuKernelImpl:SP,dtype:"bool"}),oV={kernelName:_c,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 lV(e){const{inputs:t,backend:n}=e,{input:r}=t;return Wz({inputs:{x:n.texData.get(r.dataId).complexTensorInfos.real},backend:n})}const uV={kernelName:Vc,backendName:"webgl",kernelFunc:lV},cV="return float(int(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 dV={kernelName:ru,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 Wz({inputs:{x:s},backend:r});const t=jy(s.shape),n=e({inputs:{x:s},backend:r,attrs:{dtype:"float32"}}),a=Tz({inputs:{real:n,imag:t},backend:r});return t.dispose(),r.disposeIntermediateTensorInfo(n),a}if("complex64"===s.dtype){const t=lV({inputs:{input:s},backend:r}),n=e({inputs:{x:t},backend:r,attrs:{dtype:i}});return r.disposeIntermediateTensorInfo(t),n}if(!sl(s.dtype,i)){const e=Wz({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]=aP(e,s.shape,s.dtype,i);return r.makeTensorInfo(t,n,a)}if("int32"===i)return function(e,t){const n=new rz(e.shape,cV),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",tl("bool",1)),t=iV({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}`)}},hV="return ceil(x);",pV=Lz({opSnippet:hV,packedOpSnippet:hV,cpuKernelImpl:sP}),fV={kernelName:au,backendName:"webgl",kernelFunc:pV};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 mV{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 gV{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 yV={kernelName:su,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{clipValueMin:s,clipValueMax:i}=r;let o;o=_l().getBool("WEBGL_PACK_CLIP")?new gV(a.shape):new mV(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 bV{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 vV(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}const AV={kernelName:ou,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=n.texData.get(r.dataId),s=new bV(r.shape),i=[vV(r,a.complexTensorInfos.real),vV(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 xV{constructor(e){this.outputShape=[],this.outputShape=_k(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 kV{constructor(e,t){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=_k(e,t);const n=this.outputShape,r=n.length,a=_B(r),s=ZP("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}(${wV(i,l,e)}),\n            vec2(${wV(u,l,e)}));\n        }`}const h=o.length,p=o[o.length-1];d+=`\n        return getChannel(\n          getT${h}(${wV(i,l,p)}),\n          vec2(${wV(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 wV(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 SV(e){const{inputs:t,backend:n}=e,{input:r}=t;return Wz({inputs:{x:n.texData.get(r.dataId).complexTensorInfos.imag},backend:n})}const CV={kernelName:Ku,backendName:"webgl",kernelFunc:SV};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 IV(e,t,n){const r=e[0].dtype;if("complex64"===r){const r=e.map((e=>lV({inputs:{input:e},backend:n}))),a=e.map((e=>SV({inputs:{input:e},backend:n}))),s=IV(r,t,n),i=IV(a,t,n),o=Tz({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=Ho(e.shape.slice(t));return qz({inputs:{x:e},backend:n,attrs:{shape:[-1,r]}})})),s=a.map((e=>({vals:n.readSync(e.dataId),shape:e.shape}))),i=_k(a.map((e=>e.shape)),1),o=1===a[0].shape[0],l=iP(s,i,r,o),u=_k(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=>Ho(e.shape)>0)),i=_l().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&s[0].shape.length>1;if(1===s.length){const t=i?new rz(e[0].shape,cz):new yz(e[0].shape,cz);return n.runWebGLProgram(t,e,r)}const o=_l().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(IV(r,t,n))}const r=IV(e,t,n);for(const t of e)n.disposeIntermediateTensorInfo(t);return r}if(i){const e=new kV(s.map((e=>e.shape)),t);return n.runWebGLProgram(e,s,r)}const{tensors2D:l,outShape:u}=function(e,t,n){const r=_k(e.map((e=>e.shape)),t),a=e.map((e=>qz({inputs:{x:e},attrs:{shape:[-1,Ho(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 xV(l.map((e=>e.shape))),d=n.runWebGLProgram(c,l,r);l.forEach((e=>n.disposeIntermediateTensorInfo(e)));const h=qz({inputs:{x:d},attrs:{shape:u},backend:n});return n.disposeIntermediateTensorInfo(d),h}function WV(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r,s=Yo(a,t[0].shape)[0];Wk(t.map((e=>e.shape)),s);const i=_k(t.map((e=>e.shape)),s);if(0===Ho(i))return n.makeTensorInfo(i,t[0].dtype,[]);const o=t.filter((e=>Ho(e.shape)>0));return 1===o.length?Wz({inputs:{x:o[0]},backend:n}):IV(o,s,n)}const _V={kernelName:lu,backendName:"webgl",kernelFunc:WV};
/**
 * @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 TV{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 NV{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 EV{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=FB(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?Bo(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 RV{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=FB(this.outputShape.length);const{dataFormat:n}=t,r=dB(),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 $V(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 OV({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;let f;const m=[];if(null!=s){const e=$V(s.shape,p);null!=e&&(s=qz({inputs:{x:s},backend:r,attrs:{shape:e}}),m.push(s))}if(null!=a){const e=$V(a.shape,p);null!=e&&(a=qz({inputs:{x:a},backend:r,attrs:{shape:e}}),m.push(a))}if(!((1===d||1===h)&&c>sG)&&u.isPacked&&p&&null!=u.texture&&l[2]%2!=0&&qo(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]++,Go(nB(u.shape,d.shape),(()=>`packed reshape ${u.shape} to ${d.shape} isn't free`));const p=qz({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}});m.push(p);const g=iG({a:d,b:p,backend:r,transposeA:false,transposeB:false,bias:a,activation:o,preluActivationWeights:s,leakyreluAlpha:i}),y=r.texData.get(g.dataId);Go(y.isPacked,(()=>"batchMatMul result is expected to be packed")),u.shape=h,y.shape=n.outShape,f=Wz({inputs:{x:g},backend:r}),f.shape=n.outShape,m.push(g)}else{const l=n.outHeight*n.outWidth,u=qz({inputs:{x:e},backend:r,attrs:{shape:p?[n.batchSize,l,n.inChannels]:[n.batchSize,n.inChannels,l]}}),c=qz({inputs:{x:t},backend:r,attrs:{shape:[1,n.inChannels,n.outChannels]}}),d=iG({a:p?u:c,b:p?c:u,transposeA:!p,transposeB:false,backend:r,bias:a,activation:o,preluActivationWeights:s,leakyreluAlpha:i});f=qz({inputs:{x:d},backend:r,attrs:{shape:n.outShape}}),m.push(u),m.push(c),m.push(d)}for(const g of m)r.disposeIntermediateTensorInfo(g);return f}function FV({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=$V(s.shape,f);null!=e&&(s=qz({inputs:{x:s},backend:r,attrs:{shape:e}}),b.push(s))}if(null!=a){const e=$V(a.shape,f);null!=e&&(a=qz({inputs:{x:a},backend:r,attrs:{shape:e}}),b.push(a))}const v=qz({inputs:{x:t},backend:r,attrs:{shape:[1,m,Ho(t.shape)/m]}});b.push(v);const A=new RV(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=qz({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?Pz(o,!0):null,_=new zz(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",zh(i,"float32"));T.push(e),b.push(e)}const N=r.runWebGLProgram(_,T,"float32"),E=qz({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 DV={kernelName:uu,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=Bm(l),h=Tm(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&&_l().getBool("WEBGL_EXP_CONV")){const e=new EV(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(_l().getBool("WEBGL_CONV_IM2COL"))p=FV({x:a,filter:s,convInfo:h,backend:n});else{const e=new TV(h);p=n.runWebGLProgram(e,[a,s],"float32")}else p=OV({x:a,filter:s,convInfo:h,backend:n});const f=qz({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 MV{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 LV{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 BV{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 PV{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 zV={kernelName:cu,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=Bm(l),h=Tm(a.shape,c,i,1,o,u,!1,d),p=new MV(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 GV{constructor(e){this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=e.inShape,this.enableShapeUniforms=FB(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 VV={kernelName:du,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=Bm(u),h=Tm(i,s.shape,o,1,l,c,!1,d);if(_l().getBool("WEBGL_PACK_CONV2DTRANSPOSE")&&"channelsLast"===d){const e=[[h.strideHeight,h.strideWidth]],t=new GV(h);return n.runWebGLProgram(t,[a,s],"float32",e)}{const e=new LV(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 UV={kernelName:hu,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=Nm(a.shape,s.shape,i,l,o),c=new NV(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 HV={kernelName:pu,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=Nm(a.shape,l,i,1,o),c=new BV(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 jV={kernelName:fu,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=Nm(l,s.shape,o,1,i),c=new PV(u);return n.runWebGLProgram(c,[a,s],"float32")}},qV=Lz({opSnippet:Mz+"\n  return cos(x);\n",packedOpSnippet:`\n  vec4 result = cos(x);\n  bvec4 isNaN = isnan(x);\n  ${Cz}\n  return result;\n`}),QV={kernelName:mu,backendName:"webgl",kernelFunc:qV},XV=Lz({opSnippet:"\n  float e2x = exp(-x);\n  return (e2x + 1.0 / e2x) / 2.0;\n"}),ZV={kernelName:gu,backendName:"webgl",kernelFunc:XV};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 KV{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 JV={kernelName:vu,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 KV(a.shape,s.shape,o,l,u);return n.runWebGLProgram(c,[a,s,i],"float32")}};var YV,eU;(eU=YV||(YV={})).Prod="*",eU.Sum="+";class tU{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===YV.Prod?"1.0":"0.0",i=n?s:`getX(${nU(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        ${_B(a)} coords = getOutputCoords();\n        int end = ${rU(a,"coords",this.op)};\n        float val = ${i};\n        int pow2 = int(pow(2.0, index));\n        if (${l}) {\n          int idx = ${u};\n          ${rU(a,"coords",this.op)} = idx;\n          val ${this.op}= getX(${nU(a,"coords",this.op)});\n        }\n        setOutput(val);\n      }\n    `}}function nU(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 rU(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 aU(e,t,n,r,a,s){const i=t.shape.length,o=jg([r],i);let l=t;null!=o&&(l=rG({inputs:{x:t},backend:n,attrs:{perm:o}}));const u=Qg(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=Wz({inputs:{x:l},backend:n});for(let h=0;h<=Math.ceil(Math.log2(c))-1;h++){const t=new tU(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 tU(e,l.shape,a,s),r=d;d=n.runWebGLProgram(t,[d],d.dtype),n.disposeIntermediateTensorInfo(r)}if(null!=o){const e=rG({inputs:{x:d},backend:n,attrs:{perm:qg(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 sU={kernelName:yu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;return aU(YV.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 iU={kernelName:bu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{axis:s,exclusive:i,reverse:o}=r;return aU(YV.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 oU={kernelName:Au,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=tP(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=nP(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 lU{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 uU={kernelName:xu,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 lU("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 cU{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=FB(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 dU{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=FB(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?Bo(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 hU={kernelName:ku,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]),Go(Mm(i,c),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`));const d=Tm(a.shape,s.shape,i,c,o,u,!0);let h;h=_l().getBool("WEBGL_PACK_DEPTHWISECONV")&&d.strideWidth<=2&&d.outChannels/d.inChannels==1?new dU(d):new cU(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 pU{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 fU{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 mU={kernelName:wu,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=Tm(a.shape,c,i,o,l,u,!0),h=new pU(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 gU={kernelName:Su,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=Tm(c,s.shape,i,o,l,u,!0),h=new fU(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 yU{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 bU={kernelName:Cu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{x:r}=t,a=[...r.shape,...r.shape],s=Ho(r.shape),i=qz({inputs:{x:r},backend:n,attrs:{shape:[s]}}),o=new yU(s),l=n.runWebGLProgram(o,[i],i.dtype),u=qz({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 vU{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 AU={kernelName:Iu,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=Im(a.shape,s.shape,i,o,"NHWC",l);let c;const d=new vU(u);c=n.runWebGLProgram(d,[a,s],"float32");const h=qz({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 xU={kernelName:Eu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{equation:a}=r,s=t,{allDims:i,summedDims:o,idDims:l}=uw(a,s.length);dw(i.length,l,s);const{path:u,steps:c}=hw(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}=cw(p,l[e]);let a;pw(t)?a=s[e]:(a=rG({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);qo(a.shape,i)||(a=qz({inputs:{x:a},backend:n,attrs:{shape:i}}),f.push(a)),null===h?h=a:(h=Hz({inputs:{a:a,b:h},backend:n}),f.push(h))}m<d-1&&(u[m]>=0&&(h=tG({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}},kU=Lz({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"}),wU={kernelName:Ru,backendName:"webgl",kernelFunc:kU},SU={kernelName:$u,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n}=e,{dy:r,y:a}=t,s=_l().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Iz("\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 Sz("return (b >= 0.0) ? a : a * (b + 1.0);",r.shape,a.shape);return n.runWebGLProgram(s,[r,a],r.dtype)}},CU=Bz({opSnippet:"return float(a == b);",packedOpSnippet:"\n  return vec4(equal(a, b));\n",dtype:"bool",cpuKernelImpl:oP}),IU={kernelName:Fu,backendName:"webgl",kernelFunc:CU},WU=Lz({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 = ${Hk};\n  float a1 = ${jk};\n  float a2 = ${qk};\n  float a3 = ${Qk};\n  float a4 = ${Xk};\n  float a5 = ${Zk};\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`}),_U={kernelName:Ou,backendName:"webgl",kernelFunc:WU},TU=Lz({opSnippet:Mz+"\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:lP,dtype:"float32"}),NU={kernelName:Du,backendName:"webgl",kernelFunc:TU};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 EU(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&&(Go(-(i+1)<=a,(()=>`Axis must be in the interval [${-(i+1)}, ${i}]`)),l=i+a+1),o.splice(l,0,1),qz({inputs:{x:s},backend:r,attrs:{shape:o}})}const RU={kernelName:Mu,backendName:"webgl",kernelFunc:EU},$U="return exp(x) - 1.0;",OU=Lz({opSnippet:$U,packedOpSnippet:$U,cpuKernelImpl:uP}),FU={kernelName:Lu,backendName:"webgl",kernelFunc:OU};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 DU{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 MU(e,t,n){const r=n.texData.get(e.dataId),a=Ho(e.shape),s=e.shape[e.shape.length-1],i=qz({inputs:{x:e},backend:n,attrs:{shape:[a/s,s]}}),o=i.shape,l=new DU("real",o,t),u=new DU("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=Tz({inputs:{real:d,imag:h},backend:n});n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(h);const f=qz({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 LU={kernelName:Bu,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{input:r}=t;return MU(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 BU{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 PU(e){const{backend:t,attrs:n}=e,{shape:r,value:a}=n;let{dtype:s}=n;if(s=s||dl(a),"string"===s){const e=nl(s,Ho(r));return e.fill(a),t.makeTensorInfo(r,s,e)}{const e=new BU(r,a),n=[[a]];return t.runWebGLProgram(e,[],s,n)}}const zU={kernelName:Pu,backendName:"webgl",kernelFunc:PU};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 GU{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 VU={kernelName:zu,backendName:"webgl",kernelFunc:({inputs:e,backend:t})=>{const{image:n}=e,r=t,a=new GU(n.shape);return r.runWebGLProgram(a,[n],n.dtype)}},UU="return floor(x);",HU=Lz({opSnippet:UU,packedOpSnippet:UU,cpuKernelImpl:cP}),jU={kernelName:Gu,backendName:"webgl",kernelFunc:HU},qU=Bz({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"}),QU={kernelName:Vu,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 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 XU{constructor(e){this.variableNames=["A"];const t=dB(),[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 ZU{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const t=dB(),[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 KU={kernelName:zd,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=_l().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");null!=JU&&e===YU||(YU=e,JU=document.createElement("canvas").getContext("2d",{willReadFrequently:YU})),JU.canvas.width=l,JU.canvas.height=u,JU.drawImage(a,0,0,l,u),a=JU.canvas}const h=n.makeTensorInfo(c,"int32");n.texData.get(h.dataId).usage=RL.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(h.dataId),a);const p=_l().getBool("WEBGL_PACK")?new ZU(d):new XU(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 JU,YU=_l().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");const eH={kernelName:Ud,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=Bm(c),g=Tm(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=qz({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",zh(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&&_l().getBool("WEBGL_EXP_CONV")){const e=p?Pz(p,!0):null,t=new EV(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(_l().getBool("WEBGL_CONV_IM2COL"))y=FV({x:a,filter:s,convInfo:g,backend:n,bias:i,activation:p,preluActivationWeights:o,leakyreluAlpha:f});else{const e=p?Pz(p,!1):null,t=new TV(g,v,e,A,x),r=k();y=n.runWebGLProgram(t,r,"float32")}else y=OV({x:a,filter:s,convInfo:g,backend:n,bias:i,activation:p,preluActivationWeights:o,leakyreluAlpha:f});const w=qz({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 tH={kernelName:Hd,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]),Go(Mm(l,m),(()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${m}'`));const g=Tm(a.shape,s.shape,l,m,u,d,!0),y=_l().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels==1,b=h?Pz(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",zh(p,"float32"));v.push(e),f.push(e)}let w;w=y?new dU(g,A,b,x,k):new cU(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 nH{constructor(e,t,n,r){this.sliceDim=e,this.strides=t,this.paramsShape=r,this.variableNames=["x","indices"],this.outputShape=n;const a=_B(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 rH={kernelName:ju,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=Ho(r.shape),[l,u,c,d]=rk(r,a),h=qz({inputs:{x:a},backend:n,attrs:{shape:[u,i]}}),p=qz({inputs:{x:r},backend:n,attrs:{shape:[Ho(r.shape)/c,c]}});if(n.shouldExecuteOnCPU([r,a])||"string"===r.dtype){const e=n.readSync(a.dataId),t=n.bufferSync(r),s=dP(e,t,r.dtype,u,i,c,d,r.shape,o);return n.makeTensorInfo(l,r.dtype,s.values)}const f=new nH(i,d,[u,c],r.shape),m=n.runWebGLProgram(f,[p,h],p.dtype),g=qz({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 aH{constructor(e,t){this.variableNames=["A","indices"],this.outputShape=t,this.rank=t.length;const n=_B(this.rank),r=function(e,t){const n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[];for(let a=0;a<e.length;a++)2===a?r.push("index"):r.push(`${n[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        ${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 sH(e){const{inputs:t,backend:n,attrs:r}=e,{x:a,indices:s}=t,{axis:i,batchDims:o}=r,l=Yo(i,a.shape)[0];if(_l().get("DEBUG")){const e=n.readSync(s.dataId),t=a.shape[l];for(let n=0;n<e.length;++n){const r=e[n];Go(r<=t-1&&r>=0,(()=>`GatherV2: the index value ${r} is not in [0, ${t-1}]`))}}const u=Nw(a,s,l,o),c=Ho(s.shape),d=[],h=qz({inputs:{x:a},backend:n,attrs:{shape:[u.batchSize,u.outerSize,u.dimSize,u.sliceSize]}}),p=qz({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=hP(t,e,f);return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),n.makeTensorInfo(u.outputShape,r.dtype,r.values)}const m=new aH(h.shape,f),g=n.runWebGLProgram(m,[h,p],h.dtype);d.push(g);const y=qz({inputs:{x:g},backend:n,attrs:{shape:u.outputShape}});return d.forEach((e=>n.disposeIntermediateTensorInfo(e))),y}const iH={kernelName:Hu,backendName:"webgl",kernelFunc:sH},oH=Bz({opSnippet:"return float(a > b);",packedOpSnippet:"\n  return vec4(greaterThan(a, b));\n",cpuKernelImpl:pP,dtype:"bool"}),lH={kernelName:qu,backendName:"webgl",kernelFunc:oH},uH=Bz({opSnippet:"return float(a >= b);",packedOpSnippet:"\n  return vec4(greaterThanEqual(a, b));\n",dtype:"bool",cpuKernelImpl:fP}),cH={kernelName:Qu,backendName:"webgl",kernelFunc:uH};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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:Zu,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 MU(r,!0,n)}},hH=Lz({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"}),pH={kernelName:Ju,backendName:"webgl",kernelFunc:hH},fH=Lz({opSnippet:"return float(isinf(x));",dtype:"bool"}),mH={kernelName:Yu,backendName:"webgl",kernelFunc:fH},gH=Lz({opSnippet:"return float(isnan(x));",dtype:"bool"}),yH={kernelName:ec,backendName:"webgl",kernelFunc:gH},bH=Bz({opSnippet:"return float(a < b);",packedOpSnippet:"\n  return vec4(lessThan(a, b));\n",cpuKernelImpl:mP,dtype:"bool"}),vH={kernelName:nc,backendName:"webgl",kernelFunc:bH},AH=Bz({opSnippet:"return float(a <= b);",packedOpSnippet:"\n  return vec4(lessThanEqual(a, b));\n",cpuKernelImpl:gP,dtype:"bool"}),xH={kernelName:rc,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:ac,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=yP(r,a,s);return t.makeTensorInfo([i.length],"float32",i)}},wH=Lz({opSnippet:Mz+"\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:bP}),SH={kernelName:sc,backendName:"webgl",kernelFunc:wH},CH=Lz({opSnippet:Mz+"\n  return log(1.0 + x);\n"}),IH={kernelName:ic,backendName:"webgl",kernelFunc:CH},WH=Bz({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"}),_H={kernelName:oc,backendName:"webgl",kernelFunc:WH},TH=Lz({opSnippet:"return float(!(x >= 1.0));"}),NH={kernelName:lc,backendName:"webgl",kernelFunc:TH},EH=Bz({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"}),RH={kernelName:uc,backendName:"webgl",kernelFunc:EH};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 $H{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 OH{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 FH={kernelName:dc,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=_l().getBool("WEBGL_PACK_NORMALIZATION")?new OH(a.shape,s,i,o,l):new $H(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 DH{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 MH={kernelName:hc,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 DH(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 LH(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{reductionIndices:s,keepDims:i}=r,o=a.shape.length,l=Yo(s,a.shape);let u=l;const c=jg(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=qP(e,a.shape,a.dtype,c,t);p=n.makeTensorInfo(t,a.dtype);n.texData.get(p.dataId).values=r}else p=eG(a,c,n);u=Qg(u.length,o)}Hg("max",u,o);const[f,m]=Vg(p.shape,u);let g,y=f;if(i&&(y=Ug(f,l)),h){const e=n.texData.get(p.dataId).values,t=vP(e,Ho(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=Ho(t),s=qz({inputs:{x:e},attrs:{shape:[Ho(e.shape)/a,a]},backend:r}),i=Kz(s,e.dtype,"max",r),o=qz({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 BH={kernelName:pc,backendName:"webgl",kernelFunc:LH},PH=Bz({opSnippet:wz+"\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  "+Cz+"\n  return result;\n",cpuKernelImpl:AP}),zH={kernelName:fc,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.
 * =============================================================================
 */const GH={kernelName:mc,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;uB(a,"maxPool");const{filterSize:s,strides:i,pad:o,dimRoundingMode:l}=r;Go(Mm(i,1),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '1'`));const u=Wm(a.shape,s,i,1,o,l);if(1===u.filterWidth&&1===u.filterHeight&&qo(u.inShape,u.outShape))return Wz({inputs:{x:a},backend:n});const c=new BG(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 VH={kernelName:yc,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=_m(a.shape,s,i,[1,1,1],o,u,l),d=new PG(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 UH{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 HH{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 jH={kernelName:bc,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=_m(i.shape,o,l,[1,1,1],u,c),h=new PG(d,"max",!0),p=n.runWebGLProgram(h,[i],i.dtype),f=new HH(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 qH={kernelName:gc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{dy:a,input:s,output:i}=t,o=s;uB([s,i],"maxPoolGrad");const{filterSize:l,strides:u,pad:c,dimRoundingMode:d}=r,h=Wm(o.shape,l,u,1,c,d),p=new BG(h,"max",!0),f=n.runWebGLProgram(p,[o],o.dtype),m=new UH(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 QH={kernelName:vc,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{x:r}=e,{filterSize:a,strides:s,pad:i,includeBatchInIndex:o}=t,l=n;Go(4===r.shape.length,(()=>`Error in maxPool: input must be rank 4 but got rank ${r.shape.length}.`));const u=[1,1];Go(Mm(s,u),(()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${s} and dilations '${u}'`));const c=Wm(r.shape,a,s,u,i),[d,h]=function(e,t,n,r){let a=new BG(n,"max",!1);const s=r.runWebGLProgram(a,[e],"float32");return a=new BG(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 XH={kernelName:Ac,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=Yo(s,r.shape);let u=l;const c=jg(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=qP(e,r.shape,r.dtype,c,t);f=i.makeTensorInfo(t,r.dtype);i.texData.get(f.dataId).values=n}else f=eG(r,c,i);p.push(f),u=Qg(u.length,o)}Hg("sum",u,o);const[m,g]=Vg(f.shape,u);let y=m;a&&(y=Ug(m,l));const b=function(e,t,n,r){const a=Ho(t),s=qz({inputs:{x:e},attrs:{shape:[Ho(e.shape)/a,a]},backend:r}),i=Kz(s,"float32","mean",r),o=qz({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 ZH={kernelName:xc,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=Yo(s,a.shape);let u=l;const c=jg(u,o);let d=a;null!=c&&(d=rG({inputs:{x:a},backend:n,attrs:{perm:c}}),u=Qg(u.length,a.shape.length)),Hg("min",u,o);const[h,p]=Vg(d.shape,u),f=qz({inputs:{x:d},backend:n,attrs:{shape:[-1,Ho(p)]}}),m=Kz(f,f.dtype,"min",n);let g;if(i){g=qz({inputs:{x:m},backend:n,attrs:{shape:Ug(h,l)}})}else g=qz({inputs:{x:m},backend:n,attrs:{shape:h}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(m),null!=c&&n.disposeIntermediateTensorInfo(d),g}},KH=Bz({opSnippet:wz+"\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  "+Cz+"\n  return result;\n",cpuKernelImpl:xP}),JH={kernelName:kc,backendName:"webgl",kernelFunc:KH};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 YH{constructor(e,t,n){this.variableNames=["x"],this.outputShape=t.map(((t,n)=>t[0]+e[n]+t[1]));const r=e.length,a=_B(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 ej{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=_B(r),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),o=ZP("rc",r),l=ZP("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 tj={kernelName:wc,backendName:"webgl",kernelFunc:({inputs:e,backend:t,attrs:n})=>{const{x:r}=e,{paddings:a,mode:s}=n,i=_l().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new ej(r.shape,a,s):new YH(r.shape,a,s);return t.runWebGLProgram(i,[r],r.dtype)}},nj=Bz({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  "+Cz+"\n  return result;\n"}),rj={kernelName:Sc,backendName:"webgl",kernelFunc:nj};
/**
 * @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 aj{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 sj=Bz({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}),ij={kernelName:Nu,backendName:"webgl",kernelFunc:sj},oj="return a - b;",lj=Bz({opSnippet:oj,packedOpSnippet:oj,supportsComplex:!0,cpuKernelImpl:UP}),uj={kernelName:Td,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.
 * =============================================================================
 */
function cj(e){const{inputs:t,backend:n,attrs:r}=e,{logits:a}=t,{dim:s}=r,i=Yo([s],a.shape),o=LH({inputs:{x:a},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),l=Ug(o.shape,i),u=qz({inputs:{x:o},backend:n,attrs:{shape:l}}),c=lj({inputs:{a:a,b:u},backend:n}),d=TU({inputs:{x:c},backend:n}),h=tG({inputs:{x:d},backend:n,attrs:{axis:i,keepDims:!1}}),p=qz({inputs:{x:h},backend:n,attrs:{shape:l}}),f=sj({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 dj={kernelName:gd,backendName:"webgl",kernelFunc:cj};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES 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:Cc,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:cj({inputs:{logits:a},backend:n,attrs:{dim:a.shape.length-1}}),u=l.shape[0],c=l.shape[1],d=new aj(u,c,s),h=[[i]],p=n.runWebGLProgram(d,[l],"int32",h);return o||n.disposeIntermediateTensorInfo(l),p}},pj=az+"\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 fj={kernelName:Wc,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]=wP(e.values,r.shape,r.dtype);return n.makeTensorInfo(a,r.dtype,t)}let a;return a=_l().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new yz(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 rz(r.shape,pj),n.runWebGLProgram(a,[r],r.dtype)}},mj=OA;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const gj={kernelName:Tc,backendName:"webgl",kernelFunc:function(e){jd();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}=mj(u,c,i,o,l);return n.makeTensorInfo([d.length],"int32",new Int32Array(d))}},yj=FA;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const bj={kernelName:Nc,backendName:"webgl",kernelFunc:function(e){jd();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}=yj(c,d,i,o,l,u);return[n.makeTensorInfo([h.length],"int32",new Int32Array(h)),n.makeTensorInfo([],"int32",new Int32Array([p]))]}},vj=DA;
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Aj={kernelName:Ec,backendName:"webgl",kernelFunc:function(e){jd();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}=vj(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 xj{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 kj={kernelName:$c,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=Ho(a.shape),c=new xj(u,i,o,l),d=qz({inputs:{x:a},backend:n,attrs:{shape:[u]}}),h=n.runWebGLProgram(c,[d],s);n.disposeIntermediateTensorInfo(d);const p=qz({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 wj(e){const{inputs:t,backend:n}=e,{x:r}=t;if("complex64"===r.dtype){const e=lV({inputs:{input:r},backend:n}),t=wj({inputs:{x:e},backend:n}),a=SV({inputs:{input:r},backend:n}),s=wj({inputs:{x:a},backend:n}),i=Tz({inputs:{real:t,imag:s},backend:n});return n.disposeIntermediateTensorInfo(e),n.disposeIntermediateTensorInfo(t),n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(s),i}return PU({attrs:{shape:r.shape,dtype:r.dtype,value:"string"===r.dtype?"":0},backend:n})}const Sj={kernelName:Bd,backendName:"webgl",kernelFunc:wj};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Cj={kernelName:Rc,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=lV({inputs:{input:a},backend:r}),n=e({inputs:{x:t},backend:r}),s=SV({inputs:{input:a},backend:r}),i=wj({inputs:{x:s},backend:r}),o=Tz({inputs:{real:n,imag:i},backend:r});return r.disposeIntermediateTensorInfo(t),r.disposeIntermediateTensorInfo(n),r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(i),o}return PU({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 Ij={kernelName:Oc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{axis:a}=r;if(1===t.length)return EU({inputs:{input:t[0]},backend:n,attrs:{dim:a}});const s=t[0].shape,i=t[0].dtype;t.forEach((e=>{Vo(s,e.shape,"All tensors passed to stack must have matching shapes"),Go(i===e.dtype,(()=>"All tensors passed to stack must have matching dtypes"))}));const o=[],l=WV({inputs:t.map((e=>{const t=EU({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 Wj{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=_B(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 _j{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=_B(r),s=t.map((e=>e[0])).join(","),i=t.map(((t,n)=>t[0]+e[n])).join(","),o=ZP("rc",r),l=ZP("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 Tj=e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{paddings:s,constantValue:i}=r;if(0===Ho(a.shape)){return PU({backend:n,attrs:{shape:s.map(((e,t)=>e[0]+a.shape[t]+e[1])),value:i,dtype:a.dtype}})}const o=_l().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new _j(a.shape,s,i):new Wj(a.shape,s,i),l=[[i]];return n.runWebGLProgram(o,[a],a.dtype,l)},Nj={kernelName:Fc,backendName:"webgl",kernelFunc:Tj},Ej=Bz({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  "+Cz+"\n  return result;\n"}),Rj={kernelName:Dc,backendName:"webgl",kernelFunc:Ej};const $j={kernelName:Lc,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=Yo(s,a.shape);let c=u;const d=jg(c,o);let h,p=a;if(null!=d&&(p=rG({inputs:{x:a},backend:n,attrs:{perm:d}}),c=Qg(c.length,o),l.push(p)),Hg("prod",c,o),n.shouldExecuteOnCPU([p])){const e=n.texData.get(p.dataId).values,{outVals:t,outShape:r,outDtype:a}=CP(p.shape,p.dtype,e,c);h=n.makeTensorInfo(r,a,t)}else{const[e,t]=Vg(p.shape,c),r=Ho(t),s=qz({inputs:{x:p},backend:n,attrs:{shape:[-1,r]}}),i=Kz(s,Sp(a.dtype),"prod",n);h=qz({inputs:{x:i},backend:n,attrs:{shape:e}}),l.push(s),l.push(i)}if(i){l.push(h);const e=Ug(h.shape,u);h=qz({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 Oj={kernelName:Bc,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]=IP(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 Fj={kernelName:Pc,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]=WP(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 Dj={kernelName:zc,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]=_P(u,a.shape,c,s.shape,s.dtype,d,i.shape,h,p,l);return n.makeTensorInfo(f,s.dtype,m)}},Mj=e=>{const{backend:t,attrs:n}=e,{start:r,stop:a,step:s,dtype:i}=n,o=TP(r,a,s,i);return t.makeTensorInfo([o.length],i,o)},Lj={kernelName:Gc,backendName:"webgl",kernelFunc:Mj},Bj=Lz({opSnippet:"return 1.0 / x;"}),Pj={kernelName:Uc,backendName:"webgl",kernelFunc:Bj},zj=Lz({opSnippet:az+"\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"}),Gj={kernelName:Hc,backendName:"webgl",kernelFunc:zj},Vj=Lz({opSnippet:az+"\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"}),Uj={kernelName:Kc,backendName:"webgl",kernelFunc:Vj};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 Hj{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 jj{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 qj={kernelName:Xc,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=_l().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new jj(a.shape,l,u,s,i):new Hj(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 Qj{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 Xj={kernelName:Zc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r,o=new Qj(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 Zj{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 Kj{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 Jj={kernelName:qc,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=_l().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new Kj(a.shape,l,u,s,i):new Zj(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 Yj{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 eq={kernelName:Qc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{images:a,dy:s}=t,{alignCorners:i}=r,o=new Yj(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 tq{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=_B(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 nq{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=ZP("rc",n),a=`${r[n-1]} + 1 < ${this.outputShape[n-1]}`,s=`${r[n-2]} + 1 < ${this.outputShape[n-2]}`,i=_B(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 rq={kernelName:Jc,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{dims:s}=r,i=a.shape.length,o=Yo(s,a.shape);if(0===i)return Wz({inputs:{x:a},backend:n});const l=_l().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new nq(a.shape,o):new tq(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 aq{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 sq={kernelName:Gd,backendName:"webgl",kernelFunc:({inputs:e,attrs:t,backend:n})=>{const{image:r}=e,{radians:a,fillValue:s,center:i}=t,o=n,l=new aq(r.shape,s),[u,c]=Mk(i,r.shape[1],r.shape[2]),d=[[u,c,Math.sin(a),Math.cos(a)]];return o.runWebGLProgram(l,[r],r.dtype,d)}},iq=Lz({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"}),oq={kernelName:Yc,backendName:"webgl",kernelFunc:iq},lq=Lz({opSnippet:"return inversesqrt(x);",cpuKernelImpl:NP}),uq={kernelName:ed,backendName:"webgl",kernelFunc:lq};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT 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 cq{constructor(e,t,n,r,a,s,i=!0,o=!1){this.variableNames=["updates","indices","defaultValue"],this.outputShape=s;const l=_B(a.length),u=_B(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 dq{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=_B(a.length),u=_B(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 hq={kernelName:td,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}=Gv(0,a,i),h=[d/u,u];if(0===d)return n.makeTensorInfo(i,a.dtype);const p=qz({inputs:{x:a},backend:n,attrs:{shape:[l,o]}}),f=qz({inputs:{x:s},backend:n,attrs:{shape:[l,u]}}),m=n.makeTensorInfo([],"float32",new Float32Array([0]));let g;g=_l().getBool("WEBGL_PACK")?new dq(l,o,p.shape.length,f.shape.length,c,h):new cq(l,o,p.shape.length,f.shape.length,c,h);const y=n.runWebGLProgram(g,[f,p,m],f.dtype),b=qz({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 pq{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===_l().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 fq={kernelName:rd,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{sortedSequence:a,values:s}=t,{side:i}=r,o=new pq(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 mq{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=_B(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 gq={kernelName:ad,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n}=e,{condition:r,t:a,e:s}=t,i=new mq(r.shape.length,a.shape,a.shape.length);return n.runWebGLProgram(i,[r,a,s],wp(a.dtype,s.dtype))}},yq=Lz({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 = ${Uk};\n  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n`}),bq={kernelName:sd,backendName:"webgl",kernelFunc:yq},vq=Lz({opSnippet:Mz+"\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:RP}),Aq={kernelName:cd,backendName:"webgl",kernelFunc:vq},xq=Lz({opSnippet:"\n  if (isnan(x)) { return 0.0; }\n  return sign(x);\n"}),kq={kernelName:ud,backendName:"webgl",kernelFunc:xq},wq=Lz({opSnippet:Mz+"\n  return sin(x);\n",packedOpSnippet:`\n  vec4 result = sin(x);\n  bvec4 isNaN = isnan(x);\n  ${Cz}\n  return result;\n`}),Sq={kernelName:od,backendName:"webgl",kernelFunc:wq},Cq=Lz({opSnippet:"\n  float e2x = exp(x);\n  return (e2x - 1.0 / e2x) / 2.0;\n"}),Iq={kernelName:ld,backendName:"webgl",kernelFunc:Cq},Wq=Lz({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"}),_q={kernelName:dd,backendName:"webgl",kernelFunc:Wq},Tq={kernelName:fd,backendName:"webgl",kernelFunc:e=>{const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{blockShape:s,paddings:i}=r;Go(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=Tj({inputs:{x:a},backend:n,attrs:{paddings:l,constantValue:0}}),d=Lk(c.shape,s,o,!1),h=Bk(d.length,s.length,!1),p=Pk(c.shape,s,o,!1),f=qz({inputs:{x:c},backend:n,attrs:{shape:d}}),m=rG({inputs:{x:f},backend:n,attrs:{perm:h}}),g=qz({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 Nq={kernelName:yd,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]=FP(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 Eq={kernelName:bd,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]=DP(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 Rq={kernelName:vd,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]=MP(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 $q={kernelName:Ad,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]=MP(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 Oq={kernelName:xd,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}=Gv(0,a,o);if("string"===s.dtype){const e=n.bufferSync(a),t=n.bufferSync(s),r=Hh(n.readSync(i.dataId)[0]),p=EP(e,t,o,h,c,u,l,d,r,false);return n.makeTensorInfo(o,p.dtype,p.values)}const p=new cq(u,l,a.shape.length,s.shape.length,d,[h,1],false),f=n.runWebGLProgram(p,[s,a,i],s.dtype),m=qz({inputs:{x:f},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(f),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 Fq={kernelName:md,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{numOrSizeSplits:s,axis:i}=r,o=Yo(i,a.shape)[0],l=mw(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=eV({inputs:{x:a},backend:n,attrs:{begin:c,size:t}});return c[o]+=e,r}))}},Dq="return sqrt(x);",Mq=Lz({opSnippet:Dq,packedOpSnippet:Dq,cpuKernelImpl:LP}),Lq={kernelName:hd,backendName:"webgl",kernelFunc:Mq},Bq={kernelName:wd,backendName:"webgl",kernelFunc:Lz({opSnippet:"return x * x;"})},Pq="return (a - b) * (a - b);",zq=Bz({opSnippet:Pq,packedOpSnippet:Pq}),Gq={kernelName:kd,backendName:"webgl",kernelFunc:zq};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const Vq={kernelName:Sd,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=Rw(n.readSync(a.dataId)),i=BP(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 Uq={kernelName:Pd,backendName:"webgl",kernelFunc:function({inputs:e,attrs:t,backend:n}){const{x:r}=e,a=az+`\n    return x > 0.0 ? 1.0 : float(${t.alpha});\n  `,s=new rz(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 Hq{constructor(e,t,n){this.variableNames=["x"],this.outputShape=n;const r=n.length,a=_B(n.length),s=_B(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 jq={kernelName:Cd,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}=Ak(a.shape,s,i,o,l,u,c,d,h);let x;if(m)x=qz({inputs:{x:a},backend:n,attrs:{shape:f}});else if(g||y){Go(a.shape.length>=1,(()=>`Input must have rank at least 1, got: ${a.shape.length}`));const e=lk(b,v,A),t=eV({inputs:{x:a},backend:n,attrs:{begin:b,size:e}});x=qz({inputs:{x:t},backend:n,attrs:{shape:f}}),n.disposeIntermediateTensorInfo(t)}else{if(n.shouldExecuteOnCPU([a])){const e=n.readSync(a.dataId),t=sm(a.shape,a.dtype,e),r=PP(p,t,A,b);x=n.makeTensorInfo(f,a.dtype,r.values)}else{const e=new Hq(b,A,p);x=n.runWebGLProgram(e,[a],a.dtype)}}const k=qz({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 qq={kernelName:Id,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]=zP(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 Qq={kernelName:Wd,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]=GP(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 Xq={kernelName:_d,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=VP(i,a);return n.makeTensorInfo(s.shape,"int32",o)}},Zq=Lz({opSnippet:"return tan(x);"}),Kq={kernelName:Nd,backendName:"webgl",kernelFunc:Zq},Jq=Lz({opSnippet:"\n  float e2x = exp(-2.0 * abs(x));\n  return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n"}),Yq={kernelName:Ed,backendName:"webgl",kernelFunc:Jq};
/**
 * @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */const eQ={kernelName:nd,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}=Gv(0,s,a.shape),h=[d/u,u];if(0===d)return n.makeTensorInfo(a.shape,s.dtype);const p=qz({inputs:{x:s},backend:n,attrs:{shape:[l,o]}}),f=qz({inputs:{x:i},backend:n,attrs:{shape:[l,u]}}),m=qz({inputs:{x:a},backend:n,attrs:{shape:h}}),g=new cq(l,o,p.shape.length,f.shape.length,c,h,!1,!0),y=n.runWebGLProgram(g,[f,p,m],m.dtype),b=qz({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 tQ{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=_B(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 nQ(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=>Hh(e))):e,r=sm(a.shape,a.dtype,t),i=HP(r,s);return n.makeTensorInfo(i.shape,i.dtype,i.values)}const i=new tQ(a.shape,s);return n.runWebGLProgram(i,[a],a.dtype)}const rQ={kernelName:Rd,backendName:"webgl",kernelFunc:nQ};class aQ{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 sQ{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 iQ(e,t){null!==t&&e.disposeIntermediateTensorInfo(t)}function oQ(e){let t=1;for(;t<e;)t*=2;return t}const lQ={kernelName:$d,backendName:"webgl",kernelFunc:function(e){const{inputs:t,backend:n,attrs:r}=e,{x:a}=t,{k:s,sorted:i}=r,o=_l().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),l=_l().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]=jP(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,PU({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=Ho(u)/c,m=qz({inputs:{x:p},attrs:{shape:[f,c]},backend:n});h&&iQ(n,p);const g=oQ(s),y=oQ(c);let b=null;const v=()=>null===b?[m,m]:[m,b],A=(e,t,r)=>{const a=v(),s=new aQ(r),i=[[c],[null===b?1:0],[Number.NEGATIVE_INFINITY],[e],[t]],o=b;b=n.runWebGLProgram(s,a,"int32",i),iQ(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 sQ([f,C/2]),r=[[c],[null===b?1:0],[g]],a=b;b=n.runWebGLProgram(t,e,"int32",r),iQ(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=eV({inputs:{x:b},backend:n,attrs:{begin:0,size:[f,s]}}),iQ(n,x);let k=sH({inputs:{x:m,indices:b},backend:n,attrs:{axis:1,batchDims:1}});iQ(n,m);const w=u.slice(0,-1);w.push(s),x=b,b=qz({inputs:{x:b},attrs:{shape:w},backend:n}),iQ(n,x);const S=k;return k=qz({inputs:{x:k},attrs:{shape:w},backend:n}),iQ(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 uQ{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 cQ={kernelName:Od,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 uQ(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 dQ={kernelName:Dd,backendName:"webgl",kernelFunc:function(e){const{inputs:t,attrs:n,backend:r}=e,{axis:a}=n,{x:s}=t;uB(s,"unique");const i=r.readSync(s.dataId),{outputValues:o,outputShape:l,indices:u}=QP(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 hQ={kernelName:Md,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=eV({inputs:{x:i},backend:n,attrs:{begin:h,size:p}}),t=qz({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 pQ{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 fQ={kernelName:Ld,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=jg([u],o);let d=a;null!=c&&(d=rG({inputs:{x:a},backend:n,attrs:{perm:c}}),l.push(d),u=Qg(1,o)[0]);const h=Tw(d.shape,u,i),p=Ho([d.shape[u]]),f=qz({inputs:{x:d},backend:n,attrs:{shape:[-1,p]}});l.push(f);const m=Sp(a.dtype),g=(e,t,r,a,s)=>{const i=e.shape[0],o=e.shape[1],u=_w(o,s),c=new pQ({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=Mj({backend:n,attrs:{start:0,stop:s,step:1,dtype:"float32"}}),p=nQ({inputs:{x:h},backend:n,attrs:{reps:[o/u]}});l.push(h),l.push(p);return g(d,t,p,a,s)},y=qz({inputs:{x:g(f,"unsortedSegmentSum",s,m,i)},backend:n,attrs:{shape:h}});let b=y;if(null!=c){l.push(y);const e=qg(c);b=rG({inputs:{x:b},backend:n,attrs:{perm:e}})}return l.forEach((e=>n.disposeIntermediateTensorInfo(e))),b}},mQ=[oG,uG,dG,pG,gG,vG,AG,xG,WG,_G,NG,RG,OG,DG,LG,zG,GG,HG,jG,qG,ZG,nV,rV,aV,sV,dV,fV,yV,Nz,AV,_V,DV,zV,VV,UV,HV,jV,QV,ZV,JV,sU,iU,oU,uU,hU,mU,gU,bU,AU,xU,wU,SU,IU,_U,NU,RU,FU,LU,zU,VU,jU,QU,KU,eH,tH,rH,iH,lH,cH,_z,dH,CV,pH,mH,yH,$z,vH,xH,kH,SH,IH,_H,NH,RH,FH,MH,BH,zH,GH,VH,jH,qH,QH,XH,ZH,JH,tj,rj,hj,jz,fj,gj,bj,Aj,oV,kj,Cj,Ij,Nj,Rj,Dz,$j,Oj,Fj,Dj,Lj,uV,ij,Pj,Gj,Uj,Qz,qj,Xj,Jj,eq,rq,sq,oq,uq,hq,fq,gq,bq,Aq,kq,Sq,Iq,tV,dj,_q,Tq,Nq,Eq,Rq,$q,Oq,Fq,Lq,Bq,Gq,Vq,Uq,jq,qq,Qq,Xq,uj,nG,Kq,Yq,eQ,rQ,lQ,cQ,aG,dQ,hQ,fQ,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.
 * =============================================================================
 */for(const t of mQ)Jd(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 gQ(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 yQ(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 bQ={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"},vQ=224,AQ={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},xQ={"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 kQ(e){return void 0===e&&(e={version:1,alpha:1}),gQ(this,void 0,void 0,(function(){var t,n,r,a,s,i,o;return yQ(this,(function(l){switch(l.label){case 0:if(null==Dw)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 xQ))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys(xQ));if(!(n in xQ[t]))throw new Error("MobileNet constructed with invalid alpha "+e.alpha+". Valid multipliers for this version are: "+Object.keys(xQ[t])+".");i=xQ[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 wQ(t,n,e.modelUrl,r,a)).load()];case 1:return l.sent(),[2,s]}}))}))}var wQ=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 gQ(this,void 0,void 0,(function(){var e,t,n,r,a=this;return yQ(this,(function(s){switch(s.label){case 0:return this.modelUrl?(e=this,[4,rR(this.modelUrl)]):[3,2];case 1:return e.model=s.sent(),[3,4];case 2:return t=xQ[this.version][this.alpha].url,n=this,[4,rR(t,{fromTFHub:!0})];case 3:n.model=s.sent(),s.label=4;case 4:return[4,(r=rf((function(){return a.model.predict(jy([1,vQ,vQ,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),rf((function(){e instanceof up||(e=tk(e));var r=um(hm(im(e,"float32"),n.normalizationConstant),n.inputMin),a=r;e.shape[0]===vQ&&e.shape[1]===vQ||(a=px.resizeBilinear(r,[vQ,vQ],!0));var s,i=zm(a,[-1,vQ,vQ,3]);if(t){var o=AQ[n.version],l=n.model.execute(i,o);s=Tv(l,[1,2])}else{var u=n.model.predict(i);s=qm(u,[0,1],[-1,1e3])}return s}))},e.prototype.classify=function(e,t){return void 0===t&&(t=3),gQ(this,void 0,void 0,(function(){var n,r;return yQ(this,(function(a){switch(a.label){case 0:return[4,SQ(n=this.infer(e),t)];case 1:return r=a.sent(),n.dispose(),[2,r]}}))}))},e}();function SQ(e,t){return gQ(this,void 0,void 0,(function(){var n,r,a,s,i,o,l;return yQ(this,(function(u){switch(u.label){case 0:return[4,(n=kv(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:bQ[i[l]],probability:s[l]});return[2,o]}}))}))}const CQ=e=>(Oe("data-v-06c98a1a"),e=e(),Fe(),e),IQ=["href"],WQ={class:"left"},_Q=CQ((()=>we("div",{class:"title"}," 立即升级到专业版 Temu图搜更精准 ",-1))),TQ={class:"sub-title"},NQ={key:0},EQ={key:1},RQ={class:"center"},$Q=["src"],OQ={class:"right"},FQ={class:"btn-click"},DQ=CQ((()=>we("span",{style:{"margin-right":"3px"}},"查看更多同款",-1))),MQ={key:0},LQ={key:1},BQ=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)=>Ge((xe(),ke("a",{href:i.value,target:"_blank",class:"search-ad"},[we("div",WQ,[_Q,we("div",TQ,[Ce(" 为您搜索到 "),a.value.total>=80?(xe(),ke("b",NQ,"100+")):(xe(),ke("b",EQ,Te(a.value.total)+"个",1)),Ce(" 同款商品,最高相似度:"+Te(a.value.score)+"% ",1)])]),we("div",RQ,[(xe(!0),ke(D,null,Ie(a.value.list,((e,t)=>(xe(),ke("img",{key:t,class:"thumb",src:e+"?imageView2/2/w/500/q/60/format/webp"},null,8,$Q)))),128))]),we("div",OQ,[we("span",FQ,[DQ,a.value.total>=80?(xe(),ke("span",MQ,"(100+)")):(xe(),ke("span",LQ,"("+Te(a.value.total)+")",1))])]),$(We(He),{class:"close-icon",onClick:Ue(s,["prevent","stop"])},null,8,["onClick"])],8,IQ)),[[Ve,r.value]])}},[["__scopeId","data-v-06c98a1a"]]),PQ=e=>(Oe("data-v-ea83a69c"),e=e(),Fe(),e),zQ={class:"1688-search"},GQ={class:"filter-wrap"},VQ={class:"filter-item"},UQ={class:"label"},HQ={class:"filter-item"},jQ=PQ((()=>we("span",{class:"label"},"排序:",-1))),qQ={class:"filter-item"},QQ=PQ((()=>we("span",{class:"label"},"筛选:",-1))),XQ={class:"list-wrap"},ZQ=["href"],KQ={class:"info-wrap"},JQ=["src"],YQ={class:"title"},eX=["innerHTML"],tX={class:"price-wrap"},nX={class:"price"},rX={class:"prefix"},aX={key:0,class:"sold"},sX={key:0,class:"mall-wrap"},iX=["innerHTML"],oX=["innerHTML"],lX={key:0,class:"error-tip"},uX={class:"left"},cX={class:"center"},dX=PQ((()=>we("div",{class:"title"}," 提示 ",-1))),hX={class:"sub-title"},pX={class:"right"},fX=["href"],mX={key:1,class:"error-tip"},gX={class:"left"},yX={class:"center"},bX=PQ((()=>we("div",{class:"title"}," 提示 ",-1))),vX={class:"sub-title"},AX={class:"right"},xX={key:2,class:"loading-wrap"},kX={class:"text"},wX={key:3,style:{padding:"20px"}},SX={key:4,class:"bottom-tip"},CX=[PQ((()=>we("span",null,"没有更多了",-1)))],IX=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"),je.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 tk(n).toFloat().expandDims()}let M,L,B;N.value&&kQ({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 kQ()),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,EW(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 bn(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 mn(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(_X){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(_X){d.value="error",h.value="请重新尝试搜索,或稍后再试",s("update:loading",!1)}}};return ue((async()=>{const e=await gn();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 vn({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=qe,a=It,s=i,f=o,m=l,A=De,w=Ee,C=Ye,I=Ae("router-link"),W=u,_=Re;return xe(),ke("div",zQ,[we("div",GQ,[we("span",VQ,[we("span",UQ,[Ce("AI识别 "),$(r,null,{title:Se((()=>[Ce("使用AI提高Temu图搜返回的精准度,但会减慢搜索速度")])),default:Se((()=>[$(We(S))])),_:1}),Ce(" :")]),$(a,{checked:N.value,onChange:R},null,8,["checked"])]),we("span",HQ,[jQ,$(f,{value:v.value,"onUpdate:value":n[0]||(n[0]=e=>v.value=e),style:{width:"130px"},onChange:x},{default:Se((()=>[$(s,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(s,{value:"similar"},{default:Se((()=>[Ce("同款优先")])),_:1}),$(s,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(s,{value:"sold-max-min"},{default:Se((()=>[Ce("销量从高到低")])),_:1}),$(s,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1}),$(s,{value:"sold-min-max"},{default:Se((()=>[Ce("销量从低到高")])),_:1})])),_:1},8,["value"])]),we("span",qQ,[QQ,$(m,{value:p.value,"onUpdate:value":n[1]||(n[1]=e=>p.value=e),placeholder:"商品标题 / 发货地 / 店铺名",style:{width:"200px"}},null,8,["value"])])]),$(BQ,{"img-url":t.imgUrl},null,8,["img-url"]),we("div",XQ,[(xe(!0),ke(D,null,Ie(b.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",KQ,[we("img",{src:e.thumb+"?imageView2/2/w/624/q/70/format/webp",class:"thumb"},null,8,JQ),we("div",YQ,[e.tag?(xe(),$e(A,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:k(e.title,p.value)},null,8,eX)]),we("div",tX,[we("span",nX,[we("span",rX,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",aX,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",sX,[we("span",{class:"mall",innerHTML:k(e.mall,p.value)},null,8,iX),we("span",{class:"location",innerHTML:k(e.location,p.value)},null,8,oX)])):Ne("",!0)],8,ZQ)))),128))]),"error"===d.value?(xe(),ke("div",lX,[we("div",uX,[$(We(_e),{class:"icon"})]),we("div",cX,[dX,we("div",hX,Te(h.value),1)]),we("div",pX,[$(C,null,{default:Se((()=>[we("a",{target:"_blank",href:g.value},[$(w,{type:"primary"},{default:Se((()=>[Ce(" 打开Temu ")])),_:1})],8,fX),$(w,{onClick:T},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===d.value?(xe(),ke("div",mX,[we("div",gX,[$(We(_e),{class:"icon"})]),we("div",yX,[bX,we("div",vX,Te(h.value),1)]),we("div",AX,[$(C,null,{default:Se((()=>[$(I,{target:"_blank",to:"/download"},{default:Se((()=>[$(w,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===d.value||""===d.value?(xe(),ke("div",xX,[$(W,{size:"large"}),we("span",kX,Te(y.value),1)])):Ne("",!0),"success"!==d.value&&"finish"!==d.value||0!==b.value.length?Ne("",!0):(xe(),ke("div",wX,[$(_,{description:"没有搜索到商品"})])),"finish"===d.value&&b.value.length>0?(xe(),ke("div",SX,CX)):Ne("",!0)])}}},[["__scopeId","data-v-ea83a69c"]]);var WX,_X;!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;var o,l=e.printErr||void 0;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&(-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&(-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&(-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: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&(-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: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: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: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=(-1^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!=(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!=(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!=(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,!(0!=((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!=(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!=(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((-1^(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==(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: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!=(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: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|0,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-1^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,!((-1^(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((-1^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|0)<<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]|-1^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!=(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!=(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!=(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^-1,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!=(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)?-1^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=-1^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!=(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!=(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!=(0|(t=i[n>>2]|0!=(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(O.length))}(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(t){if(T--,e.monitorRunDependencies&&e.monitorRunDependencies(T),0==T&&N){var n=N;N=null,n()}}()}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(a){function s(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function i(e,t,n,r,a,i){return s((o=s(s(t,e),s(r,i)))<<(l=a)|o>>>32-l,n);var o,l}function o(e,t,n,r,a,s,o){return i(t&n|~t&r,e,t,a,s,o)}function l(e,t,n,r,a,s,o){return i(t&r|n&~r,e,t,a,s,o)}function u(e,t,n,r,a,s,o){return i(t^n^r,e,t,a,s,o)}function c(e,t,n,r,a,s,o){return i(n^(t|~r),e,t,a,s,o)}function d(e,t){var n,r,a,i,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,a=p,i=f,d=m,h=o(h,p,f,m,e[n],7,-680876936),m=o(m,h,p,f,e[n+1],12,-389564586),f=o(f,m,h,p,e[n+2],17,606105819),p=o(p,f,m,h,e[n+3],22,-1044525330),h=o(h,p,f,m,e[n+4],7,-176418897),m=o(m,h,p,f,e[n+5],12,1200080426),f=o(f,m,h,p,e[n+6],17,-1473231341),p=o(p,f,m,h,e[n+7],22,-45705983),h=o(h,p,f,m,e[n+8],7,1770035416),m=o(m,h,p,f,e[n+9],12,-1958414417),f=o(f,m,h,p,e[n+10],17,-42063),p=o(p,f,m,h,e[n+11],22,-1990404162),h=o(h,p,f,m,e[n+12],7,1804603682),m=o(m,h,p,f,e[n+13],12,-40341101),f=o(f,m,h,p,e[n+14],17,-1502002290),h=l(h,p=o(p,f,m,h,e[n+15],22,1236535329),f,m,e[n+1],5,-165796510),m=l(m,h,p,f,e[n+6],9,-1069501632),f=l(f,m,h,p,e[n+11],14,643717713),p=l(p,f,m,h,e[n],20,-373897302),h=l(h,p,f,m,e[n+5],5,-701558691),m=l(m,h,p,f,e[n+10],9,38016083),f=l(f,m,h,p,e[n+15],14,-660478335),p=l(p,f,m,h,e[n+4],20,-405537848),h=l(h,p,f,m,e[n+9],5,568446438),m=l(m,h,p,f,e[n+14],9,-1019803690),f=l(f,m,h,p,e[n+3],14,-187363961),p=l(p,f,m,h,e[n+8],20,1163531501),h=l(h,p,f,m,e[n+13],5,-1444681467),m=l(m,h,p,f,e[n+2],9,-51403784),f=l(f,m,h,p,e[n+7],14,1735328473),h=u(h,p=l(p,f,m,h,e[n+12],20,-1926607734),f,m,e[n+5],4,-378558),m=u(m,h,p,f,e[n+8],11,-2022574463),f=u(f,m,h,p,e[n+11],16,1839030562),p=u(p,f,m,h,e[n+14],23,-35309556),h=u(h,p,f,m,e[n+1],4,-1530992060),m=u(m,h,p,f,e[n+4],11,1272893353),f=u(f,m,h,p,e[n+7],16,-155497632),p=u(p,f,m,h,e[n+10],23,-1094730640),h=u(h,p,f,m,e[n+13],4,681279174),m=u(m,h,p,f,e[n],11,-358537222),f=u(f,m,h,p,e[n+3],16,-722521979),p=u(p,f,m,h,e[n+6],23,76029189),h=u(h,p,f,m,e[n+9],4,-640364487),m=u(m,h,p,f,e[n+12],11,-421815835),f=u(f,m,h,p,e[n+15],16,530742520),h=c(h,p=u(p,f,m,h,e[n+2],23,-995338651),f,m,e[n],6,-198630844),m=c(m,h,p,f,e[n+7],10,1126891415),f=c(f,m,h,p,e[n+14],15,-1416354905),p=c(p,f,m,h,e[n+5],21,-57434055),h=c(h,p,f,m,e[n+12],6,1700485571),m=c(m,h,p,f,e[n+3],10,-1894986606),f=c(f,m,h,p,e[n+10],15,-1051523),p=c(p,f,m,h,e[n+1],21,-2054922799),h=c(h,p,f,m,e[n+8],6,1873313359),m=c(m,h,p,f,e[n+15],10,-30611744),f=c(f,m,h,p,e[n+6],15,-1560198380),p=c(p,f,m,h,e[n+13],21,1309151649),h=c(h,p,f,m,e[n+4],6,-145523070),m=c(m,h,p,f,e[n+11],10,-1120210379),f=c(f,m,h,p,e[n+2],15,718787259),p=c(p,f,m,h,e[n+9],21,-343485551),h=s(h,r),p=s(p,a),f=s(f,i),m=s(m,d);return[h,p,f,m]}function h(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 p(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 f(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 m(e){return unescape(encodeURIComponent(e))}function g(e){return h(d(p(t=m(e)),8*t.length));var t}function y(e,t){return function(e,t){var n,r,a=p(e),s=[],i=[];for(s[15]=i[15]=void 0,a.length>16&&(a=d(a,8*e.length)),n=0;n<16;n+=1)s[n]=909522486^a[n],i[n]=1549556828^a[n];return r=d(s.concat(p(t)),512+8*t.length),h(d(i.concat(r),640))}(m(e),m(t))}function b(e,t,n){return t?n?y(t,e):f(y(t,e)):n?g(e):f(g(e))}void 0===(r=function(){return b}.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(Math.random()*e.length)];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,$="a",O="b",F="d",D="e";function M(){return(M=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",[$+"="+n,O+"="+r,F+"="+a,D+"="+encodeURIComponent(s)].join("&"));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}window._SHEIN_CALC_SIGNATURE_=function(e){return M.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)})}()}(),WX=self,_X=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,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==n.g&&n.g.crypto&&(r=n.g.crypto),!r)try{r=n(91)}catch(g){}var a=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(g){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},o=i.lib={},l=o.Base={extend:function(e){var t=s(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)}},u=o.WordArray=l.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).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=l.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(a());return new u.init(t,e)}}),c=i.enc={},d=c.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 u.init(n,t/2)}},h=c.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 u.init(n,t)}},p=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},f=o.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.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),l=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*i,c=e.min(4*l,s);if(l){for(var d=0;d<l;d+=i)this._doProcessBlock(a,d);n=a.splice(0,l),r.sigBytes-=c}return new u.init(n,c)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),m=(o.Hasher=f.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.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 m.HMAC.init(e,n).finalize(t)}}}),i.algo={});return i}(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|0,s=e>>>16&65535|0,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|0}},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-1^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,t,n){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,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;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=_X():"function"==typeof define&&define.amd?define([],_X):"object"==typeof exports?exports.AntiIn=_X():WX.AntiIn=_X();const TX=e=>(Oe("data-v-5ed42ea0"),e=e(),Fe(),e),NX={class:"1688-search"},EX={class:"filter-wrap"},RX={class:"filter-item"},$X=TX((()=>we("span",{class:"label"},"排序:",-1))),OX={class:"filter-item"},FX=TX((()=>we("span",{class:"label"},"筛选:",-1))),DX={key:0,class:"ad-wrap"},MX=TX((()=>we("a",{href:"https://www.sheinshuju.com/download",target:"_blank"},[we("img",{src:"/assets/shein-banner-919d23d5.jpg"})],-1))),LX={class:"list-wrap"},BX=["href"],PX={class:"info-wrap"},zX=["src"],GX={class:"title"},VX=["innerHTML"],UX={class:"price-wrap"},HX={class:"price"},jX={class:"prefix"},qX={key:0,class:"sold"},QX={key:0,class:"mall-wrap"},XX=["innerHTML"],ZX=["innerHTML"],KX={key:1,class:"error-tip"},JX={class:"left"},YX={class:"center"},eZ=TX((()=>we("div",{class:"title"}," 提示 ",-1))),tZ={class:"sub-title"},nZ={class:"right"},rZ=["href"],aZ={key:2,class:"error-tip"},sZ={class:"left"},iZ={class:"center"},oZ=TX((()=>we("div",{class:"title"}," 提示 ",-1))),lZ={class:"sub-title"},uZ={class:"right"},cZ={key:3,class:"loading-wrap"},dZ={class:"text"},hZ={key:4,style:{padding:"20px"}},pZ={key:5,class:"bottom-tip"},fZ=[TX((()=>we("span",null,"没有更多了",-1)))],mZ=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 yn({...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 vn({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=De,f=Ee,v=Ye,S=Ae("router-link"),C=u,I=Re;return xe(),ke("div",NX,[we("div",EX,[we("span",RX,[$X,$(r,{value:b.value,"onUpdate:value":t[0]||(t[0]=e=>b.value=e),style:{width:"130px"},onChange:A},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1})])),_:1},8,["value"])]),we("span",OX,[FX,$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题",style:{width:"200px"}},null,8,["value"])])]),k.value?(xe(),ke("div",DX,[MX,$(We(He),{class:"close-icon",onClick:Ue(w,["prevent","stop"])},null,8,["onClick"])])):Ne("",!0),we("div",LX,[(xe(!0),ke(D,null,Ie(y.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",PX,[we("img",{src:e.thumb,class:"thumb"},null,8,zX),we("div",GX,[e.tag?(xe(),$e(p,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:x(e.title,h.value)},null,8,VX)]),we("div",UX,[we("span",HX,[we("span",jX,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",qX,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",QX,[we("span",{class:"mall",innerHTML:x(e.mall,h.value)},null,8,XX),we("span",{class:"location",innerHTML:x(e.location,h.value)},null,8,ZX)])):Ne("",!0)],8,BX)))),128))]),"error"===s.value?(xe(),ke("div",KX,[we("div",JX,[$(We(_e),{class:"icon"})]),we("div",YX,[eZ,we("div",tZ,Te(d.value),1)]),we("div",nZ,[$(v,null,{default:Se((()=>[we("a",{target:"_blank",href:m.value},[$(f,{type:"primary"},{default:Se((()=>[Ce(" 打开Shein ")])),_:1})],8,rZ),$(f,{onClick:O},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===s.value?(xe(),ke("div",aZ,[we("div",sZ,[$(We(_e),{class:"icon"})]),we("div",iZ,[oZ,we("div",lZ,Te(d.value),1)]),we("div",uZ,[$(v,null,{default:Se((()=>[$(S,{target:"_blank",to:"/download"},{default:Se((()=>[$(f,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===s.value||""===s.value?(xe(),ke("div",cZ,[$(C,{size:"large"}),we("span",dZ,Te(g.value),1)])):Ne("",!0),"success"!==s.value&&"finish"!==s.value||0!==y.value.length?Ne("",!0):(xe(),ke("div",hZ,[$(I,{description:"没有搜索到商品"})])),"finish"===s.value&&y.value.length>0?(xe(),ke("div",pZ,fZ)):Ne("",!0)])}}},[["__scopeId","data-v-5ed42ea0"]]),gZ=e=>(Oe("data-v-388cb41e"),e=e(),Fe(),e),yZ={class:"1688-search"},bZ={class:"filter-wrap"},vZ={class:"filter-item"},AZ=gZ((()=>we("span",{class:"label"},"站点:",-1))),xZ={class:"filter-item"},kZ=gZ((()=>we("span",{class:"label"},"排序:",-1))),wZ={class:"filter-item"},SZ=gZ((()=>we("span",{class:"label"},"筛选:",-1))),CZ={class:"list-wrap"},IZ=["href"],WZ={class:"info-wrap"},_Z=["src"],TZ={class:"title"},NZ=["innerHTML"],EZ={class:"price-wrap"},RZ={class:"price"},$Z={class:"prefix"},OZ={key:0,class:"sold"},FZ={key:0,class:"mall-wrap"},DZ=["innerHTML"],MZ=["innerHTML"],LZ={key:0,class:"error-tip"},BZ={class:"left"},PZ={class:"center"},zZ=gZ((()=>we("div",{class:"title"}," 提示 ",-1))),GZ={class:"sub-title"},VZ={class:"right"},UZ=["href"],HZ={key:1,class:"error-tip"},jZ={class:"left"},qZ={class:"center"},QZ=gZ((()=>we("div",{class:"title"}," 提示 ",-1))),XZ={class:"sub-title"},ZZ={class:"right"},KZ={key:2,class:"loading-wrap"},JZ={class:"text"},YZ={key:3,style:{padding:"20px"}},eK={key:4,class:"bottom-tip"},tK=[gZ((()=>we("span",null,"没有更多了",-1)))],nK=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 yn({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 yn({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 gn();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=De,y=Ee,x=Ye,k=Ae("router-link"),w=u,S=Re;return xe(),ke("div",yZ,[we("div",bZ,[we("span",vZ,[AZ,$(r,{value:We(A),"onUpdate:value":t[0]||(t[0]=e=>Qe(A)?A.value=e:A=e),style:{width:"100px"},onChange:C},{default:Se((()=>[$(n,{value:"https://www.amazon.com"},{default:Se((()=>[Ce("美国")])),_:1}),$(n,{value:"https://www.amazon.co.uk"},{default:Se((()=>[Ce("英国")])),_:1}),$(n,{value:"https://www.amazon.co.jp"},{default:Se((()=>[Ce("日本")])),_:1}),$(n,{value:"https://www.amazon.es"},{default:Se((()=>[Ce("西班牙")])),_:1}),$(n,{value:"https://www.amazon.fr"},{default:Se((()=>[Ce("法国")])),_:1}),$(n,{value:"https://www.amazon.it"},{default:Se((()=>[Ce("意大利")])),_:1})])),_:1},8,["value"])]),we("span",xZ,[kZ,$(r,{value:g.value,"onUpdate:value":t[1]||(t[1]=e=>g.value=e),style:{width:"130px"},onChange:b},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1})])),_:1},8,["value"])]),we("span",wZ,[SZ,$(h,{value:d.value,"onUpdate:value":t[2]||(t[2]=e=>d.value=e),placeholder:"商品标题",style:{width:"200px"}},null,8,["value"])])]),we("div",CZ,[(xe(!0),ke(D,null,Ie(m.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",WZ,[we("img",{src:e.thumb,class:"thumb"},null,8,_Z),we("div",TZ,[e.tag?(xe(),$e(p,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:v(e.title,d.value)},null,8,NZ)]),we("div",EZ,[we("span",RZ,[we("span",$Z,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",OZ,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",FZ,[we("span",{class:"mall",innerHTML:v(e.mall,d.value)},null,8,DZ),we("span",{class:"location",innerHTML:v(e.location,d.value)},null,8,MZ)])):Ne("",!0)],8,IZ)))),128))]),"error"===a.value?(xe(),ke("div",LZ,[we("div",BZ,[$(We(_e),{class:"icon"})]),we("div",PZ,[zZ,we("div",GZ,Te(s.value),1)]),we("div",VZ,[$(x,null,{default:Se((()=>[we("a",{target:"_blank",href:We(A)},[$(y,{type:"primary"},{default:Se((()=>[Ce(" 登录亚马逊 ")])),_:1})],8,UZ),$(y,{onClick:C},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===a.value?(xe(),ke("div",HZ,[we("div",jZ,[$(We(_e),{class:"icon"})]),we("div",qZ,[QZ,we("div",XZ,Te(s.value),1)]),we("div",ZZ,[$(x,null,{default:Se((()=>[$(k,{target:"_blank",to:"/download"},{default:Se((()=>[$(y,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===a.value||""===a.value?(xe(),ke("div",KZ,[$(w,{size:"large"}),we("span",JZ,Te(f.value),1)])):Ne("",!0),"success"!==a.value&&"finish"!==a.value||0!==m.value.length?Ne("",!0):(xe(),ke("div",YZ,[$(S,{description:"没有搜索到商品"})])),"finish"===a.value&&m.value.length>0?(xe(),ke("div",eK,tK)):Ne("",!0)])}}},[["__scopeId","data-v-388cb41e"]]),rK=e=>(Oe("data-v-aafe3dda"),e=e(),Fe(),e),aK={class:"1688xunyuantong-search"},sK={class:"filter-wrap"},iK={class:"filter-item"},oK=rK((()=>we("span",{class:"label"},"排序:",-1))),lK={class:"filter-item"},uK=rK((()=>we("span",{class:"label"},"筛选:",-1))),cK={class:"list-wrap"},dK=["href"],hK={class:"info-wrap"},pK=["src"],fK={class:"title"},mK=["innerHTML"],gK={class:"price-wrap"},yK={class:"price"},bK={class:"prefix"},vK={key:0,class:"sold"},AK={key:0,class:"mall-wrap"},xK=["innerHTML"],kK=["innerHTML"],wK={key:0,class:"error-tip"},SK={class:"left"},CK={class:"center"},IK=rK((()=>we("div",{class:"title"}," 提示 ",-1))),WK={class:"sub-title"},_K={class:"right"},TK={key:1,class:"error-tip"},NK={class:"left"},EK={class:"center"},RK=rK((()=>we("div",{class:"title"}," 提示 ",-1))),$K={class:"sub-title"},OK={class:"right"},FK={key:2,class:"loading-wrap"},DK={class:"text"},MK={key:3,style:{padding:"20px"}},LK={key:4,class:"bottom-tip"},BK=[rK((()=>we("span",null,"没有更多了",-1)))],PK=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=De,y=Ee,A=Ye,k=Ae("router-link"),w=u,S=Re;return xe(),ke("div",aK,[we("div",sK,[we("span",iK,[oK,$(r,{value:g.value,"onUpdate:value":t[0]||(t[0]=e=>g.value=e),style:{width:"130px"},onChange:b},{default:Se((()=>[$(n,{value:""},{default:Se((()=>[Ce("默认排序")])),_:1}),$(n,{value:"price-min-max"},{default:Se((()=>[Ce("价格从低到高")])),_:1}),$(n,{value:"price-max-min"},{default:Se((()=>[Ce("价格从高到低")])),_:1})])),_:1},8,["value"])]),we("span",lK,[uK,$(a,{value:h.value,"onUpdate:value":t[1]||(t[1]=e=>h.value=e),placeholder:"商品标题 / 品类",style:{width:"200px"}},null,8,["value"])])]),we("div",cK,[(xe(!0),ke(D,null,Ie(m.value,((e,t)=>(xe(),ke("a",{key:e.url+t,target:"_blank",href:e.url,class:"list-item"},[we("div",hK,[we("img",{src:e.thumb,class:"thumb"},null,8,pK),we("div",fK,[e.tag?(xe(),$e(p,{key:0,color:"orange"},{default:Se((()=>[Ce(Te(e.tag),1)])),_:2},1024)):Ne("",!0),we("span",{innerHTML:v(e.title,h.value)},null,8,mK)]),we("div",gK,[we("span",yK,[we("span",bK,Te(e.currency),1),Ce(Te(e.price),1)]),e.sold?(xe(),ke("span",vK,"已售出 "+Te(We(c)(e.sold))+" 件",1)):Ne("",!0)])]),e.mall||e.location?(xe(),ke("div",AK,[we("span",{class:"mall",innerHTML:v(e.mall,h.value)},null,8,xK),we("span",{class:"location",innerHTML:v(e.location,h.value)},null,8,kK)])):Ne("",!0)],8,dK)))),128))]),"error"===s.value?(xe(),ke("div",wK,[we("div",SK,[$(We(_e),{class:"icon"})]),we("div",CK,[IK,we("div",WK,Te(d.value),1)]),we("div",_K,[$(A,null,{default:Se((()=>[$(y,{onClick:x},{default:Se((()=>[Ce(" 重新搜索 ")])),_:1})])),_:1})])])):Ne("",!0),"install-error"===s.value?(xe(),ke("div",TK,[we("div",NK,[$(We(_e),{class:"icon"})]),we("div",EK,[RK,we("div",$K,Te(d.value),1)]),we("div",OK,[$(A,null,{default:Se((()=>[$(k,{target:"_blank",to:"/download"},{default:Se((()=>[$(y,{type:"primary"},{default:Se((()=>[Ce(" 下载插件 ")])),_:1})])),_:1})])),_:1})])])):Ne("",!0),"loading"===s.value||""===s.value?(xe(),ke("div",FK,[$(w,{size:"large"}),we("span",DK,Te(f.value),1)])):Ne("",!0),"success"!==s.value&&"finish"!==s.value||0!==m.value.length?Ne("",!0):(xe(),ke("div",MK,[$(S,{description:"没有搜索到商品"})])),"finish"===s.value&&m.value.length>0?(xe(),ke("div",LK,BK)):Ne("",!0)])}}},[["__scopeId","data-v-aafe3dda"]]),zK={class:"search-image-wrap"},GK={class:"content-wrap"},VK={class:"info-card"},UK={class:"price-info"},HK={key:0,class:"item"},jK={class:"label"},qK={class:"value"},QK={key:0},XK={key:1},ZK={key:1,class:"item"},KK={class:"label"},JK={class:"value"},YK={key:2,class:"item"},eJ={class:"label"},tJ={class:"value"},nJ={key:3,class:"item"},rJ={class:"label"},aJ={class:"value"},sJ={style:{"margin-top":"5px"}},iJ={class:"tab-wrap"},oJ={key:0,class:"search-result"},lJ={__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 je.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}`:je.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||"")}`):je.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 yn({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=qe,k=Be,w=Ee,C=Ye,I=tt,W=et;return xe(),ke("div",zK,[$(Xe),we("div",GK,[we("div",VK,[$(n,{width:80,src:r.value},null,8,["src"]),we("div",UK,[we("div",null,[c.value&&d.value?(xe(),ke("span",HK,[we("span",jK,[Ce(" 供货价参考 "),$(x,null,{title:Se((()=>[Ce("综合1688和拼多多同款货源Top10的价格范围,基本可以参考为供货价")])),default:Se((()=>[$(We(S))])),_:1}),Ce(" : ")]),we("span",qK,[c.value==p.value?(xe(),ke("span",QK,"¥"+Te(c.value),1)):(xe(),ke("span",XK,"¥"+Te(c.value)+"-"+Te(p.value),1))]),$(k,{type:"vertical"})])):Ne("",!0),h.value&&p.value?(xe(),ke("span",ZK,[we("span",KK,[Ce(" 1688货源价 "),$(x,null,{title:Se((()=>[Ce("1688同款货源Top10的价格范围")])),default:Se((()=>[$(We(S))])),_:1}),Ce(" : ")]),we("span",JK,"¥"+Te(h.value)+"-"+Te(f.value),1),$(k,{type:"vertical"})])):Ne("",!0),p.value?(xe(),ke("span",YK,[we("span",eJ,[Ce(" 1688中位价 "),$(x,null,{title:Se((()=>[Ce("1688同款货源Top10的中位价,Temu要求供货价不得高于此价格")])),default:Se((()=>[$(We(S))])),_:1}),Ce(" : ")]),we("span",tJ," ¥"+Te(p.value),1),$(k,{type:"vertical"})])):Ne("",!0),m.value&&g.value?(xe(),ke("span",nJ,[we("span",rJ,[Ce(" 拼多多货源价 "),$(x,null,{title:Se((()=>[Ce("拼多多同款货源Top10的价格范围,Temu要求供货价不得高于最低价格")])),default:Se((()=>[$(We(S))])),_:1}),Ce(" : ")]),we("span",aJ,"¥"+Te(m.value)+"-"+Te(g.value),1)])):Ne("",!0)]),we("div",sJ,[$(C,null,{default:Se((()=>[$(w,{icon:Le(We(N)),loading:i.value,onClick:o},{default:Se((()=>[Ce(" 上传图片 ")])),_:1},8,["icon","loading"]),$(k,{type:"vertical"}),$(w,{icon:Le(We(Et)),loading:l.value,onClick:u},{default:Se((()=>[Ce(" 侵权检测 ")])),_:1},8,["icon","loading"])])),_:1})])])]),we("div",iJ,[$(W,{"active-key":a.value,size:"large",class:"tab",onChange:A},{default:Se((()=>[$(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?(xe(),ke("div",oJ,["1688"===a.value?(xe(),$e(sr,{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"])):Ne("",!0),"1688xunyuantong"===a.value?(xe(),$e(ea,{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"])):Ne("",!0),"1688fenxiao"===a.value?(xe(),$e(La,{key:2,loading:s.value,"onUpdate:loading":t[2]||(t[2]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Ne("",!0),"1688kuajing"===a.value?(xe(),$e(ws,{key:3,loading:s.value,"onUpdate:loading":t[3]||(t[3]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Ne("",!0),"pdd"===a.value?(xe(),$e(li,{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"])):Ne("",!0),"pdd-pifa"===a.value?(xe(),$e(Qi,{key:5,loading:s.value,"onUpdate:loading":t[5]||(t[5]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Ne("",!0),"taobao"===a.value?(xe(),$e($o,{key:6,loading:s.value,"onUpdate:loading":t[6]||(t[6]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Ne("",!0),"temu"===a.value?(xe(),$e(IX,{key:7,loading:s.value,"onUpdate:loading":t[7]||(t[7]=e=>s.value=e),"img-url":r.value,title:We(y)},null,8,["loading","img-url","title"])):Ne("",!0),"shein"===a.value?(xe(),$e(mZ,{key:8,loading:s.value,"onUpdate:loading":t[8]||(t[8]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Ne("",!0),"amazon"===a.value?(xe(),$e(nK,{key:9,loading:s.value,"onUpdate:loading":t[9]||(t[9]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Ne("",!0),"aliexpress"===a.value?(xe(),$e(PK,{key:10,loading:s.value,"onUpdate:loading":t[10]||(t[10]=e=>s.value=e),"img-url":r.value},null,8,["loading","img-url"])):Ne("",!0)])):Ne("",!0)]),$(Je),$(Ke)])}}},uJ=ye(lJ,[["__scopeId","data-v-15cf22eb"]]);export{uJ as default};