denotify-client 1.1.6 → 1.1.8

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.
@@ -1,57 +1,47 @@
1
+ import { AlertBuilder } from "../alertbuilder.js";
1
2
  import { DeNotifyClient } from "../denotifyclient.js";
3
+ import { FunctionBuilder } from "../functionbuilder.js";
4
+ import { FilterBuilder } from "../util/filter.js";
2
5
  // Simple App to demonstrate usage. Created a balance monitoring alert, updates it and deletes it
3
6
  async function main() {
4
7
  const api = await DeNotifyClient.create({
5
- email: 's.battenally@gmail.com',
6
- password: 'Password',
8
+ email: process.env.EMAIL,
9
+ password: process.env.PASSWORD,
7
10
  });
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)
11
+ const network = 'avalanche';
12
+ const address = '0x26985888d5b7019ff2A7444fB567D8F386c3b538';
13
+ const myAddress = '0x7601630eC802952ba1ED2B6e4db16F699A0a5A87';
14
+ const { abi } = await api.getAbi(network, address);
15
+ const webhook = process.env.DISCORD_WEBHOOK;
16
+ const builder = FunctionBuilder.create(api);
17
+ await builder.addFunction(address, 'getBalance', [myAddress], abi);
18
+ // Create the Balance Monitor alert
19
+ const alert = await AlertBuilder.create('Test Alert')
20
+ .onNetwork('avalanche')
21
+ .withTrigger('PollFunctionV2', {
22
+ timeBase: 'time',
23
+ timePeriod: '100s',
24
+ functions: builder.get(),
25
+ triggerOn: 'always',
26
+ })
27
+ .withNotification('Discord', {
28
+ url: webhook,
29
+ message: `Your avax balance is [{func_0_ret_0 / 1e18}](https://snowtrace.io/address/${myAddress})`,
30
+ })
31
+ .config();
32
+ // Create the alert with the API
33
+ const triggerId = await api.createAlert(alert);
34
+ console.log(triggerId);
35
+ // Update the period to every 10s
36
+ await api.updateTrigger(triggerId, { timePeriod: '10s' });
37
+ // Update the Filter using the filter builder
38
+ const filter = FilterBuilder.new()
39
+ .addCondition('WHERE', 'func_0_ret_0', 'Number', 'gt', 3)
40
+ .finalise();
41
+ await api.updateTrigger(13, { triggerOn: 'filter', filter, filterVersion: FilterBuilder.version() });
42
+ // Delete the filter in 10s
43
+ setTimeout(async () => {
44
+ await api.deleteAlert(triggerId);
45
+ }, 10 * 1000);
56
46
  }
57
47
  main();
package/dist/index.js CHANGED
@@ -3066,6 +3066,117 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3066
3066
  });
3067
3067
  };
3068
3068
 
