UNPKG

chartjs-plugin-datasource-prometheus

Version:

Chart.js plugin for Prometheus datasource. Like Grafana, but standalone.

13 lines 56 kB
/*! * chartjs-plugin-datasource-prometheus v2.4.2 * github.com/samber/chartjs-plugin-datasource-prometheus * (c) 2025 chartjs-plugin-datasource-prometheus Contributors * Released under the MIT License */ /*! * chartjs-plugin-datasource-prometheus v2.4.2 * github.com/samber/chartjs-plugin-datasource-prometheus * (c) 2025 chartjs-plugin-datasource-prometheus Contributors * Released under the MIT License */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).ChartDatasourcePrometheusPlugin=t()}(this,(function(){"use strict";var e,t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};var n=(e||(e=1,function(e,r){!function(e){function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:o}=Object,s=(i=Object.create(null),e=>{const t=n.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())});var i;const a=e=>(e=e.toLowerCase(),t=>s(t)===e),l=e=>t=>typeof t===e,{isArray:c}=Array,u=l("undefined"),d=a("ArrayBuffer"),f=l("string"),h=l("function"),p=l("number"),m=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=o(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},b=a("Date"),y=a("File"),w=a("Blob"),E=a("FileList"),R=a("URLSearchParams"),[T,v,S,O]=["ReadableStream","Request","Response","Headers"].map(a);function x(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),c(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 A(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 N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:t,P=e=>!u(e)&&e!==N,C=(j="undefined"!=typeof Uint8Array&&o(Uint8Array),e=>j&&e instanceof j);var j;const D=a("HTMLFormElement"),U=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),k=a("RegExp"),_=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};x(r,((r,o)=>{let s;!1!==(s=t(r,o,e))&&(n[o]=s||r)})),Object.defineProperties(e,n)},q=a("AsyncFunction"),B=(L="function"==typeof setImmediate,F=h(N.postMessage),L?setImmediate:F?(M=`axios@${Math.random()}`,I=[],N.addEventListener("message",(({source:e,data:t})=>{e===N&&t===M&&I.length&&I.shift()()}),!1),e=>{I.push(e),N.postMessage(M,"*")}):e=>setTimeout(e));var L,F,M,I;const J="undefined"!=typeof queueMicrotask?queueMicrotask.bind(N):"undefined"!=typeof process&&process.nextTick||B;var G={isArray:c,isArrayBuffer:d,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=s(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:f,isNumber:p,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:g,isReadableStream:T,isRequest:v,isResponse:S,isHeaders:O,isUndefined:u,isDate:b,isFile:y,isBlob:w,isRegExp:k,isFunction:h,isStream:e=>m(e)&&h(e.pipe),isURLSearchParams:R,isTypedArray:C,isFileList:E,forEach:x,merge:function e(){const{caseless:t}=P(this)&&this||{},r={},n=(n,o)=>{const s=t&&A(r,o)||o;g(r[s])&&g(n)?r[s]=e(r[s],n):g(n)?r[s]=e({},n):c(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&x(arguments[e],n);return r},extend:(e,t,n,{allOwnKeys:o}={})=>(x(t,((t,o)=>{n&&h(t)?e[o]=r(t,n):e[o]=t}),{allOwnKeys:o}),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 s,i,a;const l={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],n&&!n(a,e,t)||l[a]||(t[a]=e[a],l[a]=!0);e=!1!==r&&o(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,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(c(e))return e;let t=e.length;if(!p(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:D,hasOwnProperty:U,hasOwnProp:U,reduceDescriptors:_,freezeMethods:e=>{_(e,((t,r)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];h(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 c(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)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:A,global:N,isContextDefined:P,isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=c(e)?[]:{};return x(e,((e,t)=>{const s=r(e,n+1);!u(s)&&(o[t]=s)})),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:q,isThenable:e=>e&&(m(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:B,asap:J};function z(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,this.status=o.status?o.status:null)}G.inherits(z,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:G.toJSONObject(this.config),code:this.code,status:this.status}}});const H=z.prototype,$={};function W(e){return G.isPlainObject(e)||G.isArray(e)}function V(e){return G.endsWith(e,"[]")?e.slice(0,-2):e}function K(e,t,r){return e?e.concat(t).map((function(e,t){return e=V(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=>{$[e]={value:e}})),Object.defineProperties(z,$),Object.defineProperty(H,"isAxiosError",{value:!0}),z.from=(e,t,r,n,o,s)=>{const i=Object.create(H);return G.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),z.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};const Q=G.toFlatObject(G,{},null,(function(e){return/^is[A-Z]/.test(e)}));function X(e,t,r){if(!G.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=G.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!G.isUndefined(t[e])}))).metaTokens,o=r.visitor||c,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&G.isSpecCompliantForm(t);if(!G.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(G.isDate(e))return e.toISOString();if(!a&&G.isBlob(e))throw new z("Blob is not supported. Use a Buffer instead.");return G.isArrayBuffer(e)||G.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(G.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(G.isArray(e)&&function(e){return G.isArray(e)&&!e.some(W)}(e)||(G.isFileList(e)||G.endsWith(r,"[]"))&&(a=G.toArray(e)))return r=V(r),a.forEach((function(e,n){!G.isUndefined(e)&&null!==e&&t.append(!0===i?K([r],n,s):null===i?r:r+"[]",l(e))})),!1;return!!W(e)||(t.append(K(o,r,s),l(e)),!1)}const u=[],d=Object.assign(Q,{defaultVisitor:c,convertValue:l,isVisitable:W});if(!G.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!G.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),G.forEach(r,(function(r,s){!0===(!(G.isUndefined(r)||null===r)&&o.call(t,r,G.isString(s)?s.trim():s,n,d))&&e(r,n?n.concat(s):[s])})),u.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Y(e,t){this._pairs=[],e&&X(e,this,t)}const ee=Y.prototype;function te(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function re(e,t,r){if(!t)return e;const n=r&&r.encode||te;G.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let s;if(s=o?o(t,r):G.isURLSearchParams(t)?t.toString():new Y(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ee.append=function(e,t){this._pairs.push([e,t])},ee.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class ne{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){G.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var oe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},se={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Y,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ie="undefined"!=typeof window&&"undefined"!=typeof document,ae="object"==typeof navigator&&navigator||void 0,le=ie&&(!ae||["ReactNative","NativeScript","NS"].indexOf(ae.product)<0),ce="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ue=ie&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ie,hasStandardBrowserEnv:le,hasStandardBrowserWebWorkerEnv:ce,navigator:ae,origin:ue}),...se};function fe(e){function t(e,r,n,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;return s=!s&&G.isArray(n)?n.length:s,a?(G.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!i):(n[s]&&G.isObject(n[s])||(n[s]=[]),t(e,r,n[s],o)&&G.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(G.isFormData(e)&&G.isFunction(e.entries)){const r={};return G.forEachEntry(e,((e,n)=>{t(function(e){return G.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const he={transitional:oe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=G.isObject(e);if(o&&G.isHTMLForm(e)&&(e=new FormData(e)),G.isFormData(e))return n?JSON.stringify(fe(e)):e;if(G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)||G.isReadableStream(e))return e;if(G.isArrayBufferView(e))return e.buffer;if(G.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 X(e,new de.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return de.isNode&&G.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=G.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return X(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(G.isString(e))try{return(t||JSON.parse)(e),G.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||he.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(G.isResponse(e)||G.isReadableStream(e))return e;if(e&&G.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 z.from(e,z.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:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};G.forEach(["delete","get","head","post","put","patch"],(e=>{he.headers[e]={}}));const pe=G.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"]),me=Symbol("internals");function ge(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:G.isArray(e)?e.map(be):String(e)}function ye(e,t,r,n,o){return G.isFunction(n)?n.call(this,t,r):(o&&(t=r),G.isString(t)?G.isString(n)?-1!==t.indexOf(n):G.isRegExp(n)?n.test(t):void 0:void 0)}let we=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=ge(t);if(!o)throw new Error("header name must be a non-empty string");const s=G.findKey(n,o);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=be(e))}const s=(e,t)=>G.forEach(e,((e,r)=>o(e,r,t)));if(G.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(G.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.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]&&pe[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(G.isHeaders(e))for(const[t,n]of e.entries())o(n,t,r);else null!=e&&o(t,e,r);return this}get(e,t){if(e=ge(e)){const r=G.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(G.isFunction(t))return t.call(this,e,r);if(G.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ge(e)){const r=G.findKey(this,e);return!(!r||void 0===this[r]||t&&!ye(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=ge(e)){const o=G.findKey(r,e);!o||t&&!ye(0,r[o],o,t)||(delete r[o],n=!0)}}return G.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&&!ye(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return G.forEach(this,((n,o)=>{const s=G.findKey(r,o);if(s)return t[s]=be(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]=be(n),r[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return G.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&G.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[me]=this[me]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ge(e);t[n]||(function(e,t){const r=G.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 G.isArray(e)?e.forEach(n):n(e),this}};function Ee(e,t){const r=this||he,n=t||r,o=we.from(n.headers);let s=n.data;return G.forEach(e,(function(e){s=e.call(r,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function Re(e){return!(!e||!e.__CANCEL__)}function Te(e,t,r){z.call(this,null==e?"canceled":e,z.ERR_CANCELED,t,r),this.name="CanceledError"}function ve(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new z("Request failed with status code "+r.status,[z.ERR_BAD_REQUEST,z.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}we.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),G.reduceDescriptors(we.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),G.freezeMethods(we),G.inherits(Te,z,{__CANCEL__:!0});const Se=(e,t,r=3)=>{let n=0;const o=function(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 l=Date.now(),c=n[i];o||(o=l),r[s]=a,n[s]=l;let u=i,d=0;for(;u!==s;)d+=r[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),l-o<t)return;const f=c&&l-c;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let r,n,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(r=e,n||(n=setTimeout((()=>{n=null,i(r)}),s-a)))},()=>r&&i(r)]}((r=>{const s=r.loaded,i=r.lengthComputable?r.total:void 0,a=s-n,l=o(a);n=s,e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:l||void 0,estimated:l&&i&&s<=i?(i-s)/l:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})}),r)},Oe=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},xe=e=>(...t)=>G.asap((()=>e(...t)));var Ae=de.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,de.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,Ne=de.hasStandardBrowserEnv?{write(e,t,r,n,o,s){const i=[e+"="+encodeURIComponent(t)];G.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),G.isString(n)&&i.push("path="+n),G.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Pe(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ce=e=>e instanceof we?{...e}:e;function je(e,t){t=t||{};const r={};function n(e,t,r,n){return G.isPlainObject(e)&&G.isPlainObject(t)?G.merge.call({caseless:n},e,t):G.isPlainObject(t)?G.merge({},t):G.isArray(t)?t.slice():t}function o(e,t,r,o){return G.isUndefined(t)?G.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function s(e,t){if(!G.isUndefined(t))return n(void 0,t)}function i(e,t){return G.isUndefined(t)?G.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 l={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken: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,r)=>o(Ce(e),Ce(t),0,!0)};return G.forEach(Object.keys(Object.assign({},e,t)),(function(n){const s=l[n]||o,i=s(e[n],t[n],n);G.isUndefined(i)&&s!==a||(r[n]=i)})),r}var De=e=>{const t=je({},e);let r,{data:n,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=we.from(a),t.url=re(Pe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),G.isFormData(n))if(de.hasStandardBrowserEnv||de.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(de.hasStandardBrowserEnv&&(o&&G.isFunction(o)&&(o=o(t)),o||!1!==o&&Ae(t.url))){const e=s&&i&&Ne.read(i);e&&a.set(s,e)}return t},Ue="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=De(e);let o=n.data;const s=we.from(n.headers).normalize();let i,a,l,c,u,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=n;function p(){c&&c(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const n=we.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ve((function(e){t(e),p()}),(function(e){r(e),p()}),{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(r(new z("Request aborted",z.ECONNABORTED,e,m)),m=null)},m.onerror=function(){r(new z("Network Error",z.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||oe;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new z(t,o.clarifyTimeoutError?z.ETIMEDOUT:z.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&G.forEach(s.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),G.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),d&&"json"!==d&&(m.responseType=n.responseType),h&&([l,u]=Se(h,!0),m.addEventListener("progress",l)),f&&m.upload&&([a,c]=Se(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new Te(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===de.protocols.indexOf(b)?r(new z("Unsupported protocol "+b+":",z.ERR_BAD_REQUEST,e)):m.send(o||null)}))};const ke=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const o=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof z?t:new Te(t instanceof Error?t.message:t))}};let s=t&&setTimeout((()=>{s=null,o(new z(`timeout ${t} of ms exceeded`,z.ETIMEDOUT))}),t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:a}=n;return a.unsubscribe=()=>G.asap(i),a}},_e=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,o=0;for(;o<r;)n=o+t,yield e.slice(o,n),o=n},qe=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Be=(e,t,r,n)=>{const o=async function*(e,t){for await(const r of qe(e))yield*_e(r,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return a(),void e.close();let s=n.byteLength;if(r){let e=i+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Le="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Fe=Le&&"function"==typeof ReadableStream,Me=Le&&("function"==typeof TextEncoder?(Ie=new TextEncoder,e=>Ie.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ie;const Je=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ge=Fe&&Je((()=>{let e=!1;const t=new Request(de.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),ze=Fe&&Je((()=>G.isReadableStream(new Response("").body))),He={stream:ze&&(e=>e.body)};var $e;Le&&($e=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!He[e]&&(He[e]=G.isFunction($e[e])?t=>t[e]():(t,r)=>{throw new z(`Response type '${e}' is not supported`,z.ERR_NOT_SUPPORT,r)})})));const We=async(e,t)=>{const r=G.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(G.isBlob(e))return e.size;if(G.isSpecCompliantForm(e)){const t=new Request(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return G.isArrayBufferView(e)||G.isArrayBuffer(e)?e.byteLength:(G.isURLSearchParams(e)&&(e+=""),G.isString(e)?(await Me(e)).byteLength:void 0)})(t):r},Ve={http:null,xhr:Ue,fetch:Le&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:f}=De(e);c=c?(c+"").toLowerCase():"text";let h,p=ke([o,s&&s.toAbortSignal()],i);const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let g;try{if(l&&Ge&&"get"!==r&&"head"!==r&&0!==(g=await We(u,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(G.isFormData(n)&&(e=r.headers.get("content-type"))&&u.setContentType(e),r.body){const[e,t]=Oe(g,Se(xe(l)));n=Be(r.body,65536,e,t)}}G.isString(d)||(d=d?"include":"omit");const o="credentials"in Request.prototype;h=new Request(t,{...f,signal:p,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:n,duplex:"half",credentials:o?d:void 0});let s=await fetch(h);const i=ze&&("stream"===c||"response"===c);if(ze&&(a||i&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=s[t]}));const t=G.toFiniteNumber(s.headers.get("content-length")),[r,n]=a&&Oe(t,Se(xe(a),!0))||[];s=new Response(Be(s.body,65536,r,(()=>{n&&n(),m&&m()})),e)}c=c||"text";let b=await He[G.findKey(He,c)||"text"](s,e);return!i&&m&&m(),await new Promise(((t,r)=>{ve(t,r,{data:b,headers:we.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:h})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new z("Network Error",z.ERR_NETWORK,e,h),{cause:t.cause||t});throw z.from(t,t&&t.code,e,h)}})};G.forEach(Ve,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Ke=e=>`- ${e}`,Qe=e=>G.isFunction(e)||null===e||!1===e;var Xe=e=>{e=G.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let s=0;s<t;s++){let t;if(r=e[s],n=r,!Qe(r)&&(n=Ve[(t=String(r)).toLowerCase()],void 0===n))throw new z(`Unknown adapter '${t}'`);if(n)break;o[t||"#"+s]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new z("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ke).join("\n"):" "+Ke(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function Ze(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Te(null,e)}function Ye(e){return Ze(e),e.headers=we.from(e.headers),e.data=Ee.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Xe(e.adapter||he.adapter)(e).then((function(t){return Ze(e),t.data=Ee.call(e,e.transformResponse,t),t.headers=we.from(t.headers),t}),(function(t){return Re(t)||(Ze(e),t&&t.response&&(t.response.data=Ee.call(e,e.transformResponse,t.response),t.response.headers=we.from(t.response.headers))),Promise.reject(t)}))}const et="1.8.4",tt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{tt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const rt={};tt.transitional=function(e,t,r){function n(e,t){return"[Axios v1.8.4] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,s)=>{if(!1===e)throw new z(n(o," has been removed"+(t?" in "+t:"")),z.ERR_DEPRECATED);return t&&!rt[o]&&(rt[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)}},tt.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var nt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new z("options must be an object",z.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 z("option "+s+" must be "+r,z.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new z("Unknown option "+s,z.ERR_BAD_OPTION)}},validators:tt};const ot=nt.validators;let st=class{constructor(e){this.defaults=e,this.interceptors={request:new ne,response:new ne}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=je(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;void 0!==r&&nt.assertOptions(r,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean)},!1),null!=n&&(G.isFunction(n)?t.paramsSerializer={serialize:n}:nt.assertOptions(n,{encode:ot.function,serialize:ot.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),nt.assertOptions(t,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&G.merge(o.common,o[t.method]);o&&G.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=we.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 l=[];let c;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let u,d=0;if(!a){const e=[Ye.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=i.length;let f=t;for(d=0;d<u;){const t=i[d++],r=i[d++];try{f=t(f)}catch(e){r.call(this,e);break}}try{c=Ye.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return re(Pe((e=je(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};G.forEach(["delete","get","head","options"],(function(e){st.prototype[e]=function(t,r){return this.request(je(r||{},{method:e,url:t,data:(r||{}).data}))}})),G.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,o){return this.request(je(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}st.prototype[e]=t(),st.prototype[e+"Form"]=t(!0)}));const it={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(it).forEach((([e,t])=>{it[t]=e}));const at=function e(t){const n=new st(t),o=r(st.prototype.request,n);return G.extend(o,st.prototype,n,{allOwnKeys:!0}),G.extend(o,n,null,{allOwnKeys:!0}),o.create=function(r){return e(je(t,r))},o}(he);var lt;at.Axios=st,at.CanceledError=Te,at.CancelToken=class e{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 Te(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)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},at.isCancel=Re,at.VERSION=et,at.toFormData=X,at.AxiosError=z,at.Cancel=at.CanceledError,at.all=function(e){return Promise.all(e)},at.spread=function(e){return function(t){return e.apply(null,t)}},at.isAxiosError=function(e){return G.isObject(e)&&!0===e.isAxiosError},at.mergeConfig=je,at.AxiosHeaders=we,at.formToJSON=e=>fe(G.isHTMLForm(e)?new FormData(e):e),at.getAdapter=Xe,at.HttpStatusCode=it,at.default=at,e.ResponseType=void 0,(lt=e.ResponseType||(e.ResponseType={})).MATRIX="matrix",lt.VECTOR="vector",lt.SCALAR="scalar",lt.STRING="string";class ct{constructor(e,t){if(e&&"string"!=typeof e)throw new Error("Wrong name format. Expected string.");if(t&&"object"!=typeof t)throw new Error("Wrong labels format. Expected object.");this.name=e,this.labels=t}static fromJSON(e){const t=e.__name__,r=Object.assign({},e);return delete r.__name__,new ct(t,r)}toString(){return(this.name?this.name:"")+"{"+Object.keys(this.labels).map((e=>e+'="'+this.labels[e]+'"')).join(", ")+"}"}}class ut{constructor(e,t){if("object"!=typeof e||"Date"!=e.constructor.name)throw new Error("Wrong time format. Expected Date.");if("number"!=typeof t)throw new Error("Wrong value format. Expected float.");this.time=e,this.value=t}static fromJSON(e){const t=new Date(1e3*e[0]),r=parseFloat(e[1]);return new ut(t,r)}toString(){return this.time+": "+this.value}}class dt{constructor(e,t){this.metric=e,this.values=t}static fromJSON(e){const t=e.metric?ct.fromJSON(e.metric):null,r=e.values.map(ut.fromJSON);return new dt(t,r)}}class ft{constructor(e,t){this.metric=e,this.value=t}static fromJSON(e){const t=e.metric?ct.fromJSON(e.metric):null,r=ut.fromJSON(e.value);return new ft(t,r)}}class ht{constructor(e,t){this.resultType=e,this.result=t}static fromJSON(t){const r=t.resultType;let n=null;switch(r){case e.ResponseType.MATRIX:n=t.result.map(dt.fromJSON);break;case e.ResponseType.VECTOR:n=t.result.map(ft.fromJSON);break;case e.ResponseType.SCALAR:case e.ResponseType.STRING:n=t.result;break;default:throw new Error(`Unexpected resultType: ${r}`)}return new ht(r,n)}}class pt{constructor(e,t,r,n,o,s,i,a){if(e&&"object"!=typeof e)throw new Error(`Unexpected format for discoveredLabels. Got ${typeof e} instead of object`);if(t&&"object"!=typeof t)throw new Error(`Unexpected format for labels. Got ${typeof t} instead of object`);if(r&&"string"!=typeof r)throw new Error(`Unexpected format for scrapePool. Got ${typeof r} instead of string`);if(n&&"string"!=typeof n)throw new Error(`Unexpected format for scrapeUrl. Got ${typeof n} instead of string`);if(o&&"string"!=typeof o)throw new Error(`Unexpected format for lastError. Got ${typeof o} instead of string`);if(s&&("object"!=typeof s||"Date"!=s.constructor.name))throw new Error(`Unexpected format for lastScrape. Got ${typeof s} instead of object`);if(i&&"number"!=typeof i)throw new Error(`Unexpected format for lastScrapeDuration. Got ${typeof i} instead of number`);if(a&&"string"!=typeof a)throw new Error(`Unexpected format for health. Got ${typeof a} instead of string`);this.discoveredLabels=e,this.labels=t,this.scrapePool=r,this.scrapeUrl=n,this.lastError=o,this.lastScrape=s,this.lastScrapeDuration=i,this.health=a}static fromJSON(e){return new pt(e.discoveredLabels,e.labels,e.scrapePool,e.scrapeUrl,e.lastError,e.lastScrape?new Date(e.lastScrape):null,e.lastScrapeDuration?parseFloat(e.lastScrapeDuration):null,e.health)}}class mt{constructor(e,t,r,n,o){if(e&&("object"!=typeof e||"Date"!=e.constructor.name))throw new Error(`Unexpected format for activeAt. Got ${typeof e} instead of object`);if(t&&"object"!=typeof t)throw new Error(`Unexpected format for annotations. Got ${typeof t} instead of object`);if(r&&"object"!=typeof r)throw new Error(`Unexpected format for labels. Got ${typeof r} instead of object`);if(o&&"number"!=typeof o)throw new Error(`Unexpected format for value. Got ${typeof o} instead of number`);this.activeAt=e,this.annotations=t,this.labels=r,this.state=n,this.value=o}static fromJSON(e){return new mt(e.activeAt?new Date(e.activeAt):null,e.annotations,e.labels,e.state,e.value?parseFloat(e.value):null)}}class gt{constructor(e,t,r,n,o,s,i,a){this.alerts=e,this.annotations=t,this.duration=r,this.health=n,this.labels=o,this.name=s,this.query=i,this.type=a}static fromJSON(e){return new gt(e.alerts?e.alerts.map(mt.fromJSON):[],e.annotations,e.duration,e.health,e.labels,e.name,e.query,e.type)}}class bt{constructor(e,t,r,n){this.rules=e,this.file=t,this.interval=r,this.name=n}static fromJSON(e){return new bt(e.rules?e.rules.map(gt.fromJSON):[],e.file,e.interval,e.name)}}class yt{constructor(){this.baseURL="/api/v1/",this.headers={},this.auth=null,this.proxy=null,this.withCredentials=!1,this.timeout=1e4,this.preferPost=!1,this.warningHook=null}}e.Alert=mt,e.InstantVector=ft,e.Metric=ct,e.PrometheusConnectionOptions=yt,e.PrometheusDriver=class{constructor(e){if(this.listifyIfNeeded=e=>e instanceof Array?e:[e],this.formatPromQlParams=e=>Object.entries(null!=e?e:{}).reduce(((e,[t,r])=>(null!=r&&(r instanceof Array?r.filter((e=>null!=e)).forEach((r=>e.append(`${t}[]`,r))):e.append(t,r)),e)),new URLSearchParams),!(e=e||new yt).endpoint)throw"Endpoint is required";e.endpoint=e.endpoint.replace(/\/$/,""),e.baseURL=e.baseURL||"/api/v1/",e.withCredentials=e.withCredentials||!1,e.timeout=e.timeout||1e4,this.options=e,this.axiosInstance=at.create(),this.options.requestInterceptor&&this.axiosInstance.interceptors.request.use(this.options.requestInterceptor.onFulfilled,this.options.requestInterceptor.onRejected),this.options.responseInterceptor&&this.axiosInstance.interceptors.response.use(this.options.responseInterceptor.onFulfilled,this.options.responseInterceptor.onRejected)}request(e,t,r,n){var o,s,i,a,l,c;const u=Object.assign({},this.options.headers||{});return this.axiosInstance.request({baseURL:this.options.endpoint+this.options.baseURL,url:t,method:e,params:this.formatPromQlParams(r),data:this.formatPromQlParams(n),headers:u,auth:(null===(o=this.options.auth)||void 0===o?void 0:o.username)&&(null===(s=this.options.auth)||void 0===s?void 0:s.password)?{username:this.options.auth.username,password:this.options.auth.password}:null,proxy:(null===(i=this.options.proxy)||void 0===i?void 0:i.host)&&(null===(a=this.options.proxy)||void 0===a?void 0:a.port)?{host:null===(l=this.options.proxy)||void 0===l?void 0:l.host,port:null===(c=this.options.proxy)||void 0===c?void 0:c.port}:null,withCredentials:this.options.withCredentials,timeout:this.options.timeout}).then((e=>this.handleResponse(e))).catch((e=>this.handleResponse(e,!0)))}handleResponse(e,t=!1){var r,n,o,s,i;const a=!0===(null==e?void 0:e.isAxiosError),l=t||a,c=a?e:void 0,u=a?c.response:l?null==e?void 0:e.response:e;if(!u){const t=null!==(r=null==c?void 0:c.code)&&void 0!==r?r:null==e?void 0:e.code,i=null!==(o=null!==(n=null==c?void 0:c.message)&&void 0!==n?n:null==e?void 0:e.message)&&void 0!==o?o:"unexpected network error";throw{status:"error",errorType:"ECONNABORTED"===t?"timeout_error":(null===(s=null==t?void 0:t.startsWith)||void 0===s?void 0:s.call(t,"ERR_SSL"))?"ssl_error":"network_error",error:i,code:t,original:e}}this.options.warningHook&&Array.isArray(u.warnings)&&u.warnings.length&&this.options.warningHook(u.warnings);const d=u.data;if(!d||null==d.status)throw{status:"error",errorType:"client_error",error:"unexpected client error",data:d};if(l)throw{status:"error",errorType:"http_error",httpStatus:u.status,error:null!==(i=d.error)&&void 0!==i?i:u.statusText,prometheus:d};return d.data}formatTimeToPrometheus(e,t){var r;if(e||(e=t),"number"==typeof e)return e/1e3;if("object"==typeof e&&"Date"==(null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name))return e.getTime()/1e3;throw new Error("Wrong time format. Expected number or Date.")}instantQuery(e,t,r){const n={query:e,time:this.formatTimeToPrometheus(t,new Date),timeout:r};return(this.options.preferPost?this.request("POST","query",null,n):this.request("GET","query",n)).then((e=>ht.fromJSON(e)))}rangeQuery(e,t,r,n,o){const s={query:e,start:this.formatTimeToPrometheus(t),end:this.formatTimeToPrometheus(r),step:n,timeout:o};return(this.options.preferPost?this.request("POST","query_range",null,s):this.request("GET","query_range",s)).then((e=>ht.fromJSON(e)))}series(e,t,r){const n={match:this.listifyIfNeeded(e),start:this.formatTimeToPrometheus(t),end:this.formatTimeToPrometheus(r)};return(this.options.preferPost?this.request("POST","series",null,n):this.request("GET","series",n)).then((e=>e.map(ct.fromJSON)))}labelNames(e,t,r){const n={match:this.listifyIfNeeded(e),start:t?this.formatTimeToPrometheus(t):void 0,end:r?this.formatTimeToPrometheus(r):void 0};return this.options.preferPost?this.request("POST","labels",null,n):this.request("GET","labels",n)}labelValues(e,t,r,n){const o={match:this.listifyIfNeeded(t),start:r?this.formatTimeToPrometheus(r):void 0,end:n?this.formatTimeToPrometheus(n):void 0};return this.request("GET",`label/${e}/values`,o)}targets(e){const t={query:e||"any"};return this.request("GET","targets",t).then((e=>({activeTargets:e.activeTargets?e.activeTargets.map(pt.fromJSON):[],droppedTargets:e.droppedTargets?e.droppedTargets.map(pt.fromJSON):[]})))}targetsMetadata(e,t,r){const n={match_target:e,metric:t,limit:r};return this.request("GET","targets/metadata",n)}metadata(e,t){const r={metric:e,limit:t};return this.request("GET","metadata",r)}rules(){return this.request("GET","rules").then((e=>(e.groups?e.groups:[]).map(bt.fromJSON)))}alerts(){return this.request("GET","alerts").then((e=>(e.alerts?e.alerts:[]).map(mt.fromJSON)))}alertmanagers(){return this.request("GET","alertmanagers")}status(){return this.request("GET","status/config")}statusFlags(){return this.request("GET","status/flags")}statusRuntimeInfo(){return this.request("GET","status/runtimeinfo")}statusBuildinfo(){return this.request("GET","status/buildinfo")}statusTSDB(){return this.request("GET","status/tsdb")}adminSnapshot(e){const t={skip_head:e};return this.request("POST","admin/tsdb/snapshot",t)}adminDeleteSeries(e,t,r){const n={match:this.listifyIfNeeded(e),start:this.formatTimeToPrometheus(t),end:this.formatTimeToPrometheus(r)};return this.request("POST","admin/tsdb/delete_series",n)}adminCleanTombstones(){return this.request("POST","admin/tsdb/clean_tombstones")}},e.QueryResult=ht,e.RangeVector=dt,e.Rule=gt,e.RuleGroup=bt,e.SampleValue=ut,e.Target=pt}(r)}(0,r.exports)),r.exports);var o={getPrometheusStepAuto:(e,t,r)=>{const n=(t.getTime()-e.getTime())/1e3,o=25*Math.floor(n/r);return o<1?1:o},getStartAndEndDates(e){if(e.type=e.type?e.type:"absolute","absolute"===e.type)return{type:"absolute",start:e.start,end:e.end};if("relative"===e.type)return{type:"absolute",start:new Date((new Date).getTime()+e.start),end:new Date((new Date).getTime()+e.end)};throw new Error("Unexpected options.timeRange value.")},executeQueries:(e,t,r,o,s)=>{const i=null!=t.find((e=>"string"==typeof e)),a=e&&i?new n.PrometheusDriver(e):null;return t.map((e=>"string"==typeof e?a.rangeQuery(e,r,o,s):e(r,o,s).then((e=>n.QueryResult.fromJSON(e)))))}};class s{constructor(){this.message="No data to display",this.font="16px normal 'Helvetica Nueue'",this.textAlign="center",this.textBaseline="middle",this.direction="ltr"}}class i{constructor(){this.message=null,this.font="16px normal 'Helvetica Nueue'",this.textAlign="center",this.textBaseline="middle",this.direction="ltr"}}class a{constructor(){this.message="Loading data...",this.font="16px normal 'Helvetica Nueue'",this.textAlign="center",this.textBaseline="middle",this.direction="ltr"}}const l=["rgba(255, 99, 132, 1)","rgba(54, 162, 235, 1)","rgba(255, 206, 86, 1)","rgba(75, 192, 192, 1)","rgba(153, 102, 255, 1)","rgba(255, 159, 64, 1)"];class c{constructor(){this.chartType="timeseries",this.prometheus=null,this.fillGaps=!1,this.tension=.4,this.cubicInterpolationMode="default",this.stepped=!1,this.fill=!1,this.stacked=!1,this.borderWidth=3,this.borderColor=l,this.backgroundColor=l,this.noDataMsg=new s,this.errorMsg=new i,this.loadingMsg=new a,this.findInLabelMap=null,this.findInBorderColorMap=null,this.findInBackgroundColorMap=null,this.dataSetHook=null}assertPluginOptions(){if(!this.query)throw new Error("options.query is undefined");if(!this.timeRange)throw new Error("options.timeRange is undefined");if(null==this.timeRange.start)throw new Error("options.timeRange.start is undefined");if(null==this.timeRange.end)throw new Error("options.timeRange.end is undefined");if("object"!=typeof this.timeRange)throw new Error("options.timeRange must be a object");if("string"!=typeof this.timeRange.type)throw new Error("options.timeRange.type must be a string");if("relative"!=this.timeRange.type&&"absolute"!=this.timeRange.type)throw new Error('options.timeRange.type must be either "relative" or "absolute"');if("number"!=typeof this.timeRange.start&&("object"!=typeof this.timeRange.start||"Date"!=this.timeRange.start.constructor.name))throw new Error("options.timeRange.start must be a Date object (absolute) or integer (relative)");if("number"!=typeof this.timeRange.end&&("object"!=typeof this.timeRange.end||"Date"!=this.timeRange.end.constructor.name))throw new Error("options.timeRange.end must be a Date object (absolute) or integer (relative)");if(null!=this.timeRange.msUpdateInterval&&"number"!=typeof this.timeRange.msUpdateInterval)throw new Error("options.timeRange.msUpdateInterval must be a integer");if(null!=this.timeRange.msUpdateInterval&&this.timeRange.msUpdateInterval<1e3)throw new Error("options.timeRange.msUpdateInterval must be greater than 1s.")}getQueries(){var e,t;return"Array"!=(null===(t=null===(e=this.query)||void 0===e?void 0:e.constructor)||void 0===t?void 0:t.name)?[this.query]:this.query}}function u(e){const t=e.config.options.plugins["datasource-prometheus"];if(t&&"stat"===t.chartType)return;e.config.options.scales=e.config.options.scales?e.config.options.scales:{},e.config.options.scales.x=e.config.options.scales.x?e.config.options.scales.x:{},e.config.options.scales.y=e.config.options.scales.y?e.config.options.scales.y:{};const{ticks:r,time:n}=JSON.parse(JSON.stringify(e.config.options.scales.x));Object.assign(e.config.options.scales.x,{type:"timeseries",ticks:Object.assign({maxRotation:0,minRotation:0,major:{enabled:!0}},r),stacked:t.stacked,time:Object.assign({minUnit:"second"},n)}),Object.assign(e.config.options.scales.y,{stacked:t.stacked})}function d(e,t,r){const n=t.metric.toString();return e.findInLabelMap&&e.findInLabelMap(t.metric)||n}function f(e,t,r){const n=e.fill?e.backgroundColor[r%e.backgroundColor.length]:"transparent";return e.findInBackgroundColorMap&&e.findInBackgroundColorMap(t.metric)||n}function h(e,t,r){const n=e.borderColor[r%e.borderColor.length];return e.findInBorderColorMap&&e.findInBorderColorMap(t.metric)||n}class p{constructor(){this.loading=!1,this.rendering=!1,this.updateInterval=null,this.error=null}}return new class{constructor(){this.id="datasource-prometheus"}beforeInit(e,t){e["datasource-prometheus"]=new p}afterInit(e,t,r){if(!r)throw