denotify-client 1.1.5 → 1.1.6
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/dist/denotifyclient.js +13 -3
- package/dist/examples/balance-monitor.js +50 -40
- package/dist/index.js +13 -3
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +13 -3
- package/package.json +4 -1
- package/types/denotifyclient.d.ts +31 -7
- package/types/notifications/notification.d.ts +7 -0
- package/types/triggers/trigger.d.ts +18 -3
package/dist/denotifyclient.js
CHANGED
@@ -47,10 +47,19 @@ export class DeNotifyClient {
|
|
47
47
|
throw new Error('Authentication Required. DeNotify supports either username/password or API key authentication');
|
48
48
|
}
|
49
49
|
}
|
50
|
-
async alertHistory(id, pagination
|
51
|
-
const
|
52
|
-
|
50
|
+
async alertHistory(id, pagination) {
|
51
|
+
const url = `alert-history`;
|
52
|
+
const params = pagination ? pagination : {};
|
53
|
+
if (id)
|
54
|
+
params.id = id;
|
55
|
+
if (Object.keys(params).length > 0) {
|
56
|
+
return await this.request('get', url, { params: pagination });
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
return await this.request('get', url);
|
60
|
+
}
|
53
61
|
}
|
62
|
+
// TODO - Beutify the reponse
|
54
63
|
async getAlert(id) {
|
55
64
|
const alerts = await this.request('get', `alerts/${id}`);
|
56
65
|
return alerts[0];
|
@@ -77,6 +86,7 @@ export class DeNotifyClient {
|
|
77
86
|
url.searchParams.append(param, options.params[param]);
|
78
87
|
}
|
79
88
|
}
|
89
|
+
console.log(url.toString());
|
80
90
|
const payload = {
|
81
91
|
method,
|
82
92
|
url: url.toString(),
|
@@ -1,47 +1,57 @@
|
|
1
|
-
import { AlertBuilder } from "../alertbuilder.js";
|
2
1
|
import { DeNotifyClient } from "../denotifyclient.js";
|
3
|
-
import { FunctionBuilder } from "../functionbuilder.js";
|
4
|
-
import { FilterBuilder } from "../util/filter.js";
|
5
2
|
// Simple App to demonstrate usage. Created a balance monitoring alert, updates it and deletes it
|
6
3
|
async function main() {
|
7
4
|
const api = await DeNotifyClient.create({
|
8
|
-
email:
|
9
|
-
password:
|
5
|
+
email: 's.battenally@gmail.com',
|
6
|
+
password: 'Password',
|
10
7
|
});
|
11
|
-
const
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
})
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
//
|
33
|
-
|
34
|
-
|
35
|
-
//
|
36
|
-
|
37
|
-
//
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
//
|
43
|
-
|
44
|
-
|
45
|
-
|
8
|
+
// const alerts = await api.getAlerts()
|
9
|
+
const size = 100;
|
10
|
+
let page = 1;
|
11
|
+
let len = size;
|
12
|
+
while (len === size) {
|
13
|
+
console.log(`fetching page: ${page}, size: ${size}, id: ${123}`);
|
14
|
+
const ret = await api.alertHistory(123, { page, size });
|
15
|
+
console.log('success!');
|
16
|
+
console.log('length:', ret.history.length);
|
17
|
+
len = ret.history.length;
|
18
|
+
page++;
|
19
|
+
}
|
20
|
+
// const network = 'avalanche'
|
21
|
+
// const address = '0x26985888d5b7019ff2A7444fB567D8F386c3b538'
|
22
|
+
// const myAddress = '0x7601630eC802952ba1ED2B6e4db16F699A0a5A87'
|
23
|
+
// const { abi } = await api.getAbi(network, address)
|
24
|
+
// const webhook = process.env.DISCORD_WEBHOOK as string
|
25
|
+
// const builder = FunctionBuilder.create(api)
|
26
|
+
// await builder.addFunction(address, 'getBalance', [myAddress], abi)
|
27
|
+
// // Create the Balance Monitor alert
|
28
|
+
// const alert = await AlertBuilder.create('Test Alert')
|
29
|
+
// .onNetwork('avalanche')
|
30
|
+
// .withTrigger<PollFunctionV2>('PollFunctionV2', {
|
31
|
+
// timeBase: 'time',
|
32
|
+
// timePeriod: '100s',
|
33
|
+
// functions: builder.get(),
|
34
|
+
// triggerOn: 'always',
|
35
|
+
// })
|
36
|
+
// .withNotification<DiscordWebhook>('Discord', {
|
37
|
+
// url: webhook,
|
38
|
+
// message:
|
39
|
+
// `Your avax balance is [{func_0_ret_0 / 1e18}](https://snowtrace.io/address/${myAddress})`,
|
40
|
+
// })
|
41
|
+
// .config()
|
42
|
+
// // Create the alert with the API
|
43
|
+
// const triggerId = await api.createAlert(alert)
|
44
|
+
// console.log(triggerId)
|
45
|
+
// // Update the period to every 10s
|
46
|
+
// await api.updateTrigger(triggerId, { timePeriod: '10s' })
|
47
|
+
// // Update the Filter using the filter builder
|
48
|
+
// const filter = FilterBuilder.new()
|
49
|
+
// .addCondition('WHERE', 'func_0_ret_0', 'Number', 'gt', 3)
|
50
|
+
// .finalise()
|
51
|
+
// await api.updateTrigger(13, { triggerOn: 'filter', filter, filterVersion: FilterBuilder.version() })
|
52
|
+
// // Delete the filter in 10s
|
53
|
+
// setTimeout(async () => {
|
54
|
+
// await api.deleteAlert(triggerId)
|
55
|
+
// }, 10 * 1000)
|
46
56
|
}
|
47
57
|
main();
|
package/dist/index.js
CHANGED
@@ -4463,10 +4463,19 @@ class DeNotifyClient {
|
|
4463
4463
|
throw new Error('Authentication Required. DeNotify supports either username/password or API key authentication');
|
4464
4464
|
}
|
4465
4465
|
}
|
4466
|
-
async alertHistory(id, pagination
|
4467
|
-
const
|
4468
|
-
|
4466
|
+
async alertHistory(id, pagination) {
|
4467
|
+
const url = `alert-history`;
|
4468
|
+
const params = pagination ? pagination : {};
|
4469
|
+
if (id)
|
4470
|
+
params.id = id;
|
4471
|
+
if (Object.keys(params).length > 0) {
|
4472
|
+
return await this.request('get', url, { params: pagination });
|
4473
|
+
}
|
4474
|
+
else {
|
4475
|
+
return await this.request('get', url);
|
4476
|
+
}
|
4469
4477
|
}
|
4478
|
+
// TODO - Beutify the reponse
|
4470
4479
|
async getAlert(id) {
|
4471
4480
|
const alerts = await this.request('get', `alerts/${id}`);
|
4472
4481
|
return alerts[0];
|
@@ -4493,6 +4502,7 @@ class DeNotifyClient {
|
|
4493
4502
|
url.searchParams.append(param, options.params[param]);
|
4494
4503
|
}
|
4495
4504
|
}
|
4505
|
+
console.log(url.toString());
|
4496
4506
|
const payload = {
|
4497
4507
|
method,
|
4498
4508
|
url: url.toString(),
|
package/dist/index.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@supabase/supabase-js"),require("form-data"),require("url"),require("proxy-from-env"),require("http"),require("https"),require("util"),require("follow-redirects"),require("zlib"),require("stream"),require("events"),require("yup"),require("ethers")):"function"==typeof define&&define.amd?define(["exports","@supabase/supabase-js","form-data","url","proxy-from-env","http","https","util","follow-redirects","zlib","stream","events","yup","ethers"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["denotify-client"]={},e.supabaseJs,e.FormData$1,e.url,e.proxyFromEnv,e.http,e.https,e.util,e.followRedirects,e.zlib,e.stream,e.EventEmitter,e.yup,e.ethers)}(this,(function(e,t,r,n,o,s,i,a,c,u,l,d,f,h){"use strict";function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var g=p(r),y=p(n),b=p(s),w=p(i),E=p(a),R=p(c),O=p(u),S=p(l),T=p(d),A=m(f);function v(e,t){return function(){return e.apply(t,arguments)}}const{toString:C}=Object.prototype,{getPrototypeOf:x}=Object,N=(_=Object.create(null),e=>{const t=C.call(e);return _[t]||(_[t]=t.slice(8,-1).toLowerCase())});var _;const L=e=>(e=e.toLowerCase(),t=>N(t)===e),P=e=>t=>typeof t===e,{isArray:k}=Array,B=P("undefined");const j=L("ArrayBuffer");const D=P("string"),F=P("function"),U=P("number"),I=e=>null!==e&&"object"==typeof e,q=e=>{if("object"!==N(e))return!1;const t=x(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},z=L("Date"),H=L("File"),M=L("Blob"),$=L("FileList"),W=L("URLSearchParams");function J(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),k(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function V(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const K="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,G=e=>!B(e)&&e!==K;const X=(Z="undefined"!=typeof Uint8Array&&x(Uint8Array),e=>Z&&e instanceof Z);var Z;const Q=L("HTMLFormElement"),Y=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ee=L("RegExp"),te=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};J(r,((r,o)=>{!1!==t(r,o,e)&&(n[o]=r)})),Object.defineProperties(e,n)},re="abcdefghijklmnopqrstuvwxyz",ne="0123456789",oe={DIGIT:ne,ALPHA:re,ALPHA_DIGIT:re+re.toUpperCase()+ne};var se={isArray:k,isArrayBuffer:j,isBuffer:function(e){return null!==e&&!B(e)&&null!==e.constructor&&!B(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||C.call(e)===t||F(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&j(e.buffer),t},isString:D,isNumber:U,isBoolean:e=>!0===e||!1===e,isObject:I,isPlainObject:q,isUndefined:B,isDate:z,isFile:H,isBlob:M,isRegExp:ee,isFunction:F,isStream:e=>I(e)&&F(e.pipe),isURLSearchParams:W,isTypedArray:X,isFileList:$,forEach:J,merge:function e(){const{caseless:t}=G(this)&&this||{},r={},n=(n,o)=>{const s=t&&V(r,o)||o;q(r[s])&&q(n)?r[s]=e(r[s],n):q(n)?r[s]=e({},n):k(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&J(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(J(t,((t,n)=>{r&&F(t)?e[n]=v(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&x(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:N,kindOfTest:L,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(k(e))return e;let t=e.length;if(!U(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Q,hasOwnProperty:Y,hasOwnProp:Y,reduceDescriptors:te,freezeMethods:e=>{te(e,((t,r)=>{if(F(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];F(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return k(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:V,global:K,isContextDefined:G,ALPHABET:oe,generateString:(e=16,t=oe.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&F(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(I(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=k(e)?[]:{};return J(e,((e,t)=>{const s=r(e,n+1);!B(s)&&(o[t]=s)})),t[n]=void 0,o}}return e};return r(e,0)}};function ie(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}se.inherits(ie,Error,{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:se.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ae=ie.prototype,ce={};function ue(e){return se.isPlainObject(e)||se.isArray(e)}function le(e){return se.endsWith(e,"[]")?e.slice(0,-2):e}function de(e,t,r){return e?e.concat(t).map((function(e,t){return e=le(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{ce[e]={value:e}})),Object.defineProperties(ie,ce),Object.defineProperty(ae,"isAxiosError",{value:!0}),ie.from=(e,t,r,n,o,s)=>{const i=Object.create(ae);return se.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),ie.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};const fe=se.toFlatObject(se,{},null,(function(e){return/^is[A-Z]/.test(e)}));function he(e,t,r){if(!se.isObject(e))throw new TypeError("target must be an object");t=t||new(g.default||FormData);const n=(r=se.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!se.isUndefined(t[e])}))).metaTokens,o=r.visitor||u,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&se.isSpecCompliantForm(t);if(!se.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(se.isDate(e))return e.toISOString();if(!a&&se.isBlob(e))throw new ie("Blob is not supported. Use a Buffer instead.");return se.isArrayBuffer(e)||se.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(se.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(se.isArray(e)&&function(e){return se.isArray(e)&&!e.some(ue)}(e)||(se.isFileList(e)||se.endsWith(r,"[]"))&&(a=se.toArray(e)))return r=le(r),a.forEach((function(e,n){!se.isUndefined(e)&&null!==e&&t.append(!0===i?de([r],n,s):null===i?r:r+"[]",c(e))})),!1;return!!ue(e)||(t.append(de(o,r,s),c(e)),!1)}const l=[],d=Object.assign(fe,{defaultVisitor:u,convertValue:c,isVisitable:ue});if(!se.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!se.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),se.forEach(r,(function(r,s){!0===(!(se.isUndefined(r)||null===r)&&o.call(t,r,se.isString(s)?s.trim():s,n,d))&&e(r,n?n.concat(s):[s])})),l.pop()}}(e),t}function pe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function me(e,t){this._pairs=[],e&&he(e,this,t)}const ge=me.prototype;function ye(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function be(e,t,r){if(!t)return e;const n=r&&r.encode||ye,o=r&&r.serialize;let s;if(s=o?o(t,r):se.isURLSearchParams(t)?t.toString():new me(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ge.append=function(e,t){this._pairs.push([e,t])},ge.toString=function(e){const t=e?function(t){return e.call(this,t,pe)}:pe;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var we=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){se.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Ee={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Re={isNode:!0,classes:{URLSearchParams:y.default.URLSearchParams,FormData:g.default,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function Oe(e){function t(e,r,n,o){let s=e[o++];const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&se.isArray(n)?n.length:s,a)return se.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!i;n[s]&&se.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],o)&&se.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}(n[s])),!i}if(se.isFormData(e)&&se.isFunction(e.entries)){const r={};return se.forEachEntry(e,((e,n)=>{t(function(e){return se.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const Se={"Content-Type":void 0};const Te={transitional:Ee,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=se.isObject(e);o&&se.isHTMLForm(e)&&(e=new FormData(e));if(se.isFormData(e))return n&&n?JSON.stringify(Oe(e)):e;if(se.isArrayBuffer(e)||se.isBuffer(e)||se.isStream(e)||se.isFile(e)||se.isBlob(e))return e;if(se.isArrayBufferView(e))return e.buffer;if(se.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return he(e,new Re.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return se.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=se.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return he(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(se.isString(e))try{return(t||JSON.parse)(e),se.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Te.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&se.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw ie.from(e,ie.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Re.classes.FormData,Blob:Re.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};se.forEach(["delete","get","head"],(function(e){Te.headers[e]={}})),se.forEach(["post","put","patch"],(function(e){Te.headers[e]=se.merge(Se)}));var Ae=Te;const ve=se.toObjectSet(["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"]);const Ce=Symbol("internals");function xe(e){return e&&String(e).trim().toLowerCase()}function Ne(e){return!1===e||null==e?e:se.isArray(e)?e.map(Ne):String(e)}function _e(e,t,r,n,o){return se.isFunction(n)?n.call(this,t,r):(o&&(t=r),se.isString(t)?se.isString(n)?-1!==t.indexOf(n):se.isRegExp(n)?n.test(t):void 0:void 0)}class Le{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=xe(t);if(!o)throw new Error("header name must be a non-empty string");const s=se.findKey(n,o);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=Ne(e))}const s=(e,t)=>se.forEach(e,((e,r)=>o(e,r,t)));return se.isPlainObject(e)||e instanceof this.constructor?s(e,t):se.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?s((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&ve[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&o(t,e,r),this}get(e,t){if(e=xe(e)){const r=se.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(se.isFunction(t))return t.call(this,e,r);if(se.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=xe(e)){const r=se.findKey(this,e);return!(!r||void 0===this[r]||t&&!_e(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=xe(e)){const o=se.findKey(r,e);!o||t&&!_e(0,r[o],o,t)||(delete r[o],n=!0)}}return se.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!_e(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return se.forEach(this,((n,o)=>{const s=se.findKey(r,o);if(s)return t[s]=Ne(n),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(o):String(o).trim();i!==o&&delete t[o],t[i]=Ne(n),r[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return se.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&se.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[Ce]=this[Ce]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=xe(e);t[n]||(!function(e,t){const r=se.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})}))}(r,e),t[n]=!0)}return se.isArray(e)?e.forEach(n):n(e),this}}Le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),se.freezeMethods(Le.prototype),se.freezeMethods(Le);var Pe=Le;function ke(e,t){const r=this||Ae,n=t||r,o=Pe.from(n.headers);let s=n.data;return se.forEach(e,(function(e){s=e.call(r,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function Be(e){return!(!e||!e.__CANCEL__)}function je(e,t,r){ie.call(this,null==e?"canceled":e,ie.ERR_CANCELED,t,r),this.name="CanceledError"}function De(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ie("Request failed with status code "+r.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}function Fe(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}se.inherits(je,ie,{__CANCEL__:!0});const Ue="1.3.4";function Ie(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const qe=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function ze(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=n[i];o||(o=c),r[s]=a,n[s]=c;let l=i,d=0;for(;l!==s;)d+=r[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}const He=Symbol("internals");class Me extends S.default.Transform{constructor(e){super({readableHighWaterMark:(e=se.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!se.isUndefined(t[e])))).chunkSize});const t=this,r=this[He]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},n=ze(r.ticksRate*e.samplesCount,r.timeWindow);this.on("newListener",(e=>{"progress"===e&&(r.isCaptured||(r.isCaptured=!0))}));let o=0;r.updateProgress=function(e,t){let r=0;const n=1e3/t;let o=null;return function(t,s){const i=Date.now();if(t||i-r>n)return o&&(clearTimeout(o),o=null),r=i,e.apply(null,s);o||(o=setTimeout((()=>(o=null,r=Date.now(),e.apply(null,s))),n-(i-r)))}}((function(){const e=r.length,s=r.bytesSeen,i=s-o;if(!i||t.destroyed)return;const a=n(i);o=s,process.nextTick((()=>{t.emit("progress",{loaded:s,total:e,progress:e?s/e:void 0,bytes:i,rate:a||void 0,estimated:a&&e&&s<=e?(e-s)/a:void 0})}))}),r.ticksRate);const s=()=>{r.updateProgress(!0)};this.once("end",s),this.once("error",s)}_read(e){const t=this[He];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,r){const n=this,o=this[He],s=o.maxRate,i=this.readableHighWaterMark,a=o.timeWindow,c=s/(1e3/a),u=!1!==o.minChunkSize?Math.max(o.minChunkSize,.01*c):0;const l=(e,t)=>{const r=Buffer.byteLength(e);let l,d=null,f=i,h=0;if(s){const e=Date.now();(!o.ts||(h=e-o.ts)>=a)&&(o.ts=e,l=c-o.bytes,o.bytes=l<0?-l:0,h=0),l=c-o.bytes}if(s){if(l<=0)return setTimeout((()=>{t(null,e)}),a-h);l<f&&(f=l)}f&&r>f&&r-f>u&&(d=e.subarray(f),e=e.subarray(0,f)),function(e,t){const r=Buffer.byteLength(e);o.bytesSeen+=r,o.bytes+=r,o.isCaptured&&o.updateProgress(),n.push(e)?process.nextTick(t):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(t)}}(e,d?()=>{process.nextTick(t,null,d)}:t)};l(e,(function e(t,n){if(t)return r(t);n?l(n,e):r(null)}))}setLength(e){return this[He].length=+e,this}}var $e=Me;const{asyncIterator:We}=Symbol;var Je=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[We]?yield*e[We]():yield e};const Ve=se.ALPHABET.ALPHA_DIGIT+"-_",Ke=new a.TextEncoder,Ge="\r\n",Xe=Ke.encode(Ge);class Ze{constructor(e,t){const{escapeName:r}=this.constructor,n=se.isString(t);let o=`Content-Disposition: form-data; name="${r(e)}"${!n&&t.name?`; filename="${r(t.name)}"`:""}${Ge}`;n?t=Ke.encode(String(t).replace(/\r?\n|\r\n?/g,Ge)):o+=`Content-Type: ${t.type||"application/octet-stream"}${Ge}`,this.headers=Ke.encode(o+Ge),this.contentLength=n?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;se.isTypedArray(e)?yield e:yield*Je(e),yield Xe}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}}var Qe=(e,t,r)=>{const{tag:n="form-data-boundary",size:o=25,boundary:s=n+"-"+se.generateString(o,Ve)}=r||{};if(!se.isFormData(e))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");const i=Ke.encode("--"+s+Ge),a=Ke.encode("--"+s+"--"+Ge+Ge);let c=a.byteLength;const u=Array.from(e.entries()).map((([e,t])=>{const r=new Ze(e,t);return c+=r.size,r}));c+=i.byteLength*u.length,c=se.toFiniteNumber(c);const d={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(c)&&(d["Content-Length"]=c),t&&t(d),l.Readable.from(async function*(){for(const e of u)yield i,yield*e.encode();yield a}())};class Ye extends S.default.Transform{__transform(e,t,r){this.push(e),r()}_transform(e,t,r){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,r)}}var et=Ye;const tt={flush:O.default.constants.Z_SYNC_FLUSH,finishFlush:O.default.constants.Z_SYNC_FLUSH},rt={flush:O.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:O.default.constants.BROTLI_OPERATION_FLUSH},nt=se.isFunction(O.default.createBrotliDecompress),{http:ot,https:st}=R.default,it=/https:?/,at=Re.protocols.map((e=>e+":"));function ct(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function ut(e,t,r){let n=t;if(!n&&!1!==n){const e=o.getProxyForUrl(r);e&&(n=new URL(e))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));const t=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=n.hostname||n.host;e.hostname=t,e.host=t,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(e){ut(e,t,e.href)}}const lt="undefined"!=typeof process&&"process"===se.kindOf(process);function dt(e,t){let r=0;const n=ze(50,250);return o=>{const s=o.loaded,i=o.lengthComputable?o.total:void 0,a=s-r,c=n(a);r=s;const u={loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}const ft={http:lt&&function(e){return t=async function(t,r,n){let{data:o}=e;const{responseType:s,responseEncoding:i}=e,a=e.method.toUpperCase();let c,u,l=!1;const d=new T.default,f=()=>{e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h),d.removeAllListeners()};function h(t){d.emit("abort",!t||t.type?new je(null,e,u):t)}n(((e,t)=>{c=!0,t&&(l=!0,f())})),d.once("abort",r),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h)));const p=Fe(e.baseURL,e.url),m=new URL(p,"http://localhost"),g=m.protocol||at[0];if("data:"===g){let n;if("GET"!==a)return De(t,r,{status:405,statusText:"method not allowed",headers:{},config:e});try{n=function(e,t,r){const n=r&&r.Blob||Re.classes.Blob,o=Ie(e);if(void 0===t&&n&&(t=!0),"data"===o){e=o.length?e.slice(o.length+1):e;const r=qe.exec(e);if(!r)throw new ie("Invalid URL",ie.ERR_INVALID_URL);const s=r[1],i=r[2],a=r[3],c=Buffer.from(decodeURIComponent(a),i?"base64":"utf8");if(t){if(!n)throw new ie("Blob is not supported",ie.ERR_NOT_SUPPORT);return new n([c],{type:s})}return c}throw new ie("Unsupported protocol "+o,ie.ERR_NOT_SUPPORT)}(e.url,"blob"===s,{Blob:e.env&&e.env.Blob})}catch(t){throw ie.from(t,ie.ERR_BAD_REQUEST,e)}return"text"===s?(n=n.toString(i),i&&"utf8"!==i||(n=se.stripBOM(n))):"stream"===s&&(n=S.default.Readable.from(n)),De(t,r,{data:n,status:200,statusText:"OK",headers:new Pe,config:e})}if(-1===at.indexOf(g))return r(new ie("Unsupported protocol "+g,ie.ERR_BAD_REQUEST,e));const y=Pe.from(e.headers).normalize();y.set("User-Agent","axios/"+Ue,!1);const R=e.onDownloadProgress,A=e.onUploadProgress,v=e.maxRate;let C,x;if(se.isSpecCompliantForm(o)){const e=y.getContentType(/boundary=([-_\w\d]{10,70})/i);o=Qe(o,(e=>{y.set(e)}),{tag:`axios-${Ue}-boundary`,boundary:e&&e[1]||void 0})}else if(se.isFormData(o)&&se.isFunction(o.getHeaders)){if(y.set(o.getHeaders()),!y.hasContentLength())try{const e=await E.default.promisify(o.getLength).call(o);Number.isFinite(e)&&e>=0&&y.setContentLength(e)}catch(e){}}else if(se.isBlob(o))o.size&&y.setContentType(o.type||"application/octet-stream"),y.setContentLength(o.size||0),o=S.default.Readable.from(Je(o));else if(o&&!se.isStream(o)){if(Buffer.isBuffer(o));else if(se.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else{if(!se.isString(o))return r(new ie("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",ie.ERR_BAD_REQUEST,e));o=Buffer.from(o,"utf-8")}if(y.setContentLength(o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return r(new ie("Request body larger than maxBodyLength limit",ie.ERR_BAD_REQUEST,e))}const N=se.toFiniteNumber(y.getContentLength());let _,L;se.isArray(v)?(C=v[0],x=v[1]):C=x=v,o&&(A||C)&&(se.isStream(o)||(o=S.default.Readable.from(o,{objectMode:!1})),o=S.default.pipeline([o,new $e({length:N,maxRate:se.toFiniteNumber(C)})],se.noop),A&&o.on("progress",(e=>{A(Object.assign(e,{upload:!0}))}))),e.auth&&(_=(e.auth.username||"")+":"+(e.auth.password||"")),!_&&m.username&&(_=m.username+":"+m.password),_&&y.delete("authorization");try{L=be(m.pathname+m.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const n=new Error(t.message);return n.config=e,n.url=e.url,n.exists=!0,r(n)}y.set("Accept-Encoding","gzip, compress, deflate"+(nt?", br":""),!1);const P={path:L,method:a,headers:y.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:_,protocol:g,beforeRedirect:ct,beforeRedirects:{}};let k;e.socketPath?P.socketPath=e.socketPath:(P.hostname=m.hostname,P.port=m.port,ut(P,e.proxy,g+"//"+m.hostname+(m.port?":"+m.port:"")+P.path));const B=it.test(P.protocol);if(P.agent=B?e.httpsAgent:e.httpAgent,e.transport?k=e.transport:0===e.maxRedirects?k=B?w.default:b.default:(e.maxRedirects&&(P.maxRedirects=e.maxRedirects),e.beforeRedirect&&(P.beforeRedirects.config=e.beforeRedirect),k=B?st:ot),e.maxBodyLength>-1?P.maxBodyLength=e.maxBodyLength:P.maxBodyLength=1/0,e.insecureHTTPParser&&(P.insecureHTTPParser=e.insecureHTTPParser),u=k.request(P,(function(n){if(u.destroyed)return;const o=[n],c=+n.headers["content-length"];if(R){const e=new $e({length:se.toFiniteNumber(c),maxRate:se.toFiniteNumber(x)});R&&e.on("progress",(e=>{R(Object.assign(e,{download:!0}))})),o.push(e)}let h=n;const p=n.req||u;if(!1!==e.decompress&&n.headers["content-encoding"])switch("HEAD"!==a&&204!==n.statusCode||delete n.headers["content-encoding"],n.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":o.push(O.default.createUnzip(tt)),delete n.headers["content-encoding"];break;case"deflate":o.push(new et),o.push(O.default.createUnzip(tt)),delete n.headers["content-encoding"];break;case"br":nt&&(o.push(O.default.createBrotliDecompress(rt)),delete n.headers["content-encoding"])}h=o.length>1?S.default.pipeline(o,se.noop):o[0];const m=S.default.finished(h,(()=>{m(),f()})),g={status:n.statusCode,statusText:n.statusMessage,headers:new Pe(n.headers),config:e,request:p};if("stream"===s)g.data=h,De(t,r,g);else{const n=[];let o=0;h.on("data",(function(t){n.push(t),o+=t.length,e.maxContentLength>-1&&o>e.maxContentLength&&(l=!0,h.destroy(),r(new ie("maxContentLength size of "+e.maxContentLength+" exceeded",ie.ERR_BAD_RESPONSE,e,p)))})),h.on("aborted",(function(){if(l)return;const t=new ie("maxContentLength size of "+e.maxContentLength+" exceeded",ie.ERR_BAD_RESPONSE,e,p);h.destroy(t),r(t)})),h.on("error",(function(t){u.destroyed||r(ie.from(t,null,e,p))})),h.on("end",(function(){try{let e=1===n.length?n[0]:Buffer.concat(n);"arraybuffer"!==s&&(e=e.toString(i),i&&"utf8"!==i||(e=se.stripBOM(e))),g.data=e}catch(t){r(ie.from(t,null,e,g.request,g))}De(t,r,g)}))}d.once("abort",(e=>{h.destroyed||(h.emit("error",e),h.destroy())}))})),d.once("abort",(e=>{r(e),u.destroy(e)})),u.on("error",(function(t){r(ie.from(t,null,e,u))})),u.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(isNaN(t))return void r(new ie("error trying to parse `config.timeout` to int",ie.ERR_BAD_OPTION_VALUE,e,u));u.setTimeout(t,(function(){if(c)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Ee;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new ie(t,n.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,u)),h()}))}if(se.isStream(o)){let t=!1,r=!1;o.on("end",(()=>{t=!0})),o.once("error",(e=>{r=!0,u.destroy(e)})),o.on("close",(()=>{t||r||h(new je("Request stream has been aborted",e,u))})),o.pipe(u)}else u.end(o)},new Promise(((e,r)=>{let n,o;const s=(e,t)=>{o||(o=!0,n&&n(e,t))},i=e=>{s(e,!0),r(e)};t((t=>{s(t),e(t)}),i,(e=>n=e)).catch(i)}));var t},xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const o=Pe.from(e.headers).normalize(),s=e.responseType;let i;function a(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}se.isFormData(n)&&Re.isStandardBrowserWebWorkerEnv&&o.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+r))}const u=Fe(e.baseURL,e.url);function l(){if(!c)return;const n=Pe.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());De((function(e){t(e),a()}),(function(e){r(e),a()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}c.open(e.method.toUpperCase(),be(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=l:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(l)},c.onabort=function(){c&&(r(new ie("Request aborted",ie.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new ie("Network Error",ie.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Ee;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new ie(t,n.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,c)),c=null},void 0===n&&o.setContentType(null),"setRequestHeader"in c&&se.forEach(o.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),se.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&"json"!==s&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",dt(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",dt(e.onUploadProgress)),(e.cancelToken||e.signal)&&(i=t=>{c&&(r(!t||t.type?new je(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i)));const d=Ie(u);d&&-1===Re.protocols.indexOf(d)?r(new ie("Unsupported protocol "+d+":",ie.ERR_BAD_REQUEST,e)):c.send(n||null)}))}};se.forEach(ft,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var ht={getAdapter:e=>{e=se.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let o=0;o<t&&(r=e[o],!(n=se.isString(r)?ft[r.toLowerCase()]:r));o++);if(!n){if(!1===n)throw new ie(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(se.hasOwnProp(ft,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!se.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:ft};function pt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new je(null,e)}function mt(e){pt(e),e.headers=Pe.from(e.headers),e.data=ke.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ht.getAdapter(e.adapter||Ae.adapter)(e).then((function(t){return pt(e),t.data=ke.call(e,e.transformResponse,t),t.headers=Pe.from(t.headers),t}),(function(t){return Be(t)||(pt(e),t&&t.response&&(t.response.data=ke.call(e,e.transformResponse,t.response),t.response.headers=Pe.from(t.response.headers))),Promise.reject(t)}))}const gt=e=>e instanceof Pe?e.toJSON():e;function yt(e,t){t=t||{};const r={};function n(e,t,r){return se.isPlainObject(e)&&se.isPlainObject(t)?se.merge.call({caseless:r},e,t):se.isPlainObject(t)?se.merge({},t):se.isArray(t)?t.slice():t}function o(e,t,r){return se.isUndefined(t)?se.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function s(e,t){if(!se.isUndefined(t))return n(void 0,t)}function i(e,t){return se.isUndefined(t)?se.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,o,s){return s in t?n(r,o):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t)=>o(gt(e),gt(t),!0)};return se.forEach(Object.keys(e).concat(Object.keys(t)),(function(n){const s=c[n]||o,i=s(e[n],t[n],n);se.isUndefined(i)&&s!==a||(r[n]=i)})),r}const bt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{bt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const wt={};bt.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Ue+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,s)=>{if(!1===e)throw new ie(n(o," has been removed"+(t?" in "+t:"")),ie.ERR_DEPRECATED);return t&&!wt[o]&&(wt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}};var Et={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ie("options must be an object",ie.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const t=e[s],r=void 0===t||i(t,s,e);if(!0!==r)throw new ie("option "+s+" must be "+r,ie.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new ie("Unknown option "+s,ie.ERR_BAD_OPTION)}},validators:bt};const Rt=Et.validators;class Ot{constructor(e){this.defaults=e,this.interceptors={request:new we,response:new we}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=yt(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;let s;void 0!==r&&Et.assertOptions(r,{silentJSONParsing:Rt.transitional(Rt.boolean),forcedJSONParsing:Rt.transitional(Rt.boolean),clarifyTimeoutError:Rt.transitional(Rt.boolean)},!1),void 0!==n&&Et.assertOptions(n,{encode:Rt.function,serialize:Rt.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),s=o&&se.merge(o.common,o[t.method]),s&&se.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Pe.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,d=0;if(!a){const e=[mt.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=i.length;let f=t;for(d=0;d<l;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=mt.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return be(Fe((e=yt(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}se.forEach(["delete","get","head","options"],(function(e){Ot.prototype[e]=function(t,r){return this.request(yt(r||{},{method:e,url:t,data:(r||{}).data}))}})),se.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,o){return this.request(yt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ot.prototype[e]=t(),Ot.prototype[e+"Form"]=t(!0)}));var St=Ot;class Tt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,o){r.reason||(r.reason=new je(e,n,o),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new Tt((function(t){e=t})),cancel:e}}}var At=Tt;const vt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(vt).forEach((([e,t])=>{vt[t]=e}));var Ct=vt;const xt=function e(t){const r=new St(t),n=v(St.prototype.request,r);return se.extend(n,St.prototype,r,{allOwnKeys:!0}),se.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(yt(t,r))},n}(Ae);xt.Axios=St,xt.CanceledError=je,xt.CancelToken=At,xt.isCancel=Be,xt.VERSION=Ue,xt.toFormData=he,xt.AxiosError=ie,xt.Cancel=xt.CanceledError,xt.all=function(e){return Promise.all(e)},xt.spread=function(e){return function(t){return e.apply(null,t)}},xt.isAxiosError=function(e){return se.isObject(e)&&!0===e.isAxiosError},xt.mergeConfig=yt,xt.AxiosHeaders=Pe,xt.formToJSON=e=>Oe(se.isHTMLForm(e)?new FormData(e):e),xt.HttpStatusCode=Ct,xt.default=xt;var Nt=xt;const _t="notify_discord_webhook";class Lt{static SimpleToRaw(e){return{name:"",notify_type:_t,notify:e}}static validateCreate(e){const t=/^(https?|ftp):\/\/(-\.)?([^\s/?\.#]+\.?)+([^\s\.?#]+)?(\?\S*)?$/;return A.object({url:A.string().matches(t,"url is not a valid url").required(),username:A.string(),avatar_url:A.string().matches(t,"url is not a valid url"),message:A.string().required()}).validate(e)}}class Pt{static SimpleToRaw(e,t){if("Discord"===e)return Lt.SimpleToRaw(t)}}class kt{static SimpleToRaw(e,t,r){return{alertType:"event",network:t,nickname:e,type:"handler_function_call",handler:r}}static validateCreate(e){const t=([e],t)=>"true"===e?t.notRequired():t.required();return A.object({address:A.string().required(),abi:A.array().required(),nBlocks:A.number().min(10),condition:A.string().oneOf([">",">=","<","<=","=","true"]),constant:A.number().min(0).when("condition",t),responseArgIndex:A.number().min(0).when("condition",t),responseArgDecimals:A.number().min(0).when("condition",t)}).validate(e)}}class Bt{static SimpleToRaw(e,t,r){return{alertType:"event",network:t,nickname:e,type:"handler_onchain_event",handler:r}}static validateCreate(e){const t=([e],t)=>"true"===e?t.notRequired():t.required();return A.object({address:A.string().required(),event:A.string().required(),abi:A.array().required(),condition:A.string().oneOf([">",">=","<","<=","=","true"]),constant:A.number().min(0).when("condition",t),paramsIndex:A.number().min(0).when("condition",t),paramsDecimals:A.number().min(0).when("condition",t)}).validate(e)}static validateUpdate(e){}}class jt{api;data=[];constructor(e){this.api=e}static create(e){return new jt(e)}getAbiHash(e){if(void 0===this.api)throw new Error("FunctionBuilder must be initialised with api");return this.api.getAbiHash(e)}async addFunction(e,t,r,n){const o=new h.ethers.Contract(e,n);return o.interface.encodeFunctionData(t,r),this.data.push({address:e,bytecode:o.interface.encodeFunctionData(t,r),abiHash:await this.getAbiHash(n),function:t}),this}get(){return this.data}static schema(){return A.array().of(A.object({address:A.string().required(),bytecode:A.string().matches(/^(0x)?([0-9a-fA-F]{2})*$/).required(),abiHash:A.string().matches(/^[A-Fa-f0-9]{64}/).required(),function:A.string().required()}))}}class Dt{static version(){return"v1"}static execute(e,t,r="v1"){const n=JSON.parse(JSON.stringify(t));let o=!0;for(const t of n){const r=Dt.process(e,t.conditions);o=Dt.execLogic(o,t.logic,r)}return o}static process(e,t,r){const n=t.shift();if(!n)return void 0===r||r;const o=Dt.execCondition(e,n);if(void 0===r||"WHERE"===n.logic)return Dt.process(e,t,o);if(void 0===n.logic)throw new Error("Invalid filter. Condition must have logic value");const s=Dt.execLogic(r,n.logic,o);return Dt.process(e,t,s)}static execLogic(e,t,r){switch(t){case"AND":return e&&r;case"OR":return e||r;case"XOR":return(e||r)&&!(e&&r);case"NAND":case"NOR":return!(e&&r);case"WHERE":return r;default:throw new Error(`Invalid Filter. Bad logic value: ${t}`)}}static execCondition(e,t){const r=e[t.key];if("Number"===t.type){if("number"!=typeof t.constant||"number"!=typeof r)throw new Error(`Invalid filter. Type miss-match. Type: ${t.type}, Variable: ${t.constant}, Data: ${r}`);const e=r,n=t.constant;switch(t.operation){case"eq":return e===n;case"!eq":return e!==n;case"gt":return e>n;case"gte":return e>=n;case"lt":return e<n;case"lte":return e<=n;default:throw new Error("Invalid Filter. Operation does not match type")}}if("String"===t.type){if("string"!=typeof t.constant||"string"!=typeof r)throw new Error(`Invalid filter. Type miss-match. Type: ${t.type}, Variable: ${t.constant}, Data: ${r}`);const e=r,n=t.constant;switch(t.operation){case"contains":return e.includes(n);case"!contains":return!e.includes(n);case"is":return e===n;case"!is":return e!==n;case"isEmpty":return""===e;case"!isEmpty":return""!==e;default:throw new Error("Invalid Filter. Operation does not match type")}}if("Address"===t.type){if("string"!=typeof t.constant||"string"!=typeof r)throw new Error(`Invalid filter. Type miss-match. Type: ${t.type}, Variable: ${t.constant}, Data: ${r}`);const e=r,n=t.constant;switch(t.operation){case"contains":return e.toLowerCase().includes(n.toLowerCase());case"!contains":return!e.toLowerCase().includes(n.toLowerCase());case"is":return e.toLowerCase()===n.toLowerCase();case"!is":return e.toLowerCase()!==n.toLowerCase();case"isEmpty":return""===e;case"!isEmpty":return""!==e;default:throw new Error("Invalid Filter. Operation does not match type")}}throw new Error("Invalid Filter. Unknown Type")}}class Ft{groups=[];constructor(){this.newGroup("WHERE")}static version(){return Dt.version()}static new(){return new Ft}newGroup(e){if(0!==this.groups.length&&"WHERE"===e)throw new Error('Only the first groups can start with "WHERE"');return this.groups.push({logic:"WHERE",conditions:[]}),this}addCondition(e,t,r,n,o){const s=this.groups[this.groups.length-1];if(0===s.conditions.length&&"WHERE"!==e)throw new Error('Logic for the first condition of a group must be "WHERE"');if(s.conditions.length>0&&"WHERE"===e)throw new Error('Only the first condition of a group can be "WHERE"');return s.conditions.push({logic:e,key:t,type:r,operation:n,constant:o}),this}finalise(){for(const e of this.groups)if(0===e.conditions.length)throw new Error("Bad Filter. All Groups must have atleast one condition");return this.groups}static schema(){const e=A.string().oneOf(["AND","OR","XOR","NAND","NOR","WHERE"]).required(),t=A.object({logic:e,key:A.string().required(),type:A.string().oneOf(["String","Address","Number"]).required(),operation:A.string().when("type",(([e],t)=>{switch(e){case"String":return t.oneOf(["contains","!contains","is","!is","isEmpty","!isEmpty"]);case"Address":return t.oneOf(["is","!is","isEmpty","!isEmpty"]);case"Number":return t.oneOf(["String","Address","Number"]);default:throw new Error("Invalid Filter Data Type")}})),constant:A.mixed().when("type",(([e])=>{switch(e){case"String":case"Address":return A.string();case"Number":return A.number();default:throw new Error("Invalid Filter Data Type")}}))});return A.array().of(A.object({logic:e,conditions:A.array().of(t)}))}}class Ut{static SimpleToRaw(e,t,r){return{alertType:"event",network:t,nickname:e,type:"handler_function_call_v2",handler:r}}static validateCreate(e){return A.object({timeBase:A.string().oneOf(["blocks","time"]).required(),nBlocks:A.number().min(10).when("timeBase",(([e],t)=>"blocks"===e?t.required():t)),timePeriod:A.string().matches(/^(\d+)([SMHD])$/i,"timePeriod must be of the format n[s|m|h|d], eg 10s for 10 seconds").when("timeBase",(([e],t)=>"time"===e?t.required():t)),startTime:A.number().default(0),debounceCount:A.number(),functions:jt.schema(),triggerOn:A.string().oneOf(["always","filter"]).default("always"),latch:A.boolean().default(!1),filterVersion:A.string().when("triggerOn",(([e],t)=>"filter"===e?t.required():t)),filter:Ft.schema().when("triggerOn",(([e],t)=>"filter"===e?t.required():t))}).validate(e)}}class It{static SimpleToRaw(e,t,r,n){switch(t){case"PollFunctionV2":return Ut.SimpleToRaw(e,r,n);case"PollFunctionV1":return kt.SimpleToRaw(e,r,n);case"OnchainEventV1":return Bt.SimpleToRaw(e,r,n);default:throw new Error("Invalid Trigger ID")}}}const qt=e=>`https://${e}.functions.supabase.co/`,zt=e=>`https://${e}.supabase.co/`,Ht="fdgtrxmmrtlokhgkvcjz";class Mt{url;token;headers={};constructor(e,t){this.url=e,this.token=t,this.headers={Authorization:`Bearer ${t}`,"Content-Type":"application/json"}}static async create(e){if(e.key)throw new Error("Auth by key not yet supported");if(e.email&&e.password){const r=e.projectId?zt(e.projectId):zt(Ht),n=e.projectId?qt(e.projectId):qt(Ht),o=e.anonKey?e.anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZkZ3RyeG1tcnRsb2toZ2t2Y2p6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzMwODcwNzYsImV4cCI6MTk4ODY2MzA3Nn0.sAMxjlcJSSozBGr-LNcsudyxzUEM9e-UspMHHQLqLr4",s=t.createClient(r,o),{data:i,error:a}=await s.auth.signInWithPassword({email:e.email,password:e.password});if(a)throw a;if(void 0===i.session?.access_token)throw new Error("Access token not found");return new Mt(n,i.session?.access_token)}throw new Error("Authentication Required. DeNotify supports either username/password or API key authentication")}async alertHistory(e,t={}){return await this.request("get","alert-history"+(e?"/"+e:""),{params:t})}async getAlert(e){return(await this.request("get",`alerts/${e}`))[0]}async getAlerts(){return await this.request("get","alerts")}async createAlert(e){const t=It.SimpleToRaw(e.name,e.triggerId,e.network,e.trigger),r=Pt.SimpleToRaw(e.notificationId,e.notification);return await this.request("post","alerts",{body:{trigger:t,notification:r}})}async deleteAlert(e){return await this.request("delete",`alerts/${e}`)}async request(e,t,r={}){const n=new URL(`${this.url}${t}`);if(r.params)for(const e of Object.keys(r.params))n.searchParams.append(e,r.params[e]);const o={method:e,url:n.toString(),headers:this.headers};r.body&&(o.data=r.body);return(await Nt(o)).data}async getAbi(e,t){return await this.request("get",`abi/${e}/${t}`)}async getAbiHash(e){return(await this.request("post","abi",{body:e})).hash}async setAlertName(e,t){throw new Error("Not yet supported - Sorry!")}async enableAlert(e){throw new Error("Not yet supported - Sorry!")}async disableAlert(e){throw new Error("Not yet supported - Sorry!")}async updateNotification(e){throw new Error("Not yet supported - Sorry!")}async updateTrigger(e,t){return await this.request("patch",`alerts/trigger-handler/${e}`,{body:t})}}class $t{name;network;triggerId;trigger;notificationId;notification;constructor(e){this.name=e}static create(e){return new $t(e)}onNetwork(e){return this.network=e,this}withTrigger(e,t){return this.triggerId=e,this.trigger=t,this}withNotification(e,t){return this.notificationId=e,this.notification=t,this}async validate(){switch(this.triggerId){case"OnchainEventV1":return Bt.validateCreate(this.trigger);case"PollFunctionV1":return kt.validateCreate(this.trigger);case"PollFunctionV2":return Ut.validateCreate(this.trigger)}if("Discord"===this.notificationId)return Lt.validateCreate(this.notification)}async config(){if(void 0===this.trigger||void 0===this.triggerId)throw new Error("Trigger not configured");if(void 0===this.notification||void 0===this.notificationId)throw new Error("Notification not configured");if(void 0===this.network)throw new Error("Network not configured");return await this.validate(),{name:this.name,network:this.network,triggerId:this.triggerId,trigger:this.trigger,notificationId:this.notificationId,notification:this.notification}}}var Wt=Object.freeze({__proto__:null,Trigger:It,HandlerFunctionCallV2:Ut,HandlerFunctionCall:kt,HandlerOnchainEvent:Bt}),Jt=Object.freeze({__proto__:null,NOTIFY_DISCORD_WEBHOOK_RAW_ID:_t,NotifyDiscordWebhook:Lt,Notification:Pt});e.AlertBuilder=$t,e.DeNotifyClient=Mt,e.FilterBuilder=Ft,e.FunctionBuilder=jt,e.Notification=Jt,e.Trigger=Wt}));
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@supabase/supabase-js"),require("form-data"),require("url"),require("proxy-from-env"),require("http"),require("https"),require("util"),require("follow-redirects"),require("zlib"),require("stream"),require("events"),require("yup"),require("ethers")):"function"==typeof define&&define.amd?define(["exports","@supabase/supabase-js","form-data","url","proxy-from-env","http","https","util","follow-redirects","zlib","stream","events","yup","ethers"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["denotify-client"]={},e.supabaseJs,e.FormData$1,e.url,e.proxyFromEnv,e.http,e.https,e.util,e.followRedirects,e.zlib,e.stream,e.EventEmitter,e.yup,e.ethers)}(this,(function(e,t,r,n,o,s,i,a,c,u,l,d,f,h){"use strict";function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var g=p(r),y=p(n),b=p(s),w=p(i),E=p(a),R=p(c),O=p(u),S=p(l),T=p(d),A=m(f);function v(e,t){return function(){return e.apply(t,arguments)}}const{toString:C}=Object.prototype,{getPrototypeOf:x}=Object,N=(_=Object.create(null),e=>{const t=C.call(e);return _[t]||(_[t]=t.slice(8,-1).toLowerCase())});var _;const L=e=>(e=e.toLowerCase(),t=>N(t)===e),P=e=>t=>typeof t===e,{isArray:k}=Array,j=P("undefined");const B=L("ArrayBuffer");const D=P("string"),F=P("function"),U=P("number"),I=e=>null!==e&&"object"==typeof e,q=e=>{if("object"!==N(e))return!1;const t=x(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},z=L("Date"),H=L("File"),M=L("Blob"),$=L("FileList"),W=L("URLSearchParams");function J(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),k(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function V(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const K="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,G=e=>!j(e)&&e!==K;const X=(Z="undefined"!=typeof Uint8Array&&x(Uint8Array),e=>Z&&e instanceof Z);var Z;const Q=L("HTMLFormElement"),Y=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ee=L("RegExp"),te=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};J(r,((r,o)=>{!1!==t(r,o,e)&&(n[o]=r)})),Object.defineProperties(e,n)},re="abcdefghijklmnopqrstuvwxyz",ne="0123456789",oe={DIGIT:ne,ALPHA:re,ALPHA_DIGIT:re+re.toUpperCase()+ne};var se={isArray:k,isArrayBuffer:B,isBuffer:function(e){return null!==e&&!j(e)&&null!==e.constructor&&!j(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||C.call(e)===t||F(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&B(e.buffer),t},isString:D,isNumber:U,isBoolean:e=>!0===e||!1===e,isObject:I,isPlainObject:q,isUndefined:j,isDate:z,isFile:H,isBlob:M,isRegExp:ee,isFunction:F,isStream:e=>I(e)&&F(e.pipe),isURLSearchParams:W,isTypedArray:X,isFileList:$,forEach:J,merge:function e(){const{caseless:t}=G(this)&&this||{},r={},n=(n,o)=>{const s=t&&V(r,o)||o;q(r[s])&&q(n)?r[s]=e(r[s],n):q(n)?r[s]=e({},n):k(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&J(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(J(t,((t,n)=>{r&&F(t)?e[n]=v(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&x(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:N,kindOfTest:L,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(k(e))return e;let t=e.length;if(!U(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Q,hasOwnProperty:Y,hasOwnProp:Y,reduceDescriptors:te,freezeMethods:e=>{te(e,((t,r)=>{if(F(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];F(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return k(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:V,global:K,isContextDefined:G,ALPHABET:oe,generateString:(e=16,t=oe.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&F(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(I(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=k(e)?[]:{};return J(e,((e,t)=>{const s=r(e,n+1);!j(s)&&(o[t]=s)})),t[n]=void 0,o}}return e};return r(e,0)}};function ie(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}se.inherits(ie,Error,{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:se.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ae=ie.prototype,ce={};function ue(e){return se.isPlainObject(e)||se.isArray(e)}function le(e){return se.endsWith(e,"[]")?e.slice(0,-2):e}function de(e,t,r){return e?e.concat(t).map((function(e,t){return e=le(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{ce[e]={value:e}})),Object.defineProperties(ie,ce),Object.defineProperty(ae,"isAxiosError",{value:!0}),ie.from=(e,t,r,n,o,s)=>{const i=Object.create(ae);return se.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),ie.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};const fe=se.toFlatObject(se,{},null,(function(e){return/^is[A-Z]/.test(e)}));function he(e,t,r){if(!se.isObject(e))throw new TypeError("target must be an object");t=t||new(g.default||FormData);const n=(r=se.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!se.isUndefined(t[e])}))).metaTokens,o=r.visitor||u,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&se.isSpecCompliantForm(t);if(!se.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(se.isDate(e))return e.toISOString();if(!a&&se.isBlob(e))throw new ie("Blob is not supported. Use a Buffer instead.");return se.isArrayBuffer(e)||se.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(se.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(se.isArray(e)&&function(e){return se.isArray(e)&&!e.some(ue)}(e)||(se.isFileList(e)||se.endsWith(r,"[]"))&&(a=se.toArray(e)))return r=le(r),a.forEach((function(e,n){!se.isUndefined(e)&&null!==e&&t.append(!0===i?de([r],n,s):null===i?r:r+"[]",c(e))})),!1;return!!ue(e)||(t.append(de(o,r,s),c(e)),!1)}const l=[],d=Object.assign(fe,{defaultVisitor:u,convertValue:c,isVisitable:ue});if(!se.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!se.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),se.forEach(r,(function(r,s){!0===(!(se.isUndefined(r)||null===r)&&o.call(t,r,se.isString(s)?s.trim():s,n,d))&&e(r,n?n.concat(s):[s])})),l.pop()}}(e),t}function pe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function me(e,t){this._pairs=[],e&&he(e,this,t)}const ge=me.prototype;function ye(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function be(e,t,r){if(!t)return e;const n=r&&r.encode||ye,o=r&&r.serialize;let s;if(s=o?o(t,r):se.isURLSearchParams(t)?t.toString():new me(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ge.append=function(e,t){this._pairs.push([e,t])},ge.toString=function(e){const t=e?function(t){return e.call(this,t,pe)}:pe;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var we=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){se.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Ee={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Re={isNode:!0,classes:{URLSearchParams:y.default.URLSearchParams,FormData:g.default,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function Oe(e){function t(e,r,n,o){let s=e[o++];const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&se.isArray(n)?n.length:s,a)return se.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!i;n[s]&&se.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],o)&&se.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}(n[s])),!i}if(se.isFormData(e)&&se.isFunction(e.entries)){const r={};return se.forEachEntry(e,((e,n)=>{t(function(e){return se.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const Se={"Content-Type":void 0};const Te={transitional:Ee,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=se.isObject(e);o&&se.isHTMLForm(e)&&(e=new FormData(e));if(se.isFormData(e))return n&&n?JSON.stringify(Oe(e)):e;if(se.isArrayBuffer(e)||se.isBuffer(e)||se.isStream(e)||se.isFile(e)||se.isBlob(e))return e;if(se.isArrayBufferView(e))return e.buffer;if(se.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return he(e,new Re.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return se.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=se.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return he(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(se.isString(e))try{return(t||JSON.parse)(e),se.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Te.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&se.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw ie.from(e,ie.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Re.classes.FormData,Blob:Re.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};se.forEach(["delete","get","head"],(function(e){Te.headers[e]={}})),se.forEach(["post","put","patch"],(function(e){Te.headers[e]=se.merge(Se)}));var Ae=Te;const ve=se.toObjectSet(["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"]);const Ce=Symbol("internals");function xe(e){return e&&String(e).trim().toLowerCase()}function Ne(e){return!1===e||null==e?e:se.isArray(e)?e.map(Ne):String(e)}function _e(e,t,r,n,o){return se.isFunction(n)?n.call(this,t,r):(o&&(t=r),se.isString(t)?se.isString(n)?-1!==t.indexOf(n):se.isRegExp(n)?n.test(t):void 0:void 0)}class Le{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=xe(t);if(!o)throw new Error("header name must be a non-empty string");const s=se.findKey(n,o);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=Ne(e))}const s=(e,t)=>se.forEach(e,((e,r)=>o(e,r,t)));return se.isPlainObject(e)||e instanceof this.constructor?s(e,t):se.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?s((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&ve[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&o(t,e,r),this}get(e,t){if(e=xe(e)){const r=se.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(se.isFunction(t))return t.call(this,e,r);if(se.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=xe(e)){const r=se.findKey(this,e);return!(!r||void 0===this[r]||t&&!_e(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=xe(e)){const o=se.findKey(r,e);!o||t&&!_e(0,r[o],o,t)||(delete r[o],n=!0)}}return se.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!_e(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return se.forEach(this,((n,o)=>{const s=se.findKey(r,o);if(s)return t[s]=Ne(n),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(o):String(o).trim();i!==o&&delete t[o],t[i]=Ne(n),r[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return se.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&se.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[Ce]=this[Ce]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=xe(e);t[n]||(!function(e,t){const r=se.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})}))}(r,e),t[n]=!0)}return se.isArray(e)?e.forEach(n):n(e),this}}Le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),se.freezeMethods(Le.prototype),se.freezeMethods(Le);var Pe=Le;function ke(e,t){const r=this||Ae,n=t||r,o=Pe.from(n.headers);let s=n.data;return se.forEach(e,(function(e){s=e.call(r,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function je(e){return!(!e||!e.__CANCEL__)}function Be(e,t,r){ie.call(this,null==e?"canceled":e,ie.ERR_CANCELED,t,r),this.name="CanceledError"}function De(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ie("Request failed with status code "+r.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}function Fe(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}se.inherits(Be,ie,{__CANCEL__:!0});const Ue="1.3.4";function Ie(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const qe=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function ze(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=n[i];o||(o=c),r[s]=a,n[s]=c;let l=i,d=0;for(;l!==s;)d+=r[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}const He=Symbol("internals");class Me extends S.default.Transform{constructor(e){super({readableHighWaterMark:(e=se.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!se.isUndefined(t[e])))).chunkSize});const t=this,r=this[He]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},n=ze(r.ticksRate*e.samplesCount,r.timeWindow);this.on("newListener",(e=>{"progress"===e&&(r.isCaptured||(r.isCaptured=!0))}));let o=0;r.updateProgress=function(e,t){let r=0;const n=1e3/t;let o=null;return function(t,s){const i=Date.now();if(t||i-r>n)return o&&(clearTimeout(o),o=null),r=i,e.apply(null,s);o||(o=setTimeout((()=>(o=null,r=Date.now(),e.apply(null,s))),n-(i-r)))}}((function(){const e=r.length,s=r.bytesSeen,i=s-o;if(!i||t.destroyed)return;const a=n(i);o=s,process.nextTick((()=>{t.emit("progress",{loaded:s,total:e,progress:e?s/e:void 0,bytes:i,rate:a||void 0,estimated:a&&e&&s<=e?(e-s)/a:void 0})}))}),r.ticksRate);const s=()=>{r.updateProgress(!0)};this.once("end",s),this.once("error",s)}_read(e){const t=this[He];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,r){const n=this,o=this[He],s=o.maxRate,i=this.readableHighWaterMark,a=o.timeWindow,c=s/(1e3/a),u=!1!==o.minChunkSize?Math.max(o.minChunkSize,.01*c):0;const l=(e,t)=>{const r=Buffer.byteLength(e);let l,d=null,f=i,h=0;if(s){const e=Date.now();(!o.ts||(h=e-o.ts)>=a)&&(o.ts=e,l=c-o.bytes,o.bytes=l<0?-l:0,h=0),l=c-o.bytes}if(s){if(l<=0)return setTimeout((()=>{t(null,e)}),a-h);l<f&&(f=l)}f&&r>f&&r-f>u&&(d=e.subarray(f),e=e.subarray(0,f)),function(e,t){const r=Buffer.byteLength(e);o.bytesSeen+=r,o.bytes+=r,o.isCaptured&&o.updateProgress(),n.push(e)?process.nextTick(t):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(t)}}(e,d?()=>{process.nextTick(t,null,d)}:t)};l(e,(function e(t,n){if(t)return r(t);n?l(n,e):r(null)}))}setLength(e){return this[He].length=+e,this}}var $e=Me;const{asyncIterator:We}=Symbol;var Je=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[We]?yield*e[We]():yield e};const Ve=se.ALPHABET.ALPHA_DIGIT+"-_",Ke=new a.TextEncoder,Ge="\r\n",Xe=Ke.encode(Ge);class Ze{constructor(e,t){const{escapeName:r}=this.constructor,n=se.isString(t);let o=`Content-Disposition: form-data; name="${r(e)}"${!n&&t.name?`; filename="${r(t.name)}"`:""}${Ge}`;n?t=Ke.encode(String(t).replace(/\r?\n|\r\n?/g,Ge)):o+=`Content-Type: ${t.type||"application/octet-stream"}${Ge}`,this.headers=Ke.encode(o+Ge),this.contentLength=n?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;se.isTypedArray(e)?yield e:yield*Je(e),yield Xe}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}}var Qe=(e,t,r)=>{const{tag:n="form-data-boundary",size:o=25,boundary:s=n+"-"+se.generateString(o,Ve)}=r||{};if(!se.isFormData(e))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");const i=Ke.encode("--"+s+Ge),a=Ke.encode("--"+s+"--"+Ge+Ge);let c=a.byteLength;const u=Array.from(e.entries()).map((([e,t])=>{const r=new Ze(e,t);return c+=r.size,r}));c+=i.byteLength*u.length,c=se.toFiniteNumber(c);const d={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(c)&&(d["Content-Length"]=c),t&&t(d),l.Readable.from(async function*(){for(const e of u)yield i,yield*e.encode();yield a}())};class Ye extends S.default.Transform{__transform(e,t,r){this.push(e),r()}_transform(e,t,r){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,r)}}var et=Ye;const tt={flush:O.default.constants.Z_SYNC_FLUSH,finishFlush:O.default.constants.Z_SYNC_FLUSH},rt={flush:O.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:O.default.constants.BROTLI_OPERATION_FLUSH},nt=se.isFunction(O.default.createBrotliDecompress),{http:ot,https:st}=R.default,it=/https:?/,at=Re.protocols.map((e=>e+":"));function ct(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function ut(e,t,r){let n=t;if(!n&&!1!==n){const e=o.getProxyForUrl(r);e&&(n=new URL(e))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));const t=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=n.hostname||n.host;e.hostname=t,e.host=t,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(e){ut(e,t,e.href)}}const lt="undefined"!=typeof process&&"process"===se.kindOf(process);function dt(e,t){let r=0;const n=ze(50,250);return o=>{const s=o.loaded,i=o.lengthComputable?o.total:void 0,a=s-r,c=n(a);r=s;const u={loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}const ft={http:lt&&function(e){return t=async function(t,r,n){let{data:o}=e;const{responseType:s,responseEncoding:i}=e,a=e.method.toUpperCase();let c,u,l=!1;const d=new T.default,f=()=>{e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h),d.removeAllListeners()};function h(t){d.emit("abort",!t||t.type?new Be(null,e,u):t)}n(((e,t)=>{c=!0,t&&(l=!0,f())})),d.once("abort",r),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h)));const p=Fe(e.baseURL,e.url),m=new URL(p,"http://localhost"),g=m.protocol||at[0];if("data:"===g){let n;if("GET"!==a)return De(t,r,{status:405,statusText:"method not allowed",headers:{},config:e});try{n=function(e,t,r){const n=r&&r.Blob||Re.classes.Blob,o=Ie(e);if(void 0===t&&n&&(t=!0),"data"===o){e=o.length?e.slice(o.length+1):e;const r=qe.exec(e);if(!r)throw new ie("Invalid URL",ie.ERR_INVALID_URL);const s=r[1],i=r[2],a=r[3],c=Buffer.from(decodeURIComponent(a),i?"base64":"utf8");if(t){if(!n)throw new ie("Blob is not supported",ie.ERR_NOT_SUPPORT);return new n([c],{type:s})}return c}throw new ie("Unsupported protocol "+o,ie.ERR_NOT_SUPPORT)}(e.url,"blob"===s,{Blob:e.env&&e.env.Blob})}catch(t){throw ie.from(t,ie.ERR_BAD_REQUEST,e)}return"text"===s?(n=n.toString(i),i&&"utf8"!==i||(n=se.stripBOM(n))):"stream"===s&&(n=S.default.Readable.from(n)),De(t,r,{data:n,status:200,statusText:"OK",headers:new Pe,config:e})}if(-1===at.indexOf(g))return r(new ie("Unsupported protocol "+g,ie.ERR_BAD_REQUEST,e));const y=Pe.from(e.headers).normalize();y.set("User-Agent","axios/"+Ue,!1);const R=e.onDownloadProgress,A=e.onUploadProgress,v=e.maxRate;let C,x;if(se.isSpecCompliantForm(o)){const e=y.getContentType(/boundary=([-_\w\d]{10,70})/i);o=Qe(o,(e=>{y.set(e)}),{tag:`axios-${Ue}-boundary`,boundary:e&&e[1]||void 0})}else if(se.isFormData(o)&&se.isFunction(o.getHeaders)){if(y.set(o.getHeaders()),!y.hasContentLength())try{const e=await E.default.promisify(o.getLength).call(o);Number.isFinite(e)&&e>=0&&y.setContentLength(e)}catch(e){}}else if(se.isBlob(o))o.size&&y.setContentType(o.type||"application/octet-stream"),y.setContentLength(o.size||0),o=S.default.Readable.from(Je(o));else if(o&&!se.isStream(o)){if(Buffer.isBuffer(o));else if(se.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else{if(!se.isString(o))return r(new ie("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",ie.ERR_BAD_REQUEST,e));o=Buffer.from(o,"utf-8")}if(y.setContentLength(o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return r(new ie("Request body larger than maxBodyLength limit",ie.ERR_BAD_REQUEST,e))}const N=se.toFiniteNumber(y.getContentLength());let _,L;se.isArray(v)?(C=v[0],x=v[1]):C=x=v,o&&(A||C)&&(se.isStream(o)||(o=S.default.Readable.from(o,{objectMode:!1})),o=S.default.pipeline([o,new $e({length:N,maxRate:se.toFiniteNumber(C)})],se.noop),A&&o.on("progress",(e=>{A(Object.assign(e,{upload:!0}))}))),e.auth&&(_=(e.auth.username||"")+":"+(e.auth.password||"")),!_&&m.username&&(_=m.username+":"+m.password),_&&y.delete("authorization");try{L=be(m.pathname+m.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const n=new Error(t.message);return n.config=e,n.url=e.url,n.exists=!0,r(n)}y.set("Accept-Encoding","gzip, compress, deflate"+(nt?", br":""),!1);const P={path:L,method:a,headers:y.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:_,protocol:g,beforeRedirect:ct,beforeRedirects:{}};let k;e.socketPath?P.socketPath=e.socketPath:(P.hostname=m.hostname,P.port=m.port,ut(P,e.proxy,g+"//"+m.hostname+(m.port?":"+m.port:"")+P.path));const j=it.test(P.protocol);if(P.agent=j?e.httpsAgent:e.httpAgent,e.transport?k=e.transport:0===e.maxRedirects?k=j?w.default:b.default:(e.maxRedirects&&(P.maxRedirects=e.maxRedirects),e.beforeRedirect&&(P.beforeRedirects.config=e.beforeRedirect),k=j?st:ot),e.maxBodyLength>-1?P.maxBodyLength=e.maxBodyLength:P.maxBodyLength=1/0,e.insecureHTTPParser&&(P.insecureHTTPParser=e.insecureHTTPParser),u=k.request(P,(function(n){if(u.destroyed)return;const o=[n],c=+n.headers["content-length"];if(R){const e=new $e({length:se.toFiniteNumber(c),maxRate:se.toFiniteNumber(x)});R&&e.on("progress",(e=>{R(Object.assign(e,{download:!0}))})),o.push(e)}let h=n;const p=n.req||u;if(!1!==e.decompress&&n.headers["content-encoding"])switch("HEAD"!==a&&204!==n.statusCode||delete n.headers["content-encoding"],n.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":o.push(O.default.createUnzip(tt)),delete n.headers["content-encoding"];break;case"deflate":o.push(new et),o.push(O.default.createUnzip(tt)),delete n.headers["content-encoding"];break;case"br":nt&&(o.push(O.default.createBrotliDecompress(rt)),delete n.headers["content-encoding"])}h=o.length>1?S.default.pipeline(o,se.noop):o[0];const m=S.default.finished(h,(()=>{m(),f()})),g={status:n.statusCode,statusText:n.statusMessage,headers:new Pe(n.headers),config:e,request:p};if("stream"===s)g.data=h,De(t,r,g);else{const n=[];let o=0;h.on("data",(function(t){n.push(t),o+=t.length,e.maxContentLength>-1&&o>e.maxContentLength&&(l=!0,h.destroy(),r(new ie("maxContentLength size of "+e.maxContentLength+" exceeded",ie.ERR_BAD_RESPONSE,e,p)))})),h.on("aborted",(function(){if(l)return;const t=new ie("maxContentLength size of "+e.maxContentLength+" exceeded",ie.ERR_BAD_RESPONSE,e,p);h.destroy(t),r(t)})),h.on("error",(function(t){u.destroyed||r(ie.from(t,null,e,p))})),h.on("end",(function(){try{let e=1===n.length?n[0]:Buffer.concat(n);"arraybuffer"!==s&&(e=e.toString(i),i&&"utf8"!==i||(e=se.stripBOM(e))),g.data=e}catch(t){r(ie.from(t,null,e,g.request,g))}De(t,r,g)}))}d.once("abort",(e=>{h.destroyed||(h.emit("error",e),h.destroy())}))})),d.once("abort",(e=>{r(e),u.destroy(e)})),u.on("error",(function(t){r(ie.from(t,null,e,u))})),u.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(isNaN(t))return void r(new ie("error trying to parse `config.timeout` to int",ie.ERR_BAD_OPTION_VALUE,e,u));u.setTimeout(t,(function(){if(c)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Ee;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new ie(t,n.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,u)),h()}))}if(se.isStream(o)){let t=!1,r=!1;o.on("end",(()=>{t=!0})),o.once("error",(e=>{r=!0,u.destroy(e)})),o.on("close",(()=>{t||r||h(new Be("Request stream has been aborted",e,u))})),o.pipe(u)}else u.end(o)},new Promise(((e,r)=>{let n,o;const s=(e,t)=>{o||(o=!0,n&&n(e,t))},i=e=>{s(e,!0),r(e)};t((t=>{s(t),e(t)}),i,(e=>n=e)).catch(i)}));var t},xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const o=Pe.from(e.headers).normalize(),s=e.responseType;let i;function a(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}se.isFormData(n)&&Re.isStandardBrowserWebWorkerEnv&&o.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+r))}const u=Fe(e.baseURL,e.url);function l(){if(!c)return;const n=Pe.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());De((function(e){t(e),a()}),(function(e){r(e),a()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}c.open(e.method.toUpperCase(),be(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=l:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(l)},c.onabort=function(){c&&(r(new ie("Request aborted",ie.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new ie("Network Error",ie.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Ee;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new ie(t,n.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,c)),c=null},void 0===n&&o.setContentType(null),"setRequestHeader"in c&&se.forEach(o.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),se.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&"json"!==s&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",dt(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",dt(e.onUploadProgress)),(e.cancelToken||e.signal)&&(i=t=>{c&&(r(!t||t.type?new Be(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i)));const d=Ie(u);d&&-1===Re.protocols.indexOf(d)?r(new ie("Unsupported protocol "+d+":",ie.ERR_BAD_REQUEST,e)):c.send(n||null)}))}};se.forEach(ft,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var ht={getAdapter:e=>{e=se.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let o=0;o<t&&(r=e[o],!(n=se.isString(r)?ft[r.toLowerCase()]:r));o++);if(!n){if(!1===n)throw new ie(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(se.hasOwnProp(ft,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!se.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:ft};function pt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Be(null,e)}function mt(e){pt(e),e.headers=Pe.from(e.headers),e.data=ke.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ht.getAdapter(e.adapter||Ae.adapter)(e).then((function(t){return pt(e),t.data=ke.call(e,e.transformResponse,t),t.headers=Pe.from(t.headers),t}),(function(t){return je(t)||(pt(e),t&&t.response&&(t.response.data=ke.call(e,e.transformResponse,t.response),t.response.headers=Pe.from(t.response.headers))),Promise.reject(t)}))}const gt=e=>e instanceof Pe?e.toJSON():e;function yt(e,t){t=t||{};const r={};function n(e,t,r){return se.isPlainObject(e)&&se.isPlainObject(t)?se.merge.call({caseless:r},e,t):se.isPlainObject(t)?se.merge({},t):se.isArray(t)?t.slice():t}function o(e,t,r){return se.isUndefined(t)?se.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function s(e,t){if(!se.isUndefined(t))return n(void 0,t)}function i(e,t){return se.isUndefined(t)?se.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,o,s){return s in t?n(r,o):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t)=>o(gt(e),gt(t),!0)};return se.forEach(Object.keys(e).concat(Object.keys(t)),(function(n){const s=c[n]||o,i=s(e[n],t[n],n);se.isUndefined(i)&&s!==a||(r[n]=i)})),r}const bt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{bt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const wt={};bt.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Ue+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,s)=>{if(!1===e)throw new ie(n(o," has been removed"+(t?" in "+t:"")),ie.ERR_DEPRECATED);return t&&!wt[o]&&(wt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}};var Et={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ie("options must be an object",ie.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const t=e[s],r=void 0===t||i(t,s,e);if(!0!==r)throw new ie("option "+s+" must be "+r,ie.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new ie("Unknown option "+s,ie.ERR_BAD_OPTION)}},validators:bt};const Rt=Et.validators;class Ot{constructor(e){this.defaults=e,this.interceptors={request:new we,response:new we}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=yt(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;let s;void 0!==r&&Et.assertOptions(r,{silentJSONParsing:Rt.transitional(Rt.boolean),forcedJSONParsing:Rt.transitional(Rt.boolean),clarifyTimeoutError:Rt.transitional(Rt.boolean)},!1),void 0!==n&&Et.assertOptions(n,{encode:Rt.function,serialize:Rt.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),s=o&&se.merge(o.common,o[t.method]),s&&se.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Pe.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,d=0;if(!a){const e=[mt.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=i.length;let f=t;for(d=0;d<l;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=mt.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return be(Fe((e=yt(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}se.forEach(["delete","get","head","options"],(function(e){Ot.prototype[e]=function(t,r){return this.request(yt(r||{},{method:e,url:t,data:(r||{}).data}))}})),se.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,o){return this.request(yt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ot.prototype[e]=t(),Ot.prototype[e+"Form"]=t(!0)}));var St=Ot;class Tt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,o){r.reason||(r.reason=new Be(e,n,o),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new Tt((function(t){e=t})),cancel:e}}}var At=Tt;const vt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(vt).forEach((([e,t])=>{vt[t]=e}));var Ct=vt;const xt=function e(t){const r=new St(t),n=v(St.prototype.request,r);return se.extend(n,St.prototype,r,{allOwnKeys:!0}),se.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(yt(t,r))},n}(Ae);xt.Axios=St,xt.CanceledError=Be,xt.CancelToken=At,xt.isCancel=je,xt.VERSION=Ue,xt.toFormData=he,xt.AxiosError=ie,xt.Cancel=xt.CanceledError,xt.all=function(e){return Promise.all(e)},xt.spread=function(e){return function(t){return e.apply(null,t)}},xt.isAxiosError=function(e){return se.isObject(e)&&!0===e.isAxiosError},xt.mergeConfig=yt,xt.AxiosHeaders=Pe,xt.formToJSON=e=>Oe(se.isHTMLForm(e)?new FormData(e):e),xt.HttpStatusCode=Ct,xt.default=xt;var Nt=xt;const _t="notify_discord_webhook";class Lt{static SimpleToRaw(e){return{name:"",notify_type:_t,notify:e}}static validateCreate(e){const t=/^(https?|ftp):\/\/(-\.)?([^\s/?\.#]+\.?)+([^\s\.?#]+)?(\?\S*)?$/;return A.object({url:A.string().matches(t,"url is not a valid url").required(),username:A.string(),avatar_url:A.string().matches(t,"url is not a valid url"),message:A.string().required()}).validate(e)}}class Pt{static SimpleToRaw(e,t){if("Discord"===e)return Lt.SimpleToRaw(t)}}class kt{static SimpleToRaw(e,t,r){return{alertType:"event",network:t,nickname:e,type:"handler_function_call",handler:r}}static validateCreate(e){const t=([e],t)=>"true"===e?t.notRequired():t.required();return A.object({address:A.string().required(),abi:A.array().required(),nBlocks:A.number().min(10),condition:A.string().oneOf([">",">=","<","<=","=","true"]),constant:A.number().min(0).when("condition",t),responseArgIndex:A.number().min(0).when("condition",t),responseArgDecimals:A.number().min(0).when("condition",t)}).validate(e)}}class jt{static SimpleToRaw(e,t,r){return{alertType:"event",network:t,nickname:e,type:"handler_onchain_event",handler:r}}static validateCreate(e){const t=([e],t)=>"true"===e?t.notRequired():t.required();return A.object({address:A.string().required(),event:A.string().required(),abi:A.array().required(),condition:A.string().oneOf([">",">=","<","<=","=","true"]),constant:A.number().min(0).when("condition",t),paramsIndex:A.number().min(0).when("condition",t),paramsDecimals:A.number().min(0).when("condition",t)}).validate(e)}static validateUpdate(e){}}class Bt{api;data=[];constructor(e){this.api=e}static create(e){return new Bt(e)}getAbiHash(e){if(void 0===this.api)throw new Error("FunctionBuilder must be initialised with api");return this.api.getAbiHash(e)}async addFunction(e,t,r,n){const o=new h.ethers.Contract(e,n);return o.interface.encodeFunctionData(t,r),this.data.push({address:e,bytecode:o.interface.encodeFunctionData(t,r),abiHash:await this.getAbiHash(n),function:t}),this}get(){return this.data}static schema(){return A.array().of(A.object({address:A.string().required(),bytecode:A.string().matches(/^(0x)?([0-9a-fA-F]{2})*$/).required(),abiHash:A.string().matches(/^[A-Fa-f0-9]{64}/).required(),function:A.string().required()}))}}class Dt{static version(){return"v1"}static execute(e,t,r="v1"){const n=JSON.parse(JSON.stringify(t));let o=!0;for(const t of n){const r=Dt.process(e,t.conditions);o=Dt.execLogic(o,t.logic,r)}return o}static process(e,t,r){const n=t.shift();if(!n)return void 0===r||r;const o=Dt.execCondition(e,n);if(void 0===r||"WHERE"===n.logic)return Dt.process(e,t,o);if(void 0===n.logic)throw new Error("Invalid filter. Condition must have logic value");const s=Dt.execLogic(r,n.logic,o);return Dt.process(e,t,s)}static execLogic(e,t,r){switch(t){case"AND":return e&&r;case"OR":return e||r;case"XOR":return(e||r)&&!(e&&r);case"NAND":case"NOR":return!(e&&r);case"WHERE":return r;default:throw new Error(`Invalid Filter. Bad logic value: ${t}`)}}static execCondition(e,t){const r=e[t.key];if("Number"===t.type){if("number"!=typeof t.constant||"number"!=typeof r)throw new Error(`Invalid filter. Type miss-match. Type: ${t.type}, Variable: ${t.constant}, Data: ${r}`);const e=r,n=t.constant;switch(t.operation){case"eq":return e===n;case"!eq":return e!==n;case"gt":return e>n;case"gte":return e>=n;case"lt":return e<n;case"lte":return e<=n;default:throw new Error("Invalid Filter. Operation does not match type")}}if("String"===t.type){if("string"!=typeof t.constant||"string"!=typeof r)throw new Error(`Invalid filter. Type miss-match. Type: ${t.type}, Variable: ${t.constant}, Data: ${r}`);const e=r,n=t.constant;switch(t.operation){case"contains":return e.includes(n);case"!contains":return!e.includes(n);case"is":return e===n;case"!is":return e!==n;case"isEmpty":return""===e;case"!isEmpty":return""!==e;default:throw new Error("Invalid Filter. Operation does not match type")}}if("Address"===t.type){if("string"!=typeof t.constant||"string"!=typeof r)throw new Error(`Invalid filter. Type miss-match. Type: ${t.type}, Variable: ${t.constant}, Data: ${r}`);const e=r,n=t.constant;switch(t.operation){case"contains":return e.toLowerCase().includes(n.toLowerCase());case"!contains":return!e.toLowerCase().includes(n.toLowerCase());case"is":return e.toLowerCase()===n.toLowerCase();case"!is":return e.toLowerCase()!==n.toLowerCase();case"isEmpty":return""===e;case"!isEmpty":return""!==e;default:throw new Error("Invalid Filter. Operation does not match type")}}throw new Error("Invalid Filter. Unknown Type")}}class Ft{groups=[];constructor(){this.newGroup("WHERE")}static version(){return Dt.version()}static new(){return new Ft}newGroup(e){if(0!==this.groups.length&&"WHERE"===e)throw new Error('Only the first groups can start with "WHERE"');return this.groups.push({logic:"WHERE",conditions:[]}),this}addCondition(e,t,r,n,o){const s=this.groups[this.groups.length-1];if(0===s.conditions.length&&"WHERE"!==e)throw new Error('Logic for the first condition of a group must be "WHERE"');if(s.conditions.length>0&&"WHERE"===e)throw new Error('Only the first condition of a group can be "WHERE"');return s.conditions.push({logic:e,key:t,type:r,operation:n,constant:o}),this}finalise(){for(const e of this.groups)if(0===e.conditions.length)throw new Error("Bad Filter. All Groups must have atleast one condition");return this.groups}static schema(){const e=A.string().oneOf(["AND","OR","XOR","NAND","NOR","WHERE"]).required(),t=A.object({logic:e,key:A.string().required(),type:A.string().oneOf(["String","Address","Number"]).required(),operation:A.string().when("type",(([e],t)=>{switch(e){case"String":return t.oneOf(["contains","!contains","is","!is","isEmpty","!isEmpty"]);case"Address":return t.oneOf(["is","!is","isEmpty","!isEmpty"]);case"Number":return t.oneOf(["String","Address","Number"]);default:throw new Error("Invalid Filter Data Type")}})),constant:A.mixed().when("type",(([e])=>{switch(e){case"String":case"Address":return A.string();case"Number":return A.number();default:throw new Error("Invalid Filter Data Type")}}))});return A.array().of(A.object({logic:e,conditions:A.array().of(t)}))}}class Ut{static SimpleToRaw(e,t,r){return{alertType:"event",network:t,nickname:e,type:"handler_function_call_v2",handler:r}}static validateCreate(e){return A.object({timeBase:A.string().oneOf(["blocks","time"]).required(),nBlocks:A.number().min(10).when("timeBase",(([e],t)=>"blocks"===e?t.required():t)),timePeriod:A.string().matches(/^(\d+)([SMHD])$/i,"timePeriod must be of the format n[s|m|h|d], eg 10s for 10 seconds").when("timeBase",(([e],t)=>"time"===e?t.required():t)),startTime:A.number().default(0),debounceCount:A.number(),functions:Bt.schema(),triggerOn:A.string().oneOf(["always","filter"]).default("always"),latch:A.boolean().default(!1),filterVersion:A.string().when("triggerOn",(([e],t)=>"filter"===e?t.required():t)),filter:Ft.schema().when("triggerOn",(([e],t)=>"filter"===e?t.required():t))}).validate(e)}}class It{static SimpleToRaw(e,t,r,n){switch(t){case"PollFunctionV2":return Ut.SimpleToRaw(e,r,n);case"PollFunctionV1":return kt.SimpleToRaw(e,r,n);case"OnchainEventV1":return jt.SimpleToRaw(e,r,n);default:throw new Error("Invalid Trigger ID")}}}const qt=e=>`https://${e}.functions.supabase.co/`,zt=e=>`https://${e}.supabase.co/`,Ht="fdgtrxmmrtlokhgkvcjz";class Mt{url;token;headers={};constructor(e,t){this.url=e,this.token=t,this.headers={Authorization:`Bearer ${t}`,"Content-Type":"application/json"}}static async create(e){if(e.key)throw new Error("Auth by key not yet supported");if(e.email&&e.password){const r=e.projectId?zt(e.projectId):zt(Ht),n=e.projectId?qt(e.projectId):qt(Ht),o=e.anonKey?e.anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZkZ3RyeG1tcnRsb2toZ2t2Y2p6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzMwODcwNzYsImV4cCI6MTk4ODY2MzA3Nn0.sAMxjlcJSSozBGr-LNcsudyxzUEM9e-UspMHHQLqLr4",s=t.createClient(r,o),{data:i,error:a}=await s.auth.signInWithPassword({email:e.email,password:e.password});if(a)throw a;if(void 0===i.session?.access_token)throw new Error("Access token not found");return new Mt(n,i.session?.access_token)}throw new Error("Authentication Required. DeNotify supports either username/password or API key authentication")}async alertHistory(e,t){const r="alert-history",n=t||{};return e&&(n.id=e),Object.keys(n).length>0?await this.request("get",r,{params:t}):await this.request("get",r)}async getAlert(e){return(await this.request("get",`alerts/${e}`))[0]}async getAlerts(){return await this.request("get","alerts")}async createAlert(e){const t=It.SimpleToRaw(e.name,e.triggerId,e.network,e.trigger),r=Pt.SimpleToRaw(e.notificationId,e.notification);return await this.request("post","alerts",{body:{trigger:t,notification:r}})}async deleteAlert(e){return await this.request("delete",`alerts/${e}`)}async request(e,t,r={}){const n=new URL(`${this.url}${t}`);if(r.params)for(const e of Object.keys(r.params))n.searchParams.append(e,r.params[e]);console.log(n.toString());const o={method:e,url:n.toString(),headers:this.headers};r.body&&(o.data=r.body);return(await Nt(o)).data}async getAbi(e,t){return await this.request("get",`abi/${e}/${t}`)}async getAbiHash(e){return(await this.request("post","abi",{body:e})).hash}async setAlertName(e,t){throw new Error("Not yet supported - Sorry!")}async enableAlert(e){throw new Error("Not yet supported - Sorry!")}async disableAlert(e){throw new Error("Not yet supported - Sorry!")}async updateNotification(e){throw new Error("Not yet supported - Sorry!")}async updateTrigger(e,t){return await this.request("patch",`alerts/trigger-handler/${e}`,{body:t})}}class $t{name;network;triggerId;trigger;notificationId;notification;constructor(e){this.name=e}static create(e){return new $t(e)}onNetwork(e){return this.network=e,this}withTrigger(e,t){return this.triggerId=e,this.trigger=t,this}withNotification(e,t){return this.notificationId=e,this.notification=t,this}async validate(){switch(this.triggerId){case"OnchainEventV1":return jt.validateCreate(this.trigger);case"PollFunctionV1":return kt.validateCreate(this.trigger);case"PollFunctionV2":return Ut.validateCreate(this.trigger)}if("Discord"===this.notificationId)return Lt.validateCreate(this.notification)}async config(){if(void 0===this.trigger||void 0===this.triggerId)throw new Error("Trigger not configured");if(void 0===this.notification||void 0===this.notificationId)throw new Error("Notification not configured");if(void 0===this.network)throw new Error("Network not configured");return await this.validate(),{name:this.name,network:this.network,triggerId:this.triggerId,trigger:this.trigger,notificationId:this.notificationId,notification:this.notification}}}var Wt=Object.freeze({__proto__:null,Trigger:It,HandlerFunctionCallV2:Ut,HandlerFunctionCall:kt,HandlerOnchainEvent:jt}),Jt=Object.freeze({__proto__:null,NOTIFY_DISCORD_WEBHOOK_RAW_ID:_t,NotifyDiscordWebhook:Lt,Notification:Pt});e.AlertBuilder=$t,e.DeNotifyClient=Mt,e.FilterBuilder=Ft,e.FunctionBuilder=Bt,e.Notification=Jt,e.Trigger=Wt}));
|
package/dist/index.mjs
CHANGED
@@ -4430,10 +4430,19 @@ class DeNotifyClient {
|
|
4430
4430
|
throw new Error('Authentication Required. DeNotify supports either username/password or API key authentication');
|
4431
4431
|
}
|
4432
4432
|
}
|
4433
|
-
async alertHistory(id, pagination
|
4434
|
-
const
|
4435
|
-
|
4433
|
+
async alertHistory(id, pagination) {
|
4434
|
+
const url = `alert-history`;
|
4435
|
+
const params = pagination ? pagination : {};
|
4436
|
+
if (id)
|
4437
|
+
params.id = id;
|
4438
|
+
if (Object.keys(params).length > 0) {
|
4439
|
+
return await this.request('get', url, { params: pagination });
|
4440
|
+
}
|
4441
|
+
else {
|
4442
|
+
return await this.request('get', url);
|
4443
|
+
}
|
4436
4444
|
}
|
4445
|
+
// TODO - Beutify the reponse
|
4437
4446
|
async getAlert(id) {
|
4438
4447
|
const alerts = await this.request('get', `alerts/${id}`);
|
4439
4448
|
return alerts[0];
|
@@ -4460,6 +4469,7 @@ class DeNotifyClient {
|
|
4460
4469
|
url.searchParams.append(param, options.params[param]);
|
4461
4470
|
}
|
4462
4471
|
}
|
4472
|
+
console.log(url.toString());
|
4463
4473
|
const payload = {
|
4464
4474
|
method,
|
4465
4475
|
url: url.toString(),
|
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "1.1.
|
2
|
+
"version": "1.1.6",
|
3
3
|
"name": "denotify-client",
|
4
4
|
"umd:name": "denotify-client",
|
5
5
|
"repository": "robo-labs/denotify-client",
|
@@ -60,6 +60,9 @@
|
|
60
60
|
"@types/axios": "^0.14.0",
|
61
61
|
"axois": "^0.0.1-security",
|
62
62
|
"ethers": "^6.0.8",
|
63
|
+
"follow-redirects": "^1.15.2",
|
64
|
+
"form-data": "^4.0.0",
|
65
|
+
"proxy-from-env": "^1.1.0",
|
63
66
|
"ts-node": "^10.9.1",
|
64
67
|
"typescript": "^4.9.5",
|
65
68
|
"yup": "^1.0.2"
|
@@ -1,17 +1,40 @@
|
|
1
|
+
import { NotificationRawResponse, NotifyRawId } from "./notifications/notification.js";
|
1
2
|
import { AlertConfig, DeNotifyOptions } from "./types/types.js";
|
2
|
-
import { TriggerUpdate } from "./triggers/trigger.js";
|
3
|
+
import { TriggerRawResponse, TriggerTypeRawId, TriggerUpdate } from "./triggers/trigger.js";
|
4
|
+
type Pagination = {
|
5
|
+
page?: number;
|
6
|
+
size?: number;
|
7
|
+
};
|
8
|
+
type HistoryParams = {
|
9
|
+
id?: number;
|
10
|
+
page?: number;
|
11
|
+
size?: number;
|
12
|
+
};
|
13
|
+
type AlertHistory = {
|
14
|
+
type: 'trigger' | 'notification';
|
15
|
+
set: boolean;
|
16
|
+
alert_id: number;
|
17
|
+
block: number;
|
18
|
+
metadata: any;
|
19
|
+
subtype: TriggerTypeRawId | NotifyRawId;
|
20
|
+
};
|
21
|
+
type AlertRawResponse = {
|
22
|
+
alertId: number;
|
23
|
+
trigger: TriggerRawResponse;
|
24
|
+
notification: NotificationRawResponse;
|
25
|
+
};
|
3
26
|
export declare class DeNotifyClient {
|
4
27
|
private url;
|
5
28
|
private token;
|
6
29
|
private headers;
|
7
30
|
private constructor();
|
8
31
|
static create(options: DeNotifyOptions): Promise<DeNotifyClient>;
|
9
|
-
alertHistory(id
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
getAlert(id: number): Promise<
|
14
|
-
getAlerts(): Promise<
|
32
|
+
alertHistory(id?: number | null, pagination?: Pagination): Promise<{
|
33
|
+
params: HistoryParams;
|
34
|
+
history: AlertHistory[];
|
35
|
+
}>;
|
36
|
+
getAlert(id: number): Promise<AlertRawResponse>;
|
37
|
+
getAlerts(): Promise<AlertRawResponse[]>;
|
15
38
|
createAlert(config: AlertConfig): Promise<any>;
|
16
39
|
deleteAlert(id: number): Promise<any>;
|
17
40
|
private request;
|
@@ -26,3 +49,4 @@ export declare class DeNotifyClient {
|
|
26
49
|
updateNotification(triggerId: number): Promise<void>;
|
27
50
|
updateTrigger(triggerId: number, update: TriggerUpdate): Promise<any>;
|
28
51
|
}
|
52
|
+
export {};
|
@@ -10,6 +10,13 @@ export type NotificationRawConfig = {
|
|
10
10
|
notify_type: NotifyRawId;
|
11
11
|
notify: NotifyRawConfig;
|
12
12
|
};
|
13
|
+
export type NotificationRawResponse = {
|
14
|
+
notify_type: NotifyRawId;
|
15
|
+
notify: NotifyRawResponse;
|
16
|
+
error: boolean;
|
17
|
+
error_message: string | null;
|
18
|
+
error_timestamp: number | null;
|
19
|
+
};
|
13
20
|
export declare class Notification {
|
14
21
|
static SimpleToRaw(id: NotificationTypeId, config: NotificationConfig): NotificationRawConfig;
|
15
22
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { HandlerFunctionCallRawConfig, HandlerFunctionCallUpdate, PollFunctionV1 } from "./handler_function_call.js";
|
2
|
-
import { HandlerOnchainEventRawConfig, HandlerOnchainEventUpdate, OnchainEventV1 } from "./handler_onchain_event.js";
|
3
|
-
import { HandlerFunctionCallV2RawConfig, HandlerFunctionCallV2Update, PollFunctionV2 } from "./handler_function_call_v2.js";
|
1
|
+
import { HandlerFunctionCallRawConfig, HandlerFunctionCallRawResponse, HandlerFunctionCallUpdate, PollFunctionV1 } from "./handler_function_call.js";
|
2
|
+
import { HandlerOnchainEventRawConfig, HandlerOnchainEventRawResponse, HandlerOnchainEventUpdate, OnchainEventV1 } from "./handler_onchain_event.js";
|
3
|
+
import { HandlerFunctionCallV2RawConfig, HandlerFunctionCallV2RawResponse, HandlerFunctionCallV2Update, PollFunctionV2 } from "./handler_function_call_v2.js";
|
4
4
|
export type Network = 'avalanche' | 'ethereum';
|
5
5
|
export type TriggerConfig = PollFunctionV2 | PollFunctionV1 | OnchainEventV1;
|
6
6
|
export type TriggerTypeId = 'PollFunctionV2' | 'OnchainEventV1' | 'PollFunctionV1';
|
@@ -15,6 +15,21 @@ export type TriggerRawConfig = {
|
|
15
15
|
network: Network;
|
16
16
|
handler: HandlerRawConfig;
|
17
17
|
};
|
18
|
+
export type HandlerRawResponse = HandlerFunctionCallV2RawResponse | HandlerFunctionCallRawResponse | HandlerOnchainEventRawResponse;
|
19
|
+
export type TriggerRawResponse = {
|
20
|
+
id: number;
|
21
|
+
type: TriggerTypeRawId;
|
22
|
+
triggered: boolean;
|
23
|
+
lastBlock: number;
|
24
|
+
alertType: 'event' | 'latch';
|
25
|
+
enabled: boolean;
|
26
|
+
nickname: string;
|
27
|
+
error: boolean;
|
28
|
+
error_message: string | null;
|
29
|
+
error_timestamp: number | null;
|
30
|
+
network: Network;
|
31
|
+
handler: HandlerRawResponse;
|
32
|
+
};
|
18
33
|
export declare class Trigger {
|
19
34
|
static SimpleToRaw(name: string, id: TriggerTypeId, network: Network, config: TriggerConfig): TriggerRawConfig;
|
20
35
|
}
|