3069
+ var cookies = platform.isStandardBrowserEnv ?
3070
+
3071
+ // Standard browser envs support document.cookie
3072
+ (function standardBrowserEnv() {
3073
+ return {
3074
+ write: function write(name, value, expires, path, domain, secure) {
3075
+ const cookie = [];
3076
+ cookie.push(name + '=' + encodeURIComponent(value));
3077
+
3078
+ if (utils.isNumber(expires)) {
3079
+ cookie.push('expires=' + new Date(expires).toGMTString());
3080
+ }
3081
+
3082
+ if (utils.isString(path)) {
3083
+ cookie.push('path=' + path);
3084
+ }
3085
+
3086
+ if (utils.isString(domain)) {
3087
+ cookie.push('domain=' + domain);
3088
+ }
3089
+
3090
+ if (secure === true) {
3091
+ cookie.push('secure');
3092
+ }
3093
+
3094
+ document.cookie = cookie.join('; ');
3095
+ },
3096
+
3097
+ read: function read(name) {
3098
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
3099
+ return (match ? decodeURIComponent(match[3]) : null);
3100
+ },
3101
+
3102
+ remove: function remove(name) {
3103
+ this.write(name, '', Date.now() - 86400000);
3104
+ }
3105
+ };
3106
+ })() :
3107
+
3108
+ // Non standard browser env (web workers, react-native) lack needed support.
3109
+ (function nonStandardBrowserEnv() {
3110
+ return {
3111
+ write: function write() {},
3112
+ read: function read() { return null; },
3113
+ remove: function remove() {}
3114
+ };
3115
+ })();
3116
+
3117
+ var isURLSameOrigin = platform.isStandardBrowserEnv ?
3118
+
3119
+ // Standard browser envs have full support of the APIs needed to test
3120
+ // whether the request URL is of the same origin as current location.
3121
+ (function standardBrowserEnv() {
3122
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
3123
+ const urlParsingNode = document.createElement('a');
3124
+ let originURL;
3125
+
3126
+ /**
3127
+ * Parse a URL to discover it's components
3128
+ *
3129
+ * @param {String} url The URL to be parsed
3130
+ * @returns {Object}
3131
+ */
3132
+ function resolveURL(url) {
3133
+ let href = url;
3134
+
3135
+ if (msie) {
3136
+ // IE needs attribute set twice to normalize properties
3137
+ urlParsingNode.setAttribute('href', href);
3138
+ href = urlParsingNode.href;
3139
+ }
3140
+
3141
+ urlParsingNode.setAttribute('href', href);
3142
+
3143
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
3144
+ return {
3145
+ href: urlParsingNode.href,
3146
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
3147
+ host: urlParsingNode.host,
3148
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
3149
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
3150
+ hostname: urlParsingNode.hostname,
3151
+ port: urlParsingNode.port,
3152
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
3153
+ urlParsingNode.pathname :
3154
+ '/' + urlParsingNode.pathname
3155
+ };
3156
+ }
3157
+
3158
+ originURL = resolveURL(window.location.href);
3159
+
3160
+ /**
3161
+ * Determine if a URL shares the same origin as the current location
3162
+ *
3163
+ * @param {String} requestURL The URL to test
3164
+ * @returns {boolean} True if URL shares the same origin, otherwise false
3165
+ */
3166
+ return function isURLSameOrigin(requestURL) {
3167
+ const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
3168
+ return (parsed.protocol === originURL.protocol &&
3169
+ parsed.host === originURL.host);
3170
+ };
3171
+ })() :
3172
+
3173
+ // Non standard browser envs (web workers, react-native) lack needed support.
3174
+ (function nonStandardBrowserEnv() {
3175
+ return function isURLSameOrigin() {
3176
+ return true;
3177
+ };
3178
+ })();
3179
+
3069
3180
  function progressEventReducer(listener, isDownloadStream) {
3070
3181
  let bytesNotified = 0;
3071
3182
  const _speedometer = speedometer(50, 250);
@@ -3113,7 +3224,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3113
3224
  }
3114
3225
  }
3115
3226
 
3116
- if (utils.isFormData(requestData) && (platform.isStandardBrowserWebWorkerEnv)) {
3227
+ if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
3117
3228
  requestHeaders.setContentType(false); // Let the browser set it
3118
3229
  }
3119
3230
 
@@ -3226,6 +3337,19 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3226
3337
  request = null;
3227
3338
  };
3228
3339
 
3340
+ // Add xsrf header
3341
+ // This is only done if running in a standard browser environment.
3342
+ // Specifically not if we're in a web worker, or react-native.
3343
+ if (platform.isStandardBrowserEnv) {
3344
+ // Add xsrf header
3345
+ const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
3346
+ && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
3347
+
3348
+ if (xsrfValue) {
3349
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
3350
+ }
3351
+ }
3352
+
3229
3353
  // Remove Content-Type if data is undefined
3230
3354
  requestData === undefined && requestHeaders.setContentType(null);
