overtime-live-trading-utils 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.prettierrc ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "singleQuote": true,
3
+ "printWidth": 120,
4
+ "tabWidth": 4,
5
+ "useTabs": false,
6
+ "trailingComma": "es5",
7
+ "semi": true,
8
+ "endOfLine": "auto"
9
+ }
package/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ //utils
2
+ export * from './src/utils/bookmakers';
3
+ export * from './src/utils/csvReader';
4
+ export * from './src/utils/gameMatching';
5
+ export * from './src/utils/odds';
6
+ export * from './src/utils/sports';
7
+ export * from './src/utils/spread';
8
+
9
+ //enums
10
+ export * from './src/enums/network';
package/main.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see main.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.thalesUtils=t():e.thalesUtils=t()}(self,(()=>(()=>{var e={9669:(e,t,r)=>{e.exports=r(1609)},5448:(e,t,r)=>{"use strict";var n=r(4867),i=r(6026),o=r(4372),s=r(5327),a=r(4097),u=r(4109),f=r(7985),l=r(5061),c=r(5655),h=r(5263);e.exports=function(e){return new Promise((function(t,r){var d,p=e.data,g=e.headers,y=e.responseType;function m(){e.cancelToken&&e.cancelToken.unsubscribe(d),e.signal&&e.signal.removeEventListener("abort",d)}n.isFormData(p)&&delete g["Content-Type"];var b=new XMLHttpRequest;if(e.auth){var w=e.auth.username||"",v=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";g.Authorization="Basic "+btoa(w+":"+v)}var _=a(e.baseURL,e.url);function E(){if(b){var n="getAllResponseHeaders"in b?u(b.getAllResponseHeaders()):null,o={data:y&&"text"!==y&&"json"!==y?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:n,config:e,request:b};i((function(e){t(e),m()}),(function(e){r(e),m()}),o),b=null}}if(b.open(e.method.toUpperCase(),s(_,e.params,e.paramsSerializer),!0),b.timeout=e.timeout,"onloadend"in b?b.onloadend=E:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(E)},b.onabort=function(){b&&(r(l("Request aborted",e,"ECONNABORTED",b)),b=null)},b.onerror=function(){r(l("Network Error",e,null,b)),b=null},b.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||c.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",b)),b=null},n.isStandardBrowserEnv()){var S=(e.withCredentials||f(_))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;S&&(g[e.xsrfHeaderName]=S)}"setRequestHeader"in b&&n.forEach(g,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete g[t]:b.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(b.withCredentials=!!e.withCredentials),y&&"json"!==y&&(b.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&b.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(d=function(e){b&&(r(!e||e&&e.type?new h("canceled"):e),b.abort(),b=null)},e.cancelToken&&e.cancelToken.subscribe(d),e.signal&&(e.signal.aborted?d():e.signal.addEventListener("abort",d))),p||(p=null),b.send(p)}))}},1609:(e,t,r)=>{"use strict";var n=r(4867),i=r(1849),o=r(321),s=r(7185),a=function e(t){var r=new o(t),a=i(o.prototype.request,r);return n.extend(a,o.prototype,r),n.extend(a,r),a.create=function(r){return e(s(t,r))},a}(r(5655));a.Axios=o,a.Cancel=r(5263),a.CancelToken=r(4972),a.isCancel=r(6502),a.VERSION=r(7288).version,a.all=function(e){return Promise.all(e)},a.spread=r(8713),a.isAxiosError=r(6268),e.exports=a,e.exports.default=a},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,r)=>{"use strict";var n=r(5263);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(4867),i=r(5327),o=r(782),s=r(3572),a=r(7185),u=r(4875),f=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:f.transitional(f.boolean),forcedJSONParsing:f.transitional(f.boolean),clarifyTimeoutError:f.transitional(f.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!n){var l=[s,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(o),i=Promise.resolve(e);l.length;)i=i.then(l.shift(),l.shift());return i}for(var c=e;r.length;){var h=r.shift(),d=r.shift();try{c=h(c)}catch(e){d(e);break}}try{i=s(c)}catch(e){return Promise.reject(e)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=l},782:(e,t,r)=>{"use strict";var n=r(4867);function i(){this.handlers=[]}i.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},4097:(e,t,r)=>{"use strict";var n=r(1793),i=r(7303);e.exports=function(e,t){return e&&!n(t)?i(e,t):t}},5061:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,i,o){var s=new Error(e);return n(s,t,r,i,o)}},3572:(e,t,r)=>{"use strict";var n=r(4867),i=r(8527),o=r(6502),s=r(5655),a=r(5263);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},7185:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){t=t||{};var r={};function i(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function o(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:i(void 0,e[r]):i(e[r],t[r])}function s(e){if(!n.isUndefined(t[e]))return i(void 0,t[e])}function a(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:i(void 0,e[r]):i(void 0,t[r])}function u(r){return r in t?i(e[r],t[r]):r in e?i(void 0,e[r]):void 0}var f={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return n.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=f[e]||o,i=t(e);n.isUndefined(i)&&t!==u||(r[e]=i)})),r}},6026:(e,t,r)=>{"use strict";var n=r(5061);e.exports=function(e,t,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},8527:(e,t,r)=>{"use strict";var n=r(4867),i=r(5655);e.exports=function(e,t,r){var o=this||i;return n.forEach(r,(function(r){e=r.call(o,e,t)})),e}},5655:(e,t,r)=>{"use strict";var n=r(4867),i=r(6016),o=r(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,f={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r(5448)),u),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||f.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||i&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){f.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){f.headers[e]=n.merge(s)})),e.exports=f},7288:e=>{e.exports={version:"0.24.0"}},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},5327:(e,t,r)=>{"use strict";var n=r(4867);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},7303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},4372:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},6016:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},4109:(e,t,r)=>{"use strict";var n=r(4867),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,s={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:(e,t,r)=>{"use strict";var n=r(7288).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,r){function i(e,t){return"[Axios v"+n+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,s){if(!1===e)throw new Error(i(n," has been removed"+(t?" in "+t:"")));return t&&!o[n]&&(o[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,s)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),i=n.length;i-- >0;){var o=n[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:i}},4867:(e,t,r)=>{"use strict";var n=r(1849),i=Object.prototype.toString;function o(e){return"[object Array]"===i.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function f(e){return"[object Function]"===i.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:o,isArrayBuffer:function(e){return"[object ArrayBuffer]"===i.call(e)},isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:u,isUndefined:s,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:f,isStream:function(e){return a(e)&&f(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):o(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},9742:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],u=o[1],f=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,u)),l=0,c=u>0?s-4:s;for(r=0;r<c;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],f[l++]=t>>16&255,f[l++]=t>>8&255,f[l++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[l++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[l++]=t>>8&255,f[l++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,f=n-i;a<f;a+=s)o.push(u(e,a,a+s>f?f:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8764:(e,t,r)=>{"use strict";const n=r(9742),i=r(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return f(e,t,r)}function f(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);const i=function(e){if(u.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||K(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,u.prototype),n}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(i)return n?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return L(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return B(this,t,r);case"base64":return O(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(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=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:w(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):w(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,i){let o,s=1,a=e.length,u=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;s=2,a/=2,u/=2,r/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(f(e,o)===f(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(f(e,o+n)!==f(t,n)){r=!1;break}if(r)return o}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(K(n))return s;e[r+s]=n}return s}function _(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function E(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return Y(z(t),e,r,n)}function R(e,t,r,n){return Y(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function O(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function L(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(o=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}t.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{const 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}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return f(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},u.allocUnsafe=function(e){return c(e)},u.allocUnsafeSlow=function(e){return c(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(J(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),J(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=u.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(J(t,Uint8Array))i+t.length>n.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?L(this,0,e):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if(J(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new 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 new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),f=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<a;++e)if(f[e]!==l[e]){o=f[e],s=l[e];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function x(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function B(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function A(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=X[e[n]];return i}function k(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function C(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function M(e,t,r,n,i){W(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function j(e,t,r,n,i){W(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function P(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,r,n,o){return t=+t,r>>>=0,o||P(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,o){return t=+t,r>>>=0,o||P(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Z((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=Z((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Z((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=Z((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||N(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||N(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(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},u.prototype.writeBigUInt64LE=Z((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Z((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(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},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(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},u.prototype.writeBigInt64LE=Z((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Z((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new 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<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=u.isBuffer(e)?e:u.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const D={};function F(e,t,r){D[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function q(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function W(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new D.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){V(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(n,i,o)}function V(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw V(e,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=q(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const $=/[^+/0-9A-Za-z-_]/g;function G(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function z(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}const X=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Z(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},3562:(e,t,r)=>{const{Transform:n}=r(2830),[i]=Buffer.from("\r"),[o]=Buffer.from("\n"),s={escape:'"',headers:null,mapHeaders:({header:e})=>e,mapValues:({value:e})=>e,newline:"\n",quote:'"',raw:!1,separator:",",skipComments:!1,skipLines:null,maxRowBytes:Number.MAX_SAFE_INTEGER,strict:!1};class a extends n{constructor(e={}){super({objectMode:!0,highWaterMark:16}),Array.isArray(e)&&(e={headers:e});const t=Object.assign({},s,e);t.customNewline=t.newline!==s.newline;for(const e of["newline","quote","separator"])void 0!==t[e]&&([t[e]]=Buffer.from(t[e]));t.escape=(e||{}).escape?Buffer.from(t.escape)[0]:t.quote,this.state={empty:t.raw?Buffer.alloc(0):"",escaped:!1,first:!0,lineNumber:0,previousEnd:0,rowLength:0,quoted:!1},this._prev=null,!1===t.headers&&(t.strict=!1),(t.headers||!1===t.headers)&&(this.state.first=!1),this.options=t,this.headers=t.headers}parseCell(e,t,r){const{escape:n,quote:i}=this.options;e[t]===i&&e[r-1]===i&&(t++,r--);let o=t;for(let s=t;s<r;s++)e[s]===n&&s+1<r&&e[s+1]===i&&s++,o!==s&&(e[o]=e[s]),o++;return this.parseValue(e,t,o)}parseLine(e,t,r){const{customNewline:n,escape:o,mapHeaders:s,mapValues:a,quote:u,separator:f,skipComments:l,skipLines:c}=this.options;r--,!n&&e.length&&e[r-1]===i&&r--;const h=f,d=[];let p=!1,g=t;if(l){const r="string"==typeof l?l:"#";if(e[t]===Buffer.from(r)[0])return}const y=e=>{if(this.state.first)return e;const t=d.length,r=this.headers[t];return a({header:r,index:t,value:e})};for(let n=t;n<r;n++){const t=!p&&e[n]===u,i=p&&e[n]===u&&n+1<=r&&e[n+1]===h,s=p&&e[n]===o&&n+1<r&&e[n+1]===u;if(t||i)p=!p;else if(s)n++;else if(e[n]===h&&!p){let t=this.parseCell(e,g,n);t=y(t),d.push(t),g=n+1}}if(g<r){let t=this.parseCell(e,g,r);t=y(t),d.push(t)}e[r-1]===h&&d.push(y(this.state.empty));const m=c&&c>this.state.lineNumber;if(this.state.lineNumber++,this.state.first&&!m)return this.state.first=!1,this.headers=d.map(((e,t)=>s({header:e,index:t}))),void this.emit("headers",this.headers);if(!m&&this.options.strict&&d.length!==this.headers.length){const e=new RangeError("Row length does not match headers");this.emit("error",e)}else m||this.writeRow(d)}parseValue(e,t,r){return this.options.raw?e.slice(t,r):e.toString("utf-8",t,r)}writeRow(e){const t=!1===this.headers?e.map(((e,t)=>t)):this.headers,r=e.reduce(((e,r,n)=>{const i=t[n];return null===i||(void 0!==i?e[i]=r:e[`_${n}`]=r),e}),{});this.push(r)}_flush(e){if(this.state.escaped||!this._prev)return e();this.parseLine(this._prev,this.state.previousEnd,this._prev.length+1),e()}_transform(e,t,r){"string"==typeof e&&(e=Buffer.from(e));const{escape:n,quote:s}=this.options;let a=0,u=e;this._prev&&(a=this._prev.length,u=Buffer.concat([this._prev,e]),this._prev=null);const f=u.length;for(let e=a;e<f;e++){const t=u[e],l=e+1<f?u[e+1]:null;if(this.state.rowLength++,this.state.rowLength>this.options.maxRowBytes)return r(new Error("Row exceeds the maximum size"));this.state.escaped||t!==n||l!==s||e===a?t!==s?this.state.quoted||(this.state.first&&!this.options.customNewline&&(t===o?this.options.newline=o:t===i&&l!==o&&(this.options.newline=i)),t===this.options.newline&&(this.parseLine(u,this.state.previousEnd,e+1),this.state.previousEnd=e+1,this.state.rowLength=0)):this.state.escaped?this.state.escaped=!1:this.state.quoted=!this.state.quoted:this.state.escaped=!0}return this.state.previousEnd===f?(this.state.previousEnd=0,r()):f-this.state.previousEnd<e.length?(this._prev=e,this.state.previousEnd-=f-e.length,r()):(this._prev=u,void r())}}e.exports=e=>new a(e)},7187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var i,o,s,f;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=u(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,f=l,console&&console.warn&&console.warn(f)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var f=u.length,l=p(u,f);for(r=0;r<f;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return f(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return f(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},645:(e,t)=>{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,f=u>>1,l=-7,c=r?i-1:0,h=r?-1:1,d=e[t+c];for(c+=h,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+c],c+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+c],c+=h,l-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,f=8*o-i-1,l=(1<<f)-1,c=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;e[r+d]=255&s,d+=p,s/=256,f-=8);e[r+d-p]|=128*g}},5717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},4281:e=>{"use strict";var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,s,a,u;if("string"==typeof t&&(o="not ",t.substr(0,4)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var f=("number"!=typeof u&&(u=0),u+1>(a=e).length||-1===a.indexOf(".",u)?"argument":"property");s='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(n(t,"type"))}return s+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},6753:(e,t,r)=>{"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var i=r(9481),o=r(4229);r(5717)(f,i);for(var s=n(o.prototype),a=0;a<s.length;a++){var u=s[a];f.prototype[u]||(f.prototype[u]=o.prototype[u])}function f(e){if(!(this instanceof f))return new f(e);i.call(this,e),o.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||process.nextTick(c,this)}function c(e){e.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(f.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(f.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},2725:(e,t,r)=>{"use strict";e.exports=i;var n=r(4605);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(5717)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},9481:(e,t,r)=>{"use strict";var n;e.exports=R,R.ReadableState=S,r(7187).EventEmitter;var i,o=function(e,t){return e.listeners(t).length},s=r(2503),a=r(8764).Buffer,u=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},f=r(4616);i=f&&f.debuglog?f.debuglog("stream"):function(){};var l,c,h,d=r(7327),p=r(1195),g=r(2457).getHighWaterMark,y=r(4281).q,m=y.ERR_INVALID_ARG_TYPE,b=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,v=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(5717)(R,s);var _=p.errorOrDestroy,E=["error","close","destroy","pause","resume"];function S(e,t,i){n=n||r(6753),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new d,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(2553).s),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function R(e){if(n=n||r(6753),!(this instanceof R))return new R(e);var t=this instanceof n;this._readableState=new S(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function O(e,t,r,n,o){i("readableAddChunk",t);var s,f=e._readableState;if(null===t)f.reading=!1,function(e,t){if(i("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?B(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,A(e)))}}(e,f);else if(o||(s=function(e,t){var r,n;return n=t,a.isBuffer(n)||n instanceof u||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(f,t)),s)_(e,s);else if(f.objectMode||t&&t.length>0)if("string"==typeof t||f.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),n)f.endEmitted?_(e,new v):L(e,f,t,!0);else if(f.ended)_(e,new b);else{if(f.destroyed)return!1;f.reading=!1,f.decoder&&!r?(t=f.decoder.write(t),f.objectMode||0!==t.length?L(e,f,t,!1):k(e,f)):L(e,f,t,!1)}else n||(f.reading=!1,k(e,f));return!f.ended&&(f.length<f.highWaterMark||0===f.length)}function L(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),k(e,t)}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),R.prototype.destroy=p.destroy,R.prototype._undestroy=p.undestroy,R.prototype._destroy=function(e,t){t(e)},R.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=a.from(e,t),t=""),r=!0),O(this,e,t,!1,r)},R.prototype.unshift=function(e){return O(this,e,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(e){l||(l=r(2553).s);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var T=1073741824;function x(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function B(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(A,e))}function A(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,P(e)}function k(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(C,e,t))}function C(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(i("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function N(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function M(e){i("readable nexttick read 0"),e.read(0)}function j(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),P(e),t.flowing&&!t.reading&&e.read(0)}function P(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function U(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function I(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(D,t,e))}function D(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function F(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}R.prototype.read=function(e){i("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return i("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?I(this):B(this),null;if(0===(e=x(e,t))&&t.ended)return 0===t.length&&I(this),null;var n,o=t.needReadable;return i("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&i("length less than watermark",o=!0),t.ended||t.reading?i("reading or ended",o=!1):o&&(i("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=x(r,t))),null===(n=e>0?U(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&I(this)),null!==n&&this.emit("data",n),n},R.prototype._read=function(e){_(this,new w("_read()"))},R.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,i("pipe count=%d opts=%j",n.pipesCount,t);var s=t&&!1===t.end||e===process.stdout||e===process.stderr?p:a;function a(){i("onend"),e.end()}n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",(function t(o,s){i("onunpipe"),o===r&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,i("cleanup"),e.removeListener("close",h),e.removeListener("finish",d),e.removeListener("drain",u),e.removeListener("error",c),e.removeListener("unpipe",t),r.removeListener("end",a),r.removeListener("end",p),r.removeListener("data",l),f=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}));var u=function(e){return function(){var t=e._readableState;i("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,P(e))}}(r);e.on("drain",u);var f=!1;function l(t){i("ondata");var o=e.write(t);i("dest.write",o),!1===o&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==F(n.pipes,e))&&!f&&(i("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function c(t){i("onerror",t),p(),e.removeListener("error",c),0===o(e,"error")&&_(e,t)}function h(){e.removeListener("finish",d),p()}function d(){i("onfinish"),e.removeListener("close",h),p()}function p(){i("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",c),e.once("close",h),e.once("finish",d),e.emit("pipe",r),n.flowing||(i("pipe resume"),r.resume()),e},R.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=F(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},R.prototype.on=function(e,t){var r=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,i("on readable",n.length,n.reading),n.length?B(this):n.reading||process.nextTick(M,this))),r},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(N,this),r},R.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(N,this),t},R.prototype.resume=function(){var e=this._readableState;return e.flowing||(i("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(j,e,t))}(this,e)),e.paused=!1,this},R.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var o in e.on("end",(function(){if(i("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(o){i("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(t.push(o)||(n=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var s=0;s<E.length;s++)e.on(E[s],this.emit.bind(this,E[s]));return this._read=function(t){i("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(R.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=r(5850)),c(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),R._fromList=U,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(R.from=function(e,t){return void 0===h&&(h=r(5167)),h(R,e,t)})},4605:(e,t,r)=>{"use strict";e.exports=l;var n=r(4281).q,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(6753);function f(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);u.call(this,e),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new s;return e.push(null)}r(5717)(l,u),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,r){r(new i("_transform()"))},l.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},l.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},4229:(e,t,r)=>{"use strict";function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var i;e.exports=R,R.WritableState=S;var o,s={deprecate:r(4927)},a=r(2503),u=r(8764).Buffer,f=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=r(1195),c=r(2457).getHighWaterMark,h=r(4281).q,d=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,g=h.ERR_MULTIPLE_CALLBACK,y=h.ERR_STREAM_CANNOT_PIPE,m=h.ERR_STREAM_DESTROYED,b=h.ERR_STREAM_NULL_VALUES,w=h.ERR_STREAM_WRITE_AFTER_END,v=h.ERR_UNKNOWN_ENCODING,_=l.errorOrDestroy;function E(){}function S(e,t,o){i=i||r(6753),e=e||{},"boolean"!=typeof o&&(o=t instanceof i),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=c(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(A,e,t),e._writableState.errorEmitted=!0,_(e,n)):(i(n),e._writableState.errorEmitted=!0,_(e,n),A(e,t))}(e,r,n,t,i);else{var o=x(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||T(e,r),n?process.nextTick(L,e,r,o,i):L(e,r,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function R(e){var t=this instanceof(i=i||r(6753));if(!t&&!o.call(R,this))return new R(e);this._writableState=new S(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),a.call(this)}function O(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function L(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),A(e,t)}function T(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,o=new Array(i),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)o[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;o.allBuffers=u,O(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,l=r.encoding,c=r.callback;if(O(e,t,!1,t.objectMode?1:f.length,f,l,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function B(e,t){e._final((function(r){t.pendingcb--,r&&_(e,r),t.prefinished=!0,e.emit("prefinish"),A(e,t)}))}function A(e,t){var r=x(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(B,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(5717)(R,a),S.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(S.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(o=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(e){return!!o.call(this,e)||this===R&&e&&e._writableState instanceof S}})):o=function(e){return e instanceof this},R.prototype.pipe=function(){_(this,new y)},R.prototype.write=function(e,t,r){var n,i=this._writableState,o=!1,s=!i.objectMode&&(n=e,u.isBuffer(n)||n instanceof f);return s&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=E),i.ending?function(e,t){var r=new w;_(e,r),process.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var i;return null===r?i=new b:"string"==typeof r||t.objectMode||(i=new d("chunk",["string","Buffer"],r)),!i||(_(e,i),process.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,o=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r)),t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var f=t.length<t.highWaterMark;if(f||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else O(e,t,!1,a,n,i,o);return f}(this,i,s,e,t,r)),o},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||T(this,e))},R.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(e,t,r){r(new p("_write()"))},R.prototype._writev=null,R.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,A(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),R.prototype.destroy=l.destroy,R.prototype._undestroy=l.undestroy,R.prototype._destroy=function(e,t){t(e)}},5850:(e,t,r)=>{"use strict";var n;function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=r(8610),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),f=Symbol("ended"),l=Symbol("lastPromise"),c=Symbol("handlePromise"),h=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[s];if(null!==t){var r=e[h].read();null!==r&&(e[l]=null,e[s]=null,e[a]=null,t(d(r,!1)))}}function g(e){process.nextTick(p,e)}var y=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((i(n={get stream(){return this[h]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[f])return Promise.resolve(d(void 0,!0));if(this[h].destroyed)return new Promise((function(t,r){process.nextTick((function(){e[u]?r(e[u]):t(d(void 0,!0))}))}));var r,n=this[l];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[f]?r(d(void 0,!0)):t[c](r,n)}),n)}}(n,this));else{var i=this[h].read();if(null!==i)return Promise.resolve(d(i,!1));r=new Promise(this[c])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),y);e.exports=function(e){var t,r=Object.create(m,(i(t={},h,{value:e,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,f,{value:e._readableState.endEmitted,writable:!0}),i(t,c,{value:function(e,t){var n=r[h].read();n?(r[l]=null,r[s]=null,r[a]=null,e(d(n,!1))):(r[s]=e,r[a]=t)},writable:!0}),t));return r[l]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[l]=null,r[s]=null,r[a]=null,t(e)),void(r[u]=e)}var n=r[s];null!==n&&(r[l]=null,r[s]=null,r[a]=null,n(d(void 0,!0))),r[f]=!0})),e.on("readable",g.bind(null,r)),r}},7327:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=a(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var u=r(8764).Buffer,f=r(2361).inspect,l=f&&f.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return u.alloc(0);for(var t,r,n,i=u.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=i,n=s,u.prototype.copy.call(t,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=u.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:l,value:function(e,t){return f(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&s(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},1195:e=>{"use strict";function t(e,t){n(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,e)):process.nextTick(n,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!i&&e?o._writableState?o._writableState.errorEmitted?process.nextTick(r,o):(o._writableState.errorEmitted=!0,process.nextTick(t,o,e)):process.nextTick(t,o,e):i?(process.nextTick(r,o),i(e)):process.nextTick(r,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},8610:(e,t,r)=>{"use strict";var n=r(4281).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||l()},f=t._writableState&&t._writableState.finished,l=function(){a=!1,f=!0,s||o.call(t)},c=t._readableState&&t._readableState.endEmitted,h=function(){s=!1,c=!0,a||o.call(t)},d=function(e){o.call(t,e)},p=function(){var e;return s&&!c?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):a&&!f?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},g=function(){t.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",l),t.on("abort",p),t.req?g():t.on("request",g)):a&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",h),t.on("finish",l),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",l),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",l),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",l),t.removeListener("end",h),t.removeListener("error",d),t.removeListener("close",p)}}},5167:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:(e,t,r)=>{"use strict";var n,i=r(4281).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function u(e){e()}function f(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var l,c=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var h=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var a=!1;e.on("close",(function(){a=!0})),void 0===n&&(n=r(8610)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);a=!0,o()}));var u=!1;return function(t){if(!a&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}(e,o,i>0,(function(e){l||(l=e),e&&h.forEach(u),o||(h.forEach(u),c(l))}))}));return t.reduce(f)}},2457:(e,t,r)=>{"use strict";var n=r(4281).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},2503:(e,t,r)=>{e.exports=r(7187).EventEmitter},9509:(e,t,r)=>{var n=r(8764),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},2830:(e,t,r)=>{e.exports=i;var n=r(7187).EventEmitter;function i(){n.call(this)}r(5717)(i,n),i.Readable=r(9481),i.Writable=r(4229),i.Duplex=r(6753),i.Transform=r(4605),i.PassThrough=r(2725),i.finished=r(8610),i.pipeline=r(9946),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",u));var s=!1;function a(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function f(e){if(l(),0===n.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",f),e.removeListener("error",f),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("error",f),e.on("error",f),r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e}},2553:(e,t,r)=>{"use strict";var n=r(9509).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=f,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=c,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.s=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},4927:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},2361:()=>{},4616:()=>{}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{NetworkId:()=>u,adjustSpreadOnOdds:()=>M,allowGame:()=>A,allowGameSportWithPeriodConstraint:()=>k,allowSoccerGame:()=>C,allowTennisMatch:()=>N,calculateImpliedOddsDifference:()=>h,checkOddsFromBookmakers:()=>c,findOddsForTeam:()=>B,gamesDatesMatching:()=>x,getBookmakersArray:()=>l,getSpreadData:()=>j,parseCsv:()=>v,readCsvFromUrl:()=>w,teamNamesMatching:()=>T}),"function"!=typeof Object.assign&&(Object.assign=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])}return r});var e=function(e){return parseFloat(e.toPrecision(12))};function t(e,r,n){return void 0===n||0==+n?Math[e](r):(r=+r,n=+n,isNaN(r)||"number"!=typeof n||n%1!=0?NaN:r<0?-t(e,-r,n):(r=r.toString().split("e"),+((r=(r=Math[e](+(r[0]+"e"+(r[1]?+r[1]-n:-n)))).toString().split("e"))[0]+"e"+(r[1]?+r[1]+n:n))))}var i,o,s={decimal:{from:function(e){if((e=parseFloat(e))<=1)throw new Error("Outside valid range.");return e},to:function(){return this.decimalValue}},moneyline:{from:function(e){return(e=parseFloat(e))>=0?e/100+1:100/-e+1},to:function(){return this.decimalValue>=2?e(100*(this.decimalValue-1)):e(-100/(this.decimalValue-1))}},hongKong:{from:function(e){if((e=parseFloat(e))<0)throw new Error("Outside valid range.");return e+1},to:function(){return e(this.decimalValue-1)}},impliedProbability:{from:function(e){if((e="string"==typeof e&&"%"==e.slice(-1)?parseFloat(e)/100:parseFloat(e))<=0||e>=1)throw new Error("Outside valid range");return 1/e},to:function(r){if(r.percentage){var n=e(100/this.decimalValue);return null!==r.precision&&(n=t("round",n,-r.precision)),n.toString()+"%"}return e(1/this.decimalValue)}},fractional:{from:function(e){var t,r=e.toString().split("/");if(e=parseFloat(r[0]),2===r.length)t=parseFloat(r[1]);else{if(1!==r.length)throw new Error("Invalid fraction");t=1}if(0===e||0===t||e/t<=0)throw new Error("Outside valid range");return 1+e/t},to:function(e){return function(e,t){for(var r,n=[0,1],i=[1,0],o=function(e){var t=null,r=e.toString().indexOf("E");-1==r&&(r=e.toString().indexOf("e"));var n=null,i=(t=-1==r?e.toString():e.toString().substring(0,r)).toString().indexOf(".");-1==i?n=t:0===i?n=t.substring(1,t.length):i<t.length&&(n=t.substring(0,i)+t.substring(i+1,t.length));var o=n,s=o.toString().length,a=e,u=a.toString().length;0===a&&(u=0);var f,l=s-u;for(f=l;f>0&&o%2==0;f--)o/=2;for(f=l;f>0&&o%5==0;f--)o/=5;return o}(e),s=e,a=Math.pow(10,-t)/2,u=2;u<1e3;u++){var f=Math.floor(s);if(n[u]=f*n[u-1]+n[u-2],Math.abs(n[u])>o)return;if(i[u]=f*i[u-1]+i[u-2],r=n[u]/i[u],Math.abs(r-e)<a||NaN==r)return n[u].toString()+"/"+i[u].toString();s=1/(s-f)}}(this.decimalValue-1,e.precision||12)}},malay:{from:function(e){if((e=parseFloat(e))<=-1||e>1)throw new Error("Outside valid range.");return e<0&&(e=-1/e),e+1},to:function(){return this.decimalValue<=2?e(this.decimalValue-1):e(-1/(this.decimalValue-1))}},indonesian:{from:function(e){if(0===(e=parseFloat(e)))throw new Error("Outside valid range.");return e>=1?e+1:-1/e+1},to:function(){return this.decimalValue<2?e(-1/(this.decimalValue-1)):e(this.decimalValue-1)}}},a=((o=function(t){if("number"!=typeof t||isNaN(t))throw new Error("Invalid odds");this.decimalValue=e(t)}).prototype=(i=function(){throw new Error("This constructor is private, please use the from* functions")}).prototype,i.from=function(e,t){if(!s.hasOwnProperty(e))throw new Error("Unknown format "+e+".");var r=s[e].from(t);return new o(r)},i);a.prototype.to=function(e,r){if(!s.hasOwnProperty(e))throw new Error("Unknown format "+e+".");r=Object.assign({precision:null,percentage:!1},r);var n=s[e].to.call(this,r);return"number"==typeof n&&null!==r.precision&&(n=t("round",n,-r.precision)),n};var u,f=a.from,l=function(e,t,r){var n=e.find((function(e){return Number(e.sportId)===Number(t)}));if(n){if(""==n.primaryBookmaker)return r;var i=[];return n.primaryBookmaker&&i.push(n.primaryBookmaker),n.secondaryBookmaker&&i.push(n.secondaryBookmaker),n.tertiaryBookmaker&&i.push(n.tertiaryBookmaker),i}return r},c=function(e,t,r,n,i){var o=t.some((function(t){var n=e.get(t);return!!n&&(0===n.homeOdds||0===n.awayOdds||!r&&0===n.drawOdds||1===n.homeOdds||1===n.awayOdds||!r&&1===n.drawOdds)}));if(1==t.length){if(o)return[{homeOdds:0,awayOdds:0,drawOdds:0}];var s=t[0],a=e.get(s);return[{homeOdds:a.homeOdds,awayOdds:a.awayOdds,drawOdds:r?0:a.drawOdds}]}if(o)return[{homeOdds:0,awayOdds:0,drawOdds:0}];var u=e.get(t[0]),l=u.homeOdds,c=u.awayOdds,d=u.drawOdds;if(t.slice(1).some((function(t){var o=e[t];if(o){var s=o.homeOdds,a=o.awayOdds,u=o.drawOdds,p=f("decimal",l).to("impliedProbability"),g=f("decimal",c).to("impliedProbability"),y=r?0:f("decimal",d).to("impliedProbability"),m=f("decimal",s).to("impliedProbability"),b=f("decimal",a).to("impliedProbability"),w=r?0:f("decimal",u).to("impliedProbability"),v=h(p,m),_=h(g,b),E=r?0:h(y,w);if(v>n&&p>i&&m>i||_>n&&g>i&&b>i||!r&&E>n&&y>i&&w>i)return!0}return!1})))return console.log("Returning zero odds due to percentage difference"),[{homeOdds:0,awayOdds:0,drawOdds:0}];var p=[];return t.forEach((function(t){return p.push(e.get(t))})),null!=p[0]?p.map((function(e){return{homeOdds:e.homeOdds,awayOdds:e.awayOdds,drawOdds:r?0:e.drawOdds}})):(console.log("Returning zero odds cause no matching bookmakers have been found"),[{homeOdds:0,awayOdds:0,drawOdds:0}])},h=function(e,t){var r=Math.abs(e-t)/e*100;return console.log("% diff: "+r),r},d=r(9669),p=r.n(d),g=r(3562),y=r.n(g),m=r(2830),b=r.n(m),w=function(e){return t=void 0,r=void 0,i=function(){var t,r,n,i;return function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,p().get(e)];case 1:return t=o.sent(),r=t.data,(n=new(b().Readable)).push(r),n.push(null),[4,v(n)];case 2:return[2,o.sent()];case 3:throw i=o.sent(),console.error("Failed to read CSV from URL: ".concat(e),i),i;case 4:return[2]}}))},new((n=void 0)||(n=Promise))((function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(s,a)}u((i=i.apply(t,r||[])).next())}));var t,r,n,i},v=function(e){return new Promise((function(t,r){var n=[];e.pipe(y()()).on("data",(function(e){return n.push(e)})).on("end",(function(){return t(n)})).on("error",(function(e){return r(e)}))}))},_="Soccer",E="Basketball",S="Baseball",R="Hockey",O="Tennis",L=[9977,9983,10138,153,156],T=function(e,t,r,n,i,o){var s,a;if(L.includes(e)?(s=n.toLowerCase()==t.toLowerCase()||n.toLowerCase()==r.toLowerCase(),a=i.toLowerCase()==t.toLowerCase()||i.toLowerCase()==r.toLowerCase()):(s=n.toLowerCase()==t.toLowerCase(),a=i.toLowerCase()==r.toLowerCase()),!0!==s){var u=o.get(n.toLowerCase()),f=o.get(t.toLowerCase()),l=o.get(r.toLowerCase());if([u,f].some((function(e){return null==e})))return!1;s=L.includes(e)?u==f||u==l:u==f}if(!0!==a){var c=o.get(i.toLowerCase());if(f=o.get(t.toLowerCase()),[c,l=o.get(r.toLowerCase())].some((function(e){return null==e})))return!1;a=L.includes(e)&&c==f||c==l}return s&&a},x=function(e,t,r,n){var i;if(r===O){var o=t.getTime(),s=e.getTime();i=Math.abs(s-o)<=Number(60*n*1e3)}else i=t.toUTCString()==e.toUTCString();return i},B=function(e,t,r,n,i){var o=new Map;return e.forEach((function(e){var s,a,u=t.odds.filter((function(t){return t.sports_book_name.toLowerCase()==e.toLowerCase()})),f=n.get(r.homeTeam.toLowerCase()),l=n.get(r.awayTeam.toLowerCase()),c=0;null!=(s=null==f?u.find((function(e){var t=n.get(e.name.toLowerCase());return null==t?e.name.toLowerCase()==r.homeTeam.toLowerCase():t==r.homeTeam.toLowerCase()})):u.find((function(e){var t=n.get(e.name.toLowerCase());return null==t?e.name.toLowerCase()==f:t==f})))&&(c=s.price);var h=0;null!=(a=null==l?u.find((function(e){var t=n.get(e.name.toLowerCase());return null==t?e.name.toLowerCase()==r.awayTeam.toLowerCase():t==r.awayTeam.toLowerCase()})):u.find((function(e){var t=n.get(e.name.toLowerCase());return null==t?e.name.toLowerCase()==l:t==l})))&&(h=a.price);var d=0;if(i){var p=u.find((function(e){return"draw"==e.name.toLowerCase()}));null!=p&&(d=p.price)}o.set(e.toLowerCase(),{homeOdds:c,awayOdds:h,drawOdds:d})})),o},A=function(e,t,r,n){var i,o=e.score_home_total,s=e.score_away_total,a=e.clock,u=e.period,f=e.status,l=e.home_team,c=e.away_team;return"completed"==f.toLowerCase()?(console.log("Blocking game ".concat(l," - ").concat(c," because it is no longer live.")),null):(r===E&&(i=k(l,c,u,n.get(E))),r===R&&(i=k(l,c,u,n.get(R))),r===S&&(i=k(l,c,u,n.get(S))),r===_&&(i=C(l,c,a,n.get(_))),r===O&&(i=N(e,l,c,u,o,s,t)),i)},k=function(e,t,r,n){return Number(r)>=n?{allow:!1,message:"Blocking game ".concat(e," - ").concat(t," due to period: ").concat(r,". period")}:{allow:!0,message:""}},C=function(e,t,r,n){var i=Number(r);return!Number.isNaN(i)&&i>=n||Number.isNaN(i)&&"HALF"!=r?{allow:!1,message:"Blocking game ".concat(e," - ").concat(t," due to clock: ").concat(r,"min")}:{allow:!0,message:""}},N=function(e,t,r,n,i,o,s){var a,u,f=Number(n),l="atp"==e.league.toLowerCase();if(153==s&&l){if(2==Number(i)||2==Number(o)){switch(f){case 3:a=Number(e.score_home_period_3),u=Number(e.score_away_period_3);break;case 4:a=Number(e.score_home_period_4),u=Number(e.score_away_period_4);break;case 5:a=Number(e.score_home_period_5),u=Number(e.score_away_period_5)}return 2==Number(i)&&a>=5||2==Number(o)&&u>=5?{allow:!1,message:"Blocking game ".concat(t," - ").concat(r," due to current result: ").concat(i," - ").concat(o," (").concat(a," - ").concat(u,")")}:{allow:!0,message:"",currentHomeGameScore:a,currentAwayGameScore:u}}}else if(1==Number(i)||1==Number(o)){switch(f){case 2:a=Number(e.score_home_period_2),u=Number(e.score_away_period_2);break;case 3:a=Number(e.score_home_period_3),u=Number(e.score_away_period_3)}return 1==Number(i)&&a>=5||1==Number(o)&&u>=5?{allow:!1,message:"Blocking game ".concat(t," - ").concat(r," due to current result: ").concat(i," - ").concat(o," (").concat(a," - ").concat(u,")")}:{allow:!0,message:"",currentHomeGameScore:a,currentAwayGameScore:u}}},M=function(e,t,r){if(e.some((function(e){return 0===e})))return e;var n=e.reduce((function(e,t){return e+t}),0);if(n<=1)return Array(e.length).fill(0);if(0===r){if(!(t>100*(n-1)))return e;r=t}var i=1+r/100,o=i/n,s=e.map((function(e){return e*o}));if(s.some((function(e){return e>=1})))return Array(e.length).fill(0);var a=s.reduce((function(e,t){return e+t}),0);if(a<1)return Array(e.length).fill(0);var u=i/a;return s.map((function(e){return e*u}))},j=function(e,t,r,n){var i=e.find((function(e){return Number(e.typeId)===Number(r)&&Number(e.sportId)===Number(t)}));return i?{minSpread:i.minSpread?Number(i.minSpread):n,targetSpread:i.targetSpread?Number(i.targetSpread):0}:{minSpread:n,targetSpread:0}};!function(e){e[e.Mainnet=1]="Mainnet",e[e.OptimismMainnet=10]="OptimismMainnet",e[e.PolygonMainnet=137]="PolygonMainnet",e[e.ZkSyncSepolia=300]="ZkSyncSepolia",e[e.ZkSync=324]="ZkSync",e[e.Base=8453]="Base",e[e.Arbitrum=42161]="Arbitrum",e[e.OptimismSepolia=11155420]="OptimismSepolia",e[e.BlastSepolia=168587773]="BlastSepolia"}(u||(u={}))})(),n})()));
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "overtime-live-trading-utils",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "main.js",
6
+ "scripts": {
7
+ "pack": "webpack --mode production",
8
+ "prepublish": "npm run pack"
9
+ },
10
+ "author": "",
11
+ "license": "MIT",
12
+ "dependencies": {
13
+ "@types/node": "^20.8.10",
14
+ "axios": "^0.24.0",
15
+ "buffer": "^6.0.3",
16
+ "csv-parser": "^3.0.0",
17
+ "oddslib": "^2.1.1",
18
+ "react": "^17.0.1",
19
+ "stream-browserify": "^3.0.0"
20
+ },
21
+ "devDependencies": {
22
+ "ts-loader": "^9.5.0",
23
+ "typescript": "^4.5.5",
24
+ "webpack": "^5.89.0",
25
+ "webpack-cli": "^5.1.4"
26
+ }
27
+ }
@@ -0,0 +1,80 @@
1
+ export const Sport = {
2
+ SOCCER: 'Soccer',
3
+ FOOTBALL: 'Football',
4
+ BASKETBALL: 'Basketball',
5
+ BASEBALL: 'Baseball',
6
+ HOCKEY: 'Hockey',
7
+ FIGHTING: 'Fighting',
8
+ TENNIS: 'Tennis',
9
+ ESPORTS: 'eSports',
10
+ CRICKET: 'Cricket',
11
+ MOTOSPORT: 'Motosport',
12
+ GOLF: 'Golf',
13
+ EMPTY: '',
14
+ };
15
+
16
+ export const League = {
17
+ NCAAF: 1,
18
+ NFL: 2,
19
+ MLB: 3,
20
+ NBA: 4,
21
+ NCAAB: 5,
22
+ NHL: 6,
23
+ UFC: 7,
24
+ WNBA: 8,
25
+ MLS: 10,
26
+ EPL: 11,
27
+ LIGUE_ONE: 12,
28
+ BUNDESLIGA: 13,
29
+ LA_LIGA: 14,
30
+ SERIE_A: 15,
31
+ UEFA_CL: 16,
32
+ UEFA_EL: 17,
33
+ FIFA_WC: 18,
34
+ J1_LEAGUE: 19,
35
+ IPL: 20,
36
+ T20_BLAST: 21,
37
+ IIHF_WORLD_CHAMPIONSHIP: 33,
38
+ COPA_AMERICA: 44,
39
+ COPA_LIBERTADORES: 45,
40
+ UEFA_EURO: 50,
41
+ EREDIVISIE: 57,
42
+ PRIMEIRA_LIGA: 61,
43
+ FIFA_WC_WOMEN: 76,
44
+ ENGLAND_CUP: 132,
45
+ FRANCE_CUP: 134,
46
+ SPAIN_CUP: 138,
47
+ ITALY_CUP: 141,
48
+ TENNIS_GS: 153,
49
+ TENNIS_MASTERS: 156,
50
+ GERMANY_CUP: 209,
51
+ LIGA_MX: 230,
52
+ BRAZIL_1: 268,
53
+ UEFA_EURO_U21: 288,
54
+ FIFA_WORLD_CUP_U20: 296,
55
+ EUROLEAGUE: 399,
56
+ FIBA_WORLD_CUP: 409,
57
+ FORMULA1: 445,
58
+ MOTOGP: 497,
59
+ SAUDI_PROFESSIONAL_LEAGUE: 536,
60
+ BOXING: 9196,
61
+ UEFA_NATIONS_LEAGUE: 9806,
62
+ CONCACAF_NATIONS_LEAGUE: 9821,
63
+ CSGO: 9977,
64
+ DOTA2: 9983,
65
+ SUMMER_OLYMPICS_QUALIFICATION: 10502,
66
+ LOL: 10138,
67
+ CONMEBOL_WC_QUALIFICATIONS: 10199,
68
+ UEFA_CONFERENCE_LEAGUE: 10216,
69
+ NON_TITLE_BOXING: 10595,
70
+ GOLF_H2H: 100021,
71
+ GOLF_WINNER: 100121,
72
+ };
73
+
74
+ export const LEAGUES_NO_FORMAL_HOME_AWAY = [
75
+ League.CSGO,
76
+ League.DOTA2,
77
+ League.LOL,
78
+ League.TENNIS_GS,
79
+ League.TENNIS_MASTERS,
80
+ ];
@@ -0,0 +1,11 @@
1
+ export enum NetworkId {
2
+ Mainnet = 1,
3
+ OptimismMainnet = 10,
4
+ PolygonMainnet = 137,
5
+ ZkSyncSepolia = 300,
6
+ ZkSync = 324,
7
+ Base = 8453,
8
+ Arbitrum = 42161,
9
+ OptimismSepolia = 11155420,
10
+ BlastSepolia = 168587773,
11
+ }
@@ -0,0 +1,177 @@
1
+ import * as oddslib from 'oddslib';
2
+
3
+ export const getBookmakersArray = (bookmakersData, sportId, backupLiveOddsProviders) => {
4
+ const sportBookmakersData = bookmakersData.find((data) => Number(data.sportId) === Number(sportId));
5
+ if (sportBookmakersData) {
6
+ if (sportBookmakersData.primaryBookmaker == '') {
7
+ return backupLiveOddsProviders;
8
+ }
9
+ const bookmakersArray: string[] = [];
10
+
11
+ sportBookmakersData.primaryBookmaker ? bookmakersArray.push(sportBookmakersData.primaryBookmaker) : '';
12
+ sportBookmakersData.secondaryBookmaker ? bookmakersArray.push(sportBookmakersData.secondaryBookmaker) : '';
13
+ sportBookmakersData.tertiaryBookmaker ? bookmakersArray.push(sportBookmakersData.tertiaryBookmaker) : '';
14
+
15
+ return bookmakersArray;
16
+ }
17
+ return backupLiveOddsProviders;
18
+ };
19
+
20
+ export const checkOddsFromBookmakers = (
21
+ oddsMap: Map<string, any>,
22
+ arrayOfBookmakers: string[],
23
+ isTwoPositionalSport: boolean,
24
+ maxImpliedPercentageDifference: number,
25
+ minOddsForDiffChecking: number
26
+ ) => {
27
+ // Check if any bookmaker has odds of 0 or 0.0001
28
+ const hasZeroOrOne = arrayOfBookmakers.some((bookmakerId) => {
29
+ const line = oddsMap.get(bookmakerId);
30
+ if (line) {
31
+ return (
32
+ line.homeOdds === 0 ||
33
+ line.awayOdds === 0 ||
34
+ (!isTwoPositionalSport && line.drawOdds === 0) ||
35
+ line.homeOdds === 1 ||
36
+ line.awayOdds === 1 ||
37
+ (!isTwoPositionalSport && line.drawOdds === 1)
38
+ );
39
+ }
40
+ return false;
41
+ });
42
+
43
+ if (arrayOfBookmakers.length == 1) {
44
+ if (hasZeroOrOne) {
45
+ // If any bookmaker has zero odds, return zero odds
46
+ return [
47
+ {
48
+ homeOdds: 0,
49
+ awayOdds: 0,
50
+ drawOdds: 0,
51
+ },
52
+ ];
53
+ }
54
+
55
+ const firstBookmaker = arrayOfBookmakers[0];
56
+ const firstLine = oddsMap.get(firstBookmaker);
57
+ return [
58
+ {
59
+ homeOdds: firstLine.homeOdds,
60
+ awayOdds: firstLine.awayOdds,
61
+ drawOdds: isTwoPositionalSport ? 0 : firstLine.drawOdds,
62
+ },
63
+ ];
64
+ }
65
+
66
+ if (hasZeroOrOne) {
67
+ // If any bookmaker has zero odds, return zero odds
68
+ return [
69
+ {
70
+ homeOdds: 0,
71
+ awayOdds: 0,
72
+ drawOdds: 0,
73
+ },
74
+ ];
75
+ } else {
76
+ // Main bookmaker odds
77
+ const firstBookmakerOdds = oddsMap.get(arrayOfBookmakers[0]);
78
+ const homeOdd = firstBookmakerOdds.homeOdds;
79
+ const awayOdd = firstBookmakerOdds.awayOdds;
80
+ const drawOdd = firstBookmakerOdds.drawOdds;
81
+
82
+ // If none of the bookmakers have zero odds, check implied odds percentage difference
83
+ const hasLargeImpliedPercentageDifference = arrayOfBookmakers.slice(1).some((bookmakerId) => {
84
+ const line = oddsMap[bookmakerId];
85
+ if (line) {
86
+ const otherHomeOdd = line.homeOdds;
87
+ const otherAwayOdd = line.awayOdds;
88
+ const otherDrawOdd = line.drawOdds;
89
+
90
+ const homeOddsImplied = oddslib.from('decimal', homeOdd).to('impliedProbability');
91
+
92
+ const awayOddsImplied = oddslib.from('decimal', awayOdd).to('impliedProbability');
93
+
94
+ // Calculate implied odds for the "draw" if it's not a two-positions sport
95
+ const drawOddsImplied = isTwoPositionalSport
96
+ ? 0
97
+ : oddslib.from('decimal', drawOdd).to('impliedProbability');
98
+
99
+ const otherHomeOddImplied = oddslib.from('decimal', otherHomeOdd).to('impliedProbability');
100
+
101
+ const otherAwayOddImplied = oddslib.from('decimal', otherAwayOdd).to('impliedProbability');
102
+
103
+ // Calculate implied odds for the "draw" if it's not a two-positions sport
104
+ const otherDrawOddImplied = isTwoPositionalSport
105
+ ? 0
106
+ : oddslib.from('decimal', otherDrawOdd).to('impliedProbability');
107
+
108
+ // Calculate the percentage difference for implied odds
109
+ const homeOddsDifference = calculateImpliedOddsDifference(homeOddsImplied, otherHomeOddImplied);
110
+
111
+ const awayOddsDifference = calculateImpliedOddsDifference(awayOddsImplied, otherAwayOddImplied);
112
+
113
+ // Check implied odds difference for the "draw" only if it's not a two-positions sport
114
+ const drawOddsDifference = isTwoPositionalSport
115
+ ? 0
116
+ : calculateImpliedOddsDifference(drawOddsImplied, otherDrawOddImplied);
117
+
118
+ // Check if the percentage difference exceeds the threshold
119
+ if (
120
+ (homeOddsDifference > maxImpliedPercentageDifference &&
121
+ homeOddsImplied > minOddsForDiffChecking &&
122
+ otherHomeOddImplied > minOddsForDiffChecking) ||
123
+ (awayOddsDifference > maxImpliedPercentageDifference &&
124
+ awayOddsImplied > minOddsForDiffChecking &&
125
+ otherAwayOddImplied > minOddsForDiffChecking) ||
126
+ (!isTwoPositionalSport &&
127
+ drawOddsDifference > maxImpliedPercentageDifference &&
128
+ drawOddsImplied > minOddsForDiffChecking &&
129
+ otherDrawOddImplied > minOddsForDiffChecking)
130
+ ) {
131
+ return true;
132
+ }
133
+ }
134
+ return false;
135
+ });
136
+
137
+ if (hasLargeImpliedPercentageDifference) {
138
+ console.log('Returning zero odds due to percentage difference');
139
+ return [
140
+ {
141
+ homeOdds: 0,
142
+ awayOdds: 0,
143
+ drawOdds: 0,
144
+ },
145
+ ];
146
+ }
147
+
148
+ let lines: any[] = [];
149
+ arrayOfBookmakers.forEach((bookmaker) => lines.push(oddsMap.get(bookmaker)));
150
+
151
+ if (lines[0] != undefined) {
152
+ return lines.map((line) => {
153
+ return {
154
+ homeOdds: line.homeOdds,
155
+ awayOdds: line.awayOdds,
156
+ drawOdds: isTwoPositionalSport ? 0 : line.drawOdds,
157
+ };
158
+ });
159
+ }
160
+ }
161
+
162
+ // If no matching bookmakers are found, return zero odds
163
+ console.log('Returning zero odds cause no matching bookmakers have been found');
164
+ return [
165
+ {
166
+ homeOdds: 0,
167
+ awayOdds: 0,
168
+ drawOdds: 0,
169
+ },
170
+ ];
171
+ };
172
+
173
+ export const calculateImpliedOddsDifference = (impliedOddsA: number, impliedOddsB: number): number => {
174
+ const percentageDifference = (Math.abs(impliedOddsA - impliedOddsB) / impliedOddsA) * 100;
175
+ console.log('% diff: ' + percentageDifference);
176
+ return percentageDifference;
177
+ };
@@ -0,0 +1,45 @@
1
+ import axios from 'axios';
2
+ import csvParser from 'csv-parser';
3
+ import stream from 'stream';
4
+
5
+ /**
6
+ * Fetches and parses CSV data from a given URL.
7
+ *
8
+ * @param {string} url - The URL of the CSV file to fetch.
9
+ * @returns {Promise<Array<Object>>} - A promise that resolves to an array of parsed CSV data objects.
10
+ * @throws {Error} - Throws an error if the CSV data could not be fetched or parsed.
11
+ */
12
+ export const readCsvFromUrl = async (url) => {
13
+ try {
14
+ const response = await axios.get(url);
15
+ const csvContent = response.data;
16
+
17
+ const csvStream = new stream.Readable();
18
+ csvStream.push(csvContent);
19
+ csvStream.push(null);
20
+
21
+ const data = await parseCsv(csvStream);
22
+ return data;
23
+ } catch (error) {
24
+ console.error(`Failed to read CSV from URL: ${url}`, error);
25
+ throw error;
26
+ }
27
+ };
28
+
29
+ /**
30
+ * Parses CSV data from a readable stream.
31
+ *
32
+ * @param {stream.Readable} csvStream - A readable stream containing CSV data.
33
+ * @returns {Promise<Array<Object>>} - A promise that resolves to an array of parsed CSV data objects.
34
+ * @throws {Error} - Throws an error if the CSV data could not be parsed.
35
+ */
36
+ export const parseCsv = (csvStream) => {
37
+ return new Promise((resolve, reject) => {
38
+ const results: any[] = [];
39
+ csvStream
40
+ .pipe(csvParser())
41
+ .on('data', (data) => results.push(data))
42
+ .on('end', () => resolve(results))
43
+ .on('error', (error) => reject(error));
44
+ });
45
+ };
@@ -0,0 +1,85 @@
1
+ import { LEAGUES_NO_FORMAL_HOME_AWAY, Sport } from '../constants/sports';
2
+
3
+ export const teamNamesMatching = (
4
+ leagueId: number,
5
+ marketHomeTeam: string,
6
+ marketAwayTeam: string,
7
+ apiHomeTeam: string,
8
+ apiAwayTeam: string,
9
+ teamsMap: Map<string, string>
10
+ ) => {
11
+ let homeTeamsMatch;
12
+ let awayTeamsMatch;
13
+
14
+ if (LEAGUES_NO_FORMAL_HOME_AWAY.includes(leagueId)) {
15
+ homeTeamsMatch =
16
+ apiHomeTeam.toLowerCase() == marketHomeTeam.toLowerCase() ||
17
+ apiHomeTeam.toLowerCase() == marketAwayTeam.toLowerCase();
18
+ awayTeamsMatch =
19
+ apiAwayTeam.toLowerCase() == marketHomeTeam.toLowerCase() ||
20
+ apiAwayTeam.toLowerCase() == marketAwayTeam.toLowerCase();
21
+ } else {
22
+ homeTeamsMatch = apiHomeTeam.toLowerCase() == marketHomeTeam.toLowerCase();
23
+ awayTeamsMatch = apiAwayTeam.toLowerCase() == marketAwayTeam.toLowerCase();
24
+ }
25
+
26
+ if (homeTeamsMatch !== true) {
27
+ const homeTeamOpticOdds = teamsMap.get(apiHomeTeam.toLowerCase());
28
+ const gameHomeTeam = teamsMap.get(marketHomeTeam.toLowerCase());
29
+ const gameAwayTeam = teamsMap.get(marketAwayTeam.toLowerCase());
30
+ const hasUndefinedName = [homeTeamOpticOdds, gameHomeTeam].some((name) => name == undefined);
31
+
32
+ if (hasUndefinedName) {
33
+ return false;
34
+ }
35
+
36
+ if (LEAGUES_NO_FORMAL_HOME_AWAY.includes(leagueId)) {
37
+ homeTeamsMatch = homeTeamOpticOdds == gameHomeTeam || homeTeamOpticOdds == gameAwayTeam;
38
+ } else {
39
+ homeTeamsMatch = homeTeamOpticOdds == gameHomeTeam;
40
+ }
41
+ }
42
+
43
+ if (awayTeamsMatch !== true) {
44
+ const awayTeamOpticOdds = teamsMap.get(apiAwayTeam.toLowerCase());
45
+ const gameHomeTeam = teamsMap.get(marketHomeTeam.toLowerCase());
46
+ const gameAwayTeam = teamsMap.get(marketAwayTeam.toLowerCase());
47
+
48
+ const hasUndefinedName = [awayTeamOpticOdds, gameAwayTeam].some((name) => name == undefined);
49
+
50
+ if (hasUndefinedName) {
51
+ return false;
52
+ }
53
+
54
+ if (LEAGUES_NO_FORMAL_HOME_AWAY.includes(leagueId)) {
55
+ awayTeamsMatch = awayTeamOpticOdds == gameHomeTeam || awayTeamOpticOdds == gameAwayTeam;
56
+ } else {
57
+ awayTeamsMatch = awayTeamOpticOdds == gameAwayTeam;
58
+ }
59
+ }
60
+
61
+ return homeTeamsMatch && awayTeamsMatch;
62
+ };
63
+
64
+ export const gamesDatesMatching = (
65
+ marketMaturityDate: Date,
66
+ apiStartDate: Date,
67
+ marketSport: string,
68
+ tennisDifferenceEnvVariable: number
69
+ ) => {
70
+ let datesMatch;
71
+ if (marketSport === Sport.TENNIS) {
72
+ const opticOddsTimestamp = apiStartDate.getTime();
73
+ const marketTimestamp = marketMaturityDate.getTime();
74
+ const differenceBetweenDates = Math.abs(marketTimestamp - opticOddsTimestamp);
75
+ if (differenceBetweenDates <= Number(tennisDifferenceEnvVariable * 60 * 1000)) {
76
+ datesMatch = true;
77
+ } else {
78
+ datesMatch = false;
79
+ }
80
+ } else {
81
+ datesMatch = apiStartDate.toUTCString() == marketMaturityDate.toUTCString();
82
+ }
83
+
84
+ return datesMatch;
85
+ };
@@ -0,0 +1,85 @@
1
+ export const findOddsForTeam = (liveOddsProviders, gameWithOdds, market, teamsMap, isDrawAvailable) => {
2
+ const linesMap = new Map<any, any>();
3
+
4
+ liveOddsProviders.forEach((oddsProvider) => {
5
+ const providerOddsObjects = gameWithOdds.odds.filter(
6
+ (oddsObject) => oddsObject.sports_book_name.toLowerCase() == oddsProvider.toLowerCase()
7
+ );
8
+
9
+ const gameHomeTeam = teamsMap.get(market.homeTeam.toLowerCase());
10
+ const gameAwayTeam = teamsMap.get(market.awayTeam.toLowerCase());
11
+
12
+ let homeOddsObject;
13
+ if (gameHomeTeam == undefined) {
14
+ homeOddsObject = providerOddsObjects.find((oddsObject) => {
15
+ const opticOddsTeamName = teamsMap.get(oddsObject.name.toLowerCase());
16
+
17
+ if (opticOddsTeamName == undefined) {
18
+ return oddsObject.name.toLowerCase() == market.homeTeam.toLowerCase();
19
+ } else {
20
+ return opticOddsTeamName == market.homeTeam.toLowerCase();
21
+ }
22
+ });
23
+ } else {
24
+ homeOddsObject = providerOddsObjects.find((oddsObject) => {
25
+ const opticOddsTeamName = teamsMap.get(oddsObject.name.toLowerCase());
26
+
27
+ if (opticOddsTeamName == undefined) {
28
+ return oddsObject.name.toLowerCase() == gameHomeTeam;
29
+ } else {
30
+ return opticOddsTeamName == gameHomeTeam;
31
+ }
32
+ });
33
+ }
34
+
35
+ let homeOdds = 0;
36
+ if (homeOddsObject != undefined) {
37
+ homeOdds = homeOddsObject.price;
38
+ }
39
+
40
+ let awayOddsObject;
41
+ if (gameAwayTeam == undefined) {
42
+ awayOddsObject = providerOddsObjects.find((oddsObject) => {
43
+ const opticOddsTeamName = teamsMap.get(oddsObject.name.toLowerCase());
44
+
45
+ if (opticOddsTeamName == undefined) {
46
+ return oddsObject.name.toLowerCase() == market.awayTeam.toLowerCase();
47
+ } else {
48
+ return opticOddsTeamName == market.awayTeam.toLowerCase();
49
+ }
50
+ });
51
+ } else {
52
+ awayOddsObject = providerOddsObjects.find((oddsObject) => {
53
+ const opticOddsTeamName = teamsMap.get(oddsObject.name.toLowerCase());
54
+
55
+ if (opticOddsTeamName == undefined) {
56
+ return oddsObject.name.toLowerCase() == gameAwayTeam;
57
+ } else {
58
+ return opticOddsTeamName == gameAwayTeam;
59
+ }
60
+ });
61
+ }
62
+
63
+ let awayOdds = 0;
64
+ if (awayOddsObject != undefined) {
65
+ awayOdds = awayOddsObject.price;
66
+ }
67
+
68
+ let drawOdds = 0;
69
+ if (isDrawAvailable) {
70
+ const drawOddsObject = providerOddsObjects.find((oddsObject) => oddsObject.name.toLowerCase() == 'draw');
71
+
72
+ if (drawOddsObject != undefined) {
73
+ drawOdds = drawOddsObject.price;
74
+ }
75
+ }
76
+
77
+ linesMap.set(oddsProvider.toLowerCase(), {
78
+ homeOdds: homeOdds,
79
+ awayOdds: awayOdds,
80
+ drawOdds: drawOdds,
81
+ });
82
+ });
83
+
84
+ return linesMap;
85
+ };
@@ -0,0 +1,169 @@
1
+ import { League, Sport } from '../constants/sports';
2
+
3
+ export const allowGame = (opticOddsScoresApiResponse, marketLeague, marketSport, constraintsMap) => {
4
+ const currentScoreHome = opticOddsScoresApiResponse.score_home_total;
5
+ const currentScoreAway = opticOddsScoresApiResponse.score_away_total;
6
+ const currentClock = opticOddsScoresApiResponse.clock;
7
+ const currentPeriod = opticOddsScoresApiResponse.period;
8
+ const currentGameStatus = opticOddsScoresApiResponse.status;
9
+ const homeTeam = opticOddsScoresApiResponse.home_team;
10
+ const awayTeam = opticOddsScoresApiResponse.away_team;
11
+
12
+ if (currentGameStatus.toLowerCase() == 'completed') {
13
+ console.log(`Blocking game ${homeTeam} - ${awayTeam} because it is no longer live.`);
14
+ return null;
15
+ }
16
+
17
+ let allowedObject;
18
+ if (marketSport === Sport.BASKETBALL) {
19
+ allowedObject = allowGameSportWithPeriodConstraint(
20
+ homeTeam,
21
+ awayTeam,
22
+ currentPeriod,
23
+ constraintsMap.get(Sport.BASKETBALL)
24
+ );
25
+ }
26
+
27
+ if (marketSport === Sport.HOCKEY) {
28
+ allowedObject = allowGameSportWithPeriodConstraint(
29
+ homeTeam,
30
+ awayTeam,
31
+ currentPeriod,
32
+ constraintsMap.get(Sport.HOCKEY)
33
+ );
34
+ }
35
+
36
+ if (marketSport === Sport.BASEBALL) {
37
+ allowedObject = allowGameSportWithPeriodConstraint(
38
+ homeTeam,
39
+ awayTeam,
40
+ currentPeriod,
41
+ constraintsMap.get(Sport.BASEBALL)
42
+ );
43
+ }
44
+
45
+ if (marketSport === Sport.SOCCER) {
46
+ allowedObject = allowSoccerGame(homeTeam, awayTeam, currentClock, constraintsMap.get(Sport.SOCCER));
47
+ }
48
+
49
+ if (marketSport === Sport.TENNIS) {
50
+ allowedObject = allowTennisMatch(
51
+ opticOddsScoresApiResponse,
52
+ homeTeam,
53
+ awayTeam,
54
+ currentPeriod,
55
+ currentScoreHome,
56
+ currentScoreAway,
57
+ marketLeague
58
+ );
59
+ }
60
+
61
+ return allowedObject;
62
+ };
63
+
64
+ export const allowGameSportWithPeriodConstraint = (homeTeam, awayTeam, currentPeriod, periodLimitForLiveTrade) => {
65
+ if (Number(currentPeriod) >= periodLimitForLiveTrade) {
66
+ return {
67
+ allow: false,
68
+ message: `Blocking game ${homeTeam} - ${awayTeam} due to period: ${currentPeriod}. period`,
69
+ };
70
+ }
71
+ return { allow: true, message: '' };
72
+ };
73
+
74
+ export const allowSoccerGame = (homeTeam, awayTeam, currentClock, soccerMinuteLimitForLiveTrading) => {
75
+ const currentClockNumber = Number(currentClock);
76
+ if (
77
+ (!Number.isNaN(currentClockNumber) && currentClockNumber >= soccerMinuteLimitForLiveTrading) ||
78
+ (Number.isNaN(currentClockNumber) && currentClock != 'HALF')
79
+ ) {
80
+ return { allow: false, message: `Blocking game ${homeTeam} - ${awayTeam} due to clock: ${currentClock}min` };
81
+ }
82
+
83
+ return { allow: true, message: '' };
84
+ };
85
+
86
+ export const allowTennisMatch = (
87
+ opticOddsScoresApiResponse,
88
+ homeTeam,
89
+ awayTeam,
90
+ currentPeriod,
91
+ currentScoreHome,
92
+ currentScoreAway,
93
+ marketLeague
94
+ ) => {
95
+ const setInProgress = Number(currentPeriod);
96
+ let currentHomeGameScore;
97
+ let currentAwayGameScore;
98
+
99
+ const atpGrandSlamMatch = opticOddsScoresApiResponse.league.toLowerCase() == 'atp';
100
+ if (marketLeague == League.TENNIS_GS && atpGrandSlamMatch) {
101
+ if (Number(currentScoreHome) == 2 || Number(currentScoreAway) == 2) {
102
+ switch (setInProgress) {
103
+ case 3:
104
+ currentHomeGameScore = Number(opticOddsScoresApiResponse.score_home_period_3);
105
+ currentAwayGameScore = Number(opticOddsScoresApiResponse.score_away_period_3);
106
+ break;
107
+ case 4:
108
+ currentHomeGameScore = Number(opticOddsScoresApiResponse.score_home_period_4);
109
+ currentAwayGameScore = Number(opticOddsScoresApiResponse.score_away_period_4);
110
+ break;
111
+ case 5:
112
+ currentHomeGameScore = Number(opticOddsScoresApiResponse.score_home_period_5);
113
+ currentAwayGameScore = Number(opticOddsScoresApiResponse.score_away_period_5);
114
+ break;
115
+ }
116
+ if (Number(currentScoreHome) == 2 && currentHomeGameScore >= 5) {
117
+ return {
118
+ allow: false,
119
+ message: `Blocking game ${homeTeam} - ${awayTeam} due to current result: ${currentScoreHome} - ${currentScoreAway} (${currentHomeGameScore} - ${currentAwayGameScore})`,
120
+ };
121
+ }
122
+
123
+ if (Number(currentScoreAway) == 2 && currentAwayGameScore >= 5) {
124
+ return {
125
+ allow: false,
126
+ message: `Blocking game ${homeTeam} - ${awayTeam} due to current result: ${currentScoreHome} - ${currentScoreAway} (${currentHomeGameScore} - ${currentAwayGameScore})`,
127
+ };
128
+ }
129
+ return {
130
+ allow: true,
131
+ message: '',
132
+ currentHomeGameScore: currentHomeGameScore,
133
+ currentAwayGameScore: currentAwayGameScore,
134
+ };
135
+ }
136
+ } else {
137
+ if (Number(currentScoreHome) == 1 || Number(currentScoreAway) == 1) {
138
+ switch (setInProgress) {
139
+ case 2:
140
+ currentHomeGameScore = Number(opticOddsScoresApiResponse.score_home_period_2);
141
+ currentAwayGameScore = Number(opticOddsScoresApiResponse.score_away_period_2);
142
+ break;
143
+ case 3:
144
+ currentHomeGameScore = Number(opticOddsScoresApiResponse.score_home_period_3);
145
+ currentAwayGameScore = Number(opticOddsScoresApiResponse.score_away_period_3);
146
+ break;
147
+ }
148
+ if (Number(currentScoreHome) == 1 && currentHomeGameScore >= 5) {
149
+ return {
150
+ allow: false,
151
+ message: `Blocking game ${homeTeam} - ${awayTeam} due to current result: ${currentScoreHome} - ${currentScoreAway} (${currentHomeGameScore} - ${currentAwayGameScore})`,
152
+ };
153
+ }
154
+
155
+ if (Number(currentScoreAway) == 1 && currentAwayGameScore >= 5) {
156
+ return {
157
+ allow: false,
158
+ message: `Blocking game ${homeTeam} - ${awayTeam} due to current result: ${currentScoreHome} - ${currentScoreAway} (${currentHomeGameScore} - ${currentAwayGameScore})`,
159
+ };
160
+ }
161
+ return {
162
+ allow: true,
163
+ message: '',
164
+ currentHomeGameScore: currentHomeGameScore,
165
+ currentAwayGameScore: currentAwayGameScore,
166
+ };
167
+ }
168
+ }
169
+ };
@@ -0,0 +1,66 @@
1
+ export const adjustSpreadOnOdds = (impliedProbs, minSpread, targetSpread) => {
2
+ // Step 1: Check if any implied probability is zero
3
+ if (impliedProbs.some((prob) => prob === 0)) {
4
+ return impliedProbs;
5
+ }
6
+
7
+ // Step 2: Calculate the current total implied probabilities
8
+ const totalImpliedProbs = impliedProbs.reduce((sum, prob) => sum + prob, 0);
9
+
10
+ // Step 3: Check if the sum of implied probabilities is greater than 1
11
+ if (totalImpliedProbs <= 1) {
12
+ return Array(impliedProbs.length).fill(0);
13
+ }
14
+
15
+ // Step 4: Check if targetSpread is zero
16
+ if (targetSpread === 0) {
17
+ const currentSpread = (totalImpliedProbs - 1) * 100;
18
+ // If minSpread is set and greater than current spread, use minSpread
19
+ if (minSpread > currentSpread) {
20
+ targetSpread = minSpread;
21
+ } else {
22
+ // If minSpread is less than current spread, return odds as they are
23
+ return impliedProbs;
24
+ }
25
+ }
26
+
27
+ // Step 5: Calculate the target total implied probabilities
28
+ const targetTotalImpliedProbs = 1 + targetSpread / 100;
29
+
30
+ // Step 6: Calculate the adjustment factor
31
+ const adjustmentFactor = targetTotalImpliedProbs / totalImpliedProbs;
32
+
33
+ // Step 7: Adjust the probabilities to reflect the target spread
34
+ let adjustedImpliedProbs = impliedProbs.map((prob) => prob * adjustmentFactor);
35
+
36
+ // Step 8: Check if any adjusted probability equals or exceeds 1
37
+ if (adjustedImpliedProbs.some((prob) => prob >= 1)) {
38
+ return Array(impliedProbs.length).fill(0);
39
+ }
40
+
41
+ // Step 9: Ensure the sum of the adjusted probabilities equals the target total implied probabilities
42
+ const sumAdjustedProbs = adjustedImpliedProbs.reduce((sum, prob) => sum + prob, 0);
43
+
44
+ // Step 10: If the sum of the adjusted probabilities is less than 1, return zeros
45
+ if (sumAdjustedProbs < 1) {
46
+ return Array(impliedProbs.length).fill(0);
47
+ }
48
+
49
+ const normalizationFactor = targetTotalImpliedProbs / sumAdjustedProbs;
50
+ adjustedImpliedProbs = adjustedImpliedProbs.map((prob) => prob * normalizationFactor);
51
+
52
+ return adjustedImpliedProbs;
53
+ };
54
+
55
+ export const getSpreadData = (spreadData, sportId, typeId, defaultSpreadForLiveMarkets) => {
56
+ const sportSpreadData = spreadData.find(
57
+ (data) => Number(data.typeId) === Number(typeId) && Number(data.sportId) === Number(sportId)
58
+ );
59
+ if (sportSpreadData) {
60
+ return {
61
+ minSpread: sportSpreadData.minSpread ? Number(sportSpreadData.minSpread) : defaultSpreadForLiveMarkets,
62
+ targetSpread: sportSpreadData.targetSpread ? Number(sportSpreadData.targetSpread) : 0,
63
+ };
64
+ }
65
+ return { minSpread: defaultSpreadForLiveMarkets, targetSpread: 0 };
66
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "esnext",
4
+ "esModuleInterop": true,
5
+ "target": "es5",
6
+ "lib": ["dom", "dom.iterable", "esnext"],
7
+ "moduleResolution": "node",
8
+ "sourceMap": true,
9
+ "outDir": "build",
10
+ "declaration": true
11
+ }
12
+ }
@@ -0,0 +1,25 @@
1
+ const path = require('path');
2
+ const { buffer } = require('stream/consumers');
3
+
4
+ module.exports = {
5
+ entry: './index.ts',
6
+ module: {
7
+ rules: [
8
+ {
9
+ test: /\.ts?$/,
10
+ use: 'ts-loader',
11
+ exclude: /node_modules/,
12
+ },
13
+ ],
14
+ },
15
+ resolve: {
16
+ extensions: ['.tsx', '.ts', '.js'],
17
+ fallback: { stream: require.resolve('stream-browserify'), buffer: require.resolve('buffer/') },
18
+ },
19
+ output: {
20
+ filename: 'main.js',
21
+ path: path.resolve(__dirname),
22
+ library: 'thalesUtils',
23
+ libraryTarget: 'umd',
24
+ },
25
+ };