diff --git a/Extension files/icon_128.png b/Extension files/icon_128.png new file mode 100644 index 0000000..28d66f4 Binary files /dev/null and b/Extension files/icon_128.png differ diff --git a/Extension files/icon_16.png b/Extension files/icon_16.png new file mode 100644 index 0000000..28d66f4 Binary files /dev/null and b/Extension files/icon_16.png differ diff --git a/Extension files/icon_32.png b/Extension files/icon_32.png new file mode 100644 index 0000000..28d66f4 Binary files /dev/null and b/Extension files/icon_32.png differ diff --git a/Extension files/icon_48.png b/Extension files/icon_48.png new file mode 100644 index 0000000..28d66f4 Binary files /dev/null and b/Extension files/icon_48.png differ diff --git a/Extension files/main-icon.png b/Extension files/main-icon.png new file mode 100644 index 0000000..4638cd3 Binary files /dev/null and b/Extension files/main-icon.png differ diff --git a/Extension files/open.png b/Extension files/open.png new file mode 100644 index 0000000..79bfd06 Binary files /dev/null and b/Extension files/open.png differ diff --git a/Extension files/popup.css b/Extension files/popup.css new file mode 100644 index 0000000..a300fda --- /dev/null +++ b/Extension files/popup.css @@ -0,0 +1,251 @@ +* { + font-family: 'IBM Plex Sans'; + box-sizing: border-box; + outline: 0 +} + +html { + width: 340px +} + +body { + + width: 324px + +} + +body, +html { + background: #000000; + color: #fff; + line-height: 1.15; + text-size-adjust: 100% +} + +div { + display: block +} + +a { + text-decoration: none +} + +input { + font-family: inherit; + font-size: 100%; + line-height: 1.15; + margin: 0 +} + +input { + overflow: visible +} + +input { + writing-mode: horizontal-tb !important; + text-rendering: auto; + color: fieldtext; + letter-spacing: normal; + word-spacing: normal; + line-height: normal; + text-transform: none; + text-indent: 0; + text-shadow: none; + display: inline-block; + text-align: start; + appearance: auto; + -webkit-rtl-ordering: logical; + cursor: text; + background-color: field; + margin: 0; + padding: 1px 2px; + border-width: 2px; + border-style: inset; + border-color: -internal-light-dark(#767676, #858585); + border-image: initial +} + +.text_input { + background-color: transparent; + padding: 8px 8px 8px 16px; + color: #fff; + outline: 0; + border: none; + width: 100%; + font-size: 14px +} + +.text_input.small { + width: 30% +} + +.text_input.text_right { + text-align: right +} + +input::-webkit-inner-spin-button, +input::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0 +} + +input[type=number] { + appearance: textfield; + -moz-appearance: textfield +} + +::-webkit-scrollbar { + width: 6px; + right: 2px; + bottom: 2px; + top: 2px; + border-radius: 3px +} + +::-webkit-scrollbar-track { + background: 0 0 +} + +::-webkit-scrollbar-thumb { + background: #fe9800 +} + +.header { + box-sizing: border-box; + padding: 16px; + display: flex; + place-content: space-between; + font-weight: 400 +} + +.header_label_container { + box-sizing: border-box; + margin-right: 0; + display: flex; + flex: 1 1 0%; + -webkit-box-pack: center; + justify-content: center; + -webkit-box-align: center; + align-items: center +} + +.header_label { + box-sizing: border-box; + font-size: 24px; + font-weight: 700; + display: flex; + color: #fff +} + +.bbflex { + box-sizing: border-box; + display: flex; + -webkit-box-align: center; + align-items: center +} + +.scrolling_container { + box-sizing: border-box; + margin-top: 8px; + margin-left: 16px; + margin-right: 16px; + padding-bottom: 16px +} + +.settings_item_container { + box-sizing: border-box; + margin-bottom: 8px; + border: 1px solid rgba(255, 255, 255, .08); + border-radius: 8px; + box-sizing: border-box +} + +.settings_item { + width: 100%; + background-color: rgba(255, 255, 255, .08); + min-height: 48px; + padding: 14px 16px 0; + border-radius: 8px +} + +.settings_item>div { + -webkit-box-pack: justify; + justify-content: space-between; + -webkit-box-align: center; + align-items: center +} + +.settings_item_label { + font-size: 14px; + font-weight: 600; + color: #fff; + padding-left: 16px; + height: 20px; + -webkit-box-align: center; + align-items: center +} + +.settings_toggle { + height: 20px; + max-width: 36px; + min-width: 36px; + border-radius: 10px; + padding: 2px; + transition: background-color .3s ease 0s; + opacity: 1; + cursor: pointer +} + +.settings_toggle>div { + width: 16px; + height: 16px; + border-radius: 50%; + transform: translate(16px); + transition: transform .3s ease 0s, background-color .3s ease 0s +} + +.settings_toggle.on { + background-color: #fe9800 +} + +.settings_toggle.off { + background-color: #fff +} + +.settings_toggle.on>div { + background-color: #fff; + transform: translate(16px) +} + +.settings_toggle.off>div { + background-color: #fe9800; + transform: translate(0) +} + +.settings_description_container { + padding: 10px 16px 8px; + -webkit-box-pack: justify; + justify-content: space-between +} + +.settings_description { + font-size: 12px; + color: rgba(255, 255, 255, .5) +} + +.footer { + display: flex; + flex-direction: row; + padding: 8px; + margin-top: 8px; + font-size: 10px +} + +.footer * { + color: rgba(255, 255, 255, .8) +} + +.footer>:nth-child(1) { + flex-grow: 1 +} + diff --git a/Extension files/popup.js b/Extension files/popup.js new file mode 100644 index 0000000..c39e8a1 --- /dev/null +++ b/Extension files/popup.js @@ -0,0 +1 @@ +(()=>{"use strict";document.addEventListener("DOMContentLoaded",(function(){chrome.storage.local.get(["auto_open","auto_solve","click_delay_time","solve_delay_time"],(async t=>{const s=document.getElementsByClassName("settings_toggle"),e=document.getElementsByClassName("settings_text");for(const e of s)e.classList.remove("on","off"),e.classList.add(t[e.dataset.settings]?"on":"off");for(const s of e)s.value=t[s.dataset.settings]}));const t=async t=>{var s=t.classList.contains("settings_toggle")?t.classList.contains("off"):t.value;await chrome.storage.local.set({[t.dataset.settings]:s}),t.classList.contains("settings_toggle")&&(t.classList.remove("on","off"),t.classList.add(s?"on":"off"))};for(const s of document.querySelectorAll(".settings_toggle, .settings_text"))s.classList.contains("settings_toggle")?s.addEventListener("click",(()=>t(s))):s.classList.contains("settings_text")&&s.addEventListener("input",(()=>t(s)))}))})(); \ No newline at end of file diff --git a/Extension files/solve.png b/Extension files/solve.png new file mode 100644 index 0000000..39abe53 Binary files /dev/null and b/Extension files/solve.png differ diff --git a/Extension files/time.png b/Extension files/time.png new file mode 100644 index 0000000..b766f13 Binary files /dev/null and b/Extension files/time.png differ diff --git a/background.js b/background.js new file mode 100644 index 0000000..cf73a1a --- /dev/null +++ b/background.js @@ -0,0 +1,34 @@ +(() => { + "use strict"; + chrome.runtime.onInstalled.addListener((async () => { + await chrome.storage.local.set({ + auto_open: !0, + auto_solve: !0, + click_delay_time: 50, + solve_delay_time: 3e3 + }) + })), chrome.runtime.onMessage.addListener((function(e, t, a) { + return (async () => { + const t = `https://github.com/Wikidepia/hektCaptcha-extension/releases/download/modelhub/${e}.ort`; + try { + const e = await fetch(t), + s = await e.blob(), + o = await (async e => { + const t = new FileReader; + return new Promise((a => { + t.onloadend = () => a(t.result), t.readAsDataURL(e) + })) + })(s); + a({ + status: e.status, + model: o + }) + } catch (e) { + a({ + status: "error", + message: e.message + }) + } + })(), !0 + })) +})(); \ No newline at end of file diff --git a/contentScript.js b/contentScript.js new file mode 100644 index 0000000..4ceaf42 --- /dev/null +++ b/contentScript.js @@ -0,0 +1,2 @@ +/*! For license information please see contentScript.js.LICENSE.txt */ +(()=>{var __webpack_modules__={2878:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(8416)),o=r(n(784)),a=n(1567),s="image/bmp",u="image/x-ms-bmp",l=function(t){return e=o.default.decode(t),(0,a.scan)({bitmap:e},0,0,e.width,e.height,(function(t,n,r){var i=this.bitmap.data[r+0],o=this.bitmap.data[r+1],a=this.bitmap.data[r+2],s=this.bitmap.data[r+3];this.bitmap.data[r+0]=s,this.bitmap.data[r+1]=a,this.bitmap.data[r+2]=o,this.bitmap.data[r+3]=e.is_with_alpha?i:255})).bitmap;var e},c=function(t){return o.default.encode(function(t){return(0,a.scan)(t,0,0,t.bitmap.width,t.bitmap.height,(function(t,e,n){var r=this.bitmap.data[n+0],i=this.bitmap.data[n+1],o=this.bitmap.data[n+2],a=this.bitmap.data[n+3];this.bitmap.data[n+0]=a,this.bitmap.data[n+1]=o,this.bitmap.data[n+2]=i,this.bitmap.data[n+3]=r})).bitmap}(t)).data};e.default=function(){var t,e;return{mime:(0,i.default)({},s,["bmp"]),constants:{MIME_BMP:s,MIME_X_MS_BMP:u},decoders:(t={},(0,i.default)(t,s,l),(0,i.default)(t,u,l),t),encoders:(e={},(0,i.default)(e,s,c),(0,i.default)(e,u,c),e)}}},4096:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.srcOver=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=(t.r*t.a+e.r*e.a*(1-t.a))/r,o=(t.g*t.a+e.g*e.a*(1-t.a))/r,a=(t.b*t.a+e.b*e.a*(1-t.a))/r;return{r:i,g:o,b:a,a:r}},e.dstOver=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=(e.r*e.a+t.r*t.a*(1-e.a))/r,o=(e.g*e.a+t.g*t.a*(1-e.a))/r,a=(e.b*e.a+t.b*t.a*(1-e.a))/r;return{r:i,g:o,b:a,a:r}},e.multiply=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(i*s+i*(1-e.a)+s*(1-t.a))/r,h=(o*u+o*(1-e.a)+u*(1-t.a))/r,f=(a*l+a*(1-e.a)+l*(1-t.a))/r;return{r:c,g:h,b:f,a:r}},e.add=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(i+s)/r,h=(o+u)/r,f=(a+l)/r;return{r:c,g:h,b:f,a:r}},e.screen=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(i*e.a+s*t.a-i*s+i*(1-e.a)+s*(1-t.a))/r,h=(o*e.a+u*t.a-o*u+o*(1-e.a)+u*(1-t.a))/r,f=(a*e.a+l*t.a-a*l+a*(1-e.a)+l*(1-t.a))/r;return{r:c,g:h,b:f,a:r}},e.overlay=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(2*s<=e.a?2*i*s+i*(1-e.a)+s*(1-t.a):i*(1+e.a)+s*(1+t.a)-2*s*i-e.a*t.a)/r,h=(2*u<=e.a?2*o*u+o*(1-e.a)+u*(1-t.a):o*(1+e.a)+u*(1+t.a)-2*u*o-e.a*t.a)/r,f=(2*l<=e.a?2*a*l+a*(1-e.a)+l*(1-t.a):a*(1+e.a)+l*(1+t.a)-2*l*a-e.a*t.a)/r;return{r:c,g:h,b:f,a:r}},e.darken=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(Math.min(i*e.a,s*t.a)+i*(1-e.a)+s*(1-t.a))/r,h=(Math.min(o*e.a,u*t.a)+o*(1-e.a)+u*(1-t.a))/r,f=(Math.min(a*e.a,l*t.a)+a*(1-e.a)+l*(1-t.a))/r;return{r:c,g:h,b:f,a:r}},e.lighten=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(Math.max(i*e.a,s*t.a)+i*(1-e.a)+s*(1-t.a))/r,h=(Math.max(o*e.a,u*t.a)+o*(1-e.a)+u*(1-t.a))/r,f=(Math.max(a*e.a,l*t.a)+a*(1-e.a)+l*(1-t.a))/r;return{r:c,g:h,b:f,a:r}},e.hardLight=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(2*i<=t.a?2*i*s+i*(1-e.a)+s*(1-t.a):i*(1+e.a)+s*(1+t.a)-2*s*i-e.a*t.a)/r,h=(2*o<=t.a?2*o*u+o*(1-e.a)+u*(1-t.a):o*(1+e.a)+u*(1+t.a)-2*u*o-e.a*t.a)/r,f=(2*a<=t.a?2*a*l+a*(1-e.a)+l*(1-t.a):a*(1+e.a)+l*(1+t.a)-2*l*a-e.a*t.a)/r;return{r:c,g:h,b:f,a:r}},e.difference=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(i+s-2*Math.min(i*e.a,s*t.a))/r,h=(o+u-2*Math.min(o*e.a,u*t.a))/r,f=(a+l-2*Math.min(a*e.a,l*t.a))/r;return{r:c,g:h,b:f,a:r}},e.exclusion=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=n;var r=e.a+t.a-e.a*t.a,i=t.r*t.a,o=t.g*t.a,a=t.b*t.a,s=e.r*e.a,u=e.g*e.a,l=e.b*e.a,c=(i*e.a+s*t.a-2*i*s+i*(1-e.a)+s*(1-t.a))/r,h=(o*e.a+u*t.a-2*o*u+o*(1-e.a)+u*(1-t.a))/r,f=(a*e.a+l*t.a-2*a*l+a*(1-e.a)+l*(1-t.a))/r;return{r:c,g:h,b:f,a:r}}},8859:(t,e,n)=>{"use strict";var r=n(5263);Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4?arguments[4]:void 0;if("function"==typeof r&&(s=r,r={}),!(t instanceof this.constructor))return i.throwError.call(this,"The source must be a Jimp image",s);if("number"!=typeof e||"number"!=typeof n)return i.throwError.call(this,"x and y must be numbers",s);var u=r,l=u.mode,c=u.opacitySource,h=u.opacityDest;l||(l=o.BLEND_SOURCE_OVER),("number"!=typeof c||c<0||c>1)&&(c=1),("number"!=typeof h||h<0||h>1)&&(h=1);var f=a[l];e=Math.round(e),n=Math.round(n);var d=this;return 1!==h&&d.opacity(h),t.scanQuiet(0,0,t.bitmap.width,t.bitmap.height,(function(t,r,i){var a=d.getPixelIndex(e+t,n+r,o.EDGE_CROP),s=f({r:this.bitmap.data[i+0]/255,g:this.bitmap.data[i+1]/255,b:this.bitmap.data[i+2]/255,a:this.bitmap.data[i+3]/255},{r:d.bitmap.data[a+0]/255,g:d.bitmap.data[a+1]/255,b:d.bitmap.data[a+2]/255,a:d.bitmap.data[a+3]/255},c);d.bitmap.data[a+0]=this.constructor.limit255(255*s.r),d.bitmap.data[a+1]=this.constructor.limit255(255*s.g),d.bitmap.data[a+2]=this.constructor.limit255(255*s.b),d.bitmap.data[a+3]=this.constructor.limit255(255*s.a)})),(0,i.isNodePattern)(s)&&s.call(this,null,this),this};var i=n(1567),o=r(n(9215)),a=r(n(4096))},9215:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EDGE_CROP=e.EDGE_WRAP=e.EDGE_EXTEND=e.BLEND_EXCLUSION=e.BLEND_DIFFERENCE=e.BLEND_HARDLIGHT=e.BLEND_LIGHTEN=e.BLEND_DARKEN=e.BLEND_OVERLAY=e.BLEND_SCREEN=e.BLEND_ADD=e.BLEND_MULTIPLY=e.BLEND_DESTINATION_OVER=e.BLEND_SOURCE_OVER=e.VERTICAL_ALIGN_BOTTOM=e.VERTICAL_ALIGN_MIDDLE=e.VERTICAL_ALIGN_TOP=e.HORIZONTAL_ALIGN_RIGHT=e.HORIZONTAL_ALIGN_CENTER=e.HORIZONTAL_ALIGN_LEFT=e.AUTO=void 0,e.AUTO=-1,e.HORIZONTAL_ALIGN_LEFT=1,e.HORIZONTAL_ALIGN_CENTER=2,e.HORIZONTAL_ALIGN_RIGHT=4,e.VERTICAL_ALIGN_TOP=8,e.VERTICAL_ALIGN_MIDDLE=16,e.VERTICAL_ALIGN_BOTTOM=32,e.BLEND_SOURCE_OVER="srcOver",e.BLEND_DESTINATION_OVER="dstOver",e.BLEND_MULTIPLY="multiply",e.BLEND_ADD="add",e.BLEND_SCREEN="screen",e.BLEND_OVERLAY="overlay",e.BLEND_DARKEN="darken",e.BLEND_LIGHTEN="lighten",e.BLEND_HARDLIGHT="hardLight",e.BLEND_DIFFERENCE="difference",e.BLEND_EXCLUSION="exclusion",e.EDGE_EXTEND=1,e.EDGE_WRAP=2,e.EDGE_CROP=3},5859:(t,e,n)=>{"use strict";var r=n(1109).lW,i=n(4155),o=n(5263),a=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.addConstants=q,e.addJimpMethods=W,e.jimpEvMethod=Y,e.jimpEvChange=X,Object.defineProperty(e,"addType",{enumerable:!0,get:function(){return P.addType}}),e.default=void 0;for(var s=a(n(3515)),u=a(n(7424)),l=a(n(6690)),c=a(n(9728)),h=a(n(4993)),f=a(n(3808)),d=a(n(6115)),p=a(n(1655)),g=a(n(8416)),m=a(n(8698)),b=a(n(2987)),y=a(n(6470)),_=a(n(7187)),v=n(1567),w=a(n(964)),x=a(n(1890)),T=a(n(148)),E=a(n(8207)),S=a(n(3547)),A=a(n(7967)),O=a(n(8859)),I=a(n(4388)),P=o(n(9658)),k=n(5915),M=o(n(9215)),D="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",R=[NaN,NaN],C=2;C<65;C++){var L=(0,w.default)(w.default.BIN,D.slice(0,C))(new Array(65).join("1"));R.push(L.length)}function N(){}function B(t){return Object.prototype.toString.call(t).toLowerCase().indexOf("arraybuffer")>-1}function F(t){for(var e=r.alloc(t.byteLength),n=new Uint8Array(t),i=0;i (HTTP: "+i.statusCode+")";return new Error(a)}))}function U(t,e){b.default&&"function"==typeof b.default.readFile&&!t.match(/^(http|ftp)s?:\/\/./)?b.default.readFile(t,e):j({url:t},e)}function $(t){return t&&"object"===(0,m.default)(t)&&"number"==typeof t.width&&"number"==typeof t.height&&(r.isBuffer(t.data)||t.data instanceof Uint8Array||"function"==typeof Uint8ClampedArray&&t.data instanceof Uint8ClampedArray)&&(t.data.length===t.width*t.height*4||t.data.length===t.width*t.height*3)}function z(t){if(t.length%3!=0)throw new Error("Buffer length is incorrect");for(var e=r.allocUnsafe(t.length/3*4),n=0,i=0;i2&&void 0!==arguments[2]?arguments[2]:{};n=Object.assign(n,{methodName:t,eventName:e}),this.emit("any",n),t&&this.emit(t,n),this.emit(e,n)}},{key:"emitError",value:function(t,e){this.emitMulti(t,"error",e)}},{key:"getHeight",value:function(){return this.bitmap.height}},{key:"getWidth",value:function(){return this.bitmap.width}},{key:"inspect",value:function(){return""}},{key:"toString",value:function(){return"[object Jimp]"}},{key:"getMIME",value:function(){return this._originalMime||e.MIME_PNG}},{key:"getExtension",value:function(){var t=this.getMIME();return P.getExtension(t)}},{key:"write",value:function(t,e){var n=this;if(!b.default||!b.default.createWriteStream)throw new Error("Cant access the filesystem. You can use the getBase64 method.");if("string"!=typeof t)return v.throwError.call(this,"path must be a string",e);if(void 0===e&&(e=N),"function"!=typeof e)return v.throwError.call(this,"cb must be a function",e);var r=P.getType(t)||this.getMIME(),i=y.default.parse(t);return i.dir&&x.default.sync(i.dir),this.getBuffer(r,(function(r,i){if(r)return v.throwError.call(n,r,e);var o=b.default.createWriteStream(t);o.on("open",(function(){o.write(i),o.end()})).on("error",(function(t){return v.throwError.call(n,t,e)})),o.on("finish",(function(){e.call(n,null,n)}))})),this}},{key:"getBase64",value:function(t,n){return t===e.AUTO&&(t=this.getMIME()),"string"!=typeof t?v.throwError.call(this,"mime must be a string",n):"function"!=typeof n?v.throwError.call(this,"cb must be a function",n):(this.getBuffer(t,(function(e,r){if(e)return v.throwError.call(this,e,n);var i="data:"+t+";base64,"+r.toString("base64");n.call(this,null,i)})),this)}},{key:"hash",value:function(t,e){if("function"==typeof(t=t||64)&&(e=t,t=64),"number"!=typeof t)return v.throwError.call(this,"base must be a number",e);if(t<2||t>64)return v.throwError.call(this,"base must be a number between 2 and 64",e);var n=this.pHash();for(n=(0,w.default)(w.default.BIN,D.slice(0,t))(n);n.length=this.bitmap.width&&(o=this.bitmap.width-1),n<0&&(a=0),n>=this.bitmap.height&&(a=this.bitmap.height-1)),r===e.EDGE_WRAP&&(t<0&&(o=this.bitmap.width+t),t>=this.bitmap.width&&(o=t%this.bitmap.width),n<0&&(o=this.bitmap.height+n),n>=this.bitmap.height&&(a=n%this.bitmap.height));var s=this.bitmap.width*a+o<<2;return(o<0||o>=this.bitmap.width)&&(s=-1),(a<0||a>=this.bitmap.height)&&(s=-1),(0,v.isNodePattern)(i)&&i.call(this,null,s),s}},{key:"getPixelColor",value:function(t,e,n){if("number"!=typeof t||"number"!=typeof e)return v.throwError.call(this,"x and y must be numbers",n);t=Math.round(t),e=Math.round(e);var r=this.getPixelIndex(t,e),i=this.bitmap.data.readUInt32BE(r);return(0,v.isNodePattern)(n)&&n.call(this,null,i),i}},{key:"setPixelColor",value:function(t,e,n,r){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof n)return v.throwError.call(this,"hex, x and y must be numbers",r);e=Math.round(e),n=Math.round(n);var i=this.getPixelIndex(e,n);return this.bitmap.data.writeUInt32BE(t,i),(0,v.isNodePattern)(r)&&r.call(this,null,this),this}},{key:"hasAlpha",value:function(){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:H;Object.entries(t).forEach((function(t){var n=(0,u.default)(t,2),r=n[0],i=n[1];e[r]=i}))}function W(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H;Object.entries(t).forEach((function(t){var n=(0,u.default)(t,2),r=n[0],i=n[1];e.prototype[r]=i}))}function Y(t,e,n){var r="before-"+e,i=e.replace(/e$/,"")+"ed";H.prototype[t]=function(){for(var e,o=arguments.length,a=new Array(o),s=0;s255)return v.throwError.call(this,"r must be between 0 and 255",i);if((e<0||e>255)&&v.throwError.call(this,"g must be between 0 and 255",i),n<0||n>255)return v.throwError.call(this,"b must be between 0 and 255",i);if(r<0||r>255)return v.throwError.call(this,"a must be between 0 and 255",i);t=Math.round(t),n=Math.round(n),e=Math.round(e),r=Math.round(r);var o=t*Math.pow(256,3)+e*Math.pow(256,2)+n*Math.pow(256,1)+r*Math.pow(256,0);return(0,v.isNodePattern)(i)&&i.call(this,null,o),o},H.intToRGBA=function(t,e){if("number"!=typeof t)return v.throwError.call(this,"i must be a number",e);var n={};return n.r=Math.floor(t/Math.pow(256,3)),n.g=Math.floor((t-n.r*Math.pow(256,3))/Math.pow(256,2)),n.b=Math.floor((t-n.r*Math.pow(256,3)-n.g*Math.pow(256,2))/Math.pow(256,1)),n.a=Math.floor((t-n.r*Math.pow(256,3)-n.g*Math.pow(256,2)-n.b*Math.pow(256,1))/Math.pow(256,0)),(0,v.isNodePattern)(e)&&e.call(this,null,n),n},H.cssColorToHex=function(t){return"number"==typeof(t=t||0)?Number(t):parseInt((0,E.default)(t).toHex8(),16)},H.limit255=function(t){return t=Math.max(t,0),Math.min(t,255)},H.diff=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1;if(!(t instanceof H&&e instanceof H))return v.throwError.call(this,"img1 and img2 must be an Jimp images");var r=t.bitmap,i=e.bitmap;if(r.width===i.width&&r.height===i.height||(r.width*r.height>i.width*i.height?t=t.cloneQuiet().resize(i.width,i.height):e=e.cloneQuiet().resize(r.width,r.height)),"number"!=typeof n||n<0||n>1)return v.throwError.call(this,"threshold must be a number between 0 and 1");var o=new H(r.width,r.height,4294967295),a=(0,T.default)(r.data,i.data,o.bitmap.data,o.bitmap.width,o.bitmap.height,{threshold:n});return{percent:a/(o.bitmap.width*o.bitmap.height),image:o}},H.distance=function(t,e){var n=new S.default,r=n.getHash(t),i=n.getHash(e);return n.distance(r,i)},H.compareHashes=function(t,e){return(new S.default).distance(t,e)},H.colorDiff=function(t,e){var n=function(t){return Math.pow(t,2)},r=Math.max;return 0===t.a||t.a||(t.a=255),0===e.a||e.a||(e.a=255),(r(n(t.r-e.r),n(t.r-e.r-t.a+e.a))+r(n(t.g-e.g),n(t.g-e.g-t.a+e.a))+r(n(t.b-e.b),n(t.b-e.b-t.a+e.a)))/195075},Y("clone","clone",(function(t){var e=new H(this);return(0,v.isNodePattern)(t)&&t.call(e,null,e),e})),X("background",(function(t,e){return"number"!=typeof t?v.throwError.call(this,"hex must be a hexadecimal rgba value",e):(this._background=t,(0,v.isNodePattern)(e)&&e.call(this,null,this),this)})),X("scan",(function(t,e,n,r,i,o){if("number"!=typeof t||"number"!=typeof e)return v.throwError.call(this,"x and y must be numbers",o);if("number"!=typeof n||"number"!=typeof r)return v.throwError.call(this,"w and h must be numbers",o);if("function"!=typeof i)return v.throwError.call(this,"f must be a function",o);var a=(0,v.scan)(this,t,e,n,r,i);return(0,v.isNodePattern)(o)&&o.call(this,null,a),a})),"BROWSER"===i.env.ENVIRONMENT&&("undefined"!=typeof window&&"object"===("undefined"==typeof window?"undefined":(0,m.default)(window))&&(G=window),"undefined"!=typeof self&&"object"===("undefined"==typeof self?"undefined":(0,m.default)(self))&&(G=self),G.Jimp=H,G.Buffer=r);var Z=H;e.default=Z},3547:t=>{"use strict";function e(t,e){this.size=this.size||t,this.smallerSize=this.smallerSize||e,function(t){for(var e=1;eh?"1":"0";return f};var n=[];t.exports=e},7967:(t,e,n)=>{"use strict";var r=n(4155),i=n(1109).lW,o=n(4836),a=o(n(8416)),s=o(n(434));function u(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}r.browser||"BROWSER"===r.env.ENVIRONMENT||void 0!==r.versions.electron&&"renderer"===r.type&&"function"==typeof XMLHttpRequest?t.exports=function(t,e){var n=new XMLHttpRequest;n.open("GET",t.url,!0),n.responseType="arraybuffer",n.addEventListener("load",(function(){if(n.status<400)try{var r=i.from(this.response);e(null,n,r)}catch(n){return e(new Error("Response is not a buffer for url "+t.url+". Error: "+n.message))}else e(new Error("HTTP Status "+n.status+" for url "+t.url))})),n.addEventListener("error",(function(t){e(t)})),n.send()}:t.exports=function(t,e){var r=(0,s.default)({},t);n(193)(function(t){for(var e=1;e{"use strict";var r=n(1109).lW,i=n(5263),o=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.parseBitmap=function(t,e,n){var i=function(t,e){var n=(0,s.default)(t);return n?n.mime:e?h.getType(e):null}(t,e);if("string"!=typeof i)return n(new Error("Could not find MIME for Buffer <"+e+">"));this._originalMime=i.toLowerCase();try{var o=this.getMIME();if(!this.constructor.decoders[o])return l.throwError.call(this,"Unsupported MIME type: "+o,n);this.bitmap=this.constructor.decoders[o](t)}catch(t){return n.call(this,t,this)}try{this._exif=u.default.create(t).parse(),function(t){if(!(d(t)<2)){var e=function(t){var e=t.getWidth(),n=t.getHeight();switch(d(t)){case 1:default:return null;case 2:return function(t,n){return[e-t-1,n]};case 3:return function(t,r){return[e-t-1,n-r-1]};case 4:return function(t,e){return[t,n-e-1]};case 5:return function(t,e){return[e,t]};case 6:return function(t,e){return[e,n-t-1]};case 7:return function(t,r){return[e-r-1,n-t-1]};case 8:return function(t,n){return[e-n-1,t]}}}(t),n=d(t)>4;!function(t,e,n,i){for(var o=t.bitmap.data,s=t.bitmap.width,u=r.alloc(o.length),l=0;l{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getExtension=e.getType=e.addType=void 0;var n={};e.addType=function(t,e){n[t]=e},e.getType=function(t){var e,r=t.split("/").slice(-1);return(e=r[r.length-1].split(".").pop(),Object.entries(n).find((function(t){return t[1].includes(e)}))||[])[0]},e.getExtension=function(t){return(n[t.toLowerCase()]||[])[0]}},4388:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;e.default=function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{"use strict";var r=n(9742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.lW=u,e.h2=50;var a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return l(t,e,n)}function l(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|g(t,e),r=s(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if($(t,Uint8Array)){var e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if($(t,ArrayBuffer)||t&&$(t.buffer,ArrayBuffer))return d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&($(t,SharedArrayBuffer)||t&&$(t.buffer,SharedArrayBuffer)))return d(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,e,n);var i=function(t){if(u.isBuffer(t)){var e=0|p(t.length),n=s(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||z(t.length)?s(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return c(t),s(t<0?0:0|p(t))}function f(t){for(var e=t.length<0?0:0|p(t.length),n=s(e),r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(t).length;default:if(i)return r?-1:F(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return P(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function b(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:_(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):_(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,f=0;fi&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);for(var n="",r=0;rr.length?u.from(o).copy(r,i):Uint8Array.prototype.set.call(r,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i)}i+=o.length}return r},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;en&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if($(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),l=this.slice(r,i),c=t.slice(e,n),h=0;h>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return x(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function I(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function C(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,r,o){return e=+e,n>>>=0,o||C(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function N(t,e,n,r,o){return e=+e,n>>>=0,o||C(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],i=1,o=0;++o>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||R(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||R(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);R(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return N(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return N(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function j(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function $(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}var G=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)e[r+i]=t[n]+t[i];return e}()},3006:(t,e,n)=>{"use strict";var r=n(5263),i=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.default,n={hasAlpha:{},encoders:{},decoders:{},class:{},constants:{}};function r(t){Object.entries(t).forEach((function(t){var e=(0,s.default)(t,2),r=e[0],i=e[1];n[r]=c({},n[r],{},i)}))}function i(t){var e=t();Array.isArray(e.mime)?u.addType.apply(void 0,(0,o.default)(e.mime)):Object.entries(e.mime).forEach((function(t){return u.addType.apply(void 0,(0,o.default)(t))})),delete e.mime,r(e)}function a(t){var e=t(u.jimpEvChange)||{};e.class||e.constants?r(e):r({class:e})}return t.types&&(t.types.forEach(i),e.decoders=c({},e.decoders,{},n.decoders),e.encoders=c({},e.encoders,{},n.encoders),e.hasAlpha=c({},e.hasAlpha,{},n.hasAlpha)),t.plugins&&t.plugins.forEach(a),(0,u.addJimpMethods)(n.class,e),(0,u.addConstants)(n.constants,e),u.default};var o=i(n(861)),a=i(n(8416)),s=i(n(7424)),u=r(n(5859));function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function c(t){for(var e=1;e{"use strict";var r=n(8764).Buffer,i=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n(8416)),a=i(n(1494)),s=n(1702),u="image/gif";e.default=function(){return{mime:(0,o.default)({},u,["gif"]),constants:{MIME_GIF:u},decoders:(0,o.default)({},u,(function(t){var e=new a.default.GifReader(t),n=r.alloc(e.width*e.height*4);return e.decodeAndBlitFrameRGBA(0,n),{data:n,width:e.width,height:e.height}})),encoders:(0,o.default)({},u,(function(t){var e=new s.BitmapImage(t.bitmap);s.GifUtil.quantizeDekker(e,256);var n=new s.GifFrame(e);return(new s.GifCodec).encodeGif([n],{}).then((function(t){return t.buffer}))}))}}},3853:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(8416)),o=r(n(7870)),a=n(1567),s="image/jpeg";e.default=function(){return{mime:(0,i.default)({},s,["jpeg","jpg","jpe"]),constants:{MIME_JPEG:s},decoders:(0,i.default)({},s,o.default.decode),encoders:(0,i.default)({},s,(function(t){return o.default.encode(t.bitmap,t._quality).data})),class:{_quality:100,quality:function(t,e){return"number"!=typeof t?a.throwError.call(this,"n must be a number",e):t<0||t>100?a.throwError.call(this,"n must be a number 0 - 100",e):(this._quality=Math.round(t),(0,a.isNodePattern)(e)&&e.call(this,null,this),this)}}}}},2260:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(8698)),o=n(1567);e.default=function(){return{blit:function(t,e,n,r,a,s,u,l){if(!(t instanceof this.constructor))return o.throwError.call(this,"The source must be a Jimp image",l);if("number"!=typeof e||"number"!=typeof n)return o.throwError.call(this,"x and y must be numbers",l);if("function"==typeof r)l=r,r=0,a=0,s=t.bitmap.width,u=t.bitmap.height;else{if((0,i.default)(r)!==(0,i.default)(a)||(0,i.default)(a)!==(0,i.default)(s)||(0,i.default)(s)!==(0,i.default)(u))return o.throwError.call(this,"srcx, srcy, srcw, srch must be numbers",l);r=r||0,a=a||0,s=s||t.bitmap.width,u=u||t.bitmap.height}e=Math.round(e),n=Math.round(n),r=Math.round(r),a=Math.round(a),s=Math.round(s),u=Math.round(u);var c=this.bitmap.width,h=this.bitmap.height,f=this;return t.scanQuiet(r,a,s,u,(function(t,i,o){var s=e+t-r,u=n+i-a;if(s>=0&&u>=0&&c-s>0&&h-u>0){var l=f.getPixelIndex(s,u),d={r:this.bitmap.data[o],g:this.bitmap.data[o+1],b:this.bitmap.data[o+2],a:this.bitmap.data[o+3]},p={r:f.bitmap.data[l],g:f.bitmap.data[l+1],b:f.bitmap.data[l+2],a:f.bitmap.data[l+3]};f.bitmap.data[l]=(d.a*(d.r-p.r)-p.r+255>>8)+p.r,f.bitmap.data[l+1]=(d.a*(d.g-p.g)-p.g+255>>8)+p.g,f.bitmap.data[l+2]=(d.a*(d.b-p.b)-p.b+255>>8)+p.b,f.bitmap.data[l+3]=this.constructor.limit255(p.a+d.a)}})),(0,o.isNodePattern)(l)&&l.call(this,null,this),this}}}},2430:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.shgTable=e.mulTable=void 0,e.mulTable=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],e.shgTable=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18]},7139:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567),i=n(2430);e.default=function(){return{blur:function(t,e){if("number"!=typeof t)return r.throwError.call(this,"r must be a number",e);if(t<1)return r.throwError.call(this,"r must be greater than 0",e);for(var n,o,a,s,u,l,c,h,f,d,p,g,m,b,y=this.bitmap.width-1,_=this.bitmap.height-1,v=t+1,w=i.mulTable[t],x=i.shgTable[t],T=[],E=[],S=[],A=[],O=[],I=[],P=2;P-- >0;){for(g=0,m=0,l=0;ly?y:c)<<2),n+=this.bitmap.data[h++],o+=this.bitmap.data[h++],a+=this.bitmap.data[h++],s+=this.bitmap.data[h];for(u=0;u0?h<<2:0),f=m+O[u],d=m+I[u],n+=this.bitmap.data[f++]-this.bitmap.data[d++],o+=this.bitmap.data[f++]-this.bitmap.data[d++],a+=this.bitmap.data[f++]-this.bitmap.data[d++],s+=this.bitmap.data[f]-this.bitmap.data[d],g++;m+=this.bitmap.width<<2}for(u=0;u_?0:this.bitmap.width],o+=E[p],a+=S[p],s+=A[p];for(g=u<<2,l=0;l>>x,this.bitmap.data[g+3]=b,b>255&&(this.bitmap.data[g+3]=255),b>0?(b=255/b,this.bitmap.data[g]=(n*w>>>x)*b,this.bitmap.data[g+1]=(o*w>>>x)*b,this.bitmap.data[g+2]=(a*w>>>x)*b):(this.bitmap.data[g+2]=0,this.bitmap.data[g+1]=0,this.bitmap.data[g]=0),0===u&&(O[l]=((h=l+v)<_?h:_)*this.bitmap.width,I[l]=(h=l-t)>0?h*this.bitmap.width:0),f=u+O[l],d=u+I[l],n+=T[f]-T[d],o+=E[f]-E[d],a+=S[f]-S[d],s+=A[f]-A[d],g+=this.bitmap.width<<2}}return(0,r.isNodePattern)(e)&&e.call(this,null,this),this}}}},4650:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{circle:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(e=t,t={});var n=t.radius||(this.bitmap.width>this.bitmap.height?this.bitmap.height:this.bitmap.width)/2,i={x:"number"==typeof t.x?t.x:this.bitmap.width/2,y:"number"==typeof t.y?t.y:this.bitmap.height/2};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){var o=Math.sqrt(Math.pow(t-i.x,2)+Math.pow(e-i.y,2));n-o<=0?this.bitmap.data[r+3]=0:n-o<1&&(this.bitmap.data[r+3]=255*(n-o))})),(0,r.isNodePattern)(e)&&e.call(this,null,this),this}}}},809:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n(861)),a=i(n(8207)),s=n(1567);function u(t,e,n,r){for(var i=[0,0,0],o=(e.length-1)/2,a=0;a2&&void 0!==arguments[2]?arguments[2]:50;return{r:(e.r-t.r)*(n/100)+t.r,g:(e.g-t.g)*(n/100)+t.g,b:(e.b-t.b)*(n/100)+t.b}}function f(t,e){var n=this;return t&&Array.isArray(t)?(t=t.map((function(t){return"xor"!==t.apply&&"mix"!==t.apply||(t.params[0]=(0,a.default)(t.params[0]).toRgb()),t})),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,i,u){var l={r:n.bitmap.data[u],g:n.bitmap.data[u+1],b:n.bitmap.data[u+2]},c=function(t,e){return n.constructor.limit255(l[t]+e)};t.forEach((function(t){if("mix"===t.apply)l=h(l,t.params[0],t.params[1]);else if("tint"===t.apply)l=h(l,{r:255,g:255,b:255},t.params[0]);else if("shade"===t.apply)l=h(l,{r:0,g:0,b:0},t.params[0]);else if("xor"===t.apply)l={r:l.r^t.params[0].r,g:l.g^t.params[0].g,b:l.b^t.params[0].b};else if("red"===t.apply)l.r=c("r",t.params[0]);else if("green"===t.apply)l.g=c("g",t.params[0]);else if("blue"===t.apply)l.b=c("b",t.params[0]);else{var r;if("hue"===t.apply&&(t.apply="spin"),!(l=(0,a.default)(l))[t.apply])return s.throwError.call(n,"action "+t.apply+" not supported",e);l=(r=l)[t.apply].apply(r,(0,o.default)(t.params)).toRgb()}})),n.bitmap.data[u]=l.r,n.bitmap.data[u+1]=l.g,n.bitmap.data[u+2]=l.b})),(0,s.isNodePattern)(e)&&e.call(this,null,this),this):s.throwError.call(this,"actions must be an array",e)}e.default=function(){return{brightness:function(t,e){return"number"!=typeof t?s.throwError.call(this,"val must be numbers",e):t<-1||t>1?s.throwError.call(this,"val must be a number between -1 and +1",e):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,n,r){t<0?(this.bitmap.data[r]=this.bitmap.data[r]*(1+t),this.bitmap.data[r+1]=this.bitmap.data[r+1]*(1+t),this.bitmap.data[r+2]=this.bitmap.data[r+2]*(1+t)):(this.bitmap.data[r]=this.bitmap.data[r]+(255-this.bitmap.data[r])*t,this.bitmap.data[r+1]=this.bitmap.data[r+1]+(255-this.bitmap.data[r+1])*t,this.bitmap.data[r+2]=this.bitmap.data[r+2]+(255-this.bitmap.data[r+2])*t)})),(0,s.isNodePattern)(e)&&e.call(this,null,this),this)},contrast:function(t,e){if("number"!=typeof t)return s.throwError.call(this,"val must be numbers",e);if(t<-1||t>1)return s.throwError.call(this,"val must be a number between -1 and +1",e);var n=(t+1)/(1-t);function r(t){return(t=Math.floor(n*(t-127)+127))<0?0:t>255?255:t}return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,n){this.bitmap.data[n]=r(this.bitmap.data[n]),this.bitmap.data[n+1]=r(this.bitmap.data[n+1]),this.bitmap.data[n+2]=r(this.bitmap.data[n+2])})),(0,s.isNodePattern)(e)&&e.call(this,null,this),this},posterize:function(t,e){return"number"!=typeof t?s.throwError.call(this,"n must be numbers",e):(t<2&&(t=2),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,n,r){this.bitmap.data[r]=Math.floor(this.bitmap.data[r]/255*(t-1))/(t-1)*255,this.bitmap.data[r+1]=Math.floor(this.bitmap.data[r+1]/255*(t-1))/(t-1)*255,this.bitmap.data[r+2]=Math.floor(this.bitmap.data[r+2]/255*(t-1))/(t-1)*255})),(0,s.isNodePattern)(e)&&e.call(this,null,this),this)},greyscale:c,grayscale:c,opacity:function(t,e){return"number"!=typeof t?s.throwError.call(this,"f must be a number",e):t<0||t>1?s.throwError.call(this,"f must be a number from 0 to 1",e):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,n,r){var i=this.bitmap.data[r+3]*t;this.bitmap.data[r+3]=i})),(0,s.isNodePattern)(e)&&e.call(this,null,this),this)},sepia:function(t){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,n){var r=this.bitmap.data[n],i=this.bitmap.data[n+1],o=this.bitmap.data[n+2];o=.272*(r=.393*r+.769*i+.189*o)+.534*(i=.349*r+.686*i+.168*o)+.131*o,this.bitmap.data[n]=r<255?r:255,this.bitmap.data[n+1]=i<255?i:255,this.bitmap.data[n+2]=o<255?o:255})),(0,s.isNodePattern)(t)&&t.call(this,null,this),this},fade:function(t,e){return"number"!=typeof t?s.throwError.call(this,"f must be a number",e):t<0||t>1?s.throwError.call(this,"f must be a number from 0 to 1",e):(this.opacity(1-t),(0,s.isNodePattern)(e)&&e.call(this,null,this),this)},convolution:function(t,e,n){"function"==typeof e&&void 0===n&&(n=e,e=null),e||(e=this.constructor.EDGE_EXTEND);var i,o,a,u,l,c,h,f,d,p,g=r.from(this.bitmap.data),m=t.length,b=t[0].length,y=Math.floor(m/2),_=Math.floor(b/2),v=-y,w=-_;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(n,r,s){u=0,a=0,o=0;for(var m=v;m<=y;m++)for(var b=w;b<=_;b++)f=n+b,d=r+m,i=t[m+y][b+_],-1===(p=this.getPixelIndex(f,d,e))?(h=0,c=0,l=0):(l=this.bitmap.data[p+0],c=this.bitmap.data[p+1],h=this.bitmap.data[p+2]),o+=i*l,a+=i*c,u+=i*h;o<0&&(o=0),a<0&&(a=0),u<0&&(u=0),o>255&&(o=255),a>255&&(a=255),u>255&&(u=255),g[s+0]=o,g[s+1]=a,g[s+2]=u})),this.bitmap.data=g,(0,s.isNodePattern)(n)&&n.call(this,null,this),this},opaque:function(t){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,n){this.bitmap.data[n+3]=255})),(0,s.isNodePattern)(t)&&t.call(this,null,this),this},pixelate:function(t,e,n,r,i,o){if("function"==typeof e)o=e,i=null,r=null,n=null,e=null;else{if("number"!=typeof t)return s.throwError.call(this,"size must be a number",o);if(l(e)&&"number"!=typeof e)return s.throwError.call(this,"x must be a number",o);if(l(n)&&"number"!=typeof n)return s.throwError.call(this,"y must be a number",o);if(l(r)&&"number"!=typeof r)return s.throwError.call(this,"w must be a number",o);if(l(i)&&"number"!=typeof i)return s.throwError.call(this,"h must be a number",o)}var a=[[1/16,2/16,1/16],[2/16,.25,2/16],[1/16,2/16,1/16]];e=e||0,n=n||0,r=l(r)?r:this.bitmap.width-e,i=l(i)?i:this.bitmap.height-n;var c=this.cloneQuiet();return this.scanQuiet(e,n,r,i,(function(e,n,r){e=t*Math.floor(e/t),n=t*Math.floor(n/t);var i=u(c,a,e,n);this.bitmap.data[r]=i[0],this.bitmap.data[r+1]=i[1],this.bitmap.data[r+2]=i[2]})),(0,s.isNodePattern)(o)&&o.call(this,null,this),this},convolute:function(t,e,n,r,i,o){if(!Array.isArray(t))return s.throwError.call(this,"the kernel must be an array",o);if("function"==typeof e)o=e,e=null,n=null,r=null,i=null;else{if(l(e)&&"number"!=typeof e)return s.throwError.call(this,"x must be a number",o);if(l(n)&&"number"!=typeof n)return s.throwError.call(this,"y must be a number",o);if(l(r)&&"number"!=typeof r)return s.throwError.call(this,"w must be a number",o);if(l(i)&&"number"!=typeof i)return s.throwError.call(this,"h must be a number",o)}var a=(t.length-1)/2;e=l(e)?e:a,n=l(n)?n:a,r=l(r)?r:this.bitmap.width-e,i=l(i)?i:this.bitmap.height-n;var c=this.cloneQuiet();return this.scanQuiet(e,n,r,i,(function(e,n,r){var i=u(c,t,e,n);this.bitmap.data[r]=this.constructor.limit255(i[0]),this.bitmap.data[r+1]=this.constructor.limit255(i[1]),this.bitmap.data[r+2]=this.constructor.limit255(i[2])})),(0,s.isNodePattern)(o)&&o.call(this,null,this),this},color:f,colour:f}}},7890:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{contain:function(t,e,n,i,o){if("number"!=typeof t||"number"!=typeof e)return r.throwError.call(this,"w and h must be numbers",o);"string"==typeof n&&("function"==typeof i&&void 0===o&&(o=i),i=n,n=null),"function"==typeof n&&(void 0===o&&(o=n),i=null,n=null),"function"==typeof i&&void 0===o&&(o=i,i=null);var a=7&(n=n||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),s=n>>3;if((0===a||a&a-1)&&(0===s||s&s-1))return r.throwError.call(this,"only use one flag per alignment direction",o);var u=a>>1,l=s>>1,c=t/e>this.bitmap.width/this.bitmap.height?e/this.bitmap.height:t/this.bitmap.width,h=this.cloneQuiet().scale(c,i);return this.resize(t,e,i),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,n){this.bitmap.data.writeUInt32BE(this._background,n)})),this.blit(h,(this.bitmap.width-h.bitmap.width)/2*u,(this.bitmap.height-h.bitmap.height)/2*l),(0,r.isNodePattern)(o)&&o.call(this,null,this),this}}}},4587:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{cover:function(t,e,n,i,o){if("number"!=typeof t||"number"!=typeof e)return r.throwError.call(this,"w and h must be numbers",o);n&&"function"==typeof n&&void 0===o?(o=n,n=null,i=null):"function"==typeof i&&void 0===o&&(o=i,i=null);var a=7&(n=n||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),s=n>>3;if((0===a||a&a-1)&&(0===s||s&s-1))return r.throwError.call(this,"only use one flag per alignment direction",o);var u=a>>1,l=s>>1,c=t/e>this.bitmap.width/this.bitmap.height?t/this.bitmap.width:e/this.bitmap.height;return this.scale(c,i),this.crop((this.bitmap.width-t)/2*u,(this.bitmap.height-e)/2*l,t,e),(0,r.isNodePattern)(o)&&o.call(this,null,this),this}}}},6544:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return t("crop",(function(t,e,n,i,o){if("number"!=typeof t||"number"!=typeof e)return a.throwError.call(this,"x and y must be numbers",o);if("number"!=typeof n||"number"!=typeof i)return a.throwError.call(this,"w and h must be numbers",o);if(t=Math.round(t),e=Math.round(e),n=Math.round(n),i=Math.round(i),0===t&&n===this.bitmap.width){var s=n*e+t<<2,u=s+i*n<<2;this.bitmap.data=this.bitmap.data.slice(s,u)}else{var l=r.allocUnsafe(n*i*4),c=0;this.scanQuiet(t,e,n,i,(function(t,e,n){var r=this.bitmap.data.readUInt32BE(n,!0);l.writeUInt32BE(r,c,!0),c+=4})),this.bitmap.data=l}return this.bitmap.width=n,this.bitmap.height=i,(0,a.isNodePattern)(o)&&o.call(this,null,this),this})),{class:{autocrop:function(){for(var t,e=this.bitmap.width,n=this.bitmap.height,r=1,i=0,s=2e-4,u=!0,l=!1,c={north:!1,south:!1,east:!1,west:!1},h=arguments.length,f=new Array(h),d=0;ds)break t}_++}if(b=this.getPixelColor(e,0),!c.east)t:for(var O=0;Os)break t}v++}if(b=this.getPixelColor(0,n),!c.south)t:for(var M=n-1;M>=_+r;M--){for(var D=e-v-1;D>=0;D--){var R=this.getPixelColor(D,M),C=this.constructor.intToRGBA(R);if(this.constructor.colorDiff(y,C)>s)break t}w++}if(b=this.getPixelColor(e,n),!c.west)t:for(var L=e-1;L>=0+v+r;L--){for(var N=n-1;N>=0+_;N--){var B=this.getPixelColor(L,N),F=this.constructor.intToRGBA(B);if(this.constructor.colorDiff(y,F)>s)break t}x++}if(x-=i,v-=i,_-=i,w-=i,l){var j=Math.min(v,x),U=Math.min(_,w);x=j,v=j,_=U,w=U}var $=e-((x=x>=0?x:0)+(v=v>=0?v:0)),z=n-((w=w>=0?w:0)+(_=_>=0?_:0));return(u?0!==v&&0!==_&&0!==x&&0!==w:0!==v||0!==_||0!==x||0!==w)&&this.crop(v,_,$,z),(0,a.isNodePattern)(t)&&t.call(this,null,this),this}}}};var o=i(n(8698)),a=n(1567)},7679:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(8698)),o=n(1567);e.default=function(){return{displace:function(t,e,n){if("object"!==(0,i.default)(t)||t.constructor!==this.constructor)return o.throwError.call(this,"The source must be a Jimp image",n);if("number"!=typeof e)return o.throwError.call(this,"factor must be a number",n);var r=this.cloneQuiet();return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(n,i,o){var a=t.bitmap.data[o]/256*e;a=Math.round(a);var s=this.getPixelIndex(n+a,i);this.bitmap.data[s]=r.bitmap.data[o],this.bitmap.data[s+1]=r.bitmap.data[o+1],this.bitmap.data[s+2]=r.bitmap.data[o+2]})),(0,o.isNodePattern)(n)&&n.call(this,null,this),this}}}},5380:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);function i(t){var e=[1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6];return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,n,r){var i=e[((3&n)<<2)+t%4];this.bitmap.data[r]=Math.min(this.bitmap.data[r]+i,255),this.bitmap.data[r+1]=Math.min(this.bitmap.data[r+1]+i,255),this.bitmap.data[r+2]=Math.min(this.bitmap.data[r+2]+i,255)})),(0,r.isNodePattern)(t)&&t.call(this,null,this),this}e.default=function(){return{dither565:i,dither16:i}}},9462:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{fisheye:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{r:2.5},n=arguments.length>1?arguments[1]:void 0;"function"==typeof e&&(n=e,e={r:2.5});var i=this.cloneQuiet(),o=i.bitmap,a=o.width,s=o.height;return i.scanQuiet(0,0,a,s,(function(n,r){var o=n/a,u=r/s,l=Math.sqrt(Math.pow(o-.5,2)+Math.pow(u-.5,2)),c=2*Math.pow(l,e.r),h=(o-.5)/l,f=(u-.5)/l,d=Math.round((c*h+.5)*a),p=Math.round((c*f+.5)*s),g=i.getPixelColor(d,p);t.setPixelColor(g,n,r)})),this.setPixelColor(i.getPixelColor(a/2,s/2),a/2,s/2),(0,r.isNodePattern)(n)&&n.call(this,null,this),this}}}},5980:(t,e,n)=>{"use strict";var r=n(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(1567);function o(t,e,n){if("boolean"!=typeof t||"boolean"!=typeof e)return i.throwError.call(this,"horizontal and vertical must be Booleans",n);var o=r.alloc(this.bitmap.data.length);return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(n,r,i){var a=t?this.bitmap.width-1-n:n,s=e?this.bitmap.height-1-r:r,u=this.bitmap.width*s+a<<2,l=this.bitmap.data.readUInt32BE(i);o.writeUInt32BE(l,u)})),this.bitmap.data=r.from(o),(0,i.isNodePattern)(n)&&n.call(this,null,this),this}e.default=function(){return{flip:o,mirror:o}}},5092:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{gaussian:function(t,e){if("number"!=typeof t)return r.throwError.call(this,"r must be a number",e);if(t<1)return r.throwError.call(this,"r must be greater than 0",e);for(var n=Math.ceil(2.57*t),i=2*n+1,o=t*t*2,a=o*Math.PI,s=[],u=0;u{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{invert:function(t){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,n){this.bitmap.data[n]=255-this.bitmap.data[n],this.bitmap.data[n+1]=255-this.bitmap.data[n+1],this.bitmap.data[n+2]=255-this.bitmap.data[n+2]})),(0,r.isNodePattern)(t)&&t.call(this,null,this),this}}}},6597:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{mask:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;if(!(t instanceof this.constructor))return r.throwError.call(this,"The source must be a Jimp image",i);if("number"!=typeof e||"number"!=typeof n)return r.throwError.call(this,"x and y must be numbers",i);e=Math.round(e),n=Math.round(n);var o=this.bitmap.width,a=this.bitmap.height,s=this;return t.scanQuiet(0,0,t.bitmap.width,t.bitmap.height,(function(t,r,i){var u=e+t,l=n+r;if(u>=0&&l>=0&&u{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);function i(){var t={r:new Array(256).fill(0),g:new Array(256).fill(0),b:new Array(256).fill(0)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,n,r){t.r[this.bitmap.data[r+0]]++,t.g[this.bitmap.data[r+1]]++,t.b[this.bitmap.data[r+2]]++})),t}var o=function(t,e,n){return 255*(t-e)/(n-e)},a=function(t){return[t.findIndex((function(t){return t>0})),255-t.slice().reverse().findIndex((function(t){return t>0}))]};e.default=function(){return{normalize:function(t){var e=i.call(this),n={r:a(e.r),g:a(e.g),b:a(e.b)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){var i=this.bitmap.data[r+0],a=this.bitmap.data[r+1],s=this.bitmap.data[r+2];this.bitmap.data[r+0]=o(i,n.r[0],n.r[1]),this.bitmap.data[r+1]=o(a,n.g[0],n.g[1]),this.bitmap.data[r+2]=o(s,n.b[0],n.b[1])})),(0,r.isNodePattern)(t)&&t.call(this,null,this),this}}}},8869:(t,e,n)=>{"use strict";var r=n(4155),i=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n(8698)),a=i(n(861)),s=i(n(6470)),u=i(n(9902)),l=n(1567),c=n(6523);function h(t,e,n,r,i){if(i.width>0&&i.height>0){var o=e.pages[i.page];t.blit(o,n+i.xoffset,r+i.yoffset,i.x,i.y,i.width,i.height)}return t}function f(t,e,n,r,i){for(var o=0;os&&(s=u),o.push(e)):(i.push(o),o=[e])})),i.push(o),{lines:i,longestLine:s}}(t,r,i),b=m.lines,y=m.longestLine;return b.forEach((function(r){var o=r.join(" "),a=function(t,e,n,r,i){return i===t.HORIZONTAL_ALIGN_LEFT?0:i===t.HORIZONTAL_ALIGN_CENTER?(r-(0,c.measureText)(e,n))/2:r-(0,c.measureText)(e,n)}(p.constructor,t,o,i,h);f.call(p,t,e+a,n,o,g),n+=t.common.lineHeight})),(0,l.isNodePattern)(u)&&u.call(this,null,this,{x:e+y,y:n}),this}}}}},6523:(t,e)=>{"use strict";function n(t,e){for(var n=0,r=0;rr&&s>0?(a+=t.common.lineHeight,o=i[s]+" "):o=u}return a}},90:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n(1567),a=i(n(9025)),s=i(n(8226));e.default=function(){return{constants:{RESIZE_NEAREST_NEIGHBOR:"nearestNeighbor",RESIZE_BILINEAR:"bilinearInterpolation",RESIZE_BICUBIC:"bicubicInterpolation",RESIZE_HERMITE:"hermiteInterpolation",RESIZE_BEZIER:"bezierInterpolation"},class:{resize:function(t,e,n,i){if("number"!=typeof t||"number"!=typeof e)return o.throwError.call(this,"w and h must be numbers",i);if("function"==typeof n&&void 0===i&&(i=n,n=null),t===this.constructor.AUTO&&e===this.constructor.AUTO)return o.throwError.call(this,"w and h cannot both be set to auto",i);if(t===this.constructor.AUTO&&(t=this.bitmap.width*(e/this.bitmap.height)),e===this.constructor.AUTO&&(e=this.bitmap.height*(t/this.bitmap.width)),t<0||e<0)return o.throwError.call(this,"w and h must be positive numbers",i);if(t=Math.round(t),e=Math.round(e),"function"==typeof s.default[n]){var u={data:r.alloc(t*e*4),width:t,height:e};s.default[n](this.bitmap,u),this.bitmap=u}else{var l=this;new a.default(this.bitmap.width,this.bitmap.height,t,e,!0,!0,(function(n){l.bitmap.data=r.from(n),l.bitmap.width=t,l.bitmap.height=e})).resize(this.bitmap.data)}return(0,o.isNodePattern)(i)&&i.call(this,null,this),this}}}}},9025:t=>{"use strict";function e(t,e,n,r,i,o,a){this.widthOriginal=Math.abs(Math.floor(t)||0),this.heightOriginal=Math.abs(Math.floor(e)||0),this.targetWidth=Math.abs(Math.floor(n)||0),this.targetHeight=Math.abs(Math.floor(r)||0),this.colorChannels=i?4:3,this.interpolationPass=Boolean(o),this.resizeCallback="function"==typeof a?a:function(){},this.targetWidthMultipliedByChannels=this.targetWidth*this.colorChannels,this.originalWidthMultipliedByChannels=this.widthOriginal*this.colorChannels,this.originalHeightMultipliedByChannels=this.heightOriginal*this.colorChannels,this.widthPassResultSize=this.targetWidthMultipliedByChannels*this.heightOriginal,this.finalResultSize=this.targetWidthMultipliedByChannels*this.targetHeight,this.initialize()}e.prototype.initialize=function(){if(!(this.widthOriginal>0&&this.heightOriginal>0&&this.targetWidth>0&&this.targetHeight>0))throw new Error("Invalid settings specified for the resizer.");this.configurePasses()},e.prototype.configurePasses=function(){this.widthOriginal===this.targetWidth?this.resizeWidth=this.bypassResizer:(this.ratioWeightWidthPass=this.widthOriginal/this.targetWidth,this.ratioWeightWidthPass<1&&this.interpolationPass?(this.initializeFirstPassBuffers(!0),this.resizeWidth=4===this.colorChannels?this.resizeWidthInterpolatedRGBA:this.resizeWidthInterpolatedRGB):(this.initializeFirstPassBuffers(!1),this.resizeWidth=4===this.colorChannels?this.resizeWidthRGBA:this.resizeWidthRGB)),this.heightOriginal===this.targetHeight?this.resizeHeight=this.bypassResizer:(this.ratioWeightHeightPass=this.heightOriginal/this.targetHeight,this.ratioWeightHeightPass<1&&this.interpolationPass?(this.initializeSecondPassBuffers(!0),this.resizeHeight=this.resizeHeightInterpolated):(this.initializeSecondPassBuffers(!1),this.resizeHeight=4===this.colorChannels?this.resizeHeightRGBA:this.resizeHeightRGB))},e.prototype._resizeWidthInterpolatedRGBChannels=function(t,e){var n,r,i=e?4:3,o=this.ratioWeightWidthPass,a=this.widthBuffer,s=0,u=0,l=0,c=0,h=0;for(n=0;s<1/3;n+=i,s+=o)for(u=n,l=0;u=h)){d+=c;break}d=f+=n,c-=h}while(c>0&&f=u)){c+=s;break}c=l=d,s-=u}while(s>0&&l3&&(this.outputWidthWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.heightOriginal)))},e.prototype.initializeSecondPassBuffers=function(t){this.heightBuffer=this.generateUint8Buffer(this.finalResultSize),t||(this.outputHeightWorkBench=this.generateFloatBuffer(this.targetWidthMultipliedByChannels),this.colorChannels>3&&(this.outputHeightWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.targetWidth)))},e.prototype.generateFloatBuffer=function(t){try{return new Float32Array(t)}catch(t){return[]}},e.prototype.generateFloat64Buffer=function(t){try{return new Float64Array(t)}catch(t){return[]}},e.prototype.generateUint8Buffer=function(t){try{return new Uint8Array(t)}catch(t){return[]}},t.exports=e},8226:(t,e,n)=>{"use strict";var r=n(8764).Buffer;t.exports={nearestNeighbor:function(t,e){for(var n=t.width,r=t.height,i=e.width,o=e.height,a=t.data,s=e.data,u=0;u0?o[E-4]:2*o[E]-o[E+4],A=o[E],O=o[E+4],I=_0?g[F-4*f]:2*g[F]-g[F+4*f],U=g[F],$=g[F+4*f],z=R1)for(var V=0;V{"use strict";var r=n(8764).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(1567);function o(t,e){var n=(t%=360)*Math.PI/180,i=Math.cos(n),o=Math.sin(n),a=this.bitmap.width,s=this.bitmap.height;if(!0===e||"string"==typeof e){(a=Math.ceil(Math.abs(this.bitmap.width*i)+Math.abs(this.bitmap.height*o))+1)%2!=0&&a++,(s=Math.ceil(Math.abs(this.bitmap.width*o)+Math.abs(this.bitmap.height*i))+1)%2!=0&&s++;var u=this.cloneQuiet();this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,n){this.bitmap.data.writeUInt32BE(this._background,n)}));var l=Math.max(a,s,this.bitmap.width,this.bitmap.height);this.resize(l,l,e),this.blit(u,this.bitmap.width/2-u.bitmap.width/2,this.bitmap.height/2-u.bitmap.height/2)}var c=this.bitmap.width,h=this.bitmap.height,f=r.alloc(this.bitmap.data.length);function d(t,e){return function(n,r){return{x:n+t,y:r+e}}}for(var p=d(-c/2,-h/2),g=d(c/2+.5,h/2+.5),m=1;m<=h;m++)for(var b=1;b<=c;b++){var y=p(b,m),_=g(i*y.x-o*y.y,i*y.y+o*y.x),v=c*(m-1)+b-1<<2;if(_.x>=0&&_.x=0&&_.y{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{scale:function(t,e,n){if("number"!=typeof t)return r.throwError.call(this,"f must be a number",n);if(t<0)return r.throwError.call(this,"f must be a positive number",n);"function"==typeof e&&void 0===n&&(n=e,e=null);var i=this.bitmap.width*t,o=this.bitmap.height*t;return this.resize(i,o,e),(0,r.isNodePattern)(n)&&n.call(this,null,this),this},scaleToFit:function(t,e,n,i){if("number"!=typeof t||"number"!=typeof e)return r.throwError.call(this,"w and h must be numbers",i);"function"==typeof n&&void 0===i&&(i=n,n=null);var o=t/e>this.bitmap.width/this.bitmap.height?e/this.bitmap.height:t/this.bitmap.width;return this.scale(o,n),(0,r.isNodePattern)(i)&&i.call(this,null,this),this}}}},2510:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{shadow:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof e&&(n=e,e={});var i=e,o=i.opacity,a=void 0===o?.7:o,s=i.size,u=void 0===s?1.1:s,l=i.x,c=void 0===l?-25:l,h=i.y,f=void 0===h?25:h,d=i.blur,p=void 0===d?5:d,g=this.clone(),m=this.clone();return m.scan(0,0,m.bitmap.width,m.bitmap.height,(function(e,n,r){m.bitmap.data[r]=0,m.bitmap.data[r+1]=0,m.bitmap.data[r+2]=0,m.bitmap.data[r+3]=m.constructor.limit255(m.bitmap.data[r+3]*a),t.bitmap.data[r]=0,t.bitmap.data[r+1]=0,t.bitmap.data[r+2]=0,t.bitmap.data[r+3]=0})),m.resize(m.bitmap.width*u,m.bitmap.height*u).blur(p),this.composite(m,c,f),this.composite(g,0,0),(0,r.isNodePattern)(n)&&n.call(this,null,this),this}}}},4538:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(1567);e.default=function(){return{threshold:function(t,e){var n=this,i=t.max,o=t.replace,a=void 0===o?255:o,s=t.autoGreyscale,u=void 0===s||s;return"number"!=typeof i?r.throwError.call(this,"max must be a number",e):"number"!=typeof a?r.throwError.call(this,"replace must be a number",e):"boolean"!=typeof u?r.throwError.call(this,"autoGreyscale must be a boolean",e):(i=this.constructor.limit255(i),a=this.constructor.limit255(a),u&&this.greyscale(),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){var o=n.bitmap.data[r]{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(861)),o=n(7011),a=r(n(2260)),s=r(n(7139)),u=r(n(4650)),l=r(n(809)),c=r(n(7890)),h=r(n(4587)),f=r(n(6544)),d=r(n(7679)),p=r(n(5380)),g=r(n(9462)),m=r(n(5980)),b=r(n(5092)),y=r(n(9085)),_=r(n(6597)),v=r(n(2042)),w=r(n(8869)),x=r(n(90)),T=r(n(9814)),E=r(n(4246)),S=r(n(2510)),A=r(n(4538)),O=[a.default,s.default,u.default,l.default,c.default,h.default,f.default,d.default,p.default,g.default,m.default,b.default,y.default,_.default,v.default,w.default,x.default,T.default,E.default,S.default,A.default];e.default=function(t){var e=O.map((function(e){var n=e(t)||{};return n.class||n.constants||(n={class:n}),n}));return o.mergeDeep.apply(void 0,(0,i.default)(e))}},7447:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(8416)),o=n(5477),a=n(1567),s="image/png";e.default=function(){return{mime:(0,i.default)({},s,["png"]),constants:{MIME_PNG:s,PNG_FILTER_AUTO:-1,PNG_FILTER_NONE:0,PNG_FILTER_SUB:1,PNG_FILTER_UP:2,PNG_FILTER_AVERAGE:3,PNG_FILTER_PATH:4},hasAlpha:(0,i.default)({},s,!0),decoders:(0,i.default)({},s,o.PNG.sync.read),encoders:(0,i.default)({},s,(function(t){var e=new o.PNG({width:t.bitmap.width,height:t.bitmap.height});return e.data=t.bitmap.data,o.PNG.sync.write(e,{width:t.bitmap.width,height:t.bitmap.height,deflateLevel:t._deflateLevel,deflateStrategy:t._deflateStrategy,filterType:t._filterType,colorType:"number"==typeof t._colorType?t._colorType:t._rgba?6:2,inputHasAlpha:t._rgba})})),class:{_deflateLevel:9,_deflateStrategy:3,_filterType:-1,_colorType:null,deflateLevel:function(t,e){return"number"!=typeof t?a.throwError.call(this,"l must be a number",e):t<0||t>9?a.throwError.call(this,"l must be a number 0 - 9",e):(this._deflateLevel=Math.round(t),(0,a.isNodePattern)(e)&&e.call(this,null,this),this)},deflateStrategy:function(t,e){return"number"!=typeof t?a.throwError.call(this,"s must be a number",e):t<0||t>3?a.throwError.call(this,"s must be a number 0 - 3",e):(this._deflateStrategy=Math.round(t),(0,a.isNodePattern)(e)&&e.call(this,null,this),this)},filterType:function(t,e){return"number"!=typeof t?a.throwError.call(this,"n must be a number",e):t<-1||t>4?a.throwError.call(this,"n must be -1 (auto) or a number 0 - 4",e):(this._filterType=Math.round(t),(0,a.isNodePattern)(e)&&e.call(this,null,this),this)},colorType:function(t,e){return"number"!=typeof t?a.throwError.call(this,"s must be a number",e):0!==t&&2!==t&&4!==t&&6!==t?a.throwError.call(this,"s must be a number 0, 2, 4, 6.",e):(this._colorType=Math.round(t),(0,a.isNodePattern)(e)&&e.call(this,null,this),this)}}}}},1326:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n(8416)),a=i(n(6173)),s="image/tiff";e.default=function(){return{mime:(0,o.default)({},s,["tiff","tif"]),constants:{MIME_TIFF:s},decoders:(0,o.default)({},s,(function(t){var e=a.default.decode(t),n=e[0];a.default.decodeImages(t,e);var i=a.default.toRGBA8(n);return{data:r.from(i),width:n.t256[0],height:n.t257[0]}})),encoders:(0,o.default)({},s,(function(t){var e=a.default.encodeImage(t.bitmap.data,t.bitmap.width,t.bitmap.height);return r.from(e)}))}}},7209:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(7011),o=r(n(3853)),a=r(n(7447)),s=r(n(2878)),u=r(n(1326)),l=r(n(2744));e.default=function(){return(0,i.mergeDeep)((0,o.default)(),(0,a.default)(),(0,s.default)(),(0,u.default)(),(0,l.default)())}},1567:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.isNodePattern=function(t){if(void 0===t)return!1;if("function"!=typeof t)throw new TypeError("Callback must be a function");return!0},e.throwError=function(t,e){if("string"==typeof t&&(t=new Error(t)),"function"==typeof e)return e.call(this,t);throw t},e.scan=function(t,e,n,r,i,o){e=Math.round(e),n=Math.round(n),r=Math.round(r),i=Math.round(i);for(var a=n;a{!function(){var t=e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function r(t){this.message=t}r.prototype=new Error,r.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var e,i,o=0,a=n,s="";t.charAt(0|o)||(a="=",o%1);s+=a.charAt(63&e>>8-o%1*8)){if((i=t.charCodeAt(o+=3/4))>255)throw new r("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|i}return s}),t.atob||(t.atob=function(t){if((t=t.replace(/=+$/,"")).length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,i,o=0,a=0,s="";i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?s+=String.fromCharCode(255&e>>(-2*o&6)):0)i=n.indexOf(i);return s})}()},964:(t,e,n)=>{var r=n(2661);function i(t,e){var n=new r(t,e);return function(t){return n.convert(t)}}i.BIN="01",i.OCT="01234567",i.DEC="0123456789",i.HEX="0123456789abcdef",t.exports=i},2661:t=>{"use strict";function e(t,e){if(!(t&&e&&t.length&&e.length))throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}e.prototype.convert=function(t){var e,n,r,i={},o=this.srcAlphabet.length,a=this.dstAlphabet.length,s=t.length,u="string"==typeof t?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e=a?(i[r++]=parseInt(n/a,10),n%=a):r>0&&(i[r++]=0);s=r,u=this.dstAlphabet.slice(n,n+1).concat(u)}while(0!==r);return u},e.prototype.isValid=function(t){for(var e=0;e{"use strict";var r=n(4155);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}var o,a,s=n(2136).codes,u=s.ERR_AMBIGUOUS_ARGUMENT,l=s.ERR_INVALID_ARG_TYPE,c=s.ERR_INVALID_ARG_VALUE,h=s.ERR_INVALID_RETURN_VALUE,f=s.ERR_MISSING_ARGS,d=n(5961),p=n(9539).inspect,g=n(9539).types,m=g.isPromise,b=g.isRegExp,y=Object.assign?Object.assign:n(8091).assign,_=Object.is?Object.is:n(609);function v(){var t=n(9158);o=t.isDeepEqual,a=t.isDeepStrictEqual}new Map;var w=!1,x=t.exports=A,T={};function E(t){if(t.message instanceof Error)throw t.message;throw new d(t)}function S(t,e,n,r){if(!n){var i=!1;if(0===e)i=!0,r="No value argument passed to `assert.ok()`";else if(r instanceof Error)throw r;var o=new d({actual:n,expected:!0,message:r,operator:"==",stackStartFn:t});throw o.generatedMessage=i,o}}function A(){for(var t=arguments.length,e=new Array(t),n=0;n1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;i1?n-1:0),i=1;i{"use strict";var r=n(4155);function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;nt.length)&&(n=t.length),t.substring(n-e.length,n)===e}var b="",y="",_="",v="",w={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function x(t){var e=Object.keys(t),n=Object.create(Object.getPrototypeOf(t));return e.forEach((function(e){n[e]=t[e]})),Object.defineProperty(n,"message",{value:t.message}),n}function T(t){return p(t,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var E=function(t){function e(t){var n;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),"object"!==d(t)||null===t)throw new g("options","Object",t);var i=t.message,o=t.operator,u=t.stackStartFn,l=t.actual,c=t.expected,h=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)n=a(this,f(e).call(this,String(i)));else if(r.stderr&&r.stderr.isTTY&&(r.stderr&&r.stderr.getColorDepth&&1!==r.stderr.getColorDepth()?(b="",y="",v="",_=""):(b="",y="",v="",_="")),"object"===d(l)&&null!==l&&"object"===d(c)&&null!==c&&"stack"in l&&l instanceof Error&&"stack"in c&&c instanceof Error&&(l=x(l),c=x(c)),"deepStrictEqual"===o||"strictEqual"===o)n=a(this,f(e).call(this,function(t,e,n){var i="",o="",a=0,s="",u=!1,l=T(t),c=l.split("\n"),h=T(e).split("\n"),f=0,p="";if("strictEqual"===n&&"object"===d(t)&&"object"===d(e)&&null!==t&&null!==e&&(n="strictEqualObject"),1===c.length&&1===h.length&&c[0]!==h[0]){var g=c[0].length+h[0].length;if(g<=10){if(!("object"===d(t)&&null!==t||"object"===d(e)&&null!==e||0===t&&0===e))return"".concat(w[n],"\n\n")+"".concat(c[0]," !== ").concat(h[0],"\n")}else if("strictEqualObject"!==n&&g<(r.stderr&&r.stderr.isTTY?r.stderr.columns:80)){for(;c[0][f]===h[0][f];)f++;f>2&&(p="\n ".concat(function(t,e){if(e=Math.floor(e),0==t.length||0==e)return"";var n=t.length*e;for(e=Math.floor(Math.log(e)/Math.log(2));e;)t+=t,e--;return t+t.substring(0,n-t.length)}(" ",f),"^"),f=0)}}for(var x=c[c.length-1],E=h[h.length-1];x===E&&(f++<2?s="\n ".concat(x).concat(s):i=x,c.pop(),h.pop(),0!==c.length&&0!==h.length);)x=c[c.length-1],E=h[h.length-1];var S=Math.max(c.length,h.length);if(0===S){var A=l.split("\n");if(A.length>30)for(A[26]="".concat(b,"...").concat(v);A.length>27;)A.pop();return"".concat(w.notIdentical,"\n\n").concat(A.join("\n"),"\n")}f>3&&(s="\n".concat(b,"...").concat(v).concat(s),u=!0),""!==i&&(s="\n ".concat(i).concat(s),i="");var O=0,I=w[n]+"\n".concat(y,"+ actual").concat(v," ").concat(_,"- expected").concat(v),P=" ".concat(b,"...").concat(v," Lines skipped");for(f=0;f1&&f>2&&(k>4?(o+="\n".concat(b,"...").concat(v),u=!0):k>3&&(o+="\n ".concat(h[f-2]),O++),o+="\n ".concat(h[f-1]),O++),a=f,i+="\n".concat(_,"-").concat(v," ").concat(h[f]),O++;else if(h.length1&&f>2&&(k>4?(o+="\n".concat(b,"...").concat(v),u=!0):k>3&&(o+="\n ".concat(c[f-2]),O++),o+="\n ".concat(c[f-1]),O++),a=f,o+="\n".concat(y,"+").concat(v," ").concat(c[f]),O++;else{var M=h[f],D=c[f],R=D!==M&&(!m(D,",")||D.slice(0,-1)!==M);R&&m(M,",")&&M.slice(0,-1)===D&&(R=!1,D+=","),R?(k>1&&f>2&&(k>4?(o+="\n".concat(b,"...").concat(v),u=!0):k>3&&(o+="\n ".concat(c[f-2]),O++),o+="\n ".concat(c[f-1]),O++),a=f,o+="\n".concat(y,"+").concat(v," ").concat(D),i+="\n".concat(_,"-").concat(v," ").concat(M),O+=2):(o+=i,i="",1!==k&&0!==f||(o+="\n ".concat(D),O++))}if(O>20&&f30)for(E[26]="".concat(b,"...").concat(v);E.length>27;)E.pop();n=1===E.length?a(this,f(e).call(this,"".concat(p," ").concat(E[0]))):a(this,f(e).call(this,"".concat(p,"\n\n").concat(E.join("\n"),"\n")))}else{var S=T(l),A="",O=w[o];"notDeepEqual"===o||"notEqual"===o?(S="".concat(w[o],"\n\n").concat(S)).length>1024&&(S="".concat(S.slice(0,1021),"...")):(A="".concat(T(c)),S.length>512&&(S="".concat(S.slice(0,509),"...")),A.length>512&&(A="".concat(A.slice(0,509),"...")),"deepEqual"===o||"equal"===o?S="".concat(O,"\n\n").concat(S,"\n\nshould equal\n\n"):A=" ".concat(o," ").concat(A)),n=a(this,f(e).call(this,"".concat(S).concat(A)))}return Error.stackTraceLimit=h,n.generatedMessage=!i,Object.defineProperty(s(n),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),n.code="ERR_ASSERTION",n.actual=l,n.expected=c,n.operator=o,Error.captureStackTrace&&Error.captureStackTrace(s(n),u),n.stack,n.name="AssertionError",a(n)}var n,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(e,t),n=e,u=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:p.custom,value:function(t,e){return p(this,function(t){for(var e=1;e{"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}var a,s,u={};function l(t,e,n){n||(n=Error);var a=function(n){function a(n,o,s){var u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),u=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}(this,i(a).call(this,function(t,n,r){return"string"==typeof e?e:e(t,n,r)}(n,o,s))),u.code=t,u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(a,n),a}(n);u[t]=a}function c(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",(function(t,e,i){var o,s,u,l,h;if(void 0===a&&(a=n(9282)),a("string"==typeof t,"'name' must be a string"),"string"==typeof e&&(s="not ",e.substr(0,s.length)===s)?(o="must not be",e=e.replace(/^not /,"")):o="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))u="The ".concat(t," ").concat(o," ").concat(c(e,"type"));else{var f=("number"!=typeof h&&(h=0),h+".".length>(l=t).length||-1===l.indexOf(".",h)?"argument":"property");u='The "'.concat(t,'" ').concat(f," ").concat(o," ").concat(c(e,"type"))}return u+". Received type ".concat(r(i))}),TypeError),l("ERR_INVALID_ARG_VALUE",(function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=n(9539));var i=s.inspect(e);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(t,"' ").concat(r,". Received ").concat(i)}),TypeError,RangeError),l("ERR_INVALID_RETURN_VALUE",(function(t,e,n){var i;return i=n&&n.constructor&&n.constructor.name?"instance of ".concat(n.constructor.name):"type ".concat(r(n)),"Expected ".concat(t,' to be returned from the "').concat(e,'"')+" function but got ".concat(i,".")}),TypeError),l("ERR_MISSING_ARGS",(function(){for(var t=arguments.length,e=new Array(t),r=0;r0,"At least one arg needs to be specified");var i="The ",o=e.length;switch(e=e.map((function(t){return'"'.concat(t,'"')})),o){case 1:i+="".concat(e[0]," argument");break;case 2:i+="".concat(e[0]," and ").concat(e[1]," arguments");break;default:i+=e.slice(0,o-1).join(", "),i+=", and ".concat(e[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),t.exports.codes=u},9158:(t,e,n)=>{"use strict";function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}var o=void 0!==/a/g.flags,a=function(t){var e=[];return t.forEach((function(t){return e.push(t)})),e},s=function(t){var e=[];return t.forEach((function(t,n){return e.push([n,t])})),e},u=Object.is?Object.is:n(609),l=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},c=Number.isNaN?Number.isNaN:n(360);function h(t){return t.call.bind(t)}var f=h(Object.prototype.hasOwnProperty),d=h(Object.prototype.propertyIsEnumerable),p=h(Object.prototype.toString),g=n(9539).types,m=g.isAnyArrayBuffer,b=g.isArrayBufferView,y=g.isDate,_=g.isMap,v=g.isRegExp,w=g.isSet,x=g.isNativeError,T=g.isBoxedPrimitive,E=g.isNumberObject,S=g.isStringObject,A=g.isBooleanObject,O=g.isBigIntObject,I=g.isSymbolObject,P=g.isFloat32Array,k=g.isFloat64Array;function M(t){if(0===t.length||t.length>10)return!0;for(var e=0;e57)return!0}return 10===t.length&&t>=Math.pow(2,32)}function D(t){return Object.keys(t).filter(M).concat(l(t).filter(Object.prototype.propertyIsEnumerable.bind(t)))}function R(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i{"use strict";e.byteLength=function(t){var e=u(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=u(t),a=o[0],s=o[1],l=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),c=0,h=s>0?a-4:a;for(n=0;n>16&255,l[c++]=e>>8&255,l[c++]=255&e;return 2===s&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[c++]=255&e),1===s&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e),l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=16383,s=0,u=r-i;su?u:s+a));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},784:(t,e,n)=>{var r=n(8232),i=n(6871);t.exports={encode:r,decode:i}},6871:(t,e,n)=>{var r=n(8764).Buffer;function i(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseRGBA()}i.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<=0?this.height-1:-this.height;for(n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i>7-s&1];this.data[a+4*s]=0,this.data[a+4*s+1]=u.blue,this.data[a+4*s+2]=u.green,this.data[a+4*s+3]=u.red}0!=e&&(this.pos+=4-e)}},i.prototype.bit4=function(){if(2==this.compress){this.data.fill(255);for(var t=0,e=this.bottom_up?this.height-1:0,n=!1;t>4),1&u&&u+1>1&1)&&this.pos++}}else for(u=0;u>4),n=!n}function l(e){var n=this.palette[e];this.data[t]=0,this.data[t+1]=n.blue,this.data[t+2]=n.green,this.data[t+3]=n.red,t+=4}}else{var c=Math.ceil(this.width/2),h=c%4;for(a=this.height-1;a>=0;a--){var f=this.bottom_up?a:this.height-1-a;for(o=0;o>4,p=15&i,g=this.palette[d];if(this.data[t]=0,this.data[t+1]=g.blue,this.data[t+2]=g.green,this.data[t+3]=g.red,2*o+1>=this.width)break;g=this.palette[p],this.data[t+4]=0,this.data[t+4+1]=g.blue,this.data[t+4+2]=g.green,this.data[t+4+3]=g.red}0!=h&&(this.pos+=4-h)}}},i.prototype.bit8=function(){if(1==this.compress){this.data.fill(255);for(var t=0,e=this.bottom_up?this.height-1:0;t=0;o--){var c=this.bottom_up?o:this.height-1-o;for(i=0;i=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i>5&e)/e*255|0,u=(o>>10&e)/e*255|0,l=o>>15?255:0,c=r*this.width*4+4*i;this.data[c]=l,this.data[c+1]=a,this.data[c+2]=s,this.data[c+3]=u}this.pos+=t}},i.prototype.bit16=function(){var t=this.width%2*2;this.maskRed=31744,this.maskGreen=992,this.maskBlue=31,this.mask0=0,3==this.compress&&(this.maskRed=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskGreen=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskBlue=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.mask0=this.buffer.readUInt32LE(this.pos),this.pos+=4);for(var e=[0,0,0],n=0;n<16;n++)this.maskRed>>n&1&&e[0]++,this.maskGreen>>n&1&&e[1]++,this.maskBlue>>n&1&&e[2]++;e[1]+=e[0],e[2]+=e[1],e[0]=8-e[0],e[1]-=8,e[2]-=8;for(var r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,o=0;o>e[1],l=(a&this.maskRed)>>e[2],c=i*this.width*4+4*o;this.data[c]=0,this.data[c+1]=s,this.data[c+2]=u,this.data[c+3]=l}this.pos+=t}},i.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,n=0;n=0;t--)for(var e=this.bottom_up?t:this.height-1-t,n=0;n=0;t--)for(e=this.bottom_up?t:this.height-1-t,n=0;n{var r=n(8764).Buffer;function i(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}i.prototype.encode=function(){var t=new r(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeInt32LE(-this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var e=0,n=3*this.width+this.extraBytes,i=0;i0){var s=this.pos+i*n+3*this.width;t.fill(0,s,s+this.extraBytes)}}return t},t.exports=function(t,e){return void 0===e&&(e=100),{data:new i(t).encode(),width:t.width,height:t.height}}},4505:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(4155),o=n(9282),a=n(2292),s=n(405),u=n(7948),l=n(1619);for(var c in l)e[c]=l[c];function h(t){if("number"!=typeof t||te.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}e.NONE=0,e.DEFLATE=1,e.INFLATE=2,e.GZIP=3,e.GUNZIP=4,e.DEFLATERAW=5,e.INFLATERAW=6,e.UNZIP=7,h.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,o(this.init_done,"close before init"),o(this.mode<=e.UNZIP),this.mode===e.DEFLATE||this.mode===e.GZIP||this.mode===e.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==e.INFLATE&&this.mode!==e.GUNZIP&&this.mode!==e.INFLATERAW&&this.mode!==e.UNZIP||u.inflateEnd(this.strm),this.mode=e.NONE,this.dictionary=null)},h.prototype.write=function(t,e,n,r,i,o,a){return this._write(!0,t,e,n,r,i,o,a)},h.prototype.writeSync=function(t,e,n,r,i,o,a){return this._write(!1,t,e,n,r,i,o,a)},h.prototype._write=function(t,n,a,s,u,l,c,h){if(o.equal(arguments.length,8),o(this.init_done,"write before init"),o(this.mode!==e.NONE,"already finalized"),o.equal(!1,this.write_in_progress,"write already in progress"),o.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,o.equal(!1,void 0===n,"must provide flush value"),this.write_in_progress=!0,n!==e.Z_NO_FLUSH&&n!==e.Z_PARTIAL_FLUSH&&n!==e.Z_SYNC_FLUSH&&n!==e.Z_FULL_FLUSH&&n!==e.Z_FINISH&&n!==e.Z_BLOCK)throw new Error("Invalid flush value");if(null==a&&(a=r.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=a,this.strm.next_in=s,this.strm.avail_out=h,this.strm.output=l,this.strm.next_out=c,this.flush=n,!t)return this._process(),this._checkError()?this._afterSync():void 0;var f=this;return i.nextTick((function(){f._process(),f._after()})),this},h.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},h.prototype._process=function(){var t=null;switch(this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case e.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=e.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=e.GUNZIP):this.mode=e.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:for(this.err=u.inflate(this.strm,this.flush),this.err===e.Z_NEED_DICT&&this.dictionary&&(this.err=u.inflateSetDictionary(this.strm,this.dictionary),this.err===e.Z_OK?this.err=u.inflate(this.strm,this.flush):this.err===e.Z_DATA_ERROR&&(this.err=e.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===e.GUNZIP&&this.err===e.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=u.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},h.prototype._checkError=function(){switch(this.err){case e.Z_OK:case e.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===e.Z_FINISH)return this._error("unexpected end of file"),!1;break;case e.Z_STREAM_END:break;case e.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},h.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},h.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},h.prototype.init=function(t,n,r,i,a){o(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),o(t>=8&&t<=15,"invalid windowBits"),o(n>=-1&&n<=9,"invalid compression level"),o(r>=1&&r<=9,"invalid memlevel"),o(i===e.Z_FILTERED||i===e.Z_HUFFMAN_ONLY||i===e.Z_RLE||i===e.Z_FIXED||i===e.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(n,t,r,i,a),this._setDictionary()},h.prototype.params=function(){throw new Error("deflateParams Not supported")},h.prototype.reset=function(){this._reset(),this._setDictionary()},h.prototype._init=function(t,n,r,i,o){switch(this.level=t,this.windowBits=n,this.memLevel=r,this.strategy=i,this.flush=e.Z_NO_FLUSH,this.err=e.Z_OK,this.mode!==e.GZIP&&this.mode!==e.GUNZIP||(this.windowBits+=16),this.mode===e.UNZIP&&(this.windowBits+=32),this.mode!==e.DEFLATERAW&&this.mode!==e.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=s.deflateInit2(this.strm,this.level,e.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:case e.UNZIP:this.err=u.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==e.Z_OK&&this._error("Init error"),this.dictionary=o,this.write_in_progress=!1,this.init_done=!0},h.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:this.err=s.deflateSetDictionary(this.strm,this.dictionary)}this.err!==e.Z_OK&&this._error("Failed to set dictionary")}},h.prototype._reset=function(){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:case e.GZIP:this.err=s.deflateReset(this.strm);break;case e.INFLATE:case e.INFLATERAW:case e.GUNZIP:this.err=u.inflateReset(this.strm)}this.err!==e.Z_OK&&this._error("Failed to reset stream")},e.Zlib=h},2635:(t,e,n)=>{"use strict";var r=n(4155),i=n(8764).Buffer,o=n(2830).Transform,a=n(4505),s=n(9539),u=n(9282).ok,l=n(8764).kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+l.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var h=Object.keys(a),f=0;f=l?a=new RangeError(c):e=i.concat(r,o),r=[],t.close(),n(a,e)}t.on("error",(function(e){t.removeListener("end",s),t.removeListener("readable",a),n(e)})),t.on("end",s),t.end(e),a()}function _(t,e){if("string"==typeof e&&(e=i.from(e)),!i.isBuffer(e))throw new TypeError("Not a string or buffer");var n=t._finishFlushFlag;return t._processChunk(e,n)}function v(t){if(!(this instanceof v))return new v(t);I.call(this,t,a.DEFLATE)}function w(t){if(!(this instanceof w))return new w(t);I.call(this,t,a.INFLATE)}function x(t){if(!(this instanceof x))return new x(t);I.call(this,t,a.GZIP)}function T(t){if(!(this instanceof T))return new T(t);I.call(this,t,a.GUNZIP)}function E(t){if(!(this instanceof E))return new E(t);I.call(this,t,a.DEFLATERAW)}function S(t){if(!(this instanceof S))return new S(t);I.call(this,t,a.INFLATERAW)}function A(t){if(!(this instanceof A))return new A(t);I.call(this,t,a.UNZIP)}function O(t){return t===a.Z_NO_FLUSH||t===a.Z_PARTIAL_FLUSH||t===a.Z_SYNC_FLUSH||t===a.Z_FULL_FLUSH||t===a.Z_FINISH||t===a.Z_BLOCK}function I(t,n){var r=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||e.Z_DEFAULT_CHUNK,o.call(this,t),t.flush&&!O(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!O(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:a.Z_FINISH,t.chunkSize&&(t.chunkSizee.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBitse.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.levele.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevele.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=e.Z_FILTERED&&t.strategy!=e.Z_HUFFMAN_ONLY&&t.strategy!=e.Z_RLE&&t.strategy!=e.Z_FIXED&&t.strategy!=e.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!i.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(n);var s=this;this._hadError=!1,this._handle.onerror=function(t,n){P(s),s._hadError=!0;var r=new Error(t);r.errno=n,r.code=e.codes[n],s.emit("error",r)};var u=e.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(u=t.level);var l=e.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(l=t.strategy),this._handle.init(t.windowBits||e.Z_DEFAULT_WINDOWBITS,u,t.memLevel||e.Z_DEFAULT_MEMLEVEL,l,t.dictionary),this._buffer=i.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!r._handle},configurable:!0,enumerable:!0})}function P(t,e){e&&r.nextTick(e),t._handle&&(t._handle.close(),t._handle=null)}function k(t){t.emit("close")}Object.defineProperty(e,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),e.Deflate=v,e.Inflate=w,e.Gzip=x,e.Gunzip=T,e.DeflateRaw=E,e.InflateRaw=S,e.Unzip=A,e.createDeflate=function(t){return new v(t)},e.createInflate=function(t){return new w(t)},e.createDeflateRaw=function(t){return new E(t)},e.createInflateRaw=function(t){return new S(t)},e.createGzip=function(t){return new x(t)},e.createGunzip=function(t){return new T(t)},e.createUnzip=function(t){return new A(t)},e.deflate=function(t,e,n){return"function"==typeof e&&(n=e,e={}),y(new v(e),t,n)},e.deflateSync=function(t,e){return _(new v(e),t)},e.gzip=function(t,e,n){return"function"==typeof e&&(n=e,e={}),y(new x(e),t,n)},e.gzipSync=function(t,e){return _(new x(e),t)},e.deflateRaw=function(t,e,n){return"function"==typeof e&&(n=e,e={}),y(new E(e),t,n)},e.deflateRawSync=function(t,e){return _(new E(e),t)},e.unzip=function(t,e,n){return"function"==typeof e&&(n=e,e={}),y(new A(e),t,n)},e.unzipSync=function(t,e){return _(new A(e),t)},e.inflate=function(t,e,n){return"function"==typeof e&&(n=e,e={}),y(new w(e),t,n)},e.inflateSync=function(t,e){return _(new w(e),t)},e.gunzip=function(t,e,n){return"function"==typeof e&&(n=e,e={}),y(new T(e),t,n)},e.gunzipSync=function(t,e){return _(new T(e),t)},e.inflateRaw=function(t,e,n){return"function"==typeof e&&(n=e,e={}),y(new S(e),t,n)},e.inflateRawSync=function(t,e){return _(new S(e),t)},s.inherits(I,o),I.prototype.params=function(t,n,i){if(te.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(n!=e.Z_FILTERED&&n!=e.Z_HUFFMAN_ONLY&&n!=e.Z_RLE&&n!=e.Z_FIXED&&n!=e.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+n);if(this._level!==t||this._strategy!==n){var o=this;this.flush(a.Z_SYNC_FLUSH,(function(){u(o._handle,"zlib binding closed"),o._handle.params(t,n),o._hadError||(o._level=t,o._strategy=n,i&&i())}))}else r.nextTick(i)},I.prototype.reset=function(){return u(this._handle,"zlib binding closed"),this._handle.reset()},I.prototype._flush=function(t){this._transform(i.alloc(0),"",t)},I.prototype.flush=function(t,e){var n=this,o=this._writableState;("function"==typeof t||void 0===t&&!e)&&(e=t,t=a.Z_FULL_FLUSH),o.ended?e&&r.nextTick(e):o.ending?e&&this.once("end",e):o.needDrain?e&&this.once("drain",(function(){return n.flush(t,e)})):(this._flushFlag=t,this.write(i.alloc(0),"",e))},I.prototype.close=function(t){P(this,t),r.nextTick(k,this)},I.prototype._transform=function(t,e,n){var r,o=this._writableState,s=(o.ending||o.ended)&&(!t||o.length===t.length);return null===t||i.isBuffer(t)?this._handle?(s?r=this._finishFlushFlag:(r=this._flushFlag,t.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(t,r,n)):n(new Error("zlib binding closed")):n(new Error("invalid input"))},I.prototype._processChunk=function(t,e,n){var r=t&&t.length,o=this._chunkSize-this._offset,a=0,s=this,h="function"==typeof n;if(!h){var f,d=[],p=0;this.on("error",(function(t){f=t})),u(this._handle,"zlib binding closed");do{var g=this._handle.writeSync(e,t,a,r,this._buffer,this._offset,o)}while(!this._hadError&&y(g[0],g[1]));if(this._hadError)throw f;if(p>=l)throw P(this),new RangeError(c);var m=i.concat(d,p);return P(this),m}u(this._handle,"zlib binding closed");var b=this._handle.write(e,t,a,r,this._buffer,this._offset,o);function y(l,c){if(this&&(this.buffer=null,this.callback=null),!s._hadError){var f=o-c;if(u(f>=0,"have should not go down"),f>0){var g=s._buffer.slice(s._offset,s._offset+f);s._offset+=f,h?s.push(g):(d.push(g),p+=g.length)}if((0===c||s._offset>=s._chunkSize)&&(o=s._chunkSize,s._offset=0,s._buffer=i.allocUnsafe(s._chunkSize)),0===c){if(a+=r-l,r=l,!h)return!0;var m=s._handle.write(e,t,a,r,s._buffer,s._offset,s._chunkSize);return m.callback=y,void(m.buffer=t)}if(!h)return!1;n()}}b.buffer=t,b.callback=y},s.inherits(v,I),s.inherits(w,I),s.inherits(x,I),s.inherits(T,I),s.inherits(E,I),s.inherits(S,I),s.inherits(A,I)},2369:(t,e,n)=>{var r=n(8764).Buffer;t.exports=function(t,e){if(r.isBuffer(t)&&r.isBuffer(e)){if("function"==typeof t.equals)return t.equals(e);if(t.length!==e.length)return!1;for(var n=0;n{"use strict";const r=n(9742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return l(t,e,n)}function l(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|g(t,e);let r=s(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(X(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(X(t,SharedArrayBuffer)||t&&X(t.buffer,SharedArrayBuffer)))return d(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return u.from(r,e,n);const i=function(t){if(u.isBuffer(t)){const e=0|p(t.length),n=s(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?s(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return c(t),s(t<0?0:0|p(t))}function f(t){const e=t.length<0?0:0|p(t.length),n=s(e);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(t).length;default:if(i)return r?-1:q(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return P(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function b(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:_(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):_(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,n,r,i){let o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let r=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let a;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],s=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,n,r,i){if(X(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const s=Math.min(o,a),l=this.slice(r,i),c=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return x(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function I(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function C(t,e,n,r,i){z(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function L(t,e,n,r,i){z(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function N(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(t,e,n,r,o){return e=+e,n>>>=0,o||N(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,o){return e=+e,n>>>=0,o||N(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||D(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||D(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=J((function(t){G(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||D(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||D(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=J((function(t){G(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||D(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||R(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||R(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=J((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,t,e,n,r-1,-r)}let i=0,o=1,a=0;for(this[e]=255&t;++i>0)-a&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,t,e,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=J((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,n){return B(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return B(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function z(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){G(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||V(e,t.length-(n+1))}(r,i,o)}function G(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,n){if(Math.floor(t)!==t)throw G(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=$(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=$(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function q(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let a=0;a55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function W(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},584:t=>{t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},1924:(t,e,n)=>{"use strict";var r=n(210),i=n(5559),o=i(r("String.prototype.indexOf"));t.exports=function(t,e){var n=r(t,!!e);return"function"==typeof n&&o(t,".prototype.")>-1?i(n):n}},5559:(t,e,n)=>{"use strict";var r=n(8612),i=n(210),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||r.call(a,o),u=i("%Object.getOwnPropertyDescriptor%",!0),l=i("%Object.defineProperty%",!0),c=i("%Math.max%");if(l)try{l({},"a",{value:1})}catch(t){l=null}t.exports=function(t){var e=s(r,a,arguments);if(u&&l){var n=u(e,"length");n.configurable&&l(e,"length",{value:1+c(0,t.length-(arguments.length-1))})}return e};var h=function(){return s(r,o,arguments)};l?l(t.exports,"apply",{value:h}):t.exports.apply=h},4289:(t,e,n)=>{"use strict";var r=n(2215),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,u=n(1044)(),l=s&&u,c=function(t,e,n,r){var i;(!(e in t)||"function"==typeof(i=r)&&"[object Function]"===o.call(i)&&r())&&(l?s(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n)},h=function(t,e){var n=arguments.length>2?arguments[2]:{},o=r(e);i&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s{"use strict";function e(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var n=Object(t),r=1;r{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function l(t,e,n,r){var i,o,a,l;if(s(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=u(t))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=a.length,l=c,console&&console.warn&&console.warn(l)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=c.bind(r);return i.listener=n,r.wrapFn=i,i}function f(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var l=u.length,c=p(u,l);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},2594:(t,e,n)=>{var r=n(3518);t.exports={create:function(t,e){if(t instanceof(e=e||(0,eval)("this")).ArrayBuffer){var i=n(9565);return new r(new i(t,0,t.byteLength,!0,e))}var o=n(1618);return new r(new o(t,0,t.length,!0))}}},1618:t=>{function e(t,e,n,r){this.buffer=t,this.offset=e||0,n="number"==typeof n?n:t.length,this.endPosition=this.offset+n,this.setBigEndian(r)}e.prototype={setBigEndian:function(t){this.bigEndian=!!t},nextUInt8:function(){var t=this.buffer.readUInt8(this.offset);return this.offset+=1,t},nextInt8:function(){var t=this.buffer.readInt8(this.offset);return this.offset+=1,t},nextUInt16:function(){var t=this.bigEndian?this.buffer.readUInt16BE(this.offset):this.buffer.readUInt16LE(this.offset);return this.offset+=2,t},nextUInt32:function(){var t=this.bigEndian?this.buffer.readUInt32BE(this.offset):this.buffer.readUInt32LE(this.offset);return this.offset+=4,t},nextInt16:function(){var t=this.bigEndian?this.buffer.readInt16BE(this.offset):this.buffer.readInt16LE(this.offset);return this.offset+=2,t},nextInt32:function(){var t=this.bigEndian?this.buffer.readInt32BE(this.offset):this.buffer.readInt32LE(this.offset);return this.offset+=4,t},nextFloat:function(){var t=this.bigEndian?this.buffer.readFloatBE(this.offset):this.buffer.readFloatLE(this.offset);return this.offset+=4,t},nextDouble:function(){var t=this.bigEndian?this.buffer.readDoubleBE(this.offset):this.buffer.readDoubleLE(this.offset);return this.offset+=8,t},nextBuffer:function(t){var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},remainingLength:function(){return this.endPosition-this.offset},nextString:function(t){var e=this.buffer.toString("utf8",this.offset,this.offset+t);return this.offset+=t,e},mark:function(){var t=this;return{openWithOffset:function(n){return n=(n||0)+this.offset,new e(t.buffer,n,t.endPosition-n,t.bigEndian)},offset:this.offset}},offsetFrom:function(t){return this.offset-t.offset},skip:function(t){this.offset+=t},branch:function(t,n){return n="number"==typeof n?n:this.endPosition-(this.offset+t),new e(this.buffer,this.offset+t,n,this.bigEndian)}},t.exports=e},292:t=>{function e(t){return parseInt(t,10)}function n(t,n){t=t.map(e),n=n.map(e);var r=t[0],i=t[1]-1,o=t[2],a=n[0],s=n[1],u=n[2];return Date.UTC(r,i,o,a,s,u,0)/1e3}function r(t){var r=t.substr(0,10).split("-"),i=t.substr(11,8).split(":"),o=t.substr(19,6).split(":").map(e),a=3600*o[0]+60*o[1],s=n(r,i);if("number"==typeof(s-=a)&&!isNaN(s))return s}function i(t){var e=t.split(" "),r=n(e[0].split(":"),e[1].split(":"));if("number"==typeof r&&!isNaN(r))return r}t.exports={parseDateWithSpecFormat:i,parseDateWithTimezoneFormat:r,parseExifDate:function(t){var e=19===t.length&&":"===t.charAt(4);return 25===t.length&&"T"===t.charAt(10)?r(t):e?i(t):void 0}}},9565:t=>{function e(t,e,n,r,i,o){this.global=i,e=e||0,n=n||t.byteLength-e,this.arrayBuffer=t.slice(e,e+n),this.view=new i.DataView(this.arrayBuffer,0,this.arrayBuffer.byteLength),this.setBigEndian(r),this.offset=0,this.parentOffset=(o||0)+e}e.prototype={setBigEndian:function(t){this.littleEndian=!t},nextUInt8:function(){var t=this.view.getUint8(this.offset);return this.offset+=1,t},nextInt8:function(){var t=this.view.getInt8(this.offset);return this.offset+=1,t},nextUInt16:function(){var t=this.view.getUint16(this.offset,this.littleEndian);return this.offset+=2,t},nextUInt32:function(){var t=this.view.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},nextInt16:function(){var t=this.view.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},nextInt32:function(){var t=this.view.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},nextFloat:function(){var t=this.view.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},nextDouble:function(){var t=this.view.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},nextBuffer:function(t){var e=this.arrayBuffer.slice(this.offset,this.offset+t);return this.offset+=t,e},remainingLength:function(){return this.arrayBuffer.byteLength-this.offset},nextString:function(t){var e=this.arrayBuffer.slice(this.offset,this.offset+t);return e=String.fromCharCode.apply(null,new this.global.Uint8Array(e)),this.offset+=t,e},mark:function(){var t=this;return{openWithOffset:function(n){return n=(n||0)+this.offset,new e(t.arrayBuffer,n,t.arrayBuffer.byteLength-n,!t.littleEndian,t.global,t.parentOffset)},offset:this.offset,getParentOffset:function(){return t.parentOffset}}},offsetFrom:function(t){return this.parentOffset+this.offset-(t.offset+t.getParentOffset())},skip:function(t){this.offset+=t},branch:function(t,n){return n="number"==typeof n?n:this.arrayBuffer.byteLength-(this.offset+t),new e(this.arrayBuffer,this.offset+t,n,!this.littleEndian,this.global,this.parentOffset)}},t.exports=e},2108:t=>{t.exports={exif:{1:"InteropIndex",2:"InteropVersion",11:"ProcessingSoftware",254:"SubfileType",255:"OldSubfileType",256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",263:"Thresholding",264:"CellWidth",265:"CellLength",266:"FillOrder",269:"DocumentName",270:"ImageDescription",271:"Make",272:"Model",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",280:"MinSampleValue",281:"MaxSampleValue",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",285:"PageName",286:"XPosition",287:"YPosition",288:"FreeOffsets",289:"FreeByteCounts",290:"GrayResponseUnit",291:"GrayResponseCurve",292:"T4Options",293:"T6Options",296:"ResolutionUnit",297:"PageNumber",300:"ColorResponseUnit",301:"TransferFunction",305:"Software",306:"ModifyDate",315:"Artist",316:"HostComputer",317:"Predictor",318:"WhitePoint",319:"PrimaryChromaticities",320:"ColorMap",321:"HalftoneHints",322:"TileWidth",323:"TileLength",324:"TileOffsets",325:"TileByteCounts",326:"BadFaxLines",327:"CleanFaxData",328:"ConsecutiveBadFaxLines",330:"SubIFD",332:"InkSet",333:"InkNames",334:"NumberofInks",336:"DotRange",337:"TargetPrinter",338:"ExtraSamples",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",342:"TransferRange",343:"ClipPath",344:"XClipPathUnits",345:"YClipPathUnits",346:"Indexed",347:"JPEGTables",351:"OPIProxy",400:"GlobalParametersIFD",401:"ProfileType",402:"FaxProfile",403:"CodingMethods",404:"VersionYear",405:"ModeNumber",433:"Decode",434:"DefaultImageColor",435:"T82Options",437:"JPEGTables",512:"JPEGProc",513:"ThumbnailOffset",514:"ThumbnailLength",515:"JPEGRestartInterval",517:"JPEGLosslessPredictors",518:"JPEGPointTransforms",519:"JPEGQTables",520:"JPEGDCTables",521:"JPEGACTables",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite",559:"StripRowCounts",700:"ApplicationNotes",999:"USPTOMiscellaneous",4096:"RelatedImageFileFormat",4097:"RelatedImageWidth",4098:"RelatedImageHeight",18246:"Rating",18247:"XP_DIP_XML",18248:"StitchInfo",18249:"RatingPercent",32781:"ImageID",32931:"WangTag1",32932:"WangAnnotation",32933:"WangTag3",32934:"WangTag4",32995:"Matteing",32996:"DataType",32997:"ImageDepth",32998:"TileDepth",33405:"Model2",33421:"CFARepeatPatternDim",33422:"CFAPattern2",33423:"BatteryLevel",33424:"KodakIFD",33432:"Copyright",33434:"ExposureTime",33437:"FNumber",33445:"MDFileTag",33446:"MDScalePixel",33447:"MDColorTable",33448:"MDLabName",33449:"MDSampleInfo",33450:"MDPrepDate",33451:"MDPrepTime",33452:"MDFileUnits",33550:"PixelScale",33589:"AdventScale",33590:"AdventRevision",33628:"UIC1Tag",33629:"UIC2Tag",33630:"UIC3Tag",33631:"UIC4Tag",33723:"IPTC-NAA",33918:"IntergraphPacketData",33919:"IntergraphFlagRegisters",33920:"IntergraphMatrix",33921:"INGRReserved",33922:"ModelTiePoint",34016:"Site",34017:"ColorSequence",34018:"IT8Header",34019:"RasterPadding",34020:"BitsPerRunLength",34021:"BitsPerExtendedRunLength",34022:"ColorTable",34023:"ImageColorIndicator",34024:"BackgroundColorIndicator",34025:"ImageColorValue",34026:"BackgroundColorValue",34027:"PixelIntensityRange",34028:"TransparencyIndicator",34029:"ColorCharacterization",34030:"HCUsage",34031:"TrapIndicator",34032:"CMYKEquivalent",34118:"SEMInfo",34152:"AFCP_IPTC",34232:"PixelMagicJBIGOptions",34264:"ModelTransform",34306:"WB_GRGBLevels",34310:"LeafData",34377:"PhotoshopSettings",34665:"ExifOffset",34675:"ICC_Profile",34687:"TIFF_FXExtensions",34688:"MultiProfiles",34689:"SharedData",34690:"T88Options",34732:"ImageLayer",34735:"GeoTiffDirectory",34736:"GeoTiffDoubleParams",34737:"GeoTiffAsciiParams",34850:"ExposureProgram",34852:"SpectralSensitivity",34853:"GPSInfo",34855:"ISO",34856:"Opto-ElectricConvFactor",34857:"Interlace",34858:"TimeZoneOffset",34859:"SelfTimerMode",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",34908:"FaxRecvParams",34909:"FaxSubAddress",34910:"FaxRecvTime",34954:"LeafSubIFD",36864:"ExifVersion",36867:"DateTimeOriginal",36868:"CreateDate",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureCompensation",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",37387:"FlashEnergy",37388:"SpatialFrequencyResponse",37389:"Noise",37390:"FocalPlaneXResolution",37391:"FocalPlaneYResolution",37392:"FocalPlaneResolutionUnit",37393:"ImageNumber",37394:"SecurityClassification",37395:"ImageHistory",37396:"SubjectArea",37397:"ExposureIndex",37398:"TIFF-EPStandardID",37399:"SensingMethod",37434:"CIP3DataFile",37435:"CIP3Sheet",37436:"CIP3Side",37439:"StoNits",37500:"MakerNote",37510:"UserComment",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",37679:"MSDocumentText",37680:"MSPropertySetStorage",37681:"MSDocumentTextPosition",37724:"ImageSourceData",40091:"XPTitle",40092:"XPComment",40093:"XPAuthor",40094:"XPKeywords",40095:"XPSubject",40960:"FlashpixVersion",40961:"ColorSpace",40962:"ExifImageWidth",40963:"ExifImageHeight",40964:"RelatedSoundFile",40965:"InteropOffset",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41485:"Noise",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41489:"ImageNumber",41490:"SecurityClassification",41491:"ImageHistory",41492:"SubjectLocation",41493:"ExposureIndex",41494:"TIFF-EPStandardID",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFormat",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"OwnerName",42033:"SerialNumber",42034:"LensInfo",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",42112:"GDALMetadata",42113:"GDALNoData",42240:"Gamma",44992:"ExpandSoftware",44993:"ExpandLens",44994:"ExpandFilm",44995:"ExpandFilterLens",44996:"ExpandScanner",44997:"ExpandFlashLamp",48129:"PixelFormat",48130:"Transformation",48131:"Uncompressed",48132:"ImageType",48256:"ImageWidth",48257:"ImageHeight",48258:"WidthResolution",48259:"HeightResolution",48320:"ImageOffset",48321:"ImageByteCount",48322:"AlphaOffset",48323:"AlphaByteCount",48324:"ImageDataDiscard",48325:"AlphaDataDiscard",50215:"OceScanjobDesc",50216:"OceApplicationSelector",50217:"OceIDNumber",50218:"OceImageLogic",50255:"Annotations",50341:"PrintIM",50560:"USPTOOriginalContentType",50706:"DNGVersion",50707:"DNGBackwardVersion",50708:"UniqueCameraModel",50709:"LocalizedCameraModel",50710:"CFAPlaneColor",50711:"CFALayout",50712:"LinearizationTable",50713:"BlackLevelRepeatDim",50714:"BlackLevel",50715:"BlackLevelDeltaH",50716:"BlackLevelDeltaV",50717:"WhiteLevel",50718:"DefaultScale",50719:"DefaultCropOrigin",50720:"DefaultCropSize",50721:"ColorMatrix1",50722:"ColorMatrix2",50723:"CameraCalibration1",50724:"CameraCalibration2",50725:"ReductionMatrix1",50726:"ReductionMatrix2",50727:"AnalogBalance",50728:"AsShotNeutral",50729:"AsShotWhiteXY",50730:"BaselineExposure",50731:"BaselineNoise",50732:"BaselineSharpness",50733:"BayerGreenSplit",50734:"LinearResponseLimit",50735:"CameraSerialNumber",50736:"DNGLensInfo",50737:"ChromaBlurRadius",50738:"AntiAliasStrength",50739:"ShadowScale",50740:"DNGPrivateData",50741:"MakerNoteSafety",50752:"RawImageSegmentation",50778:"CalibrationIlluminant1",50779:"CalibrationIlluminant2",50780:"BestQualityScale",50781:"RawDataUniqueID",50784:"AliasLayerMetadata",50827:"OriginalRawFileName",50828:"OriginalRawFileData",50829:"ActiveArea",50830:"MaskedAreas",50831:"AsShotICCProfile",50832:"AsShotPreProfileMatrix",50833:"CurrentICCProfile",50834:"CurrentPreProfileMatrix",50879:"ColorimetricReference",50898:"PanasonicTitle",50899:"PanasonicTitle2",50931:"CameraCalibrationSig",50932:"ProfileCalibrationSig",50933:"ProfileIFD",50934:"AsShotProfileName",50935:"NoiseReductionApplied",50936:"ProfileName",50937:"ProfileHueSatMapDims",50938:"ProfileHueSatMapData1",50939:"ProfileHueSatMapData2",50940:"ProfileToneCurve",50941:"ProfileEmbedPolicy",50942:"ProfileCopyright",50964:"ForwardMatrix1",50965:"ForwardMatrix2",50966:"PreviewApplicationName",50967:"PreviewApplicationVersion",50968:"PreviewSettingsName",50969:"PreviewSettingsDigest",50970:"PreviewColorSpace",50971:"PreviewDateTime",50972:"RawImageDigest",50973:"OriginalRawFileDigest",50974:"SubTileBlockSize",50975:"RowInterleaveFactor",50981:"ProfileLookTableDims",50982:"ProfileLookTableData",51008:"OpcodeList1",51009:"OpcodeList2",51022:"OpcodeList3",51041:"NoiseProfile",51043:"TimeCodes",51044:"FrameRate",51058:"TStop",51081:"ReelName",51089:"OriginalDefaultFinalSize",51090:"OriginalBestQualitySize",51091:"OriginalDefaultCropSize",51105:"CameraLabel",51107:"ProfileHueSatMapEncoding",51108:"ProfileLookTableEncoding",51109:"BaselineExposureOffset",51110:"DefaultBlackRender",51111:"NewRawImageDigest",51112:"RawToPreviewGain",51125:"DefaultUserCrop",59932:"Padding",59933:"OffsetSchema",65e3:"OwnerName",65001:"SerialNumber",65002:"Lens",65024:"KDC_IFD",65100:"RawFile",65101:"Converter",65102:"WhiteBalance",65105:"Exposure",65106:"Shadows",65107:"Brightness",65108:"Contrast",65109:"Saturation",65110:"Sharpness",65111:"Smoothness",65112:"MoireFilter"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"}}},7315:t=>{function e(t,e){switch(t){case 1:return e.nextUInt8();case 3:case 8:return e.nextUInt16();case 4:case 9:return e.nextUInt32();case 5:return[e.nextUInt32(),e.nextUInt32()];case 6:return e.nextInt8();case 10:return[e.nextInt32(),e.nextInt32()];case 11:return e.nextFloat();case 12:return e.nextDouble();default:throw new Error("Invalid format while decoding: "+t)}}function n(t,n){var r,i,o=n.nextUInt16(),a=n.nextUInt16(),s=function(t){switch(t){case 1:case 2:case 6:case 7:return 1;case 3:case 8:return 2;case 4:case 9:case 11:return 4;case 5:case 10:case 12:return 8;default:return 0}}(a),u=n.nextUInt32(),l=s*u;if(l>4&&(n=t.openWithOffset(n.nextUInt32())),2===a){var c=(r=n.nextString(u)).indexOf("\0");-1!==c&&(r=r.substr(0,c))}else if(7===a)r=n.nextBuffer(u);else if(0!==a)for(r=[],i=0;i{t.exports={parseSections:function(t,e){var n,r;for(t.setBigEndian(!0);t.remainingLength()>0&&218!==r;){if(255!==t.nextUInt8())throw new Error("Invalid JPEG section offset");n=(r=t.nextUInt8())>=208&&r<=217||218===r?0:t.nextUInt16()-2,e(r,t.branch(0,n)),t.skip(n)}},getSizeFromSOFSection:function(t){return t.skip(1),{height:t.nextUInt16(),width:t.nextUInt16()}},getSectionName:function(t){var e,n;switch(t){case 216:e="SOI";break;case 196:e="DHT";break;case 219:e="DQT";break;case 221:e="DRI";break;case 218:e="SOS";break;case 254:e="COM";break;case 217:e="EOI";break;default:t>=224&&t<=239?(e="APP",n=t-224):t>=192&&t<=207&&196!==t&&200!==t&&204!==t?(e="SOF",n=t-192):t>=208&&t<=215&&(e="RST",n=t-208)}var r={name:e};return"number"==typeof n&&(r.index=n),r}}},3518:(t,e,n)=>{var r=n(329),i=n(7315),o=n(2410);function a(t,e,n,r,i,o,a){this.startMarker=t,this.tags=e,this.imageSize=n,this.thumbnailOffset=r,this.thumbnailLength=i,this.thumbnailType=o,this.app1Offset=a}function s(t){this.stream=t,this.flags={readBinaryTags:!1,resolveTagNames:!0,simplifyValues:!0,imageSize:!0,hidePointers:!0,returnTags:!0}}a.prototype={hasThumbnail:function(t){return!(!this.thumbnailOffset||!this.thumbnailLength||"string"==typeof t&&("image/jpeg"===t.toLowerCase().trim()?6!==this.thumbnailType:"image/tiff"!==t.toLowerCase().trim()||1!==this.thumbnailType))},getThumbnailOffset:function(){return this.app1Offset+6+this.thumbnailOffset},getThumbnailLength:function(){return this.thumbnailLength},getThumbnailBuffer:function(){return this._getThumbnailStream().nextBuffer(this.thumbnailLength)},_getThumbnailStream:function(){return this.startMarker.openWithOffset(this.getThumbnailOffset())},getImageSize:function(){return this.imageSize},getThumbnailSize:function(){var t,e=this._getThumbnailStream();return r.parseSections(e,(function(e,n){"SOF"===r.getSectionName(e).name&&(t=r.getSizeFromSOFSection(n))})),t}},s.prototype={enableBinaryFields:function(t){return this.flags.readBinaryTags=!!t,this},enablePointers:function(t){return this.flags.hidePointers=!t,this},enableTagNames:function(t){return this.flags.resolveTagNames=!!t,this},enableImageSize:function(t){return this.flags.imageSize=!!t,this},enableReturnTags:function(t){return this.flags.returnTags=!!t,this},enableSimpleValues:function(t){return this.flags.simplifyValues=!!t,this},parse:function(){var t,e,s,u,l,c,h,f,d,p=this.stream.mark(),g=p.openWithOffset(0),m=this.flags;return m.resolveTagNames&&(h=n(2108)),m.resolveTagNames?(t={},f=function(e){return t[e.name]},d=function(e,n){t[e.name]=n}):(t=[],f=function(e){var n;for(n=0;n{var r=n(7315),i=n(292),o=[{section:r.GPSIFD,type:2,name:"GPSLatitude",refType:1,refName:"GPSLatitudeRef",posVal:"N"},{section:r.GPSIFD,type:4,name:"GPSLongitude",refType:3,refName:"GPSLongitudeRef",posVal:"E"}],a=[{section:r.SubIFD,type:306,name:"ModifyDate"},{section:r.SubIFD,type:36867,name:"DateTimeOriginal"},{section:r.SubIFD,type:36868,name:"CreateDate"},{section:r.SubIFD,type:306,name:"ModifyDate"}];t.exports={castDegreeValues:function(t,e){o.forEach((function(n){var r=t(n);if(r){var i=t({section:n.section,type:n.refType,name:n.refName})===n.posVal?1:-1,o=(r[0]+r[1]/60+r[2]/3600)*i;e(n,o)}}))},castDateValues:function(t,e){a.forEach((function(n){var r=t(n);if(r){var o=i.parseExifDate(r);void 0!==o&&e(n,o)}}))},simplifyValue:function(t,e){return Array.isArray(t)&&1===(t=t.map((function(t){return 10===e||5===e?t[0]/t[1]:t}))).length&&(t=t[0]),t}}},7769:t=>{"use strict";const e=t=>[...t].map((t=>t.charCodeAt(0))),n=e("META-INF/mozilla.rsa"),r=e("[Content_Types].xml"),i=e("_rels/.rels");t.exports=t=>{const o=t instanceof Uint8Array?t:new Uint8Array(t);if(!(o&&o.length>1))return null;const a=(t,e)=>{e=Object.assign({offset:0},e);for(let n=0;na(e(t),n);if(a([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(a([137,80,78,71,13,10,26,10]))return{ext:"png",mime:"image/png"};if(a([71,73,70]))return{ext:"gif",mime:"image/gif"};if(a([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(a([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((a([73,73,42,0])||a([77,77,0,42]))&&a([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a([73,73,42,0])||a([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(a([66,77]))return{ext:"bmp",mime:"image/bmp"};if(a([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(a([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(a([80,75,3,4])){if(a([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(a(n,{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(s("mimetypeapplication/vnd.oasis.opendocument.text",{offset:30}))return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};if(s("mimetypeapplication/vnd.oasis.opendocument.spreadsheet",{offset:30}))return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};if(s("mimetypeapplication/vnd.oasis.opendocument.presentation",{offset:30}))return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};const t=(t,e=0)=>t.findIndex(((t,n,r)=>n>=e&&80===r[n]&&75===r[n+1]&&3===r[n+2]&&4===r[n+3]));let e=0,u=!1,l=null;do{const n=e+30;if(u||(u=a(r,{offset:n})||a(i,{offset:n})),l||(s("word/",{offset:n})?l={ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:s("ppt/",{offset:n})?l={ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:s("xl/",{offset:n})&&(l={ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),u&&l)return l;e=t(o,n)}while(e>=0);if(l)return l}if(a([80,75])&&(3===o[2]||5===o[2]||7===o[2])&&(4===o[3]||6===o[3]||8===o[3]))return{ext:"zip",mime:"application/zip"};if(a([117,115,116,97,114],{offset:257}))return{ext:"tar",mime:"application/x-tar"};if(a([82,97,114,33,26,7])&&(0===o[6]||1===o[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(a([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(a([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(a([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(a([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(a([51,103,112,53])||a([0,0,0])&&a([102,116,121,112],{offset:4})&&(a([109,112,52,49],{offset:8})||a([109,112,52,50],{offset:8})||a([105,115,111,109],{offset:8})||a([105,115,111,50],{offset:8})||a([109,109,112,52],{offset:8})||a([77,52,86],{offset:8})||a([100,97,115,104],{offset:8})))return{ext:"mp4",mime:"video/mp4"};if(a([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(a([26,69,223,163])){const t=o.subarray(4,4100),e=t.findIndex(((t,e,n)=>66===n[e]&&130===n[e+1]));if(-1!==e){const n=e+3,r=e=>[...e].every(((e,r)=>t[n+r]===e.charCodeAt(0)));if(r("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(r("webm"))return{ext:"webm",mime:"video/webm"}}}if(a([0,0,0,20,102,116,121,112,113,116,32,32])||a([102,114,101,101],{offset:4})||a([102,116,121,112,113,116,32,32],{offset:4})||a([109,100,97,116],{offset:4})||a([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(a([82,73,70,70])){if(a([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(a([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(a([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(a([48,38,178,117,142,102,207,17,166,217]))return{ext:"wmv",mime:"video/x-ms-wmv"};if(a([0,0,1,186])||a([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(a([102,116,121,112,51,103],{offset:4}))return{ext:"3gp",mime:"video/3gpp"};for(let t=0;t<2&&t{"use strict";var r=n(5320),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty,a=function(t,e,n){for(var r=0,i=t.length;r=3&&(o=n),"[object Array]"===i.call(t)?a(t,e,o):"string"==typeof t?s(t,e,o):u(t,e,o)}},7648:t=>{"use strict";var e="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,r=Object.prototype.toString,i="[object Function]";t.exports=function(t){var o=this;if("function"!=typeof o||r.call(o)!==i)throw new TypeError(e+o);for(var a,s=n.call(arguments,1),u=function(){if(this instanceof a){var e=o.apply(this,s.concat(n.call(arguments)));return Object(e)===e?e:this}return o.apply(t,s.concat(n.call(arguments)))},l=Math.max(0,o.length-s.length),c=[],h=0;h{"use strict";var r=n(7648);t.exports=Function.prototype.bind||r},210:(t,e,n)=>{"use strict";var r,i=SyntaxError,o=Function,a=TypeError,s=function(t){try{return o('"use strict"; return ('+t+").constructor;")()}catch(t){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(t){u=null}var l=function(){throw new a},c=u?function(){try{return l}catch(t){try{return u(arguments,"callee").get}catch(t){return l}}}():l,h=n(1405)(),f=Object.getPrototypeOf||function(t){return t.__proto__},d={},p="undefined"==typeof Uint8Array?r:f(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":h?f([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?f(f([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?f((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?f((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h?f(""[Symbol.iterator]()):r,"%Symbol%":h?Symbol:r,"%SyntaxError%":i,"%ThrowTypeError%":c,"%TypedArray%":p,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet},m=function t(e){var n;if("%AsyncFunction%"===e)n=s("async function () {}");else if("%GeneratorFunction%"===e)n=s("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=s("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&(n=f(i.prototype))}return g[e]=n,n},b={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},y=n(8612),_=n(7642),v=y.call(Function.call,Array.prototype.concat),w=y.call(Function.apply,Array.prototype.splice),x=y.call(Function.call,String.prototype.replace),T=y.call(Function.call,String.prototype.slice),E=y.call(Function.call,RegExp.prototype.exec),S=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A=/\\(\\)?/g,O=function(t){var e=T(t,0,1),n=T(t,-1);if("%"===e&&"%"!==n)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new i("invalid intrinsic syntax, expected opening `%`");var r=[];return x(t,S,(function(t,e,n,i){r[r.length]=n?x(i,A,"$1"):e||t})),r},I=function(t,e){var n,r=t;if(_(b,r)&&(r="%"+(n=b[r])[0]+"%"),_(g,r)){var o=g[r];if(o===d&&(o=m(r)),void 0===o&&!e)throw new a("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:o}}throw new i("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new a('"allowMissing" argument must be a boolean');if(null===E(/^%?[^%]*%?$/,t))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=O(t),r=n.length>0?n[0]:"",o=I("%"+r+"%",e),s=o.name,l=o.value,c=!1,h=o.alias;h&&(r=h[0],w(n,v([0,1],h)));for(var f=1,d=!0;f=n.length){var y=u(l,p);l=(d=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:l[p]}else d=_(l,p),l=l[p];d&&!c&&(g[s]=l)}}return l}},1915:(t,e,n)=>{"use strict";var r=n(8764).Buffer;class i{constructor(...t){if(0===t.length)throw new Error("constructor requires parameters");const e=t[0];if(null!==e&&"object"==typeof e)if(e instanceof i){const t=e.bitmap;this.bitmap={width:t.width,height:t.height,data:new r(t.width*t.height*4)},t.data.copy(this.bitmap.data)}else{if(!(e.width&&e.height&&e.data))throw new Error("unrecognized constructor parameters");this.bitmap=e}else{if("number"!=typeof e||"number"!=typeof t[1])throw new Error("unrecognized constructor parameters");{const n=e,i=t[1],o=t[2];this.bitmap={width:n,height:i},r.isBuffer(o)?this.bitmap.data=o:(this.bitmap.data=new r(n*i*4),"number"==typeof o&&this.fillRGBA(o))}}}blit(t,e,n,r,i,o,a){if(r+o>this.bitmap.width)throw new Error("copy exceeds width of source bitmap");if(e+o>t.bitmap.width)throw new Error("copy exceeds width of target bitmap");if(i+a>this.bitmap.height)throw new Error("copy exceeds height of source bitmap");if(n+a>t.bitmap.height)throw new Erro("copy exceeds height of target bitmap");const s=this.bitmap.data,u=t.bitmap.data,l=4*this.bitmap.width,c=4*t.bitmap.width,h=4*o;let f=i*l+4*r,d=n*c+4*e;for(;--a>=0;)s.copy(u,d,f,f+h),f+=l,d+=c;return this}fillRGBA(t){const e=this.bitmap.data,n=4*this.bitmap.height;let r=0;for(;r{const i=Math.round(.299*t[r]+.587*t[r+1]+.114*t[r+2]);t[r]=i,t[r+1]=i,t[r+2]=i})),this}reframe(t,e,n,r,o){const a=t<0?0:t,s=e<0?0:e,u=n+a>this.bitmap.width?this.bitmap.width-a:n,l=r+s>this.bitmap.height?this.bitmap.height-s:r,c=t<0?-t:0,h=e<0?-e:0;let f;if(void 0===o){if(a!==t||s!=e||u!==n||l!==r)throw new GifError("fillRGBA required for this reframing");f=new i(n,r)}else f=new i(n,r,o);return this.blit(f,c,h,a,s,u,l),this.bitmap=f.bitmap,this}scale(t){if(1===t)return;if(!Number.isInteger(t)||t<1)throw new Error("the scale must be an integer >= 1");const e=this.bitmap.width,n=this.bitmap.height,i=e*t*4,o=this.bitmap.data,a=new r(n*i*t);let s,u=0,l=0;for(let r=0;r{"use strict";class n{constructor(t,e,n){this.width=n.width,this.height=n.height,this.loops=n.loops,this.usesTransparency=n.usesTransparency,this.colorScope=n.colorScope,this.frames=e,this.buffer=t}}n.GlobalColorsPreferred=0,n.GlobalColorsOnly=1,n.LocalColorsOnly=2;class r extends Error{constructor(t){super(t),t instanceof Error&&(this.stack="Gif"+t.stack)}}e.Gif=n,e.GifError=r},2527:(t,e,n)=>{"use strict";var r=n(8764).Buffer;const i=n(1494),{Gif:o,GifError:a}=n(8932);function s(){const t=n(8305);return s=function(){return t},t}const{GifFrame:u}=n(3573);function l(t,e){const n=t.indexOf(e);return-1===n?null:n}function c(t,e){for(var n,r=0,i=t.length-1;r<=i;)if(t[n=Math.floor((r+i)/2)]>e)i=n-1;else{if(!(t[n]r;)r<<=1;e.length=r,e.fill(0,n)}function f(t,e){let n=t.bitmap.width*t.bitmap.height;return n=Math.ceil(n*e/8),n+=Math.ceil(n/255),100+n+768}function d(t){let e=t.indexCount,n=0;for(--e;e;)++n,e>>=1;return n>0?n:1}function p(t,e,n,i,o){if(n.interlaced)throw new a("writing interlaced GIFs is not supported");const s=function(t,e,n){const i=n.colors,o=i.length<=8?l:c,s=e.bitmap.data,u=new r(s.length/4);let h=i.length,f=0,d=0;for(;f>8&16777215;u[d]=o(i,t)}else u[d]=h;f+=4,++d}if(n.usesTransparency){if(256===h)throw new a(`Frame ${t} already has 256 colorsand so can't use transparency`)}else h=null;return{buffer:u,transparentIndex:h}}(e,n,i),u={delay:n.delayCentisecs,disposal:n.disposalMethod,transparent:s.transparentIndex};o&&(h(i),u.palette=i.colors);try{let e,i=t.getOutputBuffer(),o=t.getOutputBufferPosition(),a=!0;for(;a;)if(e=t.addFrame(n.xOffset,n.yOffset,n.bitmap.width,n.bitmap.height,s.buffer,u),a=!1,e>=i.length-1){const e=new r(1.5*i.length);i.copy(e),t.setOutputBuffer(e),t.setOutputBufferPosition(o),i=e,a=!0}return i}catch(t){throw new a(t)}}e.GifCodec=class{constructor(t={}){this._transparentRGB=null,"number"==typeof t.transparentRGB&&0!==t.transparentRGB&&(this._transparentRGBA=256*t.transparentRGB),this._testInitialBufferSize=0}decodeGif(t){try{let e;try{e=new i.GifReader(t)}catch(t){throw new a(t)}const n=e.numFrames(),r=[],s={width:e.width,height:e.height,loops:e.loopCount(),usesTransparency:!1};for(let t=0;ti.width)for(let e=0;e0)return this._testInitialBufferSize;let n=968;const r=d(t);return e.forEach((t=>{n+=f(t,r)})),n}_getSizeEstimateLocal(t,e){if(this._testInitialBufferSize>0)return this._testInitialBufferSize;let n=200;for(let r=0;r{"use strict";const r=n(1915),{GifError:i}=n(8932);class o extends r{constructor(...t){if(super(...t),t[0]instanceof o){const e=t[0];this.xOffset=e.xOffset,this.yOffset=e.yOffset,this.disposalMethod=e.disposalMethod,this.delayCentisecs=e.delayCentisecs,this.interlaced=e.interlaced}else{const e=t[t.length-1];let n={};"object"!=typeof e||e instanceof r||(n=e),this.xOffset=n.xOffset||0,this.yOffset=n.yOffset||0,this.disposalMethod=void 0!==n.disposalMethod?n.disposalMethod:o.DisposeToBackgroundColor,this.delayCentisecs=n.delayCentisecs||8,this.interlaced=n.interlaced||!1}}getPalette(){const t=new Set,e=this.bitmap.data;let n=0,r=!1;for(;n>8&16777215;t.add(r)}n+=4}const i=new Array(t.size),o=t.values();for(n=0;nt-e));let a=i.length;return r&&++a,{colors:i,usesTransparency:r,indexCount:a}}}o.DisposeToAnything=0,o.DisposeNothing=1,o.DisposeToBackgroundColor=2,o.DisposeToPrevious=3,e.GifFrame=o},8305:(t,e,n)=>{"use strict";var r=n(8764).Buffer;const i=n(8104),o=n(9160),a=n(1915),{GifFrame:s}=n(3573),{GifError:u}=n(8932),{GifCodec:l}=n(2527),c=[".jpg",".jpeg",".png",".bmp"],h=new l;function f(t,e,n,r,i){const a=Array.isArray(t)?t:[t];if(i){if(["FloydSteinberg","FalseFloydSteinberg","Stucki","Atkinson","Jarvis","Burkes","Sierra","TwoSierra","SierraLite"].indexOf(i.ditherAlgorithm)<0)throw new Error(`Invalid ditherAlgorithm '${i.ditherAlgorithm}'`);void 0===i.serpentine&&(i.serpentine=!0),void 0===i.minimumColorDistanceToDither&&(i.minimumColorDistanceToDither=0),void 0===i.calculateErrorLikeGIMP&&(i.calculateErrorLikeGIMP=!1)}const s=new o.distance.Euclidean,u=new o.palette[e](s,n,r);let l;l=i?new o.image.ErrorDiffusionArray(s,o.image.ErrorDiffusionArrayKernel[i.ditherAlgorithm],i.serpentine,i.minimumColorDistanceToDither,i.calculateErrorLikeGIMP):new o.image.NearestColor(s);const c=[];a.forEach((t=>{const e=t.bitmap.data,n=new ArrayBuffer(e.length),r=new Uint32Array(n);for(let t=0,n=0;t{e.push(new s(t))})),e},e.getColorInfo=function(t,e){let n=!1;const r=[];for(let e=0;e256)throw new u(`Frame ${e} uses more than 256 color indexes`);r.push(i)}if(0===e)return{usesTransparency:n,palettes:r};const i=new Set;r.forEach((t=>{t.colors.forEach((t=>{i.add(t)}))}));let o=i.size;if(n&&++o,e&&o>e)return{usesTransparency:n,palettes:r};const a=new Array(i.size),s=i.values();for(let t=0;tt-e)),{colors:a,indexCount:o,usesTransparency:n,palettes:r}},e.copyAsJimp=function(t,n){return e.shareAsJimp(t,new a(n))},e.getMaxDimensions=function(t){let e=0,n=0;return t.forEach((t=>{const r=t.xOffset+t.bitmap.width;r>e&&(e=r);const i=t.yOffset+t.bitmap.height;i>n&&(n=i)})),{maxWidth:e,maxHeight:n}},e.quantizeDekker=function(t,e,n){f(t,"NeuQuantFloat",e=e||256,0,n)},e.quantizeSorokin=function(t,e,n,r){let i;switch(e=e||256,n=n||"min-pop"){case"min-pop":i=2;break;case"top-pop":i=1;break;default:throw new Error(`Invalid quantizeSorokin histogram '${n}'`)}f(t,"RGBQuant",e,i,r)},e.quantizeWu=function(t,e,n,r){if(e=e||256,(n=n||5)<1||n>8)throw new Error("Invalid quantization quality");f(t,"WuQuant",e,n,r)},e.read=function(t,e){return e=e||h,r.isBuffer(t)?e.decodeGif(t):(n=t,new Promise(((t,e)=>{i.readFile(n,((n,r)=>n?e(n):t(r)))}))).then((t=>e.decodeGif(t)));var n},e.shareAsJimp=function(t,e){const n=new t(e.bitmap.width,e.bitmap.height,0);return n.bitmap.data=e.bitmap.data,n},e.write=function(t,e,n,r){r=r||h;const o=t.match(/\.[a-zA-Z]+$/);if(null!==o&&c.includes(o[0].toLowerCase()))throw new Error(`GIF '${t}' has an unexpected suffix`);return r.encodeGif(e,n).then((e=>function(t,e){return new Promise(((n,r)=>{i.writeFile(t,e,(t=>t?r(t):n()))}))}(t,e.buffer).then((()=>e))))}},1702:(t,e,n)=>{"use strict";const r=n(1915),{Gif:i,GifError:o}=n(8932),{GifCodec:a}=n(2527),{GifFrame:s}=n(3573),u=n(8305);t.exports={BitmapImage:r,Gif:i,GifCodec:a,GifFrame:s,GifUtil:u,GifError:o}},8908:(t,e,n)=>{var r;r="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},t.exports=r},7296:(t,e,n)=>{"use strict";var r=n(210)("%Object.getOwnPropertyDescriptor%",!0);if(r)try{r([],"length")}catch(t){r=null}t.exports=r},1044:(t,e,n)=>{"use strict";var r=n(210)("%Object.defineProperty%",!0),i=function(){if(r)try{return r({},"a",{value:1}),!0}catch(t){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==r([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},1405:(t,e,n)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,i=n(5419);t.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&i()}},5419:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6410:(t,e,n)=>{"use strict";var r=n(5419);t.exports=function(){return r()&&!!Symbol.toStringTag}},7642:(t,e,n)=>{"use strict";var r=n(8612);t.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},1592:(t,e,n)=>{var r=t.exports,i=(n(7187).EventEmitter,n(8886)),o=n(8575);r.request=function(t,e){"string"==typeof t&&(t=o.parse(t)),t||(t={}),t.host||t.port||(t.port=parseInt(window.location.port,10)),!t.host&&t.hostname&&(t.host=t.hostname),t.protocol||(t.scheme?t.protocol=t.scheme+":":t.protocol=window.location.protocol),t.host||(t.host=window.location.hostname||window.location.host),/:/.test(t.host)&&(t.port||(t.port=t.host.split(":")[1]),t.host=t.host.split(":")[0]),t.port||(t.port="https:"==t.protocol?443:80);var n=new i(new a,t);return e&&n.on("response",e),n},r.get=function(t,e){t.method="GET";var n=r.request(t,e);return n.end(),n},r.Agent=function(){},r.Agent.defaultMaxSockets=4;var a=function(){if("undefined"==typeof window)throw new Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject){for(var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],e=0;e{var r=n(2830),i=n(9067),o=n(4188),a=n(5717),s=t.exports=function(t,e){var n=this;n.writable=!0,n.xhr=t,n.body=[],n.uri=(e.protocol||"http:")+"//"+e.host+(e.port?":"+e.port:"")+(e.path||"/"),void 0===e.withCredentials&&(e.withCredentials=!0);try{t.withCredentials=e.withCredentials}catch(t){}if(e.responseType)try{t.responseType=e.responseType}catch(t){}if(t.open(e.method||"GET",n.uri,!0),t.onerror=function(t){n.emit("error",new Error("Network error"))},n._headers={},e.headers)for(var r=u(e.headers),a=0;a{var r=n(2830),i=n(9539),o=t.exports=function(t){this.offset=0,this.readable=!0};i.inherits(o,r);var a={streaming:!0,status2:!0};function s(t){for(var e=t.getAllResponseHeaders().split(/\r?\n/),n={},r=0;rthis.offset&&(this.emit("data",e.slice(this.offset)),this.offset=e.length)};var u=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},645:(t,e)=>{e.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,h=n?i-1:0,f=n?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=l}return(d?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[n+d]=255&a,d+=p,a/=256,l-=8);t[n+d-p]|=128*g}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},2584:(t,e,n)=>{"use strict";var r=n(6410)(),i=n(1924)("Object.prototype.toString"),o=function(t){return!(r&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===i(t)},a=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i(t)&&"[object Function]"===i(t.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,t.exports=s?o:a},5320:t=>{"use strict";var e,n,r=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw n}}),n={},i((function(){throw 42}),null,e)}catch(t){t!==n&&(i=null)}else i=null;var o=/^\s*class\b/,a=function(t){try{var e=r.call(t);return o.test(e)}catch(t){return!1}},s=function(t){try{return!a(t)&&(r.call(t),!0)}catch(t){return!1}},u=Object.prototype.toString,l="function"==typeof Symbol&&!!Symbol.toStringTag,c=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var f=document.all;u.call(f)===u.call(document.all)&&(h=function(t){if((c||!t)&&(void 0===t||"object"==typeof t))try{var e=u.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=i?function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{i(t,null,e)}catch(t){if(t!==n)return!1}return!a(t)&&s(t)}:function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(l)return s(t);if(a(t))return!1;var e=u.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&s(t)}},7376:t=>{t.exports=function(t){if(!t)return!1;var n=e.call(t);return"[object Function]"===n||"function"==typeof t&&"[object RegExp]"!==n||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},8662:(t,e,n)=>{"use strict";var r,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=n(6410)(),u=Object.getPrototypeOf;t.exports=function(t){if("function"!=typeof t)return!1;if(a.test(o.call(t)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(t);if(!u)return!1;if(void 0===r){var e=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(t){}}();r=!!e&&u(e)}return u(t)===r}},8611:t=>{"use strict";t.exports=function(t){return t!=t}},360:(t,e,n)=>{"use strict";var r=n(5559),i=n(4289),o=n(8611),a=n(9415),s=n(3194),u=r(a(),Number);i(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},9415:(t,e,n)=>{"use strict";var r=n(8611);t.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:r}},3194:(t,e,n)=>{"use strict";var r=n(4289),i=n(9415);t.exports=function(){var t=i();return r(Number,{isNaN:t},{isNaN:function(){return Number.isNaN!==t}}),t}},5692:(t,e,n)=>{"use strict";var r=n(4029),i=n(3083),o=n(1924),a=o("Object.prototype.toString"),s=n(6410)(),u=n(7296),l="undefined"==typeof globalThis?n.g:globalThis,c=i(),h=o("Array.prototype.indexOf",!0)||function(t,e){for(var n=0;n-1}return!!u&&function(t){var e=!1;return r(d,(function(n,r){if(!e)try{e=n.call(t)===r}catch(t){}})),e}(t)}},5817:(t,e,n)=>{"use strict";var r=n(4836);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(3006)),o=r(n(7209)),a=r(n(6240)),s=(0,i.default)({types:[o.default],plugins:[a.default]});e.default=s},7870:(t,e,n)=>{var r=n(587),i=n(914);t.exports={encode:r,decode:i}},914:(t,e,n)=>{var r=n(8764).Buffer,i=function(){"use strict";var t=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),e=4017,n=799,r=3406,i=2276,o=1567,a=3784,s=5793,u=2896;function l(){}function c(t,e){for(var n,r,i=0,o=[],a=16;a>0&&!t[a-1];)a--;o.push({children:[],index:0});var s,u=o[0];for(n=0;n0;){if(0===o.length)throw new Error("Could not recreate Huffman Table");u=o.pop()}for(u.index++,o.push(u);o.length<=n;)o.push(s={children:[],index:0}),u.children[u.index]=s.children,u=s;i++}n+10)return g--,p>>g&1;if(255==(p=e[n++])){var t=e[n++];if(t)throw new Error("unexpected marker: "+(p<<8|t).toString(16))}return g=7,p>>>7}function b(t){for(var e,n=t;null!==(e=m());){if("number"==typeof(n=n[e]))return n;if("object"!=typeof n)throw new Error("invalid huffman sequence")}return null}function y(t){for(var e=0;t>0;){var n=m();if(null===n)return;e=e<<1|n,t--}return e}function _(t){var e=y(t);return e>=1<0)w--;else for(var r=a,i=s;r<=i;){var o=b(e.huffmanTableAC),u=15&o,c=o>>4;if(0!==u)n[t[r+=c]]=_(u)*(1<>4,0===f)o<15?(w=y(o)+(1<>4;if(0!==s)n[t[o+=u]]=_(s),o++;else{if(u<15)break;o+=16}}};var D,R,C,L,N=0;for(R=1==M?i[0].blocksPerLine*i[0].blocksPerColumn:h*r.mcusPerColumn,o||(o=R);N=65488&&D<=65495))break;n+=2}return n-d}function f(t,l){var c,h,f=[],d=l.blocksPerLine,p=l.blocksPerColumn,g=d<<3,b=new Int32Array(64),y=new Uint8Array(64);function _(t,c,h){var f,d,p,g,m,b,y,_,v,w,x=l.quantizationTable,T=h;for(w=0;w<64;w++)T[w]=t[w]*x[w];for(w=0;w<8;++w){var E=8*w;0!=T[1+E]||0!=T[2+E]||0!=T[3+E]||0!=T[4+E]||0!=T[5+E]||0!=T[6+E]||0!=T[7+E]?(f=s*T[0+E]+128>>8,d=s*T[4+E]+128>>8,p=T[2+E],g=T[6+E],m=u*(T[1+E]-T[7+E])+128>>8,_=u*(T[1+E]+T[7+E])+128>>8,b=T[3+E]<<4,y=T[5+E]<<4,v=f-d+1>>1,f=f+d+1>>1,d=v,v=p*a+g*o+128>>8,p=p*o-g*a+128>>8,g=v,v=m-y+1>>1,m=m+y+1>>1,y=v,v=_+b+1>>1,b=_-b+1>>1,_=v,v=f-g+1>>1,f=f+g+1>>1,g=v,v=d-p+1>>1,d=d+p+1>>1,p=v,v=m*i+_*r+2048>>12,m=m*r-_*i+2048>>12,_=v,v=b*n+y*e+2048>>12,b=b*e-y*n+2048>>12,y=v,T[0+E]=f+_,T[7+E]=f-_,T[1+E]=d+y,T[6+E]=d-y,T[2+E]=p+b,T[5+E]=p-b,T[3+E]=g+m,T[4+E]=g-m):(v=s*T[0+E]+512>>10,T[0+E]=v,T[1+E]=v,T[2+E]=v,T[3+E]=v,T[4+E]=v,T[5+E]=v,T[6+E]=v,T[7+E]=v)}for(w=0;w<8;++w){var S=w;0!=T[8+S]||0!=T[16+S]||0!=T[24+S]||0!=T[32+S]||0!=T[40+S]||0!=T[48+S]||0!=T[56+S]?(f=s*T[0+S]+2048>>12,d=s*T[32+S]+2048>>12,p=T[16+S],g=T[48+S],m=u*(T[8+S]-T[56+S])+2048>>12,_=u*(T[8+S]+T[56+S])+2048>>12,b=T[24+S],y=T[40+S],v=f-d+1>>1,f=f+d+1>>1,d=v,v=p*a+g*o+2048>>12,p=p*o-g*a+2048>>12,g=v,v=m-y+1>>1,m=m+y+1>>1,y=v,v=_+b+1>>1,b=_-b+1>>1,_=v,v=f-g+1>>1,f=f+g+1>>1,g=v,v=d-p+1>>1,d=d+p+1>>1,p=v,v=m*i+_*r+2048>>12,m=m*r-_*i+2048>>12,_=v,v=b*n+y*e+2048>>12,b=b*e-y*n+2048>>12,y=v,T[0+S]=f+_,T[56+S]=f-_,T[8+S]=d+y,T[48+S]=d-y,T[16+S]=p+b,T[40+S]=p-b,T[24+S]=g+m,T[32+S]=g-m):(v=s*h[w+0]+8192>>14,T[0+S]=v,T[8+S]=v,T[16+S]=v,T[24+S]=v,T[32+S]=v,T[40+S]=v,T[48+S]=v,T[56+S]=v)}for(w=0;w<64;++w){var A=128+(T[w]+8>>4);c[w]=A<0?0:A>255?255:A}}m(g*p*8);for(var v=0;v255?255:t}l.prototype={load:function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){var t=new Uint8Array(e.response||e.mozResponseArrayBuffer);this.parse(t),this.onload&&this.onload()}.bind(this),e.send(null)},parse:function(e){var n=1e3*this.opts.maxResolutionInMP*1e3,r=0;function i(){var t=e[r]<<8|e[r+1];return r+=2,t}function o(t){var e,n,r=1,i=1;for(n in t.components)t.components.hasOwnProperty(n)&&(r<(e=t.components[n]).h&&(r=e.h),i>4==0)for(Y=0;Y<64;Y++)A[t[Y]]=e[r++];else{if(S>>4!=1)throw new Error("DQT: invalid table spec");for(Y=0;Y<64;Y++)A[t[Y]]=i()}g[15&S]=A}break;case 65472:case 65473:case 65474:i(),(a={}).extended=65473===v,a.progressive=65474===v,a.precision=e[r++],a.scanLines=i(),a.samplesPerLine=i(),a.components={},a.componentsOrder=[];var O=a.scanLines*a.samplesPerLine;if(O>n){var I=Math.ceil((O-n)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${I}MP`)}var P,k=e[r++];for(q=0;q>4,D=15&e[r+1],R=e[r+2];if(M<=0||D<=0)throw new Error("Invalid sampling factor, expected values above 0");a.componentsOrder.push(P),a.components[P]={h:M,v:D,quantizationIdx:R},r+=3}o(a),b.push(a);break;case 65476:var C=i();for(q=2;q>4==0?_:y)[15&L]=c(N,F)}break;case 65501:i(),s=i();break;case 65500:i(),i();break;case 65498:i();var j=e[r++],U=[];for(q=0;q>4],X.huffmanTableAC=y[15&$],U.push(X)}var z=e[r++],G=e[r++],V=e[r++],H=h(e,r,a,U,s,z,G,V>>4,15&V,this.opts);r+=H;break;case 65535:255!==e[r]&&r--;break;default:if(255==e[r-3]&&e[r-2]>=192&&e[r-2]<=254){r-=3;break}if(224===v||225==v){if(-1!==w)throw new Error(`first unknown JPEG marker at offset ${w.toString(16)}, second unknown JPEG marker ${v.toString(16)} at offset ${(r-1).toString(16)}`);w=r-1;const t=i();if(255===e[r+t-2]){r+=t-2;break}}throw new Error("unknown JPEG marker "+v.toString(16))}v=i()}if(1!=b.length)throw new Error("only single frame JPEGs supported");for(var q=0;qg){var n=Math.ceil((e-g)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${n}MB`)}p=e}return l.resetMaxMemoryUsage=function(t){p=0,g=t},l.getBytesAllocated=function(){return p},l.requestMemoryAllocation=m,l}();t.exports=function(t,e={}){var n={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512,...e},o=new Uint8Array(t),a=new i;a.opts=n,i.resetMaxMemoryUsage(1024*n.maxMemoryUsageInMB*1024),a.parse(o);var s=n.formatAsRGBA?4:3,u=a.width*a.height*s;try{i.requestMemoryAllocation(u);var l={width:a.width,height:a.height,exifBuffer:a.exifBuffer,data:n.useTArray?new Uint8Array(u):r.alloc(u)};a.comments.length>0&&(l.comments=a.comments)}catch(t){if(t instanceof RangeError)throw new Error("Could not allocate enough memory for the image. Required: "+u);if(t instanceof ReferenceError&&"Buffer is not defined"===t.message)throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");throw t}return a.copyToImageData(l,n.formatAsRGBA),l}},587:(t,e,n)=>{var r=n(8764).Buffer;function i(t){Math.round;var e,n,i,o,a,s=Math.floor,u=new Array(64),l=new Array(64),c=new Array(64),h=new Array(64),f=new Array(65535),d=new Array(65535),p=new Array(64),g=new Array(64),m=[],b=0,y=7,_=new Array(64),v=new Array(64),w=new Array(64),x=new Array(256),T=new Array(2048),E=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],S=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],A=[0,1,2,3,4,5,6,7,8,9,10,11],O=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],I=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],P=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],k=[0,1,2,3,4,5,6,7,8,9,10,11],M=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],D=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function R(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function C(t){for(var e=t[0],n=t[1]-1;n>=0;)e&1<>8&255),L(255&t)}function B(t,e,n,r,i){for(var o,a=i[0],s=i[240],u=function(t,e){var n,r,i,o,a,s,u,l,c,h,f=0;for(c=0;c<8;++c){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],u=t[f+6];var d=n+(l=t[f+7]),g=n-l,m=r+u,b=r-u,y=i+s,_=i-s,v=o+a,w=o-a,x=d+v,T=d-v,E=m+y,S=m-y;t[f]=x+E,t[f+4]=x-E;var A=.707106781*(S+T);t[f+2]=T+A,t[f+6]=T-A;var O=.382683433*((x=w+_)-(S=b+g)),I=.5411961*x+O,P=1.306562965*S+O,k=.707106781*(E=_+b),M=g+k,D=g-k;t[f+5]=D+I,t[f+3]=D-I,t[f+1]=M+P,t[f+7]=M-P,f+=8}for(f=0,c=0;c<8;++c){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],u=t[f+48];var R=n+(l=t[f+56]),C=n-l,L=r+u,N=r-u,B=i+s,F=i-s,j=o+a,U=o-a,$=R+j,z=R-j,G=L+B,V=L-B;t[f]=$+G,t[f+32]=$-G;var H=.707106781*(V+z);t[f+16]=z+H,t[f+48]=z-H;var q=.382683433*(($=U+F)-(V=N+C)),W=.5411961*$+q,Y=1.306562965*V+q,X=.707106781*(G=F+N),Z=C+X,K=C-X;t[f+40]=K+W,t[f+24]=K-W,t[f+8]=Z+Y,t[f+56]=Z-Y,f++}for(c=0;c<64;++c)h=t[c]*e[c],p[c]=h>0?h+.5|0:h-.5|0;return p}(t,e),l=0;l<64;++l)g[E[l]]=u[l];var c=g[0]-n;n=g[0],0==c?C(r[0]):(C(r[d[o=32767+c]]),C(f[o]));for(var h=63;h>0&&0==g[h];h--);if(0==h)return C(a),n;for(var m,b=1;b<=h;){for(var y=b;0==g[b]&&b<=h;++b);var _=b-y;if(_>=16){m=_>>4;for(var v=1;v<=m;++v)C(s);_&=15}o=32767+g[b],C(i[(_<<4)+d[o]]),C(f[o]),b++}return 63!=h&&C(a),n}function F(t){t<=0&&(t=1),t>100&&(t=100),a!=t&&(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=s((e[n]*t+50)/100);r<1?r=1:r>255&&(r=255),u[E[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=s((i[o]*t+50)/100);a<1?a=1:a>255&&(a=255),l[E[o]]=a}for(var f=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],d=0,p=0;p<8;p++)for(var g=0;g<8;g++)c[d]=1/(u[E[d]]*f[p]*f[g]*8),h[d]=1/(l[E[d]]*f[p]*f[g]*8),d++}(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),a=t)}this.encode=function(t,a){var s;(new Date).getTime(),a&&F(a),m=new Array,b=0,y=7,N(65496),N(65504),N(16),L(74),L(70),L(73),L(70),L(0),L(1),L(1),L(0),N(1),N(1),L(0),L(0),void 0!==(s=t.comments)&&s.constructor===Array&&s.forEach((t=>{if("string"==typeof t){N(65534);var e,n=t.length;for(N(n+2),e=0;e>3)*W+($=4*(7&G)),Y+z>=q&&(U-=W*(Y+1+z-q)),g+$>=W&&(U-=g+$-W+4),x=V[U++],E=V[U++],R=V[U++],_[G]=(T[x]+T[E+256>>0]+T[R+512>>0]>>16)-128,v[G]=(T[x+768>>0]+T[E+1024>>0]+T[R+1280>>0]>>16)-128,w[G]=(T[x+1280>>0]+T[E+1536>>0]+T[R+1792>>0]>>16)-128;f=B(_,c,f,e,i),d=B(v,h,d,n,o),p=B(w,h,p,n,o),g+=32}Y+=8}if(y>=0){var X=[];X[1]=y+1,X[0]=(1<>0]=38470*t,T[t+512>>0]=7471*t+32768,T[t+768>>0]=-11059*t,T[t+1024>>0]=-21709*t,T[t+1280>>0]=32768*t+8421375,T[t+1536>>0]=-27439*t,T[t+1792>>0]=-5329*t}(),F(t),(new Date).getTime()}t.exports=function(t,e){return void 0===e&&(e=50),{data:new i(e).encode(t,e),width:t.width,height:t.height}}},9902:(t,e,n)=>{var r=n(8764).Buffer,i=n(1875),o=function(){},a=n(3340),s=n(5748),u=n(3827),l=n(5781),c=n(7529),h=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(t,e){e="function"==typeof e?e:o,"string"==typeof t?t={uri:t}:t||(t={}),t.binary&&(t=function(t){if(h)return c(t,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),c({xhr:e},t)}(t)),i(t,(function(n,i,c){if(n)return e(n);if(!/^2/.test(i.statusCode))return e(new Error("http status code: "+i.statusCode));if(!c)return e(new Error("no body result"));var h,f,d=!1;if(h=c,"[object ArrayBuffer]"===Object.prototype.toString.call(h)){var p=new Uint8Array(c);c=r.from(p,"binary")}l(c)&&(d=!0,"string"==typeof c&&(c=r.from(c,"binary"))),d||(r.isBuffer(c)&&(c=c.toString(t.encoding)),c=c.trim());try{var g=i.headers["content-type"];f=d?u(c):/json/.test(g)||"{"===c.charAt(0)?JSON.parse(c):/xml/.test(g)||"<"===c.charAt(0)?s(c):a(c)}catch(t){e(new Error("error parsing font "+t.message)),e=o}e(null,f)}))}},5781:(t,e,n)=>{var r=n(8764).Buffer,i=n(2369),o=r.from([66,77,70,3]);t.exports=function(t){return"string"==typeof t?"BMF"===t.substring(0,3):t.length>4&&i(t.slice(0,4),o)}},1890:(t,e,n)=>{var r=n(6470),i=n(3731),o=parseInt("0777",8);function a(t,e,n,s){"function"==typeof e?(n=e,e={}):e&&"object"==typeof e||(e={mode:e});var u=e.mode,l=e.fs||i;void 0===u&&(u=o),s||(s=null);var c=n||function(){};t=r.resolve(t),l.mkdir(t,u,(function(n){if(!n)return c(null,s=s||t);if("ENOENT"===n.code){if(r.dirname(t)===t)return c(n);a(r.dirname(t),e,(function(n,r){n?c(n,r):a(t,e,c,r)}))}else l.stat(t,(function(t,e){t||!e.isDirectory()?c(n,s):c(null,s)}))}))}t.exports=a.mkdirp=a.mkdirP=a,a.sync=function t(e,n,a){n&&"object"==typeof n||(n={mode:n});var s=n.mode,u=n.fs||i;void 0===s&&(s=o),a||(a=null),e=r.resolve(e);try{u.mkdirSync(e,s),a=a||e}catch(i){if("ENOENT"===i.code)a=t(r.dirname(e),n,a),t(e,n,a);else{var l;try{l=u.statSync(e)}catch(t){throw i}if(!l.isDirectory())throw i}}return a}},4244:t=>{"use strict";var e=function(t){return t!=t};t.exports=function(t,n){return 0===t&&0===n?1/t==1/n:t===n||!(!e(t)||!e(n))}},609:(t,e,n)=>{"use strict";var r=n(4289),i=n(5559),o=n(4244),a=n(5624),s=n(3647),u=i(a(),Object);r(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},5624:(t,e,n)=>{"use strict";var r=n(4244);t.exports=function(){return"function"==typeof Object.is?Object.is:r}},3647:(t,e,n)=>{"use strict";var r=n(5624),i=n(4289);t.exports=function(){var t=r();return i(Object,{is:t},{is:function(){return Object.is!==t}}),t}},8987:(t,e,n)=>{"use strict";var r;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=n(1414),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),l=s.call((function(){}),"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(t){var e=t.constructor;return e&&e.prototype===t},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{h(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();r=function(t){var e=null!==t&&"object"==typeof t,n="[object Function]"===o.call(t),r=a(t),s=e&&"[object String]"===o.call(t),f=[];if(!e&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var p=l&&n;if(s&&t.length>0&&!i.call(t,0))for(var g=0;g0)for(var m=0;m{"use strict";var r=Array.prototype.slice,i=n(1414),o=Object.keys,a=o?function(t){return o(t)}:n(8987),s=Object.keys;a.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return i(t)?s(r.call(t)):s(t)})}else Object.keys=a;return Object.keys||a},t.exports=a},1414:t=>{"use strict";var e=Object.prototype.toString;t.exports=function(t){var n=e.call(t),r="[object Arguments]"===n;return r||(r="[object Array]"!==n&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),r}},1494:(t,e)=>{"use strict";function n(t,e,n,r){for(var i=t[e++],o=1<>=u,c-=u,m!==o){if(m===a)break;for(var b=mo;)_=p[_]>>8,++y;var v=_;if(f+y+(b!==m?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[f++]=v;var w=f+=y;for(b!==m&&(n[f++]=v),_=b;y--;)_=p[_],n[--w]=255&_,_>>=8;null!==g&&s<4096&&(p[s++]=g<<8|v,s>=l+1&&u<12&&(++u,l=l<<1|1)),g=m}else s=a+1,l=(1<<(u=i+1))-1,g=null}return f!==r&&console.log("Warning, gif stream shorter than expected."),n}try{e.GifWriter=function(t,e,n,r){var i=0,o=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(e<=0||n<=0||e>65535||n>65535)throw new Error("Width/Height invalid.");function s(t){var e=t.length;if(e<2||e>256||e&e-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return e}t[i++]=71,t[i++]=73,t[i++]=70,t[i++]=56,t[i++]=57,t[i++]=97;var u=0,l=0;if(null!==a){for(var c=s(a);c>>=1;)++u;if(c=1<=c)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&n,t[i++]=n>>8&255,t[i++]=(null!==a?128:0)|u,t[i++]=l,t[i++]=0,null!==a)for(var h=0,f=a.length;h>16&255,t[i++]=d>>8&255,t[i++]=255&d}if(null!==o){if(o<0||o>65535)throw new Error("Loop count invalid.");t[i++]=33,t[i++]=255,t[i++]=11,t[i++]=78,t[i++]=69,t[i++]=84,t[i++]=83,t[i++]=67,t[i++]=65,t[i++]=80,t[i++]=69,t[i++]=50,t[i++]=46,t[i++]=48,t[i++]=3,t[i++]=1,t[i++]=255&o,t[i++]=o>>8&255,t[i++]=0}var p=!1;this.addFrame=function(e,n,r,o,u,l){if(!0===p&&(--i,p=!1),l=void 0===l?{}:l,e<0||n<0||e>65535||n>65535)throw new Error("x/y invalid.");if(r<=0||o<=0||r>65535||o>65535)throw new Error("Width/Height invalid.");if(u.length>=1;)++d;f=1<3)throw new Error("Disposal out of range.");var b=!1,y=0;if(void 0!==l.transparent&&null!==l.transparent&&(b=!0,(y=l.transparent)<0||y>=f))throw new Error("Transparent color index.");if((0!==m||b||0!==g)&&(t[i++]=33,t[i++]=249,t[i++]=4,t[i++]=m<<2|(!0===b?1:0),t[i++]=255&g,t[i++]=g>>8&255,t[i++]=y,t[i++]=0),t[i++]=44,t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&n,t[i++]=n>>8&255,t[i++]=255&r,t[i++]=r>>8&255,t[i++]=255&o,t[i++]=o>>8&255,t[i++]=!0===c?128|d-1:0,!0===c)for(var _=0,v=h.length;_>16&255,t[i++]=w>>8&255,t[i++]=255&w}return i=function(t,e,n,r){t[e++]=n;var i=e++,o=1<=n;)t[e++]=255&h,h>>=8,c-=8,e===i+256&&(t[i]=255,i=e++)}function d(t){h|=t<=8;)t[e++]=255&h,h>>=8,c-=8,e===i+256&&(t[i]=255,i=e++);4096===u?(d(o),u=s+1,l=n+1,g={}):(u>=1<>7,s=1<<1+(7&o);t[e++],t[e++];var u=null,l=null;a&&(u=e,l=s,e+=3*s);var c=!0,h=[],f=0,d=null,p=0,g=null;for(this.width=r,this.height=i;c&&e=0))throw Error("Invalid block size");if(0===I)break;e+=I}break;case 249:if(4!==t[e++]||0!==t[e+4])throw new Error("Invalid graphics extension block.");var m=t[e++];f=t[e++]|t[e++]<<8,d=t[e++],0==(1&m)&&(d=null),p=m>>2&7,e++;break;case 254:for(;;){if(!((I=t[e++])>=0))throw Error("Invalid block size");if(0===I)break;e+=I}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var b=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,v=t[e++]|t[e++]<<8,w=t[e++],x=w>>6&1,T=1<<1+(7&w),E=u,S=l,A=!1;w>>7&&(A=!0,E=e,S=T,e+=3*T);var O=e;for(e++;;){var I;if(!((I=t[e++])>=0))throw Error("Invalid block size");if(0===I)break;e+=I}h.push({x:b,y,width:_,height:v,has_local_palette:A,palette_offset:E,palette_size:S,data_offset:O,data_length:e-O,transparent_index:d,interlaced:!!x,delay:f,disposal:p});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return h.length},this.loopCount=function(){return g},this.frameInfo=function(t){if(t<0||t>=h.length)throw new Error("Frame index out of range.");return h[t]},this.decodeAndBlitFrameBGRA=function(e,i){var o=this.frameInfo(e),a=o.width*o.height,s=new Uint8Array(a);n(t,o.data_offset,s,a);var u=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var c=o.width,h=r-c,f=c,d=4*(o.y*r+o.x),p=4*((o.y+o.height)*r+o.x),g=d,m=4*h;!0===o.interlaced&&(m+=4*r*7);for(var b=8,y=0,_=s.length;y<_;++y){var v=s[y];if(0===f&&(f=c,(g+=m)>=p&&(m=4*h+4*r*(b-1),g=d+(c+h)*(b<<1),b>>=1)),v===l)g+=4;else{var w=t[u+3*v],x=t[u+3*v+1],T=t[u+3*v+2];i[g++]=T,i[g++]=x,i[g++]=w,i[g++]=255}--f}},this.decodeAndBlitFrameRGBA=function(e,i){var o=this.frameInfo(e),a=o.width*o.height,s=new Uint8Array(a);n(t,o.data_offset,s,a);var u=o.palette_offset,l=o.transparent_index;null===l&&(l=256);var c=o.width,h=r-c,f=c,d=4*(o.y*r+o.x),p=4*((o.y+o.height)*r+o.x),g=d,m=4*h;!0===o.interlaced&&(m+=4*r*7);for(var b=8,y=0,_=s.length;y<_;++y){var v=s[y];if(0===f&&(f=c,(g+=m)>=p&&(m=4*h+4*r*(b-1),g=d+(c+h)*(b<<1),b>>=1)),v===l)g+=4;else{var w=t[u+3*v],x=t[u+3*v+1],T=t[u+3*v+2];i[g++]=w,i[g++]=x,i[g++]=T,i[g++]=255}--f}}}}catch(t){}},8412:(t,e,n)=>{"use strict";n.r(e),n.d(e,{InferenceSession:()=>p,Tensor:()=>f,env:()=>a,registerBackend:()=>o});const r={},i=[],o=(t,e,n)=>{if(!e||"function"!=typeof e.init||"function"!=typeof e.createSessionHandler)throw new TypeError("not a valid backend");{const o=r[t];if(void 0===o)r[t]={backend:e,priority:n};else{if(o.priority>n)return;if(o.priority===n&&o.backend!==e)throw new Error(`cannot register backend "${t}" using priority ${n}`)}if(n>=0){const e=i.indexOf(t);-1!==e&&i.splice(e,1);for(let e=0;e{let e=1;for(let n=0;n=r.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${r.byteLength}).`);if(u=t.byteLength-i,"number"==typeof n){if(u=n,!Number.isSafeInteger(u))throw new RangeError("'byteLength' must be an integer.");if(u<=0||i+u>r.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${r.byteLength-i}].`);if("object"==typeof o&&null!==o)s=o;else if(void 0!==o)throw new TypeError("'options' must be an object.")}else if(void 0!==n)throw new TypeError("'byteLength' must be a number.")}else if(void 0!==e)throw new TypeError("'options' must be an object.");a=new Uint8Array(r,i,u)}}const u=(s.executionProviders||[]).map((t=>"string"==typeof t?t:t.name)),l=await(async t=>{const e=0===t.length?i:t,n=[];for(const t of e){const e=r[t];if(e){if(e.initialized)return e.backend;if(e.aborted)continue;const r=!!e.initPromise;try{return r||(e.initPromise=e.backend.init()),await e.initPromise,e.initialized=!0,e.backend}catch(i){r||n.push({name:t,err:i}),e.aborted=!0}finally{delete e.initPromise}}}throw new Error(`no available backend found. ERR: ${n.map((t=>`[${t.name}] ${t.err}`)).join(", ")}`)})(u),c=await l.createSessionHandler(a,s);return new d(c)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}const p=d},8736:(module,__unused_webpack_exports,__webpack_require__)=>{var process=__webpack_require__(4155),t;self,t=__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(t,e,n)=>{var r,i=(r=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return D.buffer!=C&&q(D.buffer),L}function i(){return D.buffer!=C&&q(D.buffer),N}function o(){return D.buffer!=C&&q(D.buffer),B}function a(){return D.buffer!=C&&q(D.buffer),F}function s(){return D.buffer!=C&&q(D.buffer),j}var u,l,c;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){l=t,c=e}));var h,f,d,p,g,m,b=Object.assign({},u),y="./this.program",_=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,x="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,T=u.ENVIRONMENT_IS_PTHREAD||!1,E="";function S(t){return u.locateFile?u.locateFile(t,E):E+t}if(x){let e;E=w?n(908).dirname(E)+"/":"//",m=()=>{g||(p=n(1384),g=n(908))},h=function(t,e){return m(),t=g.normalize(t),p.readFileSync(t,e?void 0:"utf8")},d=t=>((t=h(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{m(),t=g.normalize(t),p.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(Q())throw process.exitCode=t,e;e instanceof lt||k("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(9925)}catch(t){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),t}n.g.Worker=e.Worker}else(v||w)&&(w?E=self.location.href:"undefined"!=typeof document&&document.currentScript&&(E=document.currentScript.src),r&&(E=r),E=0!==E.indexOf("blob:")?E.substr(0,E.replace(/[?#].*/,"").lastIndexOf("/")+1):"",x||(h=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(d=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));x&&"undefined"==typeof performance&&(n.g.performance=n(6953).performance);var A=console.log.bind(console),O=console.warn.bind(console);x&&(m(),A=t=>p.writeSync(1,t+"\n"),O=t=>p.writeSync(2,t+"\n"));var I,P=u.print||A,k=u.printErr||O;Object.assign(u,b),b=null,u.thisProgram&&(y=u.thisProgram),u.quit&&(_=u.quit),u.wasmBinary&&(I=u.wasmBinary);var M=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&ot("no native wasm support detected");var D,R,C,L,N,B,F,j,U=!1,$="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else r+=String.fromCharCode(i)}return r}function G(t,e){return(t>>>=0)?z(i(),t,e):""}function V(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var o=0;o=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o)),127>=a){if(n>=r)break;e[n++>>>0]=a}else{if(2047>=a){if(n+1>=r)break;e[n++>>>0]=192|a>>6}else{if(65535>=a){if(n+2>=r)break;e[n++>>>0]=224|a>>12}else{if(n+3>=r)break;e[n++>>>0]=240|a>>18,e[n++>>>0]=128|a>>12&63}e[n++>>>0]=128|a>>6&63}e[n++>>>0]=128|63&a}}return e[n>>>0]=0,n-i}function H(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function q(t){C=t,u.HEAP8=L=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=B=new Int32Array(t),u.HEAPU8=N=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=F=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=j=new Float64Array(t)}T&&(C=u.buffer);var W=u.INITIAL_MEMORY||16777216;if(T)D=u.wasmMemory,C=u.buffer;else if(u.wasmMemory)D=u.wasmMemory;else if(!((D=new WebAssembly.Memory({initial:W/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw k("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),x&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");D&&(C=D.buffer),W=C.byteLength,q(C);var Y,X=[],Z=[],K=[],J=[];function Q(){return M||!1}function tt(){var t=u.preRun.shift();X.unshift(t)}var et,nt=0,rt=null,it=null;function ot(t){throw T?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),k(t="Aborted("+t+")"),U=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),c(t),t}function at(){return et.startsWith("data:application/octet-stream;base64,")}function st(){var t=et;try{if(t==et&&I)return new Uint8Array(I);if(d)return d(t);throw"both async and sync fetching of the wasm failed"}catch(t){ot(t)}}et="ort-wasm-threaded.wasm",at()||(et=S(et));var ut={};function lt(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function ct(t){(t=pt.Ja[t])||ot(),pt.Sa(t)}function ht(t){var e=pt.ab();if(!e)return 6;pt.Oa.push(e),pt.Ja[t.Ia]=e,e.Ia=t.Ia;var n={cmd:"run",start_routine:t.gb,arg:t.Ya,pthread_ptr:t.Ia};return e.Na=()=>{n.time=performance.now(),e.postMessage(n,t.lb)},e.loaded&&(e.Na(),delete e.Na),0}function ft(t){if(T)return zt(1,1,t);Q()||(pt.Ua(),u.onExit&&u.onExit(t),U=!0),_(t,new lt(t))}function dt(t,e){if(!e&&T)throw bt(t),"unwind";Q()||T||(ce(),gt(K),le(0),Jt[1].length&&Qt(1,10),Jt[2].length&&Qt(2,10),pt.Ua()),ft(t)}var pt={Ma:[],Oa:[],Wa:[],Ja:{},bb:function(){T&&pt.cb()},nb:function(){},cb:function(){pt.receiveObjectTransfer=pt.fb,pt.threadInitTLS=pt.Va,pt.setExitStatus=pt.Ta,M=!1},Ta:function(){},Ua:function(){for(var t of Object.values(pt.Ja))pt.Sa(t);for(t of pt.Ma)t.terminate();pt.Ma=[]},Sa:function(t){var e=t.Ia;delete pt.Ja[e],pt.Ma.push(t),pt.Oa.splice(pt.Oa.indexOf(t),1),t.Ia=0,ge(e)},fb:function(){},Va:function(){pt.Wa.forEach((t=>t()))},eb:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ia&&(pt.$a=t.Ia),n.targetThread&&n.targetThread!=se()){var i=pt.Ja[n.ob];i?i.postMessage(n,n.transferList):k('Internal error! Worker sent a message "'+r+'" to target pthread '+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?Nt(n.queue):"spawnThread"===r?ht(n):"cleanupThread"===r?ct(n.thread):"killThread"===r?(n=n.thread,r=pt.Ja[n],delete pt.Ja[n],r.terminate(),ge(n),pt.Oa.splice(pt.Oa.indexOf(r),1),r.Ia=0):"cancelThread"===r?pt.Ja[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.Na&&(t.Na(),delete t.Na)):"print"===r?P("Thread "+n.threadId+": "+n.text):"printErr"===r?k("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&k("worker sent an unknown command "+r);pt.$a=void 0},t.onerror=t=>{throw k("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},x&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||r,wasmMemory:D,wasmModule:R})},Xa:function(){var t=S("ort-wasm-threaded.worker.js");pt.Ma.push(new Worker(t))},ab:function(){return 0==pt.Ma.length&&(pt.Xa(),pt.eb(pt.Ma[0])),pt.Ma.pop()}};function gt(t){for(;0>2>>>0];t=o()[t+48>>2>>>0],be(e,e-t),_e(e)};var yt,_t,vt=[];function wt(t,e,n,r){return T?zt(3,1,t,e,n,r):xt(t,e,n,r)}function xt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return k("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var i=[];return T&&0===i.length?wt(t,e,n,r):(t={gb:n,Ia:t,Ya:r,lb:i},T?(t.mb="spawnThread",postMessage(t,i),0):ht(t))}function Tt(t,e,n){return T?zt(4,1,t,e,n):0}function Et(t,e){if(T)return zt(5,1,t,e)}function St(t,e){if(T)return zt(6,1,t,e)}function At(t,e,n){if(T)return zt(7,1,t,e,n)}function Ot(t,e,n){return T?zt(8,1,t,e,n):0}function It(t,e){if(T)return zt(9,1,t,e)}function Pt(t,e,n){if(T)return zt(10,1,t,e,n)}function kt(t,e,n,r){if(T)return zt(11,1,t,e,n,r)}function Mt(t,e,n,r){if(T)return zt(12,1,t,e,n,r)}function Dt(t,e,n,r){if(T)return zt(13,1,t,e,n,r)}function Rt(t){if(T)return zt(14,1,t)}function Ct(t,e){if(T)return zt(15,1,t,e)}function Lt(t,e,n){if(T)return zt(16,1,t,e,n)}function Nt(t){Atomics.store(o(),t>>2,1),se()&&pe(t),Atomics.compareExchange(o(),t>>2,1,0)}function Bt(t){return a()[t>>>2]+4294967296*o()[t+4>>>2]}function Ft(t,e,n,r,i,o){return T?zt(17,1,t,e,n,r,i,o):-52}function jt(t,e,n,r,i,o){if(T)return zt(18,1,t,e,n,r,i,o)}function Ut(t){var n=H(t)+1,r=ue(n);return r&&V(t,e(),r,n),r}function $t(t,e,n){function r(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}if(T)return zt(19,1,t,e,n);var i=(new Date).getFullYear(),s=new Date(i,0,1),u=new Date(i,6,1);i=s.getTimezoneOffset();var l=u.getTimezoneOffset(),c=Math.max(i,l);o()[t>>2>>>0]=60*c,o()[e>>2>>>0]=Number(i!=l),t=r(s),e=r(u),t=Ut(t),e=Ut(e),l>2>>>0]=t,a()[n+4>>2>>>0]=e):(a()[n>>2>>>0]=e,a()[n+4>>2>>>0]=t)}function zt(t,e){var n=arguments.length-2,r=arguments;return mt((()=>{for(var i=ve(8*n),o=i>>3,a=0;a>>0]=u}return de(t,n,i,e)}))}u.invokeEntryPoint=function(t,e){var n=vt[t];n||(t>=vt.length&&(vt.length=t+1),vt[t]=n=Y.get(t)),t=n(e),Q()?pt.Ta(t):me(t)},u.executeNotifiedProxyingQueue=Nt,_t=x?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:T?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var Gt,Vt=[],Ht={};function qt(){if(!Gt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:y||"./this.program"};for(t in Ht)void 0===Ht[t]?delete e[t]:e[t]=Ht[t];var n=[];for(t in e)n.push(t+"="+e[t]);Gt=n}return Gt}function Wt(t,n){if(T)return zt(20,1,t,n);var r=0;return qt().forEach((function(i,o){var s=n+r;for(o=a()[t+4*o>>2>>>0]=s,s=0;s>0>>>0]=i.charCodeAt(s);e()[o>>0>>>0]=0,r+=i.length+1})),0}function Yt(t,e){if(T)return zt(21,1,t,e);var n=qt();a()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),a()[e>>2>>>0]=r,0}function Xt(t){return T?zt(22,1,t):52}function Zt(t,e,n,r){return T?zt(23,1,t,e,n,r):52}function Kt(t,e,n,r,i){return T?zt(24,1,t,e,n,r,i):70}var Jt=[null,[],[]];function Qt(t,e){var n=Jt[t];0===e||10===e?((1===t?P:k)(z(n,0)),n.length=0):n.push(e)}function te(t,e,n,r){if(T)return zt(25,1,t,e,n,r);for(var o=0,s=0;s>2>>>0],l=a()[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);o+=l}return a()[r>>2>>>0]=o,0}function ee(t){return 0==t%4&&(0!=t%100||0==t%400)}var ne=[31,29,31,30,31,30,31,31,30,31,30,31],re=[31,28,31,30,31,30,31,31,30,31,30,31];function ie(t,n,r,i){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=l(new Date(t.getFullYear(),0,4)),n=l(n),0>=u(e,t)?0>=u(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var h=o()[i+40>>2>>>0];for(var f in i={jb:o()[i>>2>>>0],ib:o()[i+4>>2>>>0],Pa:o()[i+8>>2>>>0],Ra:o()[i+12>>2>>>0],Qa:o()[i+16>>2>>>0],La:o()[i+20>>2>>>0],Ha:o()[i+24>>2>>>0],Ka:o()[i+28>>2>>>0],pb:o()[i+32>>2>>>0],hb:o()[i+36>>2>>>0],kb:h?G(h):""},r=G(r),h={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(f,"g"),h[f]);var d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(f in h={"%a":function(t){return d[t.Ha].substring(0,3)},"%A":function(t){return d[t.Ha]},"%b":function(t){return p[t.Qa].substring(0,3)},"%B":function(t){return p[t.Qa]},"%C":function(t){return s((t.La+1900)/100|0,2)},"%d":function(t){return s(t.Ra,2)},"%e":function(t){return a(t.Ra,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return s(t.Pa,2)},"%I":function(t){return 0==(t=t.Pa)?t=12:12t.Pa?"AM":"PM"},"%S":function(t){return s(t.jb,2)},"%t":function(){return"\t"},"%u":function(t){return t.Ha||7},"%U":function(t){return s(Math.floor((t.Ka+7-t.Ha)/7),2)},"%V":function(t){var e=Math.floor((t.Ka+7-(t.Ha+6)%7)/7);if(2>=(t.Ha+371-t.Ka-2)%7&&e++,e)53==e&&(4==(n=(t.Ha+371-t.Ka)%7)||3==n&&ee(t.La)||(e=1));else{e=52;var n=(t.Ha+7-t.Ka-1)%7;(4==n||5==n&&ee(t.La%400-1))&&e++}return s(e,2)},"%w":function(t){return t.Ha},"%W":function(t){return s(Math.floor((t.Ka+7-(t.Ha+6)%7)/7),2)},"%y":function(t){return(t.La+1900).toString().substring(2)},"%Y":function(t){return t.La+1900},"%z":function(t){var e=0<=(t=t.hb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.kb},"%%":function(){return"%"}},r=r.replace(/%%/g,"\0\0"),h)r.includes(f)&&(r=r.replace(new RegExp(f,"g"),h[f](i)));return f=function(t){var e=Array(H(t)+1);return V(t,e,0,e.length),e}(r=r.replace(/\0\0/g,"%")),f.length>n?0:(function(t,n){e().set(t,n>>>0)}(f,t),f.length-1)}pt.bb();var oe=[null,ft,bt,wt,Tt,Et,St,At,Ot,It,Pt,kt,Mt,Dt,Rt,Ct,Lt,Ft,jt,$t,Wt,Yt,Xt,Zt,Kt,te],ae={L:function(t){he(t,!w,1,!v),pt.Va()},h:function(t){T?postMessage({cmd:"cleanupThread",thread:t}):ct(t)},D:xt,e:Tt,S:Et,z:St,B:At,s:Ot,Q:It,I:Pt,P:kt,k:Mt,A:Dt,w:Rt,R:Ct,y:Lt,p:function(){},j:function(){ot("To use dlopen, you need enable dynamic linking, see ")},x:function(){ot("To use dlopen, you need enable dynamic linking, see ")},l:function(){return Date.now()},E:function(){return 2097152},U:function(){return!0},F:function(t,e,n,r){if(t==e)setTimeout((()=>Nt(r)));else if(T)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=pt.Ja[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},K:function(){return-1},V:function(t,e){t=new Date(1e3*Bt(t)),o()[e>>2>>>0]=t.getUTCSeconds(),o()[e+4>>2>>>0]=t.getUTCMinutes(),o()[e+8>>2>>>0]=t.getUTCHours(),o()[e+12>>2>>>0]=t.getUTCDate(),o()[e+16>>2>>>0]=t.getUTCMonth(),o()[e+20>>2>>>0]=t.getUTCFullYear()-1900,o()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,o()[e+28>>2>>>0]=t},m:function(t,e){t=new Date(1e3*Bt(t)),o()[e>>2>>>0]=t.getSeconds(),o()[e+4>>2>>>0]=t.getMinutes(),o()[e+8>>2>>>0]=t.getHours(),o()[e+12>>2>>>0]=t.getDate(),o()[e+16>>2>>>0]=t.getMonth(),o()[e+20>>2>>>0]=t.getFullYear()-1900,o()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;o()[e+28>>2>>>0]=r,o()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),o()[e+32>>2>>>0]=t},n:function(t){var e=new Date(o()[t+20>>2>>>0]+1900,o()[t+16>>2>>>0],o()[t+12>>2>>>0],o()[t+8>>2>>>0],o()[t+4>>2>>>0],o()[t>>2>>>0],0),n=o()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),u=Math.min(s,a);return 0>n?o()[t+32>>2>>>0]=Number(a!=s&&u==r):0>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,o()[t+28>>2>>>0]=n,o()[t>>2>>>0]=e.getSeconds(),o()[t+4>>2>>>0]=e.getMinutes(),o()[t+8>>2>>>0]=e.getHours(),o()[t+12>>2>>>0]=e.getDate(),o()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},G:Ft,H:jt,o:function t(e,n,r){t.Za||(t.Za=!0,$t(e,n,r))},b:function(){ot("")},i:function(){if(!x&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";yt||(yt={}),yt[t]||(yt[t]=1,x&&(t="warning: "+t),k(t))}},u:function(){return 4294901760},c:_t,O:function(t,e,n){i().copyWithin(t>>>0,e>>>0,e+n>>>0)},v:function(){return x?n(3993).cpus().length:navigator.hardwareConcurrency},J:function(t,e,n){Vt.length=e,n>>=3;for(var r=0;r>>0];return(0>t?ut[-t-1]:oe[t]).apply(null,Vt)},t:function(t){var e=i().length;if((t>>>=0)<=e||4294901760=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var o=Math;r=Math.max(t,r),o=o.min.call(o,4294901760,r+(65536-r%65536)%65536);t:{try{D.grow(o-C.byteLength+65535>>>16),q(D.buffer);var a=1;break t}catch(t){}a=void 0}if(a)return!0}return!1},T:function(){throw"unwind"},M:Wt,N:Yt,C:dt,d:Xt,g:Zt,q:Kt,f:te,a:D||u.wasmMemory,W:ie,r:function(t,e,n,r){return ie(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,pt.Wa.push(u.asm.ua),Y=u.asm.wa,Z.unshift(u.asm.X),R=e,T||(nt--,u.monitorRunDependencies&&u.monitorRunDependencies(nt),0==nt&&(null!==rt&&(clearInterval(rt),rt=null),it&&(t=it,it=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!I&&(v||w)){if("function"==typeof fetch&&!et.startsWith("file://"))return fetch(et,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+et+"'";return t.arrayBuffer()})).catch((function(){return st()}));if(f)return new Promise((function(t,e){f(et,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return st()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){k("failed to asynchronously prepare wasm: "+t),ot(t)}))}var r={a:ae};if(T||(nt++,u.monitorRunDependencies&&u.monitorRunDependencies(nt)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return k("Module.instantiateWasm callback failed with error: "+t),!1}(I||"function"!=typeof WebAssembly.instantiateStreaming||at()||et.startsWith("file://")||x||"function"!=typeof fetch?n(e):fetch(et,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return k("wasm streaming compile failed: "+t),k("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(c)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.X).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Y).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Z).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm._).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.$).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm.aa).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.ba).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ca).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.da).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.ea).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.fa).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.ga).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.ha).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.ia).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.ja).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ka).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.la).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.ma).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.na).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.oa).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.pa).apply(null,arguments)};var se=u._pthread_self=function(){return(se=u._pthread_self=u.asm.qa).apply(null,arguments)},ue=u._malloc=function(){return(ue=u._malloc=u.asm.ra).apply(null,arguments)};u._free=function(){return(u._free=u.asm.sa).apply(null,arguments)};var le=u._fflush=function(){return(le=u._fflush=u.asm.ta).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.ua).apply(null,arguments)};var ce=u.___funcs_on_exit=function(){return(ce=u.___funcs_on_exit=u.asm.va).apply(null,arguments)},he=u.__emscripten_thread_init=function(){return(he=u.__emscripten_thread_init=u.asm.xa).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.ya).apply(null,arguments)};var fe,de=u._emscripten_run_in_main_runtime_thread_js=function(){return(de=u._emscripten_run_in_main_runtime_thread_js=u.asm.za).apply(null,arguments)},pe=u.__emscripten_proxy_execute_task_queue=function(){return(pe=u.__emscripten_proxy_execute_task_queue=u.asm.Aa).apply(null,arguments)},ge=u.__emscripten_thread_free_data=function(){return(ge=u.__emscripten_thread_free_data=u.asm.Ba).apply(null,arguments)},me=u.__emscripten_thread_exit=function(){return(me=u.__emscripten_thread_exit=u.asm.Ca).apply(null,arguments)},be=u._emscripten_stack_set_limits=function(){return(be=u._emscripten_stack_set_limits=u.asm.Da).apply(null,arguments)},ye=u.stackSave=function(){return(ye=u.stackSave=u.asm.Ea).apply(null,arguments)},_e=u.stackRestore=function(){return(_e=u.stackRestore=u.asm.Fa).apply(null,arguments)},ve=u.stackAlloc=function(){return(ve=u.stackAlloc=u.asm.Ga).apply(null,arguments)};function we(){function t(){if(!fe&&(fe=!0,u.calledRun=!0,!U)&&(T||gt(Z),l(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!T)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();J.unshift(t)}gt(J)}}if(!(0{var r,i=(r=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,i,o;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){i=t,o=e}));var a,s,u,l,c,h,f=Object.assign({},e),d="./this.program",p="object"==typeof window,g="function"==typeof importScripts,m="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,b="";m?(b=g?n(908).dirname(b)+"/":"//",h=()=>{c||(l=n(1384),c=n(908))},a=function(t,e){return h(),t=c.normalize(t),l.readFileSync(t,e?void 0:"utf8")},u=t=>((t=a(t,!0)).buffer||(t=new Uint8Array(t)),t),s=(t,e,n)=>{h(),t=c.normalize(t),l.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},g&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),s=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var y,_=e.print||console.log.bind(console),v=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(d=e.thisProgram),e.wasmBinary&&(y=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&z("no native wasm support detected");var w,x,T,E,S,A,O=!1,I="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function P(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else r+=String.fromCharCode(i)}return r}function k(t,e){return(t>>>=0)?P(E,t,e):""}function M(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var o=0;o=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o)),127>=a){if(n>=r)break;e[n++>>>0]=a}else{if(2047>=a){if(n+1>=r)break;e[n++>>>0]=192|a>>6}else{if(65535>=a){if(n+2>=r)break;e[n++>>>0]=224|a>>12}else{if(n+3>=r)break;e[n++>>>0]=240|a>>18,e[n++>>>0]=128|a>>12&63}e[n++>>>0]=128|a>>6&63}e[n++>>>0]=128|63&a}}return e[n>>>0]=0,n-i}function D(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function R(){var t=w.buffer;x=t,e.HEAP8=T=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=S=new Int32Array(t),e.HEAPU8=E=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=A=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var C=[],L=[],N=[];function B(){var t=e.preRun.shift();C.unshift(t)}var F,j=0,U=null,$=null;function z(t){throw e.onAbort&&e.onAbort(t),v(t="Aborted("+t+")"),O=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),o(t),t}function G(){return F.startsWith("data:application/octet-stream;base64,")}if(F="ort-wasm.wasm",!G()){var V=F;F=e.locateFile?e.locateFile(V,b):b+V}function H(){var t=F;try{if(t==F&&y)return new Uint8Array(y);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){z(t)}}function q(t){for(;0t?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=a(e,t)?0>=a(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var l=S[r+40>>2>>>0];for(var c in r={ua:S[r>>2>>>0],ta:S[r+4>>2>>>0],oa:S[r+8>>2>>>0],qa:S[r+12>>2>>>0],pa:S[r+16>>2>>>0],na:S[r+20>>2>>>0],ia:S[r+24>>2>>>0],ma:S[r+28>>2>>>0],wa:S[r+32>>2>>>0],sa:S[r+36>>2>>>0],va:l?k(l):""},n=k(n),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(c,"g"),l[c]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),f="January February March April May June July August September October November December".split(" ");for(c in l={"%a":function(t){return h[t.ia].substring(0,3)},"%A":function(t){return h[t.ia]},"%b":function(t){return f[t.pa].substring(0,3)},"%B":function(t){return f[t.pa]},"%C":function(t){return o((t.na+1900)/100|0,2)},"%d":function(t){return o(t.qa,2)},"%e":function(t){return i(t.qa,2," ")},"%g":function(t){return u(t).toString().substring(2)},"%G":function(t){return u(t)},"%H":function(t){return o(t.oa,2)},"%I":function(t){return 0==(t=t.oa)?t=12:12t.oa?"AM":"PM"},"%S":function(t){return o(t.ua,2)},"%t":function(){return"\t"},"%u":function(t){return t.ia||7},"%U":function(t){return o(Math.floor((t.ma+7-t.ia)/7),2)},"%V":function(t){var e=Math.floor((t.ma+7-(t.ia+6)%7)/7);if(2>=(t.ia+371-t.ma-2)%7&&e++,e)53==e&&(4==(n=(t.ia+371-t.ma)%7)||3==n&&J(t.na)||(e=1));else{e=52;var n=(t.ia+7-t.ma-1)%7;(4==n||5==n&&J(t.na%400-1))&&e++}return o(e,2)},"%w":function(t){return t.ia},"%W":function(t){return o(Math.floor((t.ma+7-(t.ia+6)%7)/7),2)},"%y":function(t){return(t.na+1900).toString().substring(2)},"%Y":function(t){return t.na+1900},"%z":function(t){var e=0<=(t=t.sa);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.va},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),l)n.includes(c)&&(n=n.replace(new RegExp(c,"g"),l[c](r)));return c=function(t){var e=Array(D(t)+1);return M(t,e,0,e.length),e}(n=n.replace(/\0\0/g,"%")),c.length>e?0:(T.set(c,t>>>0),c.length-1)}var nt={d:function(){return 0},I:function(){},w:function(){},y:function(){},r:function(){return 0},G:function(){},B:function(){},F:function(){},h:function(){},x:function(){},t:function(){},H:function(){},v:function(){},n:function(){},u:function(){z("To use dlopen, you need enable dynamic linking, see ")},o:function(){z("To use dlopen, you need enable dynamic linking, see ")},i:function(){return Date.now()},J:function(){return!0},j:function(t,e){t=new Date(1e3*(A[t>>>2]+4294967296*S[t+4>>>2])),S[e>>2>>>0]=t.getUTCSeconds(),S[e+4>>2>>>0]=t.getUTCMinutes(),S[e+8>>2>>>0]=t.getUTCHours(),S[e+12>>2>>>0]=t.getUTCDate(),S[e+16>>2>>>0]=t.getUTCMonth(),S[e+20>>2>>>0]=t.getUTCFullYear()-1900,S[e+24>>2>>>0]=t.getUTCDay(),S[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},k:function(t,e){t=new Date(1e3*(A[t>>>2]+4294967296*S[t+4>>>2])),S[e>>2>>>0]=t.getSeconds(),S[e+4>>2>>>0]=t.getMinutes(),S[e+8>>2>>>0]=t.getHours(),S[e+12>>2>>>0]=t.getDate(),S[e+16>>2>>>0]=t.getMonth(),S[e+20>>2>>>0]=t.getFullYear()-1900,S[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);S[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,S[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),S[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},l:function(t){var e=new Date(S[t+20>>2>>>0]+1900,S[t+16>>2>>>0],S[t+12>>2>>>0],S[t+8>>2>>>0],S[t+4>>2>>>0],S[t>>2>>>0],0),n=S[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),a=i.getTimezoneOffset(),s=Math.min(a,o);return 0>n?S[t+32>>2>>>0]=Number(o!=a&&s==r):0>2>>>0]=e.getDay(),S[t+28>>2>>>0]=(e.getTime()-i.getTime())/864e5|0,S[t>>2>>>0]=e.getSeconds(),S[t+4>>2>>>0]=e.getMinutes(),S[t+8>>2>>>0]=e.getHours(),S[t+12>>2>>>0]=e.getDate(),S[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},z:function(){return-52},A:function(){},m:function t(e,n,r){t.ra||(t.ra=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}var i=(new Date).getFullYear(),o=new Date(i,0,1),a=new Date(i,6,1);i=o.getTimezoneOffset();var s=a.getTimezoneOffset();S[t>>2>>>0]=60*Math.max(i,s),S[e>>2>>>0]=Number(i!=s),t=r(o),e=r(a),t=W(t),e=W(e),s>2>>>0]=t,A[n+4>>2>>>0]=e):(A[n>>2>>>0]=e,A[n+4>>2>>>0]=t)}(e,n,r))},a:function(){z("")},s:function(){return 4294901760},e:m?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),E:function(t,e,n){E.copyWithin(t>>>0,e>>>0,e+n>>>0)},b:function(t){var e=E.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var i=Math;r=Math.max(t,r),i=i.min.call(i,4294901760,r+(65536-r%65536)%65536);t:{try{w.grow(i-x.byteLength+65535>>>16),R();var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},C:function(t,e){var n=0;return X().forEach((function(r,i){var o=e+n;for(i=A[t+4*i>>2>>>0]=o,o=0;o>0>>>0]=r.charCodeAt(o);T[i>>0>>>0]=0,n+=r.length+1})),0},D:function(t,e){var n=X();A[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),A[e>>2>>>0]=r,0},c:function(){return 52},g:function(){return 52},p:function(){return 70},f:function(t,e,n,r){for(var i=0,o=0;o>2>>>0],s=A[e+4>>2>>>0];e+=8;for(var u=0;u>>0],c=K[t];0===l||10===l?((1===t?_:v)(P(c,0)),c.length=0):c.push(l)}i+=s}return A[r>>2>>>0]=i,0},K:et,q:function(t,e,n,r){return et(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,w=e.asm.L,R(),L.unshift(e.asm.M),j--,e.monitorRunDependencies&&e.monitorRunDependencies(j),0==j&&(null!==U&&(clearInterval(U),U=null),$&&(t=$,$=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!y&&(p||g)){if("function"==typeof fetch&&!F.startsWith("file://"))return fetch(F,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+F+"'";return t.arrayBuffer()})).catch((function(){return H()}));if(s)return new Promise((function(t,e){s(F,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return H()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){v("failed to asynchronously prepare wasm: "+t),z(t)}))}var i={a:nt};if(j++,e.monitorRunDependencies&&e.monitorRunDependencies(j),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return v("Module.instantiateWasm callback failed with error: "+t),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||G()||F.startsWith("file://")||m||"function"!=typeof fetch?r(n):fetch(F,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return v("wasm streaming compile failed: "+t),v("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(o)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.M).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.N).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.O).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.P).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Q).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.R).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.S).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.T).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.U).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.V).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.W).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.X).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Y).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Z).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm._).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm.$).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.aa).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ba).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.ca).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.da).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.ea).apply(null,arguments)};var rt=e._malloc=function(){return(rt=e._malloc=e.asm.fa).apply(null,arguments)};e._free=function(){return(e._free=e.asm.ga).apply(null,arguments)},e._fflush=function(){return(e._fflush=e.asm.ha).apply(null,arguments)};var it,ot=e.stackSave=function(){return(ot=e.stackSave=e.asm.ja).apply(null,arguments)},at=e.stackRestore=function(){return(at=e.stackRestore=e.asm.ka).apply(null,arguments)},st=e.stackAlloc=function(){return(st=e.stackAlloc=e.asm.la).apply(null,arguments)};function ut(){function t(){if(!it&&(it=!0,e.calledRun=!0,!O)){if(q(L),i(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();N.unshift(t)}q(N)}}if(!(0{"use strict";t.exports=function(t,e){for(var n=new Array(arguments.length-1),r=0,i=2,o=!0;i{"use strict";var n=e;n.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&"="===t.charAt(e);)++n;return Math.ceil(3*t.length)/4-n};for(var r=new Array(64),i=new Array(123),o=0;o<64;)i[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(t,e,n){for(var i,o=null,a=[],s=0,u=0;e>2],i=(3&l)<<4,u=1;break;case 1:a[s++]=r[i|l>>4],i=(15&l)<<2,u=2;break;case 2:a[s++]=r[i|l>>6],a[s++]=r[63&l],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=r[i],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var a="invalid encoding";n.decode=function(t,e,n){for(var r,o=n,s=0,u=0;u1)break;if(void 0===(l=i[l]))throw Error(a);switch(s){case 0:r=l,s=1;break;case 1:e[n++]=r<<2|(48&l)>>4,r=l,s=2;break;case 2:e[n++]=(15&r)<<4|(60&l)>>2,r=l,s=3;break;case 3:e[n++]=(3&r)<<6|l,s=0}}if(1===s)throw Error(a);return n-o},n.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},9211:t=>{"use strict";function e(){this._listeners={}}t.exports=e,e.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this},e.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var n=this._listeners[t],r=0;r{"use strict";function e(t){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),n=new Uint8Array(e.buffer),r=128===n[3];function i(t,r,i){e[0]=t,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function o(t,r,i){e[0]=t,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function a(t,r){return n[0]=t[r],n[1]=t[r+1],n[2]=t[r+2],n[3]=t[r+3],e[0]}function s(t,r){return n[3]=t[r],n[2]=t[r+1],n[1]=t[r+2],n[0]=t[r+3],e[0]}t.writeFloatLE=r?i:o,t.writeFloatBE=r?o:i,t.readFloatLE=r?a:s,t.readFloatBE=r?s:a}():function(){function e(t,e,n,r){var i=e<0?1:0;if(i&&(e=-e),0===e)t(1/e>0?0:2147483648,n,r);else if(isNaN(e))t(2143289344,n,r);else if(e>34028234663852886e22)t((i<<31|2139095040)>>>0,n,r);else if(e<11754943508222875e-54)t((i<<31|Math.round(e/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(e)/Math.LN2);t((i<<31|o+127<<23|8388607&Math.round(e*Math.pow(2,-o)*8388608))>>>0,n,r)}}function a(t,e,n){var r=t(e,n),i=2*(r>>31)+1,o=r>>>23&255,a=8388607&r;return 255===o?a?NaN:i*(1/0):0===o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(a+8388608)}t.writeFloatLE=e.bind(null,n),t.writeFloatBE=e.bind(null,r),t.readFloatLE=a.bind(null,i),t.readFloatBE=a.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),n=new Uint8Array(e.buffer),r=128===n[7];function i(t,r,i){e[0]=t,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(t,r,i){e[0]=t,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function a(t,r){return n[0]=t[r],n[1]=t[r+1],n[2]=t[r+2],n[3]=t[r+3],n[4]=t[r+4],n[5]=t[r+5],n[6]=t[r+6],n[7]=t[r+7],e[0]}function s(t,r){return n[7]=t[r],n[6]=t[r+1],n[5]=t[r+2],n[4]=t[r+3],n[3]=t[r+4],n[2]=t[r+5],n[1]=t[r+6],n[0]=t[r+7],e[0]}t.writeDoubleLE=r?i:o,t.writeDoubleBE=r?o:i,t.readDoubleLE=r?a:s,t.readDoubleBE=r?s:a}():function(){function e(t,e,n,r,i,o){var a=r<0?1:0;if(a&&(r=-r),0===r)t(0,i,o+e),t(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))t(0,i,o+e),t(2146959360,i,o+n);else if(r>17976931348623157e292)t(0,i,o+e),t((a<<31|2146435072)>>>0,i,o+n);else{var s;if(r<22250738585072014e-324)t((s=r/5e-324)>>>0,i,o+e),t((a<<31|s/4294967296)>>>0,i,o+n);else{var u=Math.floor(Math.log(r)/Math.LN2);1024===u&&(u=1023),t(4503599627370496*(s=r*Math.pow(2,-u))>>>0,i,o+e),t((a<<31|u+1023<<20|1048576*s&1048575)>>>0,i,o+n)}}}function a(t,e,n,r,i){var o=t(r,i+e),a=t(r,i+n),s=2*(a>>31)+1,u=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===u?l?NaN:s*(1/0):0===u?5e-324*s*l:s*Math.pow(2,u-1075)*(l+4503599627370496)}t.writeDoubleLE=e.bind(null,n,0,4),t.writeDoubleBE=e.bind(null,r,4,0),t.readDoubleLE=a.bind(null,i,0,4),t.readDoubleBE=a.bind(null,o,4,0)}(),t}function n(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}function r(t,e,n){e[n]=t>>>24,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=255&t}function i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function o(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}t.exports=e(e)},7199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},6662:t=>{"use strict";t.exports=function(t,e,n){var r=n||8192,i=r>>>1,o=null,a=r;return function(n){if(n<1||n>i)return t(n);a+n>r&&(o=t(r),a=0);var s=e.call(o,a,a+=n);return 7&a&&(a=1+(7|a)),s}}},4997:(t,e)=>{"use strict";var n=e;n.length=function(t){for(var e=0,n=0,r=0;r191&&r<224?o[a++]=(31&r)<<6|63&t[e++]:r>239&&r<365?(r=((7&r)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[a++]=55296+(r>>10),o[a++]=56320+(1023&r)):o[a++]=(15&r)<<12|(63&t[e++])<<6|63&t[e++],a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},n.write=function(t,e,n){for(var r,i,o=n,a=0;a>6|192,e[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=t.charCodeAt(a+1)))?(r=65536+((1023&r)<<10)+(1023&i),++a,e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128);return n-o}},3442:(t,e)=>{"use strict";e.__esModule=!0;var n=function(){function t(e){if(!e)throw new TypeError("Invalid argument; `value` has no value.");this.value=t.EMPTY,e&&t.isGuid(e)&&(this.value=e)}return t.isGuid=function(e){var n=e.toString();return e&&(e instanceof t||t.validator.test(n))},t.create=function(){return new t([t.gen(2),t.gen(1),t.gen(1),t.gen(1),t.gen(3)].join("-"))},t.createEmpty=function(){return new t("emptyguid")},t.parse=function(e){return new t(e)},t.raw=function(){return[t.gen(2),t.gen(1),t.gen(1),t.gen(1),t.gen(3)].join("-")},t.gen=function(t){for(var e="",n=0;n{t.exports=n;var e=null;try{e=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(t){}function n(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function r(t){return!0===(t&&t.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var i={},o={};function a(t,e){var n,r,a;return e?(a=0<=(t>>>=0)&&t<256)&&(r=o[t])?r:(n=u(t,(0|t)<0?-1:0,!0),a&&(o[t]=n),n):(a=-128<=(t|=0)&&t<128)&&(r=i[t])?r:(n=u(t,t<0?-1:0,!1),a&&(i[t]=n),n)}function s(t,e){if(isNaN(t))return e?b:m;if(e){if(t<0)return b;if(t>=d)return x}else{if(t<=-p)return T;if(t+1>=p)return w}return t<0?s(-t,e).neg():u(t%f|0,t/f|0,e)}function u(t,e,r){return new n(t,e,r)}n.fromInt=a,n.fromNumber=s,n.fromBits=u;var l=Math.pow;function c(t,e,n){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return m;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return c(t.substring(1),e,n).neg();for(var i=s(l(n,8)),o=m,a=0;a>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},E.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((o=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},E.isOdd=function(){return 1==(1&this.low)},E.isEven=function(){return 0==(1&this.low)},E.equals=function(t){return r(t)||(t=h(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},E.eq=E.equals,E.notEquals=function(t){return!this.eq(t)},E.neq=E.notEquals,E.ne=E.notEquals,E.lessThan=function(t){return this.comp(t)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(t){return this.comp(t)<=0},E.lte=E.lessThanOrEqual,E.le=E.lessThanOrEqual,E.greaterThan=function(t){return this.comp(t)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(t){return this.comp(t)>=0},E.gte=E.greaterThanOrEqual,E.ge=E.greaterThanOrEqual,E.compare=function(t){if(r(t)||(t=h(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(y)},E.neg=E.negate,E.add=function(t){r(t)||(t=h(t));var e=this.high>>>16,n=65535&this.high,i=this.low>>>16,o=65535&this.low,a=t.high>>>16,s=65535&t.high,l=t.low>>>16,c=0,f=0,d=0,p=0;return d+=(p+=o+(65535&t.low))>>>16,f+=(d+=i+l)>>>16,c+=(f+=n+s)>>>16,c+=e+a,u((d&=65535)<<16|(p&=65535),(c&=65535)<<16|(f&=65535),this.unsigned)},E.subtract=function(t){return r(t)||(t=h(t)),this.add(t.neg())},E.sub=E.subtract,E.multiply=function(t){if(this.isZero())return m;if(r(t)||(t=h(t)),e)return u(e.mul(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned);if(t.isZero())return m;if(this.eq(T))return t.isOdd()?T:m;if(t.eq(T))return this.isOdd()?T:m;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(g)&&t.lt(g))return s(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,l=t.high>>>16,c=65535&t.high,f=t.low>>>16,d=65535&t.low,p=0,b=0,y=0,_=0;return y+=(_+=a*d)>>>16,b+=(y+=o*d)>>>16,y&=65535,b+=(y+=a*f)>>>16,p+=(b+=i*d)>>>16,b&=65535,p+=(b+=o*f)>>>16,b&=65535,p+=(b+=a*c)>>>16,p+=n*d+i*f+o*c+a*l,u((y&=65535)<<16|(_&=65535),(p&=65535)<<16|(b&=65535),this.unsigned)},E.mul=E.multiply,E.divide=function(t){if(r(t)||(t=h(t)),t.isZero())throw Error("division by zero");var n,i,o;if(e)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?u((this.unsigned?e.div_u:e.div_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:m;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return b;if(t.gt(this.shru(1)))return _;o=b}else{if(this.eq(T))return t.eq(y)||t.eq(v)?T:t.eq(T)?y:(n=this.shr(1).div(t).shl(1)).eq(m)?t.isNegative()?y:v:(i=this.sub(t.mul(n)),o=n.add(i.div(t)));if(t.eq(T))return this.unsigned?b:m;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=m}for(i=this;i.gte(t);){n=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:l(2,a-48),f=s(n),d=f.mul(t);d.isNegative()||d.gt(i);)d=(f=s(n-=c,this.unsigned)).mul(t);f.isZero()&&(f=y),o=o.add(f),i=i.sub(d)}return o},E.div=E.divide,E.modulo=function(t){return r(t)||(t=h(t)),e?u((this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},E.mod=E.modulo,E.rem=E.modulo,E.not=function(){return u(~this.low,~this.high,this.unsigned)},E.and=function(t){return r(t)||(t=h(t)),u(this.low&t.low,this.high&t.high,this.unsigned)},E.or=function(t){return r(t)||(t=h(t)),u(this.low|t.low,this.high|t.high,this.unsigned)},E.xor=function(t){return r(t)||(t=h(t)),u(this.low^t.low,this.high^t.high,this.unsigned)},E.shiftLeft=function(t){return r(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low<>>32-t,this.unsigned):u(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):u(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},E.shr=E.shiftRight,E.shiftRightUnsigned=function(t){if(r(t)&&(t=t.toInt()),0==(t&=63))return this;var e=this.high;return t<32?u(this.low>>>t|e<<32-t,e>>>t,this.unsigned):u(32===t?e:e>>>t-32,0,this.unsigned)},E.shru=E.shiftRightUnsigned,E.shr_u=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},E.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},E.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},E.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},n.fromBytes=function(t,e,r){return r?n.fromBytesLE(t,e):n.fromBytesBE(t,e)},n.fromBytesLE=function(t,e){return new n(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},n.fromBytesBE=function(t,e){return new n(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},1446:(t,e,n)=>{"use strict";var r,i,o,a=n(2100),s=a.Reader,u=a.Writer,l=a.util,c=a.roots.default||(a.roots.default={});c.onnx=((o={}).Version=(r={},(i=Object.create(r))[r[0]="_START_VERSION"]=0,i[r[1]="IR_VERSION_2017_10_10"]=1,i[r[2]="IR_VERSION_2017_10_30"]=2,i[r[3]="IR_VERSION_2017_11_3"]=3,i[r[4]="IR_VERSION_2019_1_22"]=4,i[r[5]="IR_VERSION"]=5,i),o.AttributeProto=function(){function t(t){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],t)for(var e=Object.keys(t),n=0;n>>3){case 1:r.name=t.string();break;case 21:r.refAttrName=t.string();break;case 13:r.docString=t.string();break;case 20:r.type=t.int32();break;case 2:r.f=t.float();break;case 3:r.i=t.int64();break;case 4:r.s=t.bytes();break;case 5:r.t=c.onnx.TensorProto.decode(t,t.uint32());break;case 6:r.g=c.onnx.GraphProto.decode(t,t.uint32());break;case 7:if(r.floats&&r.floats.length||(r.floats=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos>>0,t.i.high>>>0).toNumber())),null!=t.s&&("string"==typeof t.s?l.base64.decode(t.s,e.s=l.newBuffer(l.base64.length(t.s)),0):t.s.length&&(e.s=t.s)),null!=t.t){if("object"!=typeof t.t)throw TypeError(".onnx.AttributeProto.t: object expected");e.t=c.onnx.TensorProto.fromObject(t.t)}if(null!=t.g){if("object"!=typeof t.g)throw TypeError(".onnx.AttributeProto.g: object expected");e.g=c.onnx.GraphProto.fromObject(t.g)}if(t.floats){if(!Array.isArray(t.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");e.floats=[];for(var n=0;n>>0,t.ints[n].high>>>0).toNumber())}if(t.strings){if(!Array.isArray(t.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(e.strings=[],n=0;n>>0,t.i.high>>>0).toNumber():t.i),null!=t.s&&t.hasOwnProperty("s")&&(n.s=e.bytes===String?l.base64.encode(t.s,0,t.s.length):e.bytes===Array?Array.prototype.slice.call(t.s):t.s),null!=t.t&&t.hasOwnProperty("t")&&(n.t=c.onnx.TensorProto.toObject(t.t,e)),null!=t.g&&t.hasOwnProperty("g")&&(n.g=c.onnx.GraphProto.toObject(t.g,e)),t.floats&&t.floats.length){n.floats=[];for(var i=0;i>>0,t.ints[i].high>>>0).toNumber():t.ints[i];if(t.strings&&t.strings.length)for(n.strings=[],i=0;i>>3){case 1:r.name=t.string();break;case 2:r.type=c.onnx.TypeProto.decode(t,t.uint32());break;case 3:r.docString=t.string();break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.name&&t.hasOwnProperty("name")&&!l.isString(t.name))return"name: string expected";if(null!=t.type&&t.hasOwnProperty("type")){var e=c.onnx.TypeProto.verify(t.type);if(e)return"type."+e}return null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString)?"docString: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.ValueInfoProto)return t;var e=new c.onnx.ValueInfoProto;if(null!=t.name&&(e.name=String(t.name)),null!=t.type){if("object"!=typeof t.type)throw TypeError(".onnx.ValueInfoProto.type: object expected");e.type=c.onnx.TypeProto.fromObject(t.type)}return null!=t.docString&&(e.docString=String(t.docString)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.name="",n.type=null,n.docString=""),null!=t.name&&t.hasOwnProperty("name")&&(n.name=t.name),null!=t.type&&t.hasOwnProperty("type")&&(n.type=c.onnx.TypeProto.toObject(t.type,e)),null!=t.docString&&t.hasOwnProperty("docString")&&(n.docString=t.docString),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.NodeProto=function(){function t(t){if(this.input=[],this.output=[],this.attribute=[],t)for(var e=Object.keys(t),n=0;n>>3){case 1:r.input&&r.input.length||(r.input=[]),r.input.push(t.string());break;case 2:r.output&&r.output.length||(r.output=[]),r.output.push(t.string());break;case 3:r.name=t.string();break;case 4:r.opType=t.string();break;case 7:r.domain=t.string();break;case 5:r.attribute&&r.attribute.length||(r.attribute=[]),r.attribute.push(c.onnx.AttributeProto.decode(t,t.uint32()));break;case 6:r.docString=t.string();break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.input&&t.hasOwnProperty("input")){if(!Array.isArray(t.input))return"input: array expected";for(var e=0;e>>3){case 1:r.irVersion=t.int64();break;case 8:r.opsetImport&&r.opsetImport.length||(r.opsetImport=[]),r.opsetImport.push(c.onnx.OperatorSetIdProto.decode(t,t.uint32()));break;case 2:r.producerName=t.string();break;case 3:r.producerVersion=t.string();break;case 4:r.domain=t.string();break;case 5:r.modelVersion=t.int64();break;case 6:r.docString=t.string();break;case 7:r.graph=c.onnx.GraphProto.decode(t,t.uint32());break;case 14:r.metadataProps&&r.metadataProps.length||(r.metadataProps=[]),r.metadataProps.push(c.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.irVersion&&t.hasOwnProperty("irVersion")&&!(l.isInteger(t.irVersion)||t.irVersion&&l.isInteger(t.irVersion.low)&&l.isInteger(t.irVersion.high)))return"irVersion: integer|Long expected";if(null!=t.opsetImport&&t.hasOwnProperty("opsetImport")){if(!Array.isArray(t.opsetImport))return"opsetImport: array expected";for(var e=0;e>>0,t.irVersion.high>>>0).toNumber())),t.opsetImport){if(!Array.isArray(t.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");e.opsetImport=[];for(var n=0;n>>0,t.modelVersion.high>>>0).toNumber())),null!=t.docString&&(e.docString=String(t.docString)),null!=t.graph){if("object"!=typeof t.graph)throw TypeError(".onnx.ModelProto.graph: object expected");e.graph=c.onnx.GraphProto.fromObject(t.graph)}if(t.metadataProps){if(!Array.isArray(t.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(e.metadataProps=[],n=0;n>>0,t.irVersion.high>>>0).toNumber():t.irVersion),null!=t.producerName&&t.hasOwnProperty("producerName")&&(n.producerName=t.producerName),null!=t.producerVersion&&t.hasOwnProperty("producerVersion")&&(n.producerVersion=t.producerVersion),null!=t.domain&&t.hasOwnProperty("domain")&&(n.domain=t.domain),null!=t.modelVersion&&t.hasOwnProperty("modelVersion")&&("number"==typeof t.modelVersion?n.modelVersion=e.longs===String?String(t.modelVersion):t.modelVersion:n.modelVersion=e.longs===String?l.Long.prototype.toString.call(t.modelVersion):e.longs===Number?new l.LongBits(t.modelVersion.low>>>0,t.modelVersion.high>>>0).toNumber():t.modelVersion),null!=t.docString&&t.hasOwnProperty("docString")&&(n.docString=t.docString),null!=t.graph&&t.hasOwnProperty("graph")&&(n.graph=c.onnx.GraphProto.toObject(t.graph,e)),t.opsetImport&&t.opsetImport.length){n.opsetImport=[];for(var i=0;i>>3){case 1:r.key=t.string();break;case 2:r.value=t.string();break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.key&&t.hasOwnProperty("key")&&!l.isString(t.key)?"key: string expected":null!=t.value&&t.hasOwnProperty("value")&&!l.isString(t.value)?"value: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.StringStringEntryProto)return t;var e=new c.onnx.StringStringEntryProto;return null!=t.key&&(e.key=String(t.key)),null!=t.value&&(e.value=String(t.value)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.key="",n.value=""),null!=t.key&&t.hasOwnProperty("key")&&(n.key=t.key),null!=t.value&&t.hasOwnProperty("value")&&(n.value=t.value),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.TensorAnnotation=function(){function t(t){if(this.quantParameterTensorNames=[],t)for(var e=Object.keys(t),n=0;n>>3){case 1:r.tensorName=t.string();break;case 2:r.quantParameterTensorNames&&r.quantParameterTensorNames.length||(r.quantParameterTensorNames=[]),r.quantParameterTensorNames.push(c.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.tensorName&&t.hasOwnProperty("tensorName")&&!l.isString(t.tensorName))return"tensorName: string expected";if(null!=t.quantParameterTensorNames&&t.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(t.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var e=0;e>>3){case 1:r.node&&r.node.length||(r.node=[]),r.node.push(c.onnx.NodeProto.decode(t,t.uint32()));break;case 2:r.name=t.string();break;case 5:r.initializer&&r.initializer.length||(r.initializer=[]),r.initializer.push(c.onnx.TensorProto.decode(t,t.uint32()));break;case 10:r.docString=t.string();break;case 11:r.input&&r.input.length||(r.input=[]),r.input.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 12:r.output&&r.output.length||(r.output=[]),r.output.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 13:r.valueInfo&&r.valueInfo.length||(r.valueInfo=[]),r.valueInfo.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 14:r.quantizationAnnotation&&r.quantizationAnnotation.length||(r.quantizationAnnotation=[]),r.quantizationAnnotation.push(c.onnx.TensorAnnotation.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.node&&t.hasOwnProperty("node")){if(!Array.isArray(t.node))return"node: array expected";for(var e=0;e>>3){case 1:if(r.dims&&r.dims.length||(r.dims=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos>>0,t.dims[n].high>>>0).toNumber())}if(null!=t.dataType&&(e.dataType=0|t.dataType),null!=t.segment){if("object"!=typeof t.segment)throw TypeError(".onnx.TensorProto.segment: object expected");e.segment=c.onnx.TensorProto.Segment.fromObject(t.segment)}if(t.floatData){if(!Array.isArray(t.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(e.floatData=[],n=0;n>>0,t.int64Data[n].high>>>0).toNumber())}if(null!=t.name&&(e.name=String(t.name)),null!=t.docString&&(e.docString=String(t.docString)),null!=t.rawData&&("string"==typeof t.rawData?l.base64.decode(t.rawData,e.rawData=l.newBuffer(l.base64.length(t.rawData)),0):t.rawData.length&&(e.rawData=t.rawData)),t.externalData){if(!Array.isArray(t.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(e.externalData=[],n=0;n>>0,t.uint64Data[n].high>>>0).toNumber(!0))}return e},t.toObject=function(t,e){e||(e={});var n={};if((e.arrays||e.defaults)&&(n.dims=[],n.floatData=[],n.int32Data=[],n.stringData=[],n.int64Data=[],n.doubleData=[],n.uint64Data=[],n.externalData=[]),e.defaults&&(n.dataType=0,n.segment=null,n.name="",e.bytes===String?n.rawData="":(n.rawData=[],e.bytes!==Array&&(n.rawData=l.newBuffer(n.rawData))),n.docString="",n.dataLocation=e.enums===String?"DEFAULT":0),t.dims&&t.dims.length){n.dims=[];for(var r=0;r>>0,t.dims[r].high>>>0).toNumber():t.dims[r]}if(null!=t.dataType&&t.hasOwnProperty("dataType")&&(n.dataType=t.dataType),null!=t.segment&&t.hasOwnProperty("segment")&&(n.segment=c.onnx.TensorProto.Segment.toObject(t.segment,e)),t.floatData&&t.floatData.length)for(n.floatData=[],r=0;r>>0,t.int64Data[r].high>>>0).toNumber():t.int64Data[r];if(null!=t.name&&t.hasOwnProperty("name")&&(n.name=t.name),null!=t.rawData&&t.hasOwnProperty("rawData")&&(n.rawData=e.bytes===String?l.base64.encode(t.rawData,0,t.rawData.length):e.bytes===Array?Array.prototype.slice.call(t.rawData):t.rawData),t.doubleData&&t.doubleData.length)for(n.doubleData=[],r=0;r>>0,t.uint64Data[r].high>>>0).toNumber(!0):t.uint64Data[r];if(null!=t.docString&&t.hasOwnProperty("docString")&&(n.docString=t.docString),t.externalData&&t.externalData.length)for(n.externalData=[],r=0;r>>3){case 1:r.begin=t.int64();break;case 2:r.end=t.int64();break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.begin&&t.hasOwnProperty("begin")&&!(l.isInteger(t.begin)||t.begin&&l.isInteger(t.begin.low)&&l.isInteger(t.begin.high))?"begin: integer|Long expected":null!=t.end&&t.hasOwnProperty("end")&&!(l.isInteger(t.end)||t.end&&l.isInteger(t.end.low)&&l.isInteger(t.end.high))?"end: integer|Long expected":null},t.fromObject=function(t){if(t instanceof c.onnx.TensorProto.Segment)return t;var e=new c.onnx.TensorProto.Segment;return null!=t.begin&&(l.Long?(e.begin=l.Long.fromValue(t.begin)).unsigned=!1:"string"==typeof t.begin?e.begin=parseInt(t.begin,10):"number"==typeof t.begin?e.begin=t.begin:"object"==typeof t.begin&&(e.begin=new l.LongBits(t.begin.low>>>0,t.begin.high>>>0).toNumber())),null!=t.end&&(l.Long?(e.end=l.Long.fromValue(t.end)).unsigned=!1:"string"==typeof t.end?e.end=parseInt(t.end,10):"number"==typeof t.end?e.end=t.end:"object"==typeof t.end&&(e.end=new l.LongBits(t.end.low>>>0,t.end.high>>>0).toNumber())),e},t.toObject=function(t,e){e||(e={});var n={};if(e.defaults){if(l.Long){var r=new l.Long(0,0,!1);n.begin=e.longs===String?r.toString():e.longs===Number?r.toNumber():r}else n.begin=e.longs===String?"0":0;l.Long?(r=new l.Long(0,0,!1),n.end=e.longs===String?r.toString():e.longs===Number?r.toNumber():r):n.end=e.longs===String?"0":0}return null!=t.begin&&t.hasOwnProperty("begin")&&("number"==typeof t.begin?n.begin=e.longs===String?String(t.begin):t.begin:n.begin=e.longs===String?l.Long.prototype.toString.call(t.begin):e.longs===Number?new l.LongBits(t.begin.low>>>0,t.begin.high>>>0).toNumber():t.begin),null!=t.end&&t.hasOwnProperty("end")&&("number"==typeof t.end?n.end=e.longs===String?String(t.end):t.end:n.end=e.longs===String?l.Long.prototype.toString.call(t.end):e.longs===Number?new l.LongBits(t.end.low>>>0,t.end.high>>>0).toNumber():t.end),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),t.DataLocation=function(){var t={},e=Object.create(t);return e[t[0]="DEFAULT"]=0,e[t[1]="EXTERNAL"]=1,e}(),t}(),o.TensorShapeProto=function(){function t(t){if(this.dim=[],t)for(var e=Object.keys(t),n=0;n>>3==1?(r.dim&&r.dim.length||(r.dim=[]),r.dim.push(c.onnx.TensorShapeProto.Dimension.decode(t,t.uint32()))):t.skipType(7&i)}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.dim&&t.hasOwnProperty("dim")){if(!Array.isArray(t.dim))return"dim: array expected";for(var e=0;e>>3){case 1:r.dimValue=t.int64();break;case 2:r.dimParam=t.string();break;case 3:r.denotation=t.string();break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";var e={};if(null!=t.dimValue&&t.hasOwnProperty("dimValue")&&(e.value=1,!(l.isInteger(t.dimValue)||t.dimValue&&l.isInteger(t.dimValue.low)&&l.isInteger(t.dimValue.high))))return"dimValue: integer|Long expected";if(null!=t.dimParam&&t.hasOwnProperty("dimParam")){if(1===e.value)return"value: multiple values";if(e.value=1,!l.isString(t.dimParam))return"dimParam: string expected"}return null!=t.denotation&&t.hasOwnProperty("denotation")&&!l.isString(t.denotation)?"denotation: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.TensorShapeProto.Dimension)return t;var e=new c.onnx.TensorShapeProto.Dimension;return null!=t.dimValue&&(l.Long?(e.dimValue=l.Long.fromValue(t.dimValue)).unsigned=!1:"string"==typeof t.dimValue?e.dimValue=parseInt(t.dimValue,10):"number"==typeof t.dimValue?e.dimValue=t.dimValue:"object"==typeof t.dimValue&&(e.dimValue=new l.LongBits(t.dimValue.low>>>0,t.dimValue.high>>>0).toNumber())),null!=t.dimParam&&(e.dimParam=String(t.dimParam)),null!=t.denotation&&(e.denotation=String(t.denotation)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.denotation=""),null!=t.dimValue&&t.hasOwnProperty("dimValue")&&("number"==typeof t.dimValue?n.dimValue=e.longs===String?String(t.dimValue):t.dimValue:n.dimValue=e.longs===String?l.Long.prototype.toString.call(t.dimValue):e.longs===Number?new l.LongBits(t.dimValue.low>>>0,t.dimValue.high>>>0).toNumber():t.dimValue,e.oneofs&&(n.value="dimValue")),null!=t.dimParam&&t.hasOwnProperty("dimParam")&&(n.dimParam=t.dimParam,e.oneofs&&(n.value="dimParam")),null!=t.denotation&&t.hasOwnProperty("denotation")&&(n.denotation=t.denotation),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),t}(),o.TypeProto=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n>>3){case 1:r.tensorType=c.onnx.TypeProto.Tensor.decode(t,t.uint32());break;case 6:r.denotation=t.string();break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.tensorType&&t.hasOwnProperty("tensorType")){var e=c.onnx.TypeProto.Tensor.verify(t.tensorType);if(e)return"tensorType."+e}return null!=t.denotation&&t.hasOwnProperty("denotation")&&!l.isString(t.denotation)?"denotation: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.TypeProto)return t;var e=new c.onnx.TypeProto;if(null!=t.tensorType){if("object"!=typeof t.tensorType)throw TypeError(".onnx.TypeProto.tensorType: object expected");e.tensorType=c.onnx.TypeProto.Tensor.fromObject(t.tensorType)}return null!=t.denotation&&(e.denotation=String(t.denotation)),e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.denotation=""),null!=t.tensorType&&t.hasOwnProperty("tensorType")&&(n.tensorType=c.onnx.TypeProto.Tensor.toObject(t.tensorType,e),e.oneofs&&(n.value="tensorType")),null!=t.denotation&&t.hasOwnProperty("denotation")&&(n.denotation=t.denotation),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t.Tensor=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n>>3){case 1:r.elemType=t.int32();break;case 2:r.shape=c.onnx.TensorShapeProto.decode(t,t.uint32());break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.elemType&&t.hasOwnProperty("elemType")&&!l.isInteger(t.elemType))return"elemType: integer expected";if(null!=t.shape&&t.hasOwnProperty("shape")){var e=c.onnx.TensorShapeProto.verify(t.shape);if(e)return"shape."+e}return null},t.fromObject=function(t){if(t instanceof c.onnx.TypeProto.Tensor)return t;var e=new c.onnx.TypeProto.Tensor;if(null!=t.elemType&&(e.elemType=0|t.elemType),null!=t.shape){if("object"!=typeof t.shape)throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");e.shape=c.onnx.TensorShapeProto.fromObject(t.shape)}return e},t.toObject=function(t,e){e||(e={});var n={};return e.defaults&&(n.elemType=0,n.shape=null),null!=t.elemType&&t.hasOwnProperty("elemType")&&(n.elemType=t.elemType),null!=t.shape&&t.hasOwnProperty("shape")&&(n.shape=c.onnx.TensorShapeProto.toObject(t.shape,e)),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),t}(),o.OperatorSetIdProto=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n>>3){case 1:r.domain=t.string();break;case 2:r.version=t.int64();break;default:t.skipType(7&i)}}return r},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.domain&&t.hasOwnProperty("domain")&&!l.isString(t.domain)?"domain: string expected":null!=t.version&&t.hasOwnProperty("version")&&!(l.isInteger(t.version)||t.version&&l.isInteger(t.version.low)&&l.isInteger(t.version.high))?"version: integer|Long expected":null},t.fromObject=function(t){if(t instanceof c.onnx.OperatorSetIdProto)return t;var e=new c.onnx.OperatorSetIdProto;return null!=t.domain&&(e.domain=String(t.domain)),null!=t.version&&(l.Long?(e.version=l.Long.fromValue(t.version)).unsigned=!1:"string"==typeof t.version?e.version=parseInt(t.version,10):"number"==typeof t.version?e.version=t.version:"object"==typeof t.version&&(e.version=new l.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber())),e},t.toObject=function(t,e){e||(e={});var n={};if(e.defaults)if(n.domain="",l.Long){var r=new l.Long(0,0,!1);n.version=e.longs===String?r.toString():e.longs===Number?r.toNumber():r}else n.version=e.longs===String?"0":0;return null!=t.domain&&t.hasOwnProperty("domain")&&(n.domain=t.domain),null!=t.version&&t.hasOwnProperty("version")&&("number"==typeof t.version?n.version=e.longs===String?String(t.version):t.version:n.version=e.longs===String?l.Long.prototype.toString.call(t.version):e.longs===Number?new l.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber():t.version),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o),t.exports=c},2100:(t,e,n)=>{"use strict";t.exports=n(9482)},9482:(t,e,n)=>{"use strict";var r=e;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(1173),r.BufferWriter=n(3155),r.Reader=n(1408),r.BufferReader=n(593),r.util=n(9693),r.rpc=n(5994),r.roots=n(5054),r.configure=i,i()},1408:(t,e,n)=>{"use strict";t.exports=u;var r,i=n(9693),o=i.LongBits,a=i.utf8;function s(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function u(t){this.buf=t,this.pos=0,this.len=t.length}var l,c="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new u(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new u(t);throw Error("illegal buffer")},h=function(){return i.Buffer?function(t){return(u.create=function(t){return i.Buffer.isBuffer(t)?new r(t):c(t)})(t)}:c};function f(){var t=new o(0,0),e=0;if(!(this.len-this.pos>4)){for(;e<3;++e){if(this.pos>=this.len)throw s(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw s(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function d(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw s(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}u.create=h(),u.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return d(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|d(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var t=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},u.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var t=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},u.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw s(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)},u.prototype.string=function(){var t=this.bytes();return a.read(t,0,t.length)},u.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw s(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},u._configure=function(t){r=t,u.create=h(),r._configure();var e=i.Long?"toLong":"toNumber";i.merge(u.prototype,{int64:function(){return f.call(this)[e](!1)},uint64:function(){return f.call(this)[e](!0)},sint64:function(){return f.call(this).zzDecode()[e](!1)},fixed64:function(){return p.call(this)[e](!0)},sfixed64:function(){return p.call(this)[e](!1)}})}},593:(t,e,n)=>{"use strict";t.exports=o;var r=n(1408);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(9693);function o(t){r.call(this,t)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},o._configure()},5054:t=>{"use strict";t.exports={}},5994:(t,e,n)=>{"use strict";e.Service=n(7948)},7948:(t,e,n)=>{"use strict";t.exports=i;var r=n(9693);function i(t,e,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function t(e,n,i,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return r.asPromise(t,s,e,n,i,o);if(s.rpcImpl)try{return s.rpcImpl(e,n[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(t,n){if(t)return s.emit("error",t,e),a(t);if(null!==n){if(!(n instanceof i))try{n=i[s.responseDelimited?"decodeDelimited":"decode"](n)}catch(t){return s.emit("error",t,e),a(t)}return s.emit("data",n,e),a(null,n)}s.end(!0)}))}catch(t){return s.emit("error",t,e),void setTimeout((function(){a(t)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},i.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(t,e,n)=>{"use strict";t.exports=i;var r=n(9693);function i(t,e){this.lo=t>>>0,this.hi=e>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var a=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return o;var e=t<0;e&&(t=-t);var n=t>>>0,r=(t-n)/4294967296>>>0;return e&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(t){if("number"==typeof t)return i.fromNumber(t);if(r.isString(t)){if(!r.Long)return i.fromNumber(parseInt(t,10));t=r.Long.fromString(t)}return t.low||t.high?new i(t.low>>>0,t.high>>>0):o},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(t){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var s=String.prototype.charCodeAt;i.fromHash=function(t){return t===a?o:new i((s.call(t,0)|s.call(t,1)<<8|s.call(t,2)<<16|s.call(t,3)<<24)>>>0,(s.call(t,4)|s.call(t,5)<<8|s.call(t,6)<<16|s.call(t,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}},9693:function(t,e,n){"use strict";var r=e;function i(t,e,n){for(var r=Object.keys(e),i=0;i0)},r.Buffer=function(){try{var t=r.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(t){return"number"==typeof t?r.Buffer?r._Buffer_allocUnsafe(t):new r.Array(t):r.Buffer?r._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(t){return t?r.LongBits.from(t).toHash():r.LongBits.zeroHash},r.longFromHash=function(t,e){var n=r.LongBits.fromHash(t);return r.Long?r.Long.fromBits(n.lo,n.hi,e):n.toNumber(Boolean(e))},r.merge=i,r.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(t){for(var e={},n=0;n-1;--n)if(1===e[t[n]]&&void 0!==this[t[n]]&&null!==this[t[n]])return t[n]}},r.oneOfSetter=function(t){return function(e){for(var n=0;n{"use strict";t.exports=h;var r,i=n(9693),o=i.LongBits,a=i.base64,s=i.utf8;function u(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}function l(){}function c(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function h(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var f=function(){return i.Buffer?function(){return(h.create=function(){return new r})()}:function(){return new h}};function d(t,e,n){e[n]=255&t}function p(t,e){this.len=t,this.next=void 0,this.val=e}function g(t,e,n){for(;t.hi;)e[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[n++]=127&t.lo|128,t.lo=t.lo>>>7;e[n++]=t.lo}function m(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}h.create=f(),h.alloc=function(t){return new i.Array(t)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(t,e,n){return this.tail=this.tail.next=new u(t,e,n),this.len+=e,this},p.prototype=Object.create(u.prototype),p.prototype.fn=function(t,e,n){for(;t>127;)e[n++]=127&t|128,t>>>=7;e[n]=t},h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new p((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},h.prototype.int32=function(t){return t<0?this._push(g,10,o.fromNumber(t)):this.uint32(t)},h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},h.prototype.uint64=function(t){var e=o.from(t);return this._push(g,e.length(),e)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(t){var e=o.from(t).zzEncode();return this._push(g,e.length(),e)},h.prototype.bool=function(t){return this._push(d,1,t?1:0)},h.prototype.fixed32=function(t){return this._push(m,4,t>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(t){var e=o.from(t);return this._push(m,4,e.lo)._push(m,4,e.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(t){return this._push(i.float.writeFloatLE,4,t)},h.prototype.double=function(t){return this._push(i.float.writeDoubleLE,8,t)};var b=i.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var r=0;r>>0;if(!e)return this._push(d,1,0);if(i.isString(t)){var n=h.alloc(e=a.length(t));a.decode(t,n,0),t=n}return this.uint32(e)._push(b,e,t)},h.prototype.string=function(t){var e=s.length(t);return e?this.uint32(e)._push(s.write,e,t):this._push(d,1,0)},h.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new u(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this},h.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e},h._configure=function(t){r=t,h.create=f(),r._configure()}},3155:(t,e,n)=>{"use strict";t.exports=o;var r=n(1173);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(9693);function o(){r.call(this)}function a(t,e,n){t.length<40?i.utf8.write(t,e,n):e.utf8Write?e.utf8Write(t,n):e.write(t,n)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var r=0;r>>0;return this.uint32(e),e&&this._push(o.writeBytesBuffer,e,t),this},o.prototype.string=function(t){var e=i.Buffer.byteLength(t);return this.uint32(e),e&&this._push(a,e,t),this},o._configure()},7714:(t,e,n)=>{"use strict";e.R=void 0;const r=n(6919),i=n(7448);e.R=new class{async init(){}async createSessionHandler(t,e){const n=new r.Session(e);return await n.loadModel(t),new i.OnnxjsSessionHandler(n)}}},4200:(t,e,n)=>{"use strict";e.c8=e.rX=void 0;const r=n(1670),i=n(5381),o=n(2157),a=n(2306);e.rX=()=>{if(("number"!=typeof r.env.wasm.initTimeout||r.env.wasm.initTimeout<0)&&(r.env.wasm.initTimeout=0),"boolean"!=typeof r.env.wasm.simd&&(r.env.wasm.simd=!0),"boolean"!=typeof r.env.wasm.proxy&&(r.env.wasm.proxy=!1),"number"!=typeof r.env.wasm.numThreads||!Number.isInteger(r.env.wasm.numThreads)||r.env.wasm.numThreads<=0){const t="undefined"==typeof navigator?(0,i.cpus)().length:navigator.hardwareConcurrency;r.env.wasm.numThreads=Math.min(4,Math.ceil((t||1)/2))}},e.c8=new class{async init(){(0,e.rX)(),await(0,o.initWasm)()}async createSessionHandler(t,e){const n=new a.OnnxruntimeWebAssemblySessionHandler;return await n.loadModel(t,e),Promise.resolve(n)}}},6018:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(1670),e);const o=n(1670);{const t=n(7714).R;(0,o.registerBackend)("webgl",t,-10)}{const t=n(4200).c8;(0,o.registerBackend)("cpu",t,10),(0,o.registerBackend)("wasm",t,10),(0,o.registerBackend)("xnnpack",t,9)}},246:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createAttributeWithCacheKey=void 0;class n{constructor(t){Object.assign(this,t)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map((t=>`${this[t]}`)).join(";")),this._cacheKey}}e.createAttributeWithCacheKey=t=>new n(t)},7778:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Attribute=void 0;const r=n(1446),i=n(9395),o=n(9162),a=n(2517);var s=i.onnxruntime.experimental.fbs;class u{constructor(t){if(this._attributes=new Map,null!=t){for(const e of t)e instanceof r.onnx.AttributeProto?this._attributes.set(e.name,[u.getValue(e),u.getType(e)]):e instanceof s.Attribute&&this._attributes.set(e.name(),[u.getValue(e),u.getType(e)]);if(this._attributes.sizeo.Tensor.fromProto(t)));if(t instanceof s.Attribute)return n.map((t=>o.Tensor.fromOrtTensor(t)))}if(e===r.onnx.AttributeProto.AttributeType.STRING&&t instanceof r.onnx.AttributeProto){const t=n;return(0,a.decodeUtf8String)(t)}return e===r.onnx.AttributeProto.AttributeType.STRINGS&&t instanceof r.onnx.AttributeProto?n.map(a.decodeUtf8String):n}static getValueNoCheck(t){return t instanceof r.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(t):this.getValueNoCheckFromOrtFormat(t)}static getValueNoCheckFromOnnxFormat(t){switch(t.type){case r.onnx.AttributeProto.AttributeType.FLOAT:return t.f;case r.onnx.AttributeProto.AttributeType.INT:return t.i;case r.onnx.AttributeProto.AttributeType.STRING:return t.s;case r.onnx.AttributeProto.AttributeType.TENSOR:return t.t;case r.onnx.AttributeProto.AttributeType.GRAPH:return t.g;case r.onnx.AttributeProto.AttributeType.FLOATS:return t.floats;case r.onnx.AttributeProto.AttributeType.INTS:return t.ints;case r.onnx.AttributeProto.AttributeType.STRINGS:return t.strings;case r.onnx.AttributeProto.AttributeType.TENSORS:return t.tensors;case r.onnx.AttributeProto.AttributeType.GRAPHS:return t.graphs;default:throw new Error(`unsupported attribute type: ${r.onnx.AttributeProto.AttributeType[t.type]}`)}}static getValueNoCheckFromOrtFormat(t){switch(t.type()){case s.AttributeType.FLOAT:return t.f();case s.AttributeType.INT:return t.i();case s.AttributeType.STRING:return t.s();case s.AttributeType.TENSOR:return t.t();case s.AttributeType.GRAPH:return t.g();case s.AttributeType.FLOATS:return t.floatsArray();case s.AttributeType.INTS:{const e=[];for(let n=0;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolveBackend=e.backend=void 0;const r=n(5038),i=new Map;async function o(t){const n=e.backend;if(void 0!==n[t]&&function(t){const e=t;return"initialize"in e&&"function"==typeof e.initialize&&"createSessionHandler"in e&&"function"==typeof e.createSessionHandler&&"dispose"in e&&"function"==typeof e.dispose}(n[t])){const e=n[t];let r=e.initialize();if("object"==typeof r&&"then"in r&&(r=await r),r)return i.set(t,e),e}}e.backend={webgl:new r.WebGLBackend},e.resolveBackend=async function t(e){if(!e)return t(["webgl"]);{const t="string"==typeof e?[e]:e;for(const e of t){const t=i.get(e);if(t)return t;const n=await o(e);if(n)return n}}throw new Error("no available backend to use")}},5038:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLBackend=void 0;const r=n(1670),i=n(6231),o=n(6416),a=n(7305);e.WebGLBackend=class{get contextId(){return r.env.webgl.contextId}set contextId(t){r.env.webgl.contextId=t}get matmulMaxBatchSize(){return r.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(t){r.env.webgl.matmulMaxBatchSize=t}get textureCacheMode(){return r.env.webgl.textureCacheMode}set textureCacheMode(t){r.env.webgl.textureCacheMode=t}get pack(){return r.env.webgl.pack}set pack(t){r.env.webgl.pack=t}get async(){return r.env.webgl.async}set async(t){r.env.webgl.async=t}initialize(){try{return this.glContext=(0,a.createWebGLContext)(this.contextId),"number"!=typeof this.matmulMaxBatchSize&&(this.matmulMaxBatchSize=16),"string"!=typeof this.textureCacheMode&&(this.textureCacheMode="full"),"boolean"!=typeof this.pack&&(this.pack=!1),"boolean"!=typeof this.async&&(this.async=!1),i.Logger.setWithEnv(r.env),i.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(t){return i.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${t}`),!1}}createSessionHandler(t){return new o.WebGLSessionHandler(this,t)}dispose(){this.glContext.dispose()}}},5107:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CoordsGlslLib=void 0;const r=n(2517),i=n(8520),o=n(5060),a=n(7859),s=n(9390);class u extends i.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new i.GlslLibRoutine("\n vec2 offsetToCoords(int offset, int width, int height) {\n int t = offset / width;\n int s = offset - t*width;\n vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height);\n return coords;\n }\n ")}}coordsToOffset(){return{coordsToOffset:new i.GlslLibRoutine("\n int coordsToOffset(vec2 coords, int width, int height) {\n float s = coords.s * float(width);\n float t = coords.t * float(height);\n int offset = int(t) * width + int(s);\n return offset;\n }\n ")}}getOutputSamplingSnippet(){const t=this.context.outputTextureLayout;return t.isPacked?this.getPackedOutputSamplingSnippet(t):this.getUnpackedOutputSamplingSnippet(t)}getPackedOutputSamplingSnippet(t){const e=t.unpackedShape,n=[t.width,t.height],r={},a="getOutputCoords";switch(e.length){case 0:r[a]=this.getOutputScalarCoords();break;case 1:r[a]=this.getOutputPacked1DCoords(e,n);break;case 2:r[a]=this.getOutputPacked2DCoords(e,n);break;case 3:r[a]=this.getOutputPacked3DCoords(e,n);break;default:r[a]=this.getOutputPackedNDCoords(e,n)}const s=`\n void setOutput(vec4 val) {\n ${(0,o.getGlsl)(this.context.glContext.version).output} = val;\n }\n `;return r.floatTextureSetRGBA=new i.GlslLibRoutine(s),r}getUnpackedOutputSamplingSnippet(t){const e=t.unpackedShape,n=[t.width,t.height],r={},a="getOutputCoords";switch(e.length){case 0:r[a]=this.getOutputScalarCoords();break;case 1:r[a]=this.getOutputUnpacked1DCoords(e,n);break;case 2:r[a]=this.getOutputUnpacked2DCoords(e,n);break;case 3:r[a]=this.getOutputUnpacked3DCoords(e,n);break;case 4:r[a]=this.getOutputUnpacked4DCoords(e,n);break;case 5:r[a]=this.getOutputUnpacked5DCoords(e,n);break;case 6:r[a]=this.getOutputUnpacked6DCoords(e,n);break;default:throw new Error(`Unsupported output dimensionality: ${e.length}`)}const s=`\n void setOutput(float val) {\n ${(0,o.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0);\n }\n `;return r.floatTextureSetR=new i.GlslLibRoutine(s),r}getOutputScalarCoords(){return new i.GlslLibRoutine("\n int getOutputCoords() {\n return 0;\n }\n ")}getOutputPacked1DCoords(t,e){const n=e;let r="";return 1===n[0]?(r=`\n int getOutputCoords() {\n return 2 * int(TexCoords.y * ${n[1]}.0);\n }\n `,new i.GlslLibRoutine(r)):1===n[1]?(r=`\n int getOutputCoords() {\n return 2 * int(TexCoords.x * ${n[0]}.0);\n }\n `,new i.GlslLibRoutine(r)):(r=`\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${n[0]}, ${n[1]}));\n return 2 * (resTexRC.y * ${n[0]} + resTexRC.x);\n }\n `,new i.GlslLibRoutine(r))}getOutputPacked2DCoords(t,e){let n="";if(r.ArrayUtil.arraysEqual(t,e))return n=`\n ivec2 getOutputCoords() {\n return 2 * ivec2(TexCoords.xy * vec2(${e[0]}, ${e[1]}));\n }\n `,new i.GlslLibRoutine(n);const o=e,a=Math.ceil(t[1]/2);return n=`\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${o[0]}, ${o[1]}));\n\n int index = resTexRC.y * ${o[0]} + resTexRC.x;\n\n // reverse r and c order for packed texture\n int r = imod(index, ${a}) * 2;\n int c = 2 * (index / ${a});\n\n return ivec2(r, c);\n }\n `,new i.GlslLibRoutine(n)}getOutputPacked3DCoords(t,e){const n=[e[0],e[1]],r=Math.ceil(t[2]/2),o=r*Math.ceil(t[1]/2),a=`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${n[0]}, ${n[1]}));\n int index = resTexRC.y * ${n[0]} + resTexRC.x;\n\n int b = index / ${o};\n index -= b * ${o};\n\n // reverse r and c order for packed texture\n int r = imod(index, ${r}) * 2;\n int c = 2 * (index / ${r});\n\n return ivec3(b, r, c);\n }\n `;return new i.GlslLibRoutine(a)}getOutputPackedNDCoords(t,e){const n=[e[0],e[1]],r=Math.ceil(t[t.length-1]/2),o=r*Math.ceil(t[t.length-2]/2);let a=o,s="",u="b, r, c";for(let e=2;e=0;--e)o[e]=o[e+1]*t[e+1];const a=["r","c","d"],s=o.map(((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`)).join("");return n=`\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${e[0]}, ${e[1]}));\n int index = resTexRC.y * ${e[0]} + resTexRC.x;\n ${s}\n return ivec3(r, c, d);\n }\n `,new i.GlslLibRoutine(n)}getOutputUnpacked4DCoords(t,e){let n="";const r=t.length;let o=null;r<2&&(o=[]),o=new Array(r-1),o[r-2]=t[r-1];for(let e=r-3;e>=0;--e)o[e]=o[e+1]*t[e+1];const a=["r","c","d","d2"],s=o.map(((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`)).join("");return n=`\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${e[0]}, ${e[1]}));\n int index = resTexRC.y * ${e[0]} + resTexRC.x;\n ${s}\n return ivec4(r, c, d, d2);\n }\n `,new i.GlslLibRoutine(n)}getOutputUnpacked5DCoords(t,e){let n="";const r=t.length;let o=null;r<2&&(o=[]),o=new Array(r-1),o[r-2]=t[r-1];for(let e=r-3;e>=0;--e)o[e]=o[e+1]*t[e+1];const a=["r","c","d","d2","d3"],s=o.map(((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`)).join("");return n=`\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${e[0]}, ${e[1]}));\n int index = resTexRC.y * ${e[0]} + resTexRC.x;\n ${s}\n return ivec5(r, c, d, d2, d3);\n }\n `,new i.GlslLibRoutine(n)}getOutputUnpacked6DCoords(t,e){let n="";const r=t.length;let o=null;r<2&&(o=[]),o=new Array(r-1),o[r-2]=t[r-1];for(let e=r-3;e>=0;--e)o[e]=o[e+1]*t[e+1];const a=["r","c","d","d2","d3","d4"],s=o.map(((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`)).join("");return n=`\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${e[0]}, ${e[1]}));\n int index = resTexRC.y * ${e[0]} + resTexRC.x;\n ${s}\n return ivec6(r, c, d, d2, d3, d4);\n }\n `,new i.GlslLibRoutine(n)}getCommonUtilFuncs(){const t={};let e="uvFromFlat";t[e]=new i.GlslLibRoutine("\n vec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texC = index / texNumR;\n int texR = index - texC * texNumR;\n // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to\n // v.\n return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC);\n }\n "),e="packedUVfrom1D",t[e]=new i.GlslLibRoutine("\n vec2 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 "),e="packedUVfrom2D",t[e]=new i.GlslLibRoutine("\n vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, 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 "),e="packedUVfrom3D",t[e]=new i.GlslLibRoutine("\n vec2 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 "),e="sampleTexture";const n=(0,o.getGlsl)(this.context.glContext.version);return t[e]=new i.GlslLibRoutine(`\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ${n.texture2D}(textureSampler, uv).r;\n }`),t}getInputsSamplingSnippets(){const t={},e=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach(((n,r)=>{const i=this.context.inputTextureLayouts[r],o=(0,s.generateShaderFuncNameFromInputSamplerName)(n);i.isPacked?t[o]=this.getPackedSamplerFromInput(o,n,i):t[o]=this.getUnpackedSamplerFromInput(o,n,i);const a=(0,s.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(n);i.unpackedShape.length<=e.unpackedShape.length&&(i.isPacked?t[a]=this.getPackedSamplerAtOutputCoords(a,i,e,n):t[a]=this.getUnpackedSamplerAtOutputCoords(a,i,e,n))})),t}getPackedSamplerAtOutputCoords(t,e,n,o){const a=e.unpackedShape,u=n.unpackedShape,l=o,c=(0,s.generateShaderFuncNameFromInputSamplerName)(l),h=a.length,f=u.length,d=r.BroadcastUtil.getBroadcastDims(a,u),p=(0,s.getCoordsDataType)(f),g=f-h;let m;const b=(0,s.getGlChannels)();m=0===h?"":f<2&&d.length>=1?"coords = 0;":d.map((t=>`coords.${b[t+g]} = 0;`)).join("\n");let y="";y=f<2&&h>0?"coords":a.map(((t,e)=>`coords.${b[e+g]}`)).join(", ");let _="return outputValue;";const v=1===r.ShapeUtil.size(a),w=1===r.ShapeUtil.size(u);if(1!==h||v||w){if(v&&!w)_=1===f?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(d.length){const t=h-2,e=h-1;d.indexOf(t)>-1&&d.indexOf(e)>-1?_="return vec4(outputValue.x);":d.indexOf(t)>-1?_="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":d.indexOf(e)>-1&&(_="return vec4(outputValue.xx, outputValue.zz);")}}else _="\n return vec4(outputValue.xy, outputValue.xy);\n ";const x=`\n vec4 ${t}() {\n ${p} coords = getOutputCoords();\n \n int lastDim = coords.${b[f-1]};\n coords.${b[f-1]} = coords.${b[f-2]};\n coords.${b[f-2]} = lastDim;\n \n ${m}\n vec4 outputValue = ${c}(${y});\n ${_}\n }\n `;return new i.GlslLibRoutine(x,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(t,e,n,o){const a=[n.width,n.height],u=[e.width,e.height],l=e.unpackedShape.length,c=n.unpackedShape.length,h=e.unpackedShape,f=n.unpackedShape,d=(0,s.generateShaderFuncNameFromInputSamplerName)(o);if(l===c&&r.ArrayUtil.arraysEqual(u,a)){const e=`\n float ${t}() {\n return sampleTexture(${o}, TexCoords);\n }\n `;return new i.GlslLibRoutine(e,["coordinates.sampleTexture"])}const p=(0,s.getCoordsDataType)(c),g=r.BroadcastUtil.getBroadcastDims(h,f),m=c-l;let b;const y=(0,s.getGlChannels)();b=0===l?"":c<2&&g.length>=1?"coords = 0;":g.map((t=>`coords.${y[t+m]} = 0;`)).join("\n");let _="";_=c<2&&l>0?"coords":e.unpackedShape.map(((t,e)=>`coords.${y[e+m]}`)).join(", ");const v=`\n float ${t}() {\n ${p} coords = getOutputCoords();\n ${b}\n return ${d}(${_});\n }\n `;return new i.GlslLibRoutine(v,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(t,e,n){switch(n.unpackedShape.length){case 0:return this.getPackedSamplerScalar(t,e);case 1:return this.getPackedSampler1D(t,e,n);case 2:return this.getPackedSampler2D(t,e,n);case 3:return this.getPackedSampler3D(t,e,n);default:return this.getPackedSamplerND(t,e,n)}}getUnpackedSamplerFromInput(t,e,n){const r=n.unpackedShape;switch(r.length){case 0:return this.getUnpackedSamplerScalar(t,e,n);case 1:return this.getUnpackedSampler1D(t,e,n);case 2:return this.getUnpackedSampler2D(t,e,n);case 3:return this.getUnpackedSampler3D(t,e,n);case 4:return this.getUnpackedSampler4D(t,e,n);case 5:return this.getUnpackedSampler5D(t,e,n);case 6:return this.getUnpackedSampler6D(t,e,n);default:throw new Error(`Unsupported dimension ${r.length}-D`)}}getPackedSamplerScalar(t,e){const n=`\n vec4 ${t}() {\n return ${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${e}, halfCR);\n }\n `;return new i.GlslLibRoutine(n)}getPackedSampler1D(t,e,n){const r=[n.width,n.height],a=[r[1],r[0]],s=(0,o.getGlsl)(this.context.glContext.version),u=`vec4 ${t}(int index) {\n vec2 uv = packedUVfrom1D(\n ${a[0]}, ${a[1]}, index);\n return ${s.texture2D}(${e}, uv);\n }`;return new i.GlslLibRoutine(u,["coordinates.packedUVfrom1D"])}getPackedSampler2D(t,e,n){const a=n.unpackedShape,s=[n.width,n.height],u=(0,o.getGlsl)(this.context.glContext.version),l=s[0],c=s[1];if(null!=s&&r.ArrayUtil.arraysEqual(a,s)){const n=`vec4 ${t}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${c}.0, ${l}.0);\n return ${u.texture2D}(${e}, uv);\n }`;return new i.GlslLibRoutine(n)}const h=s,f=Math.ceil(a[1]/2),d=`vec4 ${t}(int row, int col) {\n vec2 uv = packedUVfrom2D(${h[1]}, ${h[0]}, ${f}, row, col);\n return ${u.texture2D}(${e}, uv);\n }`;return new i.GlslLibRoutine(d,["coordinates.packedUVfrom2D"])}getPackedSampler3D(t,e,n){const r=n.unpackedShape,a=[n.width,n.height],u=[a[0],a[1]],l=(0,o.getGlsl)(this.context.glContext.version);if(1===r[0]){const o=r.slice(1),a=[1,2],u=(0,s.squeezeInputShape)(r,o),l=["b","row","col"],c=JSON.parse(JSON.stringify(n));c.unpackedShape=u;const h=this.getPackedSamplerFromInput(t,e,c),f=`${h.routineBody}\n vec4 ${t}(int b, int row, int col) {\n return ${t}(${(0,s.getSqueezedParams)(l,a)});\n } `;return new i.GlslLibRoutine(f,h.dependencies)}const c=u[0],h=u[1],f=Math.ceil(r[2]/2),d=`vec4 ${t}(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ${h}, ${c}, ${f*Math.ceil(r[1]/2)}, ${f}, b, row, col);\n return ${l.texture2D}(${e}, uv);}`;return new i.GlslLibRoutine(d,["coordinates.packedUVfrom3D"])}getPackedSamplerND(t,e,n){const r=n.unpackedShape,a=r.length,s=[n.width,n.height],u=(0,o.getGlsl)(this.context.glContext.version),l=[s[0],s[1]],c=l[1],h=l[0],f=Math.ceil(r[a-1]/2);let d=f*Math.ceil(r[a-2]/2),p="int b, int row, int col",g=`b * ${d} + (row / 2) * ${f} + (col / 2)`;for(let t=2;t{const r=this.context.inputTextureLayouts[n],o=(r.unpackedShape.length>0?r.unpackedShape:r.shape).length;let a=`_${e}`;t[a]=new i.GlslLibRoutine(this.getValueFromSingle(e,o,r.width,r.height,!1),[`shapeUtils.indicesToOffset${a}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),a+="_T",t[a]=new i.GlslLibRoutine(this.getValueFromSingle(e,o,r.width,r.height,!0),[`shapeUtils.indicesToOffset${a}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])})),t}getValueFromSingle(t,e,n,r,i){let a=`_${t}`;return i&&(a+="_T"),`\n float ${a}(int m[${e}]) {\n int offset = indicesToOffset${a}(m);\n vec2 coords = offsetToCoords(offset, ${n}, ${r});\n float value = getColorAsFloat(${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${t}, coords));\n return value;\n }\n `}getPackedValueFrom(t,e,n,r,i){let a=`_${t}_Pack`;return i&&(a+="_T"),`\n vec4 ${a}(int m[${e}]) {\n int offset = indicesToOffset_${t}(m);\n vec2 coords = offsetToCoords(offset, ${n}, ${r});\n return ${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${t}, coords);\n }\n `}}e.CoordsGlslLib=u},8520:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.TopologicalSortGlslRoutines=e.GlslLibRoutineNode=e.GlslLibRoutine=e.GlslLib=e.GlslContext=e.FunctionType=void 0,(n=e.FunctionType||(e.FunctionType={}))[n.ValueBased=0]="ValueBased",n[n.Positional=1]="Positional",e.GlslContext=class{constructor(t,e,n,r){this.glContext=t,this.programInfo=e,this.inputTextureLayouts=n,this.outputTextureLayout=r}},e.GlslLib=class{constructor(t){this.context=t}},e.GlslLibRoutine=class{constructor(t,e){this.routineBody=t,this.dependencies=e}},e.GlslLibRoutineNode=class{constructor(t,e,n){this.name=t,this.dependencies=n||[],e&&(this.routineBody=e)}addDependency(t){t&&this.dependencies.push(t)}},e.TopologicalSortGlslRoutines=class{static returnOrderedNodes(t){if(!t||0===t.length)return[];if(1===t.length)return t;const e=new Set,n=new Set,r=new Array;return this.createOrderedNodes(t,e,n,r),r}static createOrderedNodes(t,e,n,r){for(let i=0;i0)for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodingGlslLib=void 0;const r=n(8520);class i extends r.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new r.GlslLibRoutine("highp vec4 encode(highp float f) {\n return vec4(f, 0.0, 0.0, 0.0);\n }\n ")}}decodeFloat32(){return{decode:new r.GlslLibRoutine("highp float decode(highp vec4 rgba) {\n return rgba.r;\n }\n ")}}encodeUint8(){const t=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new r.GlslLibRoutine(`\n highp vec4 encode(highp float f) {\n highp float F = abs(f);\n highp float Sign = step(0.0,-f);\n highp float Exponent = floor(log2(F));\n highp float Mantissa = (exp2(- Exponent) * F);\n Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa));\n highp vec4 rgba;\n rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0));\n rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0);\n rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0)));\n rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0)));\n ${t}\n rgba = rgba / 255.0; // values need to be normalized to [0,1]\n return rgba;\n }\n `)}}decodeUint8(){const t=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new r.GlslLibRoutine(`\n highp float decode(highp vec4 rgba) {\n rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255]\n ${t}\n highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;\n highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0;\n highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);\n highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));\n return Result;\n }\n `)}}static isLittleEndian(){const t=new ArrayBuffer(4),e=new Uint32Array(t),n=new Uint8Array(t);if(e[0]=3735928559,239===n[0])return!0;if(222===n[0])return!1;throw new Error("unknown endianness")}}e.EncodingGlslLib=i},9894:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FragColorGlslLib=void 0;const r=n(8520),i=n(5060);class o extends r.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const t=(0,i.getGlsl)(this.context.glContext.version);return{setFragColor:new r.GlslLibRoutine(`\n void setFragColor(float value) {\n ${t.output} = encode(value);\n }\n `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new r.GlslLibRoutine("\n float getColorAsFloat(vec4 color) {\n return decode(color);\n }\n ",["encoding.decode"])}}}e.FragColorGlslLib=o},2848:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.replaceInlines=void 0;const n=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;e.replaceInlines=function(t){const e={};let r;for(;null!==(r=n.exec(t));){const t=r[3].split(",").map((t=>{const e=t.trim().split(" ");return e&&2===e.length?{type:e[0],name:e[1]}:null})).filter((t=>null!==t));e[r[2]]={params:t,body:r[4]}}for(const n in e){const i="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",n),o=new RegExp(i,"gm");for(;null!==(r=o.exec(t));){const i=r[1],o=r[2],a=r[3].split(","),s=i?`${i} ${o};`:"";let u=e[n].body,l="";e[n].params.forEach(((t,e)=>{t&&(l+=`${t.type} ${t.name} = ${a[e]};\n`)})),u=`${l}\n ${u}`,u=u.replace("return",`${o} = `);const c=`\n ${s}\n {\n ${u}\n }\n `;t=t.replace(r[0],c)}}return t.replace(n,"")}},8879:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GlslPreprocessor=void 0;const r=n(8520),i=n(2848),o=n(5483),a=n(5060);e.GlslPreprocessor=class{constructor(t,e,n,i){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new r.GlslContext(t,e,n,i),Object.keys(o.glslRegistry).forEach((t=>{const e=new o.glslRegistry[t](this.context);this.libs[t]=e}));const a=this.glslLibRoutineDependencyGraph;for(const t in this.libs){const e=this.libs[t].getFunctions();for(const n in e){const i=t+"."+n;let o;a[i]?(o=a[i],o.routineBody=e[n].routineBody):(o=new r.GlslLibRoutineNode(i,e[n].routineBody),a[i]=o);const s=e[n].dependencies;if(s)for(let t=0;t{const r=n.split(".")[1];-1!==t.indexOf(r)&&e.push(this.glslLibRoutineDependencyGraph[n])})),r.TopologicalSortGlslRoutines.returnOrderedNodes(e)}getUniforms(t,e){const n=[];if(t)for(const e of t)n.push(`uniform sampler2D ${e};`);if(e)for(const t of e)n.push(`uniform ${t.type} ${t.name}${t.arrayLength?`[${t.arrayLength}]`:""};`);return n.join("\n")}}},5483:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.glslRegistry=void 0;const r=n(5107),i=n(7341),o=n(9894),a=n(2655),s=n(3891);e.glslRegistry={encoding:i.EncodingGlslLib,fragcolor:o.FragColorGlslLib,vec:s.VecGlslLib,shapeUtils:a.ShapeUtilsGlslLib,coordinates:r.CoordsGlslLib}},2655:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShapeUtilsGlslLib=void 0;const r=n(8520);class i extends r.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const t=this.context.outputTextureLayout.shape.length,e={};return this.context.programInfo.inputNames.forEach(((n,i)=>{const o=this.context.inputTextureLayouts[i].unpackedShape;if(o.length<=t){const i=o.length,a=t-i,s=`bcastIndices_${n}`;let u="";for(let t=0;t{const o=this.context.inputTextureLayouts[i].shape;if(!(o.length<2||o.length>t)){const i=o.length,a=t-i,s=`bcastMatmulIndices_${n}`;let u="";for(let t=0;t{const o=this.context.inputTextureLayouts[n].shape,a=this.context.inputTextureLayouts[n].strides,s=o.length;let u=`indicesToOffset_${e}`;t[u]=new r.GlslLibRoutine(i.indexToOffsetSingle(u,s,a)),u=`indicesToOffset_${e}_T`,t[u]=new r.GlslLibRoutine(i.indexToOffsetSingle(u,s,a.slice().reverse()))})),t}static indexToOffsetSingle(t,e,n){let r="";for(let t=e-1;t>=0;--t)r+=`\n offset += indices[${t}] * ${n[t]};\n `;return`\n int ${t}(int indices[${e}]) {\n int offset = 0;\n ${r}\n return offset;\n }\n `}offsetToIndices(){const t={};return this.context.programInfo.inputNames.forEach(((e,n)=>{const o=this.context.inputTextureLayouts[n].shape,a=this.context.inputTextureLayouts[n].strides,s=o.length;let u=`offsetToIndices_${e}`;t[u]=new r.GlslLibRoutine(i.offsetToIndicesSingle(u,s,a)),u=`offsetToIndices_${e}_T`,t[u]=new r.GlslLibRoutine(i.offsetToIndicesSingle(u,s,a.slice().reverse()))})),t}static offsetToIndicesSingle(t,e,n){const r=[];for(let t=0;t{const i=this.context.inputTextureLayouts[n].shape,o=i.length,a=`incrementIndices_${e}`;let s="";for(let t=0;t= 0; --i) {\n if(i > axis) continue;\n indices[i] += 1;\n if(indices[i] < shape[i]) {\n break;\n }\n indices[i] = 0;\n }\n }\n `;t[a]=new r.GlslLibRoutine(u)})),t}}e.ShapeUtilsGlslLib=i},5060:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultFragShaderMain=e.getFragShaderPreamble=e.getVertexShaderSource=e.getGlsl=void 0;const n={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},r={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function i(t){return 1===t?n:r}e.getGlsl=i,e.getVertexShaderSource=function(t){const e=i(t);return`${e.version}\n precision highp float;\n ${e.attribute} vec3 position;\n ${e.attribute} vec2 textureCoord;\n\n ${e.varyingVertex} vec2 TexCoords;\n\n void main()\n {\n gl_Position = vec4(position, 1.0);\n TexCoords = textureCoord;\n }`},e.getFragShaderPreamble=function(t){const e=i(t);return`${e.version}\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ${e.varyingFrag} vec2 TexCoords;\n ${e.outputDeclaration}\n const vec2 halfCR = vec2(0.5, 0.5);\n\n // Custom vector types to handle higher dimenalities.\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 int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n `},e.getDefaultFragShaderMain=function(t,e){return`\n void main() {\n int indices[${e}];\n toVec(TexCoords, indices);\n vec4 result = vec4(process(indices));\n ${i(t).output} = result;\n }\n `}},3891:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VecGlslLib=void 0;const r=n(8520);class i extends r.GlslLib{constructor(t){super(t)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const t=this.context.outputTextureLayout.shape.length,e={add:"+=",sub:"-=",mul:"*=",div:"/="},n={};for(const i in e){const o=`${i}Vec`;let a="";for(let n=0;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLInferenceHandler=void 0;const r=n(6231),i=n(9162),o=n(2517),a=n(2403),s=n(7019),u=n(8710),l=n(5611),c=n(4057),h=n(2039);e.WebGLInferenceHandler=class{constructor(t){this.session=t,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(t,e){return(0,c.calculateTextureWidthAndHeight)(this.session.layoutStrategy,t,e)}executeProgram(t,e){if(e.length{const n=e.map((t=>`${t.unpackedShape.join(",")};${t.width}x${t.height}`)).join("_");let r=t.name;return t.cacheHint&&(r+="["+t.cacheHint+"]"),r+=":"+n,r})(t,n);let i=this.session.programManager.getArtifact(r);const o=i?i.programInfo:"function"==typeof t.get?t.get():t,a=(0,c.createTextureLayoutFromTextureType)(this.session.layoutStrategy,o.output.dims,o.output.textureType),s=this.createTextureData(a,o.output.type);return i||(i=this.session.programManager.build(o,n,s),this.session.programManager.setArtifact(r,i)),this.runProgram(i,n,s),s}run(t,e){return this.executeProgram(t,e).tensor}runProgram(t,e,n){for(let n=0;nthis.readTexture(a)),(async t=>this.readTextureAsync(a)),void 0,o),texture:n});return this.setTextureData(a.tensor.dataId,a,t.isPacked),a}getTextureData(t,e=!1){return this.session.isInitializer(t)?this.session.getTextureData(t,e):e?this.packedTextureDataCache.get(t):this.unpackedTextureDataCache.get(t)}setTextureData(t,e,n=!1){this.session.isInitializer(t)?this.session.setTextureData(t,e,n):(n?this.packedTextureDataCache:this.unpackedTextureDataCache).set(t,e)}isTextureLayoutCached(t,e=!1){return!!this.getTextureData(t.dataId,e)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach((t=>this.session.textureManager.releaseTexture(t))),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach((t=>this.session.textureManager.releaseTexture(t))),this.unpackedTextureDataCache=new Map}readTexture(t){return t.isPacked?this.readTexture(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,u.encodeAsUint8)(this,t))}async readTextureAsync(t){return t.isPacked?this.readTextureAsync(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,u.encodeAsUint8)(this,t))}pack(t){return this.executeProgram((0,a.createPackProgramInfoLoader)(this,t.tensor),[t.tensor])}unpack(t){return this.executeProgram((0,l.createUnpackProgramInfoLoader)(this,t.tensor),[t.tensor])}}},1640:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WEBGL_OP_RESOLVE_RULES=void 0;const a=n(2898),s=o(n(7839)),u=n(4196),l=n(2069),c=n(8138),h=n(9663),f=n(5193),d=n(7992),p=n(1253),g=n(4776),m=n(6572),b=n(3346),y=n(5623),_=n(2870),v=n(2143),w=n(4939),x=n(718),T=n(2268),E=n(8117),S=n(2278),A=n(5524),O=n(5975),I=n(3933),P=n(6558),k=n(5723),M=n(3738),D=o(n(4909)),R=n(8428),C=n(9793);e.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",D.abs],["Acos","","7+",D.acos],["Add","","7+",s.add],["And","","7+",s.and],["Asin","","7+",D.asin],["Atan","","7+",D.atan],["AveragePool","","7+",v.averagePool,v.parseAveragePoolAttributes],["BatchNormalization","","7+",a.batchNormalization,a.parseBatchNormalizationAttributes],["Cast","","6+",u.cast,u.parseCastAttributes],["Ceil","","6+",D.ceil],["Clip","","6-10",D.clip,D.parseClipAttributes],["Clip","","11+",D.clipV11],["Concat","","4+",l.concat,l.parseConcatAttributes],["Conv","","1+",c.conv,c.parseConvAttributes],["ConvTranspose","","1+",h.convTranspose,h.parseConvTransposeAttributes],["Cos","","7+",D.cos],["Div","","7+",s.div],["Dropout","","7+",D.identity],["DepthToSpace","","1+",f.depthToSpace,f.parseDepthToSpaceAttributes],["Equal","","7+",s.equal],["Elu","","6+",D.elu,D.parseEluAttributes],["Exp","","6+",D.exp],["Flatten","","1+",d.flatten,d.parseFlattenAttributes],["Floor","","6+",D.floor],["FusedConv","com.microsoft","1+",c.conv,c.parseConvAttributes],["Gather","","1+",p.gather,p.parseGatherAttributes],["Gemm","","7-10",g.gemm,g.parseGemmAttributesV7],["Gemm","","11+",g.gemm,g.parseGemmAttributesV11],["GlobalAveragePool","","1+",v.globalAveragePool,v.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",v.globalMaxPool],["Greater","","7+",s.greater],["Identity","","1+",D.identity],["ImageScaler","","1+",m.imageScaler,m.parseImageScalerAttributes],["InstanceNormalization","","6+",b.instanceNormalization,b.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",D.leakyRelu,D.parseLeakyReluAttributes],["Less","","7+",s.less],["Log","","6+",D.log],["MatMul","","1+",y.matMul,y.parseMatMulAttributes],["MaxPool","","1+",v.maxPool,v.parseMaxPoolAttributes],["Mul","","7+",s.mul],["Neg","","6+",D.neg],["Not","","1+",D.not],["Or","","7+",s.or],["Pad","","2-10",_.padV2,_.parsePadAttributesV2],["Pad","","11+",_.padV11,_.parsePadAttributesV11],["Pow","","7+",s.pow],["PRelu","","7+",s.pRelu],["ReduceLogSum","","1+",w.reduceLogSum,w.parseReduceAttributes],["ReduceMax","","1+",w.reduceMax,w.parseReduceAttributes],["ReduceMean","","1+",w.reduceMean,w.parseReduceAttributes],["ReduceMin","","1+",w.reduceMin,w.parseReduceAttributes],["ReduceProd","","1+",w.reduceProd,w.parseReduceAttributes],["ReduceSum","","1-12",w.reduceSum,w.parseReduceAttributes],["ReduceSumSquare","","1+",w.reduceLogSumSquare,w.parseReduceAttributes],["Relu","","6+",D.relu],["Reshape","","5+",x.reshape],["Resize","","10",T.resize,T.parseResizeAttributesV10],["Resize","","11+",T.resize,T.parseResizeAttributesV11],["Shape","","1+",E.shape],["Sigmoid","","6+",D.sigmoid],["Sin","","7+",D.sin],["Slice","","10+",S.sliceV10],["Slice","","1-9",S.slice,S.parseSliceAttributes],["Softmax","","1-12",A.softmax,A.parseSoftmaxAttributes],["Softmax","","13+",A.softmaxV13,A.parseSoftmaxAttributesV13],["Split","","2-12",O.split,O.parseSplitAttributes],["Sqrt","","6+",D.sqrt],["Squeeze","","1-12",I.squeeze,I.parseSqueezeAttributes],["Squeeze","","13+",I.squeezeV13],["Sub","","7+",s.sub],["Sum","","6+",P.sum],["Tan","","7+",D.tan],["Tanh","","6+",D.tanh],["Tile","","6+",k.tile],["Transpose","","1+",M.transpose,M.parseTransposeAttributes],["Upsample","","7-8",C.upsample,C.parseUpsampleAttributesV7],["Upsample","","9",C.upsample,C.parseUpsampleAttributesV9],["Unsqueeze","","1-12",R.unsqueeze,R.parseUnsqueezeAttributes],["Unsqueeze","","13+",R.unsqueezeV13],["Xor","","7+",s.xor]]},2898:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchNormalizationAttributes=e.batchNormalization=void 0;const r=n(246),i=n(5060),o=n(2039),a={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]};e.batchNormalization=(t,e,n)=>(u(e),[t.run(Object.assign(Object.assign({},a),{cacheHint:n.cacheKey,get:()=>s(t,e,n)}),e)]),e.parseBatchNormalizationAttributes=t=>{const e=t.attributes.getFloat("epsilon",1e-5),n=t.attributes.getFloat("momentum",.9),i=t.attributes.getInt("spatial",1);return(0,r.createAttributeWithCacheKey)({epsilon:e,momentum:n,spatial:i})};const s=(t,e,n)=>{const r=(0,i.getGlsl)(t.session.backend.glContext.version),s=e[0].dims.length,[u,l]=t.calculateTextureWidthAndHeight(e[1].dims,o.TextureType.unpacked),c=`\n float process(int[${s}] indices) {\n vec2 position = offsetToCoords(indices[1], ${u}, ${l});\n float scale = getColorAsFloat(${r.texture2D}(Scale, position));\n float mean = getColorAsFloat(${r.texture2D}(Mean, position));\n float variance = getColorAsFloat(${r.texture2D}(Variance, position));\n float b = getColorAsFloat(${r.texture2D}(B, position));\n\n return scale * ( (_A(indices) - mean) / sqrt(variance + float(${n.epsilon})) ) + b;\n }`;return Object.assign(Object.assign({},a),{output:{dims:e[0].dims,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:c})},u=t=>{if(!t||5!==t.length)throw new Error("BatchNormalization requires 5 inputs.");const e=t[0],n=t[1],r=t[2],i=t[3],o=t[4];if(e.dims.length<3||1!==n.dims.length||1!==r.dims.length||1!==i.dims.length||1!==o.dims.length)throw new Error("invalid input shape.");if(n.dims[0]!==e.dims[1]||r.dims[0]!==e.dims[1]||i.dims[0]!==e.dims[1]||o.dims[0]!==e.dims[1])throw new Error("invalid input shape.");if("float32"!==e.type&&"float64"!==e.type||"float32"!==n.type&&"float64"!==n.type||"float32"!==r.type&&"float64"!==r.type||"float32"!==i.type&&"float64"!==i.type||"float32"!==o.type&&"float64"!==o.type)throw new Error("invalid input tensor types.")}},7839:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.xor=e.sub=e.pRelu=e.pow=e.or=e.mul=e.less=e.greater=e.equal=e.div=e.and=e.add=e.glslPRelu=e.glslPow=e.glslXor=e.glslOr=e.glslAnd=e.glslLess=e.glslGreater=e.glslEqual=e.glslSub=e.glslMul=e.glslDiv=e.glslAdd=void 0;const r=n(2517),i=n(8520),o=n(5060),a=n(2039);function s(){const t="add_";return{body:`\n float ${t}(float a, float b) {\n return a + b;\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return v1 + v2;\n }\n `,name:t,type:i.FunctionType.ValueBased}}function u(){const t="div_";return{body:`\n float ${t}(float a, float b) {\n return a / b;\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return v1 / v2;\n }\n `,name:t,type:i.FunctionType.ValueBased}}function l(){const t="mul_";return{body:`\n float ${t}(float a, float b) {\n return a * b;\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return v1 * v2;\n }\n `,name:t,type:i.FunctionType.ValueBased}}function c(){const t="sub_";return{body:`\n float ${t}(float a, float b) {\n return a - b;\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return v1 - v2;\n }\n `,name:t,type:i.FunctionType.ValueBased}}function h(){const t="equal_";return{body:`\n float ${t}(float a, float b) {\n return float(a == b);\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return vec4(equal(v1, v2));\n }\n `,name:t,type:i.FunctionType.ValueBased}}function f(){const t="greater_";return{body:`\n float ${t}(float a, float b) {\n return float(a > b);\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return vec4( v1.r > v2.r ,\n v1.g > v2.g,\n v1.b > v2.b,\n v1.a > v2.a );\n }\n `,name:t,type:i.FunctionType.ValueBased}}function d(){const t="less_";return{body:`\n float ${t}(float a, float b) {\n return float(a < b);\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return vec4( v1.r < v2.r ,\n v1.g < v2.g,\n v1.b < v2.b,\n v1.a < v2.a );\n }\n `,name:t,type:i.FunctionType.ValueBased}}function p(){const t="and_";return{body:`\n float ${t}(float a, float b) {\n return float( bool(a) && bool(b) );\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n bvec4 b1 = bvec4(v1);\n bvec4 b2 = bvec4(v2);\n return vec4( b1.r && b2.r ,\n b1.g && b2.g,\n b1.b && b2.b,\n b1.a && b2.a );\n }\n `,name:t,type:i.FunctionType.ValueBased}}function g(){const t="or_";return{body:`\n float ${t}(float a, float b) {\n return float( bool(a) || bool(b) );\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n bvec4 b1 = bvec4(v1);\n bvec4 b2 = bvec4(v2);\n return vec4( b1.r || b2.r ,\n b1.g || b2.g,\n b1.b || b2.b,\n b1.a || b2.a );\n }\n `,name:t,type:i.FunctionType.ValueBased}}function m(){const t="xor_";return{body:`\n float ${t}(float a, float b) {\n return float( bool(a) ^^ bool(b) );\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n bvec4 b1 = bvec4(v1);\n bvec4 b2 = bvec4(v2);\n return vec4( b1.r ^^ b2.r ,\n b1.g ^^ b2.g,\n b1.b ^^ b2.b,\n b1.a ^^ b2.a );\n }\n `,name:t,type:i.FunctionType.ValueBased}}function b(){return function(t){const e=`${t}_`;return{body:`\n float ${e}(float a, float b) {\n return ${t}(a, b);\n }\n vec4 ${e}(vec4 v1, vec4 v2) {\n return ${t}(v1, v2);\n }\n `,name:e,type:i.FunctionType.ValueBased}}("pow")}function y(){const t="prelu_";return{body:`\n float ${t}(float a, float b) {\n return a < 0.0 ? a * b: a;\n }\n vec4 ${t}(vec4 v1, vec4 v2) {\n return vec4(\n v1.r < 0.0 ? v1.r * v2.r: v1.r,\n v1.g < 0.0 ? v1.g * v2.g: v1.g,\n v1.b < 0.0 ? v1.b * v2.b: v1.b,\n v1.a < 0.0 ? v1.a * v2.a: v1.a\n );\n }\n `,name:t,type:i.FunctionType.ValueBased}}e.glslAdd=s,e.glslDiv=u,e.glslMul=l,e.glslSub=c,e.glslEqual=h,e.glslGreater=f,e.glslLess=d,e.glslAnd=p,e.glslOr=g,e.glslXor=m,e.glslPow=b,e.glslPRelu=y;const _=(t,e,n,r=e[0].type,i)=>{const o=t.session.pack?a.TextureType.packed:a.TextureType.unpacked;return{name:n.name,inputNames:["A","B"],inputTypes:[o,o],cacheHint:i,get:()=>v(t,e,n,r)}},v=(t,e,n,i=e[0].type)=>{const s=t.session.pack?a.TextureType.packed:a.TextureType.unpacked,u=!r.ShapeUtil.areEqual(e[0].dims,e[1].dims);let l=e[0].dims;const c=t.session.pack;if(u){const a=r.BroadcastUtil.calcShape(e[0].dims,e[1].dims,!1);if(!a)throw new Error("Can't perform binary op on the given tensors");l=a;const u=l.length,h=0!==e[0].dims.length?e[0].dims.length:1,f=0!==e[1].dims.length?e[1].dims.length:1,d=0!==e[0].dims.length?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",p=0!==e[1].dims.length?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",g=(0,o.getGlsl)(t.session.backend.glContext.version),m=c?`\n ${n.body}\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n vec4 result = ${n.name}(a, b);\n ${g.output} = result;\n }`:`\n ${n.body}\n float process(int indices[${u}]) {\n int aindices[${h}];\n int bindices[${f}];\n ${d}\n ${p}\n return ${n.name}(_A(aindices), _B(bindices));\n }`;return{name:n.name,inputNames:["A","B"],inputTypes:[s,s],output:{dims:l,type:i,textureType:s},shaderSource:m,hasMain:c}}const h=(0,o.getGlsl)(t.session.backend.glContext.version),f=`\n ${n.body}\n void main() {\n vec4 v1 = ${h.texture2D}(A, TexCoords);\n vec4 v2 = ${h.texture2D}(B, TexCoords);\n vec4 result = ${n.name}(v1, v2);\n ${h.output} = result;\n }\n `;return{name:n.name,inputNames:["A","B"],inputTypes:[s,s],output:{dims:e[0].dims,type:i,textureType:s},shaderSource:f,hasMain:!0}};e.add=(t,e)=>[t.run(_(t,e,s()),e)],e.and=(t,e)=>[t.run(_(t,e,p(),"bool"),e)],e.div=(t,e)=>[t.run(_(t,e,u()),e)],e.equal=(t,e)=>[t.run(_(t,e,h(),"bool"),e)],e.greater=(t,e)=>[t.run(_(t,e,f(),"bool"),e)],e.less=(t,e)=>[t.run(_(t,e,d(),"bool"),e)],e.mul=(t,e)=>[t.run(_(t,e,l()),e)],e.or=(t,e)=>[t.run(_(t,e,g(),"bool"),e)],e.pow=(t,e)=>[t.run(_(t,e,b()),e)],e.pRelu=(t,e)=>[t.run(_(t,e,y()),e)],e.sub=(t,e)=>[t.run(_(t,e,c()),e)],e.xor=(t,e)=>[t.run(_(t,e,m(),"bool"),e)]},4196:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseCastAttributes=e.cast=void 0;const r=n(2517);e.cast=(t,e,n)=>(i(e),[t.cast(e[0],n)]),e.parseCastAttributes=t=>r.ProtoUtil.tensorDataTypeFromProto(t.attributes.getInt("to"));const i=t=>{if(!t||1!==t.length)throw new Error("Cast requires 1 input.");if("string"===t[0].type)throw new Error("Invalid input type.")}},1163:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedConcatProgramInfoLoader=void 0;const r=n(5060),i=n(2039),o=n(9390),a=n(2827);e.createPackedConcatProgramInfoLoader=(t,e,n)=>{const u=(l=e.length,c=n.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:l},((t,e)=>`X${e}`)),inputTypes:Array(l).fill(i.TextureType.packed),cacheHint:c});var l,c;return Object.assign(Object.assign({},u),{get:()=>((t,e,n,u)=>{const l=n[0].dims.slice();if(u>=l.length||u<-1*l.length)throw new Error("axis specified for concat doesn't match input dimensionality");u<0&&(u=l.length+u);const c=l.slice(0);for(let t=1;tt.dims)),m=(0,o.getGlChannels)(h),b=new Array(g.length-1);b[0]=g[0][u];for(let t=1;t= ${b[t-1]}) {\n return getChannel(\n getX${t}(${s(m,y,e)}),\n vec2(${s(_,y,e)}));\n }`}const x=b.length,T=b[b.length-1];w+=`\n return getChannel(\n getX${x}(${s(m,y,T)}),\n vec2(${s(_,y,T)}));`;const E=(0,r.getGlsl)(t.session.backend.glContext.version),S=`\n ${p}\n float getValue(${m.map((t=>"int "+t))}) {\n ${w}\n }\n\n void main() {\n ${d} coords = getOutputCoords();\n int lastDim = coords.${m[h-1]};\n coords.${m[h-1]} = coords.${m[h-2]};\n coords.${m[h-2]} = lastDim;\n\n vec4 result = vec4(getValue(${f}), 0., 0., 0.);\n\n ${f[h-1]} = ${f[h-1]} + 1;\n if (${f[h-1]} < ${c[h-1]}) {\n result.g = getValue(${f});\n }\n\n ${f[h-2]} = ${f[h-2]} + 1;\n if (${f[h-2]} < ${c[h-2]}) {\n result.a = getValue(${f});\n }\n\n ${f[h-1]} = ${f[h-1]} - 1;\n if (${f[h-2]} < ${c[h-2]} &&\n ${f[h-1]} < ${c[h-1]}) {\n result.b = getValue(${f});\n }\n ${E.output} = result;\n }\n `;return Object.assign(Object.assign({},e),{output:{dims:c,type:n[0].type,textureType:i.TextureType.packed},shaderSource:S,hasMain:!0})})(t,u,e,n.axis)})};const s=(t,e,n)=>{const r=t.indexOf(e);return t.map(((t,e)=>e===r?`${t} - ${n}`:t)).join()}},2069:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConcatAttributes=e.concat=void 0;const r=n(246),i=n(2039),o=n(1163);e.concat=(t,e,n)=>(h(e),t.session.pack&&e[0].dims.length>1?[t.run((0,o.createPackedConcatProgramInfoLoader)(t,e,n),e)]:[t.run(a(t,e,n),e)]);const a=(t,e,n)=>{const r=(o=e.length,a=n.cacheKey,{name:"Concat",inputNames:Array.from({length:o},((t,e)=>`X${e}`)),inputTypes:Array(o).fill(i.TextureType.unpacked),cacheHint:a});var o,a;return Object.assign(Object.assign({},r),{get:()=>((t,e,n,r)=>{const o=n[0].dims.slice();if(r>=o.length||r<-1*o.length)throw new Error("axis specified for concat doesn't match input dimensionality");r<0&&(r=o.length+r);const a=o.slice(0);for(let t=1;t`int getTextureWhereDataResides(int index) {\n ${t.map(((t,e)=>`if(index<${t}) {return ${e};}\n`)).join("")}\n }`,u=t=>s(t),l=(t,e)=>{const n=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${e}]) {`];for(let e=0;e{const e=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let n=0;n(0,r.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis")});const h=t=>{if(!t||t.length<1)throw new Error("too few inputs");const e=t[0].type,n=t[0].dims.length;if("string"===e)throw new Error("string tensor is not supported yet");for(const r of t){if(r.type!==e)throw new Error("input tensors should be one type");if(r.dims.length!==n)throw new Error("input tensors should have the same shape")}}},4770:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackedGroupedConvProgramInfoLoader=void 0;const r=n(6231),i=n(5060),o=n(2039),a=n(8138),s=n(2823);e.createUnpackedGroupedConvProgramInfoLoader=(t,e,n)=>{const u=(l=e.length>2,c=n.cacheKey,{name:"GroupedConv",inputNames:l?["X","W","Bias"]:["X","W"],inputTypes:l?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],cacheHint:c});var l,c;return Object.assign(Object.assign({},u),{get:()=>((t,e,n,u)=>{const l=e.length>2?"value += getBias(output_channel);":"",c=e[0].dims.slice(),h=e[1].dims.slice(),f=h[0]/u.group;r.Logger.verbose("GroupedConv",`autpPad:${u.autoPad}, dilations:${u.dilations}, group:${u.group}, kernelShape:${u.kernelShape}, pads:${u.pads}, strides:${u.strides}`);const d=(0,a.calculateOutputShape)(c,h,u.dilations,u.pads,u.strides),p=(0,i.getGlsl)(t.session.backend.glContext.version),{activationFunction:g,applyActivation:m}=(0,s.getActivationSnippet)(u),b=`\n const ivec2 strides = ivec2(${u.strides[0]}, ${u.strides[1]});\n const ivec2 pads = ivec2(${u.pads[0]}, ${u.pads[1]});\n ${g}\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int output_channel = coords.y;\n ivec2 xRCCorner = coords.zw * strides - pads;\n int group_id = output_channel / ${f};\n\n float value = 0.0;\n for (int wInChannel = 0; wInChannel < ${h[1]}; wInChannel++) {\n int input_channel = group_id * ${h[1]} + wInChannel;\n for (int wHeight = 0; wHeight < ${h[2]}; wHeight++) {\n int xHeight = xRCCorner.x + wHeight * ${u.dilations[0]};\n\n if (xHeight < 0 || xHeight >= ${c[2]}) {\n continue;\n }\n\n for (int wWidth = 0; wWidth < ${h[3]}; wWidth++) {\n int xWidth = xRCCorner.y + wWidth * ${u.dilations[1]};\n if (xWidth < 0 || xWidth >= ${c[3]}) {\n continue;\n }\n\n float xVal = getX(batch, input_channel, xWidth, xHeight);\n float wVal = getW(output_channel, wInChannel, wWidth, wHeight);\n value += xVal*wVal;\n }\n }\n }\n ${l}\n ${m}\n ${p.output} = vec4(value, .0, .0, .0);\n }\n`;return Object.assign(Object.assign({},n),{output:{dims:d,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:b,hasMain:!0})})(t,e,u,n)})}},1386:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.conv2DPacked=e.conv2DPackedPointwise=void 0;const r=n(8138),i=n(8555),o=n(708);e.conv2DPackedPointwise=(t,e,n)=>{const i=e[0].dims,a=e[1].dims,s=(0,r.calculateOutputShape)(i,a,n.dilations,n.pads,n.strides),u=t.reshapePacked(e[0],[i[1],i[2]*i[3]]),l=t.reshapePacked(e[1],[a[0],a[1]]),c=e.length>2?[l,u,e[2]]:[l,u],h=t.run((0,o.createPackedMatmulProgramInfoLoader)(t,c,n),c);return t.reshapePacked(h,s)},e.conv2DPacked=(t,e,n)=>{const a=e[0].dims,s=e[1].dims,u=(0,r.calculateOutputShape)(a,s,n.dilations,n.pads,n.strides),l=t.run((0,i.createPackedIm2ColProgramInfoLoader)(t,e[0],e[1],u,n),[e[0]]),c=t.reshapePacked(e[1],[s[0],s[1]*s[2]*s[3]]),h=3===e.length?[c,l,e[2]]:[c,l],f=t.run((0,o.createPackedMatmulProgramInfoLoader)(t,h,n),h);return t.reshapePacked(f,u)}},9663:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvTransposeAttributes=e.convTranspose=void 0;const r=n(246),i=n(5060),o=n(2039),a=n(2823),s=(t,e,n,r,i,o)=>(t-1)*e+n+(r-1)*i+1-o,u=(t,e,n,r,i)=>{const o=Math.floor(t/2);"SAME_UPPER"===e?(n[r]=o,n[i]=t-o):"SAME_LOWER"===e&&(n[r]=t-o,n[i]=o)};e.convTranspose=(t,e,n)=>(f(e,n),l(t,e,n));const l=(t,e,n)=>{const r=h(n,e);return[c(t,e,r)]},c=(t,e,n)=>t.run(((t,e,n)=>{const r=(s=e.length>2,u=n.cacheKey,{name:"ConvTranspose",inputNames:s?["X","W","B"]:["X","W"],inputTypes:s?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],cacheHint:u});var s,u;return Object.assign(Object.assign({},r),{get:()=>((t,e,n,r)=>{const s=e.length>2?"getB(output_channel)":"0.0",u=e[0].dims,l=e[1].dims,c=l[1],h=l[0]/r.group,f=[e[0].dims[0],e[1].dims[1]*r.group,...r.outputShape],d=(0,i.getGlsl)(t.session.backend.glContext.version),{activationFunction:p,applyActivation:g}=(0,a.getActivationSnippet)(r),m=`\n const ivec2 strides = ivec2(${r.strides[0]}, ${r.strides[1]});\n const ivec2 pads = ivec2(${r.pads[0]}, ${r.pads[1]});\n ${p}\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int output_channel = coords.y;\n\n ivec2 loc = coords.zw + pads;\n\n int group_id = output_channel / ${c};\n int wOutChannel = output_channel - group_id * ${c};\n\n float value = ${s};\n for (int inChannelOffset = 0; inChannelOffset < ${h}; inChannelOffset++) {\n int input_channel = group_id * ${h} + inChannelOffset;\n for (int wWOff = 0; wWOff < ${l[2]}; wWOff++) {\n for (int wHOff = 0; wHOff < ${l[3]}; wHOff++) {\n ivec2 wOff = ivec2(wWOff * ${r.dilations[0]}, wHOff * ${r.dilations[1]});\n ivec2 wLoc = loc - wOff;\n ivec2 wLocIn = wLoc / strides;\n if (\n wLocIn * strides == wLoc &&\n wLocIn.x >= 0 && wLocIn.x < ${u[2]} &&\n wLocIn.y >= 0 && wLocIn.y < ${u[3]}\n ) {\n float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x);\n float wVal = getW(input_channel, wOutChannel, wHOff, wWOff);\n value += xVal * wVal;\n }\n }\n }\n }\n ${g}\n ${d.output} = vec4(value, .0, .0, .0);\n }\n`;return Object.assign(Object.assign({},n),{output:{dims:f,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:m,hasMain:!0})})(t,e,r,n)})})(t,e,n),e),h=(t,e)=>{const n=t.kernelShape.slice();if(0===t.kernelShape.length)for(let t=2;t{const c=t.length-2,h=0===l.length;for(let f=0;f{const e=t.attributes,n=(0,a.parseInternalActivationAttributes)(e),i=e.getString("auto_pad","NOTSET"),o=e.getInts("dilations",[1,1]),s=e.getInt("group",1),u=e.getInts("kernel_shape",[]),l=e.getInts("output_padding",[0,0]),c=e.getInts("output_shape",[]),h=e.getInts("pads",[0,0,0,0]),f=e.getInts("strides",[1,1]);return(0,r.createAttributeWithCacheKey)(Object.assign({autoPad:i,dilations:o,group:s,kernelShape:u,outputPadding:l,outputShape:c,pads:h,strides:f},n))};const f=(t,e)=>{if(!t||2!==t.length&&3!==t.length)throw new Error("Conv requires 2 or 3 inputs");if(4!==t[0].dims.length||4!==t[1].dims.length)throw new Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const n=t[1].dims[1]*e.group;if(3===t.length&&(1!==t[2].dims.length||t[2].dims[0]!==n))throw new Error("invalid bias");const r=t[0].dims.length-2;if(e.dilations.length!==r)throw new Error(`dilations should be ${r}D`);if(e.strides.length!==r)throw new Error(`strides should be ${r}D`);if(e.pads.length!==2*r)throw new Error(`pads should be ${2*r}D`);if(e.outputPadding.length!==r)throw new Error(`output_padding should be ${r}D`);if(0!==e.kernelShape.length&&e.kernelShape.length!==t[1].dims.length-2)throw new Error("invalid kernel shape");if(0!==e.outputShape.length&&e.outputShape.length!==t[0].dims.length-2)throw new Error("invalid output shape");if("float32"!==t[0].type||"float32"!==t[1].type)throw new Error("ConvTranspose input(X,W) should be float tensor");if(3===t.length&&"float32"!==t[2].type)throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvAttributes=e.conv=e.calculateOutputShape=void 0;const r=n(246),i=n(2517),o=n(4770),a=n(1386),s=n(9828),u=n(2823),l=n(3248),c=n(5623);e.calculateOutputShape=(t,e,n,r,i)=>{const o=t[0],a=t.slice(2),s=a.length,u=e[0],l=e.slice(2).map(((t,e)=>t+(t-1)*(n[e]-1))),c=a.map(((t,e)=>t+r[e]+r[e+s])).map(((t,e)=>Math.floor((t-l[e]+i[e])/i[e])));return[o,u].concat(...c)},e.conv=(t,e,n)=>(g(e,n),h(t,e,n));const h=(t,e,n)=>{const r=p(n,e),i=t.session.pack,s=1===r.kernelShape[0]&&1===r.kernelShape[1];return r.group>1?[t.run((0,o.createUnpackedGroupedConvProgramInfoLoader)(t,e,r),e)]:s&&i?[f(t,e,r)]:i&&4===e[0].dims.length&&1===e[0].dims[0]&&!s?[(0,a.conv2DPacked)(t,e,r)]:[d(t,e,r)]},f=(t,n,r)=>{const i=n[0].dims,o=n[1].dims,a=(0,e.calculateOutputShape)(i,o,r.dilations,r.pads,r.strides),s=t.reshapeUnpacked(n[0],[i[1],i[2]*i[3]]),u=t.reshapeUnpacked(n[1],[o[0],o[1]]),l=n.length>2?[u,s,n[2]]:[u,s],h=t.run((0,c.createMatmulProgramInfoLoader)(l,r),l);return t.reshapeUnpacked(h,a)},d=(t,n,r)=>{const i=n[0].dims,o=n[1].dims,a=(0,e.calculateOutputShape)(i,o,r.dilations,r.pads,r.strides),u=t.run((0,l.createIm2ColProgramInfoLoader)(t,n[0],n[1],a,r),[n[0]]),c=3===n.length?[u,n[1],n[2]]:[u,n[1]];return t.run((0,s.createDotProductProgramInfoLoader)(t,n,a,r),c)},p=(t,e)=>{const n=t.kernelShape.slice();if(0===t.kernelShape.length)for(let t=2;t{const e=t.attributes,n=(0,u.parseInternalActivationAttributes)(e),i=e.getString("auto_pad","NOTSET"),o=e.getInts("dilations",[1,1]),a=e.getInt("group",1),s=e.getInts("kernel_shape",[]),l=e.getInts("pads",[0,0,0,0]),c=e.getInts("strides",[1,1]);return(0,r.createAttributeWithCacheKey)(Object.assign({autoPad:i,dilations:o,group:a,kernelShape:s,pads:l,strides:c},n))};const g=(t,e)=>{if(!t||2!==t.length&&3!==t.length)throw new Error("Conv requires 2 or 3 inputs");if(4!==t[0].dims.length||4!==t[1].dims.length)throw new Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[1]*e.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(3===t.length&&(1!==t[2].dims.length||t[1].dims[0]!==t[2].dims[0]))throw new Error("invalid bias");const n=t[0].dims.length-2;if(e.dilations.length!==n)throw new Error(`dilations should be ${n}D`);if(e.strides.length!==n)throw new Error(`strides should be ${n}D`);if(e.pads.length!==2*n)throw new Error(`pads should be ${2*n}D`);if(0!==e.kernelShape.length&&e.kernelShape.length!==t[1].dims.length-2)throw new Error("invalid kernel shape");if("float32"!==t[0].type||"float32"!==t[1].type)throw new Error("Conv input(X,W) should be float tensor");if(3===t.length&&"float32"!==t[2].type)throw new Error("Conv input(bias) should be float tensor")}},5193:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseDepthToSpaceAttributes=e.depthToSpace=void 0;const r=n(3738);e.depthToSpace=(t,e,n)=>{i(e);const o=n.blocksize,a=o*o,s="DCR"===n.mode?[0,3,4,1,5,2]:[0,1,4,2,5,3],u="DCR"===n.mode?[e[0].dims[0],o,o,e[0].dims[1]/a,e[0].dims[2],e[0].dims[3]]:[e[0].dims[0],e[0].dims[1]/a,o,o,e[0].dims[2],e[0].dims[3]],l=t.reshapeUnpacked(e[0],u),c={perm:s,cacheKey:`${s}`},[h]=(0,r.transpose)(t,[l],c),f=[e[0].dims[0],e[0].dims[1]/a,e[0].dims[2]*o,e[0].dims[3]*o];return[t.reshapeUnpacked(h,f)]},e.parseDepthToSpaceAttributes=t=>{const e=t.attributes.getInt("blocksize");if(e<1)throw new Error(`blocksize must be >= 1, but got : ${e} for DepthToSpace`);const n=t.attributes.getString("mode","DCR");if("DCR"!==n&&"CRD"!==n)throw new Error(`unrecognized mode: ${n} for DepthToSpace`);return{mode:n,blocksize:e}};const i=t=>{if(1!==t.length)throw new Error(`DepthToSpace expect 1 inputs, but got ${t.length}`);if("string"===t[0].type||4!==t[0].dims.length)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createDotProductProgramInfoLoader=void 0;const r=n(2517),i=n(5060),o=n(2039),a=n(2823),s=n(3248);e.createDotProductProgramInfoLoader=(t,e,n,u)=>{const l=((t,e)=>({name:"ConvDotProduct",inputNames:t?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:t?[o.TextureType.unpacked,o.TextureType.packedLastDimension,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.packedLastDimension],cacheKey:e.activationCacheKey}))(e.length>2,u);return Object.assign(Object.assign({},l),{get:()=>((t,e,n,u,l)=>{const c=n[0].dims,h=n[1].dims,f=[h[0],Math.ceil(c[1]*h[2]*h[3]/4)],d=(0,s.calculateIm2ColDims)(c,h,u),[p,g]=t.calculateTextureWidthAndHeight(f,o.TextureType.packedLastDimension),m=r.ShapeUtil.computeStrides(d),[b,y]=t.calculateTextureWidthAndHeight(d,o.TextureType.packedLastDimension),_=u.length,v=n.length<3?"0.0":"_B(b)",w=Math.ceil(c[1]*h[2]*h[3]/4),{activationFunction:x,applyActivation:T}=(0,a.getActivationSnippet)(l),E=(0,i.getGlsl)(t.session.backend.glContext.version),S=`\n${x}\nfloat process(int indices[${_}]) {\n int b[1];\n b[0] = indices[1];\n int im2col[4];\n im2col[0] = indices[0];\n im2col[1] = indices[2];\n im2col[2] = indices[3];\n int im2colOffset = im2col[0] * ${m[0]} + im2col[1] * ${m[1]} + im2col[2] * ${m[2]};\n int kernelOffset = indices[1] * ${f[1]};\n float value = ${v};\n for (int i = 0; i < ${w}; ++i) {\n vec2 im2colCoords = offsetToCoords(im2colOffset, ${b}, ${y});\n vec2 kernelCoords = offsetToCoords(kernelOffset, ${p}, ${g});\n value += dot(${E.texture2D}(Im2Col, im2colCoords), ${E.texture2D}(K, kernelCoords));\n ++im2colOffset;\n ++kernelOffset;\n }\n ${T}\n return value;\n}`;return Object.assign(Object.assign({},e),{output:{dims:u,type:n[0].type,textureType:o.TextureType.unpacked},shaderSource:S})})(t,l,e,n,u)})}},7992:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseFlattenAttributes=e.flatten=void 0;const r=n(2517);e.flatten=(t,e,n)=>{i(e,n);const o=r.ShapeUtil.flattenShape(e[0].dims,n);return[t.reshapeUnpacked(e[0],o)]},e.parseFlattenAttributes=t=>t.attributes.getInt("axis",1);const i=(t,e)=>{if(!t||1!==t.length)throw new Error("Flatten requires 1 input.");const n=t[0].dims.length;if(0===n)throw new Error("scalar tensor is not supported.");if(e<-n||e>n)throw new Error("Invalid axis");if("string"===t[0].type)throw new Error("string tensor is not supported.")}},2823:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseInternalActivationAttributes=e.getActivationSnippet=void 0;const r=n(2517),i=n(4909);e.getActivationSnippet=function(t){let e;switch(t.activation){case"Relu":e=(0,i.glslRelu)();break;case"Sigmoid":e=(0,i.glslSigmoid)();break;case"Clip":e=(0,i.glslClip)(t.clipMin,t.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const n=e.name;return{activationFunction:e.body,applyActivation:`value = ${n}_(value);`}},e.parseInternalActivationAttributes=t=>{const e=t.getString("activation","");if("Clip"===e){const[n,i]=t.getFloats("activation_params",[r.MIN_CLIP,r.MAX_CLIP]);return{activation:e,clipMax:i,clipMin:n,activationCacheKey:`${e}:${n},${i}`}}return{activation:e,activationCacheKey:e}}},1253:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseGatherAttributes=e.gather=void 0;const r=n(246),i=n(782),o=n(2517),a=n(2039);e.gather=(t,e,n)=>(l(e,n.axis),[t.run(u(t,e,n),e)]),e.parseGatherAttributes=t=>(0,r.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",0)});const s={name:"Gather",inputNames:["A","B"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},u=(t,e,n)=>{const r=Object.assign(Object.assign({},s),{cacheHint:n.cacheKey});return Object.assign(Object.assign({},r),{get:()=>((t,e,n,r)=>{const i=n[0].dims.slice(),s=n[1].dims.slice(),u=new Array(i.length+s.length-1);r=o.ShapeUtil.normalizeAxis(r,i.length);const l=[];for(let t=0;t{if(!t||2!==t.length)throw new Error("Gather requires 2 inputs.");const n=t[0].dims.length;if(n<1)throw new Error("Invalid input shape.");if(e<-n||e>n-1)throw new Error("Invalid axis.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type))throw new Error("Invaid input type.");if("int32"!==t[1].type&&"int16"!==t[1].type)throw new Error("Invaid input type.")}},4776:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseGemmAttributesV11=e.parseGemmAttributesV7=e.gemm=void 0;const r=n(246),i=n(2517),o=n(2039);e.gemm=(t,e,n)=>(l(e,n),[t.run(s(e,n),e)]);const a=(t,e)=>{const n=0!==t.attributes.getInt("transA",0),i=0!==t.attributes.getInt("transB",0),o=t.attributes.getFloat("alpha",1),a=t.attributes.getFloat("beta",1);return(0,r.createAttributeWithCacheKey)({transA:n,transB:i,alpha:o,beta:a,isOptionalC:e})};e.parseGemmAttributesV7=t=>a(t,!1),e.parseGemmAttributesV11=t=>a(t,!0);const s=(t,e)=>{const n={name:"Gemm",inputNames:3===t.length?["A","B","C"]:["A","B"],inputTypes:3===t.length?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],key:e.cacheKey};return Object.assign(Object.assign({},n),{get:()=>u(n,t,e)})},u=(t,e,n)=>{const r=e[0].dims.slice(),a=e[1].dims.slice(),[s,u]=i.GemmUtil.getShapeOfGemmResult(r,n.transA,a,n.transB,3===e.length?e[2].dims:void 0),l=[s,u];if(!l)throw new Error("Can't use gemm on the given tensors");let c=r[r.length-1],h="";n.transA&&(c=r[0]),n.transA&&n.transB?h="value += _A_T(a) * _B_T(b);":n.transA&&!n.transB?h="value += _A_T(a) * _B(b);":!n.transA&&n.transB?h="value += _A(a) * _B_T(b);":n.transA||n.transB||(h="value += _A(a) * _B(b);");const f=l.length,d=`\n float process(int indices[${f}]) {\n int a[${f}];\n int b[${f}];\n ${3===e.length?`int c[${e[2].dims.length}];`:""}\n\n copyVec(indices, a);\n copyVec(indices, b);\n ${3===e.length?"bcastIndices_C(indices, c);":""}\n\n float value = 0.0;\n for (int k=0; k<${c}; ++k) {\n a[${f-1}] = k;\n b[${f-2}] = k;\n ${h}\n }\n\n value = value * alpha;\n ${3===e.length?"value += beta * _C(c);":""}\n return value;\n }`;return Object.assign(Object.assign({},t),{output:{dims:l,type:e[0].type,textureType:o.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:n.alpha},{name:"beta",type:"float",data:n.beta}],shaderSource:d})},l=(t,e)=>{if(!t)throw new Error("Input is missing");if(e.isOptionalC&&(t.length<2||t.length>3))throw new Error("Invaid input shape.");if(!e.isOptionalC&&3!==t.length)throw new Error("Gemm requires 3 inputs");if(3===t.length&&1!==t[2].dims.length&&2!==t[2].dims.length)throw new Error("Invalid input shape of C");if("float32"!==t[0].type&&"float64"!==t[0].type||"float32"!==t[1].type&&"float64"!==t[1].type||3===t.length&&"float32"!==t[2].type&&"float64"!==t[2].type)throw new Error("Invalid input type.");if(t[0].type!==t[1].type||3===t.length&&t[0].type!==t[2].type)throw new Error("Input types are mismatched")}},8555:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedIm2ColProgramInfoLoader=void 0;const r=n(5060),i=n(2039),o=n(2827);e.createPackedIm2ColProgramInfoLoader=(t,e,n,a,s)=>{const u=(l=s.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[i.TextureType.packed],cacheHint:l});var l;return Object.assign(Object.assign({},u),{get:()=>((t,e,n,a,s,u)=>{const l=n.dims,c=a.dims,h=s.length,f=[c[1]*c[2]*c[3],s[2]*s[3]],d=c[2]*c[3],p=(0,o.unpackFromChannel)(),g=(0,r.getGlsl)(t.session.backend.glContext.version);let m="";for(let t=0;t<=1;t++)for(let e=0;e<=1;e++)m+=`\n blockIndex = rc.x + ${e};\n pos = rc.y + ${t};\n\n if(blockIndex < ${f[1]} && pos < ${f[0]}) {\n offsetY = int(blockIndex / (${s[h-1]})) * ${u.strides[0]} -\n ${u.pads[0]};\n d0 = offsetY + ${u.dilations[0]} * (imod(pos, ${d}) / ${c[2]});\n\n if(d0 < ${l[2]} && d0 >= 0) {\n offsetX = imod(blockIndex, ${s[h-1]}) * ${u.strides[1]} -\n ${u.pads[1]};\n d1 = offsetX + ${u.dilations[1]} * imod(imod(pos, ${d}), ${c[2]});\n\n if(d1 < ${l[3]} && d1 >= 0) {\n\n ch = int(float(pos)/ ${d}.);\n innerDims = vec2(d0, d1);\n result[${2*t+e}] = getChannel(\n getA(0, ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n\n `;const b=`\n ${p}\n\n void main() {\n ivec2 rc = getOutputCoords();\n vec4 result = vec4(0.0);\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n ${m}\n ${g.output} = result;\n }\n `;return Object.assign(Object.assign({},e),{output:{dims:f,type:n.type,textureType:i.TextureType.packed},shaderSource:b,hasMain:!0})})(t,u,e,n,a,s)})}},3248:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.calculateIm2ColDims=e.createIm2ColProgramInfoLoader=void 0;const r=n(2039);e.createIm2ColProgramInfoLoader=(t,n,i,o,a)=>{const s=(u=a.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[r.TextureType.unpacked],cacheHint:u});var u;return Object.assign(Object.assign({},s),{get:()=>((t,n,i,o,a,s)=>{const u=i.dims,l=o.dims,c=a.length,h=(0,e.calculateIm2ColDims)(u,l,a,4),f=`\n const int XC = ${u[1]};\n const int XH = ${u[2]};\n const int XW = ${u[3]};\n const int KH = ${s.kernelShape[0]};\n const int KW = ${s.kernelShape[1]};\n const int dilationH = ${s.dilations[0]};\n const int dilationW = ${s.dilations[1]};\n const int strideH = ${s.strides[0]};\n const int strideW = ${s.strides[1]};\n const int padH = ${s.pads[0]};\n const int padW = ${s.pads[1]};\n const int KHKW = KH*KW;\n const int XCKHKW = XC * KHKW;\n const int outputChannels = 4;\n vec4 process(int indices[${c}]) {\n int b = indices[0]; // batch size\n int oh = indices[1] * strideH - padH; //output height\n int ow = indices[2] * strideW - padW; //output width\n int p = indices[3] * outputChannels; //patch\n vec4 value = vec4(0.0);\n for(int i=0; i < outputChannels; ++i) {\n if(p < XCKHKW) {\n int patchC = p / KHKW;\n int patchH = (p - patchC*KHKW) / KW;\n int patchW = (p - patchC*KHKW) - patchH * KW;\n int xh2 = oh + patchH * dilationH;\n int xw2 = ow + patchW * dilationW;\n int x[${u.length}];\n x[0] = b;\n x[1] = patchC;\n x[2] = xh2;\n x[3] = xw2;\n if(xh2 >= 0 &&\n xh2 < XH &&\n xw2 >= 0 &&\n xw2 < XW) {\n value[i] = _X(x);\n }\n }\n ++p;\n }\n return value;\n }\n `;return Object.assign(Object.assign({},n),{output:{dims:h,type:i.type,textureType:r.TextureType.packedLastDimension},shaderSource:f})})(0,s,n,i,o,a)})},e.calculateIm2ColDims=(t,e,n,r=4)=>[n[0],n[2],n[3],Math.ceil(t[1]*e[2]*e[3]/r)]},6572:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseImageScalerAttributes=e.imageScaler=void 0;const r=n(246),i=n(2039);e.imageScaler=(t,e,n)=>(u(e),[t.run(a(t,e,n),e)]),e.parseImageScalerAttributes=t=>{const e=t.attributes.getFloat("scale"),n=t.attributes.getFloats("bias");return(0,r.createAttributeWithCacheKey)({scale:e,bias:n})};const o={name:"ImageScaler",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},a=(t,e,n)=>{const r=Object.assign(Object.assign({},o),{cacheHint:n.cacheKey});return Object.assign(Object.assign({},r),{get:()=>((t,e,n,r)=>{const o=n[0].dims.slice(),a=o.length,u=`\n ${s(r.bias.length)}\n float process(int indices[${a}]) {\n return _X(indices) * scale + getBias(bias, indices[1]);\n }`;return Object.assign(Object.assign({},e),{output:{dims:o,type:n[0].type,textureType:i.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:r.bias.length,data:r.bias},{name:"scale",type:"float",data:r.scale}],shaderSource:u})})(0,r,e,n)})},s=t=>{const e=[`float getBias(float bias[${t}], int channel) {`];for(let n=0;n{if(!t||1!==t.length)throw new Error("ImageScaler requires 1 input.");if(4!==t[0].dims.length)throw new Error("Invalid input shape.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw new Error("Invalid input type.")}},3346:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseInstanceNormalizationAttributes=e.instanceNormalization=void 0;const r=n(5060),i=n(2039);e.instanceNormalization=(t,e,n)=>{l(e);const r=t.run(a(e[0]),e);return[t.run(u(t,e[0],n,r.dims),[e[0],r,e[1],e[2]])]},e.parseInstanceNormalizationAttributes=t=>t.attributes.getFloat("epsilon",1e-5);const o={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},a=t=>Object.assign(Object.assign({},o),{get:()=>((t,e)=>{const n=e.dims.slice(),r=n[1],o=n[2]*n[3],a=[n[0],r],s=`\n vec4 process(int[2] indices) {\n vec4 v = vec4(0.0);\n int a[4];\n a[0] = indices[0];\n a[1] = indices[1];\n float temp = 0.0;\n for(int a2=0; a2<${n[2]}; a2++) {\n a[2] = a2;\n for(int a3=0; a3<${n[3]}; a3++) {\n a[3] = a3;\n float x = _X(a);\n temp += x;\n }\n }\n float mean = temp / float(${o});\n temp = 0.0;\n for(int a2=0; a2<${n[2]}; a2++) {\n a[2] = a2;\n for(int a3=0; a3<${n[3]}; a3++) {\n a[3] = a3;\n float x = _X(a);\n temp += (x - mean) * (x - mean);\n }\n }\n v.r = mean;\n v.g = temp / float(${o});\n\n return v;\n }`;return Object.assign(Object.assign({},t),{output:{dims:a,type:e.type,textureType:i.TextureType.packedLastDimension},shaderSource:s})})(o,t)}),s={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[i.TextureType.unpacked,i.TextureType.packedLastDimension,i.TextureType.unpacked,i.TextureType.unpacked]},u=(t,e,n,o)=>{const a=Object.assign(Object.assign({},s),{cacheHint:`${n}`});return Object.assign(Object.assign({},a),{get:()=>((t,e,n,o,a)=>{const s=(0,r.getGlsl)(t.session.backend.glContext.version),[u,l]=t.calculateTextureWidthAndHeight(a,i.TextureType.packedLastDimension),[c,h]=[u/4,l],f=`\n vec4 get_MeanAndVariance(int[2] mv) {\n int offset = indicesToOffset_MeanAndVariance(mv);\n vec2 coords = offsetToCoords(offset, ${c}, ${h});\n return ${s.texture2D}(MeanAndVariance, coords);\n }\n\n float process(int[4] indices) {\n int mv[2];\n mv[0] = indices[0];\n mv[1] = indices[1];\n vec4 mean_and_variance = get_MeanAndVariance(mv);\n float mean = mean_and_variance.r;\n float variance = mean_and_variance.g;\n\n int sb[1];\n sb[0] = indices[1];\n float scale = _Scale(sb);\n float b = _B(sb);\n\n return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b;\n }`;return Object.assign(Object.assign({},e),{output:{dims:n.dims,type:n.type,textureType:i.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:o}],shaderSource:f})})(t,a,e,n,o)})},l=t=>{if(!t||3!==t.length)throw new Error("InstanceNormalization requires 3 inputs.");const e=t[0],n=t[1],r=t[2];if(e.dims.length<3||1!==n.dims.length||1!==r.dims.length)throw new Error("Invalid input shape.");if(n.dims[0]!==e.dims[1]||r.dims[0]!==e.dims[1])throw new Error("Input shapes are mismatched.");if("float32"!==e.type&&"float64"!==e.type||"float32"!==n.type&&"float64"!==n.type||"float32"!==r.type&&"float64"!==r.type)throw new Error("Invalid input type.");if(4!==t[0].dims.length)throw new Error("Only support 4-D input shape.")}},708:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedMatmulProgramInfoLoader=void 0;const r=n(2517),i=n(5060),o=n(2039),a=n(9390),s=n(2823),u=n(5623);e.createPackedMatmulProgramInfoLoader=(t,e,n)=>{const l=(c=e.length>2,h=n.activationCacheKey,{name:"MatMul (packed)",inputNames:c?["A","B","Bias"]:["A","B"],inputTypes:c?[o.TextureType.packed,o.TextureType.packed,o.TextureType.packed]:[o.TextureType.packed,o.TextureType.packed],cacheHint:h});var c,h;return Object.assign(Object.assign({},l),{get:()=>((t,e,n,l)=>{const c=n.length>2,h=c?"value += getBiasForMatmul();":"",f=n[0].dims,d=n[1].dims,p=r.BroadcastUtil.calcShape(f,d,!0),g=!r.ShapeUtil.areEqual(n[0].dims,n[1].dims);if(!p)throw new Error("Can't use matmul on the given tensors");const m=f[f.length-1],b=Math.ceil(m/2),y=f.length,_=d.length,v=(0,i.getGlsl)(t.session.backend.glContext.version),w=(0,a.getCoordsDataType)(p.length),x=p.length,T=(0,a.getGlChannels)(),{activationFunction:E,applyActivation:S}=(0,s.getActivationSnippet)(l),A=c?`${(0,u.getBiasForMatmul)(w,T,n[2].dims,p,!0)}`:"",O=g?`${function(t,e,n,i){let o=[],a=[];const s=n[0].dims,u=n[1].dims,l=s.length,c=u.length,h=i.length,f=h-l,d=h-c;o=s.map(((t,n)=>`coords.${e[n+f]}`)),o[l-1]="i*2",o.join(", "),a=u.map(((t,n)=>`coords.${e[n+d]}`)),a[c-2]="i*2",a.join(", ");const p=r.BroadcastUtil.getBroadcastDims(s,i),g=r.BroadcastUtil.getBroadcastDims(u,i),m=p.map((t=>`coords.${e[t+f]} = 0;`)).join("\n"),b=g.map((t=>`coords.${e[t+d]} = 0;`)).join("\n"),y=`int lastDim = coords.${e[h-1]};\n coords.${e[h-1]} = coords.${e[h-2]};\n coords.${e[h-2]} = lastDim;`;return`\nvec4 getAAtOutCoordsMatmul(int i) {\n ${t} coords = getOutputCoords();\n ${y}\n ${m}\n vec4 outputValue = getA(${o});\n return outputValue;\n}\n\nvec4 getBAtOutCoordsMatmul(int i) {\n ${t} coords = getOutputCoords();\n ${y}\n ${b}\n vec4 outputValue = getB(${a});\n return outputValue;\n}`}(w,T,n,p)}`:"",I=g?"getAAtOutCoordsMatmul(i)":`getA(${function(t,e){let n="";for(let r=0;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBiasForMatmul=e.createMatmulProgramInfoLoader=e.parseMatMulAttributes=e.matMul=void 0;const r=n(2517),i=n(2039),o=n(9390),a=n(2823),s=n(708);function u(t,e){const n=(s=t.length>2,u=e.activationCacheKey,{name:"MatMul",inputNames:s?["A","B","Bias"]:["A","B"],inputTypes:s?[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.unpacked],cacheHint:u});var s,u;return Object.assign(Object.assign({},n),{get:()=>function(t,e,n){const s=e[0].dims,u=e[1].dims,l=r.BroadcastUtil.calcShape(s,u,!0);if(!l)throw new Error("Can't use matmul on the given tensors");const h=(0,o.getCoordsDataType)(l.length),f=(0,o.getGlChannels)(),{activationFunction:d,applyActivation:p}=(0,a.getActivationSnippet)(n),g=e.length>2,m=g?"value += getBiasForMatmul();":"",b=g?`${c(h,f,e[2].dims,l,!1)}`:"",y=l.length,_=s.length,v=u.length,w=`\n ${d}\n ${b}\n float process(int indices[${y}]) {\n int a[${_}];\n int b[${v}];\n bcastMatmulIndices_A(indices, a);\n bcastMatmulIndices_B(indices, b);\n\n float value;\n for (int k=0; k<${s[s.length-1]}; ++k) {\n a[${_-1}] = k;\n b[${v-2}] = k;\n value += _A(a) * _B(b);\n }\n ${m}\n ${p}\n return value;\n }`;return Object.assign(Object.assign({},t),{output:{dims:l,type:e[0].type,textureType:i.TextureType.unpacked},shaderSource:w})}(n,t,e)})}e.matMul=(t,e,n)=>(l(e),t.session.pack?[t.run((0,s.createPackedMatmulProgramInfoLoader)(t,e,n),e)]:[t.run(u(e,n),e)]),e.parseMatMulAttributes=t=>(0,a.parseInternalActivationAttributes)(t.attributes),e.createMatmulProgramInfoLoader=u;const l=t=>{if(!t||2!==t.length)throw new Error("MatMul requires 2 inputs.");if(t[0].dims[t[0].dims.length-1]!==t[1].dims[t[1].dims.length-2])throw new Error("shared dimension does not match.");if("float32"!==t[0].type&&"float64"!==t[0].type||"float32"!==t[1].type&&"float64"!==t[1].type)throw new Error("inputs should be float type");if(t[0].type!==t[1].type)throw new Error("inputs types should match")};function c(t,e,n,i,o){let a="";const s=n.length,u=i.length,l=u-s;a=u<2&&s>0?"coords":n.map(((t,n)=>`coords.${e[n+l]}`)).join(", ");const c=r.BroadcastUtil.getBroadcastDims(n,i).map((t=>`coords.${e[t+l]} = 0;`)).join("\n");let h="vec4(outputValue.xx, outputValue.yy)";return 1===r.ShapeUtil.size(n)&&(h="vec4(outputValue.x)"),o?`\nvec4 getBiasForMatmul() {\n ${t} coords = getOutputCoords();\n ${c}\n vec4 outputValue = getBias(${a});\n return ${h};\n}`:`\nfloat getBiasForMatmul() {\n ${t} coords = getOutputCoords();\n ${c}\n return getBias(coords.x);\n}`}e.getBiasForMatmul=c},2403:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackProgramInfoLoader=void 0;const r=n(5060),i=n(2039),o=n(9390),a=n(2827),s={name:"pack",inputNames:["A"],inputTypes:[i.TextureType.unpackedReversed]};e.createPackProgramInfoLoader=(t,e)=>Object.assign(Object.assign({},s),{get:()=>((t,e)=>{const n=(0,r.getGlsl)(t.session.backend.glContext.version),u=e.dims,l=u.length,c=e.dims.length,h=(0,o.getCoordsDataType)(c),f=(0,a.getChannels)("rc",c),d=(p=c,g=f,m=u[u.length-2],b=u[u.length-1],0===p||1===p?"":`\n int r = ${g[p-2]};\n int c = ${g[p-1]};\n int rp1 = ${g[p-2]} + 1;\n int cp1 = ${g[p-1]} + 1;\n bool rEdge = rp1 >= ${b};\n bool cEdge = cp1 >= ${m};\n `);var p,g,m,b;let y;y=0===l?[1,1]:1===l?[u[0],1]:[u[c-1],u[c-2]];const _=function(t,e,n){if(0===t)return"false";if(1===t)return`rc > ${e[0]}`;let r="";for(let i=t-2;i= ${e[i-t+2]}`,i= ${t[0]} ? 0. : getA(rc + 1),\n 0, 0`;let r="";if(n>2)for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unpackFromChannel=e.getChannels=e.getVecChannels=void 0;const r=n(9390);function i(t,e){return(0,r.getGlChannels)(e).map((e=>`${t}.${e}`))}e.getVecChannels=i,e.getChannels=function(t,e){return 1===e?[t]:i(t,e)},e.unpackFromChannel=function(){return"\n float getChannel(vec4 frag, int dim) {\n int modCoord = imod(dim, 2);\n return modCoord == 0 ? frag.r : frag.g;\n }\n\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 "}},2870:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parsePadAttributesV11=e.padV11=e.parsePadAttributesV2=e.padV2=void 0;const r=n(246),i=n(2517),o=n(5060),a=n(2039),s={name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.padV2=(t,e,n)=>(c(e),[t.run(Object.assign(Object.assign({},s),{cacheHint:n.cacheKey,get:()=>l(t,e[0],n)}),e)]),e.parsePadAttributesV2=t=>{const e=t.attributes.getString("mode","constant"),n=t.attributes.getFloat("value",0),i=t.attributes.getInts("pads");return(0,r.createAttributeWithCacheKey)({mode:e,value:n,pads:i})},e.padV11=(t,n,r)=>{h(n);const i=u(t,n,r);return(0,e.padV2)(t,[n[0]],i)},e.parsePadAttributesV11=t=>t.attributes.getString("mode","constant");const u=(t,e,n)=>{if(!t.session.isInitializer(e[1].dataId)||e.length>=3&&!t.session.isInitializer(e[2].dataId))throw new Error("dynamic pad attributes are not allowed");const i=Array.from(e[1].integerData),o=e.length>=3?e[2].floatData[0]:0;return(0,r.createAttributeWithCacheKey)({mode:n,pads:i,value:o})},l=(t,e,n)=>{const r=i.ShapeUtil.padShape(e.dims.slice(),n.pads),o=r.length,s=`\n ${f(t,e,n)}\n float process(int[${o}] indices) {\n return padA(indices);\n }`;return{name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked],output:{dims:r,type:e.type,textureType:a.TextureType.unpacked},shaderSource:s}},c=t=>{if(!t||1!==t.length)throw new Error("Pad requires 1 input");if("float32"!==t[0].type&&"float64"!==t[0].type)throw new Error("Invalid input type.")},h=t=>{if(!t||2!==t.length&&3!==t.length)throw new Error("Pad requires 2 or 3 inputs");if("int32"!==t[1].type)throw new Error("Invalid input type.");if(t.length>=3&&"string"===t[2].type)throw new Error("Invalid input type.")},f=(t,e,n)=>{const r=(0,o.getGlsl)(t.session.backend.glContext.version),[s,u]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),l=i.ShapeUtil.computeStrides(e.dims);switch(n.mode){case"constant":return d(r,e.dims,l,s,u,n.pads,n.value);case"reflect":return p(r,e.dims,l,s,u,n.pads);case"edge":return g(r,e.dims,l,s,u,n.pads);default:throw new Error("Invalid mode")}},d=(t,e,n,r,i,o,a)=>{const s=e.length;let u="";for(let t=s-1;t>=0;--t)u+=`\n k = m[${t}] - ${o[t]};\n if (k < 0) return constant;\n if (k >= ${e[t]}) return constant;\n offset += k * ${n[t]};\n `;return`\n float padA(int m[${s}]) {\n const float constant = float(${a});\n int offset = 0;\n int k = 0;\n ${u}\n vec2 coords = offsetToCoords(offset, ${r}, ${i});\n float value = getColorAsFloat(${t.texture2D}(A, coords));\n return value;\n }\n `},p=(t,e,n,r,i,o)=>{const a=e.length;let s="";for(let t=a-1;t>=0;--t)s+=`\n k = m[${t}] - ${o[t]};\n if (k < 0) { k = -k; }\n {\n const int _2n_1 = ${2*(e[t]-1)};\n k = int( mod( float(k), float(_2n_1) ) ) ;\n if(k >= ${e[t]}) { k = _2n_1 - k; }\n }\n offset += k * ${n[t]};\n `;return`\n float padA(int m[${a}]) {\n int offset = 0;\n int k = 0;\n ${s}\n vec2 coords = offsetToCoords(offset, ${r}, ${i});\n float value = getColorAsFloat(${t.texture2D}(A, coords));\n return value;\n }\n `},g=(t,e,n,r,i,o)=>{const a=e.length;let s="";for(let t=a-1;t>=0;--t)s+=`\n k = m[${t}] - ${o[t]};\n if (k < 0) k = 0;\n if (k >= ${e[t]}) k = ${e[t]-1};\n offset += k * ${n[t]};\n `;return`\n float padA(int m[${a}]) {\n int offset = 0;\n int k = 0;\n ${s}\n vec2 coords = offsetToCoords(offset, ${r}, ${i});\n float value = getColorAsFloat(${t.texture2D}(A, coords));\n return value;\n }\n `}},2143:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.globalMaxPool=e.parseMaxPoolAttributes=e.maxPool=e.parseGlobalAveragePoolAttributes=e.globalAveragePool=e.parseAveragePoolAttributes=e.averagePool=void 0;const r=n(246),i=n(2517),o=n(2039);e.averagePool=(t,e,n)=>{h(e);const r={name:"AveragePool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:n.cacheKey};return[t.run(Object.assign(Object.assign({},r),{get:()=>a(e,r,!1,n)}),e)]},e.parseAveragePoolAttributes=t=>{const e=t.attributes.getString("auto_pad","NOTSET"),n=t.attributes.getInt("ceil_mode",0),i=0!==t.attributes.getInt("count_include_pad",0),o=t.attributes.getInts("kernel_shape"),a=t.attributes.getInts("strides",[]),s=t.attributes.getInts("pads",[]);if(0!==n)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,r.createAttributeWithCacheKey)({autoPad:e,ceilMode:n,countIncludePad:i,kernelShape:o,strides:a,pads:s})};const a=(t,e,n,r)=>{const[a,s]=u(t,r,n),l=i.ShapeUtil.size(a.kernelShape);let c="";a.countIncludePad?c+=`value /= float(${l});`:c+=`value /= float(${l} - pad);`;const h=`\n ${f(t[0].dims,a,"value += _X(x);",c,"0.0")}\n `;return Object.assign(Object.assign({},e),{output:{dims:s,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:h})};e.globalAveragePool=(t,e,n)=>{h(e);const r={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:`${n.countIncludePad}`};return[t.run(Object.assign(Object.assign({},r),{get:()=>a(e,r,!0,n)}),e)]},e.parseGlobalAveragePoolAttributes=t=>{const e=0!==t.attributes.getInt("count_include_pad",0);return(0,r.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:e,kernelShape:[],strides:[],pads:[]})},e.maxPool=(t,e,n)=>{h(e);const r={name:"MaxPool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:n.cacheKey};return[t.run(Object.assign(Object.assign({},r),{get:()=>s(e,r,!1,n)}),e)]},e.parseMaxPoolAttributes=t=>{const e=t.attributes.getString("auto_pad","NOTSET"),n=t.attributes.getInt("ceil_mode",0),i=t.attributes.getInts("kernel_shape"),o=t.attributes.getInts("strides",[]),a=t.attributes.getInts("pads",[]),s=t.attributes.getInt("storage_order",0),u=t.attributes.getInts("dilations",[]);if(0!==s)throw new Error("column major storage order is not yet supported for MaxPool");if(0!==n)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,r.createAttributeWithCacheKey)({autoPad:e,ceilMode:n,countIncludePad:!1,kernelShape:i,strides:o,pads:a,storageOrder:s,dilations:u})};const s=(t,e,n,r)=>{const[i,a]=u(t,r,n),s=`\n ${f(t[0].dims,i,"\n value = max(_X(x), value);\n ","","-1e5")}\n `;return Object.assign(Object.assign({},e),{output:{dims:a,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:s})},u=(t,e,n)=>{const r=t[0].dims.slice(),o=Object.hasOwnProperty.call(e,"dilations"),a=e.kernelShape.slice(),s=e.strides.slice(),u=o?e.dilations.slice():[],l=e.pads.slice();i.PoolConvUtil.adjustPoolAttributes(n,r,a,s,u,l);const c=i.PoolConvUtil.computePoolOutputShape(n,r,s,u,a,l,e.autoPad),h=Object.assign({},e);return o?Object.assign(h,{kernelShape:a,strides:s,pads:l,dilations:u,cacheKey:e.cacheKey}):Object.assign(h,{kernelShape:a,strides:s,pads:l,cacheKey:e.cacheKey}),[h,c]},l={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},c={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[o.TextureType.unpacked]};e.globalMaxPool=(t,e)=>(h(e),[t.run(Object.assign(Object.assign({},c),{get:()=>s(e,c,!0,l)}),e)]);const h=t=>{if(!t||1!==t.length)throw new Error("Pool ops requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw new Error("Invalid input type.")},f=(t,e,n,r,o)=>{const a=t.length;if(e.kernelShape.length<=2){const i=e.kernelShape[e.kernelShape.length-1],s=e.strides[e.strides.length-1],u=e.pads[e.pads.length/2-1],l=e.pads[e.pads.length-1],c=t[a-1];let h="",f="",d="";if(h=u+l!==0?`\n for (int i = 0; i < ${i}; i++) {\n x[${a} - 1] = indices[${a} - 1] * ${s} - ${u} + i;\n if (x[${a} - 1] < 0 || x[${a} - 1] >= ${c}) {\n pad++;\n continue;\n }\n ${n}\n }`:`\n for (int i = 0; i < ${i}; i++) {\n x[${a} - 1] = indices[${a} - 1] * ${s} - ${u} + i;\n ${n}\n }`,2===e.kernelShape.length){const n=e.kernelShape[e.kernelShape.length-2],r=e.strides[e.strides.length-2],o=e.pads[e.pads.length/2-2],s=e.pads[e.pads.length-2],u=t[a-2];f=o+s!==0?`\n for (int j = 0; j < ${n}; j++) {\n x[${a} - 2] = indices[${a} - 2] * ${r} - ${o} + j;\n if (x[${a} - 2] < 0 || x[${a} - 2] >= ${u}) {\n pad+= ${i};\n continue;\n }\n `:`\n for (int j = 0; j < ${n}; j++) {\n x[${a} - 2] = indices[${a} - 2] * ${r} - ${o} + j;\n `,d="\n }\n "}return`\n float process(int indices[${a}]) {\n int x[${a}];\n copyVec(indices, x);\n\n float value = ${o};\n int pad = 0;\n ${f}\n ${h}\n ${d}\n ${r}\n return value;\n }\n `}{const s=i.ShapeUtil.size(e.kernelShape),u=i.ShapeUtil.computeStrides(e.kernelShape),l=u.length,c=e.pads.length,h=p(l),f=d(t,"inputDims"),g=d(e.pads,"pads"),m=d(u,"kernelStrides"),b=d(e.strides,"strides");let y="";return y=e.pads.reduce(((t,e)=>t+e))?`\n if (x[j] >= inputDims[j] || x[j] < 0) {\n pad++;\n isPad = true;\n break;\n }\n }\n if (!isPad) {\n ${n}\n }`:`\n }\n ${n}\n `,`\n ${h}\n float process(int indices[${a}]) {\n int x[${a}];\n copyVec(indices, x);\n int offset[${l}];\n int pads[${c}];\n int inputDims[${a}];\n int kernelStrides[${l}];\n int strides[${l}];\n ${g}\n ${f}\n ${b}\n ${m}\n\n float value = ${o};\n int pad = 0;\n bool isPad = false;\n for (int i = 0; i < ${s}; i++) {\n offsetToIndices(i, kernelStrides, offset);\n isPad = false;\n for (int j = ${a} - ${l}; j < ${a}; j++) {\n x[j] = indices[j] * strides[j - ${a} + ${l}]\n + offset[j - ${a} + ${l}] - pads[j - 2];\n ${y}\n }\n ${r}\n\n return value;\n }\n `}},d=(t,e)=>{let n="";for(let r=0;r`\n void offsetToIndices(int offset, int[${t}] strides, out int[${t}] indices) {\n if (${t} == 0) {\n return;\n }\n for (int i = 0; i < ${t} - 1; ++i) {\n indices[i] = offset / strides[i];\n offset -= indices[i] * strides[i];\n }\n indices[${t} - 1] = offset;\n }`},4939:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.reduceLogSumSquare=e.reduceLogSum=e.reduceProd=e.reduceMin=e.reduceMax=e.reduceMean=e.reduceSum=e.parseReduceAttributes=void 0;const r=n(246),i=n(782),o=n(2517),a=n(2039),s=(t,e,n,r,i)=>{l(e);const o={name:r,inputNames:["A"],inputTypes:[a.TextureType.unpacked]};return[t.run(Object.assign(Object.assign({},o),{cacheHint:n.cacheKey,get:()=>u(t,e,n,r,i,o)}),e)]};e.parseReduceAttributes=t=>{const e=t.attributes.getInts("axes",[]),n=1===t.attributes.getInt("keepdims",1);return(0,r.createAttributeWithCacheKey)({axes:e,keepDims:n})};const u=(t,e,n,r,i,s)=>{const u=[],l=e[0].dims.length||1,c=[],h=o.ShapeUtil.normalizeAxes(n.axes,e[0].dims.length),f=i(e,h);let d=f[1];for(let t=0;t=0||0===h.length?(n.keepDims&&u.push(1),d=`\n for(int j${t} = 0; j${t} < ${e[0].dims[t]}; j${t}++) {\n inputIdx[${t}] = j${t};\n ${d}\n }`):(c.push(`inputIdx[${t}] = outputIdx[${u.length}];`),u.push(e[0].dims[t]));const p=`\n float process(int outputIdx[${u.length||1}]) {\n float value; // final result\n int inputIdx[${l}]; // addressing input data\n ${c.join("\n")}\n ${f[0]} // init ops for reduce max/min\n ${d}\n ${f[2]} // final computation for reduce mean\n return value;\n }`;return Object.assign(Object.assign({},s),{output:{dims:u,type:e[0].type,textureType:a.TextureType.unpacked},shaderSource:p})},l=t=>{if(!t||1!==t.length)throw new Error("Reduce op requires 1 input.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type))throw new Error("Invalid input type.")};e.reduceSum=(t,e,n)=>s(t,e,n,"ReduceSum",(()=>["value = 0.0;","value += _A(inputIdx);",""])),e.reduceMean=(t,e,n)=>s(t,e,n,"ReduceMean",((t,e)=>{let n=1;for(let r=0;r=0||0===e.length)&&(n*=t[0].dims[r]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${n}.;`]})),e.reduceMax=(t,e,n)=>s(t,e,n,"ReduceMax",((t,e)=>{const n=[];for(let r=0;r=0||0===e.length)&&n.push(`inputIdx[${r}] = 0;`);return[`${n.join("\n")}\nvalue = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]})),e.reduceMin=(t,e,n)=>s(t,e,n,"ReduceMin",((t,e)=>{const n=[];for(let r=0;r=0||0===e.length)&&n.push(`inputIdx[${r}] = 0;`);return[`${n.join("\n")}\nvalue = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]})),e.reduceProd=(t,e,n)=>s(t,e,n,"ReduceProd",(()=>["value = 1.0;","value *= _A(inputIdx);",""])),e.reduceLogSum=(t,e,n)=>s(t,e,n,"ReduceLogSum",(()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"])),e.reduceLogSumSquare=(t,e,n)=>s(t,e,n,"ReduceLogSumSquare",(()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""]))},7019:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isReshapeCheap=e.processDims3D=e.createPackedReshape3DProgramInfoLoader=void 0;const r=n(2517),i=n(5060),o=n(2039),a=n(2827);e.createPackedReshape3DProgramInfoLoader=(t,e,n)=>{const s=(t=>({name:"Reshape (packed)",inputTypes:[o.TextureType.packed],inputNames:["A"],cacheHint:`${t}`}))(n);return Object.assign(Object.assign({},s),{get:()=>((t,e,n,s)=>{const u=e.dims,l=s;let c="";for(let t=0;t<4;t++){let e="";switch(t){case 0:e="outputCoords = rc;";break;case 1:e="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:e="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:e="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}c+=`\n ${e}\n ${t>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""}\n int flattenedIndex = getFlattenedIndex(outputCoords);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex);\n vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[${t}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims);\n\n ${t>0?"}":""}\n `}const h=(0,i.getGlsl)(t.session.backend.glContext.version),f=`\n ${function(t){const e=r.ShapeUtil.computeStrides(t),n=["b","r","c"],i="index";return`\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ${e.map(((t,r)=>`int ${n[r]} = ${i} / ${t}; ${r===e.length-1?`int ${n[r+1]} = ${i} - ${n[r]} * ${t}`:`index -= ${n[r]} * ${t}`};`)).join("")}\n return ivec3(b, r, c);\n }\n `}(u)}\n ${function(t){const e=r.ShapeUtil.computeStrides(t);return`\n int getFlattenedIndex(ivec3 coords) {\n // reverse y, z order\n return coords.x * ${e[0]} + coords.z * ${e[1]} + coords.y;\n }\n`}(l)}\n ${(0,a.unpackFromChannel)()}\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.0);\n\n ivec3 outputCoords;\n int rows = ${l[2]};\n int cols = ${l[1]};\n\n ${c}\n ${h.output} = result;\n }\n `;return Object.assign(Object.assign({},n),{output:{dims:l,type:e.type,textureType:o.TextureType.packed},shaderSource:f,hasMain:!0})})(t,e,s,n)})},e.processDims3D=function(t){if(0===t.length)return[1,1,1];let e=1;for(let n=0;n1?t[t.length-2]:1,t[t.length-1]]},e.isReshapeCheap=function(t,e){let n=!1;return n=0===t.length||0===e.length||(t.length<2||e.length<2?t[t.length-1]===e[e.length-1]:t[t.length-1]===e[e.length-1]&&t[t.length-2]===e[e.length-2]),n}},718:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.reshape=void 0;const r=n(2517);e.reshape=(t,e)=>{const n=r.ShapeUtil.calculateReshapedDims(e[0].dims,e[1].integerData);return t.session.pack?[t.reshapePacked(e[0],n)]:[t.reshapeUnpacked(e[0],n)]}},2268:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseResizeAttributesV11=e.parseResizeAttributesV10=e.resize=void 0;const r=n(5060),i=n(2039),o=n(9390),a=n(2827),s=n(9793),u={name:"Resize",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.resize=(t,e,n)=>((0,s.validateInputs)(e,n),[t.run(Object.assign(Object.assign({},u),{cacheHint:n.cacheKey,get:()=>l(t,e,n)}),e)]),e.parseResizeAttributesV10=t=>(0,s.parseUpsampleAttributes)(t,10),e.parseResizeAttributesV11=t=>(0,s.parseUpsampleAttributes)(t,11);const l=(t,e,n)=>{const s=(0,r.getGlsl)(t.session.backend.glContext.version),[l,h]=c(e,n);if(l.every((t=>1===t))&&"tf_crop_and_resize"!==n.coordinateTransformMode)return Object.assign(Object.assign({},u),{output:{dims:h,type:e[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:`void main() {\n vec4 v = ${s.texture2D}(X, TexCoords);\n ${s.output} = v;\n }`});const f=h.length;if(f<2)throw new Error(`output dimension should be at least 2, but got ${f}`);const d=h[f-2],p=h[f-1],g=e[0].dims;if(f!==g.length)throw new Error(`output dimension should match input ${g.length}, but got ${f}`);const m=g[f-2],b=g[f-1],y=l[f-2],_=l[f-1];let v="";if("linear"!==n.mode)throw new Error(`resize (packed) does not support mode: '${n.mode}'`);switch(n.coordinateTransformMode){case"asymmetric":v="\n vec4 getSourceFracIndex(ivec4 coords) {\n return vec4(coords) / scaleWHWH;\n }\n ";break;case"half_pixel":v="\n vec4 getSourceFracIndex(ivec4 coords) {\n return (vec4(coords) + 0.5) / scaleWHWH - 0.5;\n }\n ";break;case"pytorch_half_pixel":v=`\n vec4 getSourceFracIndex(ivec4 coords) {\n vec4 fcoords = vec4(coords);\n return vec4(\n ${p}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0,\n ${d}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0,\n ${p}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0,\n ${d}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0\n );\n }\n `;break;case"align_corners":v=`\n vec4 getSourceFracIndex(ivec4 coords) {\n vec4 resized = vec4(${p}.0 - 1.0, ${d}.0 - 1.0, ${p}.0 - 1.0,\n ${d}.0 - 1.0);\n vec4 original = vec4(${b}.0 - 1.0, ${m}.0 - 1.0, ${b}.0 - 1.0,\n ${m}.0 - 1.0);\n vec4 new_scale = original / resized;\n return vec4(coords) * new_scale;\n }\n `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${n.coordinateTransformMode}'`)}const w=(0,o.getCoordsDataType)(f),x=`\n const vec2 inputWH = vec2(${m}.0, ${b}.0);\n const vec4 scaleWHWH = vec4(float(${y}), float(${_}), float(${y}), float(${_}));\n ${(0,a.unpackFromChannel)()}\n ${v}\n float getAValue(int x10, int r, int c, int d) {\n return getChannel(getA(x10, r, c, d), vec2(c, d));\n }\n void main() {\n ${w} rc = getOutputCoords();\n\n int batch = rc[0];\n int depth = rc[1];\n\n // retrieve the 4 coordinates that is used in the 4 packed output values.\n ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1);\n\n // calculate the source index in fraction\n vec4 sourceFrac = getSourceFracIndex(coords);\n\n // get the lower and upper bound of the 4 values that will be packed into one texel.\n ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy)));\n ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw)));\n ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy)));\n ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw)));\n\n bool hasNextRow = rc.w < ${d-1};\n bool hasNextCol = rc.z < ${p-1};\n\n // pack x00, x01, x10, x11's top-left corner into one vec4 structure\n vec4 topLeft = vec4(\n getAValue(batch, depth, x00.x, x00.y),\n hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0);\n\n // pack x00, x01, x10, x11's top-right corner into one vec4 structure\n vec4 topRight = vec4(\n getAValue(batch, depth, x00.x, x00.w),\n hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0);\n\n // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure\n vec4 bottomLeft = vec4(\n getAValue(batch, depth, x00.z, x00.y),\n hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0);\n\n // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure\n vec4 bottomRight = vec4(\n getAValue(batch, depth, x00.z, x00.w),\n hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0);\n\n // calculate the interpolation fraction on u and v direction\n vec4 frac = vec4(sourceFrac) - floor(sourceFrac);\n vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0));\n\n vec4 top = mix(topLeft, topRight, clampFrac.ywyw);\n vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw);\n vec4 newValue = mix(top, bottom, clampFrac.xxzz);\n\n ${s.output} = vec4(newValue);\n }\n `;return Object.assign(Object.assign({},u),{output:{dims:h,type:e[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:x})},c=(t,e)=>{const n=t[0].dims;let r,i=e.scales;if(0===i.length){const o=t[e.scalesInputIdx];if(o&&0!==o.size){if(t[e.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");i=h(o,e.mode,e.isResize)}else{const o=t[e.sizesInputIdx];if(!o||0===o.size)throw new Error("Either scales or sizes MUST be provided as input.");r=Array.from(o.integerData),i=f(r,n,e.mode,e.isResize)}}else if(t[e.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const o=r||n.map(((t,e)=>Math.floor(t*i[e])));return[i,o]},h=(t,e,n)=>{const r=Array.from(t.floatData);return(0,s.scalesValidation)(r,e,n),r},f=(t,e,n,r)=>{const i=e.length,o=new Array(i);for(let n=0,r=i;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.shape=void 0;const r=n(9162);e.shape=(t,e)=>(i(e),[new r.Tensor([e[0].dims.length],"int32",void 0,void 0,new Int32Array(e[0].dims))]);const i=t=>{if(!t||1!==t.length)throw new Error("Shape requires 1 input.")}},2278:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sliceV10=e.parseSliceAttributes=e.slice=void 0;const r=n(246),i=n(782),o=n(2517),a=n(2039),s={name:"Slice",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.slice=(t,e,n)=>(l(e),[t.run(Object.assign(Object.assign({},s),{cacheHint:n.cacheKey,get:()=>u(t,e[0],n)}),e)]),e.parseSliceAttributes=t=>{const e=t.attributes.getInts("starts"),n=t.attributes.getInts("ends"),i=t.attributes.getInts("axes",[]);return(0,r.createAttributeWithCacheKey)({starts:e,ends:n,axes:i})};const u=(t,e,n)=>{const r=0===n.axes.length?e.dims.slice(0).map(((t,e)=>e)):n.axes,i=o.ShapeUtil.normalizeAxes(r,e.dims.length),u=n.starts.map(((t,n)=>t>e.dims[i[n]]-1?e.dims[i[n]]:o.ShapeUtil.normalizeAxis(t,e.dims[i[n]]))),l=n.ends.map(((t,n)=>t>e.dims[i[n]]-1?e.dims[i[n]]:o.ShapeUtil.normalizeAxis(t,e.dims[i[n]]))),c=e.dims.slice(),h=[];for(let t=0;t0&&h.push(`outputIdx[${i[t]}] += ${u[t]};`);const f=`\n float process(int outputIdx[${c.length}]) {\n ${h.join("\n ")}\n return _A(outputIdx);\n }`;return Object.assign(Object.assign({},s),{output:{dims:c,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},l=t=>{if(!t||1!==t.length)throw new Error("Slice requires 1 input.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type))throw new Error("Invalid input type.")};e.sliceV10=(t,e)=>{h(e);const n=c(t,e);return[t.run(Object.assign(Object.assign({},s),{cacheHint:n.cacheKey,get:()=>u(t,e[0],n)}),[e[0]])]};const c=(t,e)=>{if(!t.session.isInitializer(e[1].dataId)||!t.session.isInitializer(e[2].dataId)||e.length>=4&&!t.session.isInitializer(e[3].dataId)||e.length>=5&&!t.session.isInitializer(e[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(e.length>=5&&e[4].integerData.some((t=>1!==t)))throw new Error("currently non-1 steps is not supported for Slice");const n=Array.from(e[1].integerData),r=Array.from(e[2].integerData),i=e.length>=4?Array.from(e[3].integerData):[];return{starts:n,ends:r,axes:i,cacheKey:`${i};${n};${r}`}},h=t=>{if(!t||t.length<3||t.length>5)throw new Error("Invalid input number.");if("int32"!==t[1].type||1!==t[1].dims.length)throw new Error("Invalid input type.");if("int32"!==t[2].type||1!==t[2].dims.length)throw new Error("Invalid input type.");if(t.length>=4&&("int32"!==t[3].type||1!==t[3].dims.length))throw new Error("Invalid input type.");if(t.length>=5&&("int32"!==t[4].type||1!==t[4].dims.length))throw new Error("Invalid input type.")}},5524:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.softmaxV13=e.parseSoftmaxAttributesV13=e.parseSoftmaxAttributes=e.softmax=void 0;const r=n(246),i=n(2517),o=n(5060),a=n(2039),s=n(3738),u={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[a.TextureType.unpacked]},l={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},c={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]};e.softmax=(t,e,n)=>{g(e);const r=e[0].dims.slice(),o=i.ShapeUtil.normalizeAxis(n.axis,r.length),a=i.ShapeUtil.sizeToDimension(r,o),s=i.ShapeUtil.sizeFromDimension(r,o);return h(t,e,n,a,s)},e.parseSoftmaxAttributes=t=>(0,r.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",1)}),e.parseSoftmaxAttributesV13=t=>(0,r.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",-1)}),e.softmaxV13=(t,e,n)=>{g(e);const o=e[0].dims.slice(),a=i.ShapeUtil.normalizeAxis(n.axis,o.length),u=o.length,l=a!==u-1,c=[];let f,d=[],p=[];l&&(d=Array.from({length:u}).map(((t,e)=>e)),d[a]=u-1,d[u-1]=a,d.map((t=>c.push(o[t]))),f=(0,r.createAttributeWithCacheKey)({perm:d}),p=(0,s.transpose)(t,e,f));const m=l?i.ShapeUtil.sizeToDimension(c,u-1):i.ShapeUtil.sizeToDimension(o,u-1),b=l?i.ShapeUtil.sizeFromDimension(c,u-1):i.ShapeUtil.sizeFromDimension(o,u-1),y=h(t,l?p:e,n,m,b);return l?(0,s.transpose)(t,y,f):y};const h=(t,e,n,r,i)=>{const o=f(t,e[0],r,i,[r]),a=t.run(Object.assign(Object.assign({},u),{cacheHint:n.cacheKey,get:()=>o}),e),s=d(t,e[0],r,i,o.output.dims,[r]),h=t.run(Object.assign(Object.assign({},l),{cacheHint:n.cacheKey,get:()=>s}),[e[0],a]),g=p(t,e[0],r,i,o.output.dims,s.output.dims);return[t.run(Object.assign(Object.assign({},c),{cacheHint:n.cacheKey,get:()=>g}),[e[0],a,h])]},f=(t,e,n,r,i)=>{const[s,l]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),c=i.length;if(n<1||r<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==i.length)throw new Error("Dimensionality of the output should be 1");if(i[0]!==n)throw new Error("Shape of the output should be equal to logical row count");const h=(0,o.getGlsl)(t.session.backend.glContext.version),f=`\n float process(int[${c}] indices) {\n int logical_row_start_offset = indices[0] * ${r};\n\n float max = getColorAsFloat(${h.texture2D}(A, offsetToCoords(logical_row_start_offset, ${s},\n ${l} )));\n for(int i=1; i<${r}; ++i)\n {\n float current = getColorAsFloat(${h.texture2D}(A, offsetToCoords(logical_row_start_offset + i,\n ${s}, ${l})));\n if(current > max)\n max = current;\n }\n\n return max;\n }`;return Object.assign(Object.assign({},u),{output:{dims:i,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},d=(t,e,n,r,i,s)=>{const[u,c]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),h=s.length;if(n<1||r<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==s.length)throw new Error("Dimensionality of the output should be 1");if(s[0]!==n)throw new Error("Shape of the output should be equal to logical row count");if(1!==i.length)throw new Error("Dimensionality of the intermediate results should be 1");if(i[0]!==n)throw new Error("Shape of the intermediate results should be equal to logical row count");const f=`\n float process(int[${h}] indices) {\n int logical_row_start_offset = indices[0] * ${r};\n\n float norm_factor = 0.0;\n float max = _Max(indices);\n for(int i=0; i<${r}; ++i)\n {\n norm_factor += exp(getColorAsFloat(${(0,o.getGlsl)(t.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i,\n ${u}, ${c}))) - max);\n }\n\n return norm_factor;\n }`;return Object.assign(Object.assign({},l),{output:{dims:s,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},p=(t,e,n,r,i,o)=>{const[s,u]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),l=e.dims.length;if(n<1||r<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==i.length||1!==o.length)throw new Error("Dimensionality of the intermediate results should be 1");if(i[0]!==n||o[0]!==n)throw new Error("Shape of the intermediate results should be equal to logical row count");const h=`\n float process(int[${l}] indices) {\n\n // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords)\n int offset = coordsToOffset(TexCoords, ${s}, ${u});\n\n //determine the logical row for this index\n int logical_row_index[1];\n logical_row_index[0] = offset / ${r};\n\n float norm_factor = _Norm(logical_row_index);\n\n // avoid possible division by 0\n // if norm_facor is 0, all elements are zero\n // if so, return 0\n if(norm_factor == 0.0)\n return 0.0;\n\n return exp(_A(indices) - _Max(logical_row_index)) / norm_factor;\n }`;return Object.assign(Object.assign({},c),{output:{dims:e.dims,type:e.type,textureType:a.TextureType.unpacked},shaderSource:h})},g=t=>{if(!t||1!==t.length)throw new Error("Softmax requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw new Error("Invalid input type")}},5975:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseSplitAttributes=e.split=void 0;const r=n(246),i=n(2517),o=n(2039),a={name:"Split",inputNames:["A"],inputTypes:[o.TextureType.unpacked]};e.split=(t,e,n)=>{l(e);const r=i.ShapeUtil.normalizeAxis(n.axis,e[0].dims.length),o=s(t,e,r,n),c=[];for(let i=0;iu(t,e[0],n,r,i)}),e));return c},e.parseSplitAttributes=t=>{const e=t.attributes.getInt("axis",0),n=t.attributes.getInts("split",[]),i=t.outputs.length;return(0,r.createAttributeWithCacheKey)({axis:e,split:n,numOutputs:i})};const s=(t,e,n,r)=>{const[,o]=i.SplitUtil.splitShape(e[0].dims,n,r.split,r.numOutputs);return o.length},u=(t,e,n,r,s)=>{const[u,l]=i.SplitUtil.splitShape(e.dims,r,n.split,n.numOutputs),c=l[s],h=u[s],f=`\n float process(int indices[${h.length}]) {\n indices[${r}] += ${c};\n return _A(indices);\n }\n `;return Object.assign(Object.assign({},a),{cacheHint:`${n.cacheKey}:${s}`,output:{dims:h,type:e.type,textureType:o.TextureType.unpacked},shaderSource:f})},l=t=>{if(!t||1!==t.length)throw new Error("Split requires one input.");if("int8"!==t[0].type&&"uint8"!==t[0].type&&"int16"!==t[0].type&&"uint16"!==t[0].type&&"int32"!==t[0].type&&"uint32"!==t[0].type&&"float32"!==t[0].type&&"float64"!==t[0].type&&"bool"!==t[0].type)throw new Error("Invalid input type.")}},3933:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseSqueezeAttributes=e.squeezeV13=e.squeeze=void 0;const r=n(2517);e.squeeze=(t,e,n)=>{i(e);const o=r.ShapeUtil.squeezeShape(e[0].dims,n);return[t.reshapeUnpacked(e[0],o)]},e.squeezeV13=(t,n)=>(o(n),(0,e.squeeze)(t,[n[0]],Array.from(n[1].integerData))),e.parseSqueezeAttributes=t=>t.attributes.getInts("axes");const i=t=>{if(!t||1!==t.length)throw new Error("Squeeze requires 1 input.");if("string"===t[0].type)throw new Error("invalid input tensor types.")},o=t=>{if(!t||2!==t.length)throw new Error("Squeeze requires 2 inputs.");if("int32"!==t[1].type)throw new Error("Invalid input type.")}},6558:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sum=void 0;const r=n(5060),i=n(2039);e.sum=(t,e)=>{a(e);const n={name:"Sum",inputNames:e.map(((t,e)=>`X${e}`)),inputTypes:new Array(e.length).fill(i.TextureType.unpacked)};return[t.run(Object.assign(Object.assign({},n),{get:()=>o(t,e,n)}),e)]};const o=(t,e,n)=>{const o=(0,r.getGlsl)(t.session.backend.glContext.version),a=e[0].dims.slice(),s=`\n void main() {\n vec4 result = ${e.map(((t,e)=>`${o.texture2D}(X${e},TexCoords)`)).join(" + ")};\n ${o.output} = result;\n }\n `;return Object.assign(Object.assign({},n),{output:{dims:a,type:e[0].type,textureType:i.TextureType.unpacked},hasMain:!0,shaderSource:s})},a=t=>{if(!t||0===t.length)throw new Error("Sum requires inputs.");const e=t[0].dims.length;for(let n=1;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tile=void 0;const r=n(782),i=n(2039);e.tile=(t,e)=>{a(e);const n={name:"Tile",inputNames:["A"],inputTypes:[i.TextureType.unpacked]};return[t.run(Object.assign(Object.assign({},n),{get:()=>o(t,e,n)}),e)]};const o=(t,e,n)=>{const r=e[0].dims.slice(),o=new Array(r.length),a=[];for(let t=0;t{if(!t||2!==t.length)throw new Error("Tile requires 2 input.");if(1!==t[1].dims.length)throw new Error("The second input shape must 1 dimension.");if(t[1].dims[0]!==t[0].dims.length)throw new Error("Invalid input shape.");if(-1===r.NUMBER_TYPES.indexOf(t[0].type))throw new Error("Invalid input type.");if("int32"!==t[1].type&&"int16"!==t[1].type)throw new Error("Invalid repeat type.")}},3738:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseTransposeAttributes=e.transpose=void 0;const r=n(246),i=n(2517),o=n(2039),a={name:"Transpose",inputNames:["A"],inputTypes:[o.TextureType.unpacked]};e.transpose=(t,e,n)=>(h(e),[t.run(Object.assign(Object.assign({},a),{cacheHint:n.cacheKey,get:()=>s(t,e[0],n.perm)}),e)]),e.parseTransposeAttributes=t=>(0,r.createAttributeWithCacheKey)({perm:t.attributes.getInts("perm",[])});const s=(t,e,n)=>{const r=e.dims;n=u(r,n);const i=l(r,n),s=r.length,h=`\n ${c("perm",n,s)}\n float process(int indices[${s}]) {\n int a[${s}];\n perm(a, indices);\n return _A(a);\n }`;return Object.assign(Object.assign({},a),{output:{dims:i,type:e.type,textureType:o.TextureType.unpacked},shaderSource:h})},u=(t,e)=>(e&&e.length!==t.length&&(e=[...t.keys()].reverse()),e),l=(t,e)=>(e=u(t,e),i.ShapeUtil.sortBasedOnPerm(t,e)),c=(t,e,n)=>{const r=[];r.push(`void ${t}(out int a[${n}], int src[${n}]) {`);for(let t=0;t{if(!t||1!==t.length)throw new Error("Transpose requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw new Error("input should be float tensor")}},8710:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encodeAsUint8=void 0;const r=n(5060),i=n(2039);e.encodeAsUint8=(t,e)=>{const n=e.shape,o=(0,r.getGlsl)(t.session.backend.glContext.version),a=`\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n bool isNaN(float val) {\n return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true;\n }\n\n highp vec4 encodeAsUint8(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\n void main() {\n float value = ${o.texture2D}(X,TexCoords).r;\n ${o.output} = encodeAsUint8(value);\n }`,s={name:"Uint8Encode",inputTypes:[i.TextureType.unpacked],inputNames:["X"],output:{dims:n,type:e.tensor.type,textureType:i.TextureType.downloadUint8AsFloat},shaderSource:a,hasMain:!0};return t.executeProgram(s,[e.tensor])}},4909:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tanh=e.tan=e.sqrt=e.sin=e.sigmoid=e.relu=e.not=e.neg=e.log=e.parseLeakyReluAttributes=e.leakyRelu=e.identity=e.floor=e.exp=e.parseEluAttributes=e.elu=e.cos=e.ceil=e.clipV11=e.parseClipAttributes=e.clip=e.atan=e.asin=e.acos=e.abs=e.glslTanh=e.glslTan=e.glslSqrt=e.glslSigmoid=e.glslRelu=e.glslSin=e.glslNot=e.glslNeg=e.glslLog=e.glslLeakyRelu=e.glslIdentity=e.glslClip=e.glslFloor=e.glslExp=e.glslElu=e.glslCos=e.glslCeil=e.glslAtan=e.glslAsin=e.glslAcos=e.glslAbs=void 0;const r=n(246),i=n(2517),o=n(8520),a=n(5060),s=n(2039);function u(){return P("abs")}function l(){return P("acos")}function c(){return P("asin")}function h(){return P("atan")}function f(){return P("ceil")}function d(){return P("cos")}function p(t){const e="elu";return{body:`\n const float alpha = float(${t});\n\n float ${e}_(float a) {\n return a >= 0.0 ? a: (exp(a) - 1.0) * alpha;\n }\n vec4 ${e}_(vec4 v) {\n return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w));\n }\n `,name:e,type:o.FunctionType.ValueBased}}function g(){return P("exp")}function m(){return P("floor")}function b(t,e){const n="clip";return{body:`\n const float min = float(${t});\n const float max = float(${e});\n\n float ${n}_(float a) {\n return clamp(a, min, max);\n }\n vec4 ${n}_(vec4 v) {\n return clamp(v, min, max);\n }\n `,name:n,type:o.FunctionType.ValueBased}}function y(){const t="indentity";return{body:`\n float ${t}_(float a) {\n return a;\n }\n vec4 ${t}_(vec4 v) {\n return v;\n }\n `,name:t,type:o.FunctionType.ValueBased}}function _(t){const e="leakyRelu";return{body:`\n const float alpha = float(${t});\n\n float ${e}_(float a) {\n return a < 0.0 ? a * alpha : a;\n }\n vec4 ${e}_(vec4 v) {\n return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w));\n }\n `,name:e,type:o.FunctionType.ValueBased}}function v(){return P("log")}function w(){const t="neg";return{body:`\n float ${t}_(float a) {\n return -a;\n }\n vec4 ${t}_(vec4 v) {\n return -v;\n }\n `,name:t,type:o.FunctionType.ValueBased}}function x(){const t="not";return{body:`\n float ${t}_(float a) {\n return float( ! bool(a) );\n }\n bool ${t}_(bool a) {\n return !a;\n }\n vec4 ${t}_(vec4 v) {\n return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w));\n }\n bvec4 ${t}_(bvec4 v) {\n return bvec4(!v.x, !v.y, !v.z, !v.w);\n }\n `,name:t,type:o.FunctionType.ValueBased}}function T(){return P("sin")}function E(){const t="relu";return{body:`\n float ${t}_(float a) {\n return max( a, 0.0 );\n }\n vec4 ${t}_(vec4 v) {\n return max( v, 0.0 );\n }\n `,name:t,type:o.FunctionType.ValueBased}}function S(){const t="sigmoid";return{body:`\n float ${t}_(float a) {\n return 1.0 / (1.0 + exp(-a));\n }\n vec4 ${t}_(vec4 v) {\n return 1.0 / (1.0 + exp(-v));\n }\n `,name:t,type:o.FunctionType.ValueBased}}function A(){return P("sqrt")}function O(){return P("tan")}function I(){const t="tanh";return{body:`\n float ${t}_(float a) {\n a = clamp(a, -10., 10.);\n a = exp(2.*a);\n return (a - 1.) / (a + 1.);\n }\n vec4 ${t}_(vec4 v) {\n v = clamp(v, -10., 10.);\n v = exp(2.*v);\n return (v - 1.) / (v + 1.);\n }\n `,name:t,type:o.FunctionType.ValueBased}}function P(t){return{body:`\n float ${t}_(float a) {\n return ${t}(a);\n }\n vec4 ${t}_(vec4 v) {\n return ${t}(v);\n }\n `,name:t,type:o.FunctionType.ValueBased}}e.glslAbs=u,e.glslAcos=l,e.glslAsin=c,e.glslAtan=h,e.glslCeil=f,e.glslCos=d,e.glslElu=p,e.glslExp=g,e.glslFloor=m,e.glslClip=b,e.glslIdentity=y,e.glslLeakyRelu=_,e.glslLog=v,e.glslNeg=w,e.glslNot=x,e.glslSin=T,e.glslRelu=E,e.glslSigmoid=S,e.glslSqrt=A,e.glslTan=O,e.glslTanh=I;const k=(t,e,n,r)=>{const i=t.session.pack?s.TextureType.packed:s.TextureType.unpacked,o={name:n.name,inputTypes:[i],inputNames:["A"],cacheHint:r};return Object.assign(Object.assign({},o),{get:()=>((t,e,n,r)=>{const i=t.session.pack?s.TextureType.packed:s.TextureType.unpacked,o=(0,a.getGlsl)(t.session.backend.glContext.version);return Object.assign(Object.assign({},e),{output:{dims:n.dims,type:n.type,textureType:i},shaderSource:`\n ${r.body}\n void main() {\n vec4 v = ${o.texture2D}(A, TexCoords);\n v = ${r.name}_(v);\n ${o.output} = v;\n }\n `,hasMain:!0})})(t,o,e,n)})};e.abs=(t,e)=>[t.run(k(t,e[0],u()),e)],e.acos=(t,e)=>[t.run(k(t,e[0],l()),e)],e.asin=(t,e)=>[t.run(k(t,e[0],c()),e)],e.atan=(t,e)=>[t.run(k(t,e[0],h()),e)],e.clip=(t,e,n)=>[t.run(k(t,e[0],b(n.min,n.max),n.cacheKey),e)],e.parseClipAttributes=t=>(0,r.createAttributeWithCacheKey)({min:t.attributes.getFloat("min",i.MIN_CLIP),max:t.attributes.getFloat("max",i.MAX_CLIP)}),e.clipV11=(t,n)=>{const r=M(t,n);return(0,e.clip)(t,[n[0]],r)};const M=(t,e)=>{if(e.length>=3&&(!t.session.isInitializer(e[1].dataId)||!t.session.isInitializer(e[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const n=e.length>=3?e[1].numberData[0]:i.MIN_CLIP,o=e.length>=3?e[2].numberData[0]:i.MAX_CLIP;return(0,r.createAttributeWithCacheKey)({min:n,max:o})};e.ceil=(t,e)=>[t.run(k(t,e[0],f()),e)],e.cos=(t,e)=>[t.run(k(t,e[0],d()),e)],e.elu=(t,e,n)=>[t.run(k(t,e[0],p(n.alpha),n.cacheKey),e)],e.parseEluAttributes=t=>(0,r.createAttributeWithCacheKey)({alpha:t.attributes.getFloat("alpha",1)}),e.exp=(t,e)=>[t.run(k(t,e[0],g()),e)],e.floor=(t,e)=>[t.run(k(t,e[0],m()),e)],e.identity=(t,e)=>[t.run(k(t,e[0],y()),e)],e.leakyRelu=(t,e,n)=>[t.run(k(t,e[0],_(n.alpha),n.cacheKey),e)],e.parseLeakyReluAttributes=t=>(0,r.createAttributeWithCacheKey)({alpha:t.attributes.getFloat("alpha",.01)}),e.log=(t,e)=>[t.run(k(t,e[0],v()),e)],e.neg=(t,e)=>[t.run(k(t,e[0],w()),e)],e.not=(t,e)=>[t.run(k(t,e[0],x()),e)],e.relu=(t,e)=>[t.run(k(t,e[0],E()),e)],e.sigmoid=(t,e)=>[t.run(k(t,e[0],S()),e)],e.sin=(t,e)=>[t.run(k(t,e[0],T()),e)],e.sqrt=(t,e)=>[t.run(k(t,e[0],A()),e)],e.tan=(t,e)=>[t.run(k(t,e[0],O()),e)],e.tanh=(t,e)=>[t.run(k(t,e[0],I()),e)]},5611:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackProgramInfoLoader=e.createUnpackProgramInfo=void 0;const r=n(5060),i=n(2039),o=n(9390),a=n(2827),s={name:"unpack",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.createUnpackProgramInfo=(t,e)=>{const n=e.dims.length,u=(0,a.getChannels)("rc",n),l=u.slice(-2),c=(0,o.getCoordsDataType)(n),h=(0,a.unpackFromChannel)(),f=0===e.dims.length?"":function(t,e){if(1===t)return"rc";let n="";for(let r=0;rObject.assign(Object.assign({},s),{get:()=>(0,e.createUnpackProgramInfo)(t,n)})},8428:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseUnsqueezeAttributes=e.unsqueezeV13=e.unsqueeze=void 0;const r=n(2517);e.unsqueeze=(t,e,n)=>{i(e);const o=r.ShapeUtil.unsqueezeShape(e[0].dims,n);return[t.reshapeUnpacked(e[0],o)]},e.unsqueezeV13=(t,n)=>(o(n),(0,e.unsqueeze)(t,[n[0]],Array.from(n[1].integerData))),e.parseUnsqueezeAttributes=t=>t.attributes.getInts("axes");const i=t=>{if(!t||1!==t.length)throw new Error("Unsqueeze requires 1 input.");if("string"===t[0].type)throw new Error("invalid input tensor types.")},o=t=>{if(!t||2!==t.length)throw new Error("Unsqueeze requires 2 inputs.");if("int32"!==t[1].type)throw new Error("Invalid input type.")}},9793:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.scalesValidation=e.validateInputs=e.parseUpsampleAttributes=e.parseUpsampleAttributesV9=e.parseUpsampleAttributesV7=e.upsample=void 0;const r=n(246),i=n(5060),o=n(2039),a={name:"Upsample",inputNames:["X"],inputTypes:[o.TextureType.unpacked]};e.upsample=(t,n,r)=>((0,e.validateInputs)(n,r),[t.run(Object.assign(Object.assign({},a),{cacheHint:r.cacheKey,get:()=>s(t,n,r)}),n)]),e.parseUpsampleAttributesV7=t=>(0,e.parseUpsampleAttributes)(t,7),e.parseUpsampleAttributesV9=t=>(0,e.parseUpsampleAttributes)(t,9),e.parseUpsampleAttributes=(t,n)=>{const i=n>=10,o=t.attributes.getString("mode","nearest");if("nearest"!==o&&"linear"!==o&&(n<11||"cubic"!==o))throw new Error(`unrecognized mode: ${o}`);let a=[];n<9&&(a=t.attributes.getFloats("scales"),(0,e.scalesValidation)(a,o,i));const s=t.attributes.getFloat("extrapolation_value",0),u=n>10?t.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(-1===["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(u))throw new Error(`coordinate_transform_mode '${u}' is not supported`);const l="tf_crop_and_resize"===u,c=l,h="nearest"===o&&n>=11?t.attributes.getString("nearest_mode","round_prefer_floor"):"";if(-1===["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(h))throw new Error(`nearest_mode '${h}' is not supported`);const f=t.attributes.getFloat("cubic_coeff_a",-.75),d=0!==t.attributes.getInt("exclude_outside",0);if(d&&"cubic"!==o)throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const p=n<11||"nearest"===o&&"asymmetric"===u&&"floor"===h;let g=0,m=0,b=0;return n>10?t.inputs.length>2?(g=1,m=2,b=3):(m=1,b=2):9===n&&(m=1),(0,r.createAttributeWithCacheKey)({opset:n,isResize:i,mode:o,scales:a,extrapolationValue:s,coordinateTransformMode:u,useExtrapolation:c,needRoiInput:l,nearestMode:h,cubicCoefficientA:f,excludeOutside:d,useNearest2xOptimization:p,roiInputIdx:g,scalesInputIdx:m,sizesInputIdx:b})};const s=(t,e,n)=>{const r=(0,i.getGlsl)(t.session.backend.glContext.version),[s,u]=t.calculateTextureWidthAndHeight(e[0].dims,o.TextureType.unpacked),l=e[0].dims.map(((t,e)=>Math.floor(t*n.scales[e]))),[c,h]=t.calculateTextureWidthAndHeight(l,o.TextureType.unpacked),f=l.length,d=new Array(f),p=new Array(f);let g=`\n int output_pitches[${f}];\n int input_pitches[${f}];\n `;for(let t=f-1;t>=0;t--)d[t]=t===f-1?1:d[t+1]*l[t+1],p[t]=t===f-1?1:p[t+1]*e[0].dims[t+1],g+=`\n output_pitches[${t}] = ${d[t]};\n input_pitches[${t}] = ${p[t]};\n `;const m=`\n float getInputFloat(int index) {\n vec2 coords = offsetToCoords(index, ${s}, ${u});\n float value = getColorAsFloat(${r.texture2D}(X, coords));\n return value;\n }\n `,b="nearest"===n.mode?`\n ${m}\n float process(int indices[${f}]) {\n int input_index = 0;\n int output_index = coordsToOffset(TexCoords, ${c}, ${h});\n\n ${g}\n\n int d, m;\n for (int dim = 0; dim < ${f}; ++dim) {\n d = output_index / output_pitches[dim];\n m = output_index - d * output_pitches[dim];\n output_index = m;\n\n if (scales[dim] != 1 && d > 0) {\n int d2 = d / scales[dim];\n m = d - d2 * scales[dim];\n d = d2;\n }\n input_index += input_pitches[dim] * d;\n }\n\n return getInputFloat(input_index);\n }`:4===f?`\n ${m}\n float process(int indices[4]) {\n int input_index = 0;\n int output_index = coordsToOffset(TexCoords, ${c}, ${h});\n\n ${g}\n\n int m;\n int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3;\n index_of_dim0 = output_index / output_pitches[0];\n m = output_index - index_of_dim0 * output_pitches[0];\n index_of_dim1 = m / output_pitches[1];\n m = m - index_of_dim1 * output_pitches[1];\n index_of_dim2 = m / output_pitches[2];\n m = m - index_of_dim2 * output_pitches[2];\n index_of_dim3 = m;\n\n int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset;\n index_of_input_dim2 = index_of_dim2 / scales[2];\n y_offset = index_of_dim2 - index_of_input_dim2 * scales[2];\n index_of_input_dim3 = index_of_dim3 / scales[3];\n x_offset = index_of_dim3 - index_of_input_dim3 * scales[3];\n\n input_index = index_of_dim0 * input_pitches[0] +\n index_of_dim1 * input_pitches[1] +\n index_of_input_dim2 * input_pitches[2] +\n index_of_input_dim3;\n\n float x00 = getInputFloat(input_index);\n float x10, x01, x11;\n\n bool end_of_dim2 = false;\n if (index_of_input_dim2 == (${e[0].dims[2]} - 1)) {\n // It's the end in dimension 2\n x01 = x00;\n end_of_dim2 = true;\n } else {\n x01 = getInputFloat(input_index + input_pitches[2]);\n }\n\n if (index_of_input_dim3 == (input_pitches[2] - 1)) {\n // It's the end in dimension 3\n x10 = x00;\n x11 = x01;\n }\n else {\n x10 = getInputFloat(input_index + 1);\n x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1);\n }\n\n float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]);\n float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]);\n return y0 + float(x_offset) * (y1 - y0) / float(scales[3]);\n }`:`\n ${m}\n float process(int indices[2]) {\n int input_index = 0;\n int output_index = coordsToOffset(TexCoords, ${c}, ${h});\n\n ${g}\n\n int m;\n int index_of_dim0, index_of_dim1;\n index_of_dim0 = output_index / output_pitches[0];\n m = output_index - index_of_dim0 * output_pitches[0];\n index_of_dim1 = m;\n\n int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset;\n index_of_input_dim0 = index_of_dim0 / scales[0];\n y_offset = index_of_dim0 - index_of_input_dim0 * scales[0];\n index_of_input_dim1 = index_of_dim1 / scales[1];\n x_offset = index_of_dim1 - index_of_input_dim1 * scales[1];\n\n input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1;\n\n float x00 = getInputFloat(input_index);\n float x10, x01, x11;\n\n bool end_of_dim0 = false;\n if (index_of_input_dim0 == (${e[0].dims[0]} - 1)) {\n // It's the end in dimension 0\n x01 = x00;\n end_of_dim0 = true;\n } else {\n x01 = getInputFloat(input_index + input_pitches[0]);\n }\n\n if (index_of_input_dim1 == (input_pitches[0] - 1)) {\n // It's the end in dimension 1\n x10 = x00;\n x11 = x01;\n }\n else {\n x10 = getInputFloat(input_index + 1);\n x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1);\n }\n\n float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]);\n float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]);\n return y0 + float(x_offset) * (y1 - y0) / float(scales[1]);\n }`;return Object.assign(Object.assign({},a),{output:{dims:l,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:b,variables:[{name:"scales",type:"int",arrayLength:n.scales.length,data:n.scales.map((t=>Math.ceil(t)))}]})};e.validateInputs=(t,e)=>{if(!t||e.opset<9&&1!==t.length||e.opset>=9&&e.opset<11&&2!==t.length||e.opset>=11&&t.length<2)throw new Error("invalid inputs.");if(e.scales.length>0&&t[0].dims.length!==e.scales.length)throw new Error("Invalid input shape.");if("string"===t[0].type)throw new Error("Invalid input tensor types.")},e.scalesValidation=(t,e,n)=>{if(n){for(const e of t)if(e<=0)throw new Error("Scale value should be greater than 0.")}else for(const e of t)if(e<1)throw new Error("Scale value should be greater than or equal to 1.");if(!("linear"!==e&&"cubic"!==e||2===t.length||4===t.length&&1===t[0]&&1===t[1]))throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${n?"Resize":"Upsample"} opeartor.`)}},1958:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgramManager=void 0;const r=n(1670),i=n(6231),o=n(8879),a=n(5060);e.ProgramManager=class{constructor(t,e,n){this.profiler=t,this.glContext=e,this.textureLayoutStrategy=n,this.repo=new Map,this.attributesBound=!1}getArtifact(t){return this.repo.get(t)}setArtifact(t,e){this.repo.set(t,e)}run(t,e,n){var r;this.profiler.event("op",`ProgramManager.run ${null!==(r=t.programInfo.name)&&void 0!==r?r:"unknown kernel"}`,(()=>{var r;const o=this.glContext.gl,a=t.program;o.useProgram(a);try{this.bindOutput(n),this.attributesBound||this.bindAttributes(t.attribLocations),this.bindUniforms(t.uniformLocations,null!==(r=t.programInfo.variables)&&void 0!==r?r:[],e)}catch(e){throw i.Logger.error("ProgramManager",t.programInfo.shaderSource),e}this.profiler.event("backend","GlContext.draw()",(()=>{this.glContext.draw()}))}),this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach((t=>this.glContext.deleteProgram(t.program)))}build(t,e,n){return this.profiler.event("backend","ProgramManager.build",(()=>{const r=new o.GlslPreprocessor(this.glContext,t,e,n),i=r.preprocess(),a=this.compile(i);return{programInfo:t,program:a,uniformLocations:this.getUniformLocations(a,r.context.programInfo.inputNames,r.context.programInfo.variables),attribLocations:this.getAttribLocations(a)}}))}compile(t){if(!this.vertexShader){i.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const t=(0,a.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(t,this.glContext.gl.VERTEX_SHADER)}r.env.debug&&i.Logger.verbose("ProrgramManager",`FragShader:\n${t}\n`);const e=this.glContext.compileShader(t,this.glContext.gl.FRAGMENT_SHADER),n=this.glContext.createProgram(this.vertexShader,e);return this.glContext.deleteShader(e),n}bindOutput(t){const e=t.width,n=t.height;i.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${e}/${n}, shape=${t.shape}, type=${t.tensor.type}`),this.glContext.attachFramebuffer(t.texture,e,n)}bindAttributes(t){const e=t.position,n=t.textureCoord;this.glContext.setVertexAttributes(e,n),this.attributesBound=!0}bindUniforms(t,e,n){var r;const i=this.glContext.gl;let o=0;for(const{name:a,type:s,location:u,arrayLength:l}of t){const t=null===(r=e.find((t=>t.name===a)))||void 0===r?void 0:r.data;if("sampler2D"!==s&&!t)throw new Error(`variable '${a}' does not have data defined in program info`);switch(s){case"sampler2D":this.bindTexture(n[o],u,o),o++;break;case"float":l?i.uniform1fv(u,t):i.uniform1f(u,t);break;case"int":l?i.uniform1iv(u,t):i.uniform1i(u,t);break;default:throw new Error(`Uniform not implemented: ${s}`)}}}bindTexture(t,e,n){this.glContext.bindTextureToUniform(t.texture,n,e)}getAttribLocations(t){return{position:this.getAttribLocation(t,"position"),textureCoord:this.getAttribLocation(t,"textureCoord")}}getUniformLocations(t,e,n){const r=[];if(e)for(const n of e)r.push({name:n,type:"sampler2D",location:this.getUniformLocation(t,n)});if(n)for(const e of n)r.push(Object.assign(Object.assign({},e),{location:this.getUniformLocation(t,e.name)}));return r}getUniformLocation(t,e){const n=this.glContext.gl.getUniformLocation(t,e);if(null===n)throw new Error(`Uniform ${e} not found.`);return n}getAttribLocation(t,e){return this.glContext.gl.getAttribLocation(t,e)}}},6416:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLSessionHandler=void 0;const r=n(6231),i=n(1047),o=n(8316),a=n(1640),s=n(1958),u=n(7859),l=n(5702);e.WebGLSessionHandler=class{constructor(t,e){this.backend=t,this.context=e,this.layoutStrategy=new u.PreferLogicalStrategy(t.glContext.maxTextureSize),this.programManager=new s.ProgramManager(this.context.profiler,t.glContext,this.layoutStrategy),this.textureManager=new l.TextureManager(t.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:"full"===t.textureCacheMode}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=t.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new o.WebGLInferenceHandler(this)}onGraphInitialized(t){const e=t.getValues().filter((t=>-1===t.from&&t.tensor)).map((t=>t.tensor.dataId));this.initializers=new Set(e)}isInitializer(t){return!!this.initializers&&this.initializers.has(t)}addInitializer(t){this.initializers.add(t)}getTextureData(t,e){return e?this.packedTextureDataCache.get(t):this.unpackedTextureDataCache.get(t)}setTextureData(t,e,n=!1){r.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),n?this.packedTextureDataCache.set(t,e):this.unpackedTextureDataCache.set(t,e)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach((t=>this.textureManager.releaseTexture(t,!0))),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach((t=>this.textureManager.releaseTexture(t,!0))),this.unpackedTextureDataCache=new Map}resolve(t,e,n){const r=(0,i.resolveOperator)(t,e,a.WEBGL_OP_RESOLVE_RULES);return{impl:r.opImpl,context:r.opInit?r.opInit(t,n):t}}}},7769:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Uint8DataEncoder=e.RGBAFloatDataEncoder=e.RedFloat32DataEncoder=void 0;const r=n(6231);e.RedFloat32DataEncoder=class{constructor(t,e=1){if(1===e)this.internalFormat=t.R32F,this.format=t.RED,this.textureType=t.FLOAT,this.channelSize=e;else{if(4!==e)throw new Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA32F,this.format=t.RGBA,this.textureType=t.FLOAT,this.channelSize=e}}encode(t,e){let n,i;return t.constructor!==Float32Array&&(r.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),i=new Float32Array(t)),e*this.channelSize>t.length?(r.Logger.warning("Encoder","Source data too small. Allocating larger array"),i=t,n=this.allocate(e*this.channelSize),i.forEach(((t,e)=>n[e]=t))):(i=t,n=i),n}allocate(t){return new Float32Array(4*t)}decode(t,e){return 1===this.channelSize?t.filter(((t,e)=>e%4==0)).subarray(0,e):t.subarray(0,e)}},e.RGBAFloatDataEncoder=class{constructor(t,e=1,n){if(1!==e&&4!==e)throw new Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA,this.format=t.RGBA,this.channelSize=e,this.textureType=n||t.FLOAT}encode(t,e){let n=t;return 1===this.channelSize&&(r.Logger.verbose("Encoder","Exploding into a larger array"),n=this.allocate(e),t.forEach(((t,e)=>n[4*e]=t))),n}allocate(t){return new Float32Array(4*t)}decode(t,e){return 1===this.channelSize?t.filter(((t,e)=>e%4==0)).subarray(0,e):t.subarray(0,e)}},e.Uint8DataEncoder=class{constructor(t,e=1){if(this.channelSize=4,1===e)this.internalFormat=t.ALPHA,this.format=t.ALPHA,this.textureType=t.UNSIGNED_BYTE,this.channelSize=e;else{if(4!==e)throw new Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA,this.format=t.RGBA,this.textureType=t.UNSIGNED_BYTE,this.channelSize=e}}encode(t,e){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}allocate(t){return new Uint8Array(t*this.channelSize)}decode(t,e){if(t instanceof Uint8Array)return t.subarray(0,e);throw new Error(`Invalid array type: ${t.constructor}`)}}},7859:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBatchDim=e.sizeToSquarishShape=e.getRowsCols=e.sizeFromShape=e.isInt=e.parseAxisParam=e.squeezeShape=e.PreferLogicalStrategy=e.AlwaysKeepOriginalSizeStrategy=void 0;const r=n(6231),i=n(2517);function o(t,e){const n=[],r=[],i=null!=e&&Array.isArray(e)&&0===e.length,o=null==e||i?null:a(e,t).sort();let s=0;for(let e=0;ee)&&1===t[e]&&(n.push(t[e]),r.push(e)),o[s]<=e&&s++}1!==t[e]&&(n.push(t[e]),r.push(e))}return{newShape:n,keptDims:r}}function a(t,e){const n=e.length;return t=null==t?e.map(((t,e)=>e)):[].concat(t),(0,i.assert)(t.every((t=>t>=-n&&t`All values in axis param must be in range [-${n}, ${n}) but got axis ${t}`)),(0,i.assert)(t.every(s),(()=>`All values in axis param must be integers but got axis ${t}`)),t.map((t=>t<0?n+t:t))}function s(t){return t%1==0}function u(t){if(0===t.length)return 1;let e=t[0];for(let n=1;n=t.length?1:t.slice(e.breakAxis).reduce(((t,e)=>t*e)),o=e.breakAxis<=0?1:t.slice(0,e.breakAxis).reduce(((t,e)=>t*e));if(!(i>n||o>n))return[i,o];r.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${t}, breakAxis:${e.breakAxis}`)}const i=t.reduce(((t,e)=>t*e));let o=Math.floor(Math.sqrt(i));for(;o=n||i%o!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${t}`);return[o,i/o]}},e.PreferLogicalStrategy=class{constructor(t){this.maxTextureSize=t}computeTextureWH(t,e){const n=this.computeTexture(t,e);return e&&e.isPacked&&(n[0]/=2,n[1]/=2),e&&e.reverseWH?[n[1],n[0]]:n}computeTexture(t,e){const n=e&&e.isPacked;if(0===t.length)return n?[2,2]:[1,1];let i=this.maxTextureSize;if(e&&void 0!==e.breakAxis){const n=e.breakAxis>=t.length?1:t.slice(e.breakAxis).reduce(((t,e)=>t*e)),o=e.breakAxis<=0?1:t.slice(0,e.breakAxis).reduce(((t,e)=>t*e));if(!(n>i||o>i))return[n,o];r.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${t}, breakAxis:${e.breakAxis}`)}let a=t.slice(0);if(n&&(i*=2,a=a.map(((t,e)=>e>=a.length-2?a[e]%2==0?a[e]:a[e]+1:a[e])),1===a.length&&(a=[2,a[0]])),2!==a.length){const t=o(a);a=t.newShape}const s=u(a);return a.length<=1&&s<=i?[1,s]:2===a.length&&a[0]<=i&&a[1]<=i?a:3===a.length&&a[0]*a[1]<=i&&a[2]<=i?[a[0]*a[1],a[2]]:3===a.length&&a[0]<=i&&a[1]*a[2]<=i?[a[0],a[1]*a[2]]:4===a.length&&a[0]*a[1]*a[2]<=i&&a[3]<=i?[a[0]*a[1]*a[2],a[3]]:4===a.length&&a[0]<=i&&a[1]*a[2]*a[3]<=i?[a[0],a[1]*a[2]*a[3]]:n?l(s/4).map((t=>2*t)):l(s)}},e.squeezeShape=o,e.parseAxisParam=a,e.isInt=s,e.sizeFromShape=u,e.getRowsCols=function(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[t.length>1?t[t.length-2]:1,t[t.length-1]]},e.sizeToSquarishShape=l,e.getBatchDim=function(t,e=2){return u(t.slice(0,t.length-e))}},4057:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createTextureLayoutFromShape=e.calculateTextureWidthAndHeight=e.createTextureLayoutFromTextureType=void 0;const r=n(2517),i=n(2039);e.createTextureLayoutFromTextureType=(t,n,r)=>{const o=r===i.TextureType.unpacked||r===i.TextureType.unpackedReversed?1:4,a=r===i.TextureType.packed,s=r===i.TextureType.unpackedReversed||r===i.TextureType.packed,u=r===i.TextureType.packedLastDimension?n.length-1:void 0,l=r===i.TextureType.packedLastDimension?n.map(((t,e)=>e===n.length-1?4*t:t)):void 0;return(0,e.createTextureLayoutFromShape)(t,n,o,l,{isPacked:a,reverseWH:s,breakAxis:u})},e.calculateTextureWidthAndHeight=(t,n,r)=>{const i=(0,e.createTextureLayoutFromTextureType)(t,n,r);return[i.width,i.height]},e.createTextureLayoutFromShape=(t,e,n=1,i,o)=>{const a=!(!o||!o.isPacked),[s,u]=t.computeTextureWH(a&&i||e,o),l=e.length;let c=e.slice(0);if(0===l&&(c=[1]),1===n)i=e;else if(a){if(4!==n)throw new Error("a packed texture must be 4-channel");i=e,l>0&&(c[l-1]=Math.ceil(c[l-1]/2)),l>1&&(c[l-2]=Math.ceil(c[l-2]/2))}else if(!i)throw new Error("Unpacked shape is needed when using channels > 1");return{width:s,height:u,channels:n,isPacked:a,shape:c,strides:r.ShapeUtil.computeStrides(c),unpackedShape:i,reversedWH:o&&o.reverseWH}}},5702:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextureManager=void 0;const r=n(6231);e.TextureManager=class{constructor(t,e,n,r){this.glContext=t,this.layoutStrategy=e,this.profiler=n,this.config=r,this.pendingRead=new Map,r.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(t,e,n,i){const o=this.toEncoderType(t),a=this.glContext.getEncoder(o,e.channels||1,i);if(e.isPacked&&1===i)throw new Error("not implemented");const s=e.width,u=e.height;let l,c;if(this.config.reuseTextures){l=`${s}x${u}_${a.format}_${a.internalFormat}_${a.textureType}`,c=this.inUseTextures.get(l),c||(c=[],this.inUseTextures.set(l,c));const e=this.idleTextures.get(l);if(e&&e.length>0){const r=e.pop();return c.push(r),1===i&&this.glContext.updateTexture(r,s,u,a,this.toTextureData(t,n)),r}}r.Logger.verbose("TextureManager",`Creating new texture of size ${e.width}x${e.height}`);const h=this.glContext.allocateTexture(s,u,a,this.toTextureData(t,n));return this.config.reuseTextures&&(c.push(h),this.textureLookup.set(h,l)),h}readTexture(t,e,n){return n||(n=1),this.profiler.event("backend","TextureManager.readTexture",(()=>{const r=t.shape.reduce(((t,e)=>t*e))*n,i=this.glContext.readTexture(t.texture,t.width,t.height,r,this.toEncoderType(e),n);return this.toTensorData(e,i)}))}async readTextureAsync(t,e,n){const r=t.tensor.dataId;if(n||(n=1),this.pendingRead.has(r)){const t=this.pendingRead.get(r);return new Promise((e=>null==t?void 0:t.push(e)))}return this.profiler.event("backend","TextureManager.readTextureAsync",(async()=>{this.pendingRead.set(r,[]);const i=t.shape.reduce(((t,e)=>t*e))*n;await this.glContext.createAndWaitForFence();const o=this.glContext.readTexture(t.texture,t.width,t.height,i,this.toEncoderType(e),n),a=this.toTensorData(e,o),s=this.pendingRead.get(r);return this.pendingRead.delete(r),null==s||s.forEach((t=>t(a))),a}))}readUint8TextureAsFloat(t){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",(()=>{const e=t.shape.reduce(((t,e)=>t*e)),n=this.glContext.readTexture(t.texture,t.width,t.height,4*e,"byte",4);return new Float32Array(n.buffer,n.byteOffset,e)}))}releaseTexture(t,e){let n;if(this.config.reuseTextures&&(n=this.textureLookup.get(t.texture),n)){e&&this.textureLookup.delete(n);const r=this.inUseTextures.get(n);if(r){const e=r.indexOf(t.texture);if(-1!==e){r.splice(e,1);let i=this.idleTextures.get(n);i||(i=[],this.idleTextures.set(n,i)),i.push(t.texture)}}}n&&!e||(r.Logger.verbose("TextureManager",`Deleting texture of size ${t.width}x${t.height}`),this.glContext.deleteTexture(t.texture))}toTensorData(t,e){switch(t){case"int16":return e instanceof Int16Array?e:Int16Array.from(e);case"int32":return e instanceof Int32Array?e:Int32Array.from(e);case"int8":return e instanceof Int8Array?e:Int8Array.from(e);case"uint16":return e instanceof Uint16Array?e:Uint16Array.from(e);case"uint32":return e instanceof Uint32Array?e:Uint32Array.from(e);case"uint8":case"bool":return e instanceof Uint8Array?e:Uint8Array.from(e);case"float32":return e instanceof Float32Array?e:Float32Array.from(e);case"float64":return e instanceof Float64Array?e:Float64Array.from(e);default:throw new Error(`TensorData type ${t} is not supported`)}}toTextureData(t,e){if(e)return e instanceof Float32Array?e:new Float32Array(e)}toEncoderType(t){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(t,e)=>{"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.TextureType=void 0,(n=e.TextureType||(e.TextureType={}))[n.unpacked=0]="unpacked",n[n.unpackedReversed=1]="unpackedReversed",n[n.packed=2]="packed",n[n.downloadUint8AsFloat=3]="downloadUint8AsFloat",n[n.packedLastDimension=4]="packedLastDimension"},9390:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getGlChannels=e.getCoordsDataType=e.getSqueezedParams=e.squeezeInputShape=e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=e.generateShaderFuncNameFromInputSamplerName=e.repeatedTry=e.getPackedShape=void 0;const r=n(2517);e.getPackedShape=function(t){const e=t.length;return t.slice(0,e-1).concat(t[e-1]/4)},e.repeatedTry=async function(t,e=(t=>0),n){return new Promise(((r,i)=>{let o=0;const a=()=>{if(t())return void r();o++;const s=e(o);null!=n&&o>=n?i():setTimeout(a,s)};a()}))},e.generateShaderFuncNameFromInputSamplerName=function(t){return(0,r.assert)(void 0!==t&&0!==t.length,(()=>"empty string found for sampler name")),"get"+t.charAt(0).toUpperCase()+t.slice(1)},e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(t){return(0,r.assert)(void 0!==t&&0!==t.length,(()=>"empty string found for sampler name")),"get"+t.charAt(0).toUpperCase()+t.slice(1)+"AtOutCoords"},e.squeezeInputShape=function(t,e){let n=JSON.parse(JSON.stringify(t));return n=e,n},e.getSqueezedParams=function(t,e){return e.map((e=>t[e])).join(", ")},e.getCoordsDataType=function(t){if(t<=1)return"int";if(2===t)return"ivec2";if(3===t)return"ivec3";if(4===t)return"ivec4";if(5===t)return"ivec5";if(6===t)return"ivec6";throw Error(`GPU for rank ${t} is not yet supported`)},e.getGlChannels=function(t=6){return["x","y","z","w","u","v"].slice(0,t)}},7305:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createNewWebGLContext=e.createWebGLContext=void 0;const r=n(6231),i=n(1713),o={};function a(t){const e=function(){if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas)throw new TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}const t=document.createElement("canvas");return t.width=1,t.height=1,t}();let n;const o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!t||"webgl2"===t)&&(n=e.getContext("webgl2",o),n))try{return new i.WebGLContext(n,2)}catch(t){r.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${t}`)}if((!t||"webgl"===t)&&(n=e.getContext("webgl",o)||e.getContext("experimental-webgl",o),n))try{return new i.WebGLContext(n,1)}catch(t){r.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${t}`)}throw new Error("WebGL is not supported")}e.createWebGLContext=function t(e){let n;e&&"webgl2"!==e||!("webgl2"in o)?e&&"webgl"!==e||!("webgl"in o)||(n=o.webgl):n=o.webgl2,n=n||a(e),e=e||1===n.version?"webgl":"webgl2";const r=n.gl;return o[e]=n,r.isContextLost()?(delete o[e],t(e)):(r.disable(r.DEPTH_TEST),r.disable(r.STENCIL_TEST),r.disable(r.BLEND),r.disable(r.DITHER),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SAMPLE_COVERAGE),r.enable(r.SCISSOR_TEST),r.enable(r.CULL_FACE),r.cullFace(r.BACK),n)},e.createNewWebGLContext=a},1713:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLContext=e.linearSearchLastTrue=void 0;const a=n(1670),s=o(n(7769)),u=n(9390);function l(t){let e=0;for(;ethis.isTimerResultAvailable(t))),this.getTimerResult(t)}async createAndWaitForFence(){const t=this.createFence(this.gl);return this.pollFence(t)}createFence(t){let e;const n=t,r=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);return t.flush(),e=null===r?()=>!0:()=>{const t=n.clientWaitSync(r,0,0);return t===n.ALREADY_SIGNALED||t===n.CONDITION_SATISFIED},{query:r,isFencePassed:e}}async pollFence(t){return new Promise((e=>{this.addItemToPoll((()=>t.isFencePassed()),(()=>e()))}))}pollItems(){const t=l(this.itemsToPoll.map((t=>t.isDoneFn)));for(let e=0;e<=t;++e){const{resolveFn:t}=this.itemsToPoll[e];t()}this.itemsToPoll=this.itemsToPoll.slice(t+1)}async addItemToPoll(t,e){this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),this.itemsToPoll.length>1||await(0,u.repeatedTry)((()=>(this.pollItems(),0===this.itemsToPoll.length)))}}},1036:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ExecutionPlan=void 0;const r=n(6231);class i{constructor(t,e){this.op=t,this.node=e}}e.ExecutionPlan=class{constructor(t,e,n){this.graph=t,this.profiler=n,this.initialize(e)}initialize(t){this.profiler.event("session","ExecutionPlan.initialize",(()=>{const e=this.graph.getNodes();if(e.length!==t.length)throw new Error("The size of nodes and OPs do not match.");this._ops=t.map(((t,n)=>new i(t,e[n]))),this.reset(),this._starter=[],this._ops.forEach(((t,e)=>{let n=!0;for(const e of t.node.inputs)if(!this._values[e]&&-1===this.graph.getInputIndices().indexOf(e)){n=!1;break}n&&this._starter.push(e)}))}))}reset(){this._values=this.graph.getValues().map((t=>t.tensor))}async execute(t,e){return this.profiler.event("session","ExecutionPlan.execute",(async()=>{this.reset();const n=t.createInferenceHandler(),i=this.graph.getInputIndices();if(e.length!==i.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${e.length} expected: ${i.length}`);e.forEach(((t,e)=>{const n=i[e];this._values[n]=t}));const o=this._starter.slice(0),a=this.graph.getValues(),s=this.graph.getNodes();let u=0;for(;uthis._values[t]));if(-1!==i.indexOf(void 0))throw new Error(`unresolved input detected: op: ${e.node}`);const l=i;r.Logger.verbose("ExecPlan",`Runing op:${e.node.name} (${l.map(((t,n)=>`'${e.node.inputs[n]}': ${t.type}[${t.dims.join(",")}]`)).join(", ")})`);const c=await this.profiler.event("node",e.node.name,(async()=>e.op.impl(n,l,e.op.context)));if(c.length!==e.node.outputs.length)throw new Error("the size of output does not match model definition.");c.forEach(((t,n)=>{const r=e.node.outputs[n];if(this._values[r])throw new Error(`output [${r}] already has value: op:${e.node.name}`);this._values[r]=t}));const h=new Set;c.forEach(((t,n)=>{const r=e.node.outputs[n];for(const t of a[r].to){const e=s[t];let n=!0;for(const t of e.inputs)if(!this._values[t]){n=!1;break}n&&h.add(t)}})),o.push(...h)}const l=[];for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Graph=void 0;const r=n(1446),i=n(7778),o=n(9395),a=n(9162),s=n(2517);var u=o.onnxruntime.experimental.fbs;e.Graph={from:(t,e)=>new h(t,e)};class l{constructor(t){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,t&&(this.type=s.ProtoUtil.tensorValueTypeFromProto(t.type.tensorType))}get from(){return this._from}get to(){return this._to}}class c{constructor(t,e){t instanceof r.onnx.NodeProto?(this.name=t.name,this.opType=t.opType,this.attributes=new i.Attribute(t.attribute)):t instanceof u.Node&&(this.name=null!=e?e:t.name(),this.opType=t.opType(),this.attributes=new i.Attribute(s.ProtoUtil.tensorAttributesFromORTFormat(t))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class h{constructor(t,e){if(!t)throw new TypeError("graph is empty");this.buildGraph(t),this.transformGraph(e),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(t){if(t instanceof r.onnx.GraphProto)this.buildGraphFromOnnxFormat(t);else{if(!(t instanceof u.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(t)}}buildGraphFromOnnxFormat(t){const e=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const n=new Map;if(!t.input)throw new Error("missing information in graph: input");const r=[];for(const n of t.input){if(e.has(n.name))throw new Error(`duplicated input name: ${n.name}`);const t=this._allData.push(new l(n))-1;e.set(n.name,t),r.push(n.name)}if(!t.initializer)throw new Error("missing information in graph: initializer");for(const n of t.initializer){let t=e.get(n.name);if(void 0===t){const r=new l;r.type={shape:{dims:s.ProtoUtil.tensorDimsFromProto(n.dims)},tensorType:s.ProtoUtil.tensorDataTypeFromProto(n.dataType)},t=this._allData.push(r)-1,e.set(n.name,t)}this._allData[t]._from=-1,this._allData[t].tensor=a.Tensor.fromProto(n)}for(let t=0;t{this._allData[e]._to.forEach((e=>{t.add(e)}))}));const e=Array.from(t),n=new Array(this._nodes.length).fill("white");for(;e.length>0;){const t=e.pop();"gray"===n[t]?n[t]="black":(e.push(t),n[t]="gray",this._nodes[t].outputs.forEach((r=>{const i=this._allData[r];if(void 0!==i.tensor)throw new Error("node outputs should not be initialized");if(i._from!==t)throw new Error("from property of the Value object doesn't match index of Node being processed");i._to.forEach((t=>{if("gray"===n[t])throw new Error("model graph is cyclic");"white"===n[t]&&e.push(t)}))})))}}transformGraph(t){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),t&&t.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let t=0;for(let e=0;e0&&(this._nodes[e].inputs.forEach((n=>{const r=this._allData[n]._to.indexOf(e+t);-1!==r&&(this._allData[n]._to[r]=e)})),this._nodes[e].outputs.forEach((n=>{this._allData[n]._from&&this._allData[n]._from===e+t&&(this._allData[n]._from=e)}))):(t++,this._nodes[e].outputs.forEach((t=>{this._allData[t]._from=-2})),this._nodes.splice(e,1),e--);t=0;for(let e=0;e0){let n=-1;void 0!==this._allData[e].from&&-1!==this._allData[e].from?(n=this._nodes[this._allData[e].from].outputs.indexOf(e+t),-1!==n&&(this._nodes[this._allData[e].from].outputs[n]=e)):(n=this._allInputIndices.indexOf(e+t),-1!==n&&(this._allInputIndices[n]=e)),this._allData[e].to.forEach((r=>{n=this._nodes[r].inputs.indexOf(e+t),-1!==n&&(this._nodes[r].inputs[n]=e)})),0===this._allData[e].to.length&&(n=this._allOutputIndices.indexOf(e+t),-1!==n&&(this._allOutputIndices[n]=e))}}else t++,this._allData.splice(e,1),e--}deleteNode(t){const e=this._nodes[t];if(e.outputs.length>1)for(let t=1;t0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ");e.executeNode=!1;const n=e.inputs[0],r=e.outputs[0],i=this._allData[r].to,o=this._allData[n].to.indexOf(t);if(-1===o)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[n].to.splice(o,1),this._allData[r]._to=[];const a=this._allOutputIndices.indexOf(r);if(-1!==a&&(this._allOutputIndices[a]=n),i&&i.length>0)for(const t of i){const e=this._nodes[t].inputs.indexOf(r);if(-1===e)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[t].inputs[e]=n,this._allData[n].to.push(t)}}removeAllDropoutNodes(){let t=0;for(const e of this._nodes){if("Dropout"===e.opType){if(1!==e.inputs.length)throw new Error("Dropout nodes should only contain one input. ");if(1!==e.outputs.length&&2!==e.outputs.length)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(2===e.outputs.length&&0!==this._allData[e.outputs[1]]._to.length)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(t)}t++}}removeAllIdentityNodes(){let t=0;for(const e of this._nodes)"Identity"===e.opType&&this.deleteNode(t),t++}isActivation(t){switch(t.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const t of this._nodes)if("Conv"===t.opType){const e=this._allData[t.outputs[0]]._to;if(1===e.length&&this.isActivation(this._nodes[e[0]])){const n=this._nodes[e[0]];if("Clip"===n.opType)if(1===n.inputs.length)try{t.attributes.set("activation_params","floats",[n.attributes.getFloat("min"),n.attributes.getFloat("max")])}catch(e){t.attributes.set("activation_params","floats",[s.MIN_CLIP,s.MAX_CLIP])}else{if(!(n.inputs.length>=3&&void 0!==this._allData[n.inputs[1]].tensor&&void 0!==this._allData[n.inputs[2]].tensor))continue;t.attributes.set("activation_params","floats",[this._allData[n.inputs[1]].tensor.floatData[0],this._allData[n.inputs[2]].tensor.floatData[0]])}t.attributes.set("activation","string",n.opType),this.deleteNode(e[0])}}}}},6231:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.now=e.Profiler=e.Logger=void 0;const n={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},r={none:new class{log(t,e,n){}},console:new class{log(t,e,n){console.log(`${this.color(t)} ${n?""+n+" ":""}${e}`)}color(t){switch(t){case"verbose":return"v";case"info":return"i";case"warning":return"w";case"error":return"e";case"fatal":return"f";default:throw new Error(`unsupported severity: ${t}`)}}}},i={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let o={"":i};function a(t,e,n,r){if(void 0===e)return i=t,{verbose:a.verbose.bind(null,i),info:a.info.bind(null,i),warning:a.warning.bind(null,i),error:a.error.bind(null,i),fatal:a.fatal.bind(null,i)};if(void 0===n)s(t,e);else if("number"==typeof n&&void 0===r)s(t,e);else if("string"==typeof n&&void 0===r)s(t,n,0,e);else{if("string"!=typeof n||"number"!=typeof r)throw new TypeError("input is valid");s(t,n,0,e)}var i}function s(t,e,i,a){const s=o[a||""]||o[""];n[t]{a.then((async e=>{i&&await i.end(),t(e)}),(async t=>{i&&await i.end(),e(t)}))}));if(!o&&i){const t=i.end();if(t&&"function"==typeof t.then)return new Promise(((e,n)=>{t.then((()=>{e(a)}),(t=>{n(t)}))}))}return a}begin(t,n,r){if(!this._started)throw new Error("profiler is not started yet");if(void 0===r){const r=(0,e.now)();return this.flush(r),new u(t,n,r,(t=>this.endSync(t)))}{const e=r.beginTimer();return new u(t,n,0,(async t=>this.end(t)),e,r)}}async end(t){const e=await t.checkTimer();this._timingEvents.length=this._flushBatchSize||t-this._flushTime>=this._flushIntervalInMilliseconds){for(const t=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Model=void 0;const r=n(5686),i=n(1446),o=n(7070),a=n(9395),s=n(2517);var u=a.onnxruntime.experimental.fbs;e.Model=class{constructor(){}load(t,e,n){if(!n)try{return void this.loadFromOnnxFormat(t,e)}catch(t){if(void 0!==n)throw t}this.loadFromOrtFormat(t,e)}loadFromOnnxFormat(t,e){const n=i.onnx.ModelProto.decode(t);if(s.LongUtil.longToNumber(n.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=n.opsetImport.map((t=>({domain:t.domain,version:s.LongUtil.longToNumber(t.version)}))),this._graph=o.Graph.from(n.graph,e)}loadFromOrtFormat(t,e){const n=new r.flatbuffers.ByteBuffer(t),i=u.InferenceSession.getRootAsInferenceSession(n).model();if(s.LongUtil.longToNumber(i.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FLOAT_TYPES=e.INT_TYPES=e.NUMBER_TYPES=void 0,e.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],e.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],e.FLOAT_TYPES=["float32","float64"]},1047:(t,e)=>{"use strict";function n(t,e){if(e.endsWith("+")){const n=Number.parseInt(e.substring(0,e.length-1),10);return!isNaN(n)&&n<=t}if(2===e.split("-").length){const n=e.split("-"),r=Number.parseInt(n[0],10),i=Number.parseInt(n[1],10);return!isNaN(r)&&!isNaN(i)&&r<=t&&t<=i}return Number.parseInt(e,10)===t}Object.defineProperty(e,"__esModule",{value:!0}),e.resolveOperator=void 0,e.resolveOperator=function(t,e,r){for(const i of r){const r=i[0],o=i[1],a=i[2],s=i[3],u=i[4];if(t.opType===r)for(const t of e)if((t.domain===o||"ai.onnx"===t.domain&&""===o)&&n(t.version,a))return{opImpl:s,opInit:u}}throw new TypeError(`cannot resolve operator '${t.opType}' with opsets: ${e.map((t=>`${t.domain||"ai.onnx"} v${t.version}`)).join(", ")}`)}},9395:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.onnxruntime=void 0;const r=n(5686);var i,o;(function(t){let e;!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.FLOAT=1]="FLOAT",t[t.INT=2]="INT",t[t.STRING=3]="STRING",t[t.TENSOR=4]="TENSOR",t[t.GRAPH=5]="GRAPH",t[t.FLOATS=6]="FLOATS",t[t.INTS=7]="INTS",t[t.STRINGS=8]="STRINGS",t[t.TENSORS=9]="TENSORS",t[t.GRAPHS=10]="GRAPHS",t[t.SPARSE_TENSOR=11]="SPARSE_TENSOR",t[t.SPARSE_TENSORS=12]="SPARSE_TENSORS"}(e=t.AttributeType||(t.AttributeType={}))})((o=(i=e.onnxruntime||(e.onnxruntime={})).experimental||(i.experimental={})).fbs||(o.fbs={})),function(t){!function(t){!function(t){let e;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.VALUE=1]="VALUE",t[t.PARAM=2]="PARAM"}(e=t.DimensionValueType||(t.DimensionValueType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.FLOAT=1]="FLOAT",t[t.UINT8=2]="UINT8",t[t.INT8=3]="INT8",t[t.UINT16=4]="UINT16",t[t.INT16=5]="INT16",t[t.INT32=6]="INT32",t[t.INT64=7]="INT64",t[t.STRING=8]="STRING",t[t.BOOL=9]="BOOL",t[t.FLOAT16=10]="FLOAT16",t[t.DOUBLE=11]="DOUBLE",t[t.UINT32=12]="UINT32",t[t.UINT64=13]="UINT64",t[t.COMPLEX64=14]="COMPLEX64",t[t.COMPLEX128=15]="COMPLEX128",t[t.BFLOAT16=16]="BFLOAT16"}(e=t.TensorDataType||(t.TensorDataType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.Primitive=0]="Primitive",t[t.Fused=1]="Fused"}(e=t.NodeType||(t.NodeType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.NONE=0]="NONE",t[t.tensor_type=1]="tensor_type",t[t.sequence_type=2]="sequence_type",t[t.map_type=3]="map_type"}(e=t.TypeInfoValue||(t.TypeInfoValue={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsShape(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsShape(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}dim(e,n){let r=this.bb.__offset(this.bb_pos,4);return r?(n||new t.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}dimLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}static startShape(t){t.startObject(1)}static addDim(t,e){t.addFieldOffset(0,e,0)}static createDimVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startDimVector(t,e){t.startVector(4,e,4)}static endShape(t){return t.endObject()}static createShape(t,e){return n.startShape(t),n.addDim(t,e),n.endShape(t)}}e.Shape=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimension(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimension(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}value(e){let n=this.bb.__offset(this.bb_pos,4);return n?(e||new t.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}denotation(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimension(t){t.startObject(2)}static addValue(t,e){t.addFieldOffset(0,e,0)}static addDenotation(t,e){t.addFieldOffset(1,e,0)}static endDimension(t){return t.endObject()}static createDimension(t,e,r){return n.startDimension(t),n.addValue(t,e),n.addDenotation(t,r),n.endDimension(t)}}e.Dimension=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimensionValue(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimensionValue(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}dimType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):t.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}dimParam(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimensionValue(t){t.startObject(3)}static addDimType(e,n){e.addFieldInt8(0,n,t.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static addDimParam(t,e){t.addFieldOffset(2,e,0)}static endDimensionValue(t){return t.endObject()}static createDimensionValue(t,e,r,i){return n.startDimensionValue(t),n.addDimType(t,e),n.addDimValue(t,r),n.addDimParam(t,i),n.endDimensionValue(t)}}e.DimensionValue=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensorTypeAndShape(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensorTypeAndShape(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}elemType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}shape(e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startTensorTypeAndShape(t){t.startObject(2)}static addElemType(e,n){e.addFieldInt32(0,n,t.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(t,e){t.addFieldOffset(1,e,0)}static endTensorTypeAndShape(t){return t.endObject()}static createTensorTypeAndShape(t,e,r){return n.startTensorTypeAndShape(t),n.addElemType(t,e),n.addShape(t,r),n.endTensorTypeAndShape(t)}}e.TensorTypeAndShape=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMapType(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMapType(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}keyType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}valueType(e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startMapType(t){t.startObject(2)}static addKeyType(e,n){e.addFieldInt32(0,n,t.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(t,e){t.addFieldOffset(1,e,0)}static endMapType(t){return t.endObject()}static createMapType(t,e,r){return n.startMapType(t),n.addKeyType(t,e),n.addValueType(t,r),n.endMapType(t)}}e.MapType=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSequenceType(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSequenceType(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}elemType(e){let n=this.bb.__offset(this.bb_pos,4);return n?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startSequenceType(t){t.startObject(1)}static addElemType(t,e){t.addFieldOffset(0,e,0)}static endSequenceType(t){return t.endObject()}static createSequenceType(t,e){return n.startSequenceType(t),n.addElemType(t,e),n.endSequenceType(t)}}e.SequenceType=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){(t.fbs||(t.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(t,e,n,r){return t.prep(4,12),t.writeInt32(r),t.writeInt32(n),t.writeInt32(e),t.offset()}}}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNodeEdge(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNodeEdge(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}nodeIndex(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb_pos+t):0}inputEdges(e,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*e,this.bb):null}inputEdgesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}outputEdges(e,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+r)+12*e,this.bb):null}outputEdgesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNodeEdge(t){t.startObject(3)}static addNodeIndex(t,e){t.addFieldInt32(0,e,0)}static addInputEdges(t,e){t.addFieldOffset(1,e,0)}static startInputEdgesVector(t,e){t.startVector(12,e,4)}static addOutputEdges(t,e){t.addFieldOffset(2,e,0)}static startOutputEdgesVector(t,e){t.startVector(12,e,4)}static endNodeEdge(t){return t.endObject()}static createNodeEdge(t,e,r,i){return n.startNodeEdge(t),n.addNodeIndex(t,e),n.addInputEdges(t,r),n.addOutputEdges(t,i),n.endNodeEdge(t)}}e.NodeEdge=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNode(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNode(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}sinceVersion(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0}index(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint32(this.bb_pos+t):0}opType(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.NodeType.Primitive}executionProviderType(t){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null}inputs(t,e){let n=this.bb.__offset(this.bb_pos,20);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let n=this.bb.__offset(this.bb_pos,22);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}attributes(e,n){let r=this.bb.__offset(this.bb_pos,24);return r?(n||new t.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}attributesLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCounts(t){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}inputArgCountsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCountsArray(){let t=this.bb.__offset(this.bb_pos,26);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}implicitInputs(t,e){let n=this.bb.__offset(this.bb_pos,28);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*t,e):null}implicitInputsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNode(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDomain(t,e){t.addFieldOffset(2,e,0)}static addSinceVersion(t,e){t.addFieldInt32(3,e,0)}static addIndex(t,e){t.addFieldInt32(4,e,0)}static addOpType(t,e){t.addFieldOffset(5,e,0)}static addType(e,n){e.addFieldInt32(6,n,t.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(t,e){t.addFieldOffset(7,e,0)}static addInputs(t,e){t.addFieldOffset(8,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(9,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addAttributes(t,e){t.addFieldOffset(10,e,0)}static createAttributesVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startAttributesVector(t,e){t.startVector(4,e,4)}static addInputArgCounts(t,e){t.addFieldOffset(11,e,0)}static createInputArgCountsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startInputArgCountsVector(t,e){t.startVector(4,e,4)}static addImplicitInputs(t,e){t.addFieldOffset(12,e,0)}static createImplicitInputsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startImplicitInputsVector(t,e){t.startVector(4,e,4)}static endNode(t){return t.endObject()}static createNode(t,e,r,i,o,a,s,u,l,c,h,f,d,p){return n.startNode(t),n.addName(t,e),n.addDocString(t,r),n.addDomain(t,i),n.addSinceVersion(t,o),n.addIndex(t,a),n.addOpType(t,s),n.addType(t,u),n.addExecutionProviderType(t,l),n.addInputs(t,c),n.addOutputs(t,h),n.addAttributes(t,f),n.addInputArgCounts(t,d),n.addImplicitInputs(t,p),n.endNode(t)}}e.Node=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsValueInfo(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsValueInfo(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startValueInfo(t){t.startObject(3)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(t,e){t.addFieldOffset(2,e,0)}static endValueInfo(t){return t.endObject()}static createValueInfo(t,e,r,i){return n.startValueInfo(t),n.addName(t,e),n.addDocString(t,r),n.addType(t,i),n.endValueInfo(t)}}e.ValueInfo=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTypeInfo(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTypeInfo(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}denotation(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}valueType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):t.experimental.fbs.TypeInfoValue.NONE}value(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}static startTypeInfo(t){t.startObject(3)}static addDenotation(t,e){t.addFieldOffset(0,e,0)}static addValueType(e,n){e.addFieldInt8(1,n,t.experimental.fbs.TypeInfoValue.NONE)}static addValue(t,e){t.addFieldOffset(2,e,0)}static endTypeInfo(t){return t.endObject()}static createTypeInfo(t,e,r,i){return n.startTypeInfo(t),n.addDenotation(t,e),n.addValueType(t,r),n.addValue(t,i),n.endTypeInfo(t)}}e.TypeInfo=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsOperatorSetId(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsOperatorSetId(t,n){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}domain(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}version(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}static startOperatorSetId(t){t.startObject(2)}static addDomain(t,e){t.addFieldOffset(0,e,0)}static addVersion(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static endOperatorSetId(t){return t.endObject()}static createOperatorSetId(t,n,r){return e.startOperatorSetId(t),e.addDomain(t,n),e.addVersion(t,r),e.endOperatorSetId(t)}}t.OperatorSetId=e}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensor(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensor(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}dataType(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}rawData(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}rawDataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}rawDataArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}stringData(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*t,e):null}stringDataLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}static startTensor(t){t.startObject(6)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static addDataType(e,n){e.addFieldInt32(3,n,t.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(t,e){t.addFieldOffset(4,e,0)}static createRawDataVector(t,e){t.startVector(1,e.length,1);for(let n=e.length-1;n>=0;n--)t.addInt8(e[n]);return t.endVector()}static startRawDataVector(t,e){t.startVector(1,e,1)}static addStringData(t,e){t.addFieldOffset(5,e,0)}static createStringDataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startStringDataVector(t,e){t.startVector(4,e,4)}static endTensor(t){return t.endObject()}static createTensor(t,e,r,i,o,a,s){return n.startTensor(t),n.addName(t,e),n.addDocString(t,r),n.addDims(t,i),n.addDataType(t,o),n.addRawData(t,a),n.addStringData(t,s),n.endTensor(t)}}e.Tensor=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSparseTensor(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSparseTensor(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}values(e){let n=this.bb.__offset(this.bb_pos,4);return n?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}indices(e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSparseTensor(t){t.startObject(3)}static addValues(t,e){t.addFieldOffset(0,e,0)}static addIndices(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static endSparseTensor(t){return t.endObject()}static createSparseTensor(t,e,r,i){return n.startSparseTensor(t),n.addValues(t,e),n.addIndices(t,r),n.addDims(t,i),n.endSparseTensor(t)}}e.SparseTensor=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsAttribute(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsAttribute(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.AttributeType.UNDEFINED}f(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0}i(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}s(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}t(e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}g(e){let n=this.bb.__offset(this.bb_pos,18);return n?(e||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}floats(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0}floatsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}floatsArray(){let t=this.bb.__offset(this.bb_pos,20);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}ints(t){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}intsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}strings(t,e){let n=this.bb.__offset(this.bb_pos,24);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*t,e):null}stringsLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}tensors(e,n){let r=this.bb.__offset(this.bb_pos,26);return r?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}tensorsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}graphs(e,n){let r=this.bb.__offset(this.bb_pos,28);return r?(n||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}graphsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startAttribute(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(e,n){e.addFieldInt32(2,n,t.experimental.fbs.AttributeType.UNDEFINED)}static addF(t,e){t.addFieldFloat32(3,e,0)}static addI(t,e){t.addFieldInt64(4,e,t.createLong(0,0))}static addS(t,e){t.addFieldOffset(5,e,0)}static addT(t,e){t.addFieldOffset(6,e,0)}static addG(t,e){t.addFieldOffset(7,e,0)}static addFloats(t,e){t.addFieldOffset(8,e,0)}static createFloatsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addFloat32(e[n]);return t.endVector()}static startFloatsVector(t,e){t.startVector(4,e,4)}static addInts(t,e){t.addFieldOffset(9,e,0)}static createIntsVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startIntsVector(t,e){t.startVector(8,e,8)}static addStrings(t,e){t.addFieldOffset(10,e,0)}static createStringsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startStringsVector(t,e){t.startVector(4,e,4)}static addTensors(t,e){t.addFieldOffset(11,e,0)}static createTensorsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startTensorsVector(t,e){t.startVector(4,e,4)}static addGraphs(t,e){t.addFieldOffset(12,e,0)}static createGraphsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startGraphsVector(t,e){t.startVector(4,e,4)}static endAttribute(t){return t.endObject()}static createAttribute(t,e,r,i,o,a,s,u,l,c,h,f,d,p){return n.startAttribute(t),n.addName(t,e),n.addDocString(t,r),n.addType(t,i),n.addF(t,o),n.addI(t,a),n.addS(t,s),n.addT(t,u),n.addG(t,l),n.addFloats(t,c),n.addInts(t,h),n.addStrings(t,f),n.addTensors(t,d),n.addGraphs(t,p),n.endAttribute(t)}}e.Attribute=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsGraph(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGraph(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}initializers(e,n){let r=this.bb.__offset(this.bb_pos,4);return r?(n||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}initializersLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeArgs(e,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}nodeArgsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}nodes(e,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new t.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}maxNodeIndex(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint32(this.bb_pos+t):0}nodeEdges(e,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new t.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}nodeEdgesLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}inputs(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?this.bb.__string(this.bb.__vector(this.bb_pos+n)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}sparseInitializers(e,n){let r=this.bb.__offset(this.bb_pos,18);return r?(n||new t.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}sparseInitializersLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGraph(t){t.startObject(8)}static addInitializers(t,e){t.addFieldOffset(0,e,0)}static createInitializersVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startInitializersVector(t,e){t.startVector(4,e,4)}static addNodeArgs(t,e){t.addFieldOffset(1,e,0)}static createNodeArgsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startNodeArgsVector(t,e){t.startVector(4,e,4)}static addNodes(t,e){t.addFieldOffset(2,e,0)}static createNodesVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startNodesVector(t,e){t.startVector(4,e,4)}static addMaxNodeIndex(t,e){t.addFieldInt32(3,e,0)}static addNodeEdges(t,e){t.addFieldOffset(4,e,0)}static createNodeEdgesVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startNodeEdgesVector(t,e){t.startVector(4,e,4)}static addInputs(t,e){t.addFieldOffset(5,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(6,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addSparseInitializers(t,e){t.addFieldOffset(7,e,0)}static createSparseInitializersVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startSparseInitializersVector(t,e){t.startVector(4,e,4)}static endGraph(t){return t.endObject()}static createGraph(t,e,r,i,o,a,s,u,l){return n.startGraph(t),n.addInitializers(t,e),n.addNodeArgs(t,r),n.addNodes(t,i),n.addMaxNodeIndex(t,o),n.addNodeEdges(t,a),n.addInputs(t,s),n.addOutputs(t,u),n.addSparseInitializers(t,l),n.endGraph(t)}}e.Graph=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsModel(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsModel(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}irVersion(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}opsetImport(e,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}opsetImportLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}producerName(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}producerVersion(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}modelVersion(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}docString(t){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__string(this.bb_pos+e,t):null}graph(e){let n=this.bb.__offset(this.bb_pos,18);return n?(e||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}graphDocString(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__string(this.bb_pos+e,t):null}static startModel(t){t.startObject(9)}static addIrVersion(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addOpsetImport(t,e){t.addFieldOffset(1,e,0)}static createOpsetImportVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startOpsetImportVector(t,e){t.startVector(4,e,4)}static addProducerName(t,e){t.addFieldOffset(2,e,0)}static addProducerVersion(t,e){t.addFieldOffset(3,e,0)}static addDomain(t,e){t.addFieldOffset(4,e,0)}static addModelVersion(t,e){t.addFieldInt64(5,e,t.createLong(0,0))}static addDocString(t,e){t.addFieldOffset(6,e,0)}static addGraph(t,e){t.addFieldOffset(7,e,0)}static addGraphDocString(t,e){t.addFieldOffset(8,e,0)}static endModel(t){return t.endObject()}static createModel(t,e,r,i,o,a,s,u,l,c){return n.startModel(t),n.addIrVersion(t,e),n.addOpsetImport(t,r),n.addProducerName(t,i),n.addProducerVersion(t,o),n.addDomain(t,a),n.addModelVersion(t,s),n.addDocString(t,u),n.addGraph(t,l),n.addGraphDocString(t,c),n.endModel(t)}}e.Model=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKernelCreateInfos(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKernelCreateInfos(t,n){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}nodeIndices(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}nodeIndicesLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeIndicesArray(){let t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}kernelDefHashes(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}kernelDefHashesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startKernelCreateInfos(t){t.startObject(2)}static addNodeIndices(t,e){t.addFieldOffset(0,e,0)}static createNodeIndicesVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startNodeIndicesVector(t,e){t.startVector(4,e,4)}static addKernelDefHashes(t,e){t.addFieldOffset(1,e,0)}static createKernelDefHashesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startKernelDefHashesVector(t,e){t.startVector(8,e,8)}static endKernelCreateInfos(t){return t.endObject()}static createKernelCreateInfos(t,n,r){return e.startKernelCreateInfos(t),e.addNodeIndices(t,n),e.addKernelDefHashes(t,r),e.endKernelCreateInfos(t)}}t.KernelCreateInfos=e}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSubGraphSessionState(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSubGraphSessionState(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}graphId(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}sessionState(e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startSubGraphSessionState(t){t.startObject(2)}static addGraphId(t,e){t.addFieldOffset(0,e,0)}static addSessionState(t,e){t.addFieldOffset(1,e,0)}static endSubGraphSessionState(t){let e=t.endObject();return t.requiredField(e,4),e}static createSubGraphSessionState(t,e,r){return n.startSubGraphSessionState(t),n.addGraphId(t,e),n.addSessionState(t,r),n.endSubGraphSessionState(t)}}e.SubGraphSessionState=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSessionState(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSessionState(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}kernels(e){let n=this.bb.__offset(this.bb_pos,4);return n?(e||new t.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}subGraphSessionStates(e,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new t.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*e),this.bb):null}subGraphSessionStatesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSessionState(t){t.startObject(2)}static addKernels(t,e){t.addFieldOffset(0,e,0)}static addSubGraphSessionStates(t,e){t.addFieldOffset(1,e,0)}static createSubGraphSessionStatesVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startSubGraphSessionStatesVector(t,e){t.startVector(4,e,4)}static endSessionState(t){return t.endObject()}static createSessionState(t,e,r){return n.startSessionState(t),n.addKernels(t,e),n.addSubGraphSessionStates(t,r),n.endSessionState(t)}}e.SessionState=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class n{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInferenceSession(t,e){return(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInferenceSession(t,e){return t.setPosition(t.position()+r.flatbuffers.SIZE_PREFIX_LENGTH),(e||new n).__init(t.readInt32(t.position())+t.position(),t)}static bufferHasIdentifier(t){return t.__has_identifier("ORTM")}ortVersion(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}model(e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new t.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}sessionState(e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startInferenceSession(t){t.startObject(3)}static addOrtVersion(t,e){t.addFieldOffset(0,e,0)}static addModel(t,e){t.addFieldOffset(1,e,0)}static addSessionState(t,e){t.addFieldOffset(2,e,0)}static endInferenceSession(t){return t.endObject()}static finishInferenceSessionBuffer(t,e){t.finish(e,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(t,e){t.finish(e,"ORTM",!0)}static createInferenceSession(t,e,r,i){return n.startInferenceSession(t),n.addOrtVersion(t,e),n.addModel(t,r),n.addSessionState(t,i),n.endInferenceSession(t)}}e.InferenceSession=n}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={}))},7448:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxjsSessionHandler=void 0;const r=n(1670),i=n(9162);e.OnnxjsSessionHandler=class{constructor(t){this.session=t,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(t,e,n){const o=new Map;for(const e in t)if(Object.hasOwnProperty.call(t,e)){const n=t[e];o.set(e,new i.Tensor(n.dims,n.type,void 0,void 0,n.data))}const a=await this.session.run(o),s={};return a.forEach(((t,e)=>{s[e]=new r.Tensor(t.type,t.data,t.dims)})),s}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Session=void 0;const r=n(7067),i=n(1296),o=n(7091),a=n(1036),s=n(6231),u=n(2644);e.Session=class{constructor(t={}){this._initialized=!1,this.backendHint=t.backendHint,this.profiler=s.Profiler.create(t.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(t,e,n){await this.profiler.event("session","Session.loadModel",(async()=>{const a=await(0,o.resolveBackend)(this.backendHint);if(this.sessionHandler=a.createSessionHandler(this.context),this._model=new u.Model,"string"==typeof t){const e=t.endsWith(".ort");if("undefined"==typeof fetch){const n=await(0,i.promisify)(r.readFile)(t);this.initialize(n,e)}else{const n=await fetch(t),r=await n.arrayBuffer();this.initialize(new Uint8Array(r),e)}}else if(ArrayBuffer.isView(t))this.initialize(t);else{const r=new Uint8Array(t,e||0,n||t.byteLength);this.initialize(r)}}))}initialize(t,e){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",(()=>{const n=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(t,n,e),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new a.ExecutionPlan(this._model.graph,this._ops,this.profiler)})),this._initialized=!0}async run(t){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",(async()=>{const e=this.normalizeAndValidateInputs(t),n=await this._executionPlan.execute(this.sessionHandler,e);return this.createOutput(n)}))}normalizeAndValidateInputs(t){const e=this._model.graph.getInputNames();if(Array.isArray(t)){if(t.length!==e.length)throw new Error(`incorrect input array length: expected ${e.length} but got ${t.length}`)}else{if(t.size!==e.length)throw new Error(`incorrect input map size: expected ${e.length} but got ${t.size}`);const n=new Array(t.size);let r=0;for(let i=0;i"string"==typeof t))))throw new TypeError("cache should be a string array");l&&(this.cache=new Array(s))}else{if(void 0!==o){const t=f(e);if(!(o instanceof t))throw new TypeError(`cache should be type ${t.name}`)}if(l){const t=new ArrayBuffer(s*function(t){switch(t){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${t}`)}}(e));this.cache=function(t,e){return new(f(e))(t)}(t,e)}}}static fromProto(t){if(!t)throw new Error("cannot construct Value from an empty tensor");const e=u.ProtoUtil.tensorDataTypeFromProto(t.dataType),n=u.ProtoUtil.tensorDimsFromProto(t.dims),r=new c(n,e);if("string"===e)t.stringData.forEach(((t,e)=>{r.data[e]=(0,u.decodeUtf8String)(t)}));else if(t.rawData&&"number"==typeof t.rawData.byteLength&&t.rawData.byteLength>0){const e=r.data,n=new DataView(t.rawData.buffer,t.rawData.byteOffset,t.rawData.byteLength),i=h(t.dataType),o=t.rawData.byteLength/i;if(t.rawData.byteLength%i!=0)throw new Error("invalid buffer length");if(e.length!==o)throw new Error("buffer length mismatch");for(let r=0;r0){const e=r.data,n=new DataView(t.rawDataArray().buffer,t.rawDataArray().byteOffset,t.rawDataLength()),i=h(t.dataType()),o=t.rawDataLength()/i;if(t.rawDataLength()%i!=0)throw new Error("invalid buffer length");if(e.length!==o)throw new Error("buffer length mismatch");for(let r=0;r1&&u>1)return;a[o-s]=Math.max(n,u)}return a}static index(t,e){const n=new Array(e.length);return l.fillIndex(t,e,n),n}static fillIndex(t,e,n){const r=t.length-e.length;for(let i=0;i=0;t--)r[t]=c%o[t],c=Math.floor(c/o[t]);d||(l.fillIndex(r,t.dims,i),h=t.get(i)),p||(l.fillIndex(r,e.dims,s),f=e.get(s)),u.set(r,n(h,f))}}return u}}static isValidBroadcast(t,e){const n=t.length,r=e.length;if(n>r)return!1;for(let i=1;i<=n;i++)if(1!==t[n-i]&&t[n-i]!==e[r-i])return!1;return!0}static getBroadcastDims(t,e){const n=t.length,r=[];for(let i=0;i1&&1===a&&r.unshift(o)}return r}}e.BroadcastUtil=l,e.arrayCopyHelper=function(t,e,n,r,i){if(r<0||r>=e.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=t.length)throw new Error("targetIndex out of bounds");if(r+i>e.length)throw new Error("source indices to be copied are outside bounds");if(n+i>t.length)throw new Error("target array is too small to hold result");for(let o=0;oo.default.isLong(t)?t.toNumber():t))}static tensorValueTypeFromProto(t){return{tensorType:c.tensorDataTypeFromProto(t.elemType),shape:{dims:c.tensorDimsFromProto(t.shape.dim.map((t=>t.dimValue)))}}}static tensorDimsFromORTFormat(t){const e=[];for(let n=0;nt.length)throw new Error(`invalid dimension of ${e} for sizeFromDimension as Tensor has ${t.length} dimensions.`);return f.getSizeFromDimensionRange(t,e,t.length)}static sizeToDimension(t,e){if(e<0||e>t.length)throw new Error(`invalid dimension of ${e} for sizeToDimension as Tensor has ${t.length} dimensions.`);return f.getSizeFromDimensionRange(t,0,e)}static getSizeFromDimensionRange(t,e,n){let r=1;for(let i=e;i=0;--r)n[r]=n[r+1]*t[r+1];return n}static transpose(t){return t.slice().reverse()}static indicesToOffset(t,e,n){void 0===n&&(n=t.length);let r=0;for(let i=0;i=e)throw new Error("unsupported axis for this operation.");return t<0?t+e:t}static normalizeAxes(t,e){return t.map((t=>this.normalizeAxis(t,e)))}static incrementIndex(t,e,n){if(0===e.length||0===t.length)throw new Error("Index incrementing unsupported for scalar Tensor");if(void 0===n)n=e.length;else if(n<=0||n>e.length)throw new Error("Incorrect axis to increment on");for(let r=n-1;r>=0&&(t[r]++,!(t[r]=t.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");r[a]=t[a]}else r[a]=e[a];o*=r[a]}}const a=f.size(t);if(-1!==i){if(a%o!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${t}] Output shape: [${e}]`);r[i]=a/o}else if(o!==a)throw new Error("reshapedDims and originalDims don't have matching sizes");return r}static sortBasedOnPerm(t,e){return e?e.map((e=>t[e])):t.slice().reverse()}static padShape(t,e){const n=t.length;return t.map(((t,r)=>t+e[r]+e[r+n]))}static areEqual(t,e){return t.length===e.length&&t.every(((t,n)=>t===e[n]))}static validateDimsAndCalcSize(t){if(t.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let e=1;for(const n of t){if(!Number.isInteger(n))throw new TypeError(`Invalid shape: ${n} is not an integer`);if(n<0||n>2147483647)throw new TypeError(`Invalid shape: length ${n} is not allowed`);e*=n}return e}static flattenShape(t,e){e<0&&(e+=t.length);const n=t.reduce(((t,e)=>t*e),1),r=t.slice(e).reduce(((t,e)=>t*e),1);return[n/r,r]}static squeezeShape(t,e){const n=new Array;e=f.normalizeAxes(e,t.length);for(let r=0;r=0;if(i&&1!==t[r])throw new Error("squeeze an axis of size different than 1");(0===e.length&&t[r]>1||e.length>0&&!i)&&n.push(t[r])}return n}static unsqueezeShape(t,e){const n=new Array(t.length+e.length);n.fill(0);for(let t=0;t=n.length)throw new Error("'axes' has an out of range axis");if(0!==n[r])throw new Error("'axes' has a duplicate axis");n[r]=1}let r=0;for(let e=0;e=e.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=t.length)throw new Error("targetIndex out of bounds");if(r+i>e.length)throw new Error("source indices to be copied are outside bounds");if(n+i>t.length)throw new Error("target array is too small to hold result");for(let o=0;o=e.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=t.length)throw new Error("targetIndex out of bounds");if(r+i>e.length)throw new Error("source indices to be copied are outside bounds");if(n+i>t.length)throw new Error("target array is too small to hold result");for(let a=0;a=e.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=t.length)throw new Error("targetIndex out of bounds");if(r+i>e.length)throw new Error("source indices to be copied are outside bounds");if(n+i>t.length)throw new Error("target array is too small to hold result");for(let a=0;a=e.length)throw new Error("sourceIndex out of bounds");if(n<0||n>=t.length)throw new Error("targetIndex out of bounds");if(r+i>e.length)throw new Error("source indices to be copied are outside bounds");if(n+i>t.length)throw new Error("target array is too small to hold result");for(let o=0;oe.push(n)));const a=p.calcReduceShape(o,e,!0),u=f.size(a),c=new s.Tensor(a,t.type),h=f.computeStrides(a),d=f.computeStrides(o),g=new Array(o.length);for(let n=0;n=e.length)return o(t[i]);const u=e[r],l=u>=n.length?1:f.size(n.slice(u+1));for(let c=0;c0!==t))}}e.ReduceUtil=p;class g{static adjustPoolAttributes(t,e,n,r,i,o){if(!t&&n.length!==e.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(t)for(let t=0;t=n.length?n.push(e[t+2]):n[t]=e[t+2];for(let t=0;t=n[t]||o[t+n.length]>=n[t])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(t,e,n,r,i,o){if(o){if(i.length!==2*(t.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(e.length!==t.length-2)throw new Error("length of strides should be the length of data dimensions");if(r.length!==t.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let a=0;a{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,i)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,o])=>{const a=n?n+t:t;if("object"==typeof o)(0,e.iterateExtraOptions)(o,a+".",r,i);else if("string"==typeof o||"number"==typeof o)i(a,o.toString());else{if("boolean"!=typeof o)throw new Error("Can't handle extra config type: "+typeof o);i(a,o?"1":"0")}}))}},2157:function(t,e,n){"use strict";var r,i=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=e.initWasm=void 0;const s=n(1670),u=a(n(349)),l=n(6361),c=()=>!!s.env.wasm.proxy&&"undefined"!=typeof document;let h,f,d,p=!1,g=!1,m=!1;const b=[],y=[],_=[],v=[],w=[],x=[],T=()=>{if(p||!g||m||!h)throw new Error("worker not ready")},E=t=>{switch(t.data.type){case"init-wasm":p=!1,t.data.err?(m=!0,f[1](t.data.err)):(g=!0,f[0]());break;case"init-ort":t.data.err?d[1](t.data.err):d[0]();break;case"create_allocate":t.data.err?b.shift()[1](t.data.err):b.shift()[0](t.data.out);break;case"create_finalize":t.data.err?y.shift()[1](t.data.err):y.shift()[0](t.data.out);break;case"create":t.data.err?_.shift()[1](t.data.err):_.shift()[0](t.data.out);break;case"release":t.data.err?v.shift()[1](t.data.err):v.shift()[0]();break;case"run":t.data.err?w.shift()[1](t.data.err):w.shift()[0](t.data.out);break;case"end-profiling":t.data.err?x.shift()[1](t.data.err):x.shift()[0]()}},S="undefined"!=typeof document?null===(r=null===document||void 0===document?void 0:document.currentScript)||void 0===r?void 0:r.src:void 0;e.initWasm=async()=>{if(c()){if(g)return;if(p)throw new Error("multiple calls to 'initWasm()' detected.");if(m)throw new Error("previous call to 'initWasm()' failed.");return p=!0,void 0===s.env.wasm.wasmPaths&&S&&0!==S.indexOf("blob:")&&(s.env.wasm.wasmPaths=S.substr(0,+S.lastIndexOf("/")+1)),new Promise(((t,e)=>{null==h||h.terminate(),h=n(9710).Z(),h.onmessage=E,f=[t,e];const r={type:"init-wasm",in:s.env.wasm};h.postMessage(r)}))}return(0,l.initializeWebAssembly)(s.env.wasm)},e.initOrt=async(t,e)=>{if(c())return T(),new Promise(((n,r)=>{d=[n,r];const i={type:"init-ort",in:{numThreads:t,loggingLevel:e}};h.postMessage(i)}));u.initOrt(t,e)},e.createSessionAllocate=async t=>c()?(T(),new Promise(((e,n)=>{b.push([e,n]);const r={type:"create_allocate",in:{model:t}};h.postMessage(r,[t.buffer])}))):u.createSessionAllocate(t),e.createSessionFinalize=async(t,e)=>c()?(T(),new Promise(((n,r)=>{y.push([n,r]);const i={type:"create_finalize",in:{modeldata:t,options:e}};h.postMessage(i)}))):u.createSessionFinalize(t,e),e.createSession=async(t,e)=>c()?(T(),new Promise(((n,r)=>{_.push([n,r]);const i={type:"create",in:{model:t,options:e}};h.postMessage(i,[t.buffer])}))):u.createSession(t,e),e.releaseSession=async t=>{if(c())return T(),new Promise(((e,n)=>{v.push([e,n]);const r={type:"release",in:t};h.postMessage(r)}));u.releaseSession(t)},e.run=async(t,e,n,r,i)=>c()?(T(),new Promise(((o,a)=>{w.push([o,a]);const s={type:"run",in:{sessionId:t,inputIndices:e,inputs:n,outputIndices:r,options:i}};h.postMessage(s,u.extractTransferableBuffers(n))}))):u.run(t,e,n,r,i),e.endProfiling=async t=>{if(c())return T(),new Promise(((e,n)=>{x.push([e,n]);const r={type:"end-profiling",in:t};h.postMessage(r)}));u.endProfiling(t)}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(7967),i=n(4983),o=n(6361);e.setRunOptions=t=>{const e=(0,o.getInstance)();let n=0;const a=[],s=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(s.terminate=!1);let o=0;if(void 0!==(null==t?void 0:t.tag)&&(o=(0,i.allocWasmString)(t.tag,a)),n=e._OrtCreateRunOptions(s.logSeverityLevel,s.logVerbosityLevel,!!s.terminate,o),0===n)throw new Error("Can't create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const o=(0,i.allocWasmString)(t,a),s=(0,i.allocWasmString)(r,a);if(0!==e._OrtAddRunConfigEntry(n,o,s))throw new Error(`Can't set a run config entry: ${t} - ${r}`)})),[n,a]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),a.forEach(e._free),t}}},2306:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxruntimeWebAssemblySessionHandler=void 0;const r=n(2806),i=n(1670),o=n(2850),a=n(2157);let s;e.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(t){const e=await fetch(t),n=await e.arrayBuffer();return(0,a.createSessionAllocate)(new Uint8Array(n))}async loadModel(t,e){if(s||(await(0,a.initOrt)(i.env.wasm.numThreads,(t=>{switch(t){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${t}`)}})(i.env.logLevel)),s=!0),"string"==typeof t)if("undefined"==typeof fetch){const n=await(0,o.promisify)(r.readFile)(t);[this.sessionId,this.inputNames,this.outputNames]=await(0,a.createSession)(n,e)}else{const n=await this.createSessionAllocate(t);[this.sessionId,this.inputNames,this.outputNames]=await(0,a.createSessionFinalize)(n,e)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,a.createSession)(t,e)}async dispose(){return(0,a.releaseSession)(this.sessionId)}async run(t,e,n){const r=[],o=[];Object.entries(t).forEach((t=>{const e=t[0],n=t[1],i=this.inputNames.indexOf(e);if(-1===i)throw new Error(`invalid input '${e}'`);r.push(n),o.push(i)}));const s=[];Object.entries(e).forEach((t=>{const e=t[0],n=this.outputNames.indexOf(e);if(-1===n)throw new Error(`invalid output '${e}'`);s.push(n)}));const u=await(0,a.run)(this.sessionId,o,r.map((t=>[t.type,t.dims,t.data])),s,n),l={};for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(7967),i=n(4983),o=n(6361);e.setSessionOptions=t=>{const e=(0,o.getInstance)();let n=0;const a=[],s=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(s);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(s.graphOptimizationLevel="all");const u=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(s.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(s.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(s.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(s.executionMode="sequential");const l=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(s.executionMode);let c=0;if(void 0!==(null==t?void 0:t.logId)&&(c=(0,i.allocWasmString)(t.logId,a)),void 0===(null==t?void 0:t.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(s.enableProfiling=!1),n=e._OrtCreateSessionOptions(u,!!s.enableCpuMemArena,!!s.enableMemPattern,l,!!s.enableProfiling,0,c,s.logSeverityLevel,s.logVerbosityLevel),0===n)throw new Error("Can't create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const a=(0,i.allocWasmString)(e,n);if(0!==(0,o.getInstance)()._OrtAppendExecutionProvider(t,a))throw new Error(`Can't append execution provider: ${e}`)}})(n,t.executionProviders,a),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const o=(0,i.allocWasmString)(t,a),s=(0,i.allocWasmString)(r,a);if(0!==e._OrtAddSessionConfigEntry(n,o,s))throw new Error(`Can't set a session config entry: ${t} - ${r}`)})),[n,a]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),a.forEach(e._free),t}}},4983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(6361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),i=n.lengthBytesUTF8(t)+1,o=n._malloc(i);return n.stringToUTF8(t,o,i),e.push(o),o}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),i=n(4919),o=n(4983),a=n(6361);e.initOrt=(t,e)=>{const n=(0,a.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can't initialize onnxruntime. error code = ${n}`)};const s=new Map;e.createSessionAllocate=t=>{const e=(0,a.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,a.getInstance)();let r=0,o=0,u=[];try{if([o,u]=(0,i.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],o),0===r)throw new Error("Can't create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(o),u.forEach(n._free)}const l=n._OrtGetInputCount(r),c=n._OrtGetOutputCount(r),h=[],f=[],d=[],p=[];for(let t=0;t{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,a.getInstance)(),n=s.get(t);if(!n)throw new Error("invalid session id");const r=n[0],i=n[1],o=n[2];i.forEach(e._OrtFree),o.forEach(e._OrtFree),e._OrtReleaseSession(r),s.delete(t)};const u=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},c=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,i,h)=>{const f=(0,a.getInstance)(),d=s.get(t);if(!d)throw new Error("invalid session id");const p=d[0],g=d[1],m=d[2],b=e.length,y=i.length;let _=0,v=[];const w=[],x=[];try{[_,v]=(0,r.setRunOptions)(h);for(let t=0;tf.HEAP32[t++]=e));const n=f._OrtCreateTensor(u(e),a,s,c,r.length);if(0===n)throw new Error("Can't create a tensor");w.push(n)}finally{f.stackRestore(l)}}const t=f.stackSave(),a=f.stackAlloc(4*b),s=f.stackAlloc(4*b),d=f.stackAlloc(4*y),T=f.stackAlloc(4*y);try{let n=a/4,r=s/4,o=d/4,u=T/4;for(let t=0;tt*e));if(i=l(a),"string"===i){const t=[];let e=o/4;for(let n=0;n{const e=(0,a.getInstance)(),n=s.get(t);if(!n)throw new Error("invalid session id");const r=n[0],i=e._OrtEndProfiling(r);if(0===i)throw new Error("Can't get an profile file name");e._OrtFree(i)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},6361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const s=o(n(6449)),u=a(n(932)),l=n(3474);let c,h=!1,f=!1,d=!1;const p=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(h)return Promise.resolve();if(f)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(d)throw new Error("previous call to 'initializeWebAssembly()' failed.");f=!0;const e=t.initTimeout,r=t.numThreads,i=t.simd,o=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),a=i&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),g="string"==typeof t.wasmPaths?t.wasmPaths:void 0,m=p(!1,o),b=p(a,o),y="object"==typeof t.wasmPaths?t.wasmPaths[b]:void 0;let _=!1;const v=[];if(e>0&&v.push(new Promise((t=>{setTimeout((()=>{_=!0,t()}),e)}))),v.push(new Promise(((t,e)=>{const r=o?l:u.default,i={locateFile:(t,e)=>o&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(4154)],{type:"text/javascript"})):t===m?null!=y?y:(null!=g?g:e)+b:e+t};if(o)if("undefined"==typeof Blob)i.mainScriptUrlOrBlob=s.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;i.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(i).then((e=>{f=!1,h=!0,c=e,t()}),(t=>{f=!1,d=!0,e(t)}))}))),await Promise.race(v),_)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(h&&c)return c;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!h||f||d||(f=!0,null===(t=c.PThread)||void 0===t||t.terminateAllThreads(),c=void 0,f=!1,h=!1,d=!0)}},9710:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var r=n(477),i=n.n(r);function o(){return i()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var e={474:(e,t,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){function t(){return P.buffer!=D&&G(P.buffer),F}function r(){return P.buffer!=D&&G(P.buffer),I}function a(){return P.buffer!=D&&G(P.buffer),U}function o(){return P.buffer!=D&&G(P.buffer),H}function i(){return P.buffer!=D&&G(P.buffer),L}var s,u,c;e=e||{},s||(s=void 0!==e?e:{}),s.ready=new Promise((function(e,t){u=e,c=t}));var l,f,p,d,m,g,h=Object.assign({},s),y="./this.program",v=(e,t)=>{throw t},b="object"==typeof window,_="function"==typeof importScripts,w="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=s.ENVIRONMENT_IS_PTHREAD||!1,S="";function A(e){return s.locateFile?s.locateFile(e,S):S+e}if(w){let t;S=_?n(908).dirname(S)+"/":"//",g=()=>{m||(d=n(384),m=n(908))},l=function(e,t){return g(),e=m.normalize(e),d.readFileSync(e,t?void 0:"utf8")},p=e=>((e=l(e,!0)).buffer||(e=new Uint8Array(e)),e),f=(e,t,n)=>{g(),e=m.normalize(e),d.readFile(e,(function(e,r){e?n(e):t(r.buffer)}))},1{if(K())throw process.exitCode=e,t;t instanceof ue||x("exiting due to exception: "+t),process.exit(e)},s.inspect=function(){return"[Emscripten Module object]"};try{t=n(925)}catch(e){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),e}n.g.Worker=t.Worker}else(b||_)&&(_?S=self.location.href:"undefined"!=typeof document&&document.currentScript&&(S=document.currentScript.src),_scriptDir&&(S=_scriptDir),S=0!==S.indexOf("blob:")?S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1):"",w||(l=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},_&&(p=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),f=(e,t,n)=>{var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)}));w&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),M=console.warn.bind(console);w&&(g(),T=e=>d.writeSync(1,e+"\\n"),M=e=>d.writeSync(2,e+"\\n"));var E,R=s.print||T,x=s.printErr||M;Object.assign(s,h),h=null,s.thisProgram&&(y=s.thisProgram),s.quit&&(v=s.quit),s.wasmBinary&&(E=s.wasmBinary);var C=s.noExitRuntime||!1;"object"!=typeof WebAssembly&&ae("no native wasm support detected");var P,k,D,F,I,U,H,L,W=!1,j="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function Y(e,t,n){var r=(t>>>=0)+n;for(n=t;e[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|o<<6|i:(7&a)<<18|o<<12|i<<6|63&e[t++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function z(e,t){return(e>>>=0)?Y(r(),e,t):""}function N(e,t,n,r){if(!(0>>=0;r=n+r-1;for(var o=0;o=i&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++o)),127>=i){if(n>=r)break;t[n++>>>0]=i}else{if(2047>=i){if(n+1>=r)break;t[n++>>>0]=192|i>>6}else{if(65535>=i){if(n+2>=r)break;t[n++>>>0]=224|i>>12}else{if(n+3>=r)break;t[n++>>>0]=240|i>>18,t[n++>>>0]=128|i>>12&63}t[n++>>>0]=128|i>>6&63}t[n++>>>0]=128|63&i}}return t[n>>>0]=0,n-a}function B(e){for(var t=0,n=0;n=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t}function G(e){D=e,s.HEAP8=F=new Int8Array(e),s.HEAP16=new Int16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU8=I=new Uint8Array(e),s.HEAPU16=new Uint16Array(e),s.HEAPU32=H=new Uint32Array(e),s.HEAPF32=new Float32Array(e),s.HEAPF64=L=new Float64Array(e)}O&&(D=s.buffer);var q=s.INITIAL_MEMORY||16777216;if(O)P=s.wasmMemory,D=s.buffer;else if(s.wasmMemory)P=s.wasmMemory;else if(!((P=new WebAssembly.Memory({initial:q/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),w&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");P&&(D=P.buffer),q=D.byteLength,G(D);var $,V=[],J=[],X=[],Q=[];function K(){return C||!1}function Z(){var e=s.preRun.shift();V.unshift(e)}var ee,te=0,ne=null,re=null;function ae(e){throw O?postMessage({cmd:"onAbort",arg:e}):s.onAbort&&s.onAbort(e),x(e="Aborted("+e+")"),W=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),c(e),e}function oe(){return ee.startsWith("data:application/octet-stream;base64,")}function ie(){var e=ee;try{if(e==ee&&E)return new Uint8Array(E);if(p)return p(e);throw"both async and sync fetching of the wasm failed"}catch(e){ae(e)}}ee="ort-wasm-threaded.wasm",oe()||(ee=A(ee));var se={};function ue(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function ce(e){(e=de.Ja[e])||ae(),de.Sa(e)}function le(e){var t=de.ab();if(!t)return 6;de.Oa.push(t),de.Ja[e.Ia]=t,t.Ia=e.Ia;var n={cmd:"run",start_routine:e.gb,arg:e.Ya,pthread_ptr:e.Ia};return t.Na=()=>{n.time=performance.now(),t.postMessage(n,e.lb)},t.loaded&&(t.Na(),delete t.Na),0}function fe(e){if(O)return Ye(1,1,e);K()||(de.Ua(),s.onExit&&s.onExit(e),W=!0),v(e,new ue(e))}function pe(e,t){if(!t&&O)throw he(e),"unwind";K()||O||(ct(),me(X),ut(0),Qe[1].length&&Ke(1,10),Qe[2].length&&Ke(2,10),de.Ua()),fe(e)}var de={Ma:[],Oa:[],Wa:[],Ja:{},bb:function(){O&&de.cb()},nb:function(){},cb:function(){de.receiveObjectTransfer=de.fb,de.threadInitTLS=de.Va,de.setExitStatus=de.Ta,C=!1},Ta:function(){},Ua:function(){for(var e of Object.values(de.Ja))de.Sa(e);for(e of de.Ma)e.terminate();de.Ma=[]},Sa:function(e){var t=e.Ia;delete de.Ja[t],de.Ma.push(e),de.Oa.splice(de.Oa.indexOf(e),1),e.Ia=0,mt(t)},fb:function(){},Va:function(){de.Wa.forEach((e=>e()))},eb:function(e,t){e.onmessage=n=>{var r=(n=n.data).cmd;if(e.Ia&&(de.$a=e.Ia),n.targetThread&&n.targetThread!=it()){var a=de.Ja[n.ob];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?Ie(n.queue):"spawnThread"===r?le(n):"cleanupThread"===r?ce(n.thread):"killThread"===r?(n=n.thread,r=de.Ja[n],delete de.Ja[n],r.terminate(),mt(n),de.Oa.splice(de.Oa.indexOf(r),1),r.Ia=0):"cancelThread"===r?de.Ja[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(e.loaded=!0,t&&t(e),e.Na&&(e.Na(),delete e.Na)):"print"===r?R("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?e.postMessage(n):"onAbort"===r?s.onAbort&&s.onAbort(n.arg):r&&x("worker sent an unknown command "+r);de.$a=void 0},e.onerror=e=>{throw x("worker sent an error! "+e.filename+":"+e.lineno+": "+e.message),e},w&&(e.on("message",(function(t){e.onmessage({data:t})})),e.on("error",(function(t){e.onerror(t)})),e.on("detachedExit",(function(){}))),e.postMessage({cmd:"load",urlOrBlob:s.mainScriptUrlOrBlob||_scriptDir,wasmMemory:P,wasmModule:k})},Xa:function(){var e=A("ort-wasm-threaded.worker.js");de.Ma.push(new Worker(e))},ab:function(){return 0==de.Ma.length&&(de.Xa(),de.eb(de.Ma[0])),de.Ma.pop()}};function me(e){for(;0>2>>>0];e=a()[e+48>>2>>>0],ht(t,t-e),vt(t)};var ye,ve,be=[];function _e(e,t,n,r){return O?Ye(3,1,e,t,n,r):we(e,t,n,r)}function we(e,t,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?_e(e,t,n,r):(e={gb:n,Ia:e,Ya:r,lb:a},O?(e.mb="spawnThread",postMessage(e,a),0):le(e))}function Oe(e,t,n){return O?Ye(4,1,e,t,n):0}function Se(e,t){if(O)return Ye(5,1,e,t)}function Ae(e,t){if(O)return Ye(6,1,e,t)}function Te(e,t,n){if(O)return Ye(7,1,e,t,n)}function Me(e,t,n){return O?Ye(8,1,e,t,n):0}function Ee(e,t){if(O)return Ye(9,1,e,t)}function Re(e,t,n){if(O)return Ye(10,1,e,t,n)}function xe(e,t,n,r){if(O)return Ye(11,1,e,t,n,r)}function Ce(e,t,n,r){if(O)return Ye(12,1,e,t,n,r)}function Pe(e,t,n,r){if(O)return Ye(13,1,e,t,n,r)}function ke(e){if(O)return Ye(14,1,e)}function De(e,t){if(O)return Ye(15,1,e,t)}function Fe(e,t,n){if(O)return Ye(16,1,e,t,n)}function Ie(e){Atomics.store(a(),e>>2,1),it()&&dt(e),Atomics.compareExchange(a(),e>>2,1,0)}function Ue(e){return o()[e>>>2]+4294967296*a()[e+4>>>2]}function He(e,t,n,r,a,o){return O?Ye(17,1,e,t,n,r,a,o):-52}function Le(e,t,n,r,a,o){if(O)return Ye(18,1,e,t,n,r,a,o)}function We(e){var n=B(e)+1,r=st(n);return r&&N(e,t(),r,n),r}function je(e,t,n){function r(e){return(e=e.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?e[1]:"GMT"}if(O)return Ye(19,1,e,t,n);var i=(new Date).getFullYear(),s=new Date(i,0,1),u=new Date(i,6,1);i=s.getTimezoneOffset();var c=u.getTimezoneOffset(),l=Math.max(i,c);a()[e>>2>>>0]=60*l,a()[t>>2>>>0]=Number(i!=c),e=r(s),t=r(u),e=We(e),t=We(t),c>2>>>0]=e,o()[n+4>>2>>>0]=t):(o()[n>>2>>>0]=t,o()[n+4>>2>>>0]=e)}function Ye(e,t){var n=arguments.length-2,r=arguments;return ge((()=>{for(var a=bt(8*n),o=a>>3,s=0;s>>0]=u}return pt(e,n,a,t)}))}s.invokeEntryPoint=function(e,t){var n=be[e];n||(e>=be.length&&(be.length=e+1),be[e]=n=$.get(e)),e=n(t),K()?de.Ta(e):gt(e)},s.executeNotifiedProxyingQueue=Ie,ve=w?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:O?()=>performance.now()-s.__performance_now_clock_drift:()=>performance.now();var ze,Ne=[],Be={};function Ge(){if(!ze){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:y||"./this.program"};for(e in Be)void 0===Be[e]?delete t[e]:t[e]=Be[e];var n=[];for(e in t)n.push(e+"="+t[e]);ze=n}return ze}function qe(e,n){if(O)return Ye(20,1,e,n);var r=0;return Ge().forEach((function(a,i){var s=n+r;for(i=o()[e+4*i>>2>>>0]=s,s=0;s>0>>>0]=a.charCodeAt(s);t()[i>>0>>>0]=0,r+=a.length+1})),0}function $e(e,t){if(O)return Ye(21,1,e,t);var n=Ge();o()[e>>2>>>0]=n.length;var r=0;return n.forEach((function(e){r+=e.length+1})),o()[t>>2>>>0]=r,0}function Ve(e){return O?Ye(22,1,e):52}function Je(e,t,n,r){return O?Ye(23,1,e,t,n,r):52}function Xe(e,t,n,r,a){return O?Ye(24,1,e,t,n,r,a):70}var Qe=[null,[],[]];function Ke(e,t){var n=Qe[e];0===t||10===t?((1===e?R:x)(Y(n,0)),n.length=0):n.push(t)}function Ze(e,t,n,a){if(O)return Ye(25,1,e,t,n,a);for(var i=0,s=0;s>2>>>0],c=o()[t+4>>2>>>0];t+=8;for(var l=0;l>>0]);i+=c}return o()[a>>2>>>0]=i,0}function et(e){return 0==e%4&&(0!=e%100||0==e%400)}var tt=[31,29,31,30,31,30,31,31,30,31,30,31],nt=[31,28,31,30,31,30,31,31,30,31,30,31];function rt(e,n,r,o){function i(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.lengthe?-1:0r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),11>n?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return n=new Date(e.getFullYear()+1,0,4),t=c(new Date(e.getFullYear(),0,4)),n=c(n),0>=u(t,e)?0>=u(n,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var f=a()[o+40>>2>>>0];for(var p in o={jb:a()[o>>2>>>0],ib:a()[o+4>>2>>>0],Pa:a()[o+8>>2>>>0],Ra:a()[o+12>>2>>>0],Qa:a()[o+16>>2>>>0],La:a()[o+20>>2>>>0],Ha:a()[o+24>>2>>>0],Ka:a()[o+28>>2>>>0],pb:a()[o+32>>2>>>0],hb:a()[o+36>>2>>>0],kb:f?z(f):""},r=z(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),m="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(e){return d[e.Ha].substring(0,3)},"%A":function(e){return d[e.Ha]},"%b":function(e){return m[e.Qa].substring(0,3)},"%B":function(e){return m[e.Qa]},"%C":function(e){return s((e.La+1900)/100|0,2)},"%d":function(e){return s(e.Ra,2)},"%e":function(e){return i(e.Ra,2," ")},"%g":function(e){return l(e).toString().substring(2)},"%G":function(e){return l(e)},"%H":function(e){return s(e.Pa,2)},"%I":function(e){return 0==(e=e.Pa)?e=12:12e.Pa?"AM":"PM"},"%S":function(e){return s(e.jb,2)},"%t":function(){return"\\t"},"%u":function(e){return e.Ha||7},"%U":function(e){return s(Math.floor((e.Ka+7-e.Ha)/7),2)},"%V":function(e){var t=Math.floor((e.Ka+7-(e.Ha+6)%7)/7);if(2>=(e.Ha+371-e.Ka-2)%7&&t++,t)53==t&&(4==(n=(e.Ha+371-e.Ka)%7)||3==n&&et(e.La)||(t=1));else{t=52;var n=(e.Ha+7-e.Ka-1)%7;(4==n||5==n&&et(e.La%400-1))&&t++}return s(t,2)},"%w":function(e){return e.Ha},"%W":function(e){return s(Math.floor((e.Ka+7-(e.Ha+6)%7)/7),2)},"%y":function(e){return(e.La+1900).toString().substring(2)},"%Y":function(e){return e.La+1900},"%z":function(e){var t=0<=(e=e.hb);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.kb},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](o)));return p=function(e){var t=Array(B(e)+1);return N(e,t,0,t.length),t}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(e,n){t().set(e,n>>>0)}(p,e),p.length-1)}de.bb();var at=[null,fe,he,_e,Oe,Se,Ae,Te,Me,Ee,Re,xe,Ce,Pe,ke,De,Fe,He,Le,je,qe,$e,Ve,Je,Xe,Ze],ot={L:function(e){lt(e,!_,1,!b),de.Va()},h:function(e){O?postMessage({cmd:"cleanupThread",thread:e}):ce(e)},D:we,e:Oe,S:Se,z:Ae,B:Te,s:Me,Q:Ee,I:Re,P:xe,k:Ce,A:Pe,w:ke,R:De,y:Fe,p:function(){},j:function(){ae("To use dlopen, you need enable dynamic linking, see ")},x:function(){ae("To use dlopen, you need enable dynamic linking, see ")},l:function(){return Date.now()},E:function(){return 2097152},U:function(){return!0},F:function(e,t,n,r){if(e==t)setTimeout((()=>Ie(r)));else if(O)postMessage({targetThread:e,cmd:"processProxyingQueue",queue:r});else{if(!(e=de.Ja[e]))return;e.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},K:function(){return-1},V:function(e,t){e=new Date(1e3*Ue(e)),a()[t>>2>>>0]=e.getUTCSeconds(),a()[t+4>>2>>>0]=e.getUTCMinutes(),a()[t+8>>2>>>0]=e.getUTCHours(),a()[t+12>>2>>>0]=e.getUTCDate(),a()[t+16>>2>>>0]=e.getUTCMonth(),a()[t+20>>2>>>0]=e.getUTCFullYear()-1900,a()[t+24>>2>>>0]=e.getUTCDay(),e=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[t+28>>2>>>0]=e},m:function(e,t){e=new Date(1e3*Ue(e)),a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),a()[t+20>>2>>>0]=e.getFullYear()-1900,a()[t+24>>2>>>0]=e.getDay();var n=new Date(e.getFullYear(),0,1),r=(e.getTime()-n.getTime())/864e5|0;a()[t+28>>2>>>0]=r,a()[t+36>>2>>>0]=-60*e.getTimezoneOffset(),r=new Date(e.getFullYear(),6,1).getTimezoneOffset(),e=0|(r!=(n=n.getTimezoneOffset())&&e.getTimezoneOffset()==Math.min(n,r)),a()[t+32>>2>>>0]=e},n:function(e){var t=new Date(a()[e+20>>2>>>0]+1900,a()[e+16>>2>>>0],a()[e+12>>2>>>0],a()[e+8>>2>>>0],a()[e+4>>2>>>0],a()[e>>2>>>0],0),n=a()[e+32>>2>>>0],r=t.getTimezoneOffset(),o=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),u=Math.min(s,i);return 0>n?a()[e+32>>2>>>0]=Number(i!=s&&u==r):0>2>>>0]=t.getDay(),n=(t.getTime()-o.getTime())/864e5|0,a()[e+28>>2>>>0]=n,a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),t.getTime()/1e3|0},G:He,H:Le,o:function e(t,n,r){e.Za||(e.Za=!0,je(t,n,r))},b:function(){ae("")},i:function(){if(!w&&!_){var e="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";ye||(ye={}),ye[e]||(ye[e]=1,w&&(e="warning: "+e),x(e))}},u:function(){return 4294901760},c:ve,O:function(e,t,n){r().copyWithin(e>>>0,t>>>0,t+n>>>0)},v:function(){return w?n(993).cpus().length:navigator.hardwareConcurrency},J:function(e,t,n){Ne.length=t,n>>=3;for(var r=0;r>>0];return(0>e?se[-e-1]:at[e]).apply(null,Ne)},t:function(e){var t=r().length;if((e>>>=0)<=t||4294901760=n;n*=2){var a=t*(1+.2/n);a=Math.min(a,e+100663296);var o=Math;a=Math.max(e,a),o=o.min.call(o,4294901760,a+(65536-a%65536)%65536);e:{try{P.grow(o-D.byteLength+65535>>>16),G(P.buffer);var i=1;break e}catch(e){}i=void 0}if(i)return!0}return!1},T:function(){throw"unwind"},M:qe,N:$e,C:pe,d:Ve,g:Je,q:Xe,f:Ze,a:P||s.wasmMemory,W:rt,r:function(e,t,n,r){return rt(e,t,n,r)}};!function(){function e(e,t){s.asm=e.exports,de.Wa.push(s.asm.ua),$=s.asm.wa,J.unshift(s.asm.X),k=t,O||(te--,s.monitorRunDependencies&&s.monitorRunDependencies(te),0==te&&(null!==ne&&(clearInterval(ne),ne=null),re&&(e=re,re=null,e())))}function t(t){e(t.instance,t.module)}function n(e){return function(){if(!E&&(b||_)){if("function"==typeof fetch&&!ee.startsWith("file://"))return fetch(ee,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at \'"+ee+"\'";return e.arrayBuffer()})).catch((function(){return ie()}));if(f)return new Promise((function(e,t){f(ee,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return ie()}))}().then((function(e){return WebAssembly.instantiate(e,r)})).then((function(e){return e})).then(e,(function(e){x("failed to asynchronously prepare wasm: "+e),ae(e)}))}var r={a:ot};if(O||(te++,s.monitorRunDependencies&&s.monitorRunDependencies(te)),s.instantiateWasm)try{return s.instantiateWasm(r,e)}catch(e){return x("Module.instantiateWasm callback failed with error: "+e),!1}(E||"function"!=typeof WebAssembly.instantiateStreaming||oe()||ee.startsWith("file://")||w||"function"!=typeof fetch?n(t):fetch(ee,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,r).then(t,(function(e){return x("wasm streaming compile failed: "+e),x("falling back to ArrayBuffer instantiation"),n(t)}))}))).catch(c)}(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.X).apply(null,arguments)},s._OrtInit=function(){return(s._OrtInit=s.asm.Y).apply(null,arguments)},s._OrtCreateSessionOptions=function(){return(s._OrtCreateSessionOptions=s.asm.Z).apply(null,arguments)},s._OrtAppendExecutionProvider=function(){return(s._OrtAppendExecutionProvider=s.asm._).apply(null,arguments)},s._OrtAddSessionConfigEntry=function(){return(s._OrtAddSessionConfigEntry=s.asm.$).apply(null,arguments)},s._OrtReleaseSessionOptions=function(){return(s._OrtReleaseSessionOptions=s.asm.aa).apply(null,arguments)},s._OrtCreateSession=function(){return(s._OrtCreateSession=s.asm.ba).apply(null,arguments)},s._OrtReleaseSession=function(){return(s._OrtReleaseSession=s.asm.ca).apply(null,arguments)},s._OrtGetInputCount=function(){return(s._OrtGetInputCount=s.asm.da).apply(null,arguments)},s._OrtGetOutputCount=function(){return(s._OrtGetOutputCount=s.asm.ea).apply(null,arguments)},s._OrtGetInputName=function(){return(s._OrtGetInputName=s.asm.fa).apply(null,arguments)},s._OrtGetOutputName=function(){return(s._OrtGetOutputName=s.asm.ga).apply(null,arguments)},s._OrtFree=function(){return(s._OrtFree=s.asm.ha).apply(null,arguments)},s._OrtCreateTensor=function(){return(s._OrtCreateTensor=s.asm.ia).apply(null,arguments)},s._OrtGetTensorData=function(){return(s._OrtGetTensorData=s.asm.ja).apply(null,arguments)},s._OrtReleaseTensor=function(){return(s._OrtReleaseTensor=s.asm.ka).apply(null,arguments)},s._OrtCreateRunOptions=function(){return(s._OrtCreateRunOptions=s.asm.la).apply(null,arguments)},s._OrtAddRunConfigEntry=function(){return(s._OrtAddRunConfigEntry=s.asm.ma).apply(null,arguments)},s._OrtReleaseRunOptions=function(){return(s._OrtReleaseRunOptions=s.asm.na).apply(null,arguments)},s._OrtRun=function(){return(s._OrtRun=s.asm.oa).apply(null,arguments)},s._OrtEndProfiling=function(){return(s._OrtEndProfiling=s.asm.pa).apply(null,arguments)};var it=s._pthread_self=function(){return(it=s._pthread_self=s.asm.qa).apply(null,arguments)},st=s._malloc=function(){return(st=s._malloc=s.asm.ra).apply(null,arguments)};s._free=function(){return(s._free=s.asm.sa).apply(null,arguments)};var ut=s._fflush=function(){return(ut=s._fflush=s.asm.ta).apply(null,arguments)};s.__emscripten_tls_init=function(){return(s.__emscripten_tls_init=s.asm.ua).apply(null,arguments)};var ct=s.___funcs_on_exit=function(){return(ct=s.___funcs_on_exit=s.asm.va).apply(null,arguments)},lt=s.__emscripten_thread_init=function(){return(lt=s.__emscripten_thread_init=s.asm.xa).apply(null,arguments)};s.__emscripten_thread_crashed=function(){return(s.__emscripten_thread_crashed=s.asm.ya).apply(null,arguments)};var ft,pt=s._emscripten_run_in_main_runtime_thread_js=function(){return(pt=s._emscripten_run_in_main_runtime_thread_js=s.asm.za).apply(null,arguments)},dt=s.__emscripten_proxy_execute_task_queue=function(){return(dt=s.__emscripten_proxy_execute_task_queue=s.asm.Aa).apply(null,arguments)},mt=s.__emscripten_thread_free_data=function(){return(mt=s.__emscripten_thread_free_data=s.asm.Ba).apply(null,arguments)},gt=s.__emscripten_thread_exit=function(){return(gt=s.__emscripten_thread_exit=s.asm.Ca).apply(null,arguments)},ht=s._emscripten_stack_set_limits=function(){return(ht=s._emscripten_stack_set_limits=s.asm.Da).apply(null,arguments)},yt=s.stackSave=function(){return(yt=s.stackSave=s.asm.Ea).apply(null,arguments)},vt=s.stackRestore=function(){return(vt=s.stackRestore=s.asm.Fa).apply(null,arguments)},bt=s.stackAlloc=function(){return(bt=s.stackAlloc=s.asm.Ga).apply(null,arguments)};function _t(){function e(){if(!ft&&(ft=!0,s.calledRun=!0,!W)&&(O||me(J),u(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),!O)){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;){var e=s.postRun.shift();Q.unshift(e)}me(Q)}}if(!(0{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){var t,r,a;e=e||{},t||(t=void 0!==e?e:{}),t.ready=new Promise((function(e,t){r=e,a=t}));var o,i,s,u,c,l,f=Object.assign({},t),p="./this.program",d="object"==typeof window,m="function"==typeof importScripts,g="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";g?(h=m?n(908).dirname(h)+"/":"//",l=()=>{c||(u=n(384),c=n(908))},o=function(e,t){return l(),e=c.normalize(e),u.readFileSync(e,t?void 0:"utf8")},s=e=>((e=o(e,!0)).buffer||(e=new Uint8Array(e)),e),i=(e,t,n)=>{l(),e=c.normalize(e),u.readFile(e,(function(e,r){e?n(e):t(r.buffer)}))},1{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},m&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=(e,t,n)=>{var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)});var y,v=t.print||console.log.bind(console),b=t.printErr||console.warn.bind(console);Object.assign(t,f),f=null,t.thisProgram&&(p=t.thisProgram),t.wasmBinary&&(y=t.wasmBinary),t.noExitRuntime,"object"!=typeof WebAssembly&&Y("no native wasm support detected");var _,w,O,S,A,T,M=!1,E="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(e,t,n){var r=(t>>>=0)+n;for(n=t;e[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|o<<6|i:(7&a)<<18|o<<12|i<<6|63&e[t++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function x(e,t){return(e>>>=0)?R(S,e,t):""}function C(e,t,n,r){if(!(0>>=0;r=n+r-1;for(var o=0;o=i&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++o)),127>=i){if(n>=r)break;t[n++>>>0]=i}else{if(2047>=i){if(n+1>=r)break;t[n++>>>0]=192|i>>6}else{if(65535>=i){if(n+2>=r)break;t[n++>>>0]=224|i>>12}else{if(n+3>=r)break;t[n++>>>0]=240|i>>18,t[n++>>>0]=128|i>>12&63}t[n++>>>0]=128|i>>6&63}t[n++>>>0]=128|63&i}}return t[n>>>0]=0,n-a}function P(e){for(var t=0,n=0;n=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t}function k(){var e=_.buffer;w=e,t.HEAP8=O=new Int8Array(e),t.HEAP16=new Int16Array(e),t.HEAP32=A=new Int32Array(e),t.HEAPU8=S=new Uint8Array(e),t.HEAPU16=new Uint16Array(e),t.HEAPU32=T=new Uint32Array(e),t.HEAPF32=new Float32Array(e),t.HEAPF64=new Float64Array(e)}var D=[],F=[],I=[];function U(){var e=t.preRun.shift();D.unshift(e)}var H,L=0,W=null,j=null;function Y(e){throw t.onAbort&&t.onAbort(e),b(e="Aborted("+e+")"),M=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),a(e),e}function z(){return H.startsWith("data:application/octet-stream;base64,")}if(H="ort-wasm.wasm",!z()){var N=H;H=t.locateFile?t.locateFile(N,h):h+N}function B(){var e=H;try{if(e==H&&y)return new Uint8Array(y);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}catch(e){Y(e)}}function G(e){for(;0e?-1:0r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),11>n?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return n=new Date(e.getFullYear()+1,0,4),t=s(new Date(e.getFullYear(),0,4)),n=s(n),0>=i(t,e)?0>=i(n,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var c=A[r+40>>2>>>0];for(var l in r={ua:A[r>>2>>>0],ta:A[r+4>>2>>>0],oa:A[r+8>>2>>>0],qa:A[r+12>>2>>>0],pa:A[r+16>>2>>>0],na:A[r+20>>2>>>0],ia:A[r+24>>2>>>0],ma:A[r+28>>2>>>0],wa:A[r+32>>2>>>0],sa:A[r+36>>2>>>0],va:c?x(c):""},n=x(n),c={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),c[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in c={"%a":function(e){return f[e.ia].substring(0,3)},"%A":function(e){return f[e.ia]},"%b":function(e){return p[e.pa].substring(0,3)},"%B":function(e){return p[e.pa]},"%C":function(e){return o((e.na+1900)/100|0,2)},"%d":function(e){return o(e.qa,2)},"%e":function(e){return a(e.qa,2," ")},"%g":function(e){return u(e).toString().substring(2)},"%G":function(e){return u(e)},"%H":function(e){return o(e.oa,2)},"%I":function(e){return 0==(e=e.oa)?e=12:12e.oa?"AM":"PM"},"%S":function(e){return o(e.ua,2)},"%t":function(){return"\\t"},"%u":function(e){return e.ia||7},"%U":function(e){return o(Math.floor((e.ma+7-e.ia)/7),2)},"%V":function(e){var t=Math.floor((e.ma+7-(e.ia+6)%7)/7);if(2>=(e.ia+371-e.ma-2)%7&&t++,t)53==t&&(4==(n=(e.ia+371-e.ma)%7)||3==n&&Q(e.na)||(t=1));else{t=52;var n=(e.ia+7-e.ma-1)%7;(4==n||5==n&&Q(e.na%400-1))&&t++}return o(t,2)},"%w":function(e){return e.ia},"%W":function(e){return o(Math.floor((e.ma+7-(e.ia+6)%7)/7),2)},"%y":function(e){return(e.na+1900).toString().substring(2)},"%Y":function(e){return e.na+1900},"%z":function(e){var t=0<=(e=e.sa);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.va},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),c)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),c[l](r)));return l=function(e){var t=Array(P(e)+1);return C(e,t,0,t.length),t}(n=n.replace(/\\0\\0/g,"%")),l.length>t?0:(O.set(l,e>>>0),l.length-1)}var te={d:function(){return 0},I:function(){},w:function(){},y:function(){},r:function(){return 0},G:function(){},B:function(){},F:function(){},h:function(){},x:function(){},t:function(){},H:function(){},v:function(){},n:function(){},u:function(){Y("To use dlopen, you need enable dynamic linking, see ")},o:function(){Y("To use dlopen, you need enable dynamic linking, see ")},i:function(){return Date.now()},J:function(){return!0},j:function(e,t){e=new Date(1e3*(T[e>>>2]+4294967296*A[e+4>>>2])),A[t>>2>>>0]=e.getUTCSeconds(),A[t+4>>2>>>0]=e.getUTCMinutes(),A[t+8>>2>>>0]=e.getUTCHours(),A[t+12>>2>>>0]=e.getUTCDate(),A[t+16>>2>>>0]=e.getUTCMonth(),A[t+20>>2>>>0]=e.getUTCFullYear()-1900,A[t+24>>2>>>0]=e.getUTCDay(),A[t+28>>2>>>0]=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},k:function(e,t){e=new Date(1e3*(T[e>>>2]+4294967296*A[e+4>>>2])),A[t>>2>>>0]=e.getSeconds(),A[t+4>>2>>>0]=e.getMinutes(),A[t+8>>2>>>0]=e.getHours(),A[t+12>>2>>>0]=e.getDate(),A[t+16>>2>>>0]=e.getMonth(),A[t+20>>2>>>0]=e.getFullYear()-1900,A[t+24>>2>>>0]=e.getDay();var n=new Date(e.getFullYear(),0,1);A[t+28>>2>>>0]=(e.getTime()-n.getTime())/864e5|0,A[t+36>>2>>>0]=-60*e.getTimezoneOffset();var r=new Date(e.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),A[t+32>>2>>>0]=0|(r!=n&&e.getTimezoneOffset()==Math.min(n,r))},l:function(e){var t=new Date(A[e+20>>2>>>0]+1900,A[e+16>>2>>>0],A[e+12>>2>>>0],A[e+8>>2>>>0],A[e+4>>2>>>0],A[e>>2>>>0],0),n=A[e+32>>2>>>0],r=t.getTimezoneOffset(),a=new Date(t.getFullYear(),0,1),o=new Date(t.getFullYear(),6,1).getTimezoneOffset(),i=a.getTimezoneOffset(),s=Math.min(i,o);return 0>n?A[e+32>>2>>>0]=Number(o!=i&&s==r):0>2>>>0]=t.getDay(),A[e+28>>2>>>0]=(t.getTime()-a.getTime())/864e5|0,A[e>>2>>>0]=t.getSeconds(),A[e+4>>2>>>0]=t.getMinutes(),A[e+8>>2>>>0]=t.getHours(),A[e+12>>2>>>0]=t.getDate(),A[e+16>>2>>>0]=t.getMonth(),t.getTime()/1e3|0},z:function(){return-52},A:function(){},m:function e(t,n,r){e.ra||(e.ra=!0,function(e,t,n){function r(e){return(e=e.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?e[1]:"GMT"}var a=(new Date).getFullYear(),o=new Date(a,0,1),i=new Date(a,6,1);a=o.getTimezoneOffset();var s=i.getTimezoneOffset();A[e>>2>>>0]=60*Math.max(a,s),A[t>>2>>>0]=Number(a!=s),e=r(o),t=r(i),e=q(e),t=q(t),s>2>>>0]=e,T[n+4>>2>>>0]=t):(T[n>>2>>>0]=t,T[n+4>>2>>>0]=e)}(t,n,r))},a:function(){Y("")},s:function(){return 4294901760},e:g?()=>{var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:()=>performance.now(),E:function(e,t,n){S.copyWithin(e>>>0,t>>>0,t+n>>>0)},b:function(e){var t=S.length;if(4294901760<(e>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296);var a=Math;r=Math.max(e,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);e:{try{_.grow(a-w.byteLength+65535>>>16),k();var o=1;break e}catch(e){}o=void 0}if(o)return!0}return!1},C:function(e,t){var n=0;return V().forEach((function(r,a){var o=t+n;for(a=T[e+4*a>>2>>>0]=o,o=0;o>0>>>0]=r.charCodeAt(o);O[a>>0>>>0]=0,n+=r.length+1})),0},D:function(e,t){var n=V();T[e>>2>>>0]=n.length;var r=0;return n.forEach((function(e){r+=e.length+1})),T[t>>2>>>0]=r,0},c:function(){return 52},g:function(){return 52},p:function(){return 70},f:function(e,t,n,r){for(var a=0,o=0;o>2>>>0],s=T[t+4>>2>>>0];t+=8;for(var u=0;u>>0],l=X[e];0===c||10===c?((1===e?v:b)(R(l,0)),l.length=0):l.push(c)}a+=s}return T[r>>2>>>0]=a,0},K:ee,q:function(e,t,n,r){return ee(e,t,n,r)}};!function(){function e(e){t.asm=e.exports,_=t.asm.L,k(),F.unshift(t.asm.M),L--,t.monitorRunDependencies&&t.monitorRunDependencies(L),0==L&&(null!==W&&(clearInterval(W),W=null),j&&(e=j,j=null,e()))}function n(t){e(t.instance)}function r(e){return function(){if(!y&&(d||m)){if("function"==typeof fetch&&!H.startsWith("file://"))return fetch(H,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at \'"+H+"\'";return e.arrayBuffer()})).catch((function(){return B()}));if(i)return new Promise((function(e,t){i(H,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return B()}))}().then((function(e){return WebAssembly.instantiate(e,o)})).then((function(e){return e})).then(e,(function(e){b("failed to asynchronously prepare wasm: "+e),Y(e)}))}var o={a:te};if(L++,t.monitorRunDependencies&&t.monitorRunDependencies(L),t.instantiateWasm)try{return t.instantiateWasm(o,e)}catch(e){return b("Module.instantiateWasm callback failed with error: "+e),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||z()||H.startsWith("file://")||g||"function"!=typeof fetch?r(n):fetch(H,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,o).then(n,(function(e){return b("wasm streaming compile failed: "+e),b("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.M).apply(null,arguments)},t._OrtInit=function(){return(t._OrtInit=t.asm.N).apply(null,arguments)},t._OrtCreateSessionOptions=function(){return(t._OrtCreateSessionOptions=t.asm.O).apply(null,arguments)},t._OrtAppendExecutionProvider=function(){return(t._OrtAppendExecutionProvider=t.asm.P).apply(null,arguments)},t._OrtAddSessionConfigEntry=function(){return(t._OrtAddSessionConfigEntry=t.asm.Q).apply(null,arguments)},t._OrtReleaseSessionOptions=function(){return(t._OrtReleaseSessionOptions=t.asm.R).apply(null,arguments)},t._OrtCreateSession=function(){return(t._OrtCreateSession=t.asm.S).apply(null,arguments)},t._OrtReleaseSession=function(){return(t._OrtReleaseSession=t.asm.T).apply(null,arguments)},t._OrtGetInputCount=function(){return(t._OrtGetInputCount=t.asm.U).apply(null,arguments)},t._OrtGetOutputCount=function(){return(t._OrtGetOutputCount=t.asm.V).apply(null,arguments)},t._OrtGetInputName=function(){return(t._OrtGetInputName=t.asm.W).apply(null,arguments)},t._OrtGetOutputName=function(){return(t._OrtGetOutputName=t.asm.X).apply(null,arguments)},t._OrtFree=function(){return(t._OrtFree=t.asm.Y).apply(null,arguments)},t._OrtCreateTensor=function(){return(t._OrtCreateTensor=t.asm.Z).apply(null,arguments)},t._OrtGetTensorData=function(){return(t._OrtGetTensorData=t.asm._).apply(null,arguments)},t._OrtReleaseTensor=function(){return(t._OrtReleaseTensor=t.asm.$).apply(null,arguments)},t._OrtCreateRunOptions=function(){return(t._OrtCreateRunOptions=t.asm.aa).apply(null,arguments)},t._OrtAddRunConfigEntry=function(){return(t._OrtAddRunConfigEntry=t.asm.ba).apply(null,arguments)},t._OrtReleaseRunOptions=function(){return(t._OrtReleaseRunOptions=t.asm.ca).apply(null,arguments)},t._OrtRun=function(){return(t._OrtRun=t.asm.da).apply(null,arguments)},t._OrtEndProfiling=function(){return(t._OrtEndProfiling=t.asm.ea).apply(null,arguments)};var ne=t._malloc=function(){return(ne=t._malloc=t.asm.fa).apply(null,arguments)};t._free=function(){return(t._free=t.asm.ga).apply(null,arguments)},t._fflush=function(){return(t._fflush=t.asm.ha).apply(null,arguments)};var re,ae=t.stackSave=function(){return(ae=t.stackSave=t.asm.ja).apply(null,arguments)},oe=t.stackRestore=function(){return(oe=t.stackRestore=t.asm.ka).apply(null,arguments)},ie=t.stackAlloc=function(){return(ie=t.stackAlloc=t.asm.la).apply(null,arguments)};function se(){function e(){if(!re&&(re=!0,t.calledRun=!0,!M)){if(G(F),r(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e=t.postRun.shift();I.unshift(e)}G(I)}}if(!(0{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iterateExtraOptions=void 0,t.iterateExtraOptions=(e,n,r,a)=>{if("object"==typeof e&&null!==e){if(r.has(e))throw new Error("Circular reference in options");r.add(e)}Object.entries(e).forEach((([e,o])=>{const i=n?n+e:e;if("object"==typeof o)(0,t.iterateExtraOptions)(o,i+".",r,a);else if("string"==typeof o||"number"==typeof o)a(i,o.toString());else{if("boolean"!=typeof o)throw new Error("Can\'t handle extra config type: "+typeof o);a(i,o?"1":"0")}}))}},586:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setRunOptions=void 0;const r=n(967),a=n(983),o=n(361);t.setRunOptions=e=>{const t=(0,o.getInstance)();let n=0;const i=[],s=e||{};try{if(void 0===(null==e?void 0:e.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof e.logSeverityLevel||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if(void 0===(null==e?void 0:e.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof e.logVerbosityLevel||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);void 0===(null==e?void 0:e.terminate)&&(s.terminate=!1);let o=0;if(void 0!==(null==e?void 0:e.tag)&&(o=(0,a.allocWasmString)(e.tag,i)),n=t._OrtCreateRunOptions(s.logSeverityLevel,s.logVerbosityLevel,!!s.terminate,o),0===n)throw new Error("Can\'t create run options");return void 0!==(null==e?void 0:e.extra)&&(0,r.iterateExtraOptions)(e.extra,"",new WeakSet,((e,r)=>{const o=(0,a.allocWasmString)(e,i),s=(0,a.allocWasmString)(r,i);if(0!==t._OrtAddRunConfigEntry(n,o,s))throw new Error(`Can\'t set a run config entry: ${e} - ${r}`)})),[n,i]}catch(e){throw 0!==n&&t._OrtReleaseRunOptions(n),i.forEach(t._free),e}}},919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setSessionOptions=void 0;const r=n(967),a=n(983),o=n(361);t.setSessionOptions=e=>{const t=(0,o.getInstance)();let n=0;const i=[],s=e||{};(e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});const t=e.extra.session;t.use_ort_model_bytes_directly||(t.use_ort_model_bytes_directly="1")})(s);try{void 0===(null==e?void 0:e.graphOptimizationLevel)&&(s.graphOptimizationLevel="all");const u=(e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}})(s.graphOptimizationLevel);void 0===(null==e?void 0:e.enableCpuMemArena)&&(s.enableCpuMemArena=!0),void 0===(null==e?void 0:e.enableMemPattern)&&(s.enableMemPattern=!0),void 0===(null==e?void 0:e.executionMode)&&(s.executionMode="sequential");const c=(e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}})(s.executionMode);let l=0;if(void 0!==(null==e?void 0:e.logId)&&(l=(0,a.allocWasmString)(e.logId,i)),void 0===(null==e?void 0:e.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof e.logSeverityLevel||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if(void 0===(null==e?void 0:e.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof e.logVerbosityLevel||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);if(void 0===(null==e?void 0:e.enableProfiling)&&(s.enableProfiling=!1),n=t._OrtCreateSessionOptions(u,!!s.enableCpuMemArena,!!s.enableMemPattern,c,!!s.enableProfiling,0,l,s.logSeverityLevel,s.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==e?void 0:e.executionProviders)&&((e,t,n)=>{for(const r of t){let t="string"==typeof r?r:r.name;switch(t){case"xnnpack":t="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${t}`)}const i=(0,a.allocWasmString)(t,n);if(0!==(0,o.getInstance)()._OrtAppendExecutionProvider(e,i))throw new Error(`Can\'t append execution provider: ${t}`)}})(n,e.executionProviders,i),void 0!==(null==e?void 0:e.extra)&&(0,r.iterateExtraOptions)(e.extra,"",new WeakSet,((e,r)=>{const o=(0,a.allocWasmString)(e,i),s=(0,a.allocWasmString)(r,i);if(0!==t._OrtAddSessionConfigEntry(n,o,s))throw new Error(`Can\'t set a session config entry: ${e} - ${r}`)})),[n,i]}catch(e){throw 0!==n&&t._OrtReleaseSessionOptions(n),i.forEach(t._free),e}}},983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allocWasmString=void 0;const r=n(361);t.allocWasmString=(e,t)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(e)+1,o=n._malloc(a);return n.stringToUTF8(e,o,a),t.push(o),o}},349:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractTransferableBuffers=t.endProfiling=t.run=t.releaseSession=t.createSession=t.createSessionFinalize=t.createSessionAllocate=t.initOrt=void 0;const r=n(586),a=n(919),o=n(983),i=n(361);t.initOrt=(e,t)=>{const n=(0,i.getInstance)()._OrtInit(e,t);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const s=new Map;t.createSessionAllocate=e=>{const t=(0,i.getInstance)(),n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),[n,e.byteLength]},t.createSessionFinalize=(e,t)=>{const n=(0,i.getInstance)();let r=0,o=0,u=[];try{if([o,u]=(0,a.setSessionOptions)(t),r=n._OrtCreateSession(e[0],e[1],o),0===r)throw new Error("Can\'t create a session")}finally{n._free(e[0]),n._OrtReleaseSessionOptions(o),u.forEach(n._free)}const c=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],d=[],m=[];for(let e=0;e{const r=(0,t.createSessionAllocate)(e);return(0,t.createSessionFinalize)(r,n)},t.releaseSession=e=>{const t=(0,i.getInstance)(),n=s.get(e);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],o=n[2];a.forEach(t._OrtFree),o.forEach(t._OrtFree),t._OrtReleaseSession(r),s.delete(e)};const u=e=>{switch(e){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${e}`)}},c=e=>{switch(e){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${e}`)}},l=e=>{switch(e){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}};t.run=(e,t,n,a,f)=>{const p=(0,i.getInstance)(),d=s.get(e);if(!d)throw new Error("invalid session id");const m=d[0],g=d[1],h=d[2],y=t.length,v=a.length;let b=0,_=[];const w=[],O=[];try{[b,_]=(0,r.setRunOptions)(f);for(let e=0;ep.HEAP32[e++]=t));const n=p._OrtCreateTensor(u(t),i,s,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");w.push(n)}finally{p.stackRestore(c)}}const e=p.stackSave(),i=p.stackAlloc(4*y),s=p.stackAlloc(4*y),d=p.stackAlloc(4*v),S=p.stackAlloc(4*v);try{let n=i/4,r=s/4,o=d/4,u=S/4;for(let e=0;ee*t));if(a=c(i),"string"===a){const e=[];let t=o/4;for(let n=0;n{const t=(0,i.getInstance)(),n=s.get(e);if(!n)throw new Error("invalid session id");const r=n[0],a=t._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");t._OrtFree(a)},t.extractTransferableBuffers=e=>{const t=[];for(const n of e){const e=n[2];!Array.isArray(e)&&e.buffer&&t.push(e.buffer)}return t}},361:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return a(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.dispose=t.getInstance=t.initializeWebAssembly=void 0;const s=o(n(449)),u=i(n(932)),c=n(474);let l,f=!1,p=!1,d=!1;const m=(e,t)=>t?e?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":e?"ort-wasm-simd.wasm":"ort-wasm.wasm";t.initializeWebAssembly=async e=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(d)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const t=e.initTimeout,r=e.numThreads,a=e.simd,o=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(e){return!1}})(),i=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(e){return!1}})(),g="string"==typeof e.wasmPaths?e.wasmPaths:void 0,h=m(!1,o),y=m(i,o),v="object"==typeof e.wasmPaths?e.wasmPaths[y]:void 0;let b=!1;const _=[];if(t>0&&_.push(new Promise((e=>{setTimeout((()=>{b=!0,e()}),t)}))),_.push(new Promise(((e,t)=>{const r=o?c:u.default,a={locateFile:(e,t)=>o&&e.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):e===h?null!=v?v:(null!=g?g:t)+y:t+e};if(o)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=s.join("/","ort-wasm-threaded.js");else{const e=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([e],{type:"text/javascript"})}r(a).then((t=>{p=!1,f=!0,l=t,e()}),(e=>{p=!1,d=!0,t(e)}))}))),await Promise.race(_),b)throw new Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},t.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},t.dispose=()=>{var e;!f||p||d||(p=!0,null===(e=l.PThread)||void 0===e||e.terminateAllThreads(),l=void 0,p=!1,f=!1,d=!0)}},154:e=>{"use strict";e.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{"use strict";const e=n(349),t=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,t.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(e=>postMessage({type:"init-wasm",err:e})));break;case"init-ort":try{const{numThreads:t,loggingLevel:r}=n.data.in;(0,e.initOrt)(t,r),postMessage({type:"init-ort"})}catch(e){postMessage({type:"init-ort",err:e})}break;case"create_allocate":try{const{model:t}=n.data.in,r=(0,e.createSessionAllocate)(t);postMessage({type:"create_allocate",out:r})}catch(e){postMessage({type:"create_allocate",err:e})}break;case"create_finalize":try{const{modeldata:t,options:r}=n.data.in,a=(0,e.createSessionFinalize)(t,r);postMessage({type:"create_finalize",out:a})}catch(e){postMessage({type:"create_finalize",err:e})}break;case"create":try{const{model:t,options:r}=n.data.in,a=(0,e.createSession)(t,r);postMessage({type:"create",out:a})}catch(e){postMessage({type:"create",err:e})}break;case"release":try{const t=n.data.in;(0,e.releaseSession)(t),postMessage({type:"release"})}catch(e){postMessage({type:"release",err:e})}break;case"run":try{const{sessionId:t,inputIndices:r,inputs:a,outputIndices:o,options:i}=n.data.in,s=(0,e.run)(t,r,a,o,i);postMessage({type:"run",out:s},(0,e.extractTransferableBuffers)(s))}catch(e){postMessage({type:"run",err:e})}break;case"end-profiling":try{const t=n.data.in;(0,e.endProfiling)(t),postMessage({type:"end-profiling"})}catch(e){postMessage({type:"end-profiling",err:e})}}}})()})();\n',"Worker",void 0,void 0)}},477:t=>{"use strict";t.exports=function(t,e,n,r){var i=self||window;try{try{var o;try{o=new i.Blob([t])}catch(e){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),o=o.getBlob()}var a=i.URL||i.webkitURL,s=a.createObjectURL(o),u=new i[e](s,n);return a.revokeObjectURL(s),u}catch(r){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),n)}}catch(t){if(!r)throw Error("Inline worker is not supported");return new i[e](r,n)}}},4154:t=>{"use strict";t.exports='"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\n'},1670:t=>{"use strict";t.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(t,e,n)=>{"use strict";n.r(e),n.d(e,{flatbuffers:()=>r});var r={};r.Offset,r.Table,r.SIZEOF_SHORT=2,r.SIZEOF_INT=4,r.FILE_IDENTIFIER_LENGTH=4,r.SIZE_PREFIX_LENGTH=4,r.Encoding={UTF8_BYTES:1,UTF16_STRING:2},r.int32=new Int32Array(2),r.float32=new Float32Array(r.int32.buffer),r.float64=new Float64Array(r.int32.buffer),r.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],r.Long=function(t,e){this.low=0|t,this.high=0|e},r.Long.create=function(t,e){return 0==t&&0==e?r.Long.ZERO:new r.Long(t,e)},r.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},r.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},r.Long.ZERO=new r.Long(0,0),r.Builder=function(t){if(t)e=t;else var e=1024;this.bb=r.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},r.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},r.Builder.prototype.dataBuffer=function(){return this.bb},r.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},r.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var n=1+~(this.bb.capacity()-this.space+e)&t-1;this.space=0&&0==this.vtable[e];e--);for(var n=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=(n+2)*r.SIZEOF_SHORT;this.addInt16(i);var o=0,a=this.space;t:for(e=0;e=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,r.SIZEOF_INT+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},r.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},r.Builder.prototype.requiredField=function(t,e){var n=this.bb.capacity()-t,r=n-this.bb.readInt32(n);if(0==this.bb.readInt16(r+e))throw new Error("FlatBuffers: field "+e+" must be set")},r.Builder.prototype.startVector=function(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(r.SIZEOF_INT,t*e),this.prep(n,t*e)},r.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},r.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var n=0;n=56320?i:(i<<10)+t.charCodeAt(n++)+-56613888)<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(63&r|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),n=0;for(var o=this.space,a=this.bb.bytes();n>24},r.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},r.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},r.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},r.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},r.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},r.ByteBuffer.prototype.readInt64=function(t){return new r.Long(this.readInt32(t),this.readInt32(t+4))},r.ByteBuffer.prototype.readUint64=function(t){return new r.Long(this.readUint32(t),this.readUint32(t+4))},r.ByteBuffer.prototype.readFloat32=function(t){return r.int32[0]=this.readInt32(t),r.float32[0]},r.ByteBuffer.prototype.readFloat64=function(t){return r.int32[r.isLittleEndian?0:1]=this.readInt32(t),r.int32[r.isLittleEndian?1:0]=this.readInt32(t+4),r.float64[0]},r.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},r.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},r.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},r.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},r.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},r.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},r.ByteBuffer.prototype.writeFloat32=function(t,e){r.float32[0]=e,this.writeInt32(t,r.int32[0])},r.ByteBuffer.prototype.writeFloat64=function(t,e){r.float64[0]=e,this.writeInt32(t,r.int32[r.isLittleEndian?0:1]),this.writeInt32(t+4,r.int32[r.isLittleEndian?1:0])},r.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&a)))}return i},r.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},r.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+r.SIZEOF_INT},r.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},r.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=r.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+r.FILE_IDENTIFIER_LENGTH);for(var e=0;e{var e=t&&t.__esModule?()=>t.default:()=>t;return __nested_webpack_require_514868__.d(e,{a:e}),e},__nested_webpack_require_514868__.d=(t,e)=>{for(var n in e)__nested_webpack_require_514868__.o(e,n)&&!__nested_webpack_require_514868__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__nested_webpack_require_514868__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__nested_webpack_require_514868__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__nested_webpack_require_514868__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__=__nested_webpack_require_514868__(6018);return __webpack_exports__})(),module.exports=t(__webpack_require__(8412))},9591:(t,e,n)=>{"use strict";var r={};(0,n(4236).assign)(r,n(4555),n(8843),n(1619)),t.exports=r},4555:(t,e,n)=>{"use strict";var r=n(405),i=n(4236),o=n(9373),a=n(8898),s=n(2292),u=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(t);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==n)throw new Error(a[n]);if(e.header&&r.deflateSetHeader(this.strm,e.header),e.dictionary){var c;if(c="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(a[n]);this._dict_set=!0}}function c(t,e){var n=new l(e);if(n.push(t,!0),n.err)throw n.msg||a[n.err];return n.result}l.prototype.push=function(t,e){var n,a,s=this.strm,l=this.options.chunkSize;if(this.ended)return!1;a=e===~~e?e:!0===e?4:0,"string"==typeof t?s.input=o.string2buf(t):"[object ArrayBuffer]"===u.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new i.Buf8(l),s.next_out=0,s.avail_out=l),1!==(n=r.deflate(s,a))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||4!==a&&2!==a)||("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(s.output,s.next_out))):this.onData(i.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==n);return 4===a?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==a||(this.onEnd(0),s.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=l,e.deflate=c,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)}},8843:(t,e,n)=>{"use strict";var r=n(7948),i=n(4236),o=n(9373),a=n(1619),s=n(8898),u=n(2292),l=n(2401),c=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,e.windowBits);if(n!==a.Z_OK)throw new Error(s[n]);if(this.header=new l,r.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=o.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=r.inflateSetDictionary(this.strm,e.dictionary))!==a.Z_OK))throw new Error(s[n])}function f(t,e){var n=new h(e);if(n.push(t,!0),n.err)throw n.msg||s[n.err];return n.result}h.prototype.push=function(t,e){var n,s,u,l,h,f=this.strm,d=this.options.chunkSize,p=this.options.dictionary,g=!1;if(this.ended)return!1;s=e===~~e?e:!0===e?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof t?f.input=o.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?f.input=new Uint8Array(t):f.input=t,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new i.Buf8(d),f.next_out=0,f.avail_out=d),(n=r.inflate(f,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&p&&(n=r.inflateSetDictionary(this.strm,p)),n===a.Z_BUF_ERROR&&!0===g&&(n=a.Z_OK,g=!1),n!==a.Z_STREAM_END&&n!==a.Z_OK)return this.onEnd(n),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&n!==a.Z_STREAM_END&&(0!==f.avail_in||s!==a.Z_FINISH&&s!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(u=o.utf8border(f.output,f.next_out),l=f.next_out-u,h=o.buf2string(f.output,u),f.next_out=l,f.avail_out=d-l,l&&i.arraySet(f.output,f.output,u,l,0),this.onData(h)):this.onData(i.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(g=!0)}while((f.avail_in>0||0===f.avail_out)&&n!==a.Z_STREAM_END);return n===a.Z_STREAM_END&&(s=a.Z_FINISH),s===a.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===a.Z_OK):s!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),f.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=h,e.inflate=f,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,f(t,e)},e.ungzip=f},4236:(t,e)=>{"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(t[i]=n[i])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o{"use strict";var r=n(4236),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var a=new r.Buf8(256),s=0;s<256;s++)a[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function u(t,e){if(e<65534&&(t.subarray&&o||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var n="",a=0;a>>6,e[a++]=128|63&n):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|63&n):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|63&n);return e},e.buf2binstring=function(t){return u(t,t.length)},e.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n4)l[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&n1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return u(l,r)},e.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+a[t[n]]>e?n:e}},6069:t=>{"use strict";t.exports=function(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},1619:t=>{"use strict";t.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_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}},2869:t=>{"use strict";var e=function(){for(var t,e=[],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}();t.exports=function(t,n,r,i){var o=e,a=i+r;t^=-1;for(var s=i;s>>8^o[255&(t^n[s])];return-1^t}},405:(t,e,n)=>{"use strict";var r,i=n(4236),o=n(342),a=n(6069),s=n(2869),u=n(8898),l=-2,c=258,h=262,f=103,d=113,p=666;function g(t,e){return t.msg=u[e],e}function m(t){return(t<<1)-(t>4?9:0)}function b(t){for(var e=t.length;--e>=0;)t[e]=0}function y(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function _(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,y(t.strm)}function v(t,e){t.pending_buf[t.pending++]=e}function w(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function x(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-h?t.strstart-(t.w_size-h):0,l=t.window,f=t.w_mask,d=t.prev,p=t.strstart+c,g=l[o+a-1],m=l[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(n=e)+a]===m&&l[n+a-1]===g&&l[n]===l[o]&&l[++n]===l[o+1]){o+=2,n++;do{}while(l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&l[++o]===l[++n]&&oa){if(t.match_start=e,a=r,r>=s)break;g=l[o+a-1],m=l[o+a]}}}while((e=d[e&f])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead}function T(t){var e,n,r,o,u,l,c,f,d,p,g=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=g+(g-h)){i.arraySet(t.window,t.window,g,g,0),t.match_start-=g,t.strstart-=g,t.block_start-=g,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=g?r-g:0}while(--n);e=n=g;do{r=t.prev[--e],t.prev[e]=r>=g?r-g:0}while(--n);o+=g}if(0===t.strm.avail_in)break;if(l=t.strm,c=t.window,f=t.strstart+t.lookahead,d=o,p=void 0,(p=l.avail_in)>d&&(p=d),n=0===p?0:(l.avail_in-=p,i.arraySet(c,l.input,l.next_in,p,f),1===l.state.wrap?l.adler=a(l.adler,c,p,f):2===l.state.wrap&&(l.adler=s(l.adler,c,p,f)),l.next_in+=p,l.total_in+=p,p),t.lookahead+=n,t.lookahead+t.insert>=3)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(r=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,r=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<15&&(s=2,r-=16),o<1||o>9||8!==n||r<8||r>15||e<0||e>9||a<0||a>4)return g(t,l);8===r&&(r=9);var u=new O;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(T(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,_(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-h&&(_(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(_(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(_(t,!1),t.strm.avail_out),1)})),new A(4,4,8,4,E),new A(4,5,16,8,E),new A(4,6,32,32,E),new A(4,4,16,16,S),new A(8,16,32,32,S),new A(8,16,128,128,S),new A(8,32,128,256,S),new A(32,128,258,1024,S),new A(32,258,258,4096,S)],e.deflateInit=function(t,e){return k(t,e,8,15,8,0)},e.deflateInit2=k,e.deflateReset=P,e.deflateResetKeep=I,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,0):l},e.deflate=function(t,e){var n,i,a,u;if(!t||!t.state||e>5||e<0)return t?g(t,l):l;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||i.status===p&&4!==e)return g(t,0===t.avail_out?-5:l);if(i.strm=t,n=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,v(i,31),v(i,139),v(i,8),i.gzhead?(v(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),v(i,255&i.gzhead.time),v(i,i.gzhead.time>>8&255),v(i,i.gzhead.time>>16&255),v(i,i.gzhead.time>>24&255),v(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),v(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(v(i,255&i.gzhead.extra.length),v(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(v(i,0),v(i,0),v(i,0),v(i,0),v(i,0),v(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),v(i,3),i.status=d);else{var h=8+(i.w_bits-8<<4)<<8;h|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=d,w(i,h),0!==i.strstart&&(w(i,t.adler>>>16),w(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),y(t),a=i.pending,i.pending!==i.pending_buf_size));)v(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),y(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexa&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),y(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexa&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.status=f)}else i.status=f;if(i.status===f&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&y(t),i.pending+2<=i.pending_buf_size&&(v(i,255&t.adler),v(i,t.adler>>8&255),t.adler=0,i.status=d)):i.status=d),0!==i.pending){if(y(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&m(e)<=m(n)&&4!==e)return g(t,-5);if(i.status===p&&0!==t.avail_in)return g(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&i.status!==p){var x=2===i.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(T(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(_(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(_(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(_(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var n,r,i,a,s=t.window;;){if(t.lookahead<=c){if(T(t),t.lookahead<=c&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=s[i=t.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){a=t.strstart+c;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(_(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(_(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(_(t,!1),0===t.strm.avail_out)?1:2}(i,e):r[i.level].func(i,e);if(3!==x&&4!==x||(i.status=p),1===x||3===x)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===x&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(b(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),y(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(v(i,255&t.adler),v(i,t.adler>>8&255),v(i,t.adler>>16&255),v(i,t.adler>>24&255),v(i,255&t.total_in),v(i,t.total_in>>8&255),v(i,t.total_in>>16&255),v(i,t.total_in>>24&255)):(w(i,t.adler>>>16),w(i,65535&t.adler)),y(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&e!==f&&e!==d&&e!==p?g(t,l):(t.state=null,e===d?g(t,-3):0):l},e.deflateSetDictionary=function(t,e){var n,r,o,s,u,c,h,f,d=e.length;if(!t||!t.state)return l;if(2===(s=(n=t.state).wrap)||1===s&&42!==n.status||n.lookahead)return l;for(1===s&&(t.adler=a(t.adler,e,d,0)),n.wrap=0,d>=n.w_size&&(0===s&&(b(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,e,d-n.w_size,n.w_size,0),e=f,d=n.w_size),u=t.avail_in,c=t.next_in,h=t.input,t.avail_in=d,t.next_in=0,t.input=e,T(n);n.lookahead>=3;){r=n.strstart,o=n.lookahead-2;do{n.ins_h=(n.ins_h<{"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},4264:t=>{"use strict";t.exports=function(t,e){var n,r,i,o,a,s,u,l,c,h,f,d,p,g,m,b,y,_,v,w,x,T,E,S,A;n=t.state,r=t.next_in,S=t.input,i=r+(t.avail_in-5),o=t.next_out,A=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),u=n.dmax,l=n.wsize,c=n.whave,h=n.wnext,f=n.window,d=n.hold,p=n.bits,g=n.lencode,m=n.distcode,b=(1<>>=v=_>>>24,p-=v,0==(v=_>>>16&255))A[o++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=g[(65535&_)+(d&(1<>>=v,p-=v),p<15&&(d+=S[r++]<>>=v=_>>>24,p-=v,!(16&(v=_>>>16&255))){if(0==(64&v)){_=m[(65535&_)+(d&(1<u){t.msg="invalid distance too far back",n.mode=30;break t}if(d>>>=v,p-=v,x>(v=o-a)){if((v=x-v)>c&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(T=0,E=f,0===h){if(T+=l-v,v2;)A[o++]=E[T++],A[o++]=E[T++],A[o++]=E[T++],w-=3;w&&(A[o++]=E[T++],w>1&&(A[o++]=E[T++]))}else{T=o-x;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],w-=3}while(w>2);w&&(A[o++]=A[T++],w>1&&(A[o++]=A[T++]))}break}}break}}while(r>3,d&=(1<<(p-=w<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r{"use strict";var r=n(4236),i=n(6069),o=n(2869),a=n(4264),s=n(9241),u=-2,l=12,c=30;function h(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function f(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(852),e.distcode=e.distdyn=new r.Buf32(592),e.sane=1,e.back=-1,0):u}function p(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,d(t)):u}function g(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?u:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,p(t))):u}function m(t,e){var n,r;return t?(r=new f,t.state=r,r.window=null,0!==(n=g(t,e))&&(t.state=null),n):u}var b,y,_=!0;function v(t){if(_){var e;for(b=new r.Buf32(512),y=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,b,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,y,0,t.work,{bits:5}),_=!1}t.lencode=b,t.lenbits=9,t.distcode=y,t.distbits=5}function w(t,e,n,i){var o,a=t.state;return null===a.window&&(a.wsize=1<=a.wsize?(r.arraySet(a.window,e,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),r.arraySet(a.window,e,n-i,o,a.wnext),(i-=o)?(r.arraySet(a.window,e,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=o(n.check,F,2,0),y=0,_=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&y)<<8)+(y>>8))%31){t.msg="incorrect header check",n.mode=c;break}if(8!=(15&y)){t.msg="unknown compression method",n.mode=c;break}if(_-=4,R=8+(15&(y>>>=4)),0===n.wbits)n.wbits=R;else if(R>n.wbits){t.msg="invalid window size",n.mode=c;break}n.dmax=1<>8&1),512&n.flags&&(F[0]=255&y,F[1]=y>>>8&255,n.check=o(n.check,F,2,0)),y=0,_=0,n.mode=3;case 3:for(;_<32;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}n.head&&(n.head.time=y),512&n.flags&&(F[0]=255&y,F[1]=y>>>8&255,F[2]=y>>>16&255,F[3]=y>>>24&255,n.check=o(n.check,F,4,0)),y=0,_=0,n.mode=4;case 4:for(;_<16;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}n.head&&(n.head.xflags=255&y,n.head.os=y>>8),512&n.flags&&(F[0]=255&y,F[1]=y>>>8&255,n.check=o(n.check,F,2,0)),y=0,_=0,n.mode=5;case 5:if(1024&n.flags){for(;_<16;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}n.length=y,n.head&&(n.head.extra_len=y),512&n.flags&&(F[0]=255&y,F[1]=y>>>8&255,n.check=o(n.check,F,2,0)),y=0,_=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((E=n.length)>m&&(E=m),E&&(n.head&&(R=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,f,p,E,R)),512&n.flags&&(n.check=o(n.check,f,E,p)),m-=E,p+=E,n.length-=E),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===m)break t;E=0;do{R=f[p+E++],n.head&&R&&n.length<65536&&(n.head.name+=String.fromCharCode(R))}while(R&&E>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=l;break;case 10:for(;_<32;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}t.adler=n.check=h(y),y=0,_=0,n.mode=11;case 11:if(0===n.havedict)return t.next_out=g,t.avail_out=b,t.next_in=p,t.avail_in=m,n.hold=y,n.bits=_,2;t.adler=n.check=1,n.mode=l;case l:if(5===e||6===e)break t;case 13:if(n.last){y>>>=7&_,_-=7&_,n.mode=27;break}for(;_<3;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}switch(n.last=1&y,_-=1,3&(y>>>=1)){case 0:n.mode=14;break;case 1:if(v(n),n.mode=20,6===e){y>>>=2,_-=2;break t}break;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=c}y>>>=2,_-=2;break;case 14:for(y>>>=7&_,_-=7&_;_<32;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}if((65535&y)!=(y>>>16^65535)){t.msg="invalid stored block lengths",n.mode=c;break}if(n.length=65535&y,y=0,_=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(E=n.length){if(E>m&&(E=m),E>b&&(E=b),0===E)break t;r.arraySet(d,f,p,E,g),m-=E,p+=E,b-=E,g+=E,n.length-=E;break}n.mode=l;break;case 17:for(;_<14;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}if(n.nlen=257+(31&y),y>>>=5,_-=5,n.ndist=1+(31&y),y>>>=5,_-=5,n.ncode=4+(15&y),y>>>=4,_-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=c;break}n.have=0,n.mode=18;case 18:for(;n.have>>=3,_-=3}for(;n.have<19;)n.lens[j[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,L={bits:n.lenbits},C=s(0,n.lens,0,19,n.lencode,0,n.work,L),n.lenbits=L.bits,C){t.msg="invalid code lengths set",n.mode=c;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,P=65535&B,!((O=B>>>24)<=_);){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}if(P<16)y>>>=O,_-=O,n.lens[n.have++]=P;else{if(16===P){for(N=O+2;_>>=O,_-=O,0===n.have){t.msg="invalid bit length repeat",n.mode=c;break}R=n.lens[n.have-1],E=3+(3&y),y>>>=2,_-=2}else if(17===P){for(N=O+3;_>>=O)),y>>>=3,_-=3}else{for(N=O+7;_>>=O)),y>>>=7,_-=7}if(n.have+E>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=c;break}for(;E--;)n.lens[n.have++]=R}}if(n.mode===c)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=c;break}if(n.lenbits=9,L={bits:n.lenbits},C=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,L),n.lenbits=L.bits,C){t.msg="invalid literal/lengths set",n.mode=c;break}if(n.distbits=6,n.distcode=n.distdyn,L={bits:n.distbits},C=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,L),n.distbits=L.bits,C){t.msg="invalid distances set",n.mode=c;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(m>=6&&b>=258){t.next_out=g,t.avail_out=b,t.next_in=p,t.avail_in=m,n.hold=y,n.bits=_,a(t,T),g=t.next_out,d=t.output,b=t.avail_out,p=t.next_in,f=t.input,m=t.avail_in,y=n.hold,_=n.bits,n.mode===l&&(n.back=-1);break}for(n.back=0;I=(B=n.lencode[y&(1<>>16&255,P=65535&B,!((O=B>>>24)<=_);){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}if(I&&0==(240&I)){for(k=O,M=I,D=P;I=(B=n.lencode[D+((y&(1<>k)])>>>16&255,P=65535&B,!(k+(O=B>>>24)<=_);){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}y>>>=k,_-=k,n.back+=k}if(y>>>=O,_-=O,n.back+=O,n.length=P,0===I){n.mode=26;break}if(32&I){n.back=-1,n.mode=l;break}if(64&I){t.msg="invalid literal/length code",n.mode=c;break}n.extra=15&I,n.mode=22;case 22:if(n.extra){for(N=n.extra;_>>=n.extra,_-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;I=(B=n.distcode[y&(1<>>16&255,P=65535&B,!((O=B>>>24)<=_);){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}if(0==(240&I)){for(k=O,M=I,D=P;I=(B=n.distcode[D+((y&(1<>k)])>>>16&255,P=65535&B,!(k+(O=B>>>24)<=_);){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}y>>>=k,_-=k,n.back+=k}if(y>>>=O,_-=O,n.back+=O,64&I){t.msg="invalid distance code",n.mode=c;break}n.offset=P,n.extra=15&I,n.mode=24;case 24:if(n.extra){for(N=n.extra;_>>=n.extra,_-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=c;break}n.mode=25;case 25:if(0===b)break t;if(E=T-b,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=c;break}E>n.wnext?(E-=n.wnext,S=n.wsize-E):S=n.wnext-E,E>n.length&&(E=n.length),A=n.window}else A=d,S=g-n.offset,E=n.length;E>b&&(E=b),b-=E,n.length-=E;do{d[g++]=A[S++]}while(--E);0===n.length&&(n.mode=21);break;case 26:if(0===b)break t;d[g++]=n.length,b--,n.mode=21;break;case 27:if(n.wrap){for(;_<32;){if(0===m)break t;m--,y|=f[p++]<<_,_+=8}if(T-=b,t.total_out+=T,n.total+=T,T&&(t.adler=n.check=n.flags?o(n.check,d,T,g-T):i(n.check,d,T,g-T)),T=b,(n.flags?y:h(y))!==n.check){t.msg="incorrect data check",n.mode=c;break}y=0,_=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;_<32;){if(0===m)break t;m--,y+=f[p++]<<_,_+=8}if(y!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=c;break}y=0,_=0}n.mode=29;case 29:C=1;break t;case c:C=-3;break t;case 31:return-4;default:return u}return t.next_out=g,t.avail_out=b,t.next_in=p,t.avail_in=m,n.hold=y,n.bits=_,(n.wsize||T!==t.avail_out&&n.mode{"use strict";var r=n(4236),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,n,u,l,c,h,f){var d,p,g,m,b,y,_,v,w,x=f.bits,T=0,E=0,S=0,A=0,O=0,I=0,P=0,k=0,M=0,D=0,R=null,C=0,L=new r.Buf16(16),N=new r.Buf16(16),B=null,F=0;for(T=0;T<=15;T++)L[T]=0;for(E=0;E=1&&0===L[A];A--);if(O>A&&(O=A),0===A)return l[c++]=20971520,l[c++]=20971520,f.bits=1,0;for(S=1;S0&&(0===t||1!==A))return-1;for(N[1]=0,T=1;T<15;T++)N[T+1]=N[T]+L[T];for(E=0;E852||2===t&&M>592)return 1;for(;;){_=T-P,h[E]y?(v=B[F+h[E]],w=R[C+h[E]]):(v=96,w=0),d=1<>P)+(p-=d)]=_<<24|v<<16|w|0}while(0!==p);for(d=1<>=1;if(0!==d?(D&=d-1,D+=d):D=0,E++,0==--L[T]){if(T===A)break;T=e[n+h[E]]}if(T>O&&(D&m)!==g){for(0===P&&(P=O),b+=S,k=1<<(I=T-P);I+P852||2===t&&M>592)return 1;l[g=D&m]=O<<24|I<<16|b-c|0}}return 0!==D&&(l[b+D]=T-P<<24|64<<16|0),f.bits=O,0}},8898:t=>{"use strict";t.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"}},342:(t,e,n)=>{"use strict";var r=n(4236);function i(t){for(var e=t.length;--e>=0;)t[e]=0}var o=[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],a=[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],s=[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],l=new Array(576);i(l);var c=new Array(60);i(c);var h=new Array(512);i(h);var f=new Array(256);i(f);var d=new Array(29);i(d);var p,g,m,b=new Array(30);function y(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function _(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function v(t){return t<256?h[t]:h[256+(t>>>7)]}function w(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function x(t,e,n){t.bi_valid>16-n?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<>>=1,n<<=1}while(--e>0);return n>>>1}function S(t,e,n){var r,i,o=new Array(16),a=0;for(r=1;r<=15;r++)o[r]=a=a+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=E(o[s]++,s))}}function A(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function O(t){t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function I(t,e,n,r){var i=2*e,o=2*n;return t[i]>1;n>=1;n--)P(t,o,n);i=u;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],P(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,P(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,a,s,u=e.dyn_tree,l=e.max_code,c=e.stat_desc.static_tree,h=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)(o=u[2*u[2*(r=t.heap[n])+1]+1]+1)>p&&(o=p,g++),u[2*r+1]=o,r>l||(t.bl_count[o]++,a=0,r>=d&&(a=f[r-d]),s=u[2*r],t.opt_len+=s*(o+a),h&&(t.static_len+=s*(c[2*r+1]+a)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)(i=t.heap[--n])>l||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),r--)}}(t,e),S(o,l,t.bl_count)}function D(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,l=4;for(0===a&&(u=138,l=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=e[2*(r+1)+1],++s>=7;r<30;r++)for(b[r]=i<<7,t=0;t<1<0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),M(t,t.l_desc),M(t,t.d_desc),a=function(t){var e;for(D(t,t.dyn_ltree,t.l_desc.max_code),D(t,t.dyn_dtree,t.d_desc.max_code),M(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*u[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?L(t,e,n,r):4===t.strategy||o===i?(x(t,2+(r?1:0),3),k(t,l,c)):(x(t,4+(r?1:0),3),function(t,e,n,r){var i;for(x(t,e-257,5),x(t,n-1,5),x(t,r-4,4),i=0;i>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(f[n]+256+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){x(t,2,3),T(t,256,l),function(t){16===t.bi_valid?(w(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)}(t)}},2292:t=>{"use strict";t.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}},3340:t=>{function e(t,e){if(!(t=t.replace(/\t+/g," ").trim()))return null;var r=t.indexOf(" ");if(-1===r)throw new Error("no named row at line "+e);var i=t.substring(0,r);t=(t=(t=(t=t.substring(r+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var o=[],a=0;a{var e=[66,77,70];function n(t,e,n){if(n>e.length-1)return 0;var i=e.readUInt8(n++),o=e.readInt32LE(n);switch(n+=4,i){case 1:t.info=function(t,e){var n={};n.size=t.readInt16LE(e);var i=t.readUInt8(e+2);return n.smooth=i>>7&1,n.unicode=i>>6&1,n.italic=i>>5&1,n.bold=i>>4&1,i>>3&1&&(n.fixedHeight=1),n.charset=t.readUInt8(e+3)||"",n.stretchH=t.readUInt16LE(e+4),n.aa=t.readUInt8(e+6),n.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],n.spacing=[t.readInt8(e+11),t.readInt8(e+12)],n.outline=t.readUInt8(e+13),n.face=function(t,e){return r(t,e).toString("utf8")}(t,e+14),n}(e,n);break;case 2:t.common=function(t,e){var n={};return n.lineHeight=t.readUInt16LE(e),n.base=t.readUInt16LE(e+2),n.scaleW=t.readUInt16LE(e+4),n.scaleH=t.readUInt16LE(e+6),n.pages=t.readUInt16LE(e+8),t.readUInt8(e+10),n.packed=0,n.alphaChnl=t.readUInt8(e+11),n.redChnl=t.readUInt8(e+12),n.greenChnl=t.readUInt8(e+13),n.blueChnl=t.readUInt8(e+14),n}(e,n);break;case 3:t.pages=function(t,e,n){for(var i=[],o=r(t,e),a=o.length+1,s=n/a,u=0;u3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var o={kernings:[],chars:[]},a=0;a<5;a++)i+=n(o,t,i);return o}},5748:(t,e,n)=>{var r=n(2195),i=n(5926),o={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function a(t){var e=function(t){for(var e=[],n=0;n element");for(var s=o.getElementsByTagName("page"),u=0;u{var e="chasrset";t.exports=function(t){for(var n in e in t&&(t.charset=t[e],delete t[e]),t)"face"!==n&&"charset"!==n&&(t[n]="padding"===n||"spacing"===n?t[n].split(",").map((function(t){return parseInt(t,10)})):parseInt(t[n],10));return t}},4947:t=>{var e=function(t){return t.replace(/^\s+|\s+$/g,"")};t.exports=function(t){if(!t)return{};for(var n,r={},i=e(t).split("\n"),o=0;o{"use strict";var r=n(4155);function i(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function o(t,e){for(var n,r="",i=0,o=-1,a=0,s=0;s<=t.length;++s){if(s2){var u=r.lastIndexOf("/");if(u!==r.length-1){-1===u?(r="",i=0):i=(r=r.slice(0,u)).length-1-r.lastIndexOf("/"),o=s,a=0;continue}}else if(2===r.length||1===r.length){r="",i=0,o=s,a=0;continue}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+t.slice(o+1,s):r=t.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===n&&-1!==a?++a:a=-1}return r}var a={resolve:function(){for(var t,e="",n=!1,a=arguments.length-1;a>=-1&&!n;a--){var s;a>=0?s=arguments[a]:(void 0===t&&(t=r.cwd()),s=t),i(s),0!==s.length&&(e=s+"/"+e,n=47===s.charCodeAt(0))}return e=o(e,!n),n?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(i(t),0===t.length)return".";var e=47===t.charCodeAt(0),n=47===t.charCodeAt(t.length-1);return 0!==(t=o(t,!e)).length||e||(t="."),t.length>0&&n&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return i(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":a.normalize(t)},relative:function(t,e){if(i(t),i(e),t===e)return"";if((t=a.resolve(t))===(e=a.resolve(e)))return"";for(var n=1;nl){if(47===e.charCodeAt(s+h))return e.slice(s+h+1);if(0===h)return e.slice(s+h)}else o>l&&(47===t.charCodeAt(n+h)?c=h:0===h&&(c=0));break}var f=t.charCodeAt(n+h);if(f!==e.charCodeAt(s+h))break;47===f&&(c=h)}var d="";for(h=n+c+1;h<=r;++h)h!==r&&47!==t.charCodeAt(h)||(0===d.length?d+="..":d+="/..");return d.length>0?d+e.slice(s+c):(s+=c,47===e.charCodeAt(s)&&++s,e.slice(s))},_makeLong:function(t){return t},dirname:function(t){if(i(t),0===t.length)return".";for(var e=t.charCodeAt(0),n=47===e,r=-1,o=!0,a=t.length-1;a>=1;--a)if(47===(e=t.charCodeAt(a))){if(!o){r=a;break}}else o=!1;return-1===r?n?"/":".":n&&1===r?"//":t.slice(0,r)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');i(t);var n,r=0,o=-1,a=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,u=-1;for(n=t.length-1;n>=0;--n){var l=t.charCodeAt(n);if(47===l){if(!a){r=n+1;break}}else-1===u&&(a=!1,u=n+1),s>=0&&(l===e.charCodeAt(s)?-1==--s&&(o=n):(s=-1,o=u))}return r===o?o=u:-1===o&&(o=t.length),t.slice(r,o)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){r=n+1;break}}else-1===o&&(a=!1,o=n+1);return-1===o?"":t.slice(r,o)},extname:function(t){i(t);for(var e=-1,n=0,r=-1,o=!0,a=0,s=t.length-1;s>=0;--s){var u=t.charCodeAt(s);if(47!==u)-1===r&&(o=!1,r=s+1),46===u?-1===e?e=s:1!==a&&(a=1):-1!==e&&(a=-1);else if(!o){n=s+1;break}}return-1===e||-1===r||0===a||1===a&&e===r-1&&e===n+1?"":t.slice(e,r)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var n=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||"");return n?n===e.root?n+r:n+"/"+r:r}(0,t)},parse:function(t){i(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var n,r=t.charCodeAt(0),o=47===r;o?(e.root="/",n=1):n=0;for(var a=-1,s=0,u=-1,l=!0,c=t.length-1,h=0;c>=n;--c)if(47!==(r=t.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===r?-1===a?a=c:1!==h&&(h=1):-1!==a&&(h=-1);else if(!l){s=c+1;break}return-1===a||-1===u||0===h||1===h&&a===u-1&&a===s+1?-1!==u&&(e.base=e.name=0===s&&o?t.slice(1,u):t.slice(s,u)):(0===s&&o?(e.name=t.slice(1,a),e.base=t.slice(1,u)):(e.name=t.slice(s,a),e.base=t.slice(s,u)),e.ext=t.slice(a,u)),s>0?e.dir=t.slice(0,s-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,t.exports=a},193:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(8501),a=n(1592),s=n(8575),u=n(7673),l=n(2635),c=n(9539),h=function(t,e){if("string"!=typeof t&&!t.hasOwnProperty("url"))throw new Error("Missing url option from options for request method.");var n="object"===(void 0===t?"undefined":i(t))?s.parse(t.url):s.parse(t),c={hostname:n.hostname,port:n.port||("http:"===n.protocol.toLowerCase()?80:443),path:n.path,method:"GET",headers:{},auth:n.auth||null,parse:"none",stream:!1};if("object"===(void 0===t?"undefined":i(t))&&(c=Object.assign(c,t)),c.port=Number(c.port),c.hasOwnProperty("timeout")&&delete c.timeout,!0===c.compressed&&(c.headers["accept-encoding"]="gzip, deflate"),t.hasOwnProperty("form")){if("object"!==i(t.form))throw new Error("phin 'form' option must be of type Object if present.");var h=u.stringify(t.form);c.headers["Content-Type"]="application/x-www-form-urlencoded",c.headers["Content-Length"]=r.byteLength(h),t.data=h}var f=void 0,d=function(t){var n=t;!0===c.compressed&&("gzip"===t.headers["content-encoding"]?n=t.pipe(l.createGunzip()):"deflate"===t.headers["content-encoding"]&&(n=t.pipe(l.createInflate()))),!0===c.stream?(t.stream=n,e&&e(null,t)):(t.body=new r([]),n.on("data",(function(e){t.body=r.concat([t.body,e])})),n.on("end",(function(){if(e){if("json"===c.parse)try{t.body=JSON.parse(t.body.toString())}catch(n){return void e("Invalid JSON received.",t)}e(null,t)}})))};switch(n.protocol.toLowerCase()){case"http:":f=o.request(c,d);break;case"https:":f=a.request(c,d);break;default:return void(e&&e(new Error("Invalid / unknown URL protocol. Expected HTTP or HTTPS."),null))}if("number"==typeof t.timeout&&f.setTimeout(t.timeout,(function(){f.abort(),e&&e(new Error("Timeout has been reached."),null),e=null})),f.on("error",(function(t){e&&e(t,null)})),t.hasOwnProperty("data")){var p=t.data;if(!(t.data instanceof r)&&"object"===i(t.data))if("application/x-www-form-urlencoded"===(c.headers["content-type"]||c.headers["Content-Type"]))p=u.stringify(t.data);else try{p=JSON.stringify(t.data)}catch(t){e&&e(new Error("Couldn't stringify object. (Likely due to a circular reference.)"),null)}f.write(p)}f.end()};h.promisified=function(t,e){return new Promise((function(e,n){h(t,(function(t,r){t?n(t):e(r)}))}))},c.promisify&&(h[c.promisify.custom]=h.promisified),t.exports=h},148:t=>{"use strict";function e(t,r,i,o,a,s){for(var u,l,c,h,f=Math.max(r-1,0),d=Math.max(i-1,0),p=Math.min(r+1,o-1),g=Math.min(i+1,a-1),m=4*(i*o+r),b=0,y=0,_=0,v=0,w=0,x=f;x<=p;x++)for(var T=d;T<=g;T++)if(x!==r||T!==i){var E=n(t,t,m,4*(T*o+x),!0);if(0===E?b++:E<0?_++:E>0&&y++,b>2)return!1;s&&(Ew&&(w=E,c=x,h=T))}return!s||0!==_&&0!==y&&(!e(t,u,l,o,a)&&!e(s,u,l,o,a)||!e(t,c,h,o,a)&&!e(s,c,h,o,a))}function n(t,e,n,s,u){var l=t[n+3]/255,c=e[s+3]/255,h=a(t[n+0],l),f=a(t[n+1],l),d=a(t[n+2],l),p=a(e[s+0],c),g=a(e[s+1],c),m=a(e[s+2],c),b=r(h,f,d)-r(p,g,m);if(u)return b;var y=i(h,f,d)-i(p,g,m),_=o(h,f,d)-o(p,g,m);return.5053*b*b+.299*y*y+.1957*_*_}function r(t,e,n){return.29889531*t+.58662247*e+.11448223*n}function i(t,e,n){return.59597799*t-.2741761*e-.32180189*n}function o(t,e,n){return.21147017*t-.52261711*e+.31114694*n}function a(t,e){return 255+(t-255)*e}function s(t,e,n,r,i){t[e+0]=n,t[e+1]=r,t[e+2]=i,t[e+3]=255}t.exports=function(t,i,o,u,l,c){c||(c={});for(var h=void 0===c.threshold?.1:c.threshold,f=35215*h*h,d=0,p=0;pf)c.includeAA||!e(t,g,p,u,l,i)&&!e(i,g,p,u,l,t)?(o&&s(o,m,255,0,0),d++):o&&s(o,m,255,255,0);else if(o){var b=a((void 0,void 0,void 0,void 0,v=(y=t)[(_=m)+3]/255,r(a(y[_+0],v),a(y[_+1],v),a(y[_+2],v))),.1);s(o,m,b,b,b)}}var y,_,v;return d}},9983:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(7084),o=[function(){},function(t,e,n,r){if(r===e.length)throw new Error("Ran out of data");var i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=255},function(t,e,n,r){if(r+1>=e.length)throw new Error("Ran out of data");var i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=e[r+1]},function(t,e,n,r){if(r+2>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=255},function(t,e,n,r){if(r+3>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=e[r+3]}],a=[function(){},function(t,e,n,r){var i=e[0];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=r},function(t,e,n){var r=e[0];t[n]=r,t[n+1]=r,t[n+2]=r,t[n+3]=e[1]},function(t,e,n,r){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=r},function(t,e,n){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3]}];function s(t,e,n,r,i,a){for(var s=t.width,u=t.height,l=t.index,c=0;c>4,n.push(h,c);break;case 2:u=3&f,l=f>>2&3,c=f>>4&3,h=f>>6&3,n.push(h,c,l,u);break;case 1:i=1&f,o=f>>1&1,a=f>>2&1,s=f>>3&1,u=f>>4&1,l=f>>5&1,c=f>>6&1,h=f>>7&1,n.push(h,c,l,u,s,a,o,i)}}return{get:function(t){for(;n.length{"use strict";var r=n(8764).Buffer,i=n(3482);t.exports=function(t,e,n,o){var a,s=-1!==[i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(o.colorType);if(o.colorType===o.inputColorType){var u=(a=new ArrayBuffer(2),new DataView(a).setInt16(0,256,!0),256!==new Int16Array(a)[0]);if(8===o.bitDepth||16===o.bitDepth&&u)return t}var l=16!==o.bitDepth?t:new Uint16Array(t.buffer),c=255,h=i.COLORTYPE_TO_BPP_MAP[o.inputColorType];4!==h||o.inputHasAlpha||(h=3);var f=i.COLORTYPE_TO_BPP_MAP[o.colorType];16===o.bitDepth&&(c=65535,f*=2);var d=new r(e*n*f),p=0,g=0,m=o.bgColor||{};function b(){var t,e,n,r=c;switch(o.inputColorType){case i.COLORTYPE_COLOR_ALPHA:r=l[p+3],t=l[p],e=l[p+1],n=l[p+2];break;case i.COLORTYPE_COLOR:t=l[p],e=l[p+1],n=l[p+2];break;case i.COLORTYPE_ALPHA:r=l[p+1],e=t=l[p],n=t;break;case i.COLORTYPE_GRAYSCALE:e=t=l[p],n=t;break;default:throw new Error("input color type:"+o.inputColorType+" is not supported at present")}return o.inputHasAlpha&&(s||(r/=c,t=Math.min(Math.max(Math.round((1-r)*m.red+r*t),0),c),e=Math.min(Math.max(Math.round((1-r)*m.green+r*e),0),c),n=Math.min(Math.max(Math.round((1-r)*m.blue+r*n),0),c))),{red:t,green:e,blue:n,alpha:r}}void 0===m.red&&(m.red=c),void 0===m.green&&(m.green=c),void 0===m.blue&&(m.blue=c);for(var y=0;y{"use strict";var r=n(4155),i=n(8764).Buffer,o=n(9539),a=n(2830),s=t.exports=function(){a.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};o.inherits(s,a),s.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),r.nextTick(function(){this._process(),this._paused&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},s.prototype.write=function(t,e){return this.writable?(n=i.isBuffer(t)?t:new i(t,e||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var n},s.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},s.prototype.destroySoon=s.prototype.end,s.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()},s.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},s.prototype._processReadAllowingLess=function(t){this._reads.shift();var e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},s.prototype._processRead=function(t){this._reads.shift();for(var e=0,n=0,r=new i(t.length);e0&&this._buffers.splice(0,n),this._buffered-=t.length,t.func.call(this,r)},s.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&!this.writable&&this._end()}catch(t){this.emit("error",t)}}},3482:t=>{"use strict";t.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},3500:t=>{"use strict";var e=[];!function(){for(var t=0;t<256;t++){for(var n=t,r=0;r<8;r++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}}();var n=t.exports=function(){this._crc=-1};n.prototype.write=function(t){for(var n=0;n>>8;return!0},n.prototype.crc32=function(){return-1^this._crc},n.crc32=function(t){for(var n=-1,r=0;r>>8;return-1^n}},8876:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(6744),o={0:function(t,e,n,r,i){for(var o=0;o=o?t[e+a-o]:0,u=t[e+a]-s;r[i+a]=u}},2:function(t,e,n,r,i){for(var o=0;o0?t[e+o-n]:0,s=t[e+o]-a;r[i+o]=s}},3:function(t,e,n,r,i,o){for(var a=0;a=o?t[e+a-o]:0,u=e>0?t[e+a-n]:0,l=t[e+a]-(s+u>>1);r[i+a]=l}},4:function(t,e,n,r,o,a){for(var s=0;s=a?t[e+s-a]:0,l=e>0?t[e+s-n]:0,c=e>0&&s>=a?t[e+s-(n+a)]:0,h=t[e+s]-i(u,l,c);r[o+s]=h}}},a={0:function(t,e,n){for(var r=0,i=e+n,o=e;o=r?t[e+o-r]:0,s=t[e+o]-a;i+=Math.abs(s)}return i},2:function(t,e,n){for(var r=0,i=e+n,o=e;o0?t[o-n]:0,s=t[o]-a;r+=Math.abs(s)}return r},3:function(t,e,n,r){for(var i=0,o=0;o=r?t[e+o-r]:0,s=e>0?t[e+o-n]:0,u=t[e+o]-(a+s>>1);i+=Math.abs(u)}return i},4:function(t,e,n,r){for(var o=0,a=0;a=r?t[e+a-r]:0,u=e>0?t[e+a-n]:0,l=e>0&&a>=r?t[e+a-(n+r)]:0,c=t[e+a]-i(s,u,l);o+=Math.abs(c)}return o}};t.exports=function(t,e,n,i,s){var u;if("filterType"in i&&-1!==i.filterType){if("number"!=typeof i.filterType)throw new Error("unrecognised filter types");u=[i.filterType]}else u=[0,1,2,3,4];16===i.bitDepth&&(s*=2);for(var l=e*s,c=0,h=0,f=new r((l+1)*n),d=u[0],p=0;p1)for(var g=1/0,m=0;m{"use strict";var r=n(8764).Buffer,i=n(9539),o=n(8442),a=n(2769),s=t.exports=function(t){o.call(this);var e=[],n=this;this._filter=new a(t,{read:this.read.bind(this),write:function(t){e.push(t)},complete:function(){n.emit("complete",r.concat(e))}}),this._filter.start()};i.inherits(s,o)},8692:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(33),o=n(2769);e.process=function(t,e){var n=[],a=new i(t);return new o(e,{read:a.read.bind(a),write:function(t){n.push(t)},complete:function(){}}).start(),a.process(),r.concat(n)}},2769:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(7084),o=n(6744);function a(t,e,n){var r=t*e;return 8!==n&&(r=Math.ceil(r/(8/n))),r}var s=t.exports=function(t,e){var n=t.width,r=t.height,o=t.interlace,s=t.bpp,u=t.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],o)for(var l=i.getImagePasses(n,r),c=0;ci?e[o-r]:0;e[o]=a+s}},s.prototype._unFilterType2=function(t,e,n){for(var r=this._lastLine,i=0;ii?e[a-r]:0,c=Math.floor((l+u)/2);e[a]=s+c}},s.prototype._unFilterType4=function(t,e,n){for(var r=this._xComparison,i=r-1,a=this._lastLine,s=0;si?e[s-r]:0,h=s>i&&a?a[s-r]:0,f=o(c,l,h);e[s]=u+f}},s.prototype._reverseFilterLine=function(t){var e,n=t[0],i=this._images[this._imageIndex],o=i.byteWidth;if(0===n)e=t.slice(1,o+1);else switch(e=new r(o),n){case 1:this._unFilterType1(t,e,o);break;case 2:this._unFilterType2(t,e,o);break;case 3:this._unFilterType3(t,e,o);break;case 4:this._unFilterType4(t,e,o);break;default:throw new Error("Unrecognised filter type - "+n)}this.write(e),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=e,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}},8417:(t,e,n)=>{"use strict";var r=n(8764).Buffer;t.exports=function(t,e){var n=e.depth,i=e.width,o=e.height,a=e.colorType,s=e.transColor,u=e.palette,l=t;return 3===a?function(t,e,n,r,i){for(var o=0,a=0;a{"use strict";var n=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];e.getImagePasses=function(t,e){for(var r=[],i=t%8,o=e%8,a=(t-i)/8,s=(e-o)/8,u=0;u0&&h>0&&r.push({width:c,height:h,index:u})}return r},e.getInterlaceIterator=function(t){return function(e,r,i){var o=e%n[i].x.length,a=(e-o)/n[i].x.length*8+n[i].x[o],s=r%n[i].y.length;return 4*a+((r-s)/n[i].y.length*8+n[i].y[s])*t*4}}},6838:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(9539),o=n(2830),a=n(3482),s=n(9432),u=t.exports=function(t){o.call(this);var e=t||{};this._packer=new s(e),this._deflate=this._packer.createDeflate(),this.readable=!0};i.inherits(u,o),u.prototype.pack=function(t,e,n,i){this.emit("data",new r(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,n)),i&&this.emit("data",this._packer.packGAMA(i));var o=this._packer.filterData(t,e,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}},8360:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=!0,o=n(2635);o.deflateSync||(i=!1);var a=n(3482),s=n(9432);t.exports=function(t,e){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var n=new s(e||{}),u=[];u.push(new r(a.PNG_SIGNATURE)),u.push(n.packIHDR(t.width,t.height)),t.gamma&&u.push(n.packGAMA(t.gamma));var l=n.filterData(t.data,t.width,t.height),c=o.deflateSync(l,n.getDeflateOptions());if(l=null,!c||!c.length)throw new Error("bad png - invalid compressed data response");return u.push(n.packIDAT(c)),u.push(n.packIEND()),r.concat(u)}},9432:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(3482),o=n(3500),a=n(9027),s=n(8876),u=n(2635),l=t.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||u.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:i.COLORTYPE_COLOR_ALPHA,t.inputColorType="number"==typeof t.inputColorType?t.inputColorType:i.COLORTYPE_COLOR_ALPHA,-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(t.colorType))throw new Error("option color type:"+t.colorType+" is not supported at present");if(-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(t.inputColorType))throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(8!==t.bitDepth&&16!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};l.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},l.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},l.prototype.filterData=function(t,e,n){var r=a(t,e,n,this._options),o=i.COLORTYPE_TO_BPP_MAP[this._options.colorType];return s(r,e,n,this._options,o)},l.prototype._packChunk=function(t,e){var n=e?e.length:0,i=new r(n+12);return i.writeUInt32BE(n,0),i.writeUInt32BE(t,4),e&&e.copy(i,8),i.writeInt32BE(o.crc32(i.slice(4,i.length-4)),i.length-4),i},l.prototype.packGAMA=function(t){var e=new r(4);return e.writeUInt32BE(Math.floor(t*i.GAMMA_DIVISION),0),this._packChunk(i.TYPE_gAMA,e)},l.prototype.packIHDR=function(t,e){var n=new r(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(e,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(i.TYPE_IHDR,n)},l.prototype.packIDAT=function(t){return this._packChunk(i.TYPE_IDAT,t)},l.prototype.packIEND=function(){return this._packChunk(i.TYPE_IEND,null)}},6744:t=>{"use strict";t.exports=function(t,e,n){var r=t+e-n,i=Math.abs(r-t),o=Math.abs(r-e),a=Math.abs(r-n);return i<=o&&i<=a?t:o<=a?e:n}},7900:(t,e,n)=>{"use strict";var r=n(9539),i=n(2635),o=n(8442),a=n(4603),s=n(8550),u=n(9983),l=n(8417),c=t.exports=function(t){o.call(this),this._parser=new s(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};r.inherits(c,o),c.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},c.prototype._inflateData=function(t){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=i.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{var e=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,n=Math.max(e,i.Z_MIN_CHUNK);this._inflate=i.createInflate({chunkSize:n});var r=e,o=this.emit.bind(this,"error");this._inflate.on("error",(function(t){r&&o(t)})),this._filter.on("complete",this._complete.bind(this));var a=this._filter.write.bind(this._filter);this._inflate.on("data",(function(t){r&&(t.length>r&&(t=t.slice(0,r)),r-=t.length,a(t))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(t)},c.prototype._handleMetaData=function(t){this._metaData=t,this._bitmapInfo=Object.create(t),this._filter=new a(this._bitmapInfo)},c.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},c.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},c.prototype._simpleTransparency=function(){this._metaData.alpha=!0},c.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},c.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},c.prototype._complete=function(t){if(!this.errord){try{var e=u.dataToBitMap(t,this._bitmapInfo),n=l(e,this._bitmapInfo);e=null}catch(t){return void this._handleError(t)}this.emit("parsed",n)}}},2416:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=!0,o=n(2635),a=n(9653);o.deflateSync||(i=!1);var s=n(33),u=n(8692),l=n(8550),c=n(9983),h=n(8417);t.exports=function(t,e){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var n,f,d,p=[],g=new s(t),m=new l(e,{read:g.read.bind(g),error:function(t){n=t},metadata:function(t){f=t},gamma:function(t){d=t},palette:function(t){f.palette=t},transColor:function(t){f.transColor=t},inflateData:function(t){p.push(t)},simpleTransparency:function(){f.alpha=!0}});if(m.start(),g.process(),n)throw n;var b,y=r.concat(p);if(p.length=0,f.interlace)b=o.inflateSync(y);else{var _=(1+(f.width*f.bpp*f.depth+7>>3))*f.height;b=a(y,{chunkSize:_,maxLength:_})}if(y=null,!b||!b.length)throw new Error("bad png - invalid inflate data response");var v=u.process(b,f);y=null;var w=c.dataToBitMap(v,f);v=null;var x=h(w,f);return f.data=x,f.gamma=d||0,f}},8550:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(3482),o=n(3500),a=t.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[i.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[i.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[i.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[i.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[i.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[i.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};a.prototype.start=function(){this.read(i.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(t){for(var e=i.PNG_SIGNATURE,n=0;nthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var e=0;e0?this._handleIDAT(n):this._handleChunkEnd()},a.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},a.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}},6117:(t,e,n)=>{"use strict";var r=n(2416),i=n(8360);e.read=function(t,e){return r(t,e||{})},e.write=function(t,e){return i(t,e)}},5477:(t,e,n)=>{"use strict";var r=n(8764).Buffer,i=n(4155),o=n(9539),a=n(2830),s=n(7900),u=n(6838),l=n(6117),c=e.PNG=function(t){a.call(this),t=t||{},this.width=0|t.width,this.height=0|t.height,this.data=this.width>0&&this.height>0?new r(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new s(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new u(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};o.inherits(c,a),c.sync=l,c.prototype.pack=function(){return this.data&&this.data.length?(i.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},c.prototype.parse=function(t,e){var n,r;return e&&(n=function(t){this.removeListener("error",r),this.data=t,e(null,this)}.bind(this),r=function(t){this.removeListener("parsed",n),e(t,null)}.bind(this),this.once("parsed",n),this.once("error",r)),this.end(t),this},c.prototype.write=function(t){return this._parser.write(t),!0},c.prototype.end=function(t){this._parser.end(t)},c.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},c.prototype._gamma=function(t){this.gamma=t},c.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},c.bitblt=function(t,e,n,r,i,o,a,s){if(r|=0,i|=0,o|=0,a|=0,s|=0,(n|=0)>t.width||r>t.height||n+i>t.width||r+o>t.height)throw new Error("bitblt reading outside image");if(a>e.width||s>e.height||a+i>e.width||s+o>e.height)throw new Error("bitblt writing outside image");for(var u=0;u{"use strict";var r=n(4155),i=n(8764).Buffer,o=n(9282).ok,a=n(2635),s=n(9539),u=n(8764).kMaxLength;function l(t){if(!(this instanceof l))return new l(t);t&&t.chunkSize=0,"have should not go down"),n>0){var r=s._buffer.slice(s._offset,s._offset+n);if(s._offset+=n,r.length>f&&(r=r.slice(0,f)),p.push(r),g+=r.length,0==(f-=r.length))return!1}return(0===e||s._offset>=s._chunkSize)&&(h=s._chunkSize,s._offset=0,s._buffer=i.allocUnsafe(s._chunkSize)),0===e&&(d+=l-t,l=t,!0)}}this.on("error",(function(t){r=t})),o(this._handle,"zlib binding closed");do{var b=this._handle.writeSync(e,t,d,l,this._buffer,this._offset,h);b=b||this._writeState}while(!this._hadError&&m(b[0],b[1]));if(this._hadError)throw r;if(g>=u)throw c(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes");var y=i.concat(p,g);return c(this),y},s.inherits(l,a.Inflate),t.exports=e=h,e.Inflate=l,e.createInflate=function(t){return new l(t)},e.inflateSync=h},33:t=>{"use strict";var e=t.exports=function(t){this._buffer=t,this._reads=[]};e.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})},e.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){var t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;this._reads.shift();var e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},4155:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var s,u=[],l=!1,c=-1;function h(){l&&s&&(l=!1,s.length?u=s.concat(u):c=-1,u.length&&f())}function f(){if(!l){var t=a(h);l=!0;for(var e=u.length;e;){for(s=u,u=[];++c1)for(var n=1;n{"use strict";function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,n,r,i){n=n||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(n);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var u=t.length;s>0&&u>s&&(u=s);for(var l=0;l=0?(c=p.substr(0,g),h=p.substr(g+1)):(c=p,h=""),f=decodeURIComponent(c),d=decodeURIComponent(h),e(o,f)?Array.isArray(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o}},2182:t=>{"use strict";var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,n,r,i){return n=n||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(i){var o=encodeURIComponent(e(i))+r;return Array.isArray(t[i])?t[i].map((function(t){return o+encodeURIComponent(e(t))})).join(n):o+encodeURIComponent(e(t[i]))})).join(n):i?encodeURIComponent(e(i))+r+encodeURIComponent(e(t)):""}},7673:(t,e,n)=>{"use strict";e.decode=e.parse=n(2587),e.encode=e.stringify=n(2182)},4281:t=>{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,a,s,u;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var l=("number"!=typeof u&&(u=0),u+".".length>(s=t).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(t,'" ').concat(l," ").concat(i," ").concat(r(e,"type"))}return a+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},6753:(t,e,n)=>{"use strict";var r=n(4155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var o=n(9481),a=n(4229);n(5717)(c,o);for(var s=i(a.prototype),u=0;u{"use strict";t.exports=i;var r=n(4605);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(5717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},9481:(t,e,n)=>{"use strict";var r,i=n(4155);t.exports=S,S.ReadableState=E,n(7187).EventEmitter;var o,a=function(t,e){return t.listeners(e).length},s=n(2503),u=n(8764).Buffer,l=n.g.Uint8Array||function(){},c=n(4616);o=c&&c.debuglog?c.debuglog("stream"):function(){};var h,f,d,p=n(7327),g=n(1195),m=n(2457).getHighWaterMark,b=n(4281).q,y=b.ERR_INVALID_ARG_TYPE,_=b.ERR_STREAM_PUSH_AFTER_EOF,v=b.ERR_METHOD_NOT_IMPLEMENTED,w=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(5717)(S,s);var x=g.errorOrDestroy,T=["error","close","destroy","pause","resume"];function E(t,e,i){r=r||n(6753),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=n(2553).s),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function S(t){if(r=r||n(6753),!(this instanceof S))return new S(t);var e=this instanceof r;this._readableState=new E(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function A(t,e,n,r,i){o("readableAddChunk",e);var a,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?k(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,M(t)))}}(t,s);else if(i||(a=function(t,e){var n,r;return r=e,u.isBuffer(r)||r instanceof l||"string"==typeof e||void 0===e||t.objectMode||(n=new y("chunk",["string","Buffer","Uint8Array"],e)),n}(s,e)),a)x(t,a);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r)s.endEmitted?x(t,new w):O(t,s,e,!0);else if(s.ended)x(t,new _);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?O(t,s,e,!1):D(t,s)):O(t,s,e,!1)}else r||(s.reading=!1,D(t,s));return!s.ended&&(s.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function k(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(M,t))}function M(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,B(t)}function D(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(R,t,e))}function R(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){o("readable nexttick read 0"),t.read(0)}function N(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),B(t),e.flowing&&!e.reading&&t.read(0)}function B(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function F(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function j(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function $(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?j(this):k(this),null;if(0===(t=P(t,e))&&e.ended)return 0===e.length&&j(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?F(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&j(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(t){x(this,new v("_read()"))},S.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var s=e&&!1===e.end||t===i.stdout||t===i.stderr?g:u;function u(){o("onend"),t.end()}r.endEmitted?i.nextTick(s):n.once("end",s),t.on("unpipe",(function e(i,a){o("onunpipe"),i===n&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",l),t.removeListener("error",f),t.removeListener("unpipe",e),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",h),c=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}));var l=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,B(t))}}(n);t.on("drain",l);var c=!1;function h(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==$(r.pipes,t))&&!c&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function f(e){o("onerror",e),g(),t.removeListener("error",f),0===a(t,"error")&&x(t,e)}function d(){t.removeListener("finish",p),g()}function p(){o("onfinish"),t.removeListener("close",d),g()}function g(){o("unpipe"),n.unpipe(t)}return n.on("data",h),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",f),t.once("close",d),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?k(this):r.reading||i.nextTick(L,this))),n},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var n=s.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(C,this),n},S.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(C,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(N,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var a=0;a{"use strict";t.exports=c;var r=n(4281).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,a=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(6753);function l(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(4155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=S,S.WritableState=E;var a,s={deprecate:n(4927)},u=n(2503),l=n(8764).Buffer,c=n.g.Uint8Array||function(){},h=n(1195),f=n(2457).getHighWaterMark,d=n(4281).q,p=d.ERR_INVALID_ARG_TYPE,g=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,y=d.ERR_STREAM_DESTROYED,_=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,x=h.errorOrDestroy;function T(){}function E(t,e,a){r=r||n(6753),t=t||{},"boolean"!=typeof a&&(a=e instanceof r),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(M,t,e),t._writableState.errorEmitted=!0,x(t,r)):(o(r),t._writableState.errorEmitted=!0,x(t,r),M(t,e))}(t,n,r,e,o);else{var a=P(n)||t.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||I(t,n),r?i.nextTick(O,t,n,a,o):O(t,n,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function S(t){var e=this instanceof(r=r||n(6753));if(!e&&!a.call(S,this))return new S(t);this._writableState=new E(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),u.call(this)}function A(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function O(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),M(t,e)}function I(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),a=e.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,A(t,e,!0,e.length,i,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,h=n.callback;if(A(t,e,!1,e.objectMode?1:l.length,l,c,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function P(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function k(t,e){t._final((function(n){e.pendingcb--,n&&x(t,n),e.prefinished=!0,t.emit("prefinish"),M(t,e)}))}function M(t,e){var n=P(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(k,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(5717)(S,u),E.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(E.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!a.call(this,t)||this===S&&t&&t._writableState instanceof E}})):a=function(t){return t instanceof this},S.prototype.pipe=function(){x(this,new b)},S.prototype.write=function(t,e,n){var r,o=this._writableState,a=!1,s=!o.objectMode&&(r=t,l.isBuffer(r)||r instanceof c);return s&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=T),o.ending?function(t,e){var n=new v;x(t,n),i.nextTick(e,n)}(this,n):(s||function(t,e,n,r){var o;return null===n?o=new _:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(x(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,a=function(t,e,n,r,i,o){if(!n){var a=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,n)),e}(e,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var u=e.length-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,n){n(new g("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,M(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=h.destroy,S.prototype._undestroy=h.undestroy,S.prototype._destroy=function(t,e){e(t)}},5850:(t,e,n)=>{"use strict";var r,i=n(4155);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var a=n(8610),s=Symbol("lastResolve"),u=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),h=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function p(t,e){return{value:t,done:e}}function g(t){var e=t[s];if(null!==e){var n=t[d].read();null!==n&&(t[h]=null,t[s]=null,t[u]=null,e(p(n,!1)))}}function m(t){i.nextTick(g,t)}var b=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((o(r={get stream(){return this[d]},next:function(){var t=this,e=this[l];if(null!==e)return Promise.reject(e);if(this[c])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[l]?n(t[l]):e(p(void 0,!0))}))}));var n,r=this[h];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[c]?n(p(void 0,!0)):e[f](n,r)}),r)}}(r,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[f])}return this[h]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[d].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),b);t.exports=function(t){var e,n=Object.create(y,(o(e={},d,{value:t,writable:!0}),o(e,s,{value:null,writable:!0}),o(e,u,{value:null,writable:!0}),o(e,l,{value:null,writable:!0}),o(e,c,{value:t._readableState.endEmitted,writable:!0}),o(e,f,{value:function(t,e){var r=n[d].read();r?(n[h]=null,n[s]=null,n[u]=null,t(p(r,!1))):(n[s]=t,n[u]=e)},writable:!0}),e));return n[h]=null,a(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[h]=null,n[s]=null,n[u]=null,e(t)),void(n[l]=t)}var r=n[s];null!==r&&(n[h]=null,n[s]=null,n[u]=null,r(p(void 0,!0))),n[c]=!0})),t.on("readable",m.bind(null,n)),n}},7327:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,n,r,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,a.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e{"use strict";var r=n(4155);function i(t,e){a(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function a(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(a,this,t)):r.nextTick(a,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},8610:(t,e,n)=>{"use strict";var r=n(4281).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:(t,e,n)=>{"use strict";var r,i=n(4281).q,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===r&&(r=n(8610)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function l(t){t()}function c(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n0,(function(t){r||(r=t),t&&a.forEach(l),o||(a.forEach(l),i(r))}))}));return e.reduce(c)}},2457:(t,e,n)=>{"use strict";var r=n(4281).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},2503:(t,e,n)=>{t.exports=n(7187).EventEmitter},8473:(t,e,n)=>{(e=t.exports=n(9481)).Stream=e,e.Readable=e,e.Writable=n(4229),e.Duplex=n(6753),e.Transform=n(4605),e.PassThrough=n(2725),e.finished=n(8610),e.pipeline=n(9946)},9509:(t,e,n)=>{var r=n(8764),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},2830:(t,e,n)=>{t.exports=i;var r=n(7187).EventEmitter;function i(){r.call(this)}n(5717)(i,r),i.Readable=n(9481),i.Writable=n(4229),i.Duplex=n(6753),i.Transform=n(4605),i.PassThrough=n(2725),i.finished=n(8610),i.pipeline=n(9946),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",s),n.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(c(),0===r.listenerCount(this,"error"))throw t}function c(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",s),n.removeListener("close",u),n.removeListener("error",l),t.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),t.removeListener("close",c)}return n.on("error",l),t.on("error",l),n.on("end",c),n.on("close",c),t.on("close",c),t.emit("pipe",n),t}},8501:(t,e,n)=>{var r=n(1989),i=n(5676),o=n(7529),a=n(584),s=n(8575),u=e;u.request=function(t,e){t="string"==typeof t?s.parse(t):o(t);var i=-1===n.g.location.protocol.search(/^https?:$/)?"http:":"",a=t.protocol||i,u=t.hostname||t.host,l=t.port,c=t.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),t.url=(u?a+"//"+u:"")+(l?":"+l:"")+c,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var h=new r(t);return e&&h.on("response",e),h},u.get=function(t,e){var n=u.request(t,e);return n.end(),n},u.ClientRequest=r,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=a,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]},8725:(t,e,n)=>{var r;function i(){if(void 0!==r)return r;if(n.g.XMLHttpRequest){r=new n.g.XMLHttpRequest;try{r.open("GET",n.g.XDomainRequest?"/":"https://example.com")}catch(t){r=null}}else r=null;return r}function o(t){var e=i();if(!e)return!1;try{return e.responseType=t,e.responseType===t}catch(t){}return!1}function a(t){return"function"==typeof t}e.fetch=a(n.g.fetch)&&a(n.g.ReadableStream),e.writableStream=a(n.g.WritableStream),e.abortController=a(n.g.AbortController),e.arraybuffer=e.fetch||o("arraybuffer"),e.msstream=!e.fetch&&o("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&o("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||!!i()&&a(i().overrideMimeType),r=null},1989:(t,e,n)=>{var r=n(8764).Buffer,i=n(4155),o=n(8725),a=n(5717),s=n(5676),u=n(8473),l=s.IncomingMessage,c=s.readyStates,h=t.exports=function(t){var e,n=this;u.Writable.call(n),n._opts=t,n._body=[],n._headers={},t.auth&&n.setHeader("Authorization","Basic "+r.from(t.auth).toString("base64")),Object.keys(t.headers).forEach((function(e){n.setHeader(e,t.headers[e])}));var i=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!o.abortController)i=!1,e=!0;else if("prefer-streaming"===t.mode)e=!1;else if("allow-wrong-content-type"===t.mode)e=!o.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");e=!0}n._mode=function(t,e){return o.fetch&&e?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&t?"arraybuffer":"text"}(e,i),n._fetchTimer=null,n._socketTimeout=null,n._socketTimer=null,n.on("finish",(function(){n._onFinish()}))};a(h,u.Writable),h.prototype.setHeader=function(t,e){var n=t.toLowerCase();-1===f.indexOf(n)&&(this._headers[n]={name:t,value:e})},h.prototype.getHeader=function(t){var e=this._headers[t.toLowerCase()];return e?e.value:null},h.prototype.removeHeader=function(t){delete this._headers[t.toLowerCase()]},h.prototype._onFinish=function(){var t=this;if(!t._destroyed){var e=t._opts;"timeout"in e&&0!==e.timeout&&t.setTimeout(e.timeout);var r=t._headers,a=null;"GET"!==e.method&&"HEAD"!==e.method&&(a=new Blob(t._body,{type:(r["content-type"]||{}).value||""}));var s=[];if(Object.keys(r).forEach((function(t){var e=r[t].name,n=r[t].value;Array.isArray(n)?n.forEach((function(t){s.push([e,t])})):s.push([e,n])})),"fetch"===t._mode){var u=null;if(o.abortController){var l=new AbortController;u=l.signal,t._fetchAbortController=l,"requestTimeout"in e&&0!==e.requestTimeout&&(t._fetchTimer=n.g.setTimeout((function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()}),e.requestTimeout))}n.g.fetch(t._opts.url,{method:t._opts.method,headers:s,body:a||void 0,mode:"cors",credentials:e.withCredentials?"include":"same-origin",signal:u}).then((function(e){t._fetchResponse=e,t._resetTimers(!1),t._connect()}),(function(e){t._resetTimers(!0),t._destroyed||t.emit("error",e)}))}else{var h=t._xhr=new n.g.XMLHttpRequest;try{h.open(t._opts.method,t._opts.url,!0)}catch(e){return void i.nextTick((function(){t.emit("error",e)}))}"responseType"in h&&(h.responseType=t._mode),"withCredentials"in h&&(h.withCredentials=!!e.withCredentials),"text"===t._mode&&"overrideMimeType"in h&&h.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in e&&(h.timeout=e.requestTimeout,h.ontimeout=function(){t.emit("requestTimeout")}),s.forEach((function(t){h.setRequestHeader(t[0],t[1])})),t._response=null,h.onreadystatechange=function(){switch(h.readyState){case c.LOADING:case c.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(h.onprogress=function(){t._onXHRProgress()}),h.onerror=function(){t._destroyed||(t._resetTimers(!0),t.emit("error",new Error("XHR error")))};try{h.send(a)}catch(e){return void i.nextTick((function(){t.emit("error",e)}))}}}},h.prototype._onXHRProgress=function(){var t=this;t._resetTimers(!1),function(t){try{var e=t.status;return null!==e&&0!==e}catch(t){return!1}}(t._xhr)&&!t._destroyed&&(t._response||t._connect(),t._response._onXHRProgress(t._resetTimers.bind(t)))},h.prototype._connect=function(){var t=this;t._destroyed||(t._response=new l(t._xhr,t._fetchResponse,t._mode,t._resetTimers.bind(t)),t._response.on("error",(function(e){t.emit("error",e)})),t.emit("response",t._response))},h.prototype._write=function(t,e,n){this._body.push(t),n()},h.prototype._resetTimers=function(t){var e=this;n.g.clearTimeout(e._socketTimer),e._socketTimer=null,t?(n.g.clearTimeout(e._fetchTimer),e._fetchTimer=null):e._socketTimeout&&(e._socketTimer=n.g.setTimeout((function(){e.emit("timeout")}),e._socketTimeout))},h.prototype.abort=h.prototype.destroy=function(t){var e=this;e._destroyed=!0,e._resetTimers(!0),e._response&&(e._response._destroyed=!0),e._xhr?e._xhr.abort():e._fetchAbortController&&e._fetchAbortController.abort(),t&&e.emit("error",t)},h.prototype.end=function(t,e,n){"function"==typeof t&&(n=t,t=void 0),u.Writable.prototype.end.call(this,t,e,n)},h.prototype.setTimeout=function(t,e){var n=this;e&&n.once("timeout",e),n._socketTimeout=t,n._resetTimers(!1)},h.prototype.flushHeaders=function(){},h.prototype.setNoDelay=function(){},h.prototype.setSocketKeepAlive=function(){};var f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]},5676:(t,e,n)=>{var r=n(4155),i=n(8764).Buffer,o=n(8725),a=n(5717),s=n(8473),u=e.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=e.IncomingMessage=function(t,e,n,a){var u=this;if(s.Readable.call(u),u._mode=n,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",(function(){r.nextTick((function(){u.emit("close")}))})),"fetch"===n){if(u._fetchResponse=e,u.url=e.url,u.statusCode=e.status,u.statusMessage=e.statusText,e.headers.forEach((function(t,e){u.headers[e.toLowerCase()]=t,u.rawHeaders.push(e,t)})),o.writableStream){var l=new WritableStream({write:function(t){return a(!1),new Promise((function(e,n){u._destroyed?n():u.push(i.from(t))?e():u._resumeFetch=e}))},close:function(){a(!0),u._destroyed||u.push(null)},abort:function(t){a(!0),u._destroyed||u.emit("error",t)}});try{return void e.body.pipeTo(l).catch((function(t){a(!0),u._destroyed||u.emit("error",t)}))}catch(t){}}var c=e.body.getReader();!function t(){c.read().then((function(e){u._destroyed||(a(e.done),e.done?u.push(null):(u.push(i.from(e.value)),t()))})).catch((function(t){a(!0),u._destroyed||u.emit("error",t)}))}()}else if(u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText,t.getAllResponseHeaders().split(/\r?\n/).forEach((function(t){var e=t.match(/^([^:]+):\s*(.*)/);if(e){var n=e[1].toLowerCase();"set-cookie"===n?(void 0===u.headers[n]&&(u.headers[n]=[]),u.headers[n].push(e[2])):void 0!==u.headers[n]?u.headers[n]+=", "+e[2]:u.headers[n]=e[2],u.rawHeaders.push(e[1],e[2])}})),u._charset="x-user-defined",!o.overrideMimeType){var h=u.rawHeaders["mime-type"];if(h){var f=h.match(/;\s*charset=([^;])(;|$)/);f&&(u._charset=f[1].toLowerCase())}u._charset||(u._charset="utf-8")}};a(l,s.Readable),l.prototype._read=function(){var t=this._resumeFetch;t&&(this._resumeFetch=null,t())},l.prototype._onXHRProgress=function(t){var e=this,r=e._xhr,o=null;switch(e._mode){case"text":if((o=r.responseText).length>e._pos){var a=o.substr(e._pos);if("x-user-defined"===e._charset){for(var s=i.alloc(a.length),l=0;le._pos&&(e.push(i.from(new Uint8Array(c.result.slice(e._pos)))),e._pos=c.result.byteLength)},c.onload=function(){t(!0),e.push(null)},c.readAsArrayBuffer(o)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&(t(!0),e.push(null))}},2553:(t,e,n)=>{"use strict";var r=n(9509).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=l,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=c,this.end=h,e=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function c(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},7011:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.clone=a,e.addLast=u,e.addFirst=l,e.removeLast=c,e.removeFirst=h,e.insert=f,e.removeAt=d,e.replaceAt=p,e.getIn=g,e.set=m,e.setIn=b,e.update=_,e.updateIn=v,e.merge=w,e.mergeDeep=x,e.mergeIn=T,e.omit=E,e.addDefaults=S,e.default=void 0;const n="INVALID_ARGS";function r(t){throw new Error(t)}function i(t){const e=Object.keys(t);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e}const o={}.hasOwnProperty;function a(t){if(Array.isArray(t))return t.slice();const e=t,n=i(e),r={};for(let t=0;t=t.length||e<0?t:t.slice(0,e).concat(t.slice(e+1))}function p(t,e,n){if(t[e]===n)return t;const r=t.length,i=Array(r);for(let e=0;e=0||(a[r]=t[r])}return a}function S(t,e,n,r,i,o,...a){return a.length?A.call(null,!0,!1,t,e,n,r,i,o,...a):A(!0,!1,t,e,n,r,i,o)}function A(t,e,o,...u){let l=o;null==l&&r(n);let c=!1;for(let n=0;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,p=String.fromCharCode;function g(t){throw RangeError(f[t])}function m(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function b(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+m((t=t.replace(h,".")).split("."),e).join(".")}function y(t){for(var e,n,r=[],i=0,o=t.length;i=55296&&e<=56319&&i65535&&(e+=p((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+p(t)})).join("")}function v(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,n){var r=0;for(t=n?d(t/700):t>>1,t+=d(t/e);t>455;r+=u)t=d(t/35);return d(r+36*t/(t+38))}function x(t){var e,n,r,i,o,a,l,c,h,f,p,m=[],b=t.length,y=0,v=128,x=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&g("not-basic"),m.push(t.charCodeAt(r));for(i=n>0?n+1:0;i=b&&g("invalid-input"),((c=(p=t.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:u)>=u||c>d((s-y)/a))&&g("overflow"),y+=c*a,!(c<(h=l<=x?1:l>=x+26?26:l-x));l+=u)a>d(s/(f=u-h))&&g("overflow"),a*=f;x=w(y-o,e=m.length+1,0==o),d(y/e)>s-v&&g("overflow"),v+=d(y/e),y%=e,m.splice(y++,0,v)}return _(m)}function T(t){var e,n,r,i,o,a,l,c,h,f,m,b,_,x,T,E=[];for(b=(t=y(t)).length,e=128,n=0,o=72,a=0;a=e&&md((s-n)/(_=r+1))&&g("overflow"),n+=(l-e)*_,e=l,a=0;as&&g("overflow"),m==e){for(c=n,h=u;!(c<(f=h<=o?1:h>=o+26?26:h-o));h+=u)T=c-f,x=u-f,E.push(p(v(f+T%x,0))),c=d(T/x);E.push(p(v(c,0))),o=w(n,_,r==i),n=0,++r}++n,++e}return E.join("")}a={version:"1.3.2",ucs2:{decode:y,encode:_},decode:x,encode:T,toASCII:function(t){return b(t,(function(t){return c.test(t)?"xn--"+T(t):t}))},toUnicode:function(t){return b(t,(function(t){return l.test(t)?x(t.slice(4).toLowerCase()):t}))}},void 0===(r=function(){return a}.call(e,n,e,t))||(t.exports=r)}()},8575:(t,e,n)=>{"use strict";var r=n(2511),i=n(2502);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=_,e.resolve=function(t,e){return _(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?_(t,!1,!0).resolveObject(e):e},e.format=function(t){return i.isString(t)&&(t=_(t)),t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(l),h=["%","/","?",";","#"].concat(c),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(7673);function _(t,e,n){if(t&&i.isObject(t)&&t instanceof o)return t;var r=new o;return r.parse(t,e,n),r}o.prototype.parse=function(t,e,n){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o127?R+="x":R+=D[C];if(!R.match(d)){var N=k.slice(0,O),B=k.slice(O+1),F=D.match(p);F&&(N.push(F[1]),B.unshift(F[2])),B.length&&(_="/"+B.join(".")+_),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),P||(this.hostname=r.toASCII(this.hostname));var j=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+j,this.href+=this.host,P&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!g[x])for(O=0,M=c.length;O0)&&n.host.split("@"))&&(n.auth=P.shift(),n.host=n.hostname=P.shift())),n.search=t.search,n.query=t.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!T.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=T.slice(-1)[0],A=(n.host||t.host||T.length>1)&&("."===S||".."===S)||""===S,O=0,I=T.length;I>=0;I--)"."===(S=T[I])?T.splice(I,1):".."===S?(T.splice(I,1),O++):O&&(T.splice(I,1),O--);if(!w&&!x)for(;O--;O)T.unshift("..");!w||""===T[0]||T[0]&&"/"===T[0].charAt(0)||T.unshift(""),A&&"/"!==T.join("/").substr(-1)&&T.push("");var P,k=""===T[0]||T[0]&&"/"===T[0].charAt(0);return E&&(n.hostname=n.host=k?"":T.length?T.shift():"",(P=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=P.shift(),n.host=n.hostname=P.shift())),(w=w||n.host&&T.length)&&!k&&T.unshift(""),T.length?n.pathname=T.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},2502:t=>{"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},6173:(t,e,n)=>{var r=n(4155);!function(){var e={};function i(){void 0===r&&console.log.apply(console,arguments)}t.exports=e,function(t,e){var n,r,o;n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){function t(t){this.message="JPEG error: "+t}return t.prototype=Error(),t.prototype.name="JpegError",t.constructor=t}(),o=function(){function t(t,e){this.message=t,this.g=e}return t.prototype=Error(),t.prototype.name="DNLMarkerError",t.constructor=t}(),function(){function e(){this.M=null,this.B=-1}function i(t,e){for(var n,r,i=0,o=[],a=16;0>C&1;if(255===(R=t[e++])){var n=t[e++];if(n){if(220===n&&k){e+=2;var a=t[e++]<<8|t[e++];if(0>>7}function g(t){for(;;){if("number"==typeof(t=t[p()]))return t;if("object"!==(void 0===t?"undefined":n(t)))throw new r("invalid huffman sequence")}}function m(t){for(var e=0;0=1<n;){var r=g(t.o),i=15&r;if(r>>=4,0===i){if(15>r)break;n+=16}else n+=r,t.a[e+l[n]]=b(i),n++}}function _(t,e){var n=g(t.D);n=0===n?0:b(n)<>=4,0===i){if(15>r){L=m(r)+(1<t.a[n]?-1:1;switch(N){case 0:if(n=15&(o=g(t.o)),o>>=4,0===n)15>o?(L=m(o)+(1<=z)throw new r("marker was not found");if(!(65488<=z&&65495>=z))break;e+=2}return(z=u(t,e))&&z.f&&((0,_util.warn)("decodeScan - unexpected Scan data, current marker is: "+z.f),e=z.offset),e-D}function s(t,e){for(var n=e.c,i=e.l,o=new Int16Array(64),a=0;af;f+=8){var d=h[u+f],p=h[u+f+1],g=h[u+f+2],m=h[u+f+3],b=h[u+f+4],y=h[u+f+5],_=h[u+f+6],v=h[u+f+7];if(d*=c[f],0==(p|g|m|b|y|_|v))d=5793*d+512>>10,l[f]=d,l[f+1]=d,l[f+2]=d,l[f+3]=d,l[f+4]=d,l[f+5]=d,l[f+6]=d,l[f+7]=d;else{p*=c[f+1],g*=c[f+2],m*=c[f+3],b*=c[f+4],y*=c[f+5];var w=5793*d+128>>8,x=5793*b+128>>8,T=g,E=_*=c[f+6];x=(w=w+x+1>>1)-x,d=3784*T+1567*E+128>>8,T=1567*T-3784*E+128>>8,y=(b=(b=2896*(p-(v*=c[f+7]))+128>>8)+(y<<=4)+1>>1)-y,m=(v=(v=2896*(p+v)+128>>8)+(m<<=4)+1>>1)-m,E=(w=w+(E=d)+1>>1)-E,T=(x=x+T+1>>1)-T,d=2276*b+3406*v+2048>>12,b=3406*b-2276*v+2048>>12,v=d,d=799*m+4017*y+2048>>12,m=4017*m-799*y+2048>>12,y=d,l[f]=w+v,l[f+7]=w-v,l[f+1]=x+y,l[f+6]=x-y,l[f+2]=T+m,l[f+5]=T-m,l[f+3]=E+b,l[f+4]=E-b}}for(c=0;8>c;++c)d=l[c],0==((p=l[c+8])|(g=l[c+16])|(m=l[c+24])|(b=l[c+32])|(y=l[c+40])|(_=l[c+48])|(v=l[c+56]))?(d=-2040>(d=5793*d+8192>>14)?0:2024<=d?255:d+2056>>4,h[u+c]=d,h[u+c+8]=d,h[u+c+16]=d,h[u+c+24]=d,h[u+c+32]=d,h[u+c+40]=d,h[u+c+48]=d,h[u+c+56]=d):(w=5793*d+2048>>12,x=5793*b+2048>>12,d=3784*(T=g)+1567*(E=_)+2048>>12,T=1567*T-3784*E+2048>>12,E=d,y=(b=(b=2896*(p-v)+2048>>12)+y+1>>1)-y,m=(v=(v=2896*(p+v)+2048>>12)+m+1>>1)-m,d=2276*b+3406*v+2048>>12,b=3406*b-2276*v+2048>>12,v=d,d=799*m+4017*y+2048>>12,m=4017*m-799*y+2048>>12,p=(x=(x=(w=4112+(w+x+1>>1))-x)+T+1>>1)+(y=d),_=x-y,y=(T=x-T)-m,d=16>(d=(w=w+E+1>>1)+v)?0:4080<=d?255:d>>4,p=16>p?0:4080<=p?255:p>>4,g=16>(g=T+m)?0:4080<=g?255:g>>4,m=16>(m=(E=w-E)+b)?0:4080<=m?255:m>>4,b=16>(b=E-b)?0:4080<=b?255:b>>4,y=16>y?0:4080<=y?255:y>>4,_=16>_?0:4080<=_?255:_>>4,v=16>(v=w-v)?0:4080<=v?255:v>>4,h[u+c]=d,h[u+c+8]=p,h[u+c+16]=g,h[u+c+24]=m,h[u+c+32]=b,h[u+c+40]=y,h[u+c+48]=_,h[u+c+56]=v)}return e.a}function u(t,e){var n=2=r)return null;var i=t[e]<<8|t[e+1];if(65472<=i&&65534>=i)return{f:null,F:i,offset:e};for(var o=t[n]<<8|t[n+1];!(65472<=o&&65534>=o);){if(++n>=r)return null;o=t[n]<<8|t[n+1]}return{f:i.toString(16),F:o,offset:n}}var l=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);e.prototype={parse:function(t){function e(){var e=t[d]<<8|t[d+1];return d+=2,e}function n(){var n=e(),r=u(t,n=d+n-2,d);return r&&r.f&&((0,_util.warn)("readDataBlock - incorrect length, current marker is: "+r.f),n=r.offset),n=t.subarray(d,n),d+=n.length,n}function c(t){for(var e=Math.ceil(t.v/8/t.s),n=Math.ceil(t.g/8/t.u),r=0;r>4)for(_=0;64>_;_++)x[v=l[_]]=t[d++];else{if(1!=w>>4)throw new r("DQT - invalid table spec");for(_=0;64>_;_++)x[v=l[_]]=e()}h[15&w]=x}break;case 65472:case 65473:case 65474:if(T)throw new r("Only single frame JPEGs supported");e();var T={};for(T.X=65473===y,T.S=65474===y,T.precision=t[d++],y=e(),T.g=f||y,T.v=e(),T.b=[],T.C={},_=t[d++],y=x=w=0;y<_;y++){v=t[d];var E=t[d+1]>>4,S=15&t[d+1];w_;_++,d++)E+=x[_]=t[d];for(S=new Uint8Array(E),_=0;_>4?b:m)[15&w]=i(x,S)}break;case 65501:e();var A=e();break;case 65498:for(_=1==++g&&!f,e(),w=t[d++],v=[],y=0;y>4],O.o=m[15&x],v.push(O)}y=t[d++],w=t[d++],x=t[d++];try{var I=a(t,d,T,v,A,y,w,x>>4,15&x,_);d+=I}catch(e){if(e instanceof o)return(0,_util.warn)('Attempting to re-parse JPEG image using "scanLines" parameter found in DNL marker (0xFFDC) segment.'),this.parse(t,{N:e.g});throw e}break;case 65500:d+=4;break;case 65535:255!==t[d]&&d--;break;default:if(255===t[d-3]&&192<=t[d-2]&&254>=t[d-2])d-=3;else{if(!(_=u(t,d-2))||!_.f)throw new r("unknown marker "+y.toString(16));(0,_util.warn)("JpegImage.parse - unexpected data, current marker is: "+_.f),d=_.offset}}y=e()}for(this.width=T.v,this.height=T.g,this.A=p,this.b=[],y=0;y>8)+o[i+1];return u},w:function(){return this.A?!!this.A.W:3===this.i?0!==this.B:1===this.B},I:function(t){for(var e,n,r,i=0,o=t.length;i>>3)]),null==d&&(d=s.t325);var p=new Uint8Array(s.height*(h>>>3)),g=0;if(null!=s.t322){for(var m=s.t322[0],b=s.t323[0],y=Math.floor((s.width+m-1)/m),_=Math.floor((s.height+b-1)/b),v=new Uint8Array(0|Math.ceil(m*b*c/8)),w=0;w<_;w++)for(var x=0;x>>8;else{if(12!=p)throw new Error("unsupported bit depth "+p);for(h=0;h>>4,o[a++]=255&(g[h]<<4|g[h+1]>>>8),o[a++]=255&g[h+1]}}else{var b=new t.JpegDecoder;b.parse(l);var y=b.getData(b.width,b.height);for(h=0;h1),!d){if(255==e[n]&&e[n+1]==c)return{jpegOffset:n};if(null!=p&&(255==e[n+g]&&e[n+g+1]==c?h=n+g:i("JPEGInterchangeFormat does not point to SOI"),null==m?i("JPEGInterchangeFormatLength field is missing"):(g>=f||g+b<=f)&&i("JPEGInterchangeFormatLength field value is invalid"),null!=h))return{jpegOffset:h}}if(null!=_&&(v=_[0],w=_[1]),null!=p&&null!=m)if(b>=2&&g+b<=f){for(o=255==e[n+g+b-2]&&e[n+g+b-1]==c?new Uint8Array(b-2):new Uint8Array(b),s=0;s offset to first strip or tile");if(null==o){var E=0,S=[];S[E++]=255,S[E++]=c;var A=t.t519;if(null==A)throw new Error("JPEGQTables tag is missing");for(s=0;s>>8,S[E++]=255&I,S[E++]=s|l<<4,u=0;u<16;u++)S[E++]=e[n+O[s]+u];for(u=0;u>>8&255,S[E++]=255&t.height,S[E++]=t.width>>>8&255,S[E++]=255&t.width,S[E++]=x,1==x)S[E++]=1,S[E++]=17,S[E++]=0;else for(s=0;s<3;s++)S[E++]=s+1,S[E++]=0!=s?17:(15&v)<<4|15&w,S[E++]=s;null!=T&&0!=T[0]&&(S[E++]=255,S[E++]=221,S[E++]=0,S[E++]=4,S[E++]=T[0]>>>8&255,S[E++]=255&T[0]),o=new Uint8Array(S)}var P=-1;for(s=0;s>>8&255,o[M++]=255&t.height,o[M++]=t.width>>>8&255,o[M++]=255&t.width,o[M++]=x,1==x)o[M++]=1,o[M++]=17,o[M++]=0;else for(s=0;s<3;s++)o[M++]=s+1,o[M++]=0!=s?17:(15&v)<<4|15&w,o[M++]=s}if(255==e[f]&&218==e[f+1]){var D=e[f+2]<<8|e[f+3];for((a=new Uint8Array(D+2))[0]=e[f],a[1]=e[f+1],a[2]=e[f+2],a[3]=e[f+3],s=0;s>>8&255,l[c.sofPosition+6]=255&e.height,l[c.sofPosition+7]=e.width>>>8&255,l[c.sofPosition+8]=255&e.width,255==n[r]&&n[r+1]==SOS||(l.set(c.sosMarker,bufoff),bufoff+=sosMarker.length),d=0;d=0&&u<128)for(var l=0;l=-127&&u<0){for(l=0;l<1-u;l++)a[i]=o[e],i++;e++}}},t.decode._decodeThunder=function(t,e,n,r,i){for(var o=[0,1,0,-1],a=[0,1,2,3,0,-3,-2,-1],s=e+n,u=2*i,l=0;e>>6,f=63&c;if(e++,3==h&&(l=15&f,r[u>>>1]|=l<<4*(1-u&1),u++),0==h)for(var d=0;d>>1]|=l<<4*(1-u&1),u++;if(2==h)for(d=0;d<2;d++)4!=(p=f>>>3*(1-d)&7)&&(l+=a[p],r[u>>>1]|=l<<4*(1-u&1),u++);if(1==h)for(d=0;d<3;d++){var p;2!=(p=f>>>2*(2-d)&3)&&(l+=o[p],r[u>>>1]|=l<<4*(1-u&1),u++)}}},t.decode._dmap={1:0,"011":1,"000011":2,"0000011":3,"010":-1,"000010":-2,"0000010":-3},t.decode._lens=function(){var t=function(t,e,n,r){for(var i=0;i>>3>>3]>>>7-(7&l)&1),2==s&&(E=e[l>>>3]>>>(7&l)&1),l++,h+=E,"H"==w){if(null!=u._lens[_][h]){var S=u._lens[_][h];h="",c+=S,S<64&&(u._addNtimes(f,c,_),g+=c,_=1-_,c=0,0==--x&&(w=""))}}else"0001"==h&&(h="",u._addNtimes(f,y-g,_),g=y),"001"==h&&(h="",w="H",x=2),null!=u._dmap[h]&&(m=b+u._dmap[h],u._addNtimes(f,m-g,_),g=m,h="",_=1-_);f.length==a&&""==w&&(u._writeBits(f,i,8*o+v*T),_=0,v++,g=0,d=u._makeDiff(f),f=[])}},t.decode._findDiff=function(t,e,n){for(var r=0;r=e&&t[r+1]==n)return t[r]},t.decode._makeDiff=function(t){var e=[];1==t[0]&&e.push(0,1);for(var n=1;n>>3>>3]>>>7-(7&l)&1),2==s&&(S=e[l>>>3]>>>(7&l)&1),l++,h+=S,T){if(null!=u._lens[_][h]){var A=u._lens[_][h];h="",c+=A,A<64&&(u._addNtimes(f,c,_),_=1-_,c=0)}}else"H"==w?null!=u._lens[_][h]&&(A=u._lens[_][h],h="",c+=A,A<64&&(u._addNtimes(f,c,_),g+=c,_=1-_,c=0,0==--x&&(w=""))):("0001"==h&&(h="",u._addNtimes(f,y-g,_),g=y),"001"==h&&(h="",w="H",x=2),null!=u._dmap[h]&&(m=b+u._dmap[h],u._addNtimes(f,m-g,_),g=m,h="",_=1-_));h.endsWith("000000000001")&&(v>=0&&u._writeBits(f,i,8*o+v*E),1==s&&(T=1==(e[l>>>3]>>>7-(7&l)&1)),2==s&&(T=1==(e[l>>>3]>>>(7&l)&1)),l++,null==u._decodeG3.allow2D&&(u._decodeG3.allow2D=T),u._decodeG3.allow2D||(T=!0,l--),h="",_=0,v++,g=0,d=u._makeDiff(f),f=[])}f.length==a&&u._writeBits(f,i,8*o+v*E)},t.decode._addNtimes=function(t,e,n){for(var r=0;r>>3]|=t[r]<<7-(n+r&7)},t.decode._decodeLZW=function(e,n,r,i){if(null==t.decode._lzwTab){for(var o=new Uint32Array(65535),a=new Uint16Array(65535),s=new Uint8Array(2e6),u=0;u<256;u++)s[u<<2]=u,o[u]=u<<2,a[u]=1;t.decode._lzwTab=[o,a,s]}for(var l=t.decode._copyData,c=t.decode._lzwTab[0],h=t.decode._lzwTab[1],f=(s=t.decode._lzwTab[2],258),d=1032,p=9,g=n<<3,m=0,b=0;m=(e[g>>>3]<<16|e[g+8>>>3]<<8|e[g+16>>>3])>>24-(7&g)-p&(1<>>3]<<16|e[g+8>>>3]<<8|e[g+16>>>3])>>24-(7&g)-p&(1<=f?(c[f]=d,s[c[f]]=y[0],h[f]=1,d=d+1+3&-4,f++):(c[f]=d,l(s,c[b],s,d,v=h[b]),s[d+v]=s[y],v++,h[f]=v,f++,d=d+v+3&-4),f+1==1<=f?(c[f]=d,h[f]=0,f++):(c[f]=d,l(s,c[b],s,d,v=h[b]),s[d+v]=s[d],v++,h[f]=v,f++,l(s,d,r,i,v),i+=v,d=d+v+3&-4),f+1==1<4&&(e.writeUint(n,r,a),p=a),2==c&&e.writeASCII(n,p,h),3==c)for(var g=0;g4&&(a+=d+=1&d),r+=4}return[r,a]},t.toRGBA8=function(t){var e=t.width,n=t.height,r=e*n,o=4*r,a=t.data,s=new Uint8Array(4*r),u=t.t262[0],l=t.t258?Math.min(32,t.t258[0]):1,c=t.isLE?1:0;if(0==u)for(var h=Math.ceil(l*e/8),f=0;f>3)]>>7-(7&g)&1;s[m]=s[m+1]=s[m+2]=255*(1-b),s[m+3]=255}if(4==l)for(g=0;g>1)]>>4-4*(1&g)&15,s[m]=s[m+1]=s[m+2]=17*(15-b),s[m+3]=255;if(8==l)for(g=0;g>3)]>>7-(7&g)&1,s[m]=s[m+1]=s[m+2]=255*b,s[m+3]=255;if(2==l)for(g=0;g>2)]>>6-2*(3&g)&3,s[m]=s[m+1]=s[m+2]=85*b,s[m+3]=255;if(8==l)for(g=0;g0)for(g=0;g>8,s[m+1]=_[256+v]>>8,s[m+2]=_[512+v]>>8,s[m+3]=255}}else if(5==u){var w,x=(w=t.t258?t.t258.length:4)>4?1:0;for(g=0;g>8&255,t[e+1]=255&n},writeUint:function(t,e,n){t[e]=n>>24&255,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=n>>0&255},writeASCII:function(t,e,n){for(var r=0;r{function r(t){try{if(!n.g.localStorage)return!1}catch(t){return!1}var e=n.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}},384:t=>{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},5955:(t,e,n)=>{"use strict";var r=n(2584),i=n(8662),o=n(6430),a=n(5692);function s(t){return t.call.bind(t)}var u="undefined"!=typeof BigInt,l="undefined"!=typeof Symbol,c=s(Object.prototype.toString),h=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),d=s(Boolean.prototype.valueOf);if(u)var p=s(BigInt.prototype.valueOf);if(l)var g=s(Symbol.prototype.valueOf);function m(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function b(t){return"[object Map]"===c(t)}function y(t){return"[object Set]"===c(t)}function _(t){return"[object WeakMap]"===c(t)}function v(t){return"[object WeakSet]"===c(t)}function w(t){return"[object ArrayBuffer]"===c(t)}function x(t){return"undefined"!=typeof ArrayBuffer&&(w.working?w(t):t instanceof ArrayBuffer)}function T(t){return"[object DataView]"===c(t)}function E(t){return"undefined"!=typeof DataView&&(T.working?T(t):t instanceof DataView)}e.isArgumentsObject=r,e.isGeneratorFunction=i,e.isTypedArray=a,e.isPromise=function(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch},e.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):a(t)||E(t)},e.isUint8Array=function(t){return"Uint8Array"===o(t)},e.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===o(t)},e.isUint16Array=function(t){return"Uint16Array"===o(t)},e.isUint32Array=function(t){return"Uint32Array"===o(t)},e.isInt8Array=function(t){return"Int8Array"===o(t)},e.isInt16Array=function(t){return"Int16Array"===o(t)},e.isInt32Array=function(t){return"Int32Array"===o(t)},e.isFloat32Array=function(t){return"Float32Array"===o(t)},e.isFloat64Array=function(t){return"Float64Array"===o(t)},e.isBigInt64Array=function(t){return"BigInt64Array"===o(t)},e.isBigUint64Array=function(t){return"BigUint64Array"===o(t)},b.working="undefined"!=typeof Map&&b(new Map),e.isMap=function(t){return"undefined"!=typeof Map&&(b.working?b(t):t instanceof Map)},y.working="undefined"!=typeof Set&&y(new Set),e.isSet=function(t){return"undefined"!=typeof Set&&(y.working?y(t):t instanceof Set)},_.working="undefined"!=typeof WeakMap&&_(new WeakMap),e.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(_.working?_(t):t instanceof WeakMap)},v.working="undefined"!=typeof WeakSet&&v(new WeakSet),e.isWeakSet=function(t){return v(t)},w.working="undefined"!=typeof ArrayBuffer&&w(new ArrayBuffer),e.isArrayBuffer=x,T.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&T(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=E;var S="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function A(t){return"[object SharedArrayBuffer]"===c(t)}function O(t){return void 0!==S&&(void 0===A.working&&(A.working=A(new S)),A.working?A(t):t instanceof S)}function I(t){return m(t,h)}function P(t){return m(t,f)}function k(t){return m(t,d)}function M(t){return u&&m(t,p)}function D(t){return l&&m(t,g)}e.isSharedArrayBuffer=O,e.isAsyncFunction=function(t){return"[object AsyncFunction]"===c(t)},e.isMapIterator=function(t){return"[object Map Iterator]"===c(t)},e.isSetIterator=function(t){return"[object Set Iterator]"===c(t)},e.isGeneratorObject=function(t){return"[object Generator]"===c(t)},e.isWebAssemblyCompiledModule=function(t){return"[object WebAssembly.Module]"===c(t)},e.isNumberObject=I,e.isStringObject=P,e.isBooleanObject=k,e.isBigIntObject=M,e.isSymbolObject=D,e.isBoxedPrimitive=function(t){return I(t)||P(t)||k(t)||M(t)||D(t)},e.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(x(t)||O(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},9539:(t,e,n)=>{var r=n(4155),i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),s=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&e._extend(r,n),v(r.showHidden)&&(r.showHidden=!1),v(r.depth)&&(r.depth=2),v(r.colors)&&(r.colors=!1),v(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),f(r,t,r.depth)}function c(t,e){var n=l.styles[e];return n?"["+l.colors[n][0]+"m"+t+"["+l.colors[n][1]+"m":t}function h(t,e){return t}function f(t,n,r){if(t.customInspect&&n&&S(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return _(i)||(i=f(t,i,r)),i}var o=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(_(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return y(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):b(e)?t.stylize("null","null"):void 0}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),E(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return d(n);if(0===a.length){if(S(n)){var u=n.name?": "+n.name:"";return t.stylize("[Function"+u+"]","special")}if(w(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(T(n))return t.stylize(Date.prototype.toString.call(n),"date");if(E(n))return d(n)}var l,c="",h=!1,x=["{","}"];return g(n)&&(h=!0,x=["[","]"]),S(n)&&(c=" [Function"+(n.name?": "+n.name:"")+"]"),w(n)&&(c=" "+RegExp.prototype.toString.call(n)),T(n)&&(c=" "+Date.prototype.toUTCString.call(n)),E(n)&&(c=" "+d(n)),0!==a.length||h&&0!=n.length?r<0?w(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),l=h?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(l,c,x)):x[0]+c+x[1]}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),k(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=b(n)?f(t,u.value,null):f(t,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").slice(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),v(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function g(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function b(t){return null===t}function y(t){return"number"==typeof t}function _(t){return"string"==typeof t}function v(t){return void 0===t}function w(t){return x(t)&&"[object RegExp]"===A(t)}function x(t){return"object"==typeof t&&null!==t}function T(t){return x(t)&&"[object Date]"===A(t)}function E(t){return x(t)&&("[object Error]"===A(t)||t instanceof Error)}function S(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function O(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!a[t])if(s.test(t)){var n=r.pid;a[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else a[t]=function(){};return a[t]},e.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=n(5955),e.isArray=g,e.isBoolean=m,e.isNull=b,e.isNullOrUndefined=function(t){return null==t},e.isNumber=y,e.isString=_,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=v,e.isRegExp=w,e.types.isRegExp=w,e.isObject=x,e.isDate=T,e.types.isDate=T,e.isError=E,e.types.isNativeError=E,e.isFunction=S,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=n(384);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(){var t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":");return[t.getDate(),I[t.getMonth()],e].join(" ")}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",P(),e.format.apply(e,arguments))},e.inherits=n(5717),e._extend=function(t,e){if(!e||!x(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};var M="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function D(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(M&&t[M]){var e;if("function"!=typeof(e=t[M]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,M,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,n,r=new Promise((function(t,r){e=t,n=r})),i=[],o=0;o{"use strict";var r=n(4029),i=n(3083),o=n(1924),a=n(7296),s=o("Object.prototype.toString"),u=n(6410)(),l="undefined"==typeof globalThis?n.g:globalThis,c=i(),h=o("String.prototype.slice"),f={},d=Object.getPrototypeOf;u&&a&&d&&r(c,(function(t){if("function"==typeof l[t]){var e=new l[t];if(Symbol.toStringTag in e){var n=d(e),r=a(n,Symbol.toStringTag);if(!r){var i=d(n);r=a(i,Symbol.toStringTag)}f[t]=r.get}}}));var p=n(5692);t.exports=function(t){return!!p(t)&&(u&&Symbol.toStringTag in t?function(t){var e=!1;return r(f,(function(n,r){if(!e)try{var i=n.call(t);i===r&&(e=i)}catch(t){}})),e}(t):h(s(t),8,-1))}},1875:(t,e,n)=>{"use strict";var r=n(8908),i=n(7376),o=n(4947),a=n(7529);function s(t,e,n){var r=t;return i(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=a(e,{uri:t}),r.callback=n,r}function u(t,e,n){return l(e=s(t,e,n))}function l(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,r,i){e||(e=!0,t.callback(n,r,i))};function r(){var t=void 0;if(t=c.response?c.response:c.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(c),b)try{t=JSON.parse(t)}catch(t){}return t}function i(t){return clearTimeout(h),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,y)}function a(){if(!l){var e;clearTimeout(h),e=t.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var i=y,a=null;return 0!==e?(i={body:r(),statusCode:e,method:d,headers:{},url:f,rawRequest:c},c.getAllResponseHeaders&&(i.headers=o(c.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),n(a,i,i.body)}}var s,l,c=t.xhr||null;c||(c=t.cors||t.useXDR?new u.XDomainRequest:new u.XMLHttpRequest);var h,f=c.url=t.uri||t.url,d=c.method=t.method||"GET",p=t.body||t.data,g=c.headers=t.headers||{},m=!!t.sync,b=!1,y={body:void 0,headers:{},statusCode:0,method:d,url:f,rawRequest:c};if("json"in t&&!1!==t.json&&(b=!0,g.accept||g.Accept||(g.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(g["content-type"]||g["Content-Type"]||(g["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),c.onreadystatechange=function(){4===c.readyState&&setTimeout(a,0)},c.onload=a,c.onerror=i,c.onprogress=function(){},c.onabort=function(){l=!0},c.ontimeout=i,c.open(d,f,!m,t.username,t.password),m||(c.withCredentials=!!t.withCredentials),!m&&t.timeout>0&&(h=setTimeout((function(){if(!l){l=!0,c.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",i(t)}}),t.timeout)),c.setRequestHeader)for(s in g)g.hasOwnProperty(s)&&c.setRequestHeader(s,g[s]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(c.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(c),c.send(p||null),c}t.exports=u,t.exports.default=u,u.XMLHttpRequest=r.XMLHttpRequest||function(){},u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n{t.exports=void 0!==self.DOMParser?function(t){return(new self.DOMParser).parseFromString(t,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new self.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e}},7529:t=>{t.exports=function(){for(var t={},n=0;n{},8104:()=>{},3731:()=>{},2361:()=>{},4616:()=>{},3897:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n{t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},3405:(t,e,n)=>{var r=n(3897);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.__esModule=!0,t.exports.default=t.exports},6115:t=>{t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports},6690:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},3515:(t,e,n)=>{var r=n(6015),i=n(9617);function o(e,n,a){return i()?(t.exports=o=Reflect.construct.bind(),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=o=function(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&r(o,n.prototype),o},t.exports.__esModule=!0,t.exports.default=t.exports),o.apply(null,arguments)}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},9728:(t,e,n)=>{var r=n(4062);function i(t,e){for(var n=0;n{var r=n(4062);t.exports=function(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports},434:t=>{function e(){return t.exports=e=Object.assign?Object.assign.bind():function(t){for(var e=1;e{function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},1655:(t,e,n)=>{var r=n(6015);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&r(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports},4836:t=>{t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},5263:(t,e,n)=>{var r=n(8698).default;function i(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(i=function(t){return t?n:e})(t)}t.exports=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==r(t)&&"function"!=typeof t)return{default:t};var n=i(e);if(n&&n.has(t))return n.get(t);var o={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var u=a?Object.getOwnPropertyDescriptor(t,s):null;u&&(u.get||u.set)?Object.defineProperty(o,s,u):o[s]=t[s]}return o.default=t,n&&n.set(t,o),o},t.exports.__esModule=!0,t.exports.default=t.exports},9617:t=>{t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports.default=t.exports},9498:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},8872:t=>{t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}},t.exports.__esModule=!0,t.exports.default=t.exports},2218:t=>{t.exports=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.")},t.exports.__esModule=!0,t.exports.default=t.exports},2281:t=>{t.exports=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.")},t.exports.__esModule=!0,t.exports.default=t.exports},4993:(t,e,n)=>{var r=n(8698).default,i=n(6115);t.exports=function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return i(t)},t.exports.__esModule=!0,t.exports.default=t.exports},7061:(t,e,n)=>{var r=n(8698).default;function i(){"use strict";t.exports=i=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function h(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof g?e:g,o=Object.create(i.prototype),s=new I(r||[]);return a(o,"_invoke",{value:E(t,n,s)}),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p={};function g(){}function m(){}function b(){}var y={};h(y,u,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(P([])));v&&v!==n&&o.call(v,u)&&(y=v);var w=b.prototype=g.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function n(i,a,s,u){var l=d(t[i],t,a);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==r(h)&&o.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,u)}))}u(l.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(o,o):o()}})}function E(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=S(a,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function S(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=d(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function P(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},6015:t=>{function e(n,r){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},7424:(t,e,n)=>{var r=n(5372),i=n(8872),o=n(6116),a=n(2218);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},861:(t,e,n)=>{var r=n(3405),i=n(9498),o=n(6116),a=n(2281);t.exports=function(t){return r(t)||i(t)||o(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},5036:(t,e,n)=>{var r=n(8698).default;t.exports=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},4062:(t,e,n)=>{var r=n(8698).default,i=n(5036);t.exports=function(t){var e=i(t,"string");return"symbol"===r(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},8698:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},6116:(t,e,n)=>{var r=n(3897);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},4687:(t,e,n)=>{var r=n(7061)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3083:(t,e,n)=>{"use strict";var r=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?n.g:globalThis;t.exports=function(){for(var t=[],e=0;e{var r=n(4155),i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,u=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},l=(t=>(e,n)=>t&&t.get(e)||(n=((t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of a(e))s.call(t,n)||i(t,n,{get:()=>e[n],enumerable:!(r=o(e,n))||r.enumerable});return t})(i({},"__esModule",{value:!0}),e),t&&t.set(e,n),n))("undefined"!=typeof WeakMap?new WeakMap:0),c=(t,e,n)=>(((t,e,n)=>{e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n),h={};u(h,{applyPalette:()=>qt,applyPaletteSync:()=>Ht,buildPalette:()=>Vt,buildPaletteSync:()=>Gt,constants:()=>f,conversion:()=>b,distance:()=>B,image:()=>Pt,palette:()=>tt,quality:()=>Ft,utils:()=>at});var f={};u(f,{bt709:()=>d});var d={};u(d,{Y:()=>p,x:()=>g,y:()=>m});var p=(t=>(t[t.RED=.2126]="RED",t[t.GREEN=.7152]="GREEN",t[t.BLUE=.0722]="BLUE",t[t.WHITE=1]="WHITE",t))(p||{}),g=(t=>(t[t.RED=.64]="RED",t[t.GREEN=.3]="GREEN",t[t.BLUE=.15]="BLUE",t[t.WHITE=.3127]="WHITE",t))(g||{}),m=(t=>(t[t.RED=.33]="RED",t[t.GREEN=.6]="GREEN",t[t.BLUE=.06]="BLUE",t[t.WHITE=.329]="WHITE",t))(m||{}),b={};function y(t){return t>.04045?((t+.055)/1.055)**2.4:t/12.92}function _(t,e,n){return{x:.4124*(t=y(t/255))+.3576*(e=y(e/255))+.1805*(n=y(n/255)),y:.2126*t+.7152*e+.0722*n,z:.0193*t+.1192*e+.9505*n}}u(b,{lab2rgb:()=>N,lab2xyz:()=>R,rgb2hsl:()=>I,rgb2lab:()=>M,rgb2xyz:()=>_,xyz2lab:()=>k,xyz2rgb:()=>L});var v={};function w(t){return t*(Math.PI/180)}function x(t,e,n){let r=t;return re&&(r=e),r>n&&(r=n),r}function E(t,e,n){return t>n&&(t=n),t255?t=255:t<0&&(t=0),t}function A(t){return t>255?t=255:t<0&&(t=0),t}function O(t,e){const n=typeof t[0];let r;if("number"===n||"string"===n){const n=Object.create(null);for(let e=0,r=t.length;ee(t,r)||n[t]-n[r]))}else{const n=t.slice(0);r=t.sort(((t,r)=>e(t,r)||n.indexOf(t)-n.indexOf(r)))}return r}function I(t,e,n){const r=T(t,e,n),i=x(t,e,n),o=i-r,a=(r+i)/510;let s=0;a>0&&a<1&&(s=o/(a<.5?i+r:510-i-r));let u=0;return o>0&&(u=i===t?(e-n)/o:i===e?2+(n-t)/o:4+(t-e)/o,u*=60,u<0&&(u+=360)),{h:u,s,l:a}}function P(t){return t>.008856?t**(1/3):7.787*t+16/116}function k(t,e,n){if(t=P(t/.95047),e=P(e/1),n=P(n/1.08883),116*e-16<0)throw new Error("xxx");return{L:Math.max(0,116*e-16),a:500*(t-e),b:200*(e-n)}}function M(t,e,n){const r=_(t,e,n);return k(r.x,r.y,r.z)}function D(t){return t>.206893034?t**3:(t-16/116)/7.787}function R(t,e,n){const r=(t+16)/116,i=r-n/200;return{x:.95047*D(e/500+r),y:1*D(r),z:1.08883*D(i)}}function C(t){return t>.0031308?1.055*t**(1/2.4)-.055:12.92*t}function L(t,e,n){const r=C(3.2406*t+-1.5372*e+-.4986*n),i=C(-.9689*t+1.8758*e+.0415*n),o=C(.0557*t+-.204*e+1.057*n);return{r:S(255*r),g:S(255*i),b:S(255*o)}}function N(t,e,n){const r=R(t,e,n);return L(r.x,r.y,r.z)}u(v,{degrees2radians:()=>w,inRange0to255:()=>A,inRange0to255Rounded:()=>S,intInRange:()=>E,max3:()=>x,min3:()=>T,stableSort:()=>O});var B={};u(B,{AbstractDistanceCalculator:()=>F,AbstractEuclidean:()=>H,AbstractManhattan:()=>X,CIE94GraphicArts:()=>$,CIE94Textiles:()=>U,CIEDE2000:()=>G,CMetric:()=>V,Euclidean:()=>q,EuclideanBT709:()=>W,EuclideanBT709NoAlpha:()=>Y,Manhattan:()=>Z,ManhattanBT709:()=>J,ManhattanNommyde:()=>K,PNGQuant:()=>Q});var F=class{constructor(){c(this,"_maxDistance"),c(this,"_whitePoint"),this._setDefaults(),this.setWhitePoint(255,255,255,255)}setWhitePoint(t,e,n,r){this._whitePoint={r:t>0?255/t:0,g:e>0?255/e:0,b:n>0?255/n:0,a:r>0?255/r:0},this._maxDistance=this.calculateRaw(t,e,n,r,0,0,0,0)}calculateNormalized(t,e){return this.calculateRaw(t.r,t.g,t.b,t.a,e.r,e.g,e.b,e.a)/this._maxDistance}},j=class extends F{calculateRaw(t,e,n,r,i,o,a,s){const u=M(A(t*this._whitePoint.r),A(e*this._whitePoint.g),A(n*this._whitePoint.b)),l=M(A(i*this._whitePoint.r),A(o*this._whitePoint.g),A(a*this._whitePoint.b)),c=u.L-l.L,h=u.a-l.a,f=u.b-l.b,d=Math.sqrt(u.a*u.a+u.b*u.b),p=d-Math.sqrt(l.a*l.a+l.b*l.b);let g=h*h+f*f-p*p;g=g<0?0:Math.sqrt(g);const m=(s-r)*this._whitePoint.a*this._kA;return Math.sqrt((c/this._Kl)**2+(p/(1+this._K1*d))**2+(g/(1+this._K2*d))**2+m**2)}},U=class extends j{_setDefaults(){this._Kl=2,this._K1=.048,this._K2=.014,this._kA=12.5/255}},$=class extends j{_setDefaults(){this._Kl=1,this._K1=.045,this._K2=.015,this._kA=25/255}},z=class extends F{_setDefaults(){}static _calculatehp(t,e){const n=Math.atan2(t,e);return n>=0?n:n+z._deg360InRad}static _calculateRT(t,e){const n=e**7,r=2*Math.sqrt(n/(n+z._pow25to7)),i=z._deg30InRad*Math.exp(-(((t-z._deg275InRad)/z._deg25InRad)**2));return-Math.sin(2*i)*r}static _calculateT(t){return 1-.17*Math.cos(t-z._deg30InRad)+.24*Math.cos(2*t)+.32*Math.cos(3*t+z._deg6InRad)-.2*Math.cos(4*t-z._deg63InRad)}static _calculate_ahp(t,e,n,r){const i=n+r;return 0===t?i:e<=z._deg180InRad?i/2:i>8)+4*c*c+((767-u)*h*h>>8),d=(s-r)*this._whitePoint.a;return Math.sqrt(f+d*d)}_setDefaults(){}},H=class extends F{calculateRaw(t,e,n,r,i,o,a,s){const u=i-t,l=o-e,c=a-n,h=s-r;return Math.sqrt(this._kR*u*u+this._kG*l*l+this._kB*c*c+this._kA*h*h)}},q=class extends H{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},W=class extends H{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},Y=class extends H{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=0}},X=class extends F{calculateRaw(t,e,n,r,i,o,a,s){let u=i-t,l=o-e,c=a-n,h=s-r;return u<0&&(u=0-u),l<0&&(l=0-l),c<0&&(c=0-c),h<0&&(h=0-h),this._kR*u+this._kG*l+this._kB*c+this._kA*h}},Z=class extends X{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},K=class extends X{_setDefaults(){this._kR=.4984,this._kG=.8625,this._kB=.2979,this._kA=1}},J=class extends X{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},Q=class extends F{calculateRaw(t,e,n,r,i,o,a,s){const u=(s-r)*this._whitePoint.a;return this._colordifferenceCh(t*this._whitePoint.r,i*this._whitePoint.r,u)+this._colordifferenceCh(e*this._whitePoint.g,o*this._whitePoint.g,u)+this._colordifferenceCh(n*this._whitePoint.b,a*this._whitePoint.b,u)}_colordifferenceCh(t,e,n){const r=t-e,i=r+n;return r*r+i*i}_setDefaults(){}},tt={};u(tt,{AbstractPaletteQuantizer:()=>et,ColorHistogram:()=>yt,NeuQuant:()=>dt,NeuQuantFloat:()=>mt,RGBQuant:()=>vt,WuColorCube:()=>At,WuQuant:()=>It});var et=class{quantizeSync(){for(const t of this.quantize())if(t.palette)return t.palette;throw new Error("unreachable")}},nt=class{constructor(){c(this,"r"),c(this,"g"),c(this,"b"),c(this,"a"),c(this,"uint32"),c(this,"rgba"),this.uint32=-1>>>0,this.r=this.g=this.b=this.a=0,this.rgba=new Array(4),this.rgba[0]=0,this.rgba[1]=0,this.rgba[2]=0,this.rgba[3]=0}static createByQuadruplet(t){const e=new nt;return e.r=0|t[0],e.g=0|t[1],e.b=0|t[2],e.a=0|t[3],e._loadUINT32(),e._loadQuadruplet(),e}static createByRGBA(t,e,n,r){const i=new nt;return i.r=0|t,i.g=0|e,i.b=0|n,i.a=0|r,i._loadUINT32(),i._loadQuadruplet(),i}static createByUint32(t){const e=new nt;return e.uint32=t>>>0,e._loadRGBA(),e._loadQuadruplet(),e}from(t){this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this.uint32=t.uint32,this.rgba[0]=t.r,this.rgba[1]=t.g,this.rgba[2]=t.b,this.rgba[3]=t.a}getLuminosity(t){let e=this.r,n=this.g,r=this.b;return t&&(e=Math.min(255,255-this.a+this.a*e/255),n=Math.min(255,255-this.a+this.a*n/255),r=Math.min(255,255-this.a+this.a*r/255)),.2126*e+.7152*n+.0722*r}_loadUINT32(){this.uint32=(this.a<<24|this.b<<16|this.g<<8|this.r)>>>0}_loadRGBA(){this.r=255&this.uint32,this.g=this.uint32>>>8&255,this.b=this.uint32>>>16&255,this.a=this.uint32>>>24&255}_loadQuadruplet(){this.rgba[0]=this.r,this.rgba[1]=this.g,this.rgba[2]=this.b,this.rgba[3]=this.a}},rt=class{constructor(){c(this,"_pointArray"),c(this,"_width"),c(this,"_height"),this._width=0,this._height=0,this._pointArray=[]}getWidth(){return this._width}getHeight(){return this._height}setWidth(t){this._width=t}setHeight(t){this._height=t}getPointArray(){return this._pointArray}clone(){const t=new rt;t._width=this._width,t._height=this._height;for(let e=0,n=this._pointArray.length;e=i&&t=0;e--)if(t.uint32===this._pointArray[e].uint32)return!0;return!1}getNearestColor(t,e){return this._pointArray[0|this._getNearestIndex(t,e)]}getPointContainer(){return this._pointContainer}_nearestPointFromCache(t){return"number"==typeof this._i32idx[t]?this._i32idx[t]:-1}_getNearestIndex(t,e){let n=this._nearestPointFromCache(""+e.uint32);if(n>=0)return n;let r=Number.MAX_VALUE;n=0;for(let i=0,o=this._pointArray.length;i{const n=I(t.r,t.g,t.b),r=I(e.r,e.g,e.b),i=t.r===t.g&&t.g===t.b?0:1+it(n.h,10),o=(e.r===e.g&&e.g===e.b?0:1+it(r.h,10))-i;if(o)return-o;const a=t.getLuminosity(!0),s=e.getLuminosity(!0);if(s-a!=0)return s-a;const u=(100*r.s|0)-(100*n.s|0);return u?-u:0}))}},at={};u(at,{HueStatistics:()=>ut,Palette:()=>ot,Point:()=>nt,PointContainer:()=>rt,ProgressTracker:()=>ct,arithmetic:()=>v});var st=class{constructor(){c(this,"num",0),c(this,"cols",[])}},ut=class{constructor(t,e){c(this,"_numGroups"),c(this,"_minCols"),c(this,"_stats"),c(this,"_groupsFull"),this._numGroups=t,this._minCols=e,this._stats=[];for(let e=0;e<=t;e++)this._stats[e]=new st;this._groupsFull=0}check(t){this._groupsFull===this._numGroups+1&&(this.check=()=>{});const e=255&t,n=t>>>8&255,r=t>>>16&255,i=e===n&&n===r?0:1+it(I(e,n,r).h,this._numGroups),o=this._stats[i],a=this._minCols;o.num++,o.num>a||(o.num===a&&this._groupsFull++,o.num<=a&&this._stats[i].cols.push(t))}injectIntoDictionary(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{t[e]?t[e]++:t[e]=1}))}injectIntoArray(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{-1===t.indexOf(e)&&t.push(e)}))}},lt=class{constructor(t,e){c(this,"progress"),c(this,"_step"),c(this,"_range"),c(this,"_last"),c(this,"_progressRange"),this._range=t,this._progressRange=e,this._step=Math.max(1,this._range/(lt.steps+1)|0),this._last=-this._step,this.progress=0}shouldNotify(t){return t-this._last>=this._step&&(this._last=t,this.progress=Math.min(this._progressRange*this._last/this._range,this._progressRange),!0)}},ct=lt;c(ct,"steps",100);var ht=class{constructor(t){c(this,"r"),c(this,"g"),c(this,"b"),c(this,"a"),this.r=this.g=this.b=this.a=t}toPoint(){return nt.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,n,r){this.r-=0|t,this.g-=0|e,this.b-=0|n,this.a-=0|r}},ft=class extends et{constructor(t,e=256){super(),c(this,"_pointArray"),c(this,"_networkSize"),c(this,"_network"),c(this,"_sampleFactor"),c(this,"_radPower"),c(this,"_freq"),c(this,"_bias"),c(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t>3)*ft._radiusBias,u=s>>ft._radiusBiasShift;u<=1&&(u=0);for(let t=0;t>>0;i=e=e&&(c-=e),t++,0===o&&(o=1),t%o==0){a-=a/n|0,s-=s/ft._radiusDecrease|0,u=s>>ft._radiusBiasShift,u<=1&&(u=0);for(let t=0;t>>0}}}_buildPalette(){const t=new ot;return this._network.forEach((e=>{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,n,r,i,o){let a=e-t;a<-1&&(a=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let u=e+1,l=e-1,c=1;for(;ua;){const t=this._radPower[c++]/ft._alphaRadBias;if(ua){const e=this._network[l--];e.subtract(t*(e.r-i),t*(e.g-r),t*(e.b-n),t*(e.a-o))}}}_alterSingle(t,e,n,r,i,o){t/=ft._initAlpha;const a=this._network[e];a.subtract(t*(a.r-i),t*(a.g-r),t*(a.b-n),t*(a.a-o))}_contest(t,e,n,r){let i=~(1<<31),o=i,a=-1,s=a;for(let u=0;u>ft._initialBiasShift-3);h>ft._betaShift;this._freq[u]-=f,this._bias[u]+=f<>ft._betaShift),c(dt,"_betaGamma",ft._initialBias<>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,n,r){this.r-=t,this.g-=e,this.b-=n,this.a-=r}},gt=class extends et{constructor(t,e=256){super(),c(this,"_pointArray"),c(this,"_networkSize"),c(this,"_network"),c(this,"_sampleFactor"),c(this,"_radPower"),c(this,"_freq"),c(this,"_bias"),c(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t>3)*gt._radiusBias,u=s>>gt._radiusBiasShift;u<=1&&(u=0);for(let t=0;t=e&&(c-=e),t++,0===o&&(o=1),t%o==0){a-=a/n,s-=s/gt._radiusDecrease,u=s>>gt._radiusBiasShift,u<=1&&(u=0);for(let t=0;t{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,n,r,i,o){let a=e-t;a<-1&&(a=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let u=e+1,l=e-1,c=1;for(;ua;){const t=this._radPower[c++]/gt._alphaRadBias;if(ua){const e=this._network[l--];e.subtract(t*(e.r-i),t*(e.g-r),t*(e.b-n),t*(e.a-o))}}}_alterSingle(t,e,n,r,i,o){t/=gt._initAlpha;const a=this._network[e];a.subtract(t*(a.r-i),t*(a.g-r),t*(a.b-n),t*(a.a-o))}_contest(t,e,n,r){let i=~(1<<31),o=i,a=-1,s=a;for(let u=0;u>gt._initialBiasShift-3);h>gt._betaShift;this._freq[u]-=f,this._bias[u]+=f<>gt._betaShift),c(mt,"_betaGamma",gt._initialBias<this._histogram[e]-this._histogram[t]));if(0===t.length)return[];let e;switch(this._method){case 1:const n=Math.min(t.length,this._initColors),r=t[n-1],i=this._histogram[r];e=t.slice(0,n);let o=n;const a=t.length;for(;o+t))}_colorStats1D(t){const e=this._histogram,n=t.getPointArray(),r=n.length;for(let t=0;t{let n=Math.round(t.w*t.h/a)*bt._boxPixels;n<2&&(n=2);const i={};this._iterateBox(t,e,(t=>{const e=r[t].uint32;this._hueStats.check(e),e in u?u[e]++:e in i?++i[e]>=n&&(u[e]=i[e]):i[e]=1}))})),this._hueStats.injectIntoDictionary(u)}_iterateBox(t,e,n){const r=t,i=r.y*e+r.x,o=(r.y+r.h-1)*e+(r.x+r.w-1),a=e-r.w+1;let s=0,u=i;do{n.call(this,u),u+=++s%r.w==0?a:1}while(u<=o)}_makeBoxes(t,e,n,r){const i=t%n,o=e%r,a=t-i,s=e-o,u=[];for(let l=0;lthis._colors;){o.length=0;for(let t=0;t3*this._colors?this._initialDistance:this._distanceIncrement}if(ae.distance-t.distance));let t=0;for(;a=0;t--)0===r[t]&&(t!==l-1&&(n[t]=n[l-1]),--l);n.length=l,e.sort(),yield{palette:e,progress:100}}};function wt(t){const e=[];for(let n=0;n0){const n=this._sums[e],r=this._reds[e]/n,i=this._greens[e]/n,o=this._blues[e]/n,a=this._alphas[e]/n,s=nt.createByRGBA(0|r,0|i,0|o,0|a);t.add(s)}t.sort(),yield{palette:t,progress:100}}*_preparePalette(){yield*this._calculateMoments();let t=0;const e=wt(this._colors);for(let n=1;n1?this._calculateVariance(this._cubes[t]):0,e[n]=this._cubes[n].volume>1?this._calculateVariance(this._cubes[n]):0):(e[t]=0,n--),t=0;let r=e[0];for(let i=1;i<=n;++i)e[i]>r&&(r=e[i],t=i);if(r<=0){this._colors=n+1;break}}const n=[],r=[],i=[],o=[];for(let t=0;t0?(n[t]=Ot._volume(this._cubes[t],this._momentsRed)/e|0,r[t]=Ot._volume(this._cubes[t],this._momentsGreen)/e|0,i[t]=Ot._volume(this._cubes[t],this._momentsBlue)/e|0,o[t]=Ot._volume(this._cubes[t],this._momentsAlpha)/e|0):(n[t]=0,r[t]=0,i[t]=0,o[t]=0)}this._reds=wt(this._colors+1),this._greens=wt(this._colors+1),this._blues=wt(this._colors+1),this._alphas=wt(this._colors+1),this._sums=wt(this._colors+1);for(let t=0,e=this._pixels.length;t>e),r=1+(t.g>>e),i=1+(t.b>>e),o=1+(t.a>>e);this._weights[o][n][r][i]++,this._momentsRed[o][n][r][i]+=t.r,this._momentsGreen[o][n][r][i]+=t.g,this._momentsBlue[o][n][r][i]+=t.b,this._momentsAlpha[o][n][r][i]+=t.a,this._moments[o][n][r][i]+=this._table[t.r]+this._table[t.g]+this._table[t.b]+this._table[t.a]}*_calculateMoments(){const t=[],e=[],n=[],r=[],i=[],o=[],a=Tt(this._sideSize,this._sideSize,this._sideSize),s=Tt(this._sideSize,this._sideSize,this._sideSize),u=Tt(this._sideSize,this._sideSize,this._sideSize),l=Tt(this._sideSize,this._sideSize,this._sideSize),c=Tt(this._sideSize,this._sideSize,this._sideSize),h=Tt(this._sideSize,this._sideSize,this._sideSize);let f=0;const d=new ct(this._alphaMaxSideIndex*this._maxSideIndex,99);for(let p=1;p<=this._alphaMaxSideIndex;++p){Et(a,this._sideSize,this._sideSize,this._sideSize,0),Et(s,this._sideSize,this._sideSize,this._sideSize,0),Et(u,this._sideSize,this._sideSize,this._sideSize,0),Et(l,this._sideSize,this._sideSize,this._sideSize,0),Et(c,this._sideSize,this._sideSize,this._sideSize,0),Et(h,this._sideSize,this._sideSize,this._sideSize,0);for(let g=1;g<=this._maxSideIndex;++g,++f){d.shouldNotify(f)&&(yield{progress:d.progress}),St(t,this._sideSize,0),St(e,this._sideSize,0),St(n,this._sideSize,0),St(r,this._sideSize,0),St(i,this._sideSize,0),St(o,this._sideSize,0);for(let f=1;f<=this._maxSideIndex;++f){let d=0,m=0,b=0,y=0,_=0,v=0;for(let w=1;w<=this._maxSideIndex;++w)d+=this._weights[p][g][f][w],m+=this._momentsRed[p][g][f][w],b+=this._momentsGreen[p][g][f][w],y+=this._momentsBlue[p][g][f][w],_+=this._momentsAlpha[p][g][f][w],v+=this._moments[p][g][f][w],t[w]+=d,e[w]+=m,n[w]+=b,r[w]+=y,i[w]+=_,o[w]+=v,a[g][f][w]=a[g-1][f][w]+t[w],s[g][f][w]=s[g-1][f][w]+e[w],u[g][f][w]=u[g-1][f][w]+n[w],l[g][f][w]=l[g-1][f][w]+r[w],c[g][f][w]=c[g-1][f][w]+i[w],h[g][f][w]=h[g-1][f][w]+o[w],this._weights[p][g][f][w]=this._weights[p-1][g][f][w]+a[g][f][w],this._momentsRed[p][g][f][w]=this._momentsRed[p-1][g][f][w]+s[g][f][w],this._momentsGreen[p][g][f][w]=this._momentsGreen[p-1][g][f][w]+u[g][f][w],this._momentsBlue[p][g][f][w]=this._momentsBlue[p-1][g][f][w]+l[g][f][w],this._momentsAlpha[p][g][f][w]=this._momentsAlpha[p-1][g][f][w]+c[g][f][w],this._moments[p][g][f][w]=this._moments[p-1][g][f][w]+h[g][f][w]}}}}static _volumeFloat(t,e){return e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMaximum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum])}static _volume(t,e){return 0|Ot._volumeFloat(t,e)}static _top(t,e,n,r){let i;switch(e){case Ot._alpha:i=r[n][t.redMaximum][t.greenMaximum][t.blueMaximum]-r[n][t.redMaximum][t.greenMinimum][t.blueMaximum]-r[n][t.redMinimum][t.greenMaximum][t.blueMaximum]+r[n][t.redMinimum][t.greenMinimum][t.blueMaximum]-(r[n][t.redMaximum][t.greenMaximum][t.blueMinimum]-r[n][t.redMaximum][t.greenMinimum][t.blueMinimum]-r[n][t.redMinimum][t.greenMaximum][t.blueMinimum]+r[n][t.redMinimum][t.greenMinimum][t.blueMinimum]);break;case Ot._red:i=r[t.alphaMaximum][n][t.greenMaximum][t.blueMaximum]-r[t.alphaMaximum][n][t.greenMinimum][t.blueMaximum]-r[t.alphaMinimum][n][t.greenMaximum][t.blueMaximum]+r[t.alphaMinimum][n][t.greenMinimum][t.blueMaximum]-(r[t.alphaMaximum][n][t.greenMaximum][t.blueMinimum]-r[t.alphaMaximum][n][t.greenMinimum][t.blueMinimum]-r[t.alphaMinimum][n][t.greenMaximum][t.blueMinimum]+r[t.alphaMinimum][n][t.greenMinimum][t.blueMinimum]);break;case Ot._green:i=r[t.alphaMaximum][t.redMaximum][n][t.blueMaximum]-r[t.alphaMaximum][t.redMinimum][n][t.blueMaximum]-r[t.alphaMinimum][t.redMaximum][n][t.blueMaximum]+r[t.alphaMinimum][t.redMinimum][n][t.blueMaximum]-(r[t.alphaMaximum][t.redMaximum][n][t.blueMinimum]-r[t.alphaMaximum][t.redMinimum][n][t.blueMinimum]-r[t.alphaMinimum][t.redMaximum][n][t.blueMinimum]+r[t.alphaMinimum][t.redMinimum][n][t.blueMinimum]);break;case Ot._blue:i=r[t.alphaMaximum][t.redMaximum][t.greenMaximum][n]-r[t.alphaMaximum][t.redMaximum][t.greenMinimum][n]-r[t.alphaMaximum][t.redMinimum][t.greenMaximum][n]+r[t.alphaMaximum][t.redMinimum][t.greenMinimum][n]-(r[t.alphaMinimum][t.redMaximum][t.greenMaximum][n]-r[t.alphaMinimum][t.redMaximum][t.greenMinimum][n]-r[t.alphaMinimum][t.redMinimum][t.greenMaximum][n]+r[t.alphaMinimum][t.redMinimum][t.greenMinimum][n]);break;default:throw new Error("impossible")}return 0|i}static _bottom(t,e,n){switch(e){case Ot._alpha:return-n[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+n[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+n[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-n[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-n[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+n[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+n[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-n[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ot._red:return-n[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+n[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+n[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-n[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-n[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+n[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+n[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-n[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ot._green:return-n[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]+n[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+n[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]-n[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-n[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+n[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+n[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-n[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ot._blue:return-n[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]+n[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+n[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]-n[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-(-n[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+n[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+n[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-n[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);default:return 0}}_calculateVariance(t){const e=Ot._volume(t,this._momentsRed),n=Ot._volume(t,this._momentsGreen),r=Ot._volume(t,this._momentsBlue),i=Ot._volume(t,this._momentsAlpha);return Ot._volumeFloat(t,this._moments)-(e*e+n*n+r*r+i*i)/Ot._volume(t,this._weights)}_maximize(t,e,n,r,i,o,a,s,u){const l=0|Ot._bottom(t,e,this._momentsRed),c=0|Ot._bottom(t,e,this._momentsGreen),h=0|Ot._bottom(t,e,this._momentsBlue),f=0|Ot._bottom(t,e,this._momentsAlpha),d=0|Ot._bottom(t,e,this._weights);let p=0,g=-1;for(let m=n;mp&&(p=e,g=m))}}return{max:p,position:g}}_cut(t,e){let n;const r=Ot._volume(t,this._momentsRed),i=Ot._volume(t,this._momentsGreen),o=Ot._volume(t,this._momentsBlue),a=Ot._volume(t,this._momentsAlpha),s=Ot._volume(t,this._weights),u=this._maximize(t,Ot._red,t.redMinimum+1,t.redMaximum,r,i,o,a,s),l=this._maximize(t,Ot._green,t.greenMinimum+1,t.greenMaximum,r,i,o,a,s),c=this._maximize(t,Ot._blue,t.blueMinimum+1,t.blueMaximum,r,i,o,a,s),h=this._maximize(t,Ot._alpha,t.alphaMinimum+1,t.alphaMaximum,r,i,o,a,s);if(h.max>=u.max&&h.max>=l.max&&h.max>=c.max){if(n=Ot._alpha,h.position<0)return!1}else n=u.max>=h.max&&u.max>=l.max&&u.max>=c.max?Ot._red:l.max>=h.max&&l.max>=u.max&&l.max>=c.max?Ot._green:Ot._blue;switch(e.redMaximum=t.redMaximum,e.greenMaximum=t.greenMaximum,e.blueMaximum=t.blueMaximum,e.alphaMaximum=t.alphaMaximum,n){case Ot._red:e.redMinimum=t.redMaximum=u.position,e.greenMinimum=t.greenMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ot._green:e.greenMinimum=t.greenMaximum=l.position,e.redMinimum=t.redMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ot._blue:e.blueMinimum=t.blueMaximum=c.position,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ot._alpha:e.alphaMinimum=t.alphaMaximum=h.position,e.blueMinimum=t.blueMinimum,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum}return t.volume=(t.redMaximum-t.redMinimum)*(t.greenMaximum-t.greenMinimum)*(t.blueMaximum-t.blueMinimum)*(t.alphaMaximum-t.alphaMinimum),e.volume=(e.redMaximum-e.redMinimum)*(e.greenMaximum-e.greenMinimum)*(e.blueMaximum-e.blueMinimum)*(e.alphaMaximum-e.alphaMinimum),!0}_initialize(t){this._colors=t,this._cubes=[];for(let e=0;ekt,ErrorDiffusionArray:()=>Rt,ErrorDiffusionArrayKernel:()=>Dt,ErrorDiffusionRiemersma:()=>Bt,NearestColor:()=>Mt});var kt=class{quantizeSync(t,e){for(const n of this.quantize(t,e))if(n.pointContainer)return n.pointContainer;throw new Error("unreachable")}},Mt=class extends kt{constructor(t){super(),c(this,"_distance"),this._distance=t}*quantize(t,e){const n=t.getPointArray(),r=t.getWidth(),i=t.getHeight(),o=new ct(i,99);for(let t=0;t(t[t.FloydSteinberg=0]="FloydSteinberg",t[t.FalseFloydSteinberg=1]="FalseFloydSteinberg",t[t.Stucki=2]="Stucki",t[t.Atkinson=3]="Atkinson",t[t.Jarvis=4]="Jarvis",t[t.Burkes=5]="Burkes",t[t.Sierra=6]="Sierra",t[t.TwoSierra=7]="TwoSierra",t[t.SierraLite=8]="SierraLite",t))(Dt||{}),Rt=class extends kt{constructor(t,e,n=!0,r=0,i=!1){super(),c(this,"_minColorDistance"),c(this,"_serpentine"),c(this,"_kernel"),c(this,"_calculateErrorLikeGIMP"),c(this,"_distance"),this._setKernel(e),this._distance=t,this._minColorDistance=r,this._serpentine=n,this._calculateErrorLikeGIMP=i}*quantize(t,e){const n=t.getPointArray(),r=new nt,i=t.getWidth(),o=t.getHeight(),a=[];let s=1,u=1;for(const t of this._kernel){const e=t[2]+1;u=0&&n+l=0&&r+te&&(t.length=e);const n=t.length;for(let e=0;e=0&&t.x=0&&t.y{const s=n[t+i*r];let{r:u,g:l,b:c,a:h}=s;for(let t=0;t{let u=0,l=0,c=0;for(let n=0;njt});var zt="function"==typeof setImmediate?setImmediate:void 0!==r&&"function"==typeof(null==r?void 0:r.nextTick)?t=>r.nextTick(t):t=>setTimeout(t,0);function Gt(t,{colorDistanceFormula:e,paletteQuantization:n,colors:r}={}){const i=Xt(Wt(e),n,r);return t.forEach((t=>i.sample(t))),i.quantizeSync()}async function Vt(t,{colorDistanceFormula:e,paletteQuantization:n,colors:r,onProgress:i}={}){return new Promise(((o,a)=>{const s=Xt(Wt(e),n,r);let u;t.forEach((t=>s.sample(t)));const l=s.quantize(),c=()=>{try{const t=l.next();t.done?o(u):(t.value.palette&&(u=t.value.palette),i&&i(t.value.progress),zt(c))}catch(t){a(t)}};zt(c)}))}function Ht(t,e,{colorDistanceFormula:n,imageQuantization:r}={}){return Yt(Wt(n),r).quantizeSync(t,e)}async function qt(t,e,{colorDistanceFormula:n,imageQuantization:r,onProgress:i}={}){return new Promise(((o,a)=>{let s;const u=Yt(Wt(n),r).quantize(t,e),l=()=>{try{const t=u.next();t.done?o(s):(t.value.pointContainer&&(s=t.value.pointContainer),i&&i(t.value.progress),zt(l))}catch(t){a(t)}};zt(l)}))}function Wt(t="euclidean-bt709"){switch(t){case"cie94-graphic-arts":return new $;case"cie94-textiles":return new U;case"ciede2000":return new G;case"color-metric":return new V;case"euclidean":return new q;case"euclidean-bt709":return new W;case"euclidean-bt709-noalpha":return new Y;case"manhattan":return new Z;case"manhattan-bt709":return new J;case"manhattan-nommyde":return new K;case"pngquant":return new Q;default:throw new Error(`Unknown colorDistanceFormula ${t}`)}}function Yt(t,e="floyd-steinberg"){switch(e){case"nearest":return new Mt(t);case"riemersma":return new Bt(t);case"floyd-steinberg":return new Rt(t,0);case"false-floyd-steinberg":return new Rt(t,1);case"stucki":return new Rt(t,2);case"atkinson":return new Rt(t,3);case"jarvis":return new Rt(t,4);case"burkes":return new Rt(t,5);case"sierra":return new Rt(t,6);case"two-sierra":return new Rt(t,7);case"sierra-lite":return new Rt(t,8);default:throw new Error(`Unknown imageQuantization ${e}`)}}function Xt(t,e="wuquant",n=256){switch(e){case"neuquant":return new dt(t,n);case"rgbquant":return new vt(t,n);case"wuquant":return new It(t,n);case"neuquant-float":return new mt(t,n);default:throw new Error(`Unknown paletteQuantization ${e}`)}}t.exports=l(h)},8207:function(t){t.exports=function(){"use strict";const t=/^\s+/,e=/\s+$/;function n(r,i){if(i=i||{},(r=r||"")instanceof n)return r;if(!(this instanceof n))return new n(r,i);var o=function(n){var r={r:0,g:0,b:0},i=1,o=null,a=null,s=null,u=!1,l=!1;return"string"==typeof n&&(n=function(n){n=n.replace(t,"").replace(e,"").toLowerCase();var r,i=!1;if(_[n])n=_[n],i=!0;else if("transparent"==n)return{r:0,g:0,b:0,a:0,format:"name"};return(r=D.rgb.exec(n))?{r:r[1],g:r[2],b:r[3]}:(r=D.rgba.exec(n))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=D.hsl.exec(n))?{h:r[1],s:r[2],l:r[3]}:(r=D.hsla.exec(n))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=D.hsv.exec(n))?{h:r[1],s:r[2],v:r[3]}:(r=D.hsva.exec(n))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=D.hex8.exec(n))?{r:E(r[1]),g:E(r[2]),b:E(r[3]),a:I(r[4]),format:i?"name":"hex8"}:(r=D.hex6.exec(n))?{r:E(r[1]),g:E(r[2]),b:E(r[3]),format:i?"name":"hex"}:(r=D.hex4.exec(n))?{r:E(r[1]+""+r[1]),g:E(r[2]+""+r[2]),b:E(r[3]+""+r[3]),a:I(r[4]+""+r[4]),format:i?"name":"hex8"}:!!(r=D.hex3.exec(n))&&{r:E(r[1]+""+r[1]),g:E(r[2]+""+r[2]),b:E(r[3]+""+r[3]),format:i?"name":"hex"}}(n)),"object"==typeof n&&(R(n.r)&&R(n.g)&&R(n.b)?(c=n.r,h=n.g,f=n.b,r={r:255*x(c,255),g:255*x(h,255),b:255*x(f,255)},u=!0,l="%"===String(n.r).substr(-1)?"prgb":"rgb"):R(n.h)&&R(n.s)&&R(n.v)?(o=A(n.s),a=A(n.v),r=function(t,e,n){t=6*x(t,360),e=x(e,100),n=x(n,100);var r=Math.floor(t),i=t-r,o=n*(1-e),a=n*(1-i*e),s=n*(1-(1-i)*e),u=r%6;return{r:255*[n,a,o,o,s,n][u],g:255*[s,n,n,a,o,o][u],b:255*[o,o,s,n,n,a][u]}}(n.h,o,a),u=!0,l="hsv"):R(n.h)&&R(n.s)&&R(n.l)&&(o=A(n.s),s=A(n.l),r=function(t,e,n){var r,i,o;function a(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(t=x(t,360),e=x(e,100),n=x(n,100),0===e)r=i=o=n;else{var s=n<.5?n*(1+e):n+e-n*e,u=2*n-s;r=a(u,s,t+1/3),i=a(u,s,t),o=a(u,s,t-1/3)}return{r:255*r,g:255*i,b:255*o}}(n.h,o,s),u=!0,l="hsl"),n.hasOwnProperty("a")&&(i=n.a)),i=w(i),{ok:u,format:n.format||l,r:Math.min(255,Math.max(r.r,0)),g:Math.min(255,Math.max(r.g,0)),b:Math.min(255,Math.max(r.b,0)),a:i};var c,h,f}(r);this._originalInput=r,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=i.format||o.format,this._gradientType=i.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function r(t,e,n){t=x(t,255),e=x(e,255),n=x(n,255);var r,i,o=Math.max(t,e,n),a=Math.min(t,e,n),s=(o+a)/2;if(o==a)r=i=0;else{var u=o-a;switch(i=s>.5?u/(2-o-a):u/(o+a),o){case t:r=(e-n)/u+(e>1)+720)%360;--e;)i.h=(i.h+o)%360,a.push(n(i));return a}function y(t,e){e=e||6;for(var r=n(t).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/e;e--;)s.push(n({h:i,s:o,v:a})),a=(a+u)%1;return s}n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,r=this.toRgb();return t=r.r/255,e=r.g/255,n=r.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},setAlpha:function(t){return this._a=w(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=i(this._r,this._g,this._b),e=Math.round(360*t.h),n=Math.round(100*t.s),r=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=r(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=r(this._r,this._g,this._b),e=Math.round(360*t.h),n=Math.round(100*t.s),i=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+i+"%)":"hsla("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,n,r,i){var o=[S(Math.round(t).toString(16)),S(Math.round(e).toString(16)),S(Math.round(n).toString(16)),S(O(r))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*x(this._r,255))+"%",g:Math.round(100*x(this._g,255))+"%",b:Math.round(100*x(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*x(this._r,255))+"%, "+Math.round(100*x(this._g,255))+"%, "+Math.round(100*x(this._b,255))+"%)":"rgba("+Math.round(100*x(this._r,255))+"%, "+Math.round(100*x(this._g,255))+"%, "+Math.round(100*x(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(v[o(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+a(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=n(t);r="#"+a(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(c,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(f,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(u,arguments)},greyscale:function(){return this._applyModification(l,arguments)},spin:function(){return this._applyModification(d,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(b,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(m,arguments)},triad:function(){return this._applyCombination(g,[3])},tetrad:function(){return this._applyCombination(g,[4])}},n.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]="a"===i?t[i]:A(t[i]));t=r}return n(t,e)},n.equals=function(t,e){return!(!t||!e)&&n(t).toRgbString()==n(e).toRgbString()},n.random=function(){return n.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),o=n(e).toRgb(),a=r/100;return n({r:(o.r-i.r)*a+i.r,g:(o.g-i.g)*a+i.g,b:(o.b-i.b)*a+i.b,a:(o.a-i.a)*a+i.a})},n.readability=function(t,e){var r=n(t),i=n(e);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},n.isReadable=function(t,e,r){var i,o,a,s,u,l=n.readability(t,e);switch(o=!1,(a=r,"AA"!==(s=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==s&&(s="AA"),"small"!==(u=(a.size||"small").toLowerCase())&&"large"!==u&&(u="small"),i={level:s,size:u}).level+i.size){case"AAsmall":case"AAAlarge":o=l>=4.5;break;case"AAlarge":o=l>=3;break;case"AAAsmall":o=l>=7}return o},n.mostReadable=function(t,e,r){var i,o,a,s,u=null,l=0;o=(r=r||{}).includeFallbackColors,a=r.level,s=r.size;for(var c=0;cl&&(l=i,u=n(e[c]));return n.isReadable(t,u,{level:a,size:s})||!o?u:(r.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],r))};var _=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},v=n.hexNames=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(_);function w(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function x(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function T(t){return Math.min(1,Math.max(0,t))}function E(t){return parseInt(t,16)}function S(t){return 1==t.length?"0"+t:""+t}function A(t){return t<=1&&(t=100*t+"%"),t}function O(t){return Math.round(255*parseFloat(t)).toString(16)}function I(t){return E(t)/255}var P,k,M,D=(k="[\\s|\\(]+("+(P="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+P+")[,|\\s]+("+P+")\\s*\\)?",M="[\\s|\\(]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")[,|\\s]+("+P+")\\s*\\)?",{CSS_UNIT:new RegExp(P),rgb:new RegExp("rgb"+k),rgba:new RegExp("rgba"+M),hsl:new RegExp("hsl"+k),hsla:new RegExp("hsla"+M),hsv:new RegExp("hsv"+k),hsva:new RegExp("hsva"+M),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function R(t){return!!D.CSS_UNIT.exec(t)}return n}()}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={id:t,loaded:!1,exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.d=(t,e)=>{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var __webpack_exports__={};(()=>{"use strict";const t=__webpack_require__(5817),e=__webpack_require__(8736),n=chrome.runtime.id;e.env.wasm.wasmPaths={"ort-wasm.wasm":`chrome-extension://${n}/dist/ort-wasm.wasm`,"ort-wasm-threaded.wasm":`chrome-extension://${n}/dist/ort-wasm-threaded.wasm`,"ort-wasm-simd.wasm":`chrome-extension://${n}/dist/ort-wasm-simd.wasm`,"ort-wasm-simd-threaded.wasm":`chrome-extension://${n}/dist/ort-wasm-simd-threaded.wasm`};class r{static sleep(t=1e3){return new Promise((e=>setTimeout(e,t)))}static async random_sleep(t,e){const n=Math.floor(Math.random()*(e-t)+t);return await r.sleep(n)}}function i(t,n){var r=t.bitmap.data;const[i,o,a]=[[],[],[]];for(let t=0;t{function n(t){const e=t?.style.background?.trim()?.match(/(?!^)".*?"/g);return e&&0!==e.length?e[0].replaceAll('"',""):null}let o=null;async function a(){"block"!==document.querySelector("div.check")?.style.display?(u=!1,await r.sleep(500),document.querySelector("#checkbox")?.click()):u||(u=!0)}async function s(a){"EN"!==document.querySelector(".display-language .text").textContent&&(document.querySelector(".language-selector .option:nth-child(23)").click(),await r.sleep(500));const{task:s,cells:u,urls:l}=await function(t=500){return new Promise((e=>{let r=!1;const i=setInterval((async()=>{if(r)return;r=!0;let t=await async function(){let t=document.querySelector("h2.prompt-text")?.innerText?.replace(/\s+/g," ")?.trim();if(!t)return null;const e={"0430":"a","0441":"c","0501":"d","0065":"e","0435":"e","04bb":"h","0069":"i","0456":"i","0458":"j","03f3":"j","04cf":"l","03bf":"o","043e":"o","0440":"p","0455":"s","0445":"x","0443":"y","0335":"-"};function n(t,e,n){for(;`${t}`.length"] + } + ], + "host_permissions": ["*://*.github.com/*", "*://*.githubusercontent.com/*"], + "content_scripts": [ + { + "matches": ["*://*.hcaptcha.com/captcha/*"], + "js": ["contentScript.js"], + "run_at": "document_end", + "all_frames": true, + "match_about_blank": false + } + ] +} diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..5429dd8 --- /dev/null +++ b/popup.html @@ -0,0 +1,165 @@ + + + + hektCaptcha + + + + + + + +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+ Automatic opening +
+
+
+
+
+
+
+
+
+
+
+ Automatically opens hcaptcha challenges +
+
+
+ +
+
+
+
+ +
Automatic solve
+
+
+
+
+
+
+
+
+
+
+ Automatically solves hcaptcha challenges +
+
+
+ +
+
+
+
+ +
Opening time
+
+
+
+
+
+ Milliseconds to delay opening +
+ +
+
+ +
+
+
+
+ +
Solve time
+
+
+
+
+
+ Milliseconds to delay solving +
+ +
+
+ + +
+
+
+
+ +