3231
3355
 
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,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}));
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),w=p(s),b=p(i),E=p(a),R=p(c),O=p(u),S=p(l),T=p(d),v=m(f);function A(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),k=e=>t=>typeof t===e,{isArray:B}=Array,P=k("undefined");const j=L("ArrayBuffer");const D=k("string"),F=k("function"),U=k("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]),B(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=>!P(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:B,isArrayBuffer:j,isBuffer:function(e){return null!==e&&!P(e)&&null!==e.constructor&&!P(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:P,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):B(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]=A(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(B(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 B(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=B(e)?[]:{};return J(e,((e,t)=>{const s=r(e,n+1);!P(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 we(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 be=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 ve=Te;const Ae=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]&&Ae[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 ke=Le;function Be(e,t){const r=this||ve,n=t||r,o=ke.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 Pe(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);var dt=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 ke,config:e})}if(-1===at.indexOf(g))return r(new ie("Unsupported protocol "+g,ie.ERR_BAD_REQUEST,e));const y=ke.from(e.headers).normalize();y.set("User-Agent","axios/"+Ue,!1);const R=e.onDownloadProgress,v=e.onUploadProgress,A=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(A)?(C=A[0],x=A[1]):C=x=A,o&&(v||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),v&&o.on("progress",(e=>{v(Object.assign(e,{upload:!0}))}))),e.auth&&(_=(e.auth.username||"")+":"+(e.auth.password||"")),!_&&m.username&&(_=m.username+":"+m.password),_&&y.delete("authorization");try{L=we(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 k={path:L,method:a,headers:y.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:_,protocol:g,beforeRedirect:ct,beforeRedirects:{}};let B;e.socketPath?k.socketPath=e.socketPath:(k.hostname=m.hostname,k.port=m.port,ut(k,e.proxy,g+"//"+m.hostname+(m.port?":"+m.port:"")+k.path));const P=it.test(k.protocol);if(k.agent=P?e.httpsAgent:e.httpAgent,e.transport?B=e.transport:0===e.maxRedirects?B=P?b.default:w.default:(e.maxRedirects&&(k.maxRedirects=e.maxRedirects),e.beforeRedirect&&(k.beforeRedirects.config=e.beforeRedirect),B=P?st:ot),e.maxBodyLength>-1?k.maxBodyLength=e.maxBodyLength:k.maxBodyLength=1/0,e.insecureHTTPParser&&(k.insecureHTTPParser=e.insecureHTTPParser),u=B.request(k,(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 ke(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},ft=Re.isStandardBrowserEnv?{write:function(e,t,r,n,o,s){const i=[];i.push(e+"="+encodeURIComponent(t)),se.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),se.isString(n)&&i.push("path="+n),se.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},ht=Re.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=se.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function pt(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 mt={http:dt,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const o=ke.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.isStandardBrowserEnv||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=ke.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}if(c.open(e.method.toUpperCase(),we(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},Re.isStandardBrowserEnv){const t=(e.withCredentials||ht(u))&&e.xsrfCookieName&&ft.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}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",pt(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",pt(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(mt,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var gt={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)?mt[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(mt,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:mt};function yt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new je(null,e)}function wt(e){yt(e),e.headers=ke.from(e.headers),e.data=Be.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return gt.getAdapter(e.adapter||ve.adapter)(e).then((function(t){return yt(e),t.data=Be.call(e,e.transformResponse,t),t.headers=ke.from(t.headers),t}),(function(t){return Pe(t)||(yt(e),t&&t.response&&(t.response.data=Be.call(e,e.transformResponse,t.response),t.response.headers=ke.from(t.response.headers))),Promise.reject(t)}))}const bt=e=>e instanceof ke?e.toJSON():e;function Et(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(bt(e),bt(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 Rt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Rt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Ot={};Rt.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&&!Ot[o]&&(Ot[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 St={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:Rt};const Tt=St.validators;class vt{constructor(e){this.defaults=e,this.interceptors={request:new be,response:new be}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Et(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;let s;void 0!==r&&St.assertOptions(r,{silentJSONParsing:Tt.transitional(Tt.boolean),forcedJSONParsing:Tt.transitional(Tt.boolean),clarifyTimeoutError:Tt.transitional(Tt.boolean)},!1),void 0!==n&&St.assertOptions(n,{encode:Tt.function,serialize:Tt.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=ke.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=[wt.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=wt.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 we(Fe((e=Et(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}se.forEach(["delete","get","head","options"],(function(e){vt.prototype[e]=function(t,r){return this.request(Et(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(Et(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}vt.prototype[e]=t(),vt.prototype[e+"Form"]=t(!0)}));var At=vt;class Ct{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 Ct((function(t){e=t})),cancel:e}}}var xt=Ct;const Nt={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(Nt).forEach((([e,t])=>{Nt[t]=e}));var _t=Nt;const Lt=function e(t){const r=new At(t),n=A(At.prototype.request,r);return se.extend(n,At.prototype,r,{allOwnKeys:!0}),se.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Et(t,r))},n}(ve);Lt.Axios=At,Lt.CanceledError=je,Lt.CancelToken=xt,Lt.isCancel=Pe,Lt.VERSION=Ue,Lt.toFormData=he,Lt.AxiosError=ie,Lt.Cancel=Lt.CanceledError,Lt.all=function(e){return Promise.all(e)},Lt.spread=function(e){return function(t){return e.apply(null,t)}},Lt.isAxiosError=function(e){return se.isObject(e)&&!0===e.isAxiosError},Lt.mergeConfig=Et,Lt.AxiosHeaders=ke,Lt.formToJSON=e=>Oe(se.isHTMLForm(e)?new FormData(e):e),Lt.HttpStatusCode=_t,Lt.default=Lt;var kt=Lt;const Bt="notify_discord_webhook";class Pt{static SimpleToRaw(e){return{name:"",notify_type:Bt,notify:e}}static validateCreate(e){const t=/^(https?|ftp):\/\/(-\.)?([^\s/?\.#]+\.?)+([^\s\.?#]+)?(\?\S*)?$/;return v.object({url:v.string().matches(t,"url is not a valid url").required(),username:v.string(),avatar_url:v.string().matches(t,"url is not a valid url"),message:v.string().required()}).validate(e)}}class jt{static SimpleToRaw(e,t){if("Discord"===e)return Pt.SimpleToRaw(t)}}class Dt{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 v.object({address:v.string().required(),abi:v.array().required(),nBlocks:v.number().min(10),condition:v.string().oneOf([">",">=","<","<=","=","true"]),constant:v.number().min(0).when("condition",t),responseArgIndex:v.number().min(0).when("condition",t),responseArgDecimals:v.number().min(0).when("condition",t)}).validate(e)}}class Ft{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 v.object({address:v.string().required(),event:v.string().required(),abi:v.array().required(),condition:v.string().oneOf([">",">=","<","<=","=","true"]),constant:v.number().min(0).when("condition",t),paramsIndex:v.number().min(0).when("condition",t),paramsDecimals:v.number().min(0).when("condition",t)}).validate(e)}static validateUpdate(e){}}class Ut{api;data=[];constructor(e){this.api=e}static create(e){return new Ut(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 v.array().of(v.object({address:v.string().required(),bytecode:v.string().matches(/^(0x)?([0-9a-fA-F]{2})*$/).required(),abiHash:v.string().matches(/^[A-Fa-f0-9]{64}/).required(),function:v.string().required()}))}}class It{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=It.process(e,t.conditions);o=It.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=It.execCondition(e,n);if(void 0===r||"WHERE"===n.logic)return It.process(e,t,o);if(void 0===n.logic)throw new Error("Invalid filter. Condition must have logic value");const s=It.execLogic(r,n.logic,o);return It.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 qt{groups=[];constructor(){this.newGroup("WHERE")}static version(){return It.version()}static new(){return new qt}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=v.string().oneOf(["AND","OR","XOR","NAND","NOR","WHERE"]).required(),t=v.object({logic:e,key:v.string().required(),type:v.string().oneOf(["String","Address","Number"]).required(),operation:v.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:v.mixed().when("type",(([e])=>{switch(e){case"String":case"Address":return v.string();case"Number":return v.number();default:throw new Error("Invalid Filter Data Type")}}))});return v.array().of(v.object({logic:e,conditions:v.array().of(t)}))}}class zt{static SimpleToRaw(e,t,r){return{alertType:"event",network:t,nickname:e,type:"handler_function_call_v2",handler:r}}static validateCreate(e){return v.object({timeBase:v.string().oneOf(["blocks","time"]).required(),nBlocks:v.number().min(10).when("timeBase",(([e],t)=>"blocks"===e?t.required():t)),timePeriod:v.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:v.number().default(0),debounceCount:v.number(),functions:Ut.schema(),triggerOn:v.string().oneOf(["always","filter"]).default("always"),latch:v.boolean().default(!1),filterVersion:v.string().when("triggerOn",(([e],t)=>"filter"===e?t.required():t)),filter:qt.schema().when("triggerOn",(([e],t)=>"filter"===e?t.required():t))}).validate(e)}}class Ht{static SimpleToRaw(e,t,r,n){switch(t){case"PollFunctionV2":return zt.SimpleToRaw(e,r,n);case"PollFunctionV1":return Dt.SimpleToRaw(e,r,n);case"OnchainEventV1":return Ft.SimpleToRaw(e,r,n);default:throw new Error("Invalid Trigger ID")}}}const Mt=e=>`https://${e}.functions.supabase.co/`,$t=e=>`https://${e}.supabase.co/`,Wt="fdgtrxmmrtlokhgkvcjz";class Jt{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?$t(e.projectId):$t(Wt),n=e.projectId?Mt(e.projectId):Mt(Wt),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 Jt(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=Ht.SimpleToRaw(e.name,e.triggerId,e.network,e.trigger),r=jt.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 kt(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 Vt{name;network;triggerId;trigger;notificationId;notification;constructor(e){this.name=e}static create(e){return new Vt(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 Ft.validateCreate(this.trigger);case"PollFunctionV1":return Dt.validateCreate(this.trigger);case"PollFunctionV2":return zt.validateCreate(this.trigger)}if("Discord"===this.notificationId)return Pt.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 Kt=Object.freeze({__proto__:null,Trigger:Ht,HandlerFunctionCallV2:zt,HandlerFunctionCall:Dt,HandlerOnchainEvent:Ft}),Gt=Object.freeze({__proto__:null,NOTIFY_DISCORD_WEBHOOK_RAW_ID:Bt,NotifyDiscordWebhook:Pt,Notification:jt});e.AlertBuilder=Vt,e.DeNotifyClient=Jt,e.FilterBuilder=qt,e.FunctionBuilder=Ut,e.Notification=Gt,e.Trigger=Kt}));
package/dist/index.mjs CHANGED
@@ -3033,6 +3033,117 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3033
3033
  });
