diff --git "a/_next/static/chunks/766.0cd721cdb05598ed.js" "b/_next/static/chunks/766.0cd721cdb05598ed.js" new file mode 100644--- /dev/null +++ "b/_next/static/chunks/766.0cd721cdb05598ed.js" @@ -0,0 +1,6 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[766],{6033:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,s=l(e),o=s[0],a=s[1],h=new i((o+a)*3/4-a),u=0,c=a>0?o-4:o;for(r=0;r>16&255,h[u++]=t>>8&255,h[u++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,h[u++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,h[u++]=t>>8&255,h[u++]=255&t),h},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=0,a=n-i;o>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},3663:function(e,t,r){"use strict";/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */var n=r(6033),i=r(1531),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!a.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|d(e,t),n=o(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(M(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(M(e,ArrayBuffer)||e&&M(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(M(e,SharedArrayBuffer)||e&&M(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);var i=function(e){if(a.isBuffer(e)){var t,r=0|p(e.length),n=o(r);return 0===n.length||e.copy(n,0,0,r),n}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?o(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return h(e),o(e<0?0:0|p(e))}function c(e){for(var t=e.length<0?0:0|p(e.length),r=o(t),n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function d(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||M(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,s,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(s=r=+r)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var s,o=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,r/=2}function h(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(s=r;sa&&(r=a-l),s=r;s>=0;s--){for(var c=!0,f=0;f239?4:h>223?3:h>191?2:1;if(i+c<=r)switch(c){case 1:h<128&&(u=h);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&h)<<6|63&s)>127&&(u=l);break;case 3:s=e[i+1],o=e[i+2],(192&s)==128&&(192&o)==128&&(l=(15&h)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(l=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(u=l)}null===u?(u=65533,c=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;nr)throw RangeError("Trying to access beyond buffer length")}function v(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function x(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,s){return t=+t,r>>>=0,s||x(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,s){return t=+t,r>>>=0,s||x(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.lW=a,t.h2=50,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(h(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return u(e)},a.allocUnsafeSlow=function(e){return u(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(M(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),M(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);in.length?a.from(s).copy(n,i):Uint8Array.prototype.set.call(n,s,i);else if(a.isBuffer(s))s.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=s.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(M(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,o=r-t,l=Math.min(s,o),h=this.slice(n,i),u=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,o,a,l,h,u,c,f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var p=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;n>s/2&&(n=s/2);for(var o=0;o>8,i.push(r%256),i.push(n);return i}(e,this.length-u),this,u,c);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,s=0;++s>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;v(this,e,t,r,i,0)}var s=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;v(this,e,t,r,i,0)}var s=r-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);v(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);v(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function C(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var i=0;i=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function M(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var B=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},1531:function(e,t){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<>1,u=-7,c=r?i-1:0,f=r?-1:1,p=e[t+c];for(c+=f,s=p&(1<<-u)-1,p>>=-u,u+=a;u>0;s=256*s+e[t+c],c+=f,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=256*o+e[t+c],c+=f,u-=8);if(0===s)s=1-h;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=h}return(p?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,l,h=8*s-i-1,u=(1<>1,f=23===i?5960464477539062e-23:0,p=n?0:s-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?t+=f/l:t+=f*Math.pow(2,1-c),t*l>=2&&(o++,l/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(t*l-1)*Math.pow(2,i),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(o=o<0;e[r+p]=255&o,p+=d,o/=256,h-=8);e[r+p-d]|=128*m}},9079:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(3127)},4252:function(e,t,r){!function(){var t={452:function(e){"use strict";e.exports=r(979)}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var s=n[e]={exports:{}},o=!0;try{t[e](s,s.exports,i),o=!1}finally{o&&delete n[e]}return s.exports}i.ab="//";var s={};!function(){var e,t=(e=i(452))&&"object"==typeof e&&"default"in e?e.default:e,r=/https?|ftp|gopher|file/;function n(e){"string"==typeof e&&(e=_(e));var n,i,s,o,a,l,h,u,c,f=(i=(n=e).auth,s=n.hostname,o=n.protocol||"",a=n.pathname||"",l=n.hash||"",h=n.query||"",u=!1,i=i?encodeURIComponent(i).replace(/%3A/i,":")+"@":"",n.host?u=i+n.host:s&&(u=i+(~s.indexOf(":")?"["+s+"]":s),n.port&&(u+=":"+n.port)),h&&"object"==typeof h&&(h=t.encode(h)),c=n.search||h&&"?"+h||"",o&&":"!==o.substr(-1)&&(o+=":"),n.slashes||(!o||r.test(o))&&!1!==u?(u="//"+(u||""),a&&"/"!==a[0]&&(a="/"+a)):u||(u=""),l&&"#"!==l[0]&&(l="#"+l),c&&"?"!==c[0]&&(c="?"+c),{protocol:o,host:u,pathname:a=a.replace(/[?#]/g,encodeURIComponent),search:c=c.replace("#","%23"),hash:l});return""+f.protocol+f.host+f.pathname+f.search+f.hash}var o="http://",a=o+"w.w",l=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,h=/https?|ftp|gopher|file/;function u(e,t){var r="string"==typeof e?_(e):e;e="object"==typeof e?n(e):e;var i=_(t),s="";r.protocol&&!r.slashes&&(s=r.protocol,e=e.replace(r.protocol,""),s+="/"===t[0]||"/"===e[0]?"/":""),s&&i.protocol&&(s="",i.slashes||(s=i.protocol,t=t.replace(i.protocol,"")));var u=e.match(l);u&&!i.protocol&&(e=e.substr((s=u[1]+(u[2]||"")).length),/^\/\/[^/]/.test(t)&&(s=s.slice(0,-1)));var c=new URL(e,a+"/"),f=new URL(t,c).toString().replace(a,""),p=i.protocol||r.protocol;return p+=r.slashes||i.slashes?"//":"",!s&&p?f=f.replace(o,p):s&&(f=f.replace(o,"")),h.test(f)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==f.slice(-1)||(f=f.slice(0,-1)),s&&(f=s+("/"===f[0]?f.substr(1):f)),f}function c(){}c.prototype.parse=_,c.prototype.format=n,c.prototype.resolve=u,c.prototype.resolveObject=u;var f=/^https?|ftp|gopher|file/,p=/^(.*?)([#?].*)/,d=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,g=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function _(e,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!1),e&&"object"==typeof e&&e instanceof c)return e;var s=(e=e.trim()).match(p);e=s?s[1].replace(/\\/g,"/")+s[2]:e.replace(/\\/g,"/"),g.test(e)&&"/"!==e.slice(-1)&&(e+="/");var o=!/(^javascript)/.test(e)&&e.match(d),l=m.test(e),h="";o&&(f.test(o[1])||(h=o[1].toLowerCase(),e=""+o[2]+o[3]),o[2]||(l=!1,f.test(o[1])?(h=o[1],e=""+o[3]):e="//"+o[3]),3!==o[2].length&&1!==o[2].length||(h=o[1],e="/"+o[3]));var u,_=(s?s[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),y=_&&_[1],w=new c,b="",v="";try{u=new URL(e)}catch(t){b=t,h||i||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(v="/",e=e.substr(1));try{u=new URL(e,a)}catch(e){return w.protocol=h,w.href=h,w}}w.slashes=l&&!v,w.host="w.w"===u.host?"":u.host,w.hostname="w.w"===u.hostname?"":u.hostname.replace(/(\[|\])/g,""),w.protocol=b?h||null:u.protocol,w.search=u.search.replace(/\\/g,"%5C"),w.hash=u.hash.replace(/\\/g,"%5C");var x=e.split("#");!w.search&&~x[0].indexOf("?")&&(w.search="?"),w.hash||""!==x[1]||(w.hash="#"),w.query=r?t.decode(u.search.substr(1)):w.search.substr(1),w.pathname=v+(o?u.pathname.replace(/['^|`]/g,function(e){return"%"+e.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{return decodeURIComponent(t).split("").map(function(e){var t=e.charCodeAt();return t>256||/^[a-z0-9]$/i.test(e)?e:"%"+t.toString(16).toUpperCase()}).join("")}catch(e){return t}}):u.pathname),"about:"===w.protocol&&"blank"===w.pathname&&(w.protocol="",w.pathname=""),b&&"/"!==e[0]&&(w.pathname=w.pathname.substr(1)),h&&!f.test(h)&&"/"!==e.slice(-1)&&"/"===w.pathname&&(w.pathname=""),w.path=w.pathname+w.search,w.auth=[u.username,u.password].map(decodeURIComponent).filter(Boolean).join(":"),w.port=u.port,y&&!w.host.endsWith(y)&&(w.host+=y,w.port=y.slice(1)),w.href=v?""+w.pathname+w.search+w.hash:n(w);var E=/^(file)/.test(w.href)?["host","hostname"]:[];return Object.keys(w).forEach(function(e){~E.indexOf(e)||(w[e]=w[e]||null)}),w}s.parse=_,s.format=n,s.resolve=u,s.resolveObject=function(e,t){return _(u(e,t))},s.Url=c}(),e.exports=s}()},3127:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l=[],h=!1,u=-1;function c(){h&&n&&(h=!1,n.length?l=n.concat(l):u=-1,l.length&&f())}function f(){if(!h){var e=a(c);h=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r0&&l>a&&(l=a);for(var h=0;h=0?(u=d.substr(0,m),c=d.substr(m+1)):(u=d,c=""),f=decodeURIComponent(u),p=decodeURIComponent(c),Object.prototype.hasOwnProperty.call(s,f))?t(s[f])?s[f].push(p):s[f]=[s[f],p]:s[f]=p}return s};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},577:function(e){var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,s,o,a){return(s=s||"&",o=o||"=",null===e&&(e=void 0),"object"==typeof e)?n(i(e),function(i){var a=encodeURIComponent(t(i))+o;return r(e[i])?n(e[i],function(e){return a+encodeURIComponent(t(e))}).join(s):a+encodeURIComponent(t(e[i]))}).join(s):a?encodeURIComponent(t(a))+o+encodeURIComponent(t(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n{if(t&&"function"==typeof t.init&&"function"==typeof t.createSessionHandler){let s=n[e];if(void 0===s)n[e]={backend:t,priority:r};else if(s.priority>r)return;else if(s.priority===r&&s.backend!==t)throw Error(`cannot register backend "${e}" using priority ${r}`);if(r>=0){let t=i.indexOf(e);-1!==t&&i.splice(t,1);for(let t=0;t{let t=0===e.length?i:e,r=[];for(let e of t){let t=n[e];if(t){if(t.initialized)return t.backend;if(t.aborted)continue;let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init()),await t.initPromise,t.initialized=!0,t.backend}catch(i){n||r.push({name:e,err:i}),t.aborted=!0}finally{delete t.initPromise}}}throw Error(`no available backend found. ERR: ${r.map(e=>`[${e.name}] ${e.err}`).join(", ")}`)};class a{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(e){if(void 0!==e){if("string"!=typeof e||-1===["verbose","info","warning","error","fatal"].indexOf(e))throw Error(`Unsupported logging level: ${e}`);this.logLevelInternal=e}}get logLevel(){return this.logLevelInternal}}let l=new a,h="undefined"!=typeof BigInt64Array&&"function"==typeof BigInt64Array.from,u="undefined"!=typeof BigUint64Array&&"function"==typeof BigUint64Array.from,c=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),f=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);h&&(c.set("int64",BigInt64Array),f.set(BigInt64Array,"int64")),u&&(c.set("uint64",BigUint64Array),f.set(BigUint64Array,"uint64"));let p=e=>{let t=1;for(let r=0;r{let i=document.createElement("canvas"),s=i.getContext("2d");if(!e||!s)return n();let o=new Image;o.crossOrigin="Anonymous",o.src=e,o.onload=()=>{i.width=o.width,i.height=o.height,s.drawImage(o,0,0,i.width,i.height);let e=s.getImageData(0,0,i.width,i.height);if(void 0!==t){if(void 0!==t.height&&t.height!==i.height)throw Error("Image input config height doesn't match ImageBitmap height");if(a.height=i.height,void 0!==t.width&&t.width!==i.width)throw Error("Image input config width doesn't match ImageBitmap width");a.width=i.width}else a.height=i.height,a.width=i.width;r(d.bufferToTensor(e.data,a))}});else throw Error("Input data provided is not supported - aborted tensor creation");if(void 0!==r)return d.bufferToTensor(r,a);throw Error("Input data provided is not supported - aborted tensor creation")}toImageData(e){var t,r;let n;let i=document.createElement("canvas").getContext("2d");if(null!=i){let s=this.dims[3],o=this.dims[2],a=this.dims[1],l=void 0!==e&&void 0!==e.format?e.format:"RGB",h=void 0!==e&&(null===(t=e.norm)||void 0===t?void 0:t.mean)!==void 0?e.norm.mean:255,u=void 0!==e&&(null===(r=e.norm)||void 0===r?void 0:r.bias)!==void 0?e.norm.bias:0,c=o*s;if(void 0!==e){if(void 0!==e.height&&e.height!==o)throw Error("Image output config height doesn't match tensor height");if(void 0!==e.width&&e.width!==s)throw Error("Image output config width doesn't match tensor width");if(void 0!==e.format&&4===a&&"RGBA"!==e.format||3===a&&"RGB"!==e.format&&"BGR"!==e.format)throw Error("Tensor format doesn't match input tensor dims")}let f=0,p=1,d=2,m=3,g=0,_=c,y=2*c,w=-1;"RGBA"===l?(g=0,_=c,y=2*c,w=3*c):"RGB"===l?(g=0,_=c,y=2*c):"RBG"===l&&(g=0,y=c,_=2*c),n=i.createImageData(s,o);for(let e=0;e=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(a=e.byteLength-o,"number"==typeof r){if(!Number.isSafeInteger(a=r))throw RangeError("'byteLength' must be an integer.");if(a<=0||o+a>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-o}].`);if("object"==typeof n&&null!==n)s=n;else if(void 0!==n)throw TypeError("'options' must be an object.")}else if(void 0!==r)throw TypeError("'byteLength' must be a number.")}else if(void 0!==t)throw TypeError("'options' must be an object.");i=new Uint8Array(e,o,a)}else throw TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let a=(s.executionProviders||[]).map(e=>"string"==typeof e?e:e.name),l=await o(a);return new g(await l.createSessionHandler(i,s))}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}let _=g},9215:function(e,t,r){"use strict";r.d(t,{YS:function(){return R}});var n=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator"}),i=Object.freeze({set:n.Set,for:n.For,in:n.In,if:n.If,else:n.Else,endif:n.EndIf,elif:n.ElseIf,endfor:n.EndFor,and:n.And,or:n.Or,not:n.Not,"not in":n.NotIn,true:n.BooleanLiteral,false:n.BooleanLiteral}),s=class{constructor(e,t){this.value=e,this.type=t}};function o(e){return/\w/.test(e)}function a(e){return/[0-9]/.test(e)}var l=[["{%",n.OpenStatement],["%}",n.CloseStatement],["{{",n.OpenExpression],["}}",n.CloseExpression],["(",n.OpenParen],[")",n.CloseParen],["[",n.OpenSquareBracket],["]",n.CloseSquareBracket],[",",n.Comma],[".",n.Dot],[":",n.Colon],["|",n.Pipe],["<=",n.ComparisonBinaryOperator],[">=",n.ComparisonBinaryOperator],["==",n.ComparisonBinaryOperator],["!=",n.ComparisonBinaryOperator],["<",n.ComparisonBinaryOperator],[">",n.ComparisonBinaryOperator],["+",n.AdditiveBinaryOperator],["-",n.AdditiveBinaryOperator],["*",n.MultiplicativeBinaryOperator],["/",n.MultiplicativeBinaryOperator],["%",n.MultiplicativeBinaryOperator],["=",n.Equals]],h=new Map([["n","\n"],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]),u=class{type="Statement"},c=class extends u{constructor(e){super(),this.body=e}type="Program"},f=class extends u{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},p=class extends u{constructor(e,t,r){super(),this.loopvar=e,this.iterable=t,this.body=r}type="For"},d=class extends u{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},m=class extends u{type="Expression"},g=class extends m{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},_=class extends m{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},y=class extends m{constructor(e){super(),this.value=e}type="Identifier"},w=class extends m{constructor(e){super(),this.value=e}type="Literal"},b=class extends w{type="NumericLiteral"},v=class extends w{type="StringLiteral";constructor(e){super(e)}},x=class extends w{type="BooleanLiteral"},E=class extends m{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},A=class extends m{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},k=class extends m{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},z=class extends m{constructor(e,t,r){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"};function C(e,t,r,n=1){let i=Math.sign(n);i>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),r=(r??=e.length)<0?Math.max(e.length+r,0):Math.min(r,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),r=(r??=-1)<-1?Math.max(e.length+r,-1):Math.min(r,e.length-1));let s=[];for(let o=t;i*onew B(this.value.toUpperCase()))],["lower",new T(()=>new B(this.value.toLowerCase()))],["strip",new T(()=>new B(this.value.trim()))],["length",new M(this.value.length)]])},O=class extends I{type="BooleanValue"},S=class extends I{type="ObjectValue";__bool__(){return new O(this.value.size>0)}},U=class extends I{type="ArrayValue";builtins=new Map([["length",new M(this.value.length)]]);__bool__(){return new O(this.value.length>0)}},T=class extends I{type="FunctionValue"},$=class extends I{type="NullValue"},L=class extends I{type="UndefinedValue"},j=class{constructor(e){this.parent=e}variables=new Map;set(e,t){return this.declareVariable(e,function e(t){switch(typeof t){case"number":return new M(t);case"string":return new B(t);case"boolean":return new O(t);case"object":if(null===t)return new $;if(Array.isArray(t))return new U(t.map(e));return new S(new Map(Object.entries(t).map(([t,r])=>[t,e(r)])));case"function":return new T((r,n)=>e(t(...r.map(e=>e.value))??null));default:throw Error(`Cannot convert to runtime value: ${t}`)}}(t))}declareVariable(e,t){if(this.variables.has(e))throw SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){let r;try{r=this.resolve(e)}catch{}return(r??this).variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw Error(`Unknown variable: ${e}`)}lookupVariable(e){return this.resolve(e).variables.get(e)??new $}},F=class{global;constructor(e){this.global=e??new j}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){let r=this.evaluate(e.left,t),n=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new O(r.value==n.value);case"!=":return new O(r.value!=n.value);case"and":return r.__bool__().value?n:r;case"or":return r.__bool__().value?r:n}if(r instanceof L||n instanceof L)throw Error("Cannot perform operation on undefined values");if(r instanceof $||n instanceof $)throw Error("Cannot perform operation on null values");if(r instanceof M&&n instanceof M)switch(e.operator.value){case"+":return new M(r.value+n.value);case"-":return new M(r.value-n.value);case"*":return new M(r.value*n.value);case"/":return new M(r.value/n.value);case"%":return new M(r.value%n.value);case"<":return new O(r.value":return new O(r.value>n.value);case">=":return new O(r.value>=n.value);case"<=":return new O(r.value<=n.value)}else if(n instanceof U){let t=void 0!==n.value.find(e=>e.value===r.value);switch(e.operator.value){case"in":return new O(t);case"not in":return new O(!t)}}if((r instanceof B||n instanceof B)&&"+"===e.operator.value)return new B(r.value.toString()+n.value.toString());if(r instanceof B&&n instanceof B)switch(e.operator.value){case"in":return new O(n.value.includes(r.value));case"not in":return new O(!n.value.includes(r.value))}throw SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${n.type}`)}evaluateFilterExpression(e,t){let r=this.evaluate(e.operand,t);if(r instanceof U)switch(e.filter.value){case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new M(r.value.length);case"reverse":return new U(r.value.reverse());case"sort":return new U(r.value.sort((e,t)=>{if(e.type!==t.type)throw Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw Error(`Cannot compare type: ${e.type}`)}}));default:throw Error(`Unknown ArrayValue filter: ${e.filter.value}`)}else if(r instanceof B)switch(e.filter.value){case"length":return new M(r.value.length);case"upper":return new B(r.value.toUpperCase());case"lower":return new B(r.value.toLowerCase());case"title":return new B(r.value.replace(/\b\w/g,e=>e.toUpperCase()));case"capitalize":return new B(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new B(r.value.trim());default:throw Error(`Unknown StringValue filter: ${e.filter.value}`)}else if(r instanceof M){if("abs"===e.filter.value)return new M(Math.abs(r.value));throw Error(`Unknown NumericValue filter: ${e.filter.value}`)}throw Error(`Cannot apply filter "${e.filter.value}" to type: ${r.type}`)}evaluateUnaryExpression(e,t){let r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new O(!r.value);throw SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(let n of e){let e=this.evaluate(n,t);"NullValue"!==e.type&&(r+=e.value)}return new B(r=r.replace(/^\n/,""))}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){let r=e.args.map(e=>this.evaluate(e,t)),n=this.evaluate(e.callee,t);if("FunctionValue"!==n.type)throw Error(`Cannot call something that is not a function: got ${n.type}`);return n.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof U||e instanceof B))throw Error("Slice object must be an array or string");let n=this.evaluate(t.start,r),i=this.evaluate(t.stop,r),s=this.evaluate(t.step,r);if(!(n instanceof M||n instanceof L))throw Error("Slice start must be numeric or undefined");if(!(i instanceof M||i instanceof L))throw Error("Slice stop must be numeric or undefined");if(!(s instanceof M||s instanceof L))throw Error("Slice step must be numeric or undefined");return e instanceof U?new U(C(e.value,n.value,i.value,s.value)):new B(C(Array.from(e.value),n.value,i.value,s.value).join(""))}evaluateMemberExpression(e,t){let r,n;let i=this.evaluate(e.object,t);if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(i,e.property,t);r=this.evaluate(e.property,t)}else r=new B(e.property.value);if(i instanceof S){if(!(r instanceof B))throw Error(`Cannot access property with non-string: got ${r.type}`);n=i.value.get(r.value)??i.builtins.get(r.value)}else if(i instanceof U||i instanceof B){if(r instanceof M)n=i.value.at(r.value),i instanceof B&&(n=new B(i.value.at(r.value)));else if(r instanceof B)n=i.builtins.get(r.value);else throw Error(`Cannot access property with non-string/non-number: got ${r.type}`)}else{if(!(r instanceof B))throw Error(`Cannot access property with non-string: got ${r.type}`);n=i.builtins.get(r.value)}if(!(n instanceof I))throw Error(`${i.type} has no property '${r.value}'`);return n}evaluateSet(e,t){if("Identifier"!==e.assignee.type)throw Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);let r=e.assignee.value;return t.setVariable(r,this.evaluate(e.value,t)),new $}evaluateIf(e,t){let r=this.evaluate(e.test,t);return this.evaluateBlock(r.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){let r=new j(t),n=this.evaluate(e.iterable,r);if(!(n instanceof U))throw Error(`Expected iterable type in for loop: got ${n.type}`);let i="";for(let t=0;t[e,t])))),r.setVariable(e.loopvar.value,n.value[t]),i+=this.evaluateBlock(e.body,r).value;return new B(i)}evaluate(e,t){if(void 0===e)return new L;switch(e.type){case"Program":return this.evalProgram(e,t);case"Set":return this.evaluateSet(e,t);case"If":return this.evaluateIf(e,t);case"For":return this.evaluateFor(e,t);case"NumericLiteral":return new M(Number(e.value));case"StringLiteral":return new B(e.value);case"BooleanLiteral":return new O(e.value);case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);default:throw SyntaxError(`Unknown node type: ${e.type}`)}}},R=class{parsed;constructor(e){let t=function(e){let t=[],r=0,u=t=>{let n="";for(;t(e[r]);){if("\\"===e[r]){if(++r>=e.length)throw SyntaxError("Unexpected end of input");let t=e[r++],i=h.get(t);if(void 0===i)throw SyntaxError(`Unexpected escaped character: ${t}`);n+=i;continue}if(n+=e[r++],r>=e.length)throw SyntaxError("Unexpected end of input")}return n};e:for(;r0){t.push(new s(i,n.Text));continue}}u(e=>/\s/.test(e));let c=e[r];if("-"===c||"+"===c){let e=t.at(-1)?.type;if(e===n.Text||void 0===e)throw SyntaxError(`Unexpected character: ${c}`);switch(e){case n.Identifier:case n.NumericLiteral:case n.BooleanLiteral:case n.StringLiteral:case n.CloseParen:case n.CloseSquareBracket:break;default:{++r;let e=u(a);t.push(new s(`${c}${e}`,e.length>0?n.NumericLiteral:n.UnaryOperator));continue}}}for(let[n,i]of l)if(e.slice(r,r+n.length)===n){t.push(new s(n,i)),r+=n.length;continue e}if("'"===c){++r;let e=u(e=>"'"!==e);t.push(new s(e,n.StringLiteral)),++r;continue}if(a(c)){let e=u(a);t.push(new s(e,n.NumericLiteral));continue}if(o(c)){let e=u(o),r=Object.hasOwn(i,e)?i[e]:n.Identifier;r===n.In&&t.at(-1)?.type===n.Not?(t.pop(),t.push(new s("not in",n.NotIn))):t.push(new s(e,r));continue}throw SyntaxError(`Unexpected character: ${c}`)}return t}(e=e.replace(/%}\s+{%/g,"%}{%"));this.parsed=function(e){let t=new c([]),r=0;function i(t,n){let i=e[r++];if(!i||i.type!==t)throw Error(`Parser Error: ${n}. ${i.type} !== ${t}.`);return i}function s(...t){return r+t.length<=e.length&&t.every((t,n)=>t===e[r+n].type)}function o(){let t=a();for(;s(n.Or);){let n=e[r];++r,t=new E(n,t,a())}return t}function a(){let t=l();for(;s(n.And);){let n=e[r];++r,t=new E(n,t,l())}return t}function l(){let t;for(;s(n.Not);){let n=e[r];++r,t=new k(n,l())}return t??function(){let t=h();for(;s(n.ComparisonBinaryOperator)||s(n.In)||s(n.NotIn);){let n=e[r];++r,t=new E(n,t,h())}return t}()}function h(){let t=u();for(;s(n.AdditiveBinaryOperator);){let n=e[r];++r,t=new E(n,t,u())}return t}function u(){let t=m();for(;s(n.MultiplicativeBinaryOperator);){let n=e[r];++r,t=new E(n,t,m())}return t}function m(){let t=function(){let t=function(){let t=w();for(;s(n.Dot)||s(n.OpenSquareBracket);){let a;let l=e[r];++r;let h=l.type!==n.Dot;if(h)a=function(){let e=[],t=!1;for(;!s(n.CloseSquareBracket);)s(n.Colon)?(e.push(void 0),++r,t=!0):(e.push(o()),s(n.Colon)&&(++r,t=!0));if(0===e.length)throw SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw SyntaxError("Expected 0-3 arguments for slice expression");return new z(...e)}return e[0]}(),i(n.CloseSquareBracket,"Expected closing square bracket");else if("Identifier"!==(a=w()).type)throw SyntaxError("Expected identifier following dot operator");t=new g(t,a,h)}return t}();return s(n.OpenParen)?function e(t){let a=new _(t,function(){i(n.OpenParen,"Expected opening parenthesis for arguments list");let e=s(n.CloseParen)?[]:function(){let e=[o()];for(;s(n.Comma);)++r,e.push(o());return e}();return i(n.CloseParen,"Expected closing parenthesis for arguments list"),e}());return s(n.OpenParen)&&(a=e(a)),a}(t):t}();for(;s(n.Pipe);){++r;let e=w();if(!(e instanceof y))throw SyntaxError("Expected identifier for the filter");t=new A(t,e)}return t}function w(){let t=e[r];switch(t.type){case n.NumericLiteral:return++r,new b(Number(t.value));case n.StringLiteral:return++r,new v(t.value);case n.BooleanLiteral:return++r,new x("true"===t.value);case n.Identifier:return++r,new y(t.value);case n.OpenParen:{++r;let t=o();if(e[r].type!==n.CloseParen)throw SyntaxError("Expected closing parenthesis");return++r,t}default:throw SyntaxError(`Unexpected token: ${t.type}`)}}for(;rt!==e[r+n].type)}(n.OpenStatement,n.EndFor);)l.push(t());return new p(s,a,l)}(),i(n.OpenStatement,"Expected {% token"),i(n.EndFor,"Expected endfor token"),i(n.CloseStatement,"Expected %} token");break;default:throw SyntaxError(`Unknown statement type: ${e[r].type}`)}return a}();case n.OpenExpression:return function(){i(n.OpenExpression,"Expected opening expression token");let e=o();return i(n.CloseExpression,"Expected closing expression token"),e}();default:throw SyntaxError(`Unexpected token type: ${e[r].type}`)}}());return t}(t)}render(e){let t=new j;for(let[r,n]of(t.set("false",!1),t.set("true",!0),t.set("raise_exception",e=>{throw Error(e)}),Object.entries(e)))t.set(r,n);return new F(t).run(this.parsed).value}}},222:function(e,t,r){"use strict";let n;r.d(t,{ONNX:function(){return n},p:function(){return h}});var i,s,o=r(2525),a=r(6630),l=r(9079);let h=["wasm"];void 0!==l&&l?.release?.name==="node"?(n=o??(i||(i=r.t(o,2))),h.unshift("cpu")):(n=a??(s||(s=r.t(a,2))),"undefined"!=typeof navigator&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(n.env.wasm.simd=!1))},3785:function(e,t,r){"use strict";r.d(t,{z:function(){return o}});var n=r(8577);async function i(e,t){return await (0,n.yM)(e,"config.json",!0,t)}class s{constructor(e){this.model_type=null,this.is_encoder_decoder=!1,Object.assign(this,e)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:s=!1,revision:o="main"}={}){return new this(r??await i(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:s,revision:o}))}}class o{static async from_pretrained(...e){return s.from_pretrained(...e)}}},3467:function(e,t,r){"use strict";r.d(t,{O:function(){return g}});var n=r(8386),i=r(3342),s=r(4252);let{env:o}=r(222).ONNX,a="2.15.1",l="undefined"!=typeof self&&"caches"in self,h=!_(n),u=!_(i),c=h&&u,f=c?i.dirname(i.dirname(s.fileURLToPath("file:///home/waganawa/Documents/Code/javascript/onnx-upscale-js/node_modules/@xenova/transformers/src/env.js"))):"./",p=c?i.join(f,"/.cache/"):null,d="/models/",m=c?i.join(f,d):d;o.wasm.wasmPaths=c?i.join(f,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${a}/dist/`;let g={backends:{onnx:o,tfjs:{}},__dirname:f,version:a,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath:m,useFS:h,useBrowserCache:l,useFSCache:h,cacheDir:p,useCustomCache:!1,customCache:null};function _(e){return 0===Object.keys(e).length}},1008:function(e,t,r){"use strict";let n,i,s;r.d(t,{OBj:function(){return f.O},qCb:function(){return u.qC},EUT:function(){return eH}});var o=r(930),a=r(5227),l=r(8375),h=r(8577),u=r(7488),c=r(5118),f=r(3467),p=r(3380);let d="undefined"!=typeof self,m=d&&"DedicatedWorkerGlobalScope"===self.constructor.name;if(d)n=(e,t)=>{if(!self.OffscreenCanvas)throw Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},s=self.createImageBitmap,i=self.ImageData;else if(p)s=async e=>{let t=(await e.metadata()).channels,{data:r,info:n}=await e.raw().toBuffer({resolveWithObject:!0}),i=new y(new Uint8ClampedArray(r),n.width,n.height,n.channels);return void 0!==t&&t!==n.channels&&i.convert(t),i};else throw Error("Unable to load image processing library.");let g={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},_=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class y{constructor(e,t,r,n){this.data=e,this.width=t,this.height=r,this.channels=n}get size(){return[this.width,this.height]}static async read(e){if(e instanceof y)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);throw Error(`Unsupported input type: ${typeof e}`)}static async fromURL(e){let t=await (0,h.hn)(e);if(200!==t.status)throw Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);let r=await t.blob();return this.fromBlob(r)}static async fromBlob(e){if(d){let t=await s(e),r=n(t.width,t.height).getContext("2d");return r.drawImage(t,0,0),new this(r.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{let t=p(await e.arrayBuffer());return await s(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"===t);else throw Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new y(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,r=0;t=0?l=r:u=-r,i>=0?h=i:c=-i,a.drawImage(o,l,h,e,t,u,c,e,t),new y(a.getImageData(0,0,e,t).data,e,t,4).convert(s)}{let n=this.toSharp();if(r>=0&&i>=0)n=n.extract({left:Math.floor(r),top:Math.floor(i),width:e,height:t});else if(r<=0&&i<=0){let s=Math.floor(-i),o=Math.floor(-r);n=n.extend({top:s,left:o,right:e-this.width-o,bottom:t-this.height-s})}else{let s=[0,0],o=0;i<0?(s[0]=Math.floor(-i),s[1]=t-this.height-s[0]):o=Math.floor(i);let a=[0,0],l=0;r<0?(a[0]=Math.floor(-r),a[1]=e-this.width-a[0]):l=Math.floor(r),n=n.extend({top:s[0],bottom:s[1],left:a[0],right:a[1]}).extract({left:l,top:o,width:e,height:t})}return await s(n)}}async toBlob(e="image/png",t=1){if(!d)throw Error("toBlob() is only supported in browser environments.");let r=this.toCanvas();return await r.convertToBlob({type:e,quality:t})}toCanvas(){if(!d)throw Error("toCanvas() is only supported in browser environments.");let e=this.clone().rgba(),t=n(e.width,e.height),r=new i(e.data,e.width,e.height);return t.getContext("2d").putImageData(r,0,0),t}_update(e,t,r,n=null){return this.data=e,this.width=t,this.height=r,null!==n&&(this.channels=n),this}clone(){return new y(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(d){if(m)throw Error("Unable to save an image from a Web Worker.");let t=e.split(".").pop().toLowerCase(),r=_.get(t)??"image/png",n=await this.toBlob(r),i=URL.createObjectURL(n),s=document.createElement("a");s.href=i,s.download=e,s.click(),s.remove()}else if(f.O.useFS){let t=this.toSharp();return await t.toFile(e)}else throw Error("Unable to save the image because filesystem is disabled in this environment.")}toSharp(){if(d)throw Error("toSharp() is only supported in server-side environments.");return p(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}async function w(e,t){let r;if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");let n=await (await (0,h.hn)(e)).arrayBuffer(),i=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${i.sampleRate}Hz.`);let s=await i.decodeAudioData(n);if(2===s.numberOfChannels){let e=Math.sqrt(2),t=s.getChannelData(0),n=s.getChannelData(1);r=new Float32Array(t.length);for(let i=0;i2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,r=15,n=27/Math.log(6.4))=>e>=t?r+Math.log(e/t)*n:3*e/200};function x(e,t="htk"){let r=v[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}let E={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,r=15,n=Math.log(6.4)/27)=>e>=r?t*Math.exp(n*(e-r)):200*e/3};function A(e,t,r){let n=(t-e)/(r-1);return Float64Array.from({length:r},(t,r)=>e+n*r)}function k(e,t,r,n,i,s=null,o="htk",a=!1){let l;if(null!==s&&"slaney"!==s)throw Error('norm must be one of null or "slaney"');let h=A(x(r,o),x(n,o),t+2),u=function(e,t="htk"){let r=E[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}(h,o);if(a){let t=i/(2*e);l=x(Float64Array.from({length:e},(e,r)=>r*t),o),u=h}else l=A(0,Math.floor(i/2),e);let c=function(e,t){let r=Float64Array.from({length:t.length-1},(e,r)=>t[r+1]-t[r]),n=Array.from({length:e.length},()=>Array(t.length));for(let r=0;rArray(e.length));for(let t=0;ti)throw Error(`frame_length (${r}) may not be larger than fft_length (${i})`);if(x!==r)throw Error(`Length of the window (${x}) must equal frame_length (${r})`);if(n<=0)throw Error("hop_length must be greater than zero");if(o){if("reflect"!==a)throw Error(`pad_mode="${a}" not implemented yet.`);let t=Math.floor((i-1)/2)+1;e=function(e,t,r){let n=new e.constructor(e.length+t+r),i=e.length-1;for(let r=0;rE?b&&(C=w):C=k=w);let I=new u.vw(i),M=new Float64Array(i),B=new Float64Array(I.outputBufferSize),O=Array(k);for(let i=0;i=1;--e)M[e]-=c*M[e-1];M[0]*=1-c}for(let e=0;eMath.pow(e,.85));break;default:throw Error(`Unknown window type ${t}.`)}if(r&&(s=s.subarray(0,e)),null===n)return s;if(e>n)throw Error(`Length of the window (${e}) may not be larger than frame_length (${n})`);return s}function M(e,t=.5,r=null,n=!1){let i=e.logits,s=e.pred_boxes,[o,a,l]=i.dims;if(null!==r&&r.length!==o)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let h=[];for(let e=0;et&&s.push(e)}else{let e=(0,u.Fp)(i.data)[1];if(e===l-1)continue;s.push(e),r=(0,u.XA)(i.data)}for(let t of s){let n=p[e].data;n=function([e,t,r,n]){return[e-r/2,t-n/2,e+r/2,t+n/2]}(n),null!==o&&(n=n.map((e,t)=>e*o[(t+1)%2])),c.boxes.push(n),c.classes.push(t),c.scores.push(r[t])}}h.push(c)}return h}function B(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead.If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}function O(e,t,r=0,n=null){let i=Math.round(e/t)*t;return null!==n&&i>n&&(i=Math.floor(e/t)*t),ii?l=Math.floor(i*a/n):i>n&&(a=Math.floor(n*l/i)),await e.resize(l,a,{resample:r}))}async crop_margin(e,t=200){let r=e.clone().grayscale(),n=(0,u.VV)(r.data)[0],i=(0,u.Fp)(r.data)[0]-n;if(0===i)return e;let s=t/255,o=r.width,a=r.height,l=0,h=0;for(let e=0;ethis.preprocess(e)));return{pixel_values:(0,c.kn)(r.map(e=>e.pixel_values),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}class $ extends T{post_process_semantic_segmentation(e,t=null){let r=e.logits,n=r.dims[0];if(null!==t&&t.length!==n)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let i=[];for(let e=0;eh[r]&&(h[r]=t[r],l.data[r]=e)}let u=Array(s.dims[0]),f=l.data;for(let e=0;evoid 0!==e);i.push({segmentation:l,labels:p})}return i}}class L extends T{}class j extends T{}class F extends T{}class R extends T{}class N extends T{}class P extends T{}class q extends T{}class X extends T{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){let t=this.size?.shortest_edge;if(void 0===t)throw Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){let r=Math.floor(t/this.crop_pct),[n,i]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(n,i,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class D extends X{}class G extends T{}class V extends T{}class H extends T{}class W extends T{post_process_object_detection(...e){return M(...e)}}class K extends W{}class J extends T{}class Y extends T{}class Z extends T{pad_image(e,t,r,n={}){let[i,s,o]=t,a=this.image_mean;Array.isArray(this.image_mean)||(a=Array(o).fill(a));let l=this.image_std;Array.isArray(l)||(l=Array(o).fill(a));let h=a.map((e,t)=>-e/this.image_std[t]);return super.pad_image(e,t,r,{center:!0,constant_values:h,...n})}}class Q extends Z{}class ee extends T{async _call(e){let t=await super._call(e),r=[t.pixel_values.dims[0],64,64],n=new c.es("int64",new BigInt64Array(r.reduce((e,t)=>e*t)).fill(1n),r);return{...t,pixel_mask:n}}post_process_object_detection(...e){return M(...e)}remove_low_and_no_objects(e,t,r,n){let i=[],s=[],o=[];for(let a=0;ar&&(i.push(h),s.push(f),o.push(c))}return[i,s,o]}check_segment_validity(e,t,r,n=.5,i=.8){let s=[],o=0,a=0;for(let i=0;i=n&&++a;let l=o>0&&a>0;return l&&(l=o/a>i),[l,s]}compute_segments(e,t,r,n,i,s=null,o=null){let[a,l]=o??e[0].dims,h=new c.es("int32",new Int32Array(a*l),[a,l]),u=[];if(null!==o)for(let t=0;tp[t]&&(f[t]=r,p[t]=e[r].data[t])}let d=0;for(let s=0;se!==t.dims[r]))throw Error(`The first ${r.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new c.es("int64",e.flat(1/0).map(BigInt),r)}async _call(e,t=null,r=null){let n=await super._call(e);if(t&&(n.input_points=this.reshape_input_points(t,n.original_sizes,n.reshaped_input_sizes)),r){if(!n.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");n.input_labels=this.add_input_labels(r,n.input_points)}return n}post_process_masks(e,t,r,{mask_threshold:n=0,binarize:i=!0,pad_size:s=null}={}){let o=[],a=[(s=s??this.pad_size).height,s.width];for(let s=0;sn&&(e[t]=1);r=new c.es("bool",e,r.dims)}f.push(r)}o.push((0,c.kn)(f))}return o}}class en extends T{pad_image(e,t,r,n={}){let[i,s,o]=t;return super.pad_image(e,t,{width:i+(r-i%r)%r,height:s+(r-s%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...n})}}class ei extends T{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);let r=await Promise.all(e.map(e=>this.preprocess(e))),n=await Promise.all(t.map(e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,c.kn)(r.map((e,t)=>(0,c.d3)([e.pixel_values,n[t].pixel_values],0)),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}class es extends U{constructor(e){super(e),this.config.mel_filters??=k(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=I(this.config.n_fft,"hann")}_extract_fbank_features(e){let{data:t,dims:r}=C(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:this.config.nb_max_frames}),n=(0,u.Fp)(t)[0];for(let e=0;ethis.config.n_samples?(console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),t=e.slice(0,this.config.n_samples)):(t=new Float32Array(this.config.n_samples)).set(e);let{data:r,dims:n}=this._extract_fbank_features(t);return{input_features:new c.es("float32",r,[1,...n])}}}class eo extends U{_zero_mean_unit_var_norm(e){let t=e.reduce((e,t)=>e+t,0)/e.length,r=e.reduce((e,r)=>e+(r-t)**2,0)/e.length;return e.map(e=>(e-t)/Math.sqrt(r+1e-7))}async _call(e){B(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));let r=[1,t.length];return{input_values:new c.es("float32",t,r),attention_mask:new c.es("int64",new BigInt64Array(t.length).fill(1n),r)}}}class ea extends U{constructor(e){super(e);let t=this.config.sampling_rate,r=k(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e32768*e),this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:r=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:i=!0}={}){let s;B(e,"SeamlessM4TFeatureExtractor");let o=this._extract_fbank_features(e,this.config.max_length);if(n){let[e,t]=o.dims;for(let r=0;r0){let r=new Float32Array(t*(e+n));r.set(o.data),r.fill(this.config.padding_value,o.data.length);let a=e+n;o={data:r,dims:[a,t]},i&&(s=new c.es("int64",new BigInt64Array(a),[1,a])).data.fill(1n,0,e)}}let[a,l]=o.dims,h=this.config.stride;if(0!=a%h)throw Error(`The number of frames (${a}) must be a multiple of the stride (${h}).`);let u=new c.es("float32",o.data,o.dims).view(1,Math.floor(a/h),l*h),f={input_features:u};if(i){let e=u.dims[1],t=new c.es("int64",new BigInt64Array(e),[1,e]);if(s)for(let e=1,r=0;e0){if("rand_trunc"===r){s=!0;let r=Math.floor(Math.random()*(o+1));e=e.subarray(r,r+t),(i=this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)).dims=[1,...i.dims]}else throw Error(`Truncation strategy "${r}" not implemented`)}else{if(o<0){let r=new Float64Array(t);if(r.set(e),"repeat"===n)for(let n=e.length;ny.read(e)))}async function ew(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map(e=>"string"==typeof e||e instanceof URL?w(e,t):e instanceof Float64Array?new Float32Array(e):e))}function eb(e,t){t&&(e=e.map(e=>0|e));let[r,n,i,s]=e;return{xmin:r,ymin:n,xmax:i,ymax:s}}class ev extends l.Ag{constructor({task:e,model:t,tokenizer:r=null,processor:n=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=n}async dispose(){await this.model.dispose()}}class ex extends ev{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(r),i="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid().data:e=>(0,u.XA)(e.data),s=this.model.config.id2label,o=[];for(let e of n.logits){let r=i(e),n=(0,u.em)(r,t).map(e=>({label:s[e[0]],score:e[1]}));1===t?o.push(...n):o.push(n)}return Array.isArray(e)||1===t?o:o[0]}}class eE extends ev{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){let r=Array.isArray(e),n=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),i=(await this.model(n)).logits,s=this.model.config.id2label,o=[];for(let e=0;e[e,t]).filter(e=>e[1]>o),h=Array.from((0,u.XA)(i.end_logits[e].data)).map((e,t)=>[e,t]).filter(e=>e[1]>o),c=(0,l.O7)(a,h).filter(e=>e[0][1]<=e[1][1]).map(e=>[e[0][1],e[1][1],e[0][0]*e[1][0]]).sort((e,t)=>t[2]-e[2]);for(let e=0;e{let t=[...s];return t[o]=e[0],{score:e[1],token:e[0],token_str:this.tokenizer.model.vocab[e[0]],sequence:this.tokenizer.decode(t,{skip_special_tokens:!0})}}))}return Array.isArray(e)?i:i[0]}}class ez extends ev{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){let r;Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map(e=>this.model.config.prefix+e));let n=this.model.config.task_specific_params;n&&n[this.task]&&n[this.task].prefix&&(e=e.map(e=>n[this.task].prefix+e));let i=this.tokenizer,s={padding:!0,truncation:!0};r=this instanceof eI&&"_build_translation_inputs"in i?i._build_translation_inputs(e,s,t).input_ids:i(e,s).input_ids;let o=await this.model.generate(r,t);return i.batch_decode(o,{skip_special_tokens:!0}).map(e=>({[this._key]:e}))}}class eC extends ez{_key="summary_text";constructor(e){super(e)}}class eI extends ez{_key="translation_text";constructor(e){super(e)}}class eM extends ev{constructor(e){super(e)}async _call(e,t={}){let r=Array.isArray(e);r||(e=[e]);let n=t.add_special_tokens??!1;this.tokenizer.padding_side="left";let{input_ids:i,attention_mask:s}=this.tokenizer(e,{add_special_tokens:n,padding:!0,truncation:!0}),o=await this.model.generate(i,t,null,{inputs_attention_mask:s}),a=this.tokenizer.batch_decode(o,{skip_special_tokens:!0}),l=Array.from({length:e.length},e=>[]);for(let t=0;t[e.toLowerCase(),t])),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:r="This example is {}.",multi_label:n=!1}={}){let i=Array.isArray(e);i||(e=[e]),Array.isArray(t)||(t=[t]);let s=t.map(e=>r.replace("{}",e)),o=n||1===t.length,a=[];for(let r of e){let e=[];for(let t of s){let n=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}),i=await this.model(n);o?e.push([i.logits.data[this.contradiction_id],i.logits.data[this.entailment_id]]):e.push(i.logits.data[this.entailment_id])}let n=(o?e.map(e=>(0,u.XA)(e)[1]):(0,u.XA)(e)).map((e,t)=>[e,t]).sort((e,t)=>t[0]-e[0]);a.push({sequence:r,labels:n.map(e=>t[e[1]]),scores:n.map(e=>e[0])})}return i?a:a[0]}}class eO extends ev{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1}={}){let n=this.tokenizer(e,{padding:!0,truncation:!0}),i=await this.model(n),s=i.last_hidden_state??i.logits;if("none"===t);else if("mean"===t)s=(0,c.v6)(s,n.attention_mask);else if("cls"===t)s=s.slice(null,0);else throw Error(`Pooling method '${t}' not supported.`);return r&&(s=s.normalize(2,-1)),s}}class eS extends ev{constructor(e){super(e)}async _call(e,{topk:t=null}={}){let r=!Array.isArray(e),n=this.processor.feature_extractor.config.sampling_rate,i=await ew(e,n),s=this.model.config.id2label,o=[];for(let e of i){let r=await this.processor(e),n=(await this.model(r)).logits[0],i=(0,u.em)((0,u.XA)(n.data),t).map(e=>({label:s[e[0]],score:e[1]}));1===t?o.push(...i):o.push(i)}return r&&1!==t?o[0]:o}}class eU extends ev{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a sound of {}."}={}){let n=!Array.isArray(e);n&&(e=[e]);let i=t.map(e=>r.replace("{}",e)),s=this.tokenizer(i,{padding:!0,truncation:!0}),o=this.processor.feature_extractor.config.sampling_rate,a=await ew(e,o),l=[];for(let e of a){let r=await this.processor(e),n=await this.model({...s,...r}),i=(0,u.XA)(n.logits_per_audio.data);l.push([...i].map((e,r)=>({score:e,label:t[r]})))}return n?l[0]:l}}class eT extends ev{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"hubert":return this._call_wav2vec2(e,t);default:throw Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t={}){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');let r=!Array.isArray(e);r&&(e=[e]);let n=this.processor.feature_extractor.config.sampling_rate,i=await ew(e,n),s=[];for(let e of i){let t=await this.processor(e),r=(await this.model(t)).logits[0],n=[];for(let e of r)n.push((0,u.Fp)(e.data)[1]);let i=this.tokenizer.decode(n);s.push({text:i})}return r?s[0]:s}async _call_whisper(e,t={}){let r=t.return_timestamps??!1,n=t.chunk_length_s??0,i=t.chunk_callback??null,s=t.force_full_sequences??!1,o=t.stride_length_s??null;"word"===r&&(t.return_token_timestamps=!0);let a=(0,l.Sw)(t,"language",null),h=(0,l.Sw)(t,"task",null);if(a||h||r){if(t.forced_decoder_ids)throw Error("Cannot specify `language`/`task`/`return_timestamps` and `forced_decoder_ids` at the same time.");let e=this.tokenizer.get_decoder_prompt_ids({language:a,task:h,no_timestamps:!r});e.length>0&&(t.forced_decoder_ids=e)}let c=!Array.isArray(e);c&&(e=[e]);let f=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,p=this.processor.feature_extractor.config.hop_length,d=this.processor.feature_extractor.config.sampling_rate,m=await ew(e,d),g=[];for(let e of m){let a=[];if(n>0){if(null===o)o=n/6;else if(n<=o)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");let t=d*n,r=d*o,i=t-2*r,s=0;for(;s=e.length;a.push({stride:[n.length,l?0:r,h?0:r],input_features:o.input_features,is_last:h}),s+=i}}else a=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(let e of a){t.num_frames=Math.floor(e.stride[0]/p);let n=await this.model.generate(e.input_features,t);"word"===r?(e.tokens=n.sequences[0],e.token_timestamps=n.token_timestamps.tolist()[0].map(e=>(0,u.NM)(e,2))):e.tokens=n[0],e.stride=e.stride.map(e=>e/d),null!==i&&i(e)}let[l,h]=this.tokenizer._decode_asr(a,{time_precision:f,return_timestamps:r,force_full_sequences:s});g.push({text:l,...h})}return c?g[0]:g}}class e$ extends ev{constructor(e){super(e)}async _call(e,t={}){let r=Array.isArray(e),n=await ey(e),{pixel_values:i}=await this.processor(n),s=[];for(let e of i){e.dims=[1,...e.dims];let r=await this.model.generate(e,t),n=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map(e=>({generated_text:e.trim()}));s.push(n)}return r?s:s[0]}}class eL extends ev{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=Array.isArray(e),n=await ey(e),{pixel_values:i}=await this.processor(n),s=await this.model({pixel_values:i}),o=this.model.config.id2label,a=[];for(let e of s.logits){let r=(0,u.em)((0,u.XA)(e.data),t).map(e=>({label:o[e[0]],score:e[1]}));1===t?a.push(...r):a.push(r)}return r||1===t?a:a[0]}}class ej extends ev{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:r=.5,overlap_mask_area_threshold:n=.8,label_ids_to_fuse:i=null,target_sizes:s=null,subtask:o=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");let a=await ey(e),l=a.map(e=>[e.height,e.width]),{pixel_values:h,pixel_mask:u}=await this.processor(a),c=await this.model({pixel_values:h,pixel_mask:u}),f=null;if(null!==o)f=this.subtasks_mapping[o];else for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.feature_extractor){f=this.processor.feature_extractor[t].bind(this.processor.feature_extractor),o=e;break}let p=this.model.config.id2label,d=[];if("panoptic"===o||"instance"===o){let e=f(c,t,r,n,i,s??l)[0],o=e.segmentation;for(let t of e.segments_info){let e=new Uint8ClampedArray(o.data.length);for(let r=0;rr.replace("{}",e)),o=this.tokenizer(s,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:a}=await this.processor(i),l=await this.model({...o,pixel_values:a}),h="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,u.XA)(e.data),c=[];for(let e of l.logits_per_image){let r=[...h(e)].map((e,r)=>({score:e,label:t[r]}));r.sort((e,t)=>t.score-e.score),c.push(r)}return n?c:c[0]}}class eR extends ev{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){let n=Array.isArray(e);if(n&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");let i=await ey(e),s=r?null:i.map(e=>[e.height,e.width]),{pixel_values:o,pixel_mask:a}=await this.processor(i),l=await this.model({pixel_values:o,pixel_mask:a}),h=this.processor.feature_extractor.post_process_object_detection(l,t,s),u=this.model.config.id2label,c=h.map(e=>e.boxes.map((t,n)=>({score:e.scores[n],label:u[e.classes[n]],box:eb(t,!r)})));return n?c:c[0]}}class eN extends ev{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,topk:n=null,percentage:i=!1}={}){let s=Array.isArray(e),o=await ey(e),a=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(o),h=[];for(let e=0;e({score:p.scores[r],label:t[p.classes[r]],box:eb(e,!i)})).sort((e,t)=>t.score-e.score);null!==n&&(d=d.slice(0,n)),h.push(d)}return s?h:h[0]}}class eP extends ev{constructor(e){super(e)}async _call(e,t,r={}){let n=(await ey(e))[0],{pixel_values:i}=await this.processor(n),s=`${t}`,o=this.tokenizer(s,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,a=await this.model.generate(i,{...r,decoder_input_ids:o,max_length:this.model.config.decoder.max_position_embeddings}),l=this.tokenizer.batch_decode(a)[0].match(/(.*?)<\/s_answer>/),h=null;return l&&l.length>=2&&(h=l[1].trim()),[{answer:h}]}}class eq extends ev{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){let t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:r}=await this.model(t),n=this.model.config.sampling_rate;return{audio:r.data,sampling_rate:n}}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await a.$Sz.from_pretrained(this.DEFAULT_VOCODER_ID,{quantized:!1})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await (await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new c.es("float32",t,[1,t.length]);else if(!(t instanceof c.es))throw Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");let{input_ids:r}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:n}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),i=this.processor.feature_extractor.config.sampling_rate;return{audio:n.data,sampling_rate:i}}}class eX extends ev{constructor(e){super(e)}async _call(e){let t=await ey(e),r=await this.processor(t),n=await this.model(r),i=[];for(let e of n.reconstruction){let t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");i.push(y.fromTensor(t))}return i.length>1?i:i[0]}}class eD extends ev{constructor(e){super(e)}async _call(e){let t=await ey(e),r=await this.processor(t),{predicted_depth:n}=await this.model(r),i=[];for(let e=0;e1?i:i[0]}}let eG=Object.freeze({"text-classification":{tokenizer:o.t2,pipeline:ex,model:a.o$X,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:o.t2,pipeline:eE,model:a.OjJ,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:o.t2,pipeline:eA,model:a.wiU,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:o.t2,pipeline:ek,model:a.t78,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:o.t2,pipeline:eC,model:a.Kf0,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:o.t2,pipeline:eI,model:a.Kf0,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:o.t2,pipeline:ez,model:a.Kf0,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:o.t2,pipeline:eM,model:a.Hqk,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:o.t2,pipeline:eB,model:a.o$X,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:eS,model:a.K2m,processor:e_,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:o.t2,pipeline:eU,model:a.$Sz,processor:e_,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:o.t2,pipeline:eT,model:[a.hZO,a.ENH],processor:e_,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:o.t2,pipeline:eq,model:[a.z6E,a.lbf],processor:[e_,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:o.t2,pipeline:e$,model:a.tLj,processor:e_,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:eL,model:a.En$,processor:e_,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:ej,model:[a.U$$,a.$Bv],processor:e_,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:o.t2,pipeline:eF,model:a.$Sz,processor:e_,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:eR,model:a.Zn,processor:e_,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:o.t2,pipeline:eN,model:a.LdW,processor:e_,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:o.t2,pipeline:eP,model:a.DcG,processor:e_,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:eX,model:a.S2d,processor:e_,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:eD,model:a.hY6,processor:e_,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:o.t2,pipeline:eO,model:a.$Sz,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"}}),eV=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function eH(e,t=null,{quantized:r=!0,progress_callback:n=null,config:i=null,cache_dir:s=null,local_files_only:o=!1,revision:a="main"}={}){let h=eG[(e=eV[e]??e).split("_",1)[0]];if(!h)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(eG)}]`);t||(t=h.default.model,console.log(`No model specified. Using default model: "${t}".`));let u=new Map([["tokenizer",h.tokenizer],["model",h.model],["processor",h.processor]]),c=await eW(u,t,{quantized:r,progress_callback:n,config:i,cache_dir:s,local_files_only:o,revision:a});return c.task=e,(0,l.T2)(n,{status:"ready",task:e,model:t}),new h.pipeline(c)}async function eW(e,t,r){let n=Object.create(null),i=[];for(let[s,o]of e.entries()){let e;o&&(e=Array.isArray(o)?new Promise(async(e,n)=>{let i;for(let n of o){if(null===n){e(null);return}try{e(await n.from_pretrained(t,r));return}catch(e){i=e}}n(i)}):o.from_pretrained(t,r),n[s]=e,i.push(e))}for(let[e,t]of(await Promise.all(i),Object.entries(n)))n[e]=await t;return n}r(3785)},8375:function(e,t,r){"use strict";function n(e,t){e&&e(t)}function i(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e]))}function s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}r.d(t,{$2:function(){return i},Ag:function(){return o},Gg:function(){return h},O7:function(){return p},Sw:function(){return c},T2:function(){return n},Wy:function(){return l},eG:function(){return f},fU:function(){return a},hr:function(){return s},hs:function(){return d},jg:function(){return u}});let o=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}};function a(e){return e?.prototype?.__proto__?.constructor?.name==="TypedArray"}function l(e){return Number.isInteger(e)||"bigint"==typeof e}function h(e){return null!=e}function u(e){let t=[],r=e;for(;Array.isArray(r);)t.push(r.length),r=r[0];return t}function c(e,t,r){let n=e[t];if(void 0!==n)return delete e[t],n;if(void 0===r)throw Error(`Key ${t} does not exist in object.`);return r}function f(...e){return Array.prototype.concat.apply([],e)}function p(...e){return e.reduce((e,t)=>e.flatMap(e=>t.map(t=>[e,t])))}function d(e,t){return Math.abs((e+t)%(2*t)-t)}},2586:function(e,t,r){"use strict";r.d(t,{GA:function(){return i},Z3:function(){return n},pQ:function(){return o}});class n{constructor(e=(e,t)=>e>t){this._heap=[],this._comparator=e}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(let t of e)this._heap.push(t),this._siftUp();return this.size}pop(){let e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){let t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return(e<<1)+1}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){let r=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=r}_siftUp(){let e=this.size-1;for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)[]),this.endNodes=Array.from({length:this.len+1},()=>[]);let n=new a(this.bosTokenId,0,0,0,0),i=new a(this.eosTokenId,1,this.len,0,0);this.nodes.push(n.clone()),this.nodes.push(i.clone()),this.beginNodes[this.len].push(i),this.endNodes[0].push(n)}insert(e,t,r,n){let i=new a(n,this.nodes.length,e,t,r);this.beginNodes[e].push(i),this.endNodes[e+t].push(i),this.nodes.push(i)}viterbi(){let e=this.len,t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let r=0,n=null;for(let i of this.endNodes[t]){let t=i.backtraceScore+e.score;(null===n||t>r)&&(n=i.clone(),r=t)}if(null===n)return[];e.prev=n,e.backtraceScore=r}++t}let r=[],n=this.beginNodes[e][0].prev;if(null===n)return[];let i=n.clone();for(;null!==i.prev;)r.push(i.clone()),i=i.clone().prev.clone();return r.reverse(),r}piece(e){return this.sentence.slice(e.pos,e.pos+e.length)}tokens(){return this.viterbi().map(e=>this.piece(e))}tokenIds(){return this.viterbi().map(e=>e.tokenId)}}class a{constructor(e,t,r,n,i){this.tokenId=e,this.nodeId=t,this.pos=r,this.length=n,this.score=i,this.prev=null,this.backtraceScore=0}clone(){let e=new a(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}},3848:function(e,t,r){"use strict";r.d(t,{AE:function(){return g},C9:function(){return l},CJ:function(){return m},E:function(){return a},GU:function(){return u},Jj:function(){return p},Jm:function(){return s},Pg:function(){return c},Z4:function(){return y},aP:function(){return _},dZ:function(){return h},ez:function(){return d},jF:function(){return f}}),r(5118);var n=r(8375),i=r(7488);class s extends n.Ag{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){for(let r of t)this.processors.forEach(t=>t(e,r))}[Symbol.iterator](){return this.processors.values()}}class o extends n.Ag{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class a extends o{constructor(e){super(),this.force_token_map=Object.fromEntries(e??[])}_call(e,t){let r=this.force_token_map[e.length];return(0,n.Gg)(r)&&(t.data.fill(-1/0),t.data[r]=0),t}}class l extends o{constructor(e){super(),this.bos_token_id=e}_call(e,t){return 1===e.length&&(t.data.fill(-1/0),t.data[this.bos_token_id]=0),t}}class h extends o{constructor(e,t){super(),this.max_length=e,this.forced_eos_token_id=t}_call(e,t){}}class u extends o{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){if(e.length===this.begin_index)for(let e of this.begin_suppress_tokens)t.data[e]=-1/0;return t}}class c extends o{constructor(e){super(),this.eos_token_id=e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(e.forced_decoder_ids||[]).length+2,e.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){let r=t.data;if(r[this.no_timestamps_token_id]=-1/0,e.length===this.begin_index-1)return r.fill(-1/0),r[this.timestamp_begin]=0,t;let n=e.slice(this.begin_index),s=n.length>=1&&n[n.length-1]>=this.timestamp_begin,o=n.length<2||n[n.length-2]>=this.timestamp_begin;if(s&&(o?r.subarray(this.timestamp_begin).fill(-1/0):r.subarray(0,this.eos_token_id).fill(-1/0)),e.length===this.begin_index&&null!==this.max_initial_timestamp_index){let e=this.timestamp_begin+this.max_initial_timestamp_index;r.subarray(e+1).fill(-1/0)}let a=(0,i.CI)(r);return Math.log(a.subarray(this.timestamp_begin).map(Math.exp).reduce((e,t)=>e+t))>(0,i.Fp)(a.subarray(0,this.timestamp_begin))[0]&&r.subarray(0,this.timestamp_begin).fill(-1/0),t}}class f extends o{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){let t=e.length,r=[];for(let n=0;n0&&(n=n.map(e=>e/this.generation_config.temperature)),n}randomSelect(e){let t=Math.random()*e.reduce((e,t)=>e+t,0);for(let r=0;r1)return new v(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new w(e)}}class w extends y{sample(e,t=-1){let r=this.getLogits(e,t);return[[(0,i.Fp)(r)[1],0]]}}class b extends y{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),s=(0,i.em)(n,r),o=(0,i.XA)(s.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},()=>{let e=this.randomSelect(o);return[s[e][0],Math.log(o[e])]})}}class v extends y{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),s=(0,i.em)(n,r),o=(0,i.XA)(s.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},(e,t)=>[s[t][0],Math.log(o[t])])}}},8577:function(e,t,r){"use strict";r.d(t,{hn:function(){return f},st:function(){return g},yM:function(){return _}});var n=r(7147),i=r(1418),s=r(319),o=r(3467),a=r(8375),l=r(9079),h=r(3663).lW;globalThis.ReadableStream||(globalThis.ReadableStream=s.ReadableStream);class u{_CONTENT_TYPE_MAP={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=n.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=n.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();let r=this;this.body=new ReadableStream({start(e){r.arrayBuffer().then(t=>{e.enqueue(new Uint8Array(t)),e.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){let e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[e]??"application/octet-stream")}clone(){let e=new u(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await n.promises.readFile(this.filePath)).buffer}async blob(){let e=await n.promises.readFile(this.filePath);return new Blob([e],{type:this.headers.get("content-type")})}async text(){return await n.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function c(e,t=null){let r;try{r=new URL(e)}catch(e){return!1}return(!t||!!t.includes(r.hostname))&&("http:"===r.protocol||"https:"===r.protocol)}async function f(e){if(o.O.useFS&&!c(e))return new u(e);if(void 0===l||l?.release?.name!=="node")return fetch(e);{let t=!!l.env?.TESTING_REMOTELY,r=o.O.version,n=new Headers;if(n.set("User-Agent",`transformers.js/${r}; is_ci/${t};`),c(e,["huggingface.co","hf.co"])){let e=l.env?.HF_TOKEN??l.env?.HF_ACCESS_TOKEN;e&&n.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:n})}}let p={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class d{constructor(e){this.path=e}async match(e){let t=new u(i.join(this.path,e));return t.exists?t:void 0}async put(e,t){let r=h.from(await t.arrayBuffer()),s=i.join(this.path,e);try{await n.promises.mkdir(i.dirname(s),{recursive:!0}),await n.promises.writeFile(s,r)}catch(e){console.warn("An error occurred while writing the file to cache:",e)}}}async function m(e,...t){for(let r of t)try{let t=await e.match(r);if(t)return t}catch(e){continue}}async function g(e,t,r=!0,n={}){let i,s,l,h;if(!o.O.allowLocalModels){if(n.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!o.O.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}if((0,a.T2)(n.progress_callback,{status:"initiate",name:e,file:t}),!i&&o.O.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{i=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!i&&o.O.useFSCache&&(i=new d(n.cache_dir??o.O.cacheDir)),!i&&o.O.useCustomCache){if(!o.O.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!o.O.customCache.match||!o.O.customCache.put)throw Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");i=o.O.customCache}let u=n.revision??"main",g=w(e,t),_=w(o.O.localModelPath,g),b=w(o.O.remoteHost,o.O.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(u)),t),v="main"===u?g:w(e,u,t),x=i instanceof d?v:b,E=!1;i&&(l=await m(i,_,x));let A=void 0!==l;if(void 0===l){if(o.O.allowLocalModels){if(c(g)){if(n.local_files_only)throw Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${g}.`);if(!o.O.allowRemoteModels)throw Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${g}.`)}else try{l=await f(_),s=_}catch(e){console.warn(`Unable to load from local path "${_}": "${e}"`)}}if(void 0===l||404===l.status){if(n.local_files_only||!o.O.allowRemoteModels){if(!r)return null;throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${_}".`)}if(200!==(l=await f(b)).status)return function(e,t,r){if(!r)return null;let n=p[e]??`Error (${e}) occurred while trying to load file`;throw Error(`${n}: "${t}".`)}(l.status,b,r);s=x}E=i&&"undefined"!=typeof Response&&l instanceof Response&&200===l.status}(0,a.T2)(n.progress_callback,{status:"download",name:e,file:t});let k={status:"progress",name:e,file:t};return n.progress_callback?A&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(h=new Uint8Array(await l.arrayBuffer()),(0,a.T2)(n.progress_callback,{...k,progress:100,loaded:h.length,total:h.length})):h=await y(l,e=>{(0,a.T2)(n.progress_callback,{...k,...e})}):h=new Uint8Array(await l.arrayBuffer()),E&&s&&await i.match(s)===void 0&&await i.put(s,new Response(h,{headers:l.headers})).catch(e=>{console.warn(`Unable to add response to browser cache: ${e}.`)}),(0,a.T2)(n.progress_callback,{status:"done",name:e,file:t}),h}async function _(e,t,r=!0,n={}){let i=await g(e,t,r,n);return null===i?{}:JSON.parse(new TextDecoder("utf-8").decode(i))}async function y(e,t){let r=e.headers.get("Content-Length");null===r&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let n=parseInt(r??"0"),i=new Uint8Array(n),s=0,o=e.body.getReader();async function a(){let{done:e,value:r}=await o.read();if(e)return;let l=s+r.length;if(l>n){n=l;let e=new Uint8Array(n);e.set(i),i=e}return i.set(r,s),t({progress:(s=l)/n*100,loaded:s,total:n}),a()}return await a(),i}function w(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(RegExp("/$"),"")),t))).join("/")}},7488:function(e,t,r){"use strict";function n(e,[t,r,n],[i,s],o="bilinear",a=!1){let l=s/n,h=i/r,u=new e.constructor(i*s*t),c=r*n,f=i*s;for(let o=0;o=0;--e)i[e]=s,n[e]=t[r[e]],s*=n[e];let s=r.map((e,t)=>i[r.indexOf(t)]),o=new e.constructor(e.length);for(let r=0;r=0;--e)n+=i%t[e]*s[e],i=Math.floor(i/t[e]);o[n]=e[r]}return[o,n]}function s(e){let t=h(e)[0],r=e.map(e=>Math.exp(e-t)),n=r.reduce((e,t)=>e+t,0);return r.map(e=>e/n)}function o(e){return s(e).map(e=>Math.log(e))}function a(e,t=0){return e=Array.from(e).map((e,t)=>[t,e]).sort((e,t)=>t[1]-e[1]),null!==t&&t>0&&(e=e.slice(0,t)),e}function l(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let n=1;nt&&(t=e[n],r=n);return[Number(t),r]}function u(e){return e>0&&(e&e-1)==0}r.d(t,{CI:function(){return o},Fp:function(){return h},K0:function(){return i},NM:function(){return m},Nq:function(){return n},VV:function(){return l},XA:function(){return s},em:function(){return a},qC:function(){return d},vw:function(){return p}});class c{constructor(e){if(this.size=0|e,this.size<=1||!u(this.size))throw Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;ee;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<>>t&3)<>>1);for(let t=0;t>>1]=e[t];return r}toComplexArray(e,t){let r=t||this.createComplexArray();for(let t=0;t>>1],r[t+1]=0;return r}completeSpectrum(e){let t=this._csize,r=t>>>1;for(let n=2;n>=2;o>=2;o>>=2){let t=(a=s/o<<1)>>>2;for(n=0;n>>1,o>>>1)}else for(n=0,i=0;n>>1,o>>>1,r)}for(o>>=2;o>=2;o>>=2){let t=(a=s/o<<1)>>>2;for(n=0;n>1;++t){let r=(t+1-e)**2/2,n=Math.sqrt(a**2+l**2)**r,o=r*Math.atan2(l,a),h=2*t;i[h]=n*Math.cos(o),i[h+1]=n*Math.sin(o),s[h]=i[h],s[h+1]=-i[h+1]}this._slicedChirpBuffer=i.subarray(t,r),this._f=new c(n>>1),this._f.transform(this._chirpBuffer,s)}_transform(e,t,r){let n=this._buffer1,i=this._buffer2,s=this._outBuffer1,o=this._outBuffer2,a=this._chirpBuffer,l=this._slicedChirpBuffer,h=this._a;if(r)for(let e=0;e>1];n[e]=i*l[e],n[r]=i*l[r]}else for(let e=0;e=e.length&&(i=2*(e.length-1)-i),n[s++]=e[i]}n.sort(),r[t]=n[i]}return r}function m(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}},5118:function(e,t,r){"use strict";r.d(t,{J6:function(){return _},Ks:function(){return y},d3:function(){return d},es:function(){return a},f3:function(){return g},kn:function(){return m},p4:function(){return l},r6:function(){return w},sX:function(){return h},v6:function(){return u}});var n=r(222),i=r(7488);let s=Object.freeze({float32:Float32Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array}),o=n.ONNX.Tensor;class a{dims;type;data;size;constructor(...e){return e[0]instanceof o?Object.assign(this,e[0]):Object.assign(this,new o(e[0],e[1],e[2])),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let r=Number(t);if(Number.isInteger(r))return e._getitem(r)}return e[t]},set:(e,t,r)=>e[t]=r})}*[Symbol.iterator](){let[e,...t]=this.dims;if(t.length>0){let r=t.reduce((e,t)=>e*t);for(let n=0;n0))return new a(this.type,[this.data[e]],r);{let t=r.reduce((e,t)=>e*t);return this._subarray(e,t,r)}}indexOf(e){for(let t=0;te*t))throw Error(`cannot reshape array of size ${r} into shape (${t})`);let n=e;for(let e=t.length-1;e>=0;e--)n=n.reduce((r,n)=>{let i=r[r.length-1];return i.lengthi[1])throw Error(`Invalid slice: ${i}`);let e=[Math.max(i[0],0),Math.min(i[1],this.dims[n])];r.push(e),t.push(e[1]-e[0])}else throw Error(`Invalid slice: ${i}`)}let n=r.map(([e,t])=>t-e),i=n.reduce((e,t)=>e*t),s=new this.data.constructor(i),o=this.stride();for(let e=0;e=0;--i){let e=n[i];t+=(s%e+r[i][0])*o[i],s=Math.floor(s/e)}s[e]=this.data[t]}return new a(this.type,s,t)}transpose(...e){return l(this,e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,r=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);if(null===t){let t=this.data.reduce((t,r)=>t+r**e,0)**(1/e);return new a(this.type,[t],[])}t=p(t,this.dims.length);let n=this.dims.slice();n[t]=1;let i=new this.data.constructor(this.data.length/this.dims[t]);for(let r=0;r=0;--e){let r=this.dims[e];e!==t&&(s+=i%r*o,o*=n[e]),i=Math.floor(i/r)}i[s]+=this.data[r]**e}if(1!==e)for(let t=0;t=0;--r){let e=this.dims[r];r!==t&&(n+=i%e*s,s*=this.dims[r]),i=Math.floor(i/e)}this.data[e]/=r.data[n]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){let t=Array(e.length);for(let r=e.length-1,n=1;r>=0;--r)t[r]=n,n*=e[r];return t}(this.dims)}squeeze(e=null){return new a(this.type,this.data,c(this.dims,e))}squeeze_(e=null){return this.dims=c(this.dims,e),this}unsqueeze(e=null){return new a(this.type,this.data,f(this.dims,e))}unsqueeze_(e=null){return this.dims=f(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),n=this.dims.slice(e,t+1),i=this.dims.slice(t+1);return this.dims=[...r,n.reduce((e,t)=>e*t,1),...i],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let r=0;rn!==t?e*r:e,1);e[t]=this.data.length/r}return new a(this.type,this.data,e)}neg_(){for(let e=0;e1!==e):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter((e,r)=>1!==e||!t.includes(r))),e}function f(e,t){return t=p(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function p(e,t,r=null){if(e<-t||e>=t)throw Error(`IndexError: index ${e} is out of bounds for dimension${null===r?"":" "+r} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function d(e,t=0){t=p(t,e[0].dims.length);let r=e[0].dims.slice();r[t]=e.reduce((e,r)=>e+r.dims[t],0);let n=r.reduce((e,t)=>e*t,1),i=new e[0].data.constructor(n),s=e[0].type;if(0===t){let t=0;for(let r of e)i.set(r.data,t),t+=r.data.length}else{let n=0;for(let s=0;s=0;--i){let e=o.dims[i],h=a%e;i===t&&(h+=n),s+=h*l,l*=r[i],a=Math.floor(a/e)}i[s]=o.data[e]}n+=o.dims[t]}}return new a(s,i,r)}function m(e,t=0){return d(e.map(e=>e.unsqueeze(t)),t)}function g(e,t=null,r=1,n=!1){if(null===t){let t=e.data.reduce((e,t)=>e+t,0)/e.data.length,n=Math.sqrt(e.data.reduce((e,r)=>e+(r-t)**2,0)/(e.data.length-r)),i=new a(e.type,[t],[]);return[new a(e.type,[n],[]),i]}t=p(t,e.dims.length);let i=_(e,t,n),s=e.dims.slice();s[t]=1;let o=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r=0;--i){let r=e.dims[i];i!==t&&(n+=o%r*a,a*=s[i]),o=Math.floor(o/r)}o[n]+=(e.data[r]-i.data[n])**2}for(let n=0;ne+t,0);return new a(e.type,[t/e.data.length],[])}t=p(t,e.dims.length);let n=e.dims.slice();n[t]=1;let i=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r=0;--i){let r=e.dims[i];i!==t&&(s+=o%r*a,a*=n[i]),o=Math.floor(o/r)}i[s]+=e.data[r]}if(1!==e.dims[t])for(let r=0;r0||l>0;)switch(h.push(o-1),u.push(l-1),s[o][l].item()){case 0:--o,--l;break;case 1:--o;break;case 2:--l;break;default:throw Error(`Internal error in dynamic time warping. Unexpected trace[${o}, ${l}]. Please file a bug report.`)}return h.reverse(),u.reverse(),[h,u]}function w(e){return function(e){let t=e.reduce((e,t)=>e*t,1);return new a("int64",new BigInt64Array(t).fill(1n),e)}(e.dims)}}}]); \ No newline at end of file