3034
3034
  };
3035
3035
 
3036
+ var cookies = platform.isStandardBrowserEnv ?
3037
+
3038
+ // Standard browser envs support document.cookie
3039
+ (function standardBrowserEnv() {
3040
+ return {
3041
+ write: function write(name, value, expires, path, domain, secure) {
3042
+ const cookie = [];
3043
+ cookie.push(name + '=' + encodeURIComponent(value));
3044
+
3045
+ if (utils.isNumber(expires)) {
3046
+ cookie.push('expires=' + new Date(expires).toGMTString());
3047
+ }
3048
+
3049
+ if (utils.isString(path)) {
3050
+ cookie.push('path=' + path);
3051
+ }
3052
+
3053
+ if (utils.isString(domain)) {
3054
+ cookie.push('domain=' + domain);
3055
+ }
3056
+
3057
+ if (secure === true) {
3058
+ cookie.push('secure');
3059
+ }
3060
+
3061
+ document.cookie = cookie.join('; ');
3062
+ },
3063
+
3064
+ read: function read(name) {
3065
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
3066
+ return (match ? decodeURIComponent(match[3]) : null);
3067
+ },
3068
+
3069
+ remove: function remove(name) {
3070
+ this.write(name, '', Date.now() - 86400000);
3071
+ }
3072
+ };
3073
+ })() :
3074
+
3075
+ // Non standard browser env (web workers, react-native) lack needed support.
3076
+ (function nonStandardBrowserEnv() {
3077
+ return {
3078
+ write: function write() {},
3079
+ read: function read() { return null; },
3080
+ remove: function remove() {}
3081
+ };
3082
+ })();
3083
+
3084
+ var isURLSameOrigin = platform.isStandardBrowserEnv ?
3085
+
3086
+ // Standard browser envs have full support of the APIs needed to test
3087
+ // whether the request URL is of the same origin as current location.
3088
+ (function standardBrowserEnv() {
3089
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
3090
+ const urlParsingNode = document.createElement('a');
3091
+ let originURL;
3092
+
3093
+ /**
3094
+ * Parse a URL to discover it's components
3095
+ *
3096
+ * @param {String} url The URL to be parsed
3097
+ * @returns {Object}
3098
+ */
3099
+ function resolveURL(url) {
3100
+ let href = url;
3101
+
3102
+ if (msie) {
3103
+ // IE needs attribute set twice to normalize properties
3104
+ urlParsingNode.setAttribute('href', href);
3105
+ href = urlParsingNode.href;
3106
+ }
3107
+
3108
+ urlParsingNode.setAttribute('href', href);
3109
+
3110
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
3111
+ return {
3112
+ href: urlParsingNode.href,
3113
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
3114
+ host: urlParsingNode.host,
3115
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
3116
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
3117
+ hostname: urlParsingNode.hostname,
3118
+ port: urlParsingNode.port,
3119
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
3120
+ urlParsingNode.pathname :
3121
+ '/' + urlParsingNode.pathname
3122
+ };
3123
+ }
3124
+
3125
+ originURL = resolveURL(window.location.href);
3126
+
3127
+ /**
3128
+ * Determine if a URL shares the same origin as the current location
3129
+ *
3130
+ * @param {String} requestURL The URL to test
3131
+ * @returns {boolean} True if URL shares the same origin, otherwise false
3132
+ */
3133
+ return function isURLSameOrigin(requestURL) {
3134
+ const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
3135
+ return (parsed.protocol === originURL.protocol &&
3136
+ parsed.host === originURL.host);
3137
+ };
3138
+ })() :
3139
+
3140
+ // Non standard browser envs (web workers, react-native) lack needed support.
3141
+ (function nonStandardBrowserEnv() {
3142
+ return function isURLSameOrigin() {
3143
+ return true;
3144
+ };
3145
+ })();
3146
+
3036
3147
  function progressEventReducer(listener, isDownloadStream) {
3037
3148
  let bytesNotified = 0;
3038
3149
  const _speedometer = speedometer(50, 250);
@@ -3080,7 +3191,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3080
3191
  }
3081
3192
  }
3082
3193
 
3083
- if (utils.isFormData(requestData) && (platform.isStandardBrowserWebWorkerEnv)) {
3194
+ if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
3084
3195
  requestHeaders.setContentType(false); // Let the browser set it
3085
3196
  }
3086
3197
 
@@ -3193,6 +3304,19 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3193
3304
  request = null;
3194
3305
  };
3195
3306
 
3307
+ // Add xsrf header
3308
+ // This is only done if running in a standard browser environment.
3309
+ // Specifically not if we're in a web worker, or react-native.
3310
+ if (platform.isStandardBrowserEnv) {
3311
+ // Add xsrf header
3312
+ const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
3313
+ && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
3314
+
3315
+ if (xsrfValue) {
3316
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
3317
+ }
3318
+ }
3319
+
3196
3320
  // Remove Content-Type if data is undefined
3197
3321
  requestData === undefined && requestHeaders.setContentType(null);
3198
3322
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.6",
2
+ "version": "1.1.8",
3
3
  "name": "denotify-client",
4
4
  "umd:name": "denotify-client",
5
5
  "repository": "robo-labs/denotify-client",
@@ -48,7 +48,7 @@
48
48
  "@supabase/supabase-js": "^2.10.0",
49
49
  "axois": "^0.0.1-security",
50
50
  "ethers": "^6.0.8",
51
- "rollup": "2.66.1",
51
+ "rollup": "^2.66.1",
52
52
  "rollup-plugin-terser": "7.0.2",
53
53
  "rollup-plugin-typescript2": "0.27.1",
54
54
  "tsm": "2.2.1",
@@ -58,13 +58,10 @@
58
58
  "dependencies": {
59
59
  "@supabase/supabase-js": "^2.10.0",
60
60
  "@types/axios": "^0.14.0",
61
- "axois": "^0.0.1-security",
62
61
  "ethers": "^6.0.8",
63
62
  "follow-redirects": "^1.15.2",
64
63
  "form-data": "^4.0.0",
65
64
  "proxy-from-env": "^1.1.0",
66
- "ts-node": "^10.9.1",
67
- "typescript": "^4.9.5",
68
65
  "yup": "^1.0.2"
69
66
  }
70
67
  }
@@ -1,47 +0,0 @@
1
- import { AlertBuilder } from "../alertbuilder.js";
2
- import { DeNotifyClient } from "../denotifyclient.js";
3
- import { FunctionBuilder } from "../functionbuilder.js";
4
- import { FilterBuilder } from "../util/filter.js";
5
- // Simple App to demonstrate usage. Created a balance monitoring alert, updates it and deletes it
6
- async function main() {
7
- const api = await DeNotifyClient.create({
8
- email: process.env.EMAIL,
9
- password: process.env.PASSWORD,
10
- });
11
- const network = 'avalanche';
12
- const address = '0x26985888d5b7019ff2A7444fB567D8F386c3b538';
13
- const myAddress = '0x7601630eC802952ba1ED2B6e4db16F699A0a5A87';
14
- const { abi } = await api.getAbi(network, address);
15
- const webhook = process.env.DISCORD_WEBHOOK;
16
- const builder = FunctionBuilder.create(api);
17
- await builder.addFunction(address, 'getBalance', [myAddress], abi);
18
- // Create the Balance Monitor alert
19
- const alert = AlertBuilder.create('Test Alert')
20
- .onNetwork('avalanche')
21
- .withTrigger('PollFunctionV2', {
22
- timeBase: 'time',
23
- timePeriod: '100s',
24
- functions: builder.get(),
25
- triggerOn: 'always',
26
- })
27
- .withNotification('Discord', {
28
- url: webhook,
29
- message: `Your avax balance is [{func_0_ret_0 / 1e18}](https://snowtrace.io/address/${myAddress})`,
30
- })
31
- .config();
32
- // Create the alert with the API
33
- const triggerId = await api.createAlert(alert);
34
- console.log(triggerId);
35
- // Update the period to every 10s
36
- await api.updateTrigger(triggerId, { timePeriod: '10s' });
37
- // Update the Filter using the filter builder
38
- const filter = FilterBuilder.new()
39
- .addCondition('WHERE', 'func_0_ret_0', 'Number', 'gt', 3)
40
- .finalise();
41
- await api.updateTrigger(13, { triggerOn: 'filter', filter, filterVersion: FilterBuilder.version() });
42
- // Delete the filter in 10s
43
- setTimeout(async () => {
44
- await api.deleteAlert(triggerId);
45
- }, 10 * 1000);
46
- }
47
- main();