Merge tag 'v1.155.0' into pmm-6401-read-prometheus-data-files

Release v1.155.0
This commit is contained in:
Max Kotliar committed 2026-10-26 16:12:43 +02:00
commit 3db4e15142
157 files changed
+6798 -1717

No files matched your search

+8
View File
@@ -128,3 +128,11 @@ The provided [ZIP file](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/
* You may resize the logo as needed, but ensure all proportions remain intact.
Thank you for your cooperation!
## Join the team
We're hiring engineers who share the same [development goals](https://docs.victoriametrics.com/victoriametrics/goals/) as we do: practical improvements, simple solutions, and happy users.
Already contributing to VictoriaMetrics? We'd be especially happy to hear from you.
[Explore open roles.](https://careers.victoriametrics.com/)
+1
View File
@@ -98,6 +98,7 @@ func main() {
if len(listenAddrs) == 0 {
listenAddrs = []string{":8428"}
}
httpserver.CheckHealth(listenAddrs)
logger.Infof("starting VictoriaMetrics at %q...", listenAddrs)
startTime := time.Now()
+1
View File
@@ -147,6 +147,7 @@ func main() {
if len(listenAddrs) == 0 {
listenAddrs = []string{":8429"}
}
httpserver.CheckHealth(listenAddrs)
logger.Infof("starting vmagent at %q...", listenAddrs)
startTime := time.Now()
remotewrite.StartIngestionRateLimiter()
+3
View File
@@ -104,6 +104,9 @@ func (c *Client) ApplyParams(params QuerierParams) *Client {
c.dataSourceType = toDatasourceType(params.DataSourceType)
}
c.evaluationInterval = params.EvaluationInterval
if params.QueryStep > 0 {
c.queryStep = params.QueryStep
}
c.applyIntervalAsTimeFilter = params.ApplyIntervalAsTimeFilter
if params.QueryParams != nil {
if c.extraParams == nil {
+12
View File
@@ -651,6 +651,18 @@ func TestRequestParams(t *testing.T) {
checkEqualString(t, exp.Encode(), r.URL.RawQuery)
})
// step override via querier params
f(false, (&Client{
dataSourceType: datasourcePrometheus,
queryStep: time.Minute,
}).ApplyParams(QuerierParams{
EvaluationInterval: 15 * time.Second,
QueryStep: time.Hour,
}), func(t *testing.T, r *http.Request) {
exp := url.Values{"query": {query}, "step": {"3600s"}, "time": {timestamp.Format(time.RFC3339)}}
checkEqualString(t, exp.Encode(), r.URL.RawQuery)
})
// step to seconds
f(false, &Client{
dataSourceType: datasourcePrometheus,
+6 -3
View File
@@ -53,9 +53,12 @@ type QuerierParams struct {
// and we will add evaluation interval as an additional timeFilter when querying.
ApplyIntervalAsTimeFilter bool
EvaluationInterval time.Duration
QueryParams url.Values
Headers map[string]string
Debug bool
// QueryStep overrides `step` param for instant queries if set.
// It's only valid for prometheus datasource.
QueryStep time.Duration
QueryParams url.Values
Headers map[string]string
Debug bool
}
// Metric is the basic entity which should be return by datasource
+6 -5
View File
@@ -93,6 +93,12 @@ func main() {
buildinfo.Init()
logger.Init()
listenAddrs := *httpListenAddrs
if len(listenAddrs) == 0 {
listenAddrs = []string{":8880"}
}
httpserver.CheckHealth(listenAddrs)
var err error
extURL, err = getExternalURL(*externalURL)
if err != nil {
@@ -176,11 +182,6 @@ func main() {
go configReload(ctx, manager, groupsCfg, sighupCh)
listenAddrs := *httpListenAddrs
if len(listenAddrs) == 0 {
listenAddrs = []string{":8880"}
}
// Register paths which could be protected by their own -*AuthKey flag.
httpserver.RegisterAuthKeyProtectedPathsFunc(isAuthKeyProtectedPath)
+1 -1
View File
@@ -16,7 +16,7 @@ import (
)
var (
addr = flag.String("remoteRead.url", "", "Optional URL to datasource compatible with MetricsQL. It can be single node VictoriaMetrics or vmselect. "+
addr = flag.String("remoteRead.url", "", "Optional URL to datasource compatible with Prometheus querying API. It can be single node VictoriaMetrics, vmselect or Prometheus. "+
"Remote read is used to restore alerts state. "+
"This configuration makes sense only if vmalert was configured with '-remoteWrite.url' before and has been successfully persisted its state. "+
"Supports address in the form of IP address with a port (e.g., http://127.0.0.1:8428) or DNS SRV record. "+
+4 -3
View File
@@ -832,9 +832,10 @@ func (ar *AlertingRule) restore(ctx context.Context, q datasource.Querier, ts ti
}
labelsFilter += fmt.Sprintf(",%s=%q", k, v)
}
// use `default_rollup()` instead of `last_over_time()` here to accounts for possible staleness markers
expr := fmt.Sprintf("default_rollup(%s{%s%s}[%ds])",
alertForStateMetricName, nameStr, labelsFilter, int(remoteReadLookBack.Seconds()))
// use plain series selector to account for possible staleness markers
// and to stay compatible with Prometheus as -remoteRead.url.
// see https://github.com/VictoriaMetrics/VictoriaMetrics/issues/11574
expr := fmt.Sprintf("%s{%s%s}", alertForStateMetricName, nameStr, labelsFilter)
res, _, err := q.Query(ctx, expr, ts)
if err != nil {
+9 -9
View File
@@ -895,7 +895,7 @@ func TestGroup_Restore(t *testing.T) {
// one active alert with state restore
ts := time.Now().Truncate(time.Hour)
fqr.Set("foo", metricWithValueAndLabels(t, 0, "__name__", "foo"))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}`,
stateMetric("foo", ts))
f(
[]config.Rule{{Alert: "foo", Expr: "foo", For: promutil.NewDuration(time.Second)}},
@@ -912,7 +912,7 @@ func TestGroup_Restore(t *testing.T) {
fqr.Set("foo",
metricWithValueAndLabels(t, 0, "__name__", "foo", "env", "prod"),
metricWithValueAndLabels(t, 0, "__name__", "foo", "env", "dev"))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}`,
// only env=prod has state metric, so only it will have state restore
stateMetric("foo", ts, "env", "prod"))
f(
@@ -936,7 +936,7 @@ func TestGroup_Restore(t *testing.T) {
ts = time.Now().Truncate(time.Hour)
fqr.Set("foo", metricWithValueAndLabels(t, 0, "__name__", "foo"))
fqr.Set("bar", metricWithValueAndLabels(t, 0, "__name__", "bar"))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="bar"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="bar"}`,
stateMetric("bar", ts))
f(
[]config.Rule{
@@ -960,9 +960,9 @@ func TestGroup_Restore(t *testing.T) {
ts = time.Now().Truncate(time.Hour)
fqr.Set("foo", metricWithValueAndLabels(t, 0, "__name__", "foo"))
fqr.Set("bar", metricWithValueAndLabels(t, 0, "__name__", "bar"))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}`,
stateMetric("foo", ts))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="bar"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="bar"}`,
stateMetric("bar", ts))
f(
[]config.Rule{
@@ -985,7 +985,7 @@ func TestGroup_Restore(t *testing.T) {
// one active alert but wrong state restore
ts = time.Now().Truncate(time.Hour)
fqr.Set("foo", metricWithValueAndLabels(t, 0, "__name__", "foo"))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertname="bar",alertgroup="TestRestore"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertname="bar",alertgroup="TestRestore"}`,
stateMetric("wrong alert", ts))
f(
[]config.Rule{{Alert: "foo", Expr: "foo", For: promutil.NewDuration(time.Second)}},
@@ -1000,7 +1000,7 @@ func TestGroup_Restore(t *testing.T) {
// one active alert with labels
ts = time.Now().Truncate(time.Hour)
fqr.Set("foo", metricWithValueAndLabels(t, 0, "__name__", "foo"))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo",env="dev"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo",env="dev"}`,
stateMetric("foo", ts, "env", "dev"))
f(
[]config.Rule{{Alert: "foo", Expr: "foo", Labels: map[string]string{"env": "dev"}, For: promutil.NewDuration(time.Second)}},
@@ -1015,7 +1015,7 @@ func TestGroup_Restore(t *testing.T) {
// one active alert with restore labels mismatch
ts = time.Now().Truncate(time.Hour)
fqr.Set("foo", metricWithValueAndLabels(t, 0, "__name__", "foo"))
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo",env="dev"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo",env="dev"}`,
stateMetric("foo", ts, "env", "dev", "team", "foo"))
f(
[]config.Rule{{Alert: "foo", Expr: "foo", Labels: map[string]string{"env": "dev"}, For: promutil.NewDuration(time.Second)}},
@@ -1029,7 +1029,7 @@ func TestGroup_Restore(t *testing.T) {
// two active alerts with dynamic labels and restore
ts = time.Now().Truncate(time.Hour)
fqr.Set(`default_rollup(ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}[3600s])`,
fqr.Set(`ALERTS_FOR_STATE{alertgroup="TestRestore",alertname="foo"}`,
stateMetric("foo", ts, "env", "dev"),
stateMetric("foo", ts.Add(time.Second), "env", "prod"))
fqr.Set("foo",
+13 -1
View File
@@ -415,9 +415,21 @@ func (g *Group) Start(ctx context.Context, rw remotewrite.RWClient, rr datasourc
var getRemoteReadQuerier func(enableDebug bool) datasource.Querier
if rr != nil {
getRemoteReadQuerier = func(enableDebug bool) datasource.Querier {
// restore query must look back for -remoteRead.lookback for both VictoriaMetrics and Prometheus.
// VictoriaMetrics uses `step` as the lookbehind window for instant queries, capped by `max_lookback`,
// while Prometheus uses `lookback_delta`.
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/11574
lookback := fmt.Sprintf("%ds", int(remoteReadLookBack.Seconds()))
params := url.Values{
"max_lookback": {lookback},
"lookback_delta": {lookback},
}
// custom group params are prior to default ones
maps.Copy(params, g.Params)
return rr.BuildWithParams(datasource.QuerierParams{
EvaluationInterval: g.Interval,
QueryParams: g.Params,
QueryStep: *remoteReadLookBack,
QueryParams: params,
Headers: g.Headers,
Debug: enableDebug,
})
+7
View File
@@ -118,6 +118,7 @@ func main() {
if len(listenAddrs) == 0 {
listenAddrs = []string{":8427"}
}
httpserver.CheckHealth(listenAddrs)
logger.Infof("starting vmauth at %q...", listenAddrs)
startTime := time.Now()
initAuthConfig()
@@ -981,9 +982,15 @@ func debugInfo(u *url.URL, r *http.Request) string {
// slowdownUnauthorizedResponse adds a random delay in the [2..3] seconds range before returning an unauthorized response.
// This reduces the effectiveness of brute-force.
//
// The delay is skipped if there are no users with static credentials (auth_token, bearer_token or username/password),
// since there is nothing to brute-force in this case.
//
// Recommended by OWASP Top10:
// https://owasp.org/Top10/2025/A07_2025-Authentication_Failures
func slowdownUnauthorizedResponse(r *http.Request) {
if au := authUsers.Load(); au == nil || len(*au) == 0 {
return
}
d := 2*time.Second + time.Duration(rand.IntN(1000))*time.Millisecond
t := timerpool.Get(d)
+3 -1
View File
@@ -53,6 +53,9 @@ func main() {
buildinfo.Init()
logger.Init()
listenAddrs := []string{*httpListenAddr}
httpserver.CheckHealth(listenAddrs)
ctx, cancel := context.WithCancel(context.Background())
go func() {
procutil.WaitForSigterm()
@@ -107,7 +110,6 @@ func main() {
}
}
listenAddrs := []string{*httpListenAddr}
go httpserver.Serve(listenAddrs, nil, httpserver.ServeOptions{})
pushmetrics.Init()
+1
View File
@@ -44,6 +44,7 @@ func main() {
logger.Init()
listenAddrs := []string{*httpListenAddr}
httpserver.CheckHealth(listenAddrs)
go httpserver.Serve(listenAddrs, nil, httpserver.ServeOptions{})
ctx, cancelFunc := context.WithCancel(context.Background())
-202
View File
@@ -1,202 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./vendor-CtnKy-8i.js","./rolldown-runtime-B0Z9INg1.js","./vendor-CnsZ1jie.css"])))=>i.map(i=>d[i]);
import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{A as n,B as r,C as i,D as a,E as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,_ as y,a as b,b as x,c as S,d as C,f as w,g as T,h as E,i as D,j as O,k,l as A,m as j,n as M,o as N,p as P,r as F,s as I,u as ee,v as L,w as te,x as ne,y as re,z as ie}from"./vendor-CtnKy-8i.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),f();var R=e(te(),1),ae=e(i(),1),oe=e(h(),1),se=e(ne(),1),ce=e(x(),1);R.default.extend(ae.default),R.default.extend(oe.default),R.default.extend(ce.default),R.default.extend(se.default);var z={home:`/`,metrics:`/metrics`,dashboards:`/dashboards`,cardinality:`/cardinality`,topQueries:`/top-queries`,trace:`/trace`,withTemplate:`/expand-with-exprs`,relabel:`/relabeling`,activeQueries:`/active-queries`,queryAnalyzer:`/query-analyzer`,icons:`/icons`,query:`/query`,rawQuery:`/raw-query`,downsamplingDebug:`/downsampling-filters-debug`,retentionDebug:`/retention-filters-debug`,rules:`/rules`,notifiers:`/notifiers`},le={header:{tenant:!0,stepControl:!0,timeSelector:!0}},ue={[z.home]:{title:`Query`,...le},[z.rawQuery]:{title:`Raw query`,header:{tenant:!0,stepControl:!1,timeSelector:!0}},[z.metrics]:{title:`Explore Prometheus metrics`,header:{tenant:!0,stepControl:!0,timeSelector:!0}},[z.cardinality]:{title:`Explore cardinality`,header:{tenant:!0,cardinalityDatePicker:!0}},[z.topQueries]:{title:`Top queries`,header:{tenant:!0}},[z.trace]:{title:`Trace analyzer`,header:{}},[z.queryAnalyzer]:{title:`Query analyzer`,header:{}},[z.dashboards]:{title:`Dashboards`,...le},[z.rules]:{title:`Rules`,header:{}},[z.notifiers]:{title:`Notifiers`,header:{}},[z.withTemplate]:{title:`WITH templates`,header:{}},[z.relabel]:{title:`Metric relabel debug`,header:{}},[z.activeQueries]:{title:`Active Queries`,header:{}},[z.icons]:{title:`Icons`,header:{}},[z.query]:{title:`Query`,...le},[z.downsamplingDebug]:{title:`Downsampling filters debug`,header:{}},[z.retentionDebug]:{title:`Retention filters debug`,header:{}}},de=()=>{let e=document.getElementById(`root`)?.dataset.params||`{}`;try{return JSON.parse(e)}catch(e){return console.error(e),{}}},fe=()=>!!Object.keys(de()).length,pe=`VMUI:`,me=[`AUTOCOMPLETE`,`NO_CACHE`,`QUERY_TRACING`,`SERIES_LIMITS`,`LEGEND_AUTO_COLLAPSE`,`TABLE_COMPACT`,`REDUCE_MEM_USAGE`,`TIMEZONE`,`DISABLED_DEFAULT_TIMEZONE`,`THEME`,`EXPLORE_METRICS_TIPS`,`METRICS_QUERY_HISTORY`,`SERVER_URL`,`POINTS_SHOW_ALL`],he=e=>`${pe}${e}`,B=(e,t,n=!0)=>{try{let r=n?he(e):e;t?window.localStorage.setItem(r,JSON.stringify({value:t})):window.localStorage.removeItem(r),window.dispatchEvent(new Event(`storage`))}catch(e){console.error(e)}},V=(e,t=!0)=>{let n=t?he(e):e,r=window.localStorage.getItem(n);if(r!==null)try{return JSON.parse(r)?.value}catch{return r}},ge=(e,t=!0)=>{(t?e.map(he):e).forEach(e=>{window.localStorage.removeItem(e),window.dispatchEvent(new StorageEvent(`storage`,{key:e}))})},_e=()=>{let e={migrated:[],removed:[],skipped:[]};for(let t of me){let n=t,r=V(n,!1),i=V(n,!0);if(r===void 0){e.skipped.push(n);continue}if(i!==void 0){ge([n],!1),e.removed.push(n);continue}B(n,r,!0),ge([n],!1),e.migrated.push(n)}return e},ve=e=>e.replace(/(\/(?:prometheus\/)?(?:graph|vmui)\/.*|\/#\/.*)/,`/prometheus`),ye=()=>{let{serverURL:e}=de(),t=V(`SERVER_URL`),n=ve(window.location.href);return e||t||n},be=function(e){return e.table=`table`,e.chart=`chart`,e.code=`code`,e}({}),xe=function(e){return e.emptyServer=`Please enter Server URL`,e.validServer=`Please provide a valid Server URL`,e.validQuery=`Please enter a valid Query and execute it`,e.traceNotFound=`Not found the tracing information`,e.emptyTitle=`Please enter title`,e.positiveNumber=`Please enter positive number`,e.validStep=`Please enter a valid step`,e.unknownType=`Unknown server response format: must have 'errorType'`,e}({}),Se=function(e){return e.system=`system`,e.light=`light`,e.dark=`dark`,e}({}),Ce=function(e){return e.empty=`empty`,e.metricsql=`metricsql`,e.label=`label`,e.labelValue=`labelValue`,e}({}),we=e=>getComputedStyle(document.documentElement).getPropertyValue(`--${e}`),Te=(e,t)=>{document.documentElement.style.setProperty(`--${e}`,t)},Ee=()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches,De=e=>e===Se.system&&Ee()||e===Se.dark,Oe=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`},kLine truncated
<path d="M24.5475 0C10.3246.0265251 1.11379 3.06365 4.40623 6.10077c0 0 12.32997 11.23333 16.58217 14.84083.8131.6896 2.1728 1.1936 3.5191 1.2201h.1199c1.3463-.0265 2.706-.5305 3.5191-1.2201 4.2522-3.5942 16.5422-14.84083 16.5422-14.84083C48.0478 3.06365 38.8636.0265251 24.6674 0"/>
<path d="M28.1579 27.0159c-.8131.6896-2.1728 1.1936-3.5191 1.2201h-.12c-1.3463-.0265-2.7059-.5305-3.519-1.2201-2.9725-2.5067-13.35639-11.87-17.26201-15.3979v5.4112c0 .5968.22661 1.3793.6265 1.7506C7.00358 21.1936 17.2675 30.5437 20.9731 33.6737c.8132.6896 2.1728 1.1936 3.5191 1.2201h.12c1.3463-.0265 2.7059-.5305 3.519-1.2201 3.679-3.13 13.9429-12.4536 16.6089-14.8939.4132-.3713.6265-1.1538.6265-1.7506V11.618c-3.9323 3.5411-14.3162 12.931-17.2354 15.3979h.0267Z"/>
<path d="M28.1579 39.748c-.8131.6897-2.1728 1.1937-3.5191 1.2202h-.12c-1.3463-.0265-2.7059-.5305-3.519-1.2202-2.9725-2.4933-13.35639-11.8567-17.26201-15.3978v5.4111c0 .5969.22661 1.3793.6265 1.7507C7.00358 33.9258 17.2675 43.2759 20.9731 46.4058c.8132.6897 2.1728 1.1937 3.5191 1.2202h.12c1.3463-.0265 2.7059-.5305 3.519-1.2202 3.679-3.1299 13.9429-12.4535 16.6089-14.8938.4132-.3714.6265-1.1538.6265-1.7507v-5.4111c-3.9323 3.5411-14.3162 12.931-17.2354 15.3978h.0267Z"/>
</svg>
`,ma=(e=`#020202`)=>{let t=new DOMParser().parseFromString(pa,`image/svg+xml`).documentElement;if(t.localName!==`svg`)throw Error(`Invalid favicon SVG`);t.setAttribute(`fill`,e);let n=new XMLSerializer().serializeToString(t);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`},ha=(e=`#020202`)=>{let t=document.querySelector(`#favicon`);t&&(t.href=ma(e));let n=document.querySelector(`#mask-icon`);n&&n.setAttribute(`color`,e)},ga=()=>window.location.pathname.replace(/\/+$/,``)||`/`;f();var _a=`FAVICON_COLOR:${ga()}`,va=()=>V(_a),ya=()=>{let[e,t]=d(va),n=()=>{t(va())};return p(()=>{n()},[]),p(()=>{ha(e)},[e]),q(`storage`,n),{faviconColor:e,changeFaviconColor:e=>{e?B(_a,e):ge([_a])}}},ba=[`#A1A1AA`,`#71717A`,`#020202`,`#E94600`,`#FF7A00`,`#F2B705`,`#84CC16`,`#16B86A`,`#00AFAF`,`#2979FF`,`#8B5CF6`,`#E83E9A`];f();var xa=()=>{let{faviconColor:e,changeFaviconColor:t}=ya(),n=u(()=>ma(e),[e]),r=e=>()=>{t(e)};return A(`div`,{className:`vm-browser-tab-controller`,children:[A(`p`,{className:`vm-server-configurator__title`,children:`Favicon color`}),A(`div`,{className:`vm-browser-tab-controller-palette`,children:[A(`div`,{className:`vm-browser-tab-controller-palette-list`,children:[A(`button`,{className:`vm-browser-tab-controller-palette-list__item vm-browser-tab-controller-palette-list__item_reset`,type:`button`,onClick:r(),"aria-label":`Reset favicon color`,children:A(_n,{})}),ba.map(t=>A(`button`,{className:(0,K.default)({"vm-browser-tab-controller-palette-list__item":!0,"vm-browser-tab-controller-palette-list__item_selected":e===t}),type:`button`,style:{color:t},onClick:r(t),"aria-label":`Set favicon color to ${t}`,"aria-pressed":e===t},t))]}),A(`img`,{className:`vm-browser-tab-controller-palette__preview`,src:n,alt:`Favicon preview`})]})]})},Sa=({value:e=!1,disabled:t=!1,label:n,color:r=`secondary`,fullWidth:i,onChange:a})=>{let o=()=>{t||a(!e)},s=(0,K.default)({"vm-switch":!0,"vm-switch_full-width":i,"vm-switch_disabled":t,"vm-switch_active":e,[`vm-switch_${r}_active`]:e,[`vm-switch_${r}`]:r});return A(`div`,{className:s,onClick:o,children:[A(`div`,{className:`vm-switch-track`,children:A(`div`,{className:`vm-switch-track__thumb`})}),n&&A(`span`,{className:`vm-switch__label`,children:n})]})};f();var Ca=()=>{let e=V(`LEGEND_AUTO_COLLAPSE`),[t,n]=d(!e||e===`true`);return p(()=>{B(`LEGEND_AUTO_COLLAPSE`,`${t}`)},[t]),A(`div`,{className:`vm-legend-collapse-controller`,children:[A(Sa,{fullWidth:!0,color:`neutral`,value:t,onChange:n,label:A(`span`,{className:`vm-server-configurator__title`,children:`Auto-collapse legend`})}),A(`span`,{className:`vm-legend-collapse-controller__description`,children:[`Collapses the legend when series count exceeds `,100,` to reduce UI load.`]})]})};f(),s();var wa=`Settings`,Ta=o((e,t)=>{let{isMobile:i}=J(),a=fe(),o=n(null),s=n(null),{value:c,setTrue:l,setFalse:u}=Q(!1),d=()=>{o.current&&o.current.handleApply(),s.current&&s.current.handleApply(),u()},f=[{show:!a,component:A(ea,{ref:o,onClose:u})},{show:!0,component:A(ca,{})},{show:!0,component:A(na,{ref:s,onClose:u})},{show:!0,component:A(Ca,{})},{show:!a,component:A(fa,{})},{show:!0,component:A(xa,{})}].filter(e=>e.show);return O(t,()=>({open:l})),A(r,{children:[i?A(`div`,{className:`vm-mobile-option`,onClick:l,children:[A(`span`,{className:`vm-mobile-option__icon`,children:A(gn,{})}),A(`div`,{className:`vm-mobile-option-text`,children:A(`span`,{className:`vm-mobile-option-text__label`,children:wa})}),A(`span`,{className:`vm-mobile-option__arrow`,children:A(G,{})})]}):A(Z,{title:wa,children:A(X,{className:(0,K.default)({"vm-header-button":!a}),variant:`contained`,color:`primary`,startIcon:A(gn,{}),onClick:l,ariaLabel:`settings`})}),c&&A(ui,{title:wa,onClose:u,children:A(`div`,{className:(0,K.default)({"vm-server-configurator":!0,"vm-server-configurator_mobile":i}),children:[f.map((e,t)=>A(`div`,{className:`vm-server-configurator__input`,children:e.component},t)),A(`div`,{className:`vm-server-configurator-footer`,children:[A(X,{color:`error`,variant:`outlined`,onClick:u,children:`Cancel`}),A(X,{color:`primary`,variant:`contained`,onClick:d,children:`Apply`})]})]})})]})});f();var Ea=({onOpenSettings:e})=>{let{isMobile:t}=J(),{timezone:n}=W(),r=u(()=>jt(n),[n]),i=()=>{e&&e()};return t?A(`button`,{className:`vm-mobile-option`,onClick:i,children:[A(`span`,{className:`vm-mobile-option__icon`,children:A(fr,{})}),A(`div`,{className:`vm-mobile-option-text`,children:[A(`span`,{className:`vm-mobile-option-text__label`,children:`Time zone`}),A(`span`,{className:`vm-mobile-option-text__value`,children:r})]}),A(`span`,{className:`vm-mobile-option__arrow`,children:A(G,{})})]}):A(X,{className:`vm-header-button`,onClick:i,startIcon:A(fr,{}),children:r})};f();var Da=({displaySidebar:e,isMobile:t,headerSetup:r,accountIds:i})=>{let a=n(null);return A(`div`,{className:(0,K.default)({"vm-header-controls":!0,"vm-header-controls_mobile":t}),children:[r?.tenant&&A(Pi,{accountIds:i||[]}),r?.stepControl&&A(Li,{}),r?.timeSelector&&A(Xi,{onOpenSettings:( Line truncated
This query hasn't selected any time series from database.
Either the requested metrics are missing in the database,
or there is a typo in series selector.`,Ra=`The shown results are marked as PARTIAL.
The result is marked as partial if one or more storage nodes failed to respond to the query.`;f();var za=e(b(),1),Ba=({value:e,onChange:t,onEnter:r,onArrowUp:i,onArrowDown:a,autocomplete:o,autocompleteEl:s,error:c,stats:l,label:u,disabled:f=!1,includeFunctions:m=!0})=>{let{autocompleteQuick:h}=rn(),{isMobile:g}=J(),[_,v]=d(!1),[y,b]=d([0,0]),[x,S]=d([0,0]),C=n(null),[w,T]=d(!1),E=n((0,za.default)(T,500)).current,D=[{show:l?.seriesFetched===`0`&&!l.resultLength,text:La},{show:l?.isPartial,text:Ra}].filter(e=>e.show).map(e=>e.text).join(``);return l&&(u=`${u} (${l.executionTimeMsec||0}ms)`),p(()=>{v(!!s&&h)},[h]),p(()=>{T(!1),E(y.every(Boolean))},[y]),A(`div`,{className:`vm-query-editor`,ref:C,children:[A($,{value:e,label:u,type:`textarea`,autofocus:!g,error:c,warning:D,onKeyDown:e=>{let{key:t,ctrlKey:n,metaKey:o,shiftKey:s}=e,c=(e.target.value||``).split(`
`).length>1,l=n||o,u=t===`ArrowUp`,d=t===`ArrowDown`,f=t===`Enter`;u&&l&&(e.preventDefault(),i()),d&&l&&(e.preventDefault(),a()),f&&_&&e.preventDefault(),f&&!s&&(!c||l)&&!_&&(e.preventDefault(),r())},onChange:t,onChangeCaret:e=>{b(t=>t[0]===e[0]&&t[1]===e[1]?t:e)},disabled:f,inputmode:`search`,caretPosition:x}),w&&o&&s&&A(s,{value:e,anchorEl:C,caretPosition:y,hasHelperText:!!(D||c),includeFunctions:m,onSelect:(e,n)=>{t(e),S([n,n])},onFoundOptions:e=>{v(!!e.length)}})]})};f(),s();var Va=({isMobile:e,hideButtons:t})=>{let{autocomplete:n}=rn(),i=an(),{nocache:a,isTracingEnabled:o,reduceMemUsage:s}=Dr(),c=Or(),l=()=>{c({type:`TOGGLE_NO_CACHE`})},u=()=>{c({type:`TOGGLE_REDUCE_MEM_USAGE`})},d=()=>{c({type:`TOGGLE_QUERY_TRACING`})},f=()=>{i({type:`TOGGLE_AUTOCOMPLETE`})},p=()=>{i({type:`SET_AUTOCOMPLETE_QUICK`,payload:!0})};return q(`keydown`,e=>{let{code:t,ctrlKey:n,altKey:r}=e;t===`Space`&&(n||r)&&(e.preventDefault(),p())}),A(`div`,{className:(0,K.default)({"vm-additional-settings":!0,"vm-additional-settings_mobile":e}),children:[!t?.autocomplete&&A(Z,{title:A(r,{children:[`Quick tip: `,_i]}),children:A(Sa,{label:`Autocomplete`,value:n,onChange:f,fullWidth:e})}),!t?.disableCache&&A(Sa,{label:`Disable cache`,value:a,onChange:l,fullWidth:e}),!t?.reduceMemUsage&&A(Sa,{label:`Disable deduplication`,value:s,onChange:u,fullWidth:e}),!t?.traceQuery&&A(Sa,{label:`Trace query`,value:o,onChange:d,fullWidth:e})]})},Ha=e=>{let{isMobile:t}=J(),i=n(null),{value:a,toggle:o,setFalse:s}=Q(!1);return t?A(r,{children:[A(`div`,{ref:i,children:A(X,{variant:`outlined`,startIcon:A(Xn,{}),onClick:o,ariaLabel:`additional the query settings`})}),A(ii,{open:a,buttonRef:i,placement:`bottom-left`,onClose:s,title:`Query settings`,children:A(Va,{isMobile:t,...e})})]}):A(Va,{...e})},Ua=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Wa=()=>{let{serverUrl:e}=H();return async t=>{try{let n=`${e}/prettify-query?query=${encodeURIComponent(t)}`,r=await fetch(n);if(r.status!=200)return{query:t,error:`Error requesting /prettify-query, status: `+r.status};let i=await r.json();return i.status==`success`?{query:String(i.query),error:``}:{query:t,error:String(i.msg)}}catch(e){return console.error(e),e instanceof Error&&e.name!==`AbortError`?{query:t,error:`${e.name}: ${e.message}`}:{query:t,error:String(e)}}}},Ga=()=>{let{showInfoMessage:e}=Jr();return async(t,n)=>{if(!navigator?.clipboard)return e({text:A(Ka,{}),type:`error`,timeout:2e4}),!1;try{return await navigator.clipboard.writeText(t),n&&e({text:n,type:`success`}),!0}catch(t){return t instanceof Error&&e({text:`${t.name}: ${t.message}`,type:`error`}),console.warn(`Copy failed`,t),!1}}},Ka=()=>A(`div`,{className:`vm-snackbar-details`,children:[A(`p`,{className:`vm-snackbar-details__title`,children:`Clipboard not supported`}),window.isSecureContext?A(`p`,{className:`vm-snackbar-details__msg`,children:[A(`p`,{children:`Common reasons:`}),A(`ul`,{children:[A(`li`,{children:`Browser restrictions`}),A(`li`,{children:`Insecure connection (HTTP)`}),A(`li`,{children:`Permissions not granted`})]}),A(`p`,{children:[`For detailed information, visit the `,A(`a`,{className:`vm-link vm-link_underlined vm-link_colored`,href:`https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API#security_considerations`,target:`_blank`,rel:`noopener noreferrer`,children:`Clipboard API documentation`})]})]}):A(`p`,{className:`vm-snackbar-details__msg`,children:[A(`p`,{children:`This page is not running in a secure context (HTTPS).`}),A(`p`,{children:`Clipboard operations require a secure context.`}),A(`a`,{className:`vm-link vm-link_underlined vm-link_colored`,href:`https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts`,target:`_blank`,rel:`noopener noreferrer`,children:`Learn more about secure contexts`})]})]});f();var qa=({query:e,favorites:t,onRun:n,onToggleFavorite:r})=>{let i=Ga(),a=u(()=>t.includes(e),[e,t]);return A(`div`,{className:`vm-query-history-item`,children:[A(`span`,{className:`vm-query-history-item__value`,children:e}),A(`div`,{className:`vm-query-history-item__buttons`,children:[A(Z,{title:`Execute query`,children:A(X,{size:`small`,variant:`text`,onClick:()=>{n(e)},startIcon:A(jn,{})})}),A(Z,{title:`Copy query`,children:A(X,{size:`small`,variant:`text`,onClick:async()=>{await i(e,`Query has been copied`)},startIcon:A(Hn,{})})}),A(Z,{title:a?`Remove Favorite`:`Add to Favorites`,children:A(X,{size:`small`,variant:`text`,color:a?`warning`:`primary`,onClick:()=>{r(e,a)},startIcon:A(a?er:$n,{})})})]})]})};f(),s();var Ja={session:`session`,storage:`saved`,favorite:`favorite`},Ya=[{label:`Session history`,value:Ja.session},{label:`Saved history`,value:Ja.storage},{label:`Favorite queries`,value:Ja.favorite}],Xa=({handleSelectQuery:e,historyKey:t})=>{let{queryHistory:n}=rn(),{isMobile:i}=J(),{value:a,setTrue:o,setFalse:s}=Q(!1),[c,l]=d(Ya[0].value),[f,m]=d(Kt(t,`QUERY_HISTORY`)),[h,g]=d(Kt(t,`QUERY_FAVORITES`)),_=u(()=>n.map(e=>e.values.filter(e=>e).reverse()),[n]),v=u(()=>{switch(c){case Ja Line truncated
To see your favorites, mark a query as a favorite.`;default:return`Query history is empty.
To see the history, please make a query.`}},[c]),x=t=>n=>{e(n,t),s()},S=(e,t)=>{g(n=>{let r=n[0]||[];return t?[r.filter(t=>t!==e)]:!t&&!r.includes(e)?[[...r,e]]:n})};return p(()=>{Ua(h[0]||[],Kt(t,`QUERY_FAVORITES`)[0]||[])||Jt(t,h)},[h]),q(`storage`,()=>{m(Kt(t,`QUERY_HISTORY`)),g(Kt(t,`QUERY_FAVORITES`))}),A(r,{children:[A(Z,{title:`Show history`,children:A(X,{color:`primary`,variant:`text`,onClick:o,startIcon:A(En,{}),ariaLabel:`Show history`})}),a&&A(ui,{title:`Query history`,onClose:s,children:A(`div`,{className:(0,K.default)({"vm-query-history":!0,"vm-query-history_mobile":i}),children:[A(`div`,{className:(0,K.default)({"vm-query-history__tabs":!0,"vm-section-header__tabs":!0,"vm-query-history__tabs_mobile":i}),children:A(yr,{activeItem:c,items:Ya,onChange:l})}),A(`div`,{className:`vm-query-history-list`,children:[y&&A(`div`,{className:`vm-query-history-list__no-data`,children:b}),v.map((e,t)=>A(`div`,{children:[v.length>1&&A(`div`,{className:(0,K.default)({"vm-query-history-list__group-title":!0,"vm-query-history-list__group-title_first":t===0}),children:[`Query `,t+1]}),e.map((e,n)=>A(qa,{query:e,favorites:h.flat(),onRun:x(t),onToggleFavorite:S},n))]},t)),c===Ja.storage&&!y&&A(`div`,{className:`vm-query-history-footer`,children:A(X,{color:`error`,variant:`outlined`,size:`small`,startIcon:A(Fn,{}),onClick:()=>{Yt(t,`QUERY_HISTORY`)},children:`clear history`})})]})]})})]})},Za={USE_PROFILES:{html:!0},FORBID_TAGS:[`style`]},Qa=new Set([`color`,`background-color`,`font-family`,`font-size`,`font-style`,`font-weight`,`font-variant`,`font-stretch`,`line-height`,`letter-spacing`,`word-spacing`,`text-align`,`text-decoration`,`text-decoration-color`,`text-decoration-line`,`text-decoration-style`,`text-transform`,`text-shadow`,`white-space`,`word-break`,`overflow-wrap`,`text-overflow`,`vertical-align`]);D.addHook(`uponSanitizeAttribute`,(e,t)=>{if(t.attrName.toLowerCase()!==`style`)return;let n=e.ownerDocument.createElement(`span`).style;n.cssText=t.attrValue;for(let e=n.length-1;e>=0;e--){let t=n.item(e).toLowerCase();Qa.has(t)||n.removeProperty(t)}t.attrValue=n.cssText,t.keepAttr=n.length>0});var $a=e=>D.sanitize(e,Za),eo=e=>$a(F.parse(e));f();var to=({value:e,tagName:t=`div`,format:n=`html`,className:r})=>{let i=u(()=>n===`markdown`?eo(e):$a(e),[n,e]);return A(t,{className:r,dangerouslySetInnerHTML:{__html:i}})};f(),s();var no=({value:e,itemClassName:t,options:i,anchor:a,disabled:o,minLength:s=2,fullWidth:l,selected:f,noOptionsText:m,label:h,disabledFullScreen:g,offset:_,maxDisplayResults:v,loading:y,onSelect:b,onOpenAutocomplete:x,onFoundOptions:S,onChangeWrapperRef:C})=>{let{isMobile:w}=J(),T=n(null),[E,D]=d({index:-1}),[O,k]=d(``),[j,M]=d(0),{value:N,setValue:P,setFalse:F}=Q(!1),I=u(()=>{if(!N)return[];try{let t=new RegExp(String(e.trim()),`i`),n=i.filter(e=>t.test(e.value)).sort((n,r)=>n.value.toLowerCase()===e.trim().toLowerCase()?-1:r.value.toLowerCase()===e.trim().toLowerCase()?1:(n.value.match(t)?.index||0)-(r.value.match(t)?.index||0));return M(n.length),k(n.length>Number(v?.limit)&&v?.message||``),v?.limit?n.slice(0,v.limit):n}catch{return[]}},[N,i,e]),ee=u(()=>I.length===1&&I[0]?.value===e,[I]),L=u(()=>m&&!I.length,[m,I]),te=e=>()=>{o||(b(e.value,e),f||F())},ne=e=>()=>{D({index:e,type:0})},re=()=>{D({index:-1})},ie=()=>{if(!T.current||E.type===0)return;let e=T.current.childNodes[E.index];e?.scrollIntoView&&e.scrollIntoView({block:`center`})},R=c(e=>{let{key:t,ctrlKey:n,metaKey:r,shiftKey:i}=e,a=n||r||i,o=I.length&&!ee;if(t===`ArrowUp`&&!a&&o&&(e.preventDefault(),D(({index:e})=>({index:e<=0?0:e-1,type:1}))),t===`ArrowDown`&&!a&&o){e.preventDefault();let t=I.length-1;D(({index:e})=>({index:e>=t?t:e+1,type:1}))}if(t===`Enter`){let e=I[E.index];e&&b(e.value,e),f||F()}t===`Escape`&&F()},[E,I,ee,F,b,f]);return p(()=>{P(e.length>=s)},[e,i]),q(`keydown`,R),p(ie,[E,I]),p(()=>{D({index:-1})},[I]),p(()=>{x&&x(N)},[N]),p(()=>{S&&S(ee?[]:I)},[I,ee]),p(()=>{C&&C(T)},[T]),A(ii,{open:N,buttonRef:a,placement:`bottom-left`,onClose:F,fullWidth:l,title:w?h:void 0,disabledFullScreen:g,offset:_,children:[A(`div`,{className:(0,K.default)({"vm-autocomplete":!0,"vm-autocomplete_mobile":w&&!g}),ref:T,children:[y&&A(`div`,{className:`vm-autocomplete__loader`,children:[A(wn,{}),A(`span`,{children:`Loading...`})]}),L&&A(`div`,{className:`vm-autocomplete__no-options`,children:m}),!ee&&I.map((e,n)=>A(`div`,{className:(0,K.default)({"vm-list-item":!0,"vm-list-item_mobile":w,"vm-list-item_active":n===E.index,"vm-list-item_multiselect":f,"vm-list-item_multiselect_selected":f?.includes(e.value),"vm-list-item_with-icon":e.icon}),id:`$autocomplete$${e.value}`,onClick:te(e),onMouseEnter:ne(n),onMouseLeave:re,children:[f?.includes(e.value)&&A(Rn,{}),A(r,{children:e.icon}),A(`div`,{className:`vm-list-item-inner ${t} ${e.value.toLowerCase().replace(` `,`-`)}`,children:A(`span`,{children:e.value})})]},`${n}${e.value}`))]}),O&&A(`div`,{className:`vm-autocomplete-message`,children:[`Shown `,v?.limit,` results out of `,j,`. `,O]}),I[E.inde Line truncated
`)),icon:A(nr,{})}),vo=e=>{let t=``;return Array.from(e).map(e=>{let n=e.tagName.toLowerCase()===lo;return t=n?e.textContent??``:t,n?null:_o(t,e)}).filter(Boolean)},yo=e=>{let{metricsQLFunctions:t}=rn(),n=an(),r=e=>{let t=document.createElement(`div`);return t.innerHTML=eo(e),vo(t.querySelectorAll(`${lo}, ${uo}`))};return p(()=>{e&&!t.length&&(async()=>{try{let e=await(await fetch(co)).text(),t=r(e);n({type:`SET_METRICSQL_FUNCTIONS`,payload:t})}catch(e){console.error(`Error fetching or processing the MetricsQL.md file:`,e)}})()},[e,t.length,n]),t};function bo(e){let t=e.split(/\s(or|and|unless|default|ifnot|if|group_left|group_right)\s|}|\+|\|-|\*|\/|\^/i),n=t[t.length-1].trim(),r=n.match(/.*\(([^)]*)$/);if(r&&r[1]){let e=r[1];if(e.lastIndexOf(`{`)>e.lastIndexOf(`}`)){let t=e.match(/([\w_.:]+)\{[^}]*$/);return t?t[0]:n}let t=e.lastIndexOf(`,`);return t===-1?e:e.substring(t+1).trim()}return n}function xo(e){let t=e.match(/([\w_.:]+(?![},]))$/);return t?t[0]:``}function So(e){let t=/([{(),+\-*/^]|\b(?:or|and|unless|default|ifnot|if|group_left|group_right|by|without|on|ignoring)\b)/i,n=e.split(/\s+/),r=n.length,i=n[r-1],a=n[r-2],o=!i&&ao(e),s=(!i||n.length>1)&&!t.test(a);return o||s}function Co(e,t=``,n=``){let r=e.trim(),i=[`}`,`)`].some(e=>r.endsWith(e)),a=!ao(r)&&["`",`'`,`"`].some(e=>r.endsWith(e));if(!r||i||a||So(r))return Ce.empty;let o=/(?:by|without|on|ignoring)\s*\(\s*[^)]*$|\{[^}]*$/i,s=`(${ro(t)})?{?.+${ro(n)}(=|!=|=~|!~)"?([^"]*)$`,c=new RegExp(s,`g`);switch(!0){case c.test(r):return Ce.labelValue;case o.test(r):return Ce.label;default:return Ce.metricsql}}var wo=(e,t)=>t[0]===t[1]?{beforeCursor:e.substring(0,t[0]),afterCursor:e.substring(t[1])}:{beforeCursor:e,afterCursor:``},To=e=>{let t=[...e.matchAll(/\w+\((?<metricName>[^)]+)\)\s+(by|without|on|ignoring)\s*\(\w*/gi)];return t[0]?.groups?.metricName?t[0].groups.metricName:[...e.matchAll(/^\s*\b(?<metricName>[^{}(),\s]+)(?={|$)/g)][0]?.groups?.metricName||``},Eo=e=>{let t=e.match(/[a-z_:-][\w\-.:/]*\b(?=\s*(=|!=|=~|!~))/g);return t?t[t.length-1]:``},Do=(e,t)=>{let n=[...e.matchAll(/([a-z_:-][\w\-.:/]*)\s*(?:=|!=|=~|!~)\s*"[^"]*"/g)];return t?n.filter(e=>e[1]!==t).map(e=>e[0]):n.map(e=>e[0])},Oo=(e,t,n=!0)=>{let{__name__:r,...i}=e.metric,a=n?`[Query ${e.group}] `:``;if(t)return ko(e.metric,t);let o=`${a}${r||``}`;return Object.keys(i).length===0?o||`value`:`${o}{${Object.entries(i).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(`, `)}}`},ko=(e,t)=>t.replace(/\{\{(\w+)}}/g,(t,n)=>e[n]||``),Ao=e=>{switch(e){case`NaN`:return NaN;case`Inf`:case`+Inf`:return 1/0;case`-Inf`:return-1/0;default:return parseFloat(e)}},jo=e=>{if(e.length<2)return!1;let t=[`le`,`vmrange`],n=Object.keys(e[0].metric).filter(e=>!t.includes(e));return e.every(r=>{let i=Object.keys(r.metric).filter(e=>!t.includes(e));return n.length===i.length&&i.every(t=>r.metric[t]===e[0].metric[t])})&&e.every(e=>t.some(t=>t in e.metric))},Mo=e=>e.replace(/([\\./-])/g,`\\$1`);f(),s();var No=({value:e,anchorEl:t,caretPosition:n,hasHelperText:i,includeFunctions:a,onSelect:o,onFoundOptions:s})=>{let[l,f]=d({top:0,left:0}),m=yo(a),h=u(()=>wo(e,n),[e,n]),g=u(()=>bo(h.beforeCursor),[h.beforeCursor]),_=u(()=>To(g),[g]),v=u(()=>Eo(g),[g]),y=u(()=>Co(h.beforeCursor,_,v),[h.beforeCursor,_,v]),b=u(()=>xo(h.beforeCursor),[h.beforeCursor]),{metrics:x,labels:S,labelValues:C,loading:w}=so({valueByContext:b,metric:_,label:v,context:y,labelMatchers:u(()=>Do(h.beforeCursor,v),[h.beforeCursor,v])}),T=u(()=>{switch(y){case Ce.metricsql:return a?[...x,...m]:x;case Ce.label:return S;case Ce.labelValue:return C;default:return[]}},[y,x,S,C,m,a]),E=c(e=>{let t=h.beforeCursor,r=h.afterCursor,i=t.lastIndexOf(b,n[0]),a=i+b.length,s=t.substring(0,i),c=t.substring(a);if(y===Ce.labelValue){r=r.replace(/^[^\s"|},]*/,``);let t=/(?:=|!=|=~|!~)$/.test(s),n=r.trim()[0]!==`"`;e=`${t?`"`:``}${e}${n?`"`:``}`}y===Ce.label&&(e=Mo(e),r=r.replace(/^[^\s=!,{}()"|+\-/*^]*/,``)),y===Ce.metricsql&&(r=r.replace(/^[^\s[\]{}()"|+\-/*^]*/,``)),o(`${s}${e}${c}${r}`,s.length+e.length)},[h.beforeCursor,h.afterCursor,b,n,y,o]);return p(()=>{if(!t.current){f({top:0,left:0});return}let e=t.current.querySelector(`textarea`)||t.current,n=window.getComputedStyle(e),r=`${n.getPropertyValue(`font-size`)}`,a=`${n.getPropertyValue(`font-family`)}`,o=parseInt(`${n.getPropertyValue(`line-height`)}`),s=document.createElement(`div`);s.style.font=`${r} ${a}`,s.style.padding=n.getPropertyValue(`padding`),s.style.lineHeight=`${o}px`,s.style.width=`${e.offsetWidth}px`,s.style.maxWidth=`${e.offsetWidth}px`,s.style.whiteSpace=n.getPropertyValue(`white-space`),s.style.overflowWrap=n.getPropertyValue(`overflow-wrap`);let c=document.createElement(`span`);s.appendChild(document.createTextNode(h.beforeCursor)),s.appendChild(c),s.appendChild(document.createTextNode(h.afterCursor)),document.body.appendChild(s);let l=s.getBoundingClientRect(),u=c.getBoundingClientRect(),d=u.left-l.left,p=u.bottom-l.bottom-(i?o:0);f({top:p,left:d}),s.remove(),c.remove()},[t,n,i,h.beforeCursLine truncated
`);p.push(t),console.error(`Fetch query error: ${e}`,i)}m++}k(p),j(f);let _=u.length;N(_<h?`Showing ${_} series out of ${h} series due to performance reasons. Please narrow down the query, so it returns fewer series`:``),s?x(u):C(u),T(d),ee(e=>h?g:e)}catch(e){let t=e;if(t.name===`AbortError`){y(!1);return}let n=`Error executing query: ${t.message}. Please check your serverURL settings and confirm server availability.`;t.message===`Unexpected end of JSON input`&&(n+=`
Additionally, this error can occur if the server response is too large to process. Apply more specific filters to reduce the data volume.`),D(n)}y(!1)},300),[]),ne=u(()=>{let t=(e??o).filter(Boolean),i=(n||l)===be.chart;if(!s||!g||!Oe(g)||!t.length)return;let a={...s,step:r};return t.map(e=>i?Go(g,e,a,f,m):Ko(g,e,a,f,m))},[g,s,l,r,f,m,n,e,o]),re=c(()=>{P.forEach(e=>e.abort()),F([]),x([]),C([])},[P]),[ie,R]=d([]);return p(()=>{let r=ne===ie&&!!e;t&&ne?.length&&!r&&(y(!0),te({fetchUrl:ne,displayType:n||l,query:e??o,stateSeriesLimits:h,showAllSeries:a,hideQuery:i}),R(ne))},[ne,t,h,a]),p(()=>{let e=P.slice(0,-1);e.length&&(e.map(e=>e.abort()),F(e=>e.filter(e=>!e.signal.aborted)))},[P]),p(()=>{L===r&&x([])},[I]),p(()=>{D(``),k([]),j([]);let t=e??o;if(s){if(!g){D(xe.emptyServer);return}if(!Oe(g)){D(xe.validServer);return}t.every(e=>!e.trim())&&k(t.map(()=>xe.validQuery))}},[g,s,l,r,f,m,n,e,o]),{fetchUrl:ne,isLoading:v,graphData:b,liveData:S,error:E,queryErrors:O,setQueryErrors:k,queryStats:A,warning:M,traces:w,isHistogram:I,abortFetch:re}},ts=()=>A(`div`,{className:`vm-line-loader`,children:[A(`div`,{className:`vm-line-loader__background`}),A(`div`,{className:`vm-line-loader__line`})]});f();var ns=()=>{let{displayType:e}=Dr(),{query:t}=rn(),{duration:n,relativeTime:r,period:{date:i,step:a}}=W(),{customStep:o}=Nr(),[s,l]=L(),u=Ht(),f=Pr(),m=an(),h=Or(),[g,_]=d(!1),v=c(()=>{if(g){_(!1);return}let c=new URLSearchParams(s);t.forEach((t,l)=>{let u=`g${l}`;s.get(`${u}.expr`)!==t&&t&&c.set(`${u}.expr`,t),s.get(`${u}.range_input`)!==n&&c.set(`${u}.range_input`,n),s.get(`${u}.end_input`)!==i&&c.set(`${u}.end_input`,i),s.get(`${u}.relative_time`)!==r&&c.set(`${u}.relative_time`,r||`none`);let d=s.get(`expr.hide`)||``;d!==``&&c.set(`expr.hide`,d);let f=s.get(`${u}.step_input`)||a;f&&f!==o&&c.set(`${u}.step_input`,o);let p=`${br.find(t=>t.value===e)?.prometheusCode||0}`;s.get(`${u}.tab`)!==p&&c.set(`${u}.tab`,`${p}`)});let u=t.length-1;Array.from(c.keys()).forEach(e=>{let t=e.match(/^g(\d+)\./);t&&parseInt(t[1],10)>u&&c.delete(e)}),!Ae(c,s)&&c.size&&l(c)},[e,t,n,r,i,a,o]);p(()=>{let e=setTimeout(v,200);return()=>clearTimeout(e)},[v]),p(()=>{if(!g)return;let c=Rt(),l=c.duration!==n,d=c.relativeTime!==r,p=c.relativeTime===`none`&&c.period.date!==i;(l||d||p)&&u({type:`SET_TIME_STATE`,payload:c});let _=Sr();_!==e&&h({type:`SET_DISPLAY_TYPE`,payload:_});let v=qe();Ua(v,t)||(m({type:`SET_QUERY`,payload:v}),u({type:`RUN_QUERY`}));let y=setTimeout(()=>{let e=s.get(`g0.step_input`)||a;e&&e!==o&&f({type:`SET_CUSTOM_STEP`,payload:e})},50);return()=>clearTimeout(y)},[s,g]),q(`popstate`,()=>{_(!0)})},rs=A(Ii,{text:`last_over_time`,href:`https://docs.victoriametrics.com/victoriametrics/metricsql/#last_over_time`,underlined:!0}),is=A(Ii,{text:`instant query`,href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#instant-query`,underlined:!0}),as=()=>{let{customStep:e}=Nr();return A(`div`,{children:[A(`p`,{children:[`This tab shows `,is,` results for the last `,e||`5m`,` (defined by the `,A(`code`,{children:`step`}),`) ending at the selected time range.`]}),A(`p`,{children:[`Please wrap the query into `,rs,` if you need results over arbitrary lookbehind interval.`]})]})},os=({value:e,hideValue:t})=>A(`div`,{className:`vm-line-progress`,children:[A(`div`,{className:`vm-line-progress-track`,children:A(`div`,{className:`vm-line-progress-track__thumb`,style:{width:`${e}%`}})}),!t&&A(`span`,{children:[e.toFixed(2),`%`]})]});f();var ss=({isRoot:e,trace:t,totalMsec:r,isExpandedAll:i})=>{let{isDarkTheme:a}=H(),{isMobile:o}=J(),[s,c]=d({}),l=n(null),[u,f]=d(!1),[m,h]=d(!1),g=mt(t.duration/1e3)||`${t.duration}ms`;p(()=>{if(!l.current)return;let e=l.current,{height:t}=l.current.children[0].getBoundingClientRect();f(t>e.clientHeight)},[t]);let _=e=>{e.stopPropagation(),h(e=>!e)},v=t.children&&!!t.children.length,y=t.duration/r*100,b=e=>()=>{v&&c(t=>({...t,[e]:!t[e]}))},x=e=>{let t=[e.idValue];return e?.children?.forEach(e=>{t.push(...x(e))}),t};return p(()=>{if(!i){c([]);return}let e=x(t),n={};e.forEach(e=>{n[e]=!0}),c(n)},[i]),A(`div`,{className:(0,K.default)({"vm-nested-nav":!0,"vm-nested-nav_root":e,"vm-nested-nav_dark":a,"vm-nested-nav_mobile":o}),children:[A(`div`,{className:(0,K.default)({"vm-nested-nav-header":!0,"vm-nested-nav-header_open":s[t.idValue]}),onClick:b(t.idValue),children:[v&&A(`div`,{className:(0,K.default)({"vm-nested-nav-header__icon":!0,"vm-nested-nav-header__icon_open":s[t.idValue]}),children:A(G,{})}),A(`div`,{className:`vm-nested-nav-header__progress`,children:A(os,{value:y})}),A(`div`,{className:(0,K.default)({"vm-nested-nav-header__message":!0,"vm-nested-nav-header__message_show-full":m}),ref:l,children:[A(`span`,{className:`vm-nested-nav-header__message_duration`,children:g}),`:\xA0`,A(`span`,{children:t.message})]}),A(`div`,{className:`vm-nested-nav-header-bottom`,children:(u||m)&&A(X,{variant:`text`,size:`small`,onClick:_,children:m?`Hide`:`Show full query`})})]}),s[t.idValue]&&A(`div`,{className:`vm-nested Line truncated
{YYYY}`,null,null,null,null,null,1],[86400,`{MM}-{DD}`,`
{YYYY}`,null,null,null,null,null,1],[3600,`{HH}:{mm}`,`
{YYYY}-{MM}-{DD}`,null,`
{MM}-{DD}`,null,null,null,1],[60,`{HH}:{mm}`,`
{YYYY}-{MM}-{DD}`,null,`
{MM}-{DD}`,null,null,null,1],[1,`{HH}:{mm}:{ss}`,`
{YYYY}-{MM}-{DD}`,null,`
{MM}-{DD} {HH}:{mm}`,null,null,null,1],[.001,`:{ss}.{fff}`,`
{YYYY}-{MM}-{DD} {HH}:{mm}`,null,`
{MM}-{DD} {HH}:{mm}`,null,`
{HH}:{mm}`,null,1]],bs=(e,t)=>Array.from(new Set(e.map(e=>e.scale))).map(e=>{let n=`10px Arial`,r=we(`color-text`),i={scale:e,show:!0,size:Cs,stroke:r,font:n,values:(e,n)=>hs(e,n,t)};return e?!(Number(e)%2)&&e!==`y`?{...i,side:1}:i:{space:80,values:ys,stroke:r,font:n}}),xs=(e,t,n,r)=>{let i=rt(t.start),a=rt(t.end),o=_t(e)||.001,s=Math.max(.001,rt(o)),c=rt(r??i),l=(e,t)=>{let n=e%t;return n<0?n+t:n},u=rt(i+l(l(c,s)-l(i,s),s));if(u<i&&(u=rt(u+s)),u>a)return[i,a];let d=Math.floor((a-u)/s)+1,f=Math.max(1,Math.ceil(d/n)),p=Math.max(.001,rt(s*f)),m=Math.min(n,Math.floor((a-u)/p)+1),h=Array(m);for(let e=0;e<m;e++)h[e]=rt(u+e*p);return h},Ss=(e,t)=>{if(e==null||t==null)return[-1,1];let n=.02*(Math.abs(t-e)||Math.abs(e)||1);return[e-n,t+n]},Cs=(e,t,n,r)=>{let i=e.axes[n];if(r>1)return i._size||60;let a=6+(i?.ticks?.size||0)+(i.gap||0),o=(t??[]).reduce((e,t)=>t?.length>e.length?t:e,``);return o!=``&&(a+=_s(o,`10px Arial`)),Math.ceil(a)},ws=[`#e6194b`,`#4363d8`,`#3cb44b`,`#911eb4`,`#f58231`,`#f032e6`,`#c8a200`,`#a65628`,`#42d4f4`,`#a9a9a9`],Ts=e=>{let t=e.replace(`#`,``).trim();if(t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),t.length!==6)throw Error(`Invalid HEX color.`);let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return(n*299+r*587+i*114)/1e3>=128?`#000000`:`#FFFFFF`},Es=(e,t,n)=>{let r=[];for(let i=0;i<n;i++){let a=i/(n-1),o=e[0]+(t[0]-e[0])*a,s=e[1]+(t[1]-e[1])*a,c=e[2]+(t[2]-e[2])*a;r.push([o,s,c].map(e=>Math.round(e)).join(`, `))}return r.map(e=>`rgb(${e})`)},Ds=(e,t,n)=>Math.min(n,Math.max(t,e)),Os=e=>{let t=e.replace(`#`,``).trim();if(t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),!/^[0-9a-fA-F]{6}$/.test(t))throw Error(`Invalid HEX color.`);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},ks=(e,t,n)=>`#${[e,t,n].map(e=>Ds(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``)}`,As=(e,t,n)=>{e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2,o=r-i,s=0,c=0;if(o!==0){switch(c=o/(1-Math.abs(2*a-1)),r){case e:s=(t-n)/o%6;break;case t:s=(n-e)/o+2;break;case n:s=(e-t)/o+4}s*=60,s<0&&(s+=360)}return{h:s,s:c*100,l:a*100}},js=(e,t,n)=>{t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o,s,c;return e<60?[o,s,c]=[r,i,0]:e<120?[o,s,c]=[i,r,0]:e<180?[o,s,c]=[0,r,i]:e<240?[o,s,c]=[0,i,r]:e<300?[o,s,c]=[i,0,r]:[o,s,c]=[r,0,i],{r:(o+a)*255,g:(s+a)*255,b:(c+a)*255}},Ms=(e,t)=>{let{r:n,g:r,b:i}=Os(e),{h:a,s:o,l:s}=As(n,r,i),c=[{ds:0,dl:0},{ds:-20,dl:-16},{ds:-16,dl:16},{ds:14,dl:-20}],l=c[t%c.length],u=js(a,Ds(o+l.ds,35,85),Ds(s+l.dl,35,70));return ks(u.r,u.g,u.b)},Ns=e=>{let t=ws.length,n=e%t,r=Math.floor(e/t),i=ws[(n+r)%t];return Ms(i,r)},Ps=Es([246,226,219],[127,39,4],16),Fs=(e,t)=>{let n=e.data[t][2],r=Ps,i=1/0,a=-1/0;for(let e=0;e<n.length;e++)n[e]>0&&(i=Math.min(i,n[e]),a=Math.max(a,n[e]));if(!isFinite(i)||!isFinite(a))return n.map(()=>-1);let o=a-i;if(o===0)return n.map(e=>e>0?0:-1);let s=r.length,c=Array(n.length);for(let e=0;e<n.length;e++)c[e]=n[e]===0?-1:Math.min(s-1,Math.floor(s*(n[e]-i)/o));return c},Is=()=>(e,t)=>{let n=Math.round(devicePixelRatio);M.orient(e,t,(r,i,a,o,s,c,l,u,d,f,p,m,h,g)=>{let[_,v,y]=e.data[t],b=_.length,x=Fs(e,t),S=Ps??[...Array.from(new Set(x))],C=S.map(()=>new Path2D),w=b-v.lastIndexOf(v[0]),T=b/w,E=v[1]-v[0],D=c(_[w]-_[0],o,f,u)-c(0,o,f,u)-n,O=l(E,s,p,d)-l(0,s,p,d)+n,k=v.slice(0,w).map(e=>Math.round(l(e,s,p,d)-O/2)),A=Array.from({length:T},(e,t)=>Math.round(c(_[t*w],o,f,u)-D));for(let e=0;e<b;e++)if(y[e]>0&&_[e]>=(o.min||-1/0)&&_[e]<=(o.max||1/0)&&v[e]>=(s.min||-1/0)&&v[e]<=(s.max||1/0)){let t=A[~~(e/w)],n=k[e%w],r=C[x[e]];g(r,t,n,D,O)}e.ctx.save(),e.ctx.rect(e.bbox.left,e.bbox.top,e.bbox.width,e.bbox.height),e.ctx.clip(),C.forEach((t,n)=>{e.ctx.fillStyle=S[n],e.ctx.fill(t)}),e.ctx.restore()})},Ls=e=>{if(!e.every(e=>e.metric.le))return e;let t=e.sort((e,t)=>parseFloat(e.metric.le)-parseFloat(t.metric.le)),n=e[0]?.group||1,r={metric:{le:``},values:[],group:n},i=[];for(let e of t){let t=[r.metric.le,e.metric.le].filter(e=>e).join(`...`),a=[];for(let[t,n]of e.values){let e=r.values.find(e=>e[0]===t)?.[1]||0,i=+n-e;a.push([t,`${i}`])}i.push({metric:{vmrange:t},values:a,group:n}),r=e}return i},Rs=e=>{let t=(e.metric.vmrange||e.metric.le||``).split(`...`);return Ao(t[t.length-1])},zs=(e,t)=>Rs(e)-Rs(t),Bs=(e,t)=>{if(!t)return e;let n=Ls(e.sort(zs)),r={};n.forEach(e=>e.values.forEach(([e,t])=>{let n=Number(t),i=isNaN(n)?0:n,a=r[e]||0;r[e]=a+i}));let i=n.map(e=>{let t=e.values.map(([e,t])=>{let n=r[e];return[e,`${Math.round(+t/n*100)}`]});return{...e,values:t}}),a=i.map((e,t)=>e.values.every(e=>e[1]===`0`)?-1:t).filter(e=>e!==-1),o=a.length;if(o===0||i.length<=3)return i;if(o>1)return i.filter((e,t)=>a.includes(t));let s=a[0],c=new Set([s]);return s-1>=0&&c.add(s-1),s+1<i.length&&c.add(s+1),i.filter((e,t)=>c.has(t))},Vs=e=>{Object.keys(e.hooks).forEach(t=>{e.hooks[t]=[]})},Hs=2*Math.PI,Us=4,Ws=1.2,Gs=(e,t)=>{let n=Us*M.pxRatio,r=n/2,i=n*Ws,a=i/2;return M Line truncated
`).filter(e=>e).forEach(e=>{let t=Sl(e);t&&n.push({metric:t.metric,values:t.values.map((e,n)=>[t.timestamps[n]/1e3,e])})}):y(String(r)),{data:{result:n,resultType:`matrix`},vmui:ne(t)}},ie=async(e,t)=>{let n=await e.json();if(e.ok)return n.vmui=ne(t),n;{let e=n.errorType?`${n.errorType}\r\n`:``;y(`${e}${n?.error||n?.message||`unknown error`}`)}},R=async(e,n)=>{switch(t){case 1:return await re(e,n);default:return await ie(e,n)}},ae=c(async()=>{let e=L();if(!e){y(e=>e||xe.validQuery);return}y(``),x(!0);try{let t=[];for await(let n of e){if(!n)continue;let{url:e,id:r}=n,i=await fetch(e),a=await R(i,{id:r,url:e,comment:m,title:s});t.push(a)}t.length&&te(t)}catch(e){e instanceof Error&&e.name!==`AbortError`&&y(`${e.name}: ${e.message}`)}finally{x(!1)}},[L,m,te,i,s]),oe=e=>()=>{let t=n=>{let r=n+e;return O[r]?.current?r:t(r)};j(t)};return p(()=>{y(``),f(o),h(``)},[M]),p(()=>{j(0)},[F]),A(r,{children:[A(Z,{title:`Debug query`,children:A(X,{variant:`text`,startIcon:A(dr,{}),onClick:N,ariaLabel:`Debug query`})}),M&&A(ui,{title:`Debug query`,onClose:P,isOpen:M,children:A(`div`,{className:`vm-download-report`,children:[A(`div`,{className:`vm-download-report-settings`,children:[A(`div`,{ref:w,children:[A(`div`,{className:`vm-download-report-settings__title`,children:`Filename`}),A($,{value:u,onChange:f})]}),A(`div`,{ref:S,children:[A(`div`,{className:`vm-download-report-settings__title`,children:`Report title`}),A($,{value:s,onChange:l})]}),A(`div`,{ref:T,children:[A(`div`,{className:`vm-download-report-settings__title`,children:`Comment`}),A(wl,{value:m,onChange:h})]}),t===0&&A(r,{children:[A(`div`,{ref:E,children:A(gl,{checked:g,onChange:_,label:`Include query trace`})}),A(Y,{variant:`info`,children:[`If confused with the query results, try viewing the raw samples for selected series in `,A(()=>A(C,{className:`vm-link vm-link_underlined vm-link_colored`,to:z.rawQuery,children:`Raw Query`}),{}),` tab.`]})]})]}),v&&A(Y,{variant:`error`,children:v}),A(`div`,{className:`vm-download-report__buttons`,children:[A(X,{variant:`text`,onClick:I,children:`Help`}),A(`div`,{ref:D,children:A(X,{onClick:ae,disabled:b,children:b?`Loading data...`:`Generate Report`})})]}),A(ii,{open:F,buttonRef:O[k],placement:`top-left`,variant:`dark`,onClose:ee,children:A(`div`,{className:`vm-download-report-helper`,children:[A(`div`,{className:`vm-download-report-helper__description`,children:xl[k]}),A(`div`,{className:`vm-download-report-helper__buttons`,children:[k!==0&&A(X,{onClick:oe(-1),size:`small`,color:`white`,children:`Prev`}),A(X,{onClick:k===O.length-1?ee:oe(1),size:`small`,color:`white`,variant:`text`,children:k===O.length-1?`Close`:`Next`})]})]})})]})})]})},Ol=()=>{let{isEmptyHistogram:e}=Nr(),{handleChange:t}=ol();return e?A(Y,{variant:`warning`,children:A(`div`,{className:`vm-warning-heatmap-to-line`,children:[A(`p`,{className:`vm-warning-heatmap-to-line__text`,children:`The expression cannot be displayed as a heatmap. To make the graph work, disable the heatmap in the "Graph settings" or modify the expression.`}),A(X,{size:`small`,color:`primary`,variant:`text`,onClick:()=>t(!1),children:`Switch to line chart`})]})}):null};f(),s();var kl=({title:e,downloadFormatOptions:t,onDownload:i})=>{let{value:a,setTrue:o,setFalse:s}=Q(!1),l=n(null),u=c(()=>{if(a){s();return}t&&t.length>0?o():(i(),s())},[i,s,a,o]),d=c(e=>t?.includes(e),[t]),f=c(e=>{let t=e.currentTarget.textContent;t&&d(t)?i(t):i(),s()},[i]);return A(r,{children:[A(`div`,{ref:l,children:A(Z,{title:e,children:A(X,{variant:`text`,startIcon:A(ar,{}),onClick:u,ariaLabel:e})})}),t&&t.length>0&&A(ii,{open:a,onClose:s,buttonRef:l,placement:`bottom-right`,children:t.map(e=>A(`div`,{className:`vm-download-button__format-option`,children:A(X,{variant:`text`,onClick:f,className:`vm-download-button__format-option-button`,children:e})},e))})]})},Al=e=>e.includes(`,`)||e.includes(`
`)||e.includes(`"`)?`"`+e.replace(/"/g,`""`)+`"`:e,jl=e=>[`__name__`,...Array.from(new Set(e.filter(e=>e&&e!==`__name__`))).sort(),`__value__`,`__timestamp__:unix_ms`],Ml=e=>[...pl(e).map(({key:e})=>e),`__timestamp__`,`__value__`].join(`,`),Nl=(e,t)=>e?.map(e=>{let n=t.map(t=>Al(e.metric[t.key]||`-`)),r=e.value?Al(String(e.value[0])):`-`,i=e.value?Al(e.value[1]):`-`;return[...n,r,i].join(`,`)}),Pl=e=>e.length?[Ml(e),...Nl(e,pl(e))].join(`
`):``;f();var Fl=()=>{ns();let{isMobile:e}=J(),{displayType:t}=Dr(),{query:r}=rn(),{customStep:i}=Nr(),a=Pr(),[o,s]=d([]),[l,f]=d(!r[0]),[m,h]=d(!1),g=n(null),{fetchUrl:_,isLoading:v,liveData:y,graphData:b,error:x,queryErrors:S,setQueryErrors:C,queryStats:w,warning:T,traces:E,isHistogram:D,abortFetch:O}=es({visible:!0,customStep:i,hideQuery:o,showAllSeries:m}),k=u(()=>{let e=e=>`vmui_export_${r.join(`_`)}.${e}`;return{csv:async()=>{y&&us(Pl(y),e(`csv`))},json:async()=>{ds(JSON.stringify(y),e(`json`))}}},[y,r]),j=c(e=>{e&&k[e]()},[k]),M=!y?.length&&t!==be.chart,N=!l&&x,P=c(e=>{s(e)},[]),F=c(()=>{f(!1)},[]);return p(()=>{a({type:`SET_IS_HISTOGRAM`,payload:D})},[D]),A(`div`,{className:(0,K.default)({"vm-custom-panel":!0,"vm-custom-panel_mobile":e}),children:[A(Wo,{queryErrors:l?void 0:S,setQueryErrors:C,setHideError:f,stats:w,isLoading:v,onHideQuery:P,onRunQuery:F,abortFetch:O,hideButtons:{reduceMemUsage:!0}}),A(ps,{traces:E,displayType:t}),N&&A(Y,{variant:`error`,children:x}),M&&A(Y,{variant:`info`,children:A(as,{})}),A(Ol,{}),T&&A(ms,{warning:T,query:r,onChange:h}),A(`div`,{className:(0,K.default)({"vm-custom-panel-body":!0,"vm-custom-panel-body_mobile":e,"vm-block":!0,"vm-block_mobile":e}),children:[v&&A(ts,{}),A(`div`,{className:`vm-custom-panel-body-header`,ref:g,children:[A(`div`,{className:`vm-custom-panel-body-header__tabs`,children:A(xr,{})}),t===`table`&&A(kl,{title:`Export query`,onDownload:j,downloadFormatOptions:[`json`,`csv`]}),(b||y)&&t!==`code`&&A(Dl,{fetchUrl:_})]}),A(bl,{graphData:b,liveData:y,isHistogram:D,displayType:t,controlsRef:g})]})]})},Il=({containerStyles:e,message:t})=>{let{isDarkTheme:n}=H();return A(`div`,{className:(0,K.default)({"vm-spinner":!0,"vm-spinner_dark":n}),style:e,children:[A(`div`,{className:`half-circle-spinner`,children:[A(`div`,{className:`circle circle-1`}),A(`div`,{className:`circle circle-2`})]}),t&&A(`div`,{className:`vm-spinner__message`,children:t})]})};f(),s();var Ll=({title:e,description:t,unit:i,expr:a,showLegend:o,filename:s,alias:c})=>{let{isMobile:l}=J(),{period:f}=W(),{customStep:m}=Nr(),h=Ht(),g=n(null),[_,v]=d(!1),[y,b]=d(!1),[x,S]=d(!1),[C,w]=d({limits:{enable:!1,range:{1:[0,0]}}}),T=u(()=>Array.isArray(a)&&a.every(e=>e),[a]),{isLoading:E,graphData:D,error:O,warning:k}=es({predefinedQuery:T?a:[],display:be.chart,visible:_,customStep:m}),j=e=>{let t={...C};t.limits.range=e,w(t)};return p(()=>{let e=new IntersectionObserver(e=>{e.forEach(e=>v(e.isIntersecting))},{threshold:.1});return g.current&&e.observe(g.current),()=>{g.current&&e.unobserve(g.current)}},[g]),T?A(`div`,{className:`vm-predefined-panel`,ref:g,children:[A(`div`,{className:`vm-predefined-panel-header`,children:[A(Z,{title:A(()=>A(`div`,{className:`vm-predefined-panel-header__description vm-default-styles`,children:[t&&A(r,{children:[A(`div`,{children:[A(`span`,{children:`Description:`}),A(to,{tagName:`div`,value:t,format:`markdown`})]}),A(`hr`,{})]}),A(`div`,{children:[A(`span`,{children:`Queries:`}),A(`div`,{children:a.map((e,t)=>A(`div`,{children:e},`${t}_${e}`))})]})]}),{}),children:A(`div`,{className:`vm-predefined-panel-header__info`,children:A(yn,{})})}),A(`h3`,{className:`vm-predefined-panel-header__title`,children:e||``}),A(ul,{data:D||[],yaxis:C,setYaxisLimits:j,toggleEnableLimits:()=>{let e={...C};e.limits.enable=!e.limits.enable,w(e)},spanGaps:{value:y,onChange:b},showAllPoints:{value:x,onChange:S}})]}),A(`div`,{className:`vm-predefined-panel-body`,children:[E&&A(Il,{}),O&&A(Y,{variant:`error`,children:O}),k&&A(Y,{variant:`warning`,children:k}),D&&A(rl,{isPredefinedPanel:!0,data:D,period:f,customStep:m,query:a,yaxis:C,unit:i,alias:c,showLegend:o,setYaxisLimits:j,setPeriod:({from:e,to:t})=>{h({type:`SET_PERIOD`,payload:{from:e,to:t}})},fullWidth:!1,height:l?window.innerHeight*.5:500,spanGaps:y,showAllPoints:x})]})]}):A(Y,{variant:`error`,children:[A(`code`,{children:`"expr"`}),` not found. Check the configuration file `,A(`b`,{children:s}),`.`]})};f();var Rl=({index:e,title:t,panels:n,filename:r})=>{let i=vr(),a=u(()=>i.width/12,[i]),[o,s]=d(!e),[l,f]=d([]);p(()=>{f(n&&n.map(e=>e.width||12))},[n]);let[m,h]=d({start:0,target:0,enable:!1}),g=c(e=>{if(!m.enable)return;let{start:t}=m,n=Math.ceil((t-e.clientX)/a);if(Math.abs(n)>=12)return;let r=l.map((e,t)=>e-(t===m.target?n:0));f(r)},[m,a]),_=(e,t)=>{h({start:e.clientX,target:t,enable:!0})},v=c(()=>{h({...m,enable:!1})},[m]),y=e=>s(e),b=e=>t=>{_(t,e)};return q(`mousemove`,g),q(`mouseup`,v),A(`div`,{className:`vm-predefined-dashboard`,children:A(ra,{defaultExpanded:o,onChange:y,title:A(()=>A(`div`,{className:(0,K.default)({"vm-predefined-dashboard-header":!0,"vm-predefined-dashboard-header_open":o}),children:[(t||r)&&A(`span`,{className:`vm-predefined-dashboard-header__title`,children:t||`${e+1}. ${r}`}),n&&A(`span`,{className:`vm-predefined-dashboard-header__count`,children:[`(`,n.length,` panels)`]})]}),{}),children:A(`div`,{className:`vm-predefined-dashboard-panels`,children:Array.isArray(n)&&n.length?n.map((e,t)=>A(`div`,{clas Line truncated
<p>
This table returns a list of metrics with the highest cardinality.
The cardinality of a metric is the number of time series associated with that metric,
where each time series is defined as a unique combination of key-value label pairs.
</p>
<p>
When looking to reduce the number of active series in your data source,
you can start by inspecting individual metrics with high cardinality
(i.e. that have lots of active time series associated with them),
since that single metric contributes a large fraction of the series that make up your total series count.
</p>`,seriesCountByLabelName:`
<p>
This table returns a list of the labels with the highest number of series.
</p>
<p>
Use this table to identify labels that are storing dimensions with high cardinality
(many different label values).
</p>
<p>
It is recommended to choose labels such that they have a finite set of values,
since every unique combination of key-value label pairs creates a new time series
and therefore can dramatically increase the number of time series in your system.
</p>`,seriesCountByFocusLabelValue:`
<p>
This table returns a list of unique label values per selected label.
</p>
<p>
Use this table to identify label values that are storing per each selected series.
</p>`,labelValueCountByLabelName:`
<p>
This table returns a list of labels with the highest number of the unique values.
</p>
`,seriesCountByLabelValuePair:`
<p>
This table returns a list of the label values pairs with the highest number of series.
</p>
<p>
Use this table to identify unique label values pairs. This helps to identify same labels
is applied to count timeseries in your system, since every unique combination of key-value label pairs
creates a new time series and therefore can dramatically increase the number of time series in your system
</p>`}}get tablesHeaders(){return{seriesCountByMetricName:ql,seriesCountByLabelName:Jl,seriesCountByFocusLabelValue:Yl,seriesCountByLabelValuePair:Xl,labelValueCountByLabelName:Zl}}totalSeries(e,t=!1){return e===`labelValueCountByLabelName`?-1:t?this.tsdbStatus.totalSeriesPrev:this.tsdbStatus.totalSeries}};f();var $l=()=>{let e=new Ql,[t]=L(),r=t.get(`match`),i=t.get(`focusLabel`),a=+(t.get(`topN`)||10),o=t.get(`date`)||(0,R.default)().tz().format(`YYYY-MM-DD`),s=Fi(o),c=n(),{tenantId:l,serverUrl:u}=H(),[f,m]=d(!1),[h,g]=d(),[_,v]=d(e.defaultTSDBStatus),[y,b]=d(e.defaultMetricNameStats),[x,S]=d(!1),C=async e=>{let t=await fetch(e),n=await t.json();if(t.ok)return n;console.error(`Error fetching ${e}:`,n);let r=[n.errorType||xe.unknownType,n?.error||n?.message||`see console for more details`].join(`\r
`);throw Error(r)},w=(e,t)=>{Object.keys(e).forEach(n=>{let r=n,i=e[r],a=t[r];Array.isArray(i)&&Array.isArray(a)&&i.forEach(e=>{let t=a.find(t=>t.name===e.name)?.value,n=t?e.value-t:0,r=t?n/t*100:0;e.diff=n,e.diffPercent=r,e.valuePrev=t||0})})},T=async t=>{if(!u)return;g(``),m(!0),v(e.defaultTSDBStatus);let n={...t,date:t.date,topN:0,match:``,focusLabel:``},i={...t,date:(0,R.default)(t.date).subtract(1,`day`).format(Je)},a=[Vl(u,t),Vl(u,i)];s!==o&&(t.match||t.focusLabel)&&a.push(Vl(u,n));try{let[e,t,n]=await Promise.all(a.map(C)),i={...t.data},{data:o}=n||c.current||e;c.current={data:o};let s={...e.data,totalSeries:e.data?.totalSeries||e.data?.headStats?.numSeries||0,totalLabelValuePairs:e.data?.totalLabelValuePairs||e.data?.headStats?.numLabelValuePairs||0,seriesCountByLabelName:e.data?.seriesCountByLabelName||[],seriesCountByFocusLabelValue:e.data?.seriesCountByFocusLabelValue||[],totalSeriesByAll:o?.totalSeries||o?.headStats?.numSeries||_.totalSeriesByAll||0,totalSeriesPrev:i?.totalSeries||i?.headStats?.numSeries||0},l=r?.replace(/[{}"]/g,``);s.seriesCountByLabelValuePair=s.seriesCountByLabelValuePair.filter(e=>e.name!==l),w(s,i),v(s),m(!1)}catch(e){m(!1),e instanceof Error&&g(`${e.name}: ${e.message}`)}},E=async()=>{if(!u)return;g(``),m(!0);let t=Hl(u,{limit:1});try{let e=await C(t);b(e),m(!1)}catch(t){m(!1),b(e.defaultMetricNameStats),console.error(t)}};return p(()=>{T({topN:a,match:r,date:o,focusLabel:i})},[u,r,i,a,o]),p(()=>{E()},[u]),p(()=>{h&&(v(e.defaultTSDBStatus),m(!1))},[h]),p(()=>{S(!!l)},[l]),e.tsdbStatusData=_,e.metricNameStatsData=y,{isLoading:f,appConfigurator:e,error:h,isCluster:x}},eu={seriesCountByMetricName:({query:e})=>tu(`__name__`,e),seriesCountByLabelName:({query:e})=>`{${e}!=""}`,seriesCountByFocusLabelValue:({query:e,focusLabel:t})=>tu(t,e),seriesCountByLabelValuePair:({query:e})=>{let t=e.split(`=`),n=t[0];return tu(n,t.slice(1).join(`=`))},labelValueCountByLabelName:({query:e,match:t})=>t===``?`{${e}!=""}`:`${t.replace(`}`,``)}, ${e}!=""}`},tu=(e,t)=>e?`{`+Mo(e)+`=`+JSON.stringify(t)+`}`:``;s();var nu=({metricNameStats:e})=>{let{statsCollectedSince:t,statsCollectedRecordsTotal:n=0,trackerMemoryMaxSizeBytes:i=0,trackerCurrentMemoryUsageBytes:a=0}=e,o=t?R.default.unix(t).format(Ye):` - `,s=i?`${(a/i*100).toFixed(2)}%`:` - `,c=n.toLocaleString(`en-US`);return A(`div`,{className:`vm-cardinality-totals-card`,children:[A(`h4`,{className:`vm-cardinality-totals-card__title`,children:[A(Z,{placement:`bottom-left`,title:A(`div`,{className:`vm-cardinality-totals-card__tooltip`,children:t?A(r,{children:[A(`p`,{children:[`Total entries in cache since `,o]}),A(`p`,{children:[`Cache utilization: `,s]})]}):A(r,{children:[A(`p`,{children:`Metric names tracker is likely disabled.`}),A(`p`,{children:`No data available. See documentation for enabling the metric names tracker.`})]})}),children:A(`div`,{className:`vm-cardinality-totals-card__info-icon`,children:A(bn,{})})}),`Total metric names`]}),A(`span`,{className:`vm-cardinality-totals-card__value`,children:c}),A(`span`,{className:`vm-cardinality-totals-card__link`,children:A(Ii,{href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#track-ingested-metrics-usage`,children:`Docs ↗`})})]})},ru=({totalSeries:e=0,totalSeriesPrev:t=0,totalSeriesAll:n=0,metricNameStats:r,isPrometheus:i})=>{let{isMobile:a}=J(),[o]=L(),s=o.get(`match`),c=o.get(`focusLabel`),l=/__name__/.test(s||``),u=!(s||c),d=e/n*100,f=e-t,p=Math.abs(f)/t*100,m=[{title:`Total series`,value:e.toLocaleString(`en-US`),dynamic:!e||!t||i?``:`${p.toFixed(2)}%`,display:!c,info:`The total number of unique time series for a selected day.
A time series is uniquely identified by its name plus a set of its labels.
For example, temperature{city="NY",country="US"} and temperature{city="SF",country="US"}
are two distinct series, since they differ by the "city" label.`},{title:`Percentage from total`,value:isNaN(d)?`-`:`${d.toFixed(2)}%`,display:l,info:`The share of these series in the total number of time series.`}].filter(e=>e.display);return!m.length&&!u?null:A(`div`,{className:(0,K.default)({"vm-cardinality-totals":!0,"vm-cardinality-totals_mobile":a}),children:[m.map(({title:e,value:n,info:r,dynamic:i})=>A(`div`,{className:`vm-cardinality-totals-card`,children:[A(`h4`,{className:`vm-cardinality-totals-card__title`,children:[r&&A(Z,{title:A(`p`,{className:`vm-cardinality-totals-card__tooltip`,children:r}),children:A(`div`,{className:`vm-cardinality-totals-card__info-icon`,children:A(bn,{})})}),e]}),A(`span`,{className:`vm-cardinality-totals-card__value`,children:n}),!!i&&A(Z,{title:`in relation to the previous day: ${t.toLocaleString(`en-US`)}`,placement:`bottom-left`,children:A(`span`,{className:(0,K.default)({"vm-dynamic-number":!0,"vm-dynamic-number_positive vm-dynamic-number_down":f<0,"vm-dynamic-number_negative vm-dynamic-number_up":f>0}),children:i})})]},e)),u&&A(nu,{metricNameStats:r})]})};f();var iu=(e,t)=>{let[n]=L(),r=n.get(t)?n.get(t):e,[i,a]=d(r);return p(()=>{r!==i&&a(r)},[r]),[i,a]};f();var au=10,ou=({isPrometheus:e,isCluster:t,...n})=>{let{isMobile:r}=J(),[i]=L(),{setSearchParamsFromKeys:a}=Zi(),o=i.get(`tips`)||``,[s,c]=iu(``,`match`),[l,d]=iu(``,`focusLabel`),[f,m]=iu(au,`topN`),h=!!(s||l||f!==au&&!e),g=u(()=>f<0?`Number must be bigger than zero`:``,[f]),_=e=>{let t=+e;m(isNaN(t)?0:t)},v=()=>{a({match:s,topN:f,focusLabel:l})},y=()=>{a({match:``,focusLabel:``,topN:``}),c(``),d(``),m(au)},b=()=>{let e=i.get(`tips`)||``;a({tips:e?``:`true`})};return p(()=>{let e=i.get(`match`),t=+(i.get(`topN`)||au),n=i.get(`focusLabel`);e!==s&&c(e||``),t!==f&&m(t),n!==l&&d(n||``)},[i]),A(`div`,{className:(0,K.default)({"vm-cardinality-configurator":!0,"vm-cardinality-configurator_mobile":r,"vm-block":!0,"vm-block_mobile":r}),children:[A(`div`,{className:`vm-cardinality-configurator-controls`,children:[A(`div`,{className:`vm-cardinality-configurator-controls__query`,children:A($,{label:`Time series selector`,type:`string`,value:s,onChange:c,onEnter:v})}),A(`div`,{className:`vm-cardinality-configurator-controls__item`,children:A($,{label:`Focus label`,type:`text`,value:l||``,onChange:d,onEnter:v,endIcon:A(Z,{title:A(`div`,{children:A(`p`,{children:`To identify values with the highest number of series for the selected label.`})}),children:A(qn,{})})})}),A(`div`,{className:`vm-cardinality-configurator-controls__item vm-cardinality-configurator-controls__item_limit`,children:A($,{label:`Limit entries`,type:`number`,value:e?au:f,error:g,disabled:e,helperText:e?`not available for Prometheus`:``,onChange:_,onEnter:v})})]}),A(`div`,{className:`vm-cardinality-configurator-bottom`,children:[A(ru,{isPrometheus:e,isCluster:t,...n}),t&&A(`div`,{className:`vm-cardinality-configurator-bottom-helpful`,children:A(Ii,{href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#cardinality-explorer-statistic-inaccuracy`,withIcon:!0,children:[A(Gn,{}),`Statistic inaccuracy explanation`]})}),A(`div`,{className:`vm-cardinality-configurator-bottom-helpful`,children:A(Ii,{href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#cardinality-explorer`,withIcon:!0,children:[A(Gn,{}),`Documentation`]})}),A(`div`,{className:`vm-cardinality-configurator-bottom__execute`,children:[A(Z,{title:o?`Hide tips`:`Show tips`,children:A(X,{variant:`text`,color:o?`warning`:`gray`,startIcon:A(Zn,{}),onClick:b,ariaLabel:`visibility tips`})}),A(X,{variant:`text`,startIcon:A(vn,{}),onClick:y,disabled:!h,children:`Reset filters`}),A(X,{startIcon:A(An,{}),onClick:v,children:`Execute Query`})]})]})]})};function su(e){let{order:t,orderBy:n,onRequestSort:r,headerCells:i}=e,a=e=>t=>{r(t,e)};return A(`thead`,{className:`vm-table-header vm-cardinality-panel-table__header`,children:A(`tr`,{className:`vm-table__row vm-table__row_header`,children:i.map(e=>A(`th`,{className:(0,K.default)({"vm-table-cell vm-table-cell_header":!0,"vm-table-cell_sort":e.sortable,"vm-table-cell_right":e.id===`action`}),onClick:e.sortable?a(e.id):void 0,children:A(`div`,{className:`vm-table-cell__content`,children:[e.info&&A(Z,{title:e.info,children:A(`div`,{className:`vm-metrics-content-header__tip-icon`,children:A(bn,{})})}),e.label,e.sortable&&A(`div`,{className:(0,K.default)({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":n===e.id,"vm-table__sort-icon_desc":t===`desc`&&n===e.id}),children:A(Tn,{})})]})},e.id))})})}var cu=[`date`,`timestamp`,`time`];function lu(e,t,n){let r=e[n],i=t[n];if(r==null&&i==null)return 0;if(r==null)return 1;if(i==null)return-1;let a=String(r),o=String(i);if(cu.includes(String(n))){let e=It(a),t=It(o);return t<e?-1:+(t>e)}let s=Number(a),c=Number(o);return!isNaN(s)&&!isNaN(c)?c-s:o<a?-1:+(o>a)}function uu(e,t){return e===`desc`?(e,n)=>lu(e,n,t):(e,n)=>-lu(e,n,t)}function du(e,t){le Line truncated
This may take some time if the db contains big number of time series.`,Su=()=>{let{isMobile:e}=J(),[t]=L(),{setSearchParamsFromKeys:n}=Zi(),r=t.get(`tips`)||``,i=t.get(`match`)||``,a=t.get(`focusLabel`)||``,{isLoading:o,appConfigurator:s,error:c,isCluster:l}=$l(),{tsdbStatusData:u,metricNameStatsData:d,getDefaultState:f,tablesHeaders:p,sectionsTips:m}=s,h=f(i,a),g=e=>t=>{let r=t,o=[`labelValueCountByLabelName`,`seriesCountByLabelName`].includes(e);o&&(t=Mo(t));let s={match:eu[e]({query:t,focusLabel:a,match:i})};o&&(s.focusLabel=r),e===`seriesCountByFocusLabelValue`&&(s.focusLabel=``),n(s)};return A(`div`,{className:(0,K.default)({"vm-cardinality-panel":!0,"vm-cardinality-panel_mobile":e}),children:[o&&A(Il,{message:xu}),A(ou,{isPrometheus:s.isPrometheusData,totalSeries:u.totalSeries,totalSeriesPrev:u.totalSeriesPrev,totalSeriesAll:u.totalSeriesByAll,totalLabelValuePairs:u.totalLabelValuePairs,seriesCountByMetricName:u.seriesCountByMetricName,metricNameStats:d,isCluster:l}),r&&A(`div`,{className:`vm-cardinality-panel-tips`,children:[!i&&!a&&A(_u,{}),i&&!a&&A(yu,{}),!i&&!a&&A(vu,{}),a&&A(bu,{})]}),c&&A(Y,{variant:`error`,children:c}),s.keys(i,a).map(e=>A(hu,{sectionTitle:s.sectionsTitles(a)[e],tip:m[e],rows:u[e],onActionClick:g(e),tabs:h.tabs[e],chartContainer:h.containerRefs[e],totalSeriesPrev:s.totalSeries(e,!0),totalSeries:s.totalSeries(e),tableHeaderCells:p[e],isPrometheus:s.isPrometheusData},e))]})},Cu=(e,t,n)=>`${e}/api/v1/status/top_queries?topN=${t||``}&maxLifetime=${n||``}`;f();var wu=(e,t)=>{let{query:n,timeRangeSeconds:r}=e,i=[`g0.expr=${encodeURIComponent(n)}`],a=kt.find(e=>e.duration===t)?.id;return a&&i.push(`g0.relative_time=${a}`),r&&i.push(`g0.range_input=${t}`),`${z.home}?${i.join(`&`)}`},Tu=e=>([`topByAvgDuration`,`topByCount`,`topBySumDuration`,`topByAvgMemoryUsage`].forEach(t=>{let n=e[t];Array.isArray(n)&&n.forEach(e=>{let t=Et(e.timeRangeSeconds*1e3);e.url=wu(e,t),e.timeRange=t||`instant`})}),e),Eu=({topN:e,maxLifetime:t})=>{let{serverUrl:n}=H(),{setSearchParamsFromKeys:r}=Zi(),[i,a]=d(null),[o,s]=d(!1),[c,l]=d(),f=u(()=>Cu(n,e,t),[n,e,t]);return{data:i,error:c,loading:o,fetch:async()=>{s(!0),r({topN:e,maxLifetime:t});try{let e=await fetch(f),t=await e.json();a(e.ok?Tu(t):null),l(String(t.error||``))}catch(e){e instanceof Error&&e.name!==`AbortError`&&l(`${e.name}: ${e.message}`)}s(!1)}}};f();var Du=({rows:e,columns:t,defaultOrderBy:n})=>{let r=Ga(),[i,a]=d(n||`count`),[o,s]=d(`desc`),c=u(()=>du(e,uu(o,i)),[e,i,o]),l=e=>{s(t=>t===`asc`&&i===e?`desc`:`asc`),a(e)},f=e=>()=>{l(e)},p=({query:e})=>async()=>{await r(e,`Query has been copied`)};return A(`table`,{className:`vm-table`,children:[A(`thead`,{className:`vm-table-header`,children:A(`tr`,{className:`vm-table__row vm-table__row_header`,children:[t.map(e=>{let t=e.sortBy||e.key;return A(`th`,{className:`vm-table-cell vm-table-cell_header vm-table-cell_sort`,onClick:f(t),children:A(`div`,{className:`vm-table-cell__content`,children:[e.title||e.key,e.tooltip&&A(Z,{placement:`top-center`,title:e.tooltip,children:A(`span`,{className:`vm-top-queries-table__info-icon`,children:A(bn,{})})}),A(`div`,{className:(0,K.default)({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":i===t,"vm-table__sort-icon_desc":o===`desc`&&i===t}),children:A(Tn,{})})]})},e.key)}),A(`th`,{className:`vm-table-cell vm-table-cell_header`}),` `]})}),A(`tbody`,{className:`vm-table-body`,children:c.map((e,n)=>A(`tr`,{className:`vm-table__row`,children:[t.map(t=>A(`td`,{className:`vm-table-cell`,children:t.format?.(e)??e[t.key]??`-`},t.key)),A(`td`,{className:`vm-table-cell vm-table-cell_no-padding`,children:A(`div`,{className:`vm-top-queries-panels__table-actions`,children:[e.url&&A(Z,{title:`Execute query`,children:A(C,{to:e.url,target:`_blank`,rel:`noreferrer`,"aria-disabled":!0,children:A(X,{variant:`text`,size:`small`,startIcon:A(jn,{}),ariaLabel:`execute query`})})}),A(Z,{title:`Copy query`,children:A(X,{variant:`text`,size:`small`,startIcon:A(Hn,{}),onClick:p(e),ariaLabel:`copy query`})})]})})]},n))})]})};f();var Ou=[`table`,`JSON`].map((e,t)=>({value:String(t),label:e,icon:A(t===0?Nn:Pn,{})})),ku=({rows:e,title:t,columns:n,defaultOrderBy:r})=>{let{isMobile:i}=J(),[a,o]=d(0);return A(`div`,{className:(0,K.default)({"vm-top-queries-panel":!0,"vm-block":!0,"vm-block_mobile":i}),children:[A(`div`,{className:(0,K.default)({"vm-top-queries-panel-header":!0,"vm-section-header":!0,"vm-top-queries-panel-header_mobile":i}),children:[A(`h5`,{className:(0,K.default)({"vm-section-header__title":!0,"vm-section-header__title_mobile":i}),children:t}),A(`div`,{className:`vm-section-header__tabs`,children:A(yr,{activeItem:String(a),items:Ou,onChange:e=>{o(+e)}})})]}),A(`div`,{className:(0,K.default)({"vm-top-queries-panel__table":!0,"vm-top-queries-panel__table_mobile":i}),children:[a===0&&A(Du,{rows:e,columns:n,defaultOrderBy:r}),a===1&&A(fl,{data:e})]})]})},Au=Math.log(1024),ju=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`],Mu=e=>{if(!Number.isFinite(e)||e<0)return nul Line truncated
`,`The file must contain tracing information in JSON format.`,`
`,`In order to use tracing please refer to the doc:\xA0`,A(`a`,{className:`vm-link vm-link_colored`,href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#query-tracing`,target:`_blank`,rel:`help noreferrer`,children:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#query-tracing`}),`
`,`Tracing graph will be displayed after file upload.`,`
`,`Attach files by dragging & dropping, selecting or pasting them.`]}),A(Hu,{onOpenModal:o,onChange:m})]}),a&&A(ui,{title:`Paste JSON`,onClose:s,children:A(cs,{editable:!0,displayTitle:!0,defaultTile:`JSON ${e.length+1}`,onClose:s,onUpload:l})}),y&&A(`div`,{className:`vm-trace-page__dropzone`})]})};f();var Wu=({job:e,instance:t,metrics:n,size:r})=>{let{duration:i,relativeTime:a,period:{date:o}}=W(),{customStep:s}=Nr(),{setSearchParamsFromKeys:c}=Zi(),l=()=>{let l=Lc({"g0.range_input":i,"g0.end_input":o,"g0.step_input":s,"g0.relative_time":a,size:r,job:e,instance:t,metrics:n});c(l)};p(l,[i,a,o,s,e,t,n,r]),p(l,[])},Gu=(e,t)=>`${e}/api/v1/label/job/values?start=${t.start}&end=${t.end}`,Ku=(e,t,n)=>{let r=`{job=${JSON.stringify(n)}}`;return`${e}/api/v1/label/instance/values?match[]=${encodeURIComponent(r)}&start=${t.start}&end=${t.end}`},qu=(e,t,n,r)=>{let i=`{${Object.entries({job:n,instance:r}).filter(e=>e[1]).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(`,`)}}`;return`${e}/api/v1/label/__name__/values?match[]=${encodeURIComponent(i)}&start=${t.start}&end=${t.end}`};f();var Ju=()=>{let{serverUrl:e}=H(),{period:t}=W(),[n,r]=d([]),[i,a]=d(!1),[o,s]=d(),c=u(()=>Gu(e,t),[e,t]);return p(()=>{(async()=>{a(!0);try{let e=await fetch(c),t=await e.json(),n=t.data||[];r(n.sort((e,t)=>e.localeCompare(t))),e.ok?s(void 0):s(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&s(`${e.name}: ${e.message}`)}a(!1)})().catch(console.error)},[c]),{jobs:n,isLoading:i,error:o}};f();var Yu=e=>{let{serverUrl:t}=H(),{period:n}=W(),[r,i]=d([]),[a,o]=d(!1),[s,c]=d(),l=u(()=>Ku(t,n,e),[t,n,e]);return p(()=>{e&&(async()=>{o(!0);try{let e=await fetch(l),t=await e.json(),n=t.data||[];i(n.sort((e,t)=>e.localeCompare(t))),e.ok?c(void 0):c(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&c(`${e.name}: ${e.message}`)}o(!1)})().catch(console.error)},[l]),{instances:r,isLoading:a,error:s}};f();var Xu=(e,t)=>{let{serverUrl:n}=H(),{period:r}=W(),[i,a]=d([]),[o,s]=d(!1),[c,l]=d(),f=u(()=>qu(n,r,e,t),[n,r,e,t]);return p(()=>{e&&(async()=>{s(!0);try{let e=await fetch(f),t=await e.json(),n=t.data||[];a(n.sort((e,t)=>e.localeCompare(t))),e.ok?l(void 0):l(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&l(`${e.name}: ${e.message}`)}s(!1)})().catch(console.error)},[f]),{names:i,isLoading:o,error:c}};f();var Zu=({name:e,job:t,instance:n,rateEnabled:r,isBucket:i,height:a})=>{let{isMobile:o}=J(),{customStep:s,yaxis:c}=Nr(),{period:l}=W(),f=Pr(),m=Ht(),h=bt(l.end-l.start),g=Et(_t(s)*10*1e3),[_,v]=d(!1),[y,b]=d(!1),x=_&&s===h?g:s,S=u(()=>{let a=Object.entries({job:t,instance:n}).filter(e=>e[1]).map(([e,t])=>`${e}=${JSON.stringify(t)}`);a.push(`__name__=${JSON.stringify(e)}`),e==`node_cpu_seconds_total`&&a.push(`mode!="idle"`);let o=`{${a.join(`,`)}}`;return i?[`sum(increase_pure(${o})) by (vmrange, le)`]:[`
with (q = ${r?`rollup_rate(${o})`:`rollup(${o})`}) (
alias(min(label_match(q, "rollup", "min")), "min"),
alias(max(label_match(q, "rollup", "max")), "max"),
alias(avg(label_match(q, "rollup", "avg")), "avg"),
)`]},[e,t,n,r,i]),{isLoading:C,graphData:w,error:T,queryErrors:E,warning:D,isHistogram:O}=es({predefinedQuery:S,visible:!0,customStep:x,showAllSeries:y});return p(()=>{v(O)},[O]),A(`div`,{className:(0,K.default)({"vm-explore-metrics-graph":!0,"vm-explore-metrics-graph_mobile":o}),children:[C&&A(Il,{}),T&&A(Y,{variant:`error`,children:T}),E[0]&&A(Y,{variant:`error`,children:E[0]}),D&&A(ms,{warning:D,query:S,onChange:b}),w&&l&&A(rl,{data:w,period:l,customStep:x,query:S,yaxis:c,setYaxisLimits:e=>{f({type:`SET_YAXIS_LIMITS`,payload:e})},setPeriod:({from:e,to:t})=>{m({type:`SET_PERIOD`,payload:{from:e,to:t}})},showLegend:!1,height:a,isHistogram:O})]})},Qu=({name:e,index:t,length:n,isBucket:r,rateEnabled:i,onChangeRate:a,onRemoveItem:o,onChangeOrder:s})=>{let{isMobile:c}=J(),{value:l,setTrue:u,setFalse:d}=Q(!1),f=()=>{o(e)},p=()=>{s(e,t,t+1)},m=()=>{s(e,t,t-1)};return c?A(`div`,{className:`vm-explore-metrics-item-header vm-explore-metrics-item-header_mobile`,children:[A(`div`,{className:`vm-explore-metrics-item-header__name`,children:e}),A(X,{variant:`text`,size:`small`,startIcon:A(Yn,{}),onClick:u,ariaLabel:`open panel settings`}),l&&A(ui,{title:e,onClose:d,children:A(`div`,{className:`vm-explore-metrics-item-header-modal`,children:[A(`div`,{className:`vm-explore-metrics-item-header-modal-order`,children:[A(X,{startIcon:A(Ln,{}),variant:`outlined`,onClick:m,disabled:t===0,ariaLabel:`move graph up`}),A(`p`,{children:[`position:`,A(`span`,{className:`vm-explore-metrics-item-header-modal-order__index`,children:[`#`,t+1]})]}),A(X,{endIcon:A(In,{}),variant:`outlined`,onClick:p,disabled:t===n-1,ariaLabel:`move graph down`})]}),!r&&A(`div`,{className:`vm-explore-metrics-item-header-modal__rate`,children:[A(Sa,{label:A(`span`,{children:[`enable `,A(`code`,{children:`rate()`})]}),value:i,onChange:a,fullWidth:!0}),A(`p`,{children:`calculates the average per-second speed of metrics change`})]}),A(X,{startIcon:A(_n,{}),color:`error`,variant:`outlined`,onClick:f,fullWidth:!0,children:`Remove graph`})]})})]}):A(`div`,{className:`vm-explore-metrics-item-header`,children:[A(`div`,{className:`vm-explore-metrics-item-header-order`,children:[A(Z,{title:`move graph up`,children:A(X,{className:`vm-explore-metrics-item-header-order__up`,startIcon:A(G,{}),variant:`text`,color:`gray`,size:`small`,onClick:m,ariaLabel:`move graph up`})}),A(`div`,{className:`vm-explore-metrics-item-header__index`,children:[`#`,t+1]}),A(Z,{title:`move graph down`,children:A(X,{className:`vm-explore-metrics-item-header-order__down`,startIcon:A(G,{}),variant:`text`,color:`gray`,size:`small`,onClick:p,ariaLabel:`move graph down`})})]}),A(`div`,{className:`vm-explore-metrics-item-header__name`,children:e}),!r&&A(`div`,{className:`vm-explore-metrics-item-header__rate`,children:A(Z,{title:`calculates the average per-second speed of metric's change`,children:A(Sa,{label:A(`span`,{children:[`enable `,A(`code`,{children:`rate()`})]}),value:i,onChange:a})})}),A(`div`,{className:`vm-explore-metrics-item-header__close`,children:A(Z,{title:`close graph`,children:A(X,{startIcon:A(_n,{}),variant:`text`,color:`gray`,size:`small`,onClick:f,ariaLabel:`close graph`})})})]})};f();var $u=({name:e,job:t,instance:n,index:r,length:i,size:a,onRemoveItem:o,onChangeOrder:s})=>{let c=u(()=>/_sum$|_total$|_count$/.test(e),[e]),l=u(()=>/_bucket$/.test(e),[e]),[f,m]=d(c),h=vr(),g=u(a.height,[a,h]);return p(()=>{m(c)},[t]),A(`div`,{className:`vm-explore-metrics-item vm-block vm-block_empty-padding`,children:[A(Qu,{name:e,index:r,length:i,isBucket:l,rateEnabled:f,size:a.id,onChangeRate:m,onRemoveItem:o,onChangeOrder:s}),A(Zu,{name:e,job:t,instance:n,rateEnabled:f,isBucket:l,height:g},`${e}_${t}_${n}_${f}`)]})};f(),s();var ed=We.map(e=>e.id),td=({jobs:e,instances:t,names:n,job:i,instance:a,size:o,selectedMetrics:s,onChangeJob:c,onChangeInstance:l,onToggleMetric:d,onChangeSize:f})=>{let m=u(()=>i?``:`No instances. Please select job`,[i]),h=u(()=>i?``:`No metric names. Please select job`,[i]),{isMobile:g}=J(),{value:_,toggle:v,setFalse:y}=Q(V(`EXPLORE_METRICS_TIPS`)!==`false`);return p(()=>{B(`EXPLORE_METRICS_TIPS`,`${_}`)},[_]),A(r,{children:[A(`div`,{className:(0,K.default)({"vm-explore-metrics-header":!0,"vm-explore-metrics-header_mobile":g,"vm-block":!0,"vm-block_mobile":g}),children:[A(`div`,{className:`vm-explore-metrics-header__job`,children:A(Xc,{value:i,list:e,label:`Job`,placeholder:`Please select job`,onChange:c,autofocus:!i&&!!e.length&&!g,searchable:!0})}),A(`div`,{className:`vm-explore-metrics-header__instance`,children:A(Xc,{value:a,list:t,label:`Instance`,placeholder:`Please select instance`,onChange:l,noOptionsText:m,clearable:!0,searchable:!0})}),A(`div`,{className:`vm-explore-metrics-header__size`,children:[A(Xc,{label:`Size graphs`,value:o,list:ed,onChange:f}),A(Z,{title:`${_?`Hide`:`Show`} tip`,children:A(X,{variant:`text`,color:_?`warning`:`gray`,startIcon:A(Zn,{}),onClick:v,ariaLabel:`visibility tips`})})]}),A(`div`,{className:`vm-explore-metrics-header-metrics`,child Line truncated
(
node_memory_MemTotal_bytes{instance=~"$node:$port", job=~"$job"}
-
node_memory_MemFree_bytes{instance=~"$node:$port", job=~"$job"}
)
/
node_memory_MemTotal_bytes{instance=~"$node:$port", job=~"$job"}
) * 100`}),A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`It is clear the query calculates the percentage of used memory for the given $node, $port and $job. Isn't it? :)`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`What's wrong with this query? Copy-pasted label filters for distinct timeseries which makes it easy to mistype these filters during modification. Let's simplify the query with WITH expressions:`}),A(ld,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"}
)
(
node_memory_MemTotal_bytes{commonFilters}
-
node_memory_MemFree_bytes{commonFilters}
)
/
node_memory_MemTotal_bytes{commonFilters} * 100`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:[`Now label filters are located in a single place instead of three distinct places. The query mentions node_memory_MemTotal_bytes metric twice and `,`{commonFilters}`,` three times. WITH expressions may improve this:`]}),A(ld,{code:`WITH (
my_resource_utilization(free, limit, filters) = (limit{filters} - free{filters}) / limit{filters} * 100
)
my_resource_utilization(
node_memory_MemFree_bytes,
node_memory_MemTotal_bytes,
{instance=~"$node:$port",job=~"$job"},
)`}),A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`Now the template function my_resource_utilization() may be used for monitoring arbitrary resources - memory, CPU, network, storage, you name it.`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:[`Let's take another nice query from `,A(dd,{}),` dashboard:`]}),A(ld,{code:`(
(
(
count(
count(node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"}) by (cpu)
)
)
-
avg(
sum by (mode) (rate(node_cpu_seconds_total{mode='idle',instance=~"$node:$port",job=~"$job"}[5m]))
)
)
*
100
)
/
count(
count(node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"}) by (cpu)
)`}),A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`Do you understand what does this mess do? Is it manageable? :) WITH expressions are happy to help in a few iterations.`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`1. Extract common filters used in multiple places into a commonFilters variable:`}),A(ld,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"}
)
(
(
(
count(
count(node_cpu_seconds_total{commonFilters}) by (cpu)
)
)
-
avg(
sum by (mode) (rate(node_cpu_seconds_total{mode='idle',commonFilters}[5m]))
)
)
*
100
)
/
count(
count(node_cpu_seconds_total{commonFilters}) by (cpu)
)`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`2. Extract "count(count(...) by (cpu))" into cpuCount variable:`}),A(ld,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"},
cpuCount = count(count(node_cpu_seconds_total{commonFilters}) by (cpu))
)
(
(
cpuCount
-
avg(
sum by (mode) (rate(node_cpu_seconds_total{mode='idle',commonFilters}[5m]))
)
)
*
100
) / cpuCount`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`3. Extract rate(...) part into cpuIdle variable, since it is clear now that this part calculates the number of idle CPUs:`}),A(ld,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"},
cpuCount = count(count(node_cpu_seconds_total{commonFilters}) by (cpu)),
cpuIdle = sum(rate(node_cpu_seconds_total{mode='idle',commonFilters}[5m]))
)
((cpuCount - cpuIdle) * 100) / cpuCount`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:[`4. Put node_cpu_seconds_total`,`{commonFilters}`,` into its own variable with the name cpuSeconds:`]}),A(ld,{code:`WITH (
cpuSeconds = node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"},
cpuCount = count(count(cpuSeconds) by (cpu)),
cpuIdle = sum(rate(cpuSeconds{mode='idle'}[5m]))
)
((cpuCount - cpuIdle) * 100) / cpuCount`}),A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`Now the query became more clear comparing to the initial query.`})]}),A(`div`,{className:`vm-with-template-tutorial-section`,children:[A(`p`,{className:`vm-with-template-tutorial-section__text`,children:`WITH expressions may be nested and may be put anywhere. Try expanding the following query:`}),A(ld,{code:`WITH (
f(a, b) = WITH (
f1(x) = b-x,
f2(x) = x+x
) f1(a)*f2(b)
) f(foo, with(x=bar) x)`})]})]}),pd=(e,t)=>`${e}/expand-with-exprs?query=${encodeURIComponent(t)}&format=json`;f();var md=()=>{let{serverUrl:e}=H(),[t,n]=L(),[r,i]=d(``),[a,o]=d(!1),[s,c]=d();return{data:r,error:s,loading:a,expand:async r=>{t.set(`expr`,r),n(t);let a=pd(e,r);o(!0);try{let e=await(await fetch(a)).json();i(e?.expr||``),c(String(e.error||``))}catch(e){e instanceof Error&&e.name!==`AbortError`&&c(`${e.name}: ${e.message}`)}o(!1)}}};f();var hd=()=>{let[e]=L(),{data:t,loading:n,error:r,expand:i}=md(),[a,o]=d(e.get(`expr`)||``),s=e=>{o(e)},c=()=>{i(a)};return p(()=>{a&&i(a)},[]),A(`section`,{className:`vm-with-template`,children:[n&&A(Il,{}),A(`div`,{className:`vm-with-template-body vm-block`,children:[A(`div`,{className:`vm-with-template-body__expr`,children:A($,{type:`textarea`,label:`MetricsQL query with optional WITH expressions`,value:a,error:r,autofocus:!0,onEnter:c,onChange:s})}),A(`div`,{className:`vm-with-template-body__result`,children:A($,{type:`textarea`,label:`MetricsQL query after expanding WITH expressions and applying other optimizations`,value:t,readonly:!0})}),A(`div`,{className:`vm-with-template-body-top`,children:A(X,{variant:`contained`,onClick:c,startIcon:A(An,{}),children:`Expand`})})]}),A(`div`,{className:`vm-block`,children:A(fd,{})})]})},gd=(e,t,n)=>`${e}/metric-relabel-debug?${[`format=json`,`relabel_configs=${encodeURIComponent(t)}`,`metric=${encodeURIComponent(n)}`].join(`&`)}`;f();var _d=()=>{let{serverUrl:e}=H(),[t,n]=d(null),[r,i]=d(!1),[a,o]=d();return{data:t,error:a,loading:r,fetchData:async(t,r)=>{let a=gd(e,t,r);i(!0);try{let e=await(await fetch(a)).json();n(e.error?null:e),o(String(e.error||``))}catch(e){e instanceof Error&&e.name!==`AbortError`&&o(`${e.name}: ${e.message}`)}i(!1)}}};f();var vd={config:`- if: '{bar_label=~"b.*"}'
source_labels: [foo_label, bar_label]
separator: "_"
target_label: foobar
- action: labeldrop
regex: "foo_.*"
- target_label: job
replacement: "my-application-2"`,labels:`{__name__="my_metric", bar_label="bar", foo_label="foo", job="my-application", instance="192.168.0.1"}`},yd=()=>{let[e,t]=L(),{data:n,loading:r,error:i,fetchData:a}=_d(),[o,s]=iu(``,`config`),[l,u]=iu(``,`labels`),d=e=>{s(e||``)},f=e=>{u(e||``)},m=c(()=>{a(o,l),e.set(`config`,o),e.set(`labels`,l),t(e)},[o,l]);return p(()=>{let t=e.get(`config`)||``,n=e.get(`labels`)||``;(n||t)&&(a(t,n),s(t),u(n))},[]),A(`section`,{className:`vm-relabeling`,children:[r&&A(Il,{}),A(`div`,{className:`vm-relabeling-header vm-block`,children:[A(`div`,{className:`vm-relabeling-header-configs`,children:A($,{type:`textarea`,label:`Config`,value:o,autofocus:!0,onChange:d,onEnter:m})}),A(`div`,{className:`vm-relabeling-header__labels`,children:A($,{type:`textarea`,label:`A time series`,value:l,placeholder:`up{job="job_name",instance="host:port"}`,onChange:f,onEnter:m})}),A(`div`,{className:`vm-relabeling-header-bottom`,children:[A(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/relabeling/`,rel:`help noreferrer`,children:A(X,{variant:`text`,color:`gray`,startIcon:A(Gn,{}),children:`Relabeling cookbook`})}),A(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/relabeling/#relabeling-stages`,rel:`help noreferrer`,children:A(X,{variant:`text`,color:`gray`,startIcon:A(yn,{}),children:`Relabeling Stages`})}),A(X,{variant:`outlined`,onClick:()=>{let{config:n,labels:r}=vd;s(n),u(r),a(n,r),e.set(`config`,n),e.set(`labels`,r),t(e)},children:`Try example`}),A(X,{variant:`contained`,onClick:m,startIcon:A(An,{}),children:`Preview`})]})]}),i&&A(Y,{variant:`error`,children:i}),n&&A(`div`,{className:`vm-relabeling-steps vm-block`,children:[n.originalLabels&&A(`div`,{className:`vm-relabeling-steps-item`,children:A(`div`,{className:`vm-relabeling-steps-item__row`,children:[A(`span`,{children:`Original labels:`}),A(to,{tagName:`code`,value:n.originalLabels})]})}),n.steps.map((e,t)=>A(`div`,{className:`vm-relabeling-steps-item`,children:[A(`div`,{className:`vm-relabeling-steps-item__row`,children:[A(`span`,{children:`Step:`}),t+1]}),A(`div`,{className:`vm-relabeling-steps-item__row`,children:[A(`span`,{children:`Relabeling Rule:`}),A(`code`,{children:A(`pre`,{children:e.rule})})]}),A(`div`,{className:`vm-relabeling-steps-item__row`,children:[A(`span`,{children:`Input Labels:`}),A(`code`,{children:e.errors?.inLabelsMsg?A(`pre`,{className:`vm-relabeling-steps-item__error`,children:e.errors.inLabelsMsg}):A(to,{tagName:`pre`,value:e.inLabels})})]}),A(`div`,{className:`vm-relabeling-steps-item__row`,children:[A(`span`,{children:`Output labels:`}),A(`code`,{children:e.errors?.outLabelsMsg?A(`pre`,{className:`vm-relabeling-steps-item__error`,children:e.errors.outLabelsMsg}):A(to,{tagName:`pre`,value:e.outLabels})})]})]},t)),n.resultingLabels&&A(`div`,{className:`vm-relabeling-steps-item`,children:A(`div`,{className:`vm-relabeling-steps-item__row`,children:[A(`span`,{children:`Resulting labels:`}),A(to,{tagName:`code`,value:n.resultingLabels})]})})]})]})},bd=e=>`${e}/api/v1/status/active_queries`;f();var xd=()=>{let{serverUrl:e}=H(),[t,n]=d([]),[r,i]=d((0,R.default)().format(Xe)),[a,o]=d(!1),[s,c]=d(),l=u(()=>bd(e),[e]),f=async()=>{o(!0);try{let e=await fetch(l),t=await e.json();n(t.data),i((0,R.default)().format(`HH:mm:ss:SSS`)),e.ok?c(void 0):c(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&c(`${e.name}: ${e.message}`)}o(!1)};return p(()=>{f().catch(console.error)},[l]),{data:t,lastUpdated:r,isLoading:a,error:s,fetchData:f}};f();var Sd=({rows:e,columns:t,defaultOrderBy:n,defaultOrderDir:r,copyToClipboard:i,paginationOffset:a,rowClasses:o,rowAction:s=e=>()=>{}})=>{let c=Ga(),[l,f]=d(n),[m,h]=d(r||`desc`),[g,_]=d(null),[v,y]=d(new Map);p(()=>{let t=new Map;e.forEach(e=>{t.set(e.id,ie())}),y(t)},[e]);let b=u(()=>{let{startIndex:t,endIndex:n}=a;return du(e,uu(m,l)).slice(t,n)},[e,l,m,a]),x=e=>()=>{h(t=>t===`asc`&&l===e?`desc`:`asc`),f(e)},S=(e,t)=>async()=>{if(g!==t)try{await c(String(e)),_(t)}catch(e){console.error(e)}};p(()=>{if(g===null)return;let e=setTimeout(()=>_(null),2e3);return()=>clearTimeout(e)},[g]);let C=i&&t.find(e=>e.key==i);return A(`table`,{className:`vm-table`,children:[A(`thead`,{className:`vm-table-header`,children:A(`tr`,{className:`vm-table__row vm-table__row_header`,children:[t.map(e=>A(`th`,{className:`vm-table-cell vm-table-cell_header vm-table-cell_sort`,onClick:x(e.key),children:A(`div`,{className:`vm-table-cell__content`,children:[A(`div`,{children:String(e.title||e.key)}),A(`div`,{className:(0,K.default)({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":l===e.key,"vm-table__sort-icon_desc":m===`desc`&&l===e.key}),children:A(Tn,{})})]})},String(e.key))),i&&A(`th`,{className:`vm-table-cell vm-table-cell_header`})]})}),A(`tbody`,{className:`vm-table-body`,children:b.map((e,n)=>A(`tr`,{className:(0,K.default)({"vm-table__row":!0,...o?o(e):{}}),id:e.id,ref:v.get(e.id),onClick:s(v.get(e.id)),children:[t.map(t=>A(`td`,{classNa Line truncated
`,`The file must contain query information in JSON format.`,`
`,`Graph will be displayed after file upload.`,`
`,`Attach files by dragging & dropping, selecting or pasting them.`]}),A(Hu,{onOpenModal:o,onChange:h})]}),n&&A(`div`,{className:`vm-query-analyzer-error`,children:[A(Y,{variant:`error`,children:n}),A(X,{className:`vm-query-analyzer-error__close`,startIcon:A(_n,{}),variant:`text`,color:`error`,onClick:g})]}),a&&A(ui,{title:`Paste JSON`,onClose:s,children:A(wd,{onClose:s,onUpload:f})}),v&&A(`div`,{className:`vm-trace-page__dropzone`})]})},kd=(e,t,n)=>`${e}/downsampling-filters-debug?${[`flags=${encodeURIComponent(t)}`,`metrics=${encodeURIComponent(n)}`].join(`&`)}`;f();var Ad=()=>{let{serverUrl:e}=H(),[t,n]=L(),[r,i]=d(new Map),[a,o]=d(!1),[s,l]=d(),[u,f]=d(),[p,m]=d();return{data:r,error:p,metricsError:s,flagsError:u,loading:a,applyFilters:c(async(r,a)=>{if(l(a?``:`metrics are required`),f(r?``:`flags are required`),!a||!r)return;t.set(`flags`,r),t.set(`metrics`,a),n(t);let s=kd(e,r,a);o(!0);try{let e=await(await fetch(s)).json();i(new Map(Object.entries(e.result||{}))),l(e.error?.metrics||``),f(e.error?.flags||``),m(``)}catch(e){e instanceof Error&&e.name!==`AbortError`&&m(`${e.name}: ${e.message}`)}o(!1)},[e])}};f();var jd={flags:`-downsampling.period={env="dev"}:7d:5m,{env="dev"}:30d:30m
-downsampling.period=30d:1m
-downsampling.period=60d:5m
`,metrics:`up
up{env="dev"}
up{env="prod"}`},Md=()=>{let[e]=L(),{data:t,loading:n,error:r,metricsError:i,flagsError:a,applyFilters:o}=Ad(),[s,l]=d(e.get(`metrics`)||``),[u,f]=d(e.get(`flags`)||``),m=c(e=>{l(e)},[l]),h=c(e=>{f(e)},[f]),g=c(()=>{o(u,s)},[o,u,s]),_=c(()=>{let{flags:t,metrics:n}=jd;f(t),l(n),o(t,n),e.set(`flags`,t),e.set(`metrics`,n)},[jd,f,l,e]);p(()=>{u&&s&&g()},[]);let v=[];for(let[e,n]of t)v.push(A(`tr`,{className:`vm-table__row`,children:[A(`td`,{className:`vm-table-cell`,children:e}),A(`td`,{className:(0,K.default)({"vm-table-cell":!0,"vm-table-cell_empty":!n}),children:n?n.join(` `):`No matching rules found!`})]}));return A(`section`,{className:`vm-downsampling-filters`,children:[n&&A(Il,{}),A(`div`,{className:`vm-downsampling-filters-body vm-block`,children:[A(`div`,{className:`vm-downsampling-filters-body__expr`,children:[A(`div`,{className:`vm-retention-filters-body__title`,children:A(`p`,{children:[`Provide a list of flags for downsampling configuration. Note that only `,A(`code`,{children:`-downsampling.period`}),` and `,A(`code`,{children:`-dedup.minScrapeInterval`}),` flags are supported`]})}),A($,{type:`textarea`,label:`Flags`,value:u,error:r||a,autofocus:!0,onEnter:g,onChange:h,placeholder:`-downsampling.period=30d:1m -downsampling.period=7d:5m -dedup.minScrapeInterval=30s`})]}),A(`div`,{className:`vm-downsampling-filters-body__expr`,children:[A(`div`,{className:`vm-retention-filters-body__title`,children:A(`p`,{children:`Provide a list of metrics to check downsampling configuration.`})}),A($,{type:`textarea`,label:`Metrics`,value:s,error:r||i,onEnter:g,onChange:m,placeholder:`up{env="dev"}
up{env="prod"}
`})]}),A(`div`,{className:`vm-downsampling-filters-body__result`,children:A(`table`,{className:`vm-table`,children:[A(`thead`,{className:`vm-table-header`,children:A(`tr`,{children:[A(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Metric`}),A(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Applied downsampling rules`})]})}),A(`tbody`,{className:`vm-table-body`,children:v})]})}),A(`div`,{className:`vm-downsampling-filters-body-top`,children:[A(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#downsampling`,rel:`help noreferrer`,children:A(X,{variant:`text`,color:`gray`,startIcon:A(Gn,{}),children:`Documentation`})}),A(X,{variant:`outlined`,onClick:_,children:`Try example`}),A(X,{variant:`contained`,onClick:g,startIcon:A(An,{}),children:`Preview`})]})]})]})},Nd=(e,t,n)=>`${e}/retention-filters-debug?${[`flags=${encodeURIComponent(t)}`,`metrics=${encodeURIComponent(n)}`].join(`&`)}`;f();var Pd=()=>{let{serverUrl:e}=H(),[t,n]=L(),[r,i]=d(new Map),[a,o]=d(!1),[s,l]=d(),[u,f]=d(),[p,m]=d();return{data:r,error:p,metricsError:s,flagsError:u,loading:a,applyFilters:c(async(r,a)=>{if(l(a?``:`metrics are required`),f(r?``:`flags are required`),!a||!r)return;t.set(`flags`,r),t.set(`metrics`,a),n(t);let s=Nd(e,r,a);o(!0);try{let e=await(await fetch(s)).json();i(new Map(Object.entries(e.result||{}))),l(e.error?.metrics||``),f(e.error?.flags||``),m(``)}catch(e){e instanceof Error&&e.name!==`AbortError`&&m(`${e.name}: ${e.message}`)}o(!1)},[e])}};f();var Fd={flags:`-retentionPeriod=1y
-retentionFilter={env!="prod"}:2w
`,metrics:`up
up{env="dev"}
up{env="prod"}`},Id=()=>{let[e]=L(),{data:t,loading:n,error:r,metricsError:i,flagsError:a,applyFilters:o}=Pd(),[s,l]=d(e.get(`metrics`)||``),[u,f]=d(e.get(`flags`)||``),m=c(e=>{l(e)},[l]),h=c(e=>{f(e)},[f]),g=c(()=>{o(u,s)},[o,u,s]),_=c(()=>{let{flags:t,metrics:n}=Fd;f(t),l(n),o(t,n),e.set(`flags`,t),e.set(`metrics`,n)},[Fd,f,l,e]);p(()=>{u&&s&&g()},[]);let v=[];for(let[e,n]of t)v.push(A(`tr`,{className:`vm-table__row`,children:[A(`td`,{className:`vm-table-cell`,children:e}),A(`td`,{className:`vm-table-cell`,children:n})]}));return A(`section`,{className:`vm-retention-filters`,children:[n&&A(Il,{}),A(`div`,{className:`vm-retention-filters-body vm-block`,children:[A(`div`,{className:`vm-retention-filters-body__expr`,children:[A(`div`,{className:`vm-retention-filters-body__title`,children:A(`p`,{children:[`Provide a list of flags for retention configuration. Note that only `,A(`code`,{children:`-retentionPeriod`}),` and `,A(`code`,{children:`-retentionFilter`}),` flags are supported.`]})}),A($,{type:`textarea`,label:`Flags`,value:u,error:r||a,autofocus:!0,onEnter:g,onChange:h,placeholder:`-retentionPeriod=4w -retentionFilter=up{env="dev"}:2w`})]}),A(`div`,{className:`vm-retention-filters-body__expr`,children:[A(`div`,{className:`vm-retention-filters-body__title`,children:A(`p`,{children:`Provide a list of metrics to check retention configuration.`})}),A($,{type:`textarea`,label:`Metrics`,value:s,error:r||i,onEnter:g,onChange:m,placeholder:`up{env="dev"}
up{env="prod"}
`})]}),A(`div`,{className:`vm-retention-filters-body__result`,children:A(`table`,{className:`vm-table`,children:[A(`thead`,{className:`vm-table-header`,children:A(`tr`,{children:[A(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Metric`}),A(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Applied retention`})]})}),A(`tbody`,{className:`vm-table-body`,children:v})]})}),A(`div`,{className:`vm-retention-filters-body-top`,children:[A(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#retention-filters`,rel:`help noreferrer`,children:A(X,{variant:`text`,color:`gray`,startIcon:A(Gn,{}),children:`Documentation`})}),A(X,{variant:`outlined`,onClick:_,children:`Try example`}),A(X,{variant:`contained`,onClick:g,startIcon:A(An,{}),children:`Preview`})]})]})]})},Ld=async(e,t,n,r,i=fetch)=>{let a=await i(Yo(e,t,n));if(!a.ok)throw Error(await a.text());let{data:o=[]}=await a.json(),s=await i(Xo(e,t,n,r,jl(o).join(`,`)));if(!s.ok)throw Error(await s.text());return await s.text()};f();var Rd=({hideQuery:e,showAllSeries:t})=>{let{query:r}=rn(),{period:i}=W(),{displayType:a,reduceMemUsage:o,seriesLimits:s}=Dr(),{serverUrl:l}=H(),{showInfoMessage:f}=Jr(),[m,h]=d(!1),[g,_]=d(),[v,y]=d(),[b,x]=d([]),[S,C]=d(),w=n(new AbortController),T=u(()=>{if(y(``),x([]),i){if(!l)y(xe.emptyServer);else if(r.every(e=>!e.trim()))x(r.map(()=>xe.validQuery));else if(Oe(l)){let e={...i};return r.map(t=>qo(l,t,e,o))}else y(xe.validServer)}},[l,i,e,o]),E=u(()=>{let e=e=>`vmui_export_${r.join(`_`)}_${i.start}_${i.end}.${e}`;return{csv:async()=>{try{us(await Ld(l,r,i,o),e(`csv`))}catch(e){console.error(e),f({text:`Couldn't fetch data for CSV export. Please try again`,type:`error`})}},json:async()=>{let t=Zo(l,r,i,o);try{ds(await(await fetch(t)).text(),e(`json`))}catch(e){console.error(e),f({text:`Couldn't fetch data for JSON export. Please try again`,type:`error`})}}}},[r,i,l,o]),D=c(async({fetchUrl:t,stateSeriesLimits:n,showAllSeries:r})=>{w.current.abort(),w.current=new AbortController;let{signal:i}=w.current;h(!0);try{let o=Math.floor(window.innerWidth/4),s=[],c=r?1/0:+n[a]||1/0,l=1,u=0;for await(let n of t){if(e?.includes(l-1)){x(e=>[...e,``]),l++;continue}let t=await fetch(n,{signal:i}),r=await t.text();if(new TextEncoder().encode(r).length>31457280){let e=`Response too large to display (over 30 MiB). Please narrow your query.`;y(e),x(t=>[...t,e]);continue}if(!t.ok||!t.body)s.push({metric:{},values:[],group:l}),y(r),x(e=>[...e,`${r}`]);else{x(e=>[...e,``]);let e=c-s.length,t=r.split(`
`).filter(e=>e),n=t.slice(0,e).sort();for(let e of n){let t=Sl(e);if(!t)continue;let{values:n,timestamps:r}=t,i=n.length,a=i>o,c=a?o:i,u=a?i/o:1,d=Array(c),f=[];for(let e=0;e<c;e++){let t=a?Math.floor(e*u):e,i=r[t]/1e3,o=n[t];o===null&&f.push(i),d[e]=[i,o]}s.push({group:l,metric:t.metric,values:d,nullTimestamps:f})}u+=t.length}l++}let d=`Showing ${s.length} series out of ${u} series due to performance reasons. Please narrow down the query, so it returns fewer series`;C(u>c?d:``),_(s),h(!1)}catch(e){h(!1),e instanceof Error&&e.name!==`AbortError`&&(y(String(e)),console.error(e))}},[a,e]),O=c(e=>{if(v)return;let t={...i};E[e](l,r,t,o)},[l,r,i,o,v,E]),k=c(()=>{w.current.abort(),_([])},[w]);return p(()=>{if(!T?.length)return;let e=setTimeout(D,400,{fetchUrl:T,stateSeriesLimits:s,showAllSeries:t});return()=>{w.current?.abort(),clearTimeout(e)}},[T,s,t]),{fetchUrl:T,isLoading:m,data:g,error:v,queryErrors:b,setQueryErrors:x,warning:S,abortFetch:k,exportData:O}};f();var zd=()=>A(Ii,{href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#raw-samples`,underlined:!0,children:`raw samples`}),Bd=()=>A(Ii,{underlined:!0,href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#query-data`,children:`Query API`}),Vd=()=>A(Ii,{underlined:!0,href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#filtering`,children:`time series selector`}),Hd=()=>{ns();let{isMobile:e}=J(),{displayType:t}=Dr(),{query:r}=rn(),[i,a]=d([]),[o,s]=d(!r[0]),[l,u]=d(!1),[f,p]=d(!0),{data:m,error:h,isLoading:g,warning:_,queryErrors:v,setQueryErrors:y,abortFetch:b,exportData:x}=Rd({hideQuery:i,showAllSeries:l}),S=n(null),C=!o&&h,w=e=>{a(e)},T=()=>{s(!1)},E=()=>{p(!1)},D=c(async e=>{e&&x(e)},[x]);return A(`div`,{className:(0,K.default)({"vm-custom-panel":!0,"vm-custom-panel_mobile":e}),children:[A(Wo,{label:`Time series selector`,queryErrors:o?[]:v,setQueryErrors:y,setHideError:s,stats:[],isLoading:g,onHideQuery:w,onRunQuery:T,abortFetch:b,hideButtons:{traceQuery:!0,disableCache:!0},includeFunctions:!1}),f&&A(Y,{variant:`info`,children:A(`div`,{className:`vm-explore-metrics-header-description`,children:[A(`ul`,{children:[A(`li`,{children:[`This page provides a dedicated view for querying and displaying `,A(zd,{}),` from VictoriaMetrics.`]}),A(`li`,{children:[`It expects only `,A(Vd,{}),` as a query argument.`]}),A(`li`,{children:[`Deduplication can only be disabled if it was previously enabled on the server (`,A(`code`,{children:`-dedup.minScrapeInterval`}),`).`]}),A(`li`,{children:[`Users often assume that the `,A(Bd,{}),` returns data exactly as stored, but data samples and timestamps may be modified by the API.`]})]}),A(X,{variant:`text`,size:`small`,startIcon:A(_n,{}),onClick:E,ariaLabel:`close tips`})]})}),C&&A(Y,{variant:`error`,children:h}),_&&A(ms,{warning:_,query:r,onChange:u}),A(`div`,{className:(0,K.default)({"vm-custom-panel-body":!0,"vm-custom-panel-body_mobile":e,"vm-block":!0,"vm-block_mobile":e}),children:[g&&A(ts,{}),A(`div`,{className:`vm-custom-panel-body-header`,ref:S,children:[A(`div`,{className:`vm-custom-panel-body-header__tabs`,children:A(xr,{tabFilter:e=>e.value!==be.table})}),m&&A(kl,{title:`Export query`,downloadFormatOptions:[`json`,`csv`],onDownload:D})]}),A(bl,{graphData:m,liveData:m,isHistogram:!1,displayType:t,controlsRef:S})]})]})};f();var Ud=({type:e,states:t,search:n,rule_id:r,alert_id:i,group_id:a})=>{let{setSearchParamsFromKeys:o}=Zi();p(()=>{let s=Lc({type:e,states:t,search:n,alert_id:i,rule_id:r,group_id:a});o(s)},[e,t,n,r,a,i])},Wd=({kinds:e,search:t})=>{let{setSearchParamsFromKeys:n}=Zi();p(()=>{let r=Lc({kinds:e,search:t});n(r)},[e,t])},Gd=(e,t,n,r,i)=>`${e}/vmalert/api/v1/rules?datasource_type=prometheus&search=${encodeURIComponent(t)}&type=${encodeURIComponent(n)}&state=${r.map(encodeURIComponent).join(`,`)}&group_limit=${i}&extended_states=true`,Kd=(e,t,n,r)=>`${e}/vmalert/api/v1/${r}?group_id=${t}&${r}_id=${n}`,qd=(e,t)=>`${e}/vmalert/api/v1/group?group_id=${t}`,Jd=e=>`${e}/vmalert/api/v1/notifiers`;f();var Yd=100,Xd=({blockFetch:e,pageNum:t,search:n,ruleType:r,states:i,onPageChange:a})=>{let{serverUrl:o}=H(),{period:s}=W(),[c,l]=d([]),[f,m]=d(!1),[h,g]=d({page:t,total_pages:1,total_groups:0,total_rules:0}),[_,v]=d(),y=u(()=>Gd(o,n,r,i,Yd),[o,n,r,i]),b=!!c.length||!e;return p(()=>{e||(async()=>{m(!0);try{let e=`${y}&page_num=${t}`,n=await fetch(e),r=await n.json();if(n.ok){let e=r.data.groups||[];l(e),g({page:r.page||1,total_pages:r.total_pages||1,total_groups:r.total_groups||0,total_rules:r.total_rules||0}),v(void 0)}else n.status===400&&r?.error?.includes(`exceeds total amount of pages`)&&a(1)(),v(`${r.errorType}\r\n${r?.error}`)}catch(e){e instanceof Error&&v(`${e.name}: ${e.message}`)}m(!1)})().catch(console.error)},[y,s,b,t]),{groups:c,isLoading:f,error:_,pageInfo:h}};f(),s();var Zd=({types:e,allRuleTypes:t,allStates:n,states:i,search:a,onChangeRuleType:o,onChangeStates:s,onChangeSearch:c})=>{let l=u(()=>e.length?``:`No states. Please select rule states`,[e]),{isMob Line truncated
@@ -0,0 +1 @@
.vm-tabs{-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;gap:12px;height:100%;display:flex;position:relative}.vm-tabs-item{color:var(--color-primary);text-transform:capitalize;font-size:inherit;font-weight:inherit;opacity:.6;cursor:pointer;justify-content:center;align-items:center;padding:12px 8px;text-decoration:none;transition:opacity .2s;display:flex}.vm-tabs-item_active{opacity:1}.vm-tabs-item:hover{opacity:.8}.vm-tabs-item__icon{width:16px;margin-right:8px;display:grid}.vm-tabs-item__icon_single{margin-right:0}.vm-tabs__indicator{border-bottom:2px solid;border-color:var(--color-primary);transition:width .2s,left .3s cubic-bezier(.28,.84,.42,1);position:absolute}.vm-alert{z-index:8;grid-template-columns:16px 1fr;align-items:center;gap:8px;padding:12px;font-size:12px;display:grid;position:relative}.vm-alert__backdrop{background:var(--color-background-block);z-index:-1;border-radius:8px;width:100%;height:100%;position:absolute}.vm-alert:before,.vm-alert:after{content:"";z-index:-1;border-radius:8px;width:100%;height:100%;position:absolute;top:0;left:0}.vm-alert:after{opacity:.04}.vm-alert:before{opacity:.4;transform:translate(-1px,-1px)}.vm-alert__title,.vm-alert__content{white-space:pre-line;overflow-wrap:anywhere;min-width:0}.vm-alert__title{font-weight:500}.vm-alert__content{color:var(--color-text-secondary);word-break:break-word;text-wrap:pretty;grid-column:1/span 2;line-height:1.3}.vm-alert_info .vm-alert__icon{color:var(--color-info)}.vm-alert_info:after{background-color:var(--color-info)}.vm-alert_info:before{border:1px solid var(--color-info)}.vm-alert_warning .vm-alert__icon{color:var(--color-warning)}.vm-alert_warning:after{background-color:var(--color-warning)}.vm-alert_warning:before{border:1px solid var(--color-warning)}.vm-alert_error .vm-alert__icon{color:var(--color-error)}.vm-alert_error:after{background-color:var(--color-error)}.vm-alert_error:before{border:1px solid var(--color-error)}.vm-alert_success .vm-alert__icon{color:var(--color-success)}.vm-alert_success:after{background-color:var(--color-success)}.vm-alert_success:before{border:1px solid var(--color-success)}.vm-header{z-index:99;flex-wrap:wrap;justify-content:flex-start;align-items:center;gap:0 16px;min-height:51px;padding:8px 12px;display:flex}.vm-header_app{padding:8px 0}@media (width<=1000px){.vm-header{padding:8px;position:sticky;top:0}}.vm-header_sidebar{box-shadow:var(--color-background-body) 0 1px 1px 0px;justify-content:space-between;display:flex}.vm-header_dark .vm-header-button,.vm-header_dark button:before,.vm-header_dark button{background-color:var(--color-background-block)}.vm-header-logo{cursor:pointer;justify-content:flex-start;align-items:center;width:100%;min-width:75px;max-width:75px;margin-bottom:2px;display:flex;position:relative;overflow:hidden}.vm-header-logo svg{min-width:75px;max-width:75px}.vm-header-logo_mobile{order:2;min-width:75px;max-width:75px;margin:0 auto}.vm-header-nav{justify-content:flex-start;align-items:center;gap:12px;display:flex}.vm-header-nav_column{flex-direction:column;align-items:stretch;gap:8px}.vm-header-nav_column .vm-header-nav-item{padding:12px 0}.vm-header-nav_column .vm-header-nav-item_sub{justify-content:stretch}.vm-header-nav_column .vm-header-nav-item-submenu{display:none}.vm-header-nav_column .vm-header-nav-item_open .vm-header-nav-item-submenu{display:grid}.vm-header-nav-item{opacity:1;cursor:pointer;text-transform:capitalize;padding:12px 8px;font-size:14px;font-weight:400;transition:opacity .2s ease-in;position:relative}.vm-header-nav-item_sub{cursor:default;grid-template-columns:auto 14px;justify-content:center;align-items:center;gap:4px;display:grid}.vm-header-nav-item:hover{opacity:.7}.vm-header-nav-item_active{border-bottom:2px solid #110f0f33;padding:12px 8px 10px}.vm-header-nav-item svg{transition:transform .2s ease-in;transform:rotate(0)}.vm-header-nav-item_open svg{transform:rotate(180deg)}.vm-header-nav-item-submenu{color:#fff;opacity:1;transform-origin:top;border-radius:4px;padding:8px;display:grid}.vm-header-nav-item-submenu-item{cursor:pointer}.vm-popper{background-color:var(--color-background-block);box-shadow:var(--box-shadow-popper);z-index:-99;pointer-events:none;opacity:0;border-radius:4px;transition:opacity .1s ease-in-out;position:fixed}.vm-popper_open{z-index:101;opacity:1;transform-origin:top;pointer-events:auto;animation:.15s cubic-bezier(.28,.84,.42,1.1) vm-slider}.vm-popper_mobile{border-radius:0;width:100%;animation:none;position:fixed;inset:0;overflow:auto}.vm-popper-header{background-color:var(--color-background-block);color:var(--color-text);border-bottom:var(--border-divider);border-radius:4px 4px 0 0;grid-template-columns:1fr 25px;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;padding:8px 12px;display:grid}.vm-popper-header__title{-webkit-user-select:none;user-select:none;font-size:12px;font-weight:700}.vm-popper_dark{background-color:var(--color-background-tooltip);color:#fLine truncated
@@ -1 +0,0 @@
.vm-tabs{-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;gap:12px;height:100%;display:flex;position:relative}.vm-tabs-item{color:var(--color-primary);text-transform:capitalize;font-size:inherit;font-weight:inherit;opacity:.6;cursor:pointer;justify-content:center;align-items:center;padding:12px 8px;text-decoration:none;transition:opacity .2s;display:flex}.vm-tabs-item_active{opacity:1}.vm-tabs-item:hover{opacity:.8}.vm-tabs-item__icon{width:16px;margin-right:8px;display:grid}.vm-tabs-item__icon_single{margin-right:0}.vm-tabs__indicator{border-bottom:2px solid;border-color:var(--color-primary);transition:width .2s,left .3s cubic-bezier(.28,.84,.42,1);position:absolute}.vm-alert{box-shadow:var(--box-shadow);color:var(--color-text);opacity:.8;border-radius:8px;grid-template-columns:20px 1fr;align-items:center;gap:8px;padding:12px;font-size:14px;font-weight:400;line-height:1.5;display:grid;position:relative}.vm-alert_mobile{border-radius:0;align-items:flex-start}.vm-alert__icon,.vm-alert__content{z-index:2;position:relative}.vm-alert__icon{filter:brightness(.6);justify-content:center;align-self:flex-start;align-items:center;min-height:24px;display:flex}.vm-alert__content{white-space:pre-line;text-wrap:balance;overflow-wrap:anywhere;filter:brightness(.6)}.vm-alert_success{color:var(--color-success);background-color:var(--color-background-success)}.vm-alert_error{color:var(--color-error);background-color:var(--color-background-error)}.vm-alert_info{color:var(--color-info);background-color:var(--color-background-info)}.vm-alert_warning{color:var(--color-warning);background-color:var(--color-background-warning)}.vm-alert_dark .vm-alert__content,.vm-alert_dark .vm-alert__icon{filter:none}.vm-alert_dark.vm-alert_success{border:.5px solid var(--color-success)}.vm-alert_dark.vm-alert_error{border:.5px solid var(--color-error)}.vm-alert_dark.vm-alert_info{border:.5px solid var(--color-info)}.vm-alert_dark.vm-alert_warning{border:.5px solid var(--color-warning)}.vm-header{z-index:99;flex-wrap:wrap;justify-content:flex-start;align-items:center;gap:0 16px;min-height:51px;padding:8px 12px;display:flex}.vm-header_app{padding:8px 0}@media (width<=1000px){.vm-header{padding:8px;position:sticky;top:0}}.vm-header_sidebar{box-shadow:var(--color-background-body) 0 1px 1px 0px;justify-content:space-between;display:flex}.vm-header_dark .vm-header-button,.vm-header_dark button:before,.vm-header_dark button{background-color:var(--color-background-block)}.vm-header-logo{cursor:pointer;justify-content:flex-start;align-items:center;width:100%;min-width:75px;max-width:75px;margin-bottom:2px;display:flex;position:relative;overflow:hidden}.vm-header-logo svg{min-width:75px;max-width:75px}.vm-header-logo_mobile{order:2;min-width:75px;max-width:75px;margin:0 auto}.vm-header-nav{justify-content:flex-start;align-items:center;gap:12px;display:flex}.vm-header-nav_column{flex-direction:column;align-items:stretch;gap:8px}.vm-header-nav_column .vm-header-nav-item{padding:12px 0}.vm-header-nav_column .vm-header-nav-item_sub{justify-content:stretch}.vm-header-nav_column .vm-header-nav-item-submenu{display:none}.vm-header-nav_column .vm-header-nav-item_open .vm-header-nav-item-submenu{display:grid}.vm-header-nav-item{opacity:1;cursor:pointer;text-transform:capitalize;padding:12px 8px;font-size:14px;font-weight:400;transition:opacity .2s ease-in;position:relative}.vm-header-nav-item_sub{cursor:default;grid-template-columns:auto 14px;justify-content:center;align-items:center;gap:4px;display:grid}.vm-header-nav-item:hover{opacity:.7}.vm-header-nav-item_active{border-bottom:2px solid #110f0f33;padding:12px 8px 10px}.vm-header-nav-item svg{transition:transform .2s ease-in;transform:rotate(0)}.vm-header-nav-item_open svg{transform:rotate(180deg)}.vm-header-nav-item-submenu{color:#fff;opacity:1;transform-origin:top;border-radius:4px;padding:8px;display:grid}.vm-header-nav-item-submenu-item{cursor:pointer}.vm-popper{background-color:var(--color-background-block);box-shadow:var(--box-shadow-popper);z-index:-99;pointer-events:none;opacity:0;border-radius:4px;transition:opacity .1s ease-in-out;position:fixed}.vm-popper_open{z-index:101;opacity:1;transform-origin:top;pointer-events:auto;animation:.15s cubic-bezier(.28,.84,.42,1.1) vm-slider}.vm-popper_mobile{border-radius:0;width:100%;animation:none;position:fixed;inset:0;overflow:auto}.vm-popper-header{background-color:var(--color-background-block);color:var(--color-text);border-bottom:var(--border-divider);border-radius:4px 4px 0 0;grid-template-columns:1fr 25px;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;padding:8px 12px;display:grid}.vm-popper-header__title{-webkit-user-select:none;user-select:none;font-size:12px;font-weight:700}.vm-popper_dark{background-color:var(--color-background-tooltip);color:#fff}.vm-popper_dark .vm-popper-header{color:#fff;background-color:#0000}@keyframes vm-slider{0%{transform:scaleY(0)}to{transform:scaleY(1)}}.vm-mLine truncated
+203
View File
@@ -0,0 +1,203 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./vendor-U2Dx9M-W.js","./rolldown-runtime-B0Z9INg1.js","./vendor-CnsZ1jie.css"])))=>i.map(i=>d[i]);
import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{A as n,B as r,C as i,D as a,E as o,F as s,G as c,H as l,I as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,U as v,V as y,W as b,_ as x,a as S,b as C,c as w,d as T,f as E,g as D,h as O,i as k,j as A,k as j,l as M,m as N,n as P,o as F,p as I,r as ee,s as te,u as ne,v as re,w as ie,x as ae,y as L,z as oe}from"./vendor-U2Dx9M-W.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),j();var R=e(_(),1),se=e(ie(),1),ce=e(i(),1),le=e(g(),1),ue=e(ae(),1);R.default.extend(se.default),R.default.extend(ce.default),R.default.extend(ue.default),R.default.extend(le.default);var de=(e,t,n=!0)=>{let{__name__:r,...i}=e.metric,a=n?`[Query ${e.group}] `:``;if(t)return fe(e.metric,t);let o=`${a}${r||``}`;return Object.keys(i).length===0?o||`value`:`${o}{${Object.entries(i).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(`, `)}}`},fe=(e,t)=>t.replace(/\{\{(\w+)}}/g,(t,n)=>e[n]||``),pe=e=>{switch(e){case`NaN`:return NaN;case`Inf`:case`+Inf`:return 1/0;case`-Inf`:return-1/0;default:return parseFloat(e)}},me=e=>{if(e.length<2)return!1;let t=[`le`,`vmrange`],n=Object.keys(e[0].metric).filter(e=>!t.includes(e));return e.every(r=>{let i=Object.keys(r.metric).filter(e=>!t.includes(e));return n.length===i.length&&i.every(t=>r.metric[t]===e[0].metric[t])})&&e.every(e=>t.some(t=>t in e.metric))},he=e=>e.replace(/([\\./-])/g,`\\$1`),ge=`YYYY-MM-DD`,_e=`YYYY-MM-DD HH:mm:ss`,ve=`YYYY-MM-DD HH:mm:ss:SSS (Z)`,ye=`YYYY-MM-DD[T]HH:mm:ss`,be=`YYYY-MM-DD_HHmmss`,xe={seriesCountByMetricName:({query:e})=>Se(`__name__`,e),seriesCountByLabelName:({query:e})=>`{${e}!=""}`,seriesCountByFocusLabelValue:({query:e,focusLabel:t})=>Se(t,e),seriesCountByLabelValuePair:({query:e})=>{let t=e.split(`=`),n=t[0];return Se(n,t.slice(1).join(`=`))},labelValueCountByLabelName:({query:e,match:t})=>t===``?`{${e}!=""}`:`${t.replace(`}`,``)}, ${e}!=""}`},Se=(e,t)=>e?`{`+he(e)+`=`+JSON.stringify(t)+`}`:``,Ce=({searchParams:e})=>{let t=e.get(`date`)||(0,R.default)().tz().format(`YYYY-MM-DD`),n=R.default.utc(t).startOf(`day`),r=n.endOf(`day`).valueOf(),i=Date.now();return{date:n.format(ge),start:n.unix(),end:(n.valueOf()>i?r:Math.min(r,i))/1e3}},z={home:`/`,metrics:`/metrics`,dashboards:`/dashboards`,cardinality:`/cardinality`,topQueries:`/top-queries`,trace:`/trace`,withTemplate:`/expand-with-exprs`,relabel:`/relabeling`,activeQueries:`/active-queries`,queryAnalyzer:`/query-analyzer`,icons:`/icons`,query:`/query`,rawQuery:`/raw-query`,downsamplingDebug:`/downsampling-filters-debug`,retentionDebug:`/retention-filters-debug`,rules:`/rules`,notifiers:`/notifiers`},we={header:{tenant:!0,stepControl:!0,timeSelector:!0}},Te={[z.home]:{title:`Query`,...we},[z.rawQuery]:{title:`Raw query`,header:{tenant:!0,stepControl:!1,timeSelector:!0}},[z.metrics]:{title:`Explore Prometheus metrics`,header:{tenant:!0,stepControl:!0,timeSelector:!0}},[z.cardinality]:{title:`Explore cardinality`,header:{tenant:!0,cardinalityDatePicker:!0},getTenantPeriod:Ce},[z.topQueries]:{title:`Top queries`,header:{tenant:!0,timeSelector:!0}},[z.trace]:{title:`Trace analyzer`,header:{}},[z.queryAnalyzer]:{title:`Query analyzer`,header:{}},[z.dashboards]:{title:`Dashboards`,...we},[z.rules]:{title:`Rules`,header:{}},[z.notifiers]:{title:`Notifiers`,header:{}},[z.withTemplate]:{title:`WITH templates`,header:{}},[z.relabel]:{title:`Metric relabel debug`,header:{}},[z.activeQueries]:{title:`Active Queries`,header:{}},[z.icons]:{title:`Icons`,header:{}},[z.query]:{title:`Query`,...we},[z.downsamplingDebug]:{title:`Downsampling filters debug`,header:{}},[z.retentionDebug]:{title:`Retention filters debug`,header:{}}},Ee=()=>{let e=document.getElementById(`root`)?.dataset.params||`{}`;try{return JSON.parse(e)}catch(e){return console.error(e),{}}},De=()=>!!Object.keys(Ee()).length,Oe=`VMUI:`,ke=[`AUTOCOMPLETE`,`NO_CACHE`,`QUERY_TRACING`,`SERIES_LIMITS`,`LEGEND_AUTO_COLLAPSE`,`TABLE_COMPACT`,`REDUCE_MEM_USAGE`,`TIMEZONE`,`DISABLED_DEFAULT_TIMEZONE`,`THEME`,`EXPLORE_METRICS_TIPS`,`METRICS_QUERY_HISTORY`,`SERVER_URL`,`POINTS_SHOW_ALL`],Ae=e=>`${Oe}${e}`,je=(e,t,n=!0)=>{try{let r=n?Ae(e):e;t?window.localStorage.setItem(r,JSON.stringify({value:t})):window.localStorage.removeItem(r),window.dispatchEvent(new Event(`storage`))}catch(e){console.error(e)}},B=(e,t=!0)=>{let n=t?Ae(e):e,r=window.localStorage.getItem(n);if(r!==null)try{return JSON.parse(r)Line truncated
in the selected time range`}),p&&o.length>0&&!b.length&&M(`div`,{className:`vm-tenant-input-list__empty`,children:`No matching tenants`}),p&&b.map(e=>M(`div`,{className:(0,G.default)({"vm-list-item":!0,"vm-list-item_mobile":t,"vm-list-item_active":e===n}),onClick:S(e),children:e},e))]})})]}):null},$=({text:e,href:t,children:n,colored:r=!0,underlined:i=!1,withIcon:a=!1})=>M(`a`,{href:t,className:(0,G.default)({"vm-link":!0,"vm-link_colored":r,"vm-link_underlined":i,"vm-link_with-icon":a}),target:`_blank`,rel:`noreferrer`,children:e||n});j();var $i=()=>{let e=De(),{isMobile:t}=J(),{calculated:n,override:r,effective:i,setOverride:a,reset:o}=ri(),[c,l]=s(i),[d,f]=s(``),p=A(!1),{value:m,toggle:h,setFalse:g}=Z(!1),_=A(null),v=()=>{if(!p.current||d)return;let e=(c.match(/([0-9]*\.[0-9]+|[0-9]+)([a-zA-Z]+)?/g)||[]).join(``),t=(e.match(/[a-zA-Z]+/g)||[]).length?e:`${e}s`;a(t),l(t),p.current=!1},y=()=>{v(),g()},b=()=>{document.activeElement instanceof HTMLInputElement&&document.activeElement.select()},x=()=>{v(),y()},S=e=>{let t=e.replace(/,/g,`.`).replace(/[^0-9.a-zA-Z]/g,``),n=t.match(/[-+]?([0-9]*\.[0-9]+|[0-9]+)/g)||[],r=t.match(/[a-zA-Z]+/g)||[],i=n.length&&n.every(e=>parseFloat(e)>0),a=r.every(e=>St.find(t=>t.short===e)),o=i&&a;l(t),p.current=!0,f(o?``:Ie.validStep)},C=()=>{o(),l(n),f(``),p.current=!1};u(()=>{l(i),f(``),p.current=!1},[i,r]);let w=r===null?`auto (${i})`:i;return M(`div`,{className:`vm-step-control`,ref:_,children:[t?M(`div`,{className:`vm-mobile-option`,onClick:h,children:[M(`span`,{className:`vm-mobile-option__icon`,children:M(nr,{})}),M(`div`,{className:`vm-mobile-option-text`,children:[M(`span`,{className:`vm-mobile-option-text__label`,children:`Step`}),M(`span`,{className:`vm-mobile-option-text__value`,children:w})]}),M(`span`,{className:`vm-mobile-option__arrow`,children:M(In,{})})]}):M(Y,{className:e?``:`vm-header-button`,variant:`contained`,color:`primary`,startIcon:M(nr,{}),onClick:h,children:[`Step: `,w]}),M(xi,{open:m,placement:`bottom-right`,onClose:y,buttonRef:_,title:t?`Query resolution step width`:void 0,children:M(`div`,{className:(0,G.default)({"vm-step-control-popper":!0,"vm-step-control-popper_mobile":t}),children:[M(Q,{autofocus:!0,label:`Step value`,value:c,error:d,onChange:S,onEnter:x,onFocus:b,onBlur:v,endIcon:M(X,{title:`Reset to auto step (${n})`,children:M(Y,{size:`small`,variant:`text`,color:`primary`,startIcon:M(kn,{}),onClick:C,ariaLabel:`reset step`})})}),M(`div`,{className:`vm-step-control-popper-info`,children:[M(`p`,{children:[M(`code`,{children:`step`}),` - the `,M($,{href:`https://prometheus.io/docs/prometheus/latest/querying/basics/#float-literals-and-time-durations`,text:`interval`}),` between datapoints, which must be returned from the range query. The `,M(`code`,{children:`query`}),` is executed at `,M(`code`,{children:`start`}),`, `,M(`code`,{children:`start+step`}),`, `,M(`code`,{children:`start+2*step`}),`, …, `,M(`code`,{children:`end`}),` timestamps.`]}),M(`p`,{children:[`Read more about `,M($,{href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#range-query`,text:`Range`}),` and `,M($,{href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#instant-query`,text:`Instant`}),` queries.`]})]})]})})]})},ea=({relativeTime:e,setDuration:t})=>{let{isMobile:n}=J(),r=e=>()=>{t(e)};return M(`div`,{className:(0,G.default)({"vm-time-duration":!0,"vm-time-duration_mobile":n}),children:Bt.map(({id:t,duration:i,until:a,title:o})=>M(`div`,{className:(0,G.default)({"vm-list-item":!0,"vm-list-item_mobile":n,"vm-list-item_active":t===e}),onClick:r({duration:i,until:a(),id:t}),children:o||i},t))})},ta=({hasPrev:e,hasNext:t,viewDate:n,showArrowNav:r,onChangeViewDate:i,toggleDisplayYears:a})=>M(`div`,{className:`vm-calendar-header`,children:[M(`div`,{className:`vm-calendar-header-left`,onClick:a,children:[M(`span`,{className:`vm-calendar-header-left__date`,children:n.format(`MMMM YYYY`)}),M(`div`,{className:`vm-calendar-header-left__select-year`,children:M(Ln,{})})]}),r&&M(`div`,{className:`vm-calendar-header-right`,children:[M(`div`,{className:(0,G.default)({"vm-calendar-header-right__prev":!0,"vm-calendar-header-right_disabled":!e}),onClick:e?()=>{i(n.subtract(1,`month`))}:void 0,children:M(In,{})}),M(`div`,{className:(0,G.default)({"vm-calendar-header-right__next":!0,"vm-calendar-header-right_disabled":!t}),onClick:t?()=>{i(n.add(1,`month`))}:void 0,children:M(In,{})})]})]});j();var na=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],ra=({minDate:e,maxDate:t,viewDate:n,selectDate:r,onChangeSelectDate:i})=>{let a=`YYYY-MM-DD`,o=R.default.tz(),s=(0,R.default)(n.format(a)),c=f(()=>{let e=Array(42).fill(null),t=s.startOf(`month`),n=s.endOf(`month`).diff(t,`day`)+1,r=Array(n).fill(t).map((e,t)=>e.add(t,`day`)),i=t.day();return e.splice(i,n,...r),e},[s]),l=e=>()=>{e&&i(e)};return M(`div`,{className:`vm-calendar-body`,children:[na.map(e=>M(X,{title:e,children:M(`div`,{className:`vm-calendar-body-cell vm-calendar-body-cell_wee Line truncated
<path d="M24.5475 0C10.3246.0265251 1.11379 3.06365 4.40623 6.10077c0 0 12.32997 11.23333 16.58217 14.84083.8131.6896 2.1728 1.1936 3.5191 1.2201h.1199c1.3463-.0265 2.706-.5305 3.5191-1.2201 4.2522-3.5942 16.5422-14.84083 16.5422-14.84083C48.0478 3.06365 38.8636.0265251 24.6674 0"/>
<path d="M28.1579 27.0159c-.8131.6896-2.1728 1.1936-3.5191 1.2201h-.12c-1.3463-.0265-2.7059-.5305-3.519-1.2201-2.9725-2.5067-13.35639-11.87-17.26201-15.3979v5.4112c0 .5968.22661 1.3793.6265 1.7506C7.00358 21.1936 17.2675 30.5437 20.9731 33.6737c.8132.6896 2.1728 1.1936 3.5191 1.2201h.12c1.3463-.0265 2.7059-.5305 3.519-1.2201 3.679-3.13 13.9429-12.4536 16.6089-14.8939.4132-.3713.6265-1.1538.6265-1.7506V11.618c-3.9323 3.5411-14.3162 12.931-17.2354 15.3979h.0267Z"/>
<path d="M28.1579 39.748c-.8131.6897-2.1728 1.1937-3.5191 1.2202h-.12c-1.3463-.0265-2.7059-.5305-3.519-1.2202-2.9725-2.4933-13.35639-11.8567-17.26201-15.3978v5.4111c0 .5969.22661 1.3793.6265 1.7507C7.00358 33.9258 17.2675 43.2759 20.9731 46.4058c.8132.6897 2.1728 1.1937 3.5191 1.2202h.12c1.3463-.0265 2.7059-.5305 3.519-1.2202 3.679-3.1299 13.9429-12.4535 16.6089-14.8938.4132-.3714.6265-1.1538.6265-1.7507v-5.4111c-3.9323 3.5411-14.3162 12.931-17.2354 15.3978h.0267Z"/>
</svg>
`,ja=(e=`#020202`)=>{let t=new DOMParser().parseFromString(Aa,`image/svg+xml`).documentElement;if(t.localName!==`svg`)throw Error(`Invalid favicon SVG`);t.setAttribute(`fill`,e);let n=new XMLSerializer().serializeToString(t);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`},Ma=(e=`#020202`)=>{let t=document.querySelector(`#favicon`);t&&(t.href=ja(e));let n=document.querySelector(`#mask-icon`);n&&n.setAttribute(`color`,e)},Na=()=>window.location.pathname.replace(/\/+$/,``)||`/`;j();var Pa=`FAVICON_COLOR:${Na()}`,Fa=()=>B(Pa),Ia=()=>{let[e,t]=s(Fa),n=()=>{t(Fa())};return u(()=>{n()},[]),u(()=>{Ma(e)},[e]),K(`storage`,n),{faviconColor:e,changeFaviconColor:e=>{e?je(Pa,e):Me([Pa])}}},La=[`#A1A1AA`,`#71717A`,`#020202`,`#E94600`,`#FF7A00`,`#F2B705`,`#84CC16`,`#16B86A`,`#00AFAF`,`#2979FF`,`#8B5CF6`,`#E83E9A`];j();var Ra=()=>{let{faviconColor:e,changeFaviconColor:t}=Ia(),n=f(()=>ja(e),[e]),r=e=>()=>{t(e)};return M(`div`,{className:`vm-browser-tab-controller`,children:[M(`p`,{className:`vm-server-configurator__title`,children:`Favicon color`}),M(`div`,{className:`vm-browser-tab-controller-palette`,children:[M(`div`,{className:`vm-browser-tab-controller-palette-list`,children:[M(`button`,{className:`vm-browser-tab-controller-palette-list__item vm-browser-tab-controller-palette-list__item_reset`,type:`button`,onClick:r(),"aria-label":`Reset favicon color`,children:M(On,{})}),La.map(t=>M(`button`,{className:(0,G.default)({"vm-browser-tab-controller-palette-list__item":!0,"vm-browser-tab-controller-palette-list__item_selected":e===t}),type:`button`,style:{color:t},onClick:r(t),"aria-label":`Set favicon color to ${t}`,"aria-pressed":e===t},t))]}),M(`img`,{className:`vm-browser-tab-controller-palette__preview`,src:n,alt:`Favicon preview`})]})]})},za=({value:e=!1,disabled:t=!1,label:n,color:r=`secondary`,fullWidth:i,onChange:a})=>{let o=()=>{t||a(!e)},s=(0,G.default)({"vm-switch":!0,"vm-switch_full-width":i,"vm-switch_disabled":t,"vm-switch_active":e,[`vm-switch_${r}_active`]:e,[`vm-switch_${r}`]:r});return M(`div`,{className:s,onClick:o,children:[M(`div`,{className:`vm-switch-track`,children:M(`div`,{className:`vm-switch-track__thumb`})}),n&&M(`span`,{className:`vm-switch__label`,children:n})]})};j();var Ba=()=>{let e=B(`LEGEND_AUTO_COLLAPSE`),[t,n]=s(!e||e===`true`);return u(()=>{je(`LEGEND_AUTO_COLLAPSE`,`${t}`)},[t]),M(`div`,{className:`vm-legend-collapse-controller`,children:[M(za,{fullWidth:!0,color:`neutral`,value:t,onChange:n,label:M(`span`,{className:`vm-server-configurator__title`,children:`Auto-collapse legend`})}),M(`span`,{className:`vm-legend-collapse-controller__description`,children:[`Collapses the legend when series count exceeds `,100,` to reduce UI load.`]})]})};j(),b();var Va=`Settings`,Ha=a((e,t)=>{let{isMobile:n}=J(),r=De(),i=A(null),a=A(null),{value:o,setTrue:s,setFalse:c}=Z(!1),u=()=>{i.current&&i.current.handleApply(),a.current&&a.current.handleApply(),c()},f=[{show:!r,component:M(_a,{ref:i,onClose:c})},{show:!0,component:M(Ta,{})},{show:!0,component:M(ya,{ref:a,onClose:c})},{show:!0,component:M(Ba,{})},{show:!r,component:M(ka,{})},{show:!0,component:M(Ra,{})}].filter(e=>e.show);return d(t,()=>({open:s})),M(l,{children:[n?M(`div`,{className:`vm-mobile-option`,onClick:s,children:[M(`span`,{className:`vm-mobile-option__icon`,children:M(Dn,{})}),M(`div`,{className:`vm-mobile-option-text`,children:M(`span`,{className:`vm-mobile-option-text__label`,children:Va})}),M(`span`,{className:`vm-mobile-option__arrow`,children:M(In,{})})]}):M(X,{title:Va,children:M(Y,{className:(0,G.default)({"vm-header-button":!r}),variant:`contained`,color:`primary`,startIcon:M(Dn,{}),onClick:s,ariaLabel:`settings`})}),o&&M(Di,{title:Va,onClose:c,children:M(`div`,{className:(0,G.default)({"vm-server-configurator":!0,"vm-server-configurator_mobile":n}),children:[f.map((e,t)=>M(`div`,{className:`vm-server-configurator__input`,children:e.component},t)),M(`div`,{className:`vm-server-configurator-footer`,children:[M(Y,{color:`error`,variant:`outlined`,onClick:c,children:`Cancel`}),M(Y,{color:`primary`,variant:`contained`,onClick:u,children:`Apply`})]})]})})]})});j();var Ua=({onOpenSettings:e})=>{let{isMobile:t}=J(),{timezone:n}=W(),r=f(()=>Ht(n),[n]),i=()=>{e&&e()};return t?M(`button`,{className:`vm-mobile-option`,onClick:i,children:[M(`span`,{className:`vm-mobile-option__icon`,children:M(wr,{})}),M(`div`,{className:`vm-mobile-option-text`,children:[M(`span`,{className:`vm-mobile-option-text__label`,children:`Time zone`}),M(`span`,{className:`vm-mobile-option-text__value`,children:r})]}),M(`span`,{className:`vm-mobile-option__arrow`,children:M(In,{})})]}):M(Y,{className:`vm-header-button`,onClick:i,startIcon:M(wr,{}),children:r})};j();var Wa=e=>{try{let t=new URL(e).href;return Je(We(t),`0`)}catch{return Je(We(e),`0`)}},Ga=()=>{try{return!!B(`SERVER_URL`)}catch{return!1}},Ka=({onOpenSettings:e})=>{let{serverUrl:t}=H(),[n,r]=s(Ga),i=Pe(window.location.href),a=Wa(t)!==Wa(i);return u(()=>{let e=()=>r(Ga());return e(), Line truncated
This query hasn't selected any time series from database.
Either the requested metrics are missing in the database,
or there is a typo in series selector.`,io=`The shown results are marked as PARTIAL.
The result is marked as partial if one or more storage nodes failed to respond to the query.`;j();var ao=e(S(),1),oo=({value:e,onChange:t,onEnter:n,onArrowUp:r,onArrowDown:i,autocomplete:a,autocompleteEl:o,error:c,stats:l,label:d,disabled:f=!1,includeFunctions:p=!0})=>{let{autocompleteQuick:m}=hn(),{isMobile:h}=J(),[g,_]=s(!1),[v,y]=s([0,0]),[b,x]=s([0,0]),S=A(null),[C,w]=s(!1),T=A((0,ao.default)(w,500)).current,E=[{show:l?.seriesFetched===`0`&&!l.resultLength,text:ro},{show:l?.isPartial,text:io}].filter(e=>e.show).map(e=>e.text).join(``);return l&&(d=`${d} (${l.executionTimeMsec||0}ms)`),u(()=>{_(!!o&&m)},[m]),u(()=>{w(!1),T(v.every(Boolean))},[v]),M(`div`,{className:`vm-query-editor`,ref:S,children:[M(Q,{value:e,label:d,type:`textarea`,autofocus:!h,error:c,warning:E,onKeyDown:e=>{let{key:t,ctrlKey:a,metaKey:o,shiftKey:s}=e,c=(e.target.value||``).split(`
`).length>1,l=a||o,u=t===`ArrowUp`,d=t===`ArrowDown`,f=t===`Enter`;u&&l&&(e.preventDefault(),r()),d&&l&&(e.preventDefault(),i()),f&&g&&e.preventDefault(),f&&!s&&(!c||l)&&!g&&(e.preventDefault(),n())},onChange:t,onChangeCaret:e=>{y(t=>t[0]===e[0]&&t[1]===e[1]?t:e)},disabled:f,inputmode:`search`,caretPosition:b}),C&&a&&o&&M(o,{value:e,anchorEl:S,caretPosition:v,hasHelperText:!!(E||c),includeFunctions:p,onSelect:(e,n)=>{t(e),x([n,n])},onFoundOptions:e=>{_(!!e.length)}})]})};j(),b();var so=({isMobile:e,hideButtons:t})=>{let{autocomplete:n}=hn(),r=gn(),{nocache:i,isTracingEnabled:a,reduceMemUsage:o}=Br(),s=Vr(),c=()=>{s({type:`TOGGLE_NO_CACHE`})},u=()=>{s({type:`TOGGLE_REDUCE_MEM_USAGE`})},d=()=>{s({type:`TOGGLE_QUERY_TRACING`})},f=()=>{r({type:`TOGGLE_AUTOCOMPLETE`})},p=()=>{r({type:`SET_AUTOCOMPLETE_QUICK`,payload:!0})};return K(`keydown`,e=>{let{code:t,ctrlKey:n,altKey:r}=e;t===`Space`&&(n||r)&&(e.preventDefault(),p())}),M(`div`,{className:(0,G.default)({"vm-additional-settings":!0,"vm-additional-settings_mobile":e}),children:[!t?.autocomplete&&M(X,{title:M(l,{children:[`Quick tip: `,Pi]}),children:M(za,{label:`Autocomplete`,value:n,onChange:f,fullWidth:e})}),!t?.disableCache&&M(za,{label:`Disable cache`,value:i,onChange:c,fullWidth:e}),!t?.reduceMemUsage&&M(za,{label:`Disable deduplication`,value:o,onChange:u,fullWidth:e}),!t?.traceQuery&&M(za,{label:`Trace query`,value:a,onChange:d,fullWidth:e})]})},co=e=>{let{isMobile:t}=J(),n=A(null),{value:r,toggle:i,setFalse:a}=Z(!1);return t?M(l,{children:[M(`div`,{ref:n,children:M(Y,{variant:`outlined`,startIcon:M(cr,{}),onClick:i,ariaLabel:`additional the query settings`})}),M(xi,{open:r,buttonRef:n,placement:`bottom-left`,onClose:a,title:`Query settings`,children:M(so,{isMobile:t,...e})})]}):M(so,{...e})},lo=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),uo=()=>{let{serverUrl:e}=H();return async t=>{try{let n=`${e}/prettify-query?query=${encodeURIComponent(t)}`,r=await fetch(n);if(r.status!=200)return{query:t,error:`Error requesting /prettify-query, status: `+r.status};let i=await r.json();return i.status==`success`?{query:String(i.query),error:``}:{query:t,error:String(i.msg)}}catch(e){return console.error(e),e instanceof Error&&e.name!==`AbortError`?{query:t,error:`${e.name}: ${e.message}`}:{query:t,error:String(e)}}}},fo=()=>{let{showInfoMessage:e}=di();return async(t,n)=>{if(!navigator?.clipboard)return e({text:M(po,{}),type:`error`,timeout:2e4}),!1;try{return await navigator.clipboard.writeText(t),n&&e({text:n,type:`success`}),!0}catch(t){return t instanceof Error&&e({text:`${t.name}: ${t.message}`,type:`error`}),console.warn(`Copy failed`,t),!1}}},po=()=>M(`div`,{className:`vm-snackbar-details`,children:[M(`p`,{className:`vm-snackbar-details__title`,children:`Clipboard not supported`}),window.isSecureContext?M(`p`,{className:`vm-snackbar-details__msg`,children:[M(`p`,{children:`Common reasons:`}),M(`ul`,{children:[M(`li`,{children:`Browser restrictions`}),M(`li`,{children:`Insecure connection (HTTP)`}),M(`li`,{children:`Permissions not granted`})]}),M(`p`,{children:[`For detailed information, visit the `,M(`a`,{className:`vm-link vm-link_underlined vm-link_colored`,href:`https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API#security_considerations`,target:`_blank`,rel:`noopener noreferrer`,children:`Clipboard API documentation`})]})]}):M(`p`,{className:`vm-snackbar-details__msg`,children:[M(`p`,{children:`This page is not running in a secure context (HTTPS).`}),M(`p`,{children:`Clipboard operations require a secure context.`}),M(`a`,{className:`vm-link vm-link_underlined vm-link_colored`,href:`https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts`,target:`_blank`,rel:`noopener noreferrer`,children:`Learn more about secure contexts`})]})]});j();var mo=({query:e,favorites:t,onRun:n,onToggleFavorite:r})=>{let i=fo(),a=f(()=>t.includes(e),[e,t]);return M(`div`,{className:`vm-query-history-item`,children:[M(`span`,{className:`vm-query-history-item__value`,children:e}),M(`div`,{className:`vm-query-history-item__buttons`,children:[M(X,{title:`Execute query`,children:M(Y,{size:`small`,variant:`text`,onClick:()=>{n(e)},startIcon:M(Un,{})})}),M(X,{title:`Copy query`,children:M(Y,{size:`small`,variant:`text`,onClick:async()=>{await i(e,`Query has been copied`)},startIcon:M(er,{})})}),M(X,{title:a?`Remove Favorite`:`Add to Favorites`,children:M(Y,{size:`small`,variant:`text`,color:a?`warning`:`primary`,onClick:()=>{r(e,a)},startIcon:M(a?fr:dr,{})})})]})]})};j(),b();var ho={session:`session`,storage:`saved`,favorite:`favorite`},go=[{label:`Session history`,value:ho.session},{label:`Saved history`,value:ho.storage},{label:`Favorite queries`,value:ho.favorite}],_o=({handleSelectQuery:e,historyKey:t})=>{let{queryHistory:n}=hn(),{isMobile:r}=J(),{value:i,setTrue:a,setFalse:o}=Z(!1),[c,d]=s(go[0].value),[p,m]=s(rn(t,`QUERY_HISTORY`)),[h,g]=s(rn(t,`QUERY_FAVORITES`)),_=f(()=>n.map(e=>e.values.filter(e=>e).reverse()),[n]),v=f(()=>{switch(c){case ho Line truncated
To see your favorites, mark a query as a favorite.`;default:return`Query history is empty.
To see the history, please make a query.`}},[c]),x=t=>n=>{e(n,t),o()},S=(e,t)=>{g(n=>{let r=n[0]||[];return t?[r.filter(t=>t!==e)]:!t&&!r.includes(e)?[[...r,e]]:n})};return u(()=>{lo(h[0]||[],rn(t,`QUERY_FAVORITES`)[0]||[])||on(t,h)},[h]),K(`storage`,()=>{m(rn(t,`QUERY_HISTORY`)),g(rn(t,`QUERY_FAVORITES`))}),M(l,{children:[M(X,{title:`Show history`,children:M(Y,{color:`primary`,variant:`text`,onClick:a,startIcon:M(Rn,{}),ariaLabel:`Show history`})}),i&&M(Di,{title:`Query history`,onClose:o,children:M(`div`,{className:(0,G.default)({"vm-query-history":!0,"vm-query-history_mobile":r}),children:[M(`div`,{className:(0,G.default)({"vm-query-history__tabs":!0,"vm-section-header__tabs":!0,"vm-query-history__tabs_mobile":r}),children:M(Mr,{activeItem:c,items:go,onChange:d})}),M(`div`,{className:`vm-query-history-list`,children:[y&&M(`div`,{className:`vm-query-history-list__no-data`,children:b}),v.map((e,t)=>M(`div`,{children:[v.length>1&&M(`div`,{className:(0,G.default)({"vm-query-history-list__group-title":!0,"vm-query-history-list__group-title_first":t===0}),children:[`Query `,t+1]}),e.map((e,n)=>M(mo,{query:e,favorites:h.flat(),onRun:x(t),onToggleFavorite:S},n))]},t)),c===ho.storage&&!y&&M(`div`,{className:`vm-query-history-footer`,children:M(Y,{color:`error`,variant:`outlined`,size:`small`,startIcon:M(qn,{}),onClick:()=>{sn(t,`QUERY_HISTORY`)},children:`clear history`})})]})]})})]})},vo={USE_PROFILES:{html:!0},FORBID_TAGS:[`style`]},yo=new Set([`color`,`background-color`,`font-family`,`font-size`,`font-style`,`font-weight`,`font-variant`,`font-stretch`,`line-height`,`letter-spacing`,`word-spacing`,`text-align`,`text-decoration`,`text-decoration-color`,`text-decoration-line`,`text-decoration-style`,`text-transform`,`text-shadow`,`white-space`,`word-break`,`overflow-wrap`,`text-overflow`,`vertical-align`]);k.addHook(`uponSanitizeAttribute`,(e,t)=>{if(t.attrName.toLowerCase()!==`style`)return;let n=e.ownerDocument.createElement(`span`).style;n.cssText=t.attrValue;for(let e=n.length-1;e>=0;e--){let t=n.item(e).toLowerCase();yo.has(t)||n.removeProperty(t)}t.attrValue=n.cssText,t.keepAttr=n.length>0});var bo=e=>k.sanitize(e,vo),xo=e=>bo(ee.parse(e));j();var So=({value:e,tagName:t=`div`,format:n=`html`,className:r})=>{let i=f(()=>n===`markdown`?xo(e):bo(e),[n,e]);return M(t,{className:r,dangerouslySetInnerHTML:{__html:i}})};j(),b();var Co=({value:e,itemClassName:t,options:n,anchor:r,disabled:i,minLength:a=2,fullWidth:o,selected:c,noOptionsText:d,label:p,disabledFullScreen:m,offset:g,maxDisplayResults:_,loading:v,onSelect:y,onOpenAutocomplete:b,onFoundOptions:x,onChangeWrapperRef:S})=>{let{isMobile:C}=J(),w=A(null),[T,E]=s({index:-1}),[D,O]=s(``),[k,j]=s(0),{value:N,setValue:P,setFalse:F}=Z(!1),I=f(()=>{if(!N)return[];try{let t=new RegExp(String(e.trim()),`i`),r=n.filter(e=>t.test(e.value)).sort((n,r)=>n.value.toLowerCase()===e.trim().toLowerCase()?-1:r.value.toLowerCase()===e.trim().toLowerCase()?1:(n.value.match(t)?.index||0)-(r.value.match(t)?.index||0));return j(r.length),O(r.length>Number(_?.limit)&&_?.message||``),_?.limit?r.slice(0,_.limit):r}catch{return[]}},[N,n,e]),ee=f(()=>I.length===1&&I[0]?.value===e,[I]),te=f(()=>d&&!I.length,[d,I]),ne=e=>()=>{i||(y(e.value,e),c||F())},re=e=>()=>{E({index:e,type:0})},ie=()=>{E({index:-1})},ae=()=>{if(!w.current||T.type===0)return;let e=w.current.childNodes[T.index];e?.scrollIntoView&&e.scrollIntoView({block:`center`})},L=h(e=>{let{key:t,ctrlKey:n,metaKey:r,shiftKey:i}=e,a=n||r||i,o=I.length&&!ee;if(t===`ArrowUp`&&!a&&o&&(e.preventDefault(),E(({index:e})=>({index:e<=0?0:e-1,type:1}))),t===`ArrowDown`&&!a&&o){e.preventDefault();let t=I.length-1;E(({index:e})=>({index:e>=t?t:e+1,type:1}))}if(t===`Enter`){let e=I[T.index];e&&y(e.value,e),c||F()}t===`Escape`&&F()},[T,I,ee,F,y,c]);return u(()=>{P(e.length>=a)},[e,n]),K(`keydown`,L),u(ae,[T,I]),u(()=>{E({index:-1})},[I]),u(()=>{b&&b(N)},[N]),u(()=>{x&&x(ee?[]:I)},[I,ee]),u(()=>{S&&S(w)},[w]),M(xi,{open:N,buttonRef:r,placement:`bottom-left`,onClose:F,fullWidth:o,title:C?p:void 0,disabledFullScreen:m,offset:g,children:[M(`div`,{className:(0,G.default)({"vm-autocomplete":!0,"vm-autocomplete_mobile":C&&!m}),ref:w,children:[v&&M(`div`,{className:`vm-autocomplete__loader`,children:[M(Fn,{}),M(`span`,{children:`Loading...`})]}),te&&M(`div`,{className:`vm-autocomplete__no-options`,children:d}),!ee&&I.map((e,n)=>M(`div`,{className:(0,G.default)({"vm-list-item":!0,"vm-list-item_mobile":C,"vm-list-item_active":n===T.index,"vm-list-item_multiselect":c,"vm-list-item_multiselect_selected":c?.includes(e.value),"vm-list-item_with-icon":e.icon}),id:`$autocomplete$${e.value}`,onClick:ne(e),onMouseEnter:re(n),onMouseLeave:ie,children:[c?.includes(e.value)&&M(Xn,{}),M(l,{children:e.icon}),M(`div`,{className:`vm-list-item-inner ${t} ${e.value.toLowerCase().replace(` `,`-`)}`,children:M(`span`,{children:e.value})})]},`${n}${e.value}`))]}),D&&M(`div`,{className:`vm-autocomplete-message`,children:[`Shown `,_?.limit,` results out of `,k,`. `,D]}),I[T.i Line truncated
`)),icon:M(mr,{})}),Ro=e=>{let t=``;return Array.from(e).map(e=>{let n=e.tagName.toLowerCase()===Ao;return t=n?e.textContent??``:t,n?null:Lo(t,e)}).filter(Boolean)},zo=e=>{let{metricsQLFunctions:t}=hn(),n=gn(),r=e=>{let t=document.createElement(`div`);return t.innerHTML=xo(e),Ro(t.querySelectorAll(`${Ao}, ${jo}`))};return u(()=>{e&&!t.length&&(async()=>{try{let e=await(await fetch(ko)).text(),t=r(e);n({type:`SET_METRICSQL_FUNCTIONS`,payload:t})}catch(e){console.error(`Error fetching or processing the MetricsQL.md file:`,e)}})()},[e,t.length,n]),t};function Bo(e){let t=e.split(/\s(or|and|unless|default|ifnot|if|group_left|group_right)\s|}|\+|\|-|\*|\/|\^/i),n=t[t.length-1].trim(),r=n.match(/.*\(([^)]*)$/);if(r&&r[1]){let e=r[1];if(e.lastIndexOf(`{`)>e.lastIndexOf(`}`)){let t=e.match(/([\w_.:]+)\{[^}]*$/);return t?t[0]:n}let t=e.lastIndexOf(`,`);return t===-1?e:e.substring(t+1).trim()}return n}function Vo(e){let t=e.match(/([\w_.:]+(?![},]))$/);return t?t[0]:``}function Ho(e){let t=/([{(),+\-*/^]|\b(?:or|and|unless|default|ifnot|if|group_left|group_right|by|without|on|ignoring)\b)/i,n=e.split(/\s+/),r=n.length,i=n[r-1],a=n[r-2],o=!i&&Eo(e),s=(!i||n.length>1)&&!t.test(a);return o||s}function Uo(e,t=``,n=``){let r=e.trim(),i=[`}`,`)`].some(e=>r.endsWith(e)),a=!Eo(r)&&["`",`'`,`"`].some(e=>r.endsWith(e));if(!r||i||a||Ho(r))return Re.empty;let o=/(?:by|without|on|ignoring)\s*\(\s*[^)]*$|\{[^}]*$/i,s=`(${wo(t)})?{?.+${wo(n)}(=|!=|=~|!~)"?([^"]*)$`,c=new RegExp(s,`g`);switch(!0){case c.test(r):return Re.labelValue;case o.test(r):return Re.label;default:return Re.metricsql}}var Wo=(e,t)=>t[0]===t[1]?{beforeCursor:e.substring(0,t[0]),afterCursor:e.substring(t[1])}:{beforeCursor:e,afterCursor:``},Go=e=>{let t=[...e.matchAll(/\w+\((?<metricName>[^)]+)\)\s+(by|without|on|ignoring)\s*\(\w*/gi)];return t[0]?.groups?.metricName?t[0].groups.metricName:[...e.matchAll(/^\s*\b(?<metricName>[^{}(),\s]+)(?={|$)/g)][0]?.groups?.metricName||``},Ko=e=>{let t=e.match(/[a-z_:-][\w\-.:/]*\b(?=\s*(=|!=|=~|!~))/g);return t?t[t.length-1]:``},qo=(e,t)=>{let n=[...e.matchAll(/([a-z_:-][\w\-.:/]*)\s*(?:=|!=|=~|!~)\s*"[^"]*"/g)];return t?n.filter(e=>e[1]!==t).map(e=>e[0]):n.map(e=>e[0])};j(),b();var Jo=({value:e,anchorEl:t,caretPosition:n,hasHelperText:r,includeFunctions:i,onSelect:a,onFoundOptions:o})=>{let[c,d]=s({top:0,left:0}),p=zo(i),m=f(()=>Wo(e,n),[e,n]),g=f(()=>Bo(m.beforeCursor),[m.beforeCursor]),_=f(()=>Go(g),[g]),v=f(()=>Ko(g),[g]),y=f(()=>Uo(m.beforeCursor,_,v),[m.beforeCursor,_,v]),b=f(()=>Vo(m.beforeCursor),[m.beforeCursor]),{metrics:x,labels:S,labelValues:C,loading:w}=Oo({valueByContext:b,metric:_,label:v,context:y,labelMatchers:f(()=>qo(m.beforeCursor,v),[m.beforeCursor,v])}),T=f(()=>{switch(y){case Re.metricsql:return i?[...x,...p]:x;case Re.label:return S;case Re.labelValue:return C;default:return[]}},[y,x,S,C,p,i]),E=h(e=>{let t=m.beforeCursor,r=m.afterCursor,i=t.lastIndexOf(b,n[0]),o=i+b.length,s=t.substring(0,i),c=t.substring(o);if(y===Re.labelValue){r=r.replace(/^[^\s"|},]*/,``);let t=/(?:=|!=|=~|!~)$/.test(s),n=r.trim()[0]!==`"`;e=`${t?`"`:``}${e}${n?`"`:``}`}y===Re.label&&(e=he(e),r=r.replace(/^[^\s=!,{}()"|+\-/*^]*/,``)),y===Re.metricsql&&(r=r.replace(/^[^\s[\]{}()"|+\-/*^]*/,``)),a(`${s}${e}${c}${r}`,s.length+e.length)},[m.beforeCursor,m.afterCursor,b,n,y,a]);return u(()=>{if(!t.current){d({top:0,left:0});return}let e=t.current.querySelector(`textarea`)||t.current,n=window.getComputedStyle(e),i=`${n.getPropertyValue(`font-size`)}`,a=`${n.getPropertyValue(`font-family`)}`,o=parseInt(`${n.getPropertyValue(`line-height`)}`),s=document.createElement(`div`);s.style.font=`${i} ${a}`,s.style.padding=n.getPropertyValue(`padding`),s.style.lineHeight=`${o}px`,s.style.width=`${e.offsetWidth}px`,s.style.maxWidth=`${e.offsetWidth}px`,s.style.whiteSpace=n.getPropertyValue(`white-space`),s.style.overflowWrap=n.getPropertyValue(`overflow-wrap`);let c=document.createElement(`span`);s.appendChild(document.createTextNode(m.beforeCursor)),s.appendChild(c),s.appendChild(document.createTextNode(m.afterCursor)),document.body.appendChild(s);let l=s.getBoundingClientRect(),u=c.getBoundingClientRect(),f=u.left-l.left,p=u.bottom-l.bottom-(r?o:0);d({top:p,left:f}),s.remove(),c.remove()},[t,n,r,m.beforeCursor,m.afterCursor]),M(l,{children:M(Co,{loading:w,disabledFullScreen:!0,value:b,options:T,anchor:t,minLength:0,offset:c,onSelect:E,onFoundOptions:o,maxDisplayResults:{limit:ln.displayResults,message:`Please, specify the query more precisely.`}})})},Yo=`refresh`,Xo=[`Off`,`1s`,`2s`,`5s`,`10s`,`30s`,`1m`,`5m`,`15m`,`30m`,`1h`,`2h`],Zo=Xo[0],Qo=kt(Xo[Xo.length-1]),$o=e=>e?kt(e):0,es=e=>e>=1e3&&e<=Qo,ts=()=>{let[e,t]=L(),n=e.get(Yo),r=$o(n);return{refreshInterval:n&&es(r)?n:Zo,setRefreshInterval:e=>{let n=$o(e);t(t=>{let r=new URLSearchParams(t);return es(n)?r.set(Yo,e):r.delete(Yo),r})}}};j(),b();var ns=()=>{let{isMobile:e}=J(),t=$t(),{refreshInterval:n,setRefreshInterval:r}=ts(),i=A(null),{value:a,toggle:o,setFalse:s}=Z(!1),c=e=>()=>{r(e),s()};Line truncated
`);p.push(t),console.error(`Fetch query error: ${e}`,i)}m++}k(p),j(f);let _=u.length;N(_<h?`Showing ${_} series out of ${h} series due to performance reasons. Please narrow down the query, so it returns fewer series`:``),s?b({data:u,step:new URL(e[0]).searchParams.get(`step`)||``}):C(u),T(d),ee(e=>h?g:e)}catch(e){let t=e;if(t.name===`AbortError`){v(!1);return}let n=`Error executing query: ${t.message}. Please check your serverURL settings and confirm server availability.`;t.message===`Unexpected end of JSON input`&&(n+=`
Additionally, this error can occur if the server response is too large to process. Apply more specific filters to reduce the data volume.`),D(n)}v(!1)},300),[]),ne=f(()=>{let t=(e??o).filter(Boolean),i=(n||l)===V.chart;if(!c||!g||!Ue(g)||!t.length)return;let a={...c,step:r};return t.map(e=>i?os(g,e,a,d,p):ss(g,e,a,d,p))},[g,c,l,r,d,p,n,e,o]),re=h(()=>{P.forEach(e=>e.abort()),F([]),b(void 0),C([])},[P]),[ie,ae]=s([]);return u(()=>{let r=ne===ie&&!!e;t&&ne?.length&&!r&&(v(!0),te({fetchUrl:ne,displayType:n||l,query:e??o,stateSeriesLimits:m,showAllSeries:a,hideQuery:i}),ae(ne))},[ne,t,m,a]),u(()=>{let e=P.slice(0,-1);e.length&&(e.map(e=>e.abort()),F(e=>e.filter(e=>!e.signal.aborted)))},[P]),u(()=>{D(``),k([]),j([]);let t=e??o;if(c){if(!g){D(Ie.emptyServer);return}if(!Ue(g)){D(Ie.validServer);return}t.every(e=>!e.trim())&&k(t.map(()=>Ie.validQuery))}},[g,c,l,r,d,p,n,e,o]),{fetchUrl:ne,isLoading:_,graphData:x,liveData:S,error:E,queryErrors:O,setQueryErrors:k,queryStats:A,warning:M,traces:w,isHistogram:I,abortFetch:re}},gs=()=>M(`div`,{className:`vm-line-loader`,children:[M(`div`,{className:`vm-line-loader__background`}),M(`div`,{className:`vm-line-loader__line`})]});j();var _s=()=>{let{displayType:e}=Br(),{query:t}=hn(),{duration:n,relativeTime:r,period:{date:i}}=W(),[a,o]=L(),c=$t(),l=gn(),d=Vr(),[f,p]=s(!1),m=h(()=>{if(f){p(!1);return}let s=new URLSearchParams(a);t.forEach((t,o)=>{let c=`g${o}`;a.get(`${c}.expr`)!==t&&t&&s.set(`${c}.expr`,t),a.get(`${c}.range_input`)!==n&&s.set(`${c}.range_input`,n),a.get(`${c}.end_input`)!==i&&s.set(`${c}.end_input`,i),a.get(`${c}.relative_time`)!==r&&s.set(`${c}.relative_time`,r||`none`);let l=a.get(`expr.hide`)||``;l!==``&&s.set(`expr.hide`,l);let u=`${Nr.find(t=>t.value===e)?.prometheusCode||0}`;a.get(`${c}.tab`)!==u&&s.set(`${c}.tab`,`${u}`)});let c=t.length-1;Array.from(s.keys()).forEach(e=>{let t=e.match(/^g(\d+)\./);t&&parseInt(t[1],10)>c&&s.delete(e)}),!Ge(s,a)&&s.size&&o(s)},[e,t,n,r,i,a,f]);u(()=>{let e=setTimeout(m,200);return()=>clearTimeout(e)},[m]),u(()=>{if(!f)return;let a=Yt(),o=a.duration!==n,s=a.relativeTime!==r,u=a.relativeTime===`none`&&a.period.date!==i;(o||s||u)&&c({type:`SET_TIME_STATE`,payload:a});let p=Fr();p!==e&&d({type:`SET_DISPLAY_TYPE`,payload:p});let m=lt();lo(m,t)||(l({type:`SET_QUERY`,payload:m}),c({type:`RUN_QUERY`}))},[a,f]),K(`popstate`,()=>{p(!0)})},vs=M($,{text:`last_over_time`,href:`https://docs.victoriametrics.com/victoriametrics/metricsql/#last_over_time`,underlined:!0}),ys=M($,{text:`instant query`,href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#instant-query`,underlined:!0}),bs=()=>{let{effective:e}=ri();return M(`div`,{children:[M(`p`,{children:[`This tab shows `,ys,` results for the last `,e||`5m`,` (defined by the `,M(`code`,{children:`step`}),`) ending at the selected time range.`]}),M(`p`,{children:[`Please wrap the query into `,vs,` if you need results over arbitrary lookbehind interval.`]})]})},xs=({value:e,hideValue:t})=>M(`div`,{className:`vm-line-progress`,children:[M(`div`,{className:`vm-line-progress-track`,children:M(`div`,{className:`vm-line-progress-track__thumb`,style:{width:`${e}%`}})}),!t&&M(`span`,{children:[e.toFixed(2),`%`]})]});j();var Ss=({isRoot:e,trace:t,totalMsec:n,isExpandedAll:r})=>{let{isDarkTheme:i}=H(),{isMobile:a}=J(),[o,c]=s({}),l=A(null),[d,f]=s(!1),[p,m]=s(!1),h=Tt(t.duration/1e3)||`${t.duration}ms`;u(()=>{if(!l.current)return;let e=l.current,{height:t}=l.current.children[0].getBoundingClientRect();f(t>e.clientHeight)},[t]);let g=e=>{e.stopPropagation(),m(e=>!e)},_=t.children&&!!t.children.length,v=t.duration/n*100,y=e=>()=>{_&&c(t=>({...t,[e]:!t[e]}))},b=e=>{let t=[e.idValue];return e?.children?.forEach(e=>{t.push(...b(e))}),t};return u(()=>{if(!r){c([]);return}let e=b(t),n={};e.forEach(e=>{n[e]=!0}),c(n)},[r]),M(`div`,{className:(0,G.default)({"vm-nested-nav":!0,"vm-nested-nav_root":e,"vm-nested-nav_dark":i,"vm-nested-nav_mobile":a}),children:[M(`div`,{className:(0,G.default)({"vm-nested-nav-header":!0,"vm-nested-nav-header_open":o[t.idValue]}),onClick:y(t.idValue),children:[_&&M(`div`,{className:(0,G.default)({"vm-nested-nav-header__icon":!0,"vm-nested-nav-header__icon_open":o[t.idValue]}),children:M(In,{})}),M(`div`,{className:`vm-nested-nav-header__progress`,children:M(xs,{value:v})}),M(`div`,{className:(0,G.default)({"vm-nested-nav-header__message":!0,"vm-nested-nav-header__message_show-full":p}),ref:l,children:[M(`span`,{className:`vm-nested-nav-header__message_duration`,children:h}),`:\xA0`,M(`span`,{children:t.message})]}),M(`div`,{className:`vm-nested-nav-header-bottom`,children:(d||p)&&M(Y,{variant:`text`,size:`small`,onClick:g,children:p?`Hide`:`Show full query`})})]}),o[t.idValue]&&M(`div`,{className:`vm-nested-nav__childrens`,children:_&&t.children.map(e=>M(Ss,{trace:e,totalMsec:n,isExpandedAll:r},e.duration))})]})};j();var Cs=({editable:e=!1,defaultTile:t=`JSON`,displayTitle:n=!0,defaultJson:r=``,resetValue:i=``,onClose:a,onUpload:o})=>{let c=fo(),{isMobile:l}=J(), Line truncated
{YYYY}`,null,null,null,null,null,1],[86400,`{MM}-{DD}`,`
{YYYY}`,null,null,null,null,null,1],[3600,`{HH}:{mm}`,`
{YYYY}-{MM}-{DD}`,null,`
{MM}-{DD}`,null,null,null,1],[60,`{HH}:{mm}`,`
{YYYY}-{MM}-{DD}`,null,`
{MM}-{DD}`,null,null,null,1],[1,`{HH}:{mm}:{ss}`,`
{YYYY}-{MM}-{DD}`,null,`
{MM}-{DD} {HH}:{mm}`,null,null,null,1],[.001,`:{ss}.{fff}`,`
{YYYY}-{MM}-{DD} {HH}:{mm}`,null,`
{MM}-{DD} {HH}:{mm}`,null,`
{HH}:{mm}`,null,1]],Fs=(e,t)=>Array.from(new Set(e.map(e=>e.scale))).map(e=>{let n=`10px Arial`,r=ze(`color-text`),i={scale:e,show:!0,size:Rs,stroke:r,font:n,values:(e,n)=>As(e,n,t)};return e?!(Number(e)%2)&&e!==`y`?{...i,side:1}:i:{space:80,values:Ps,stroke:r,font:n}}),Is=(e,t,n,r)=>{let i=mt(t.start),a=mt(t.end),o=Ot(e)||.001,s=Math.max(.001,mt(o)),c=mt(r??i),l=(e,t)=>{let n=e%t;return n<0?n+t:n},u=mt(i+l(l(c,s)-l(i,s),s));if(u<i&&(u=mt(u+s)),u>a)return[i,a];let d=Math.floor((a-u)/s)+1,f=Math.max(1,Math.ceil(d/n)),p=Math.max(.001,mt(s*f)),m=Math.min(n,Math.floor((a-u)/p)+1),h=Array(m);for(let e=0;e<m;e++)h[e]=mt(u+e*p);return h},Ls=(e,t)=>{if(e==null||t==null)return[-1,1];let n=.02*(Math.abs(t-e)||Math.abs(e)||1);return[e-n,t+n]},Rs=(e,t,n,r)=>{let i=e.axes[n];if(r>1)return i._size||60;let a=6+(i?.ticks?.size||0)+(i.gap||0),o=(t??[]).reduce((e,t)=>t?.length>e.length?t:e,``);return o!=``&&(a+=Ms(o,`10px Arial`)),Math.ceil(a)},zs=[`#e6194b`,`#4363d8`,`#3cb44b`,`#911eb4`,`#f58231`,`#f032e6`,`#c8a200`,`#a65628`,`#42d4f4`,`#a9a9a9`],Bs=e=>{let t=e.replace(`#`,``).trim();if(t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),t.length!==6)throw Error(`Invalid HEX color.`);let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return(n*299+r*587+i*114)/1e3>=128?`#000000`:`#FFFFFF`},Vs=(e,t,n)=>{let r=[];for(let i=0;i<n;i++){let a=i/(n-1),o=e[0]+(t[0]-e[0])*a,s=e[1]+(t[1]-e[1])*a,c=e[2]+(t[2]-e[2])*a;r.push([o,s,c].map(e=>Math.round(e)).join(`, `))}return r.map(e=>`rgb(${e})`)},Hs=(e,t,n)=>Math.min(n,Math.max(t,e)),Us=e=>{let t=e.replace(`#`,``).trim();if(t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),!/^[0-9a-fA-F]{6}$/.test(t))throw Error(`Invalid HEX color.`);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},Ws=(e,t,n)=>`#${[e,t,n].map(e=>Hs(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``)}`,Gs=(e,t,n)=>{e/=255,t/=255,n/=255;let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2,o=r-i,s=0,c=0;if(o!==0){switch(c=o/(1-Math.abs(2*a-1)),r){case e:s=(t-n)/o%6;break;case t:s=(n-e)/o+2;break;case n:s=(e-t)/o+4}s*=60,s<0&&(s+=360)}return{h:s,s:c*100,l:a*100}},Ks=(e,t,n)=>{t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,o,s,c;return e<60?[o,s,c]=[r,i,0]:e<120?[o,s,c]=[i,r,0]:e<180?[o,s,c]=[0,r,i]:e<240?[o,s,c]=[0,i,r]:e<300?[o,s,c]=[i,0,r]:[o,s,c]=[r,0,i],{r:(o+a)*255,g:(s+a)*255,b:(c+a)*255}},qs=(e,t)=>{let{r:n,g:r,b:i}=Us(e),{h:a,s:o,l:s}=Gs(n,r,i),c=[{ds:0,dl:0},{ds:-20,dl:-16},{ds:-16,dl:16},{ds:14,dl:-20}],l=c[t%c.length],u=Ks(a,Hs(o+l.ds,35,85),Hs(s+l.dl,35,70));return Ws(u.r,u.g,u.b)},Js=e=>{let t=zs.length,n=e%t,r=Math.floor(e/t),i=zs[(n+r)%t];return qs(i,r)},Ys=Vs([246,226,219],[127,39,4],16),Xs=(e,t)=>{let n=e.data[t][2],r=Ys,i=1/0,a=-1/0;for(let e=0;e<n.length;e++)n[e]>0&&(i=Math.min(i,n[e]),a=Math.max(a,n[e]));if(!isFinite(i)||!isFinite(a))return n.map(()=>-1);let o=a-i;if(o===0)return n.map(e=>e>0?0:-1);let s=r.length,c=Array(n.length);for(let e=0;e<n.length;e++)c[e]=n[e]===0?-1:Math.min(s-1,Math.floor(s*(n[e]-i)/o));return c},Zs=()=>(e,t)=>{let n=Math.round(devicePixelRatio);P.orient(e,t,(r,i,a,o,s,c,l,u,d,f,p,m,h,g)=>{let[_,v,y]=e.data[t],b=_.length,x=Xs(e,t),S=Ys??[...Array.from(new Set(x))],C=S.map(()=>new Path2D),w=b-v.lastIndexOf(v[0]),T=b/w,E=v[1]-v[0],D=c(_[w]-_[0],o,f,u)-c(0,o,f,u)-n,O=l(E,s,p,d)-l(0,s,p,d)+n,k=v.slice(0,w).map(e=>Math.round(l(e,s,p,d)-O/2)),A=Array.from({length:T},(e,t)=>Math.round(c(_[t*w],o,f,u)-D));for(let e=0;e<b;e++)if(y[e]>0&&_[e]>=(o.min||-1/0)&&_[e]<=(o.max||1/0)&&v[e]>=(s.min||-1/0)&&v[e]<=(s.max||1/0)){let t=A[~~(e/w)],n=k[e%w],r=C[x[e]];g(r,t,n,D,O)}e.ctx.save(),e.ctx.rect(e.bbox.left,e.bbox.top,e.bbox.width,e.bbox.height),e.ctx.clip(),C.forEach((t,n)=>{e.ctx.fillStyle=S[n],e.ctx.fill(t)}),e.ctx.restore()})},Qs=e=>{if(!e.every(e=>e.metric.le))return e;let t=e.sort((e,t)=>parseFloat(e.metric.le)-parseFloat(t.metric.le)),n=e[0]?.group||1,r={metric:{le:``},values:[],group:n},i=[];for(let e of t){let t=[r.metric.le,e.metric.le].filter(e=>e).join(`...`),a=[];for(let[t,n]of e.values){let e=r.values.find(e=>e[0]===t)?.[1]||0,i=+n-e;a.push([t,`${i}`])}i.push({metric:{vmrange:t},values:a,group:n}),r=e}return i},$s=e=>{let t=(e.metric.vmrange||e.metric.le||``).split(`...`);return pe(t[t.length-1])},ec=(e,t)=>$s(e)-$s(t),tc=(e,t)=>{if(!t)return e;let n=Qs(e.sort(ec)),r={};n.forEach(e=>e.values.forEach(([e,t])=>{let n=Number(t),i=isNaN(n)?0:n,a=r[e]||0;r[e]=a+i}));let i=n.map(e=>{let t=e.values.map(([e,t])=>{let n=r[e];return[e,`${Math.round(+t/n*100)}`]});return{...e,values:t}}),a=i.map((e,t)=>e.values.every(e=>e[1]===`0`)?-1:t).filter(e=>e!==-1),o=a.length;if(o===0||i.length<=3)return i;if(o>1)return i.filter((e,t)=>a.includes(t));let s=a[0],c=new Set([s]);return s-1>=0&&c.add(s-1),s+1<i.length&&c.add(s+1),i.filter((e,t)=>c.has(t))},nc=e=>{Object.keys(e.hooks).forEach(t=>{e.hooks[t]=[]})},rc=2*Math.PI,ic=4,ac=1.2,oc=(e,t)=>{let n=ic*P.pxRatio,r=n/2,i=n*ac,a=i/2;return P Line truncated
`).filter(e=>e).forEach(e=>{let t=Il(e);t&&n.push({metric:t.metric,values:t.values.map((e,n)=>[t.timestamps[n]/1e3,e])})}):v(String(r)),{data:{result:n,resultType:`matrix`},vmui:re(t)}},ae=async(e,t)=>{let n=await e.json();if(e.ok)return n.vmui=re(t),n;{let e=n.errorType?`${n.errorType}\r\n`:``;v(`${e}${n?.error||n?.message||`unknown error`}`)}},L=async(e,n)=>{switch(t){case 1:return await ie(e,n);default:return await ae(e,n)}},oe=h(async()=>{let e=te();if(!e){v(e=>e||Ie.validQuery);return}v(``),b(!0);try{let t=[];for await(let n of e){if(!n)continue;let{url:e,id:r}=n,i=await fetch(e),o=await L(i,{id:r,url:e,comment:f,title:a});t.push(o)}t.length&&ne(t)}catch(e){e instanceof Error&&e.name!==`AbortError`&&v(`${e.name}: ${e.message}`)}finally{b(!1)}},[te,f,ne,n,a]),R=e=>()=>{let t=n=>{let r=n+e;return D[r]?.current?r:t(r)};k(t)};return u(()=>{v(``),d(i),p(``)},[j]),u(()=>{k(0)},[F]),M(l,{children:[M(X,{title:`Debug query`,children:M(Y,{variant:`text`,startIcon:M(Cr,{}),onClick:N,ariaLabel:`Debug query`})}),j&&M(Di,{title:`Debug query`,onClose:P,isOpen:j,children:M(`div`,{className:`vm-download-report`,children:[M(`div`,{className:`vm-download-report-settings`,children:[M(`div`,{ref:S,children:[M(`div`,{className:`vm-download-report-settings__title`,children:`Filename`}),M(Q,{value:c,onChange:d})]}),M(`div`,{ref:x,children:[M(`div`,{className:`vm-download-report-settings__title`,children:`Report title`}),M(Q,{value:a,onChange:o})]}),M(`div`,{ref:C,children:[M(`div`,{className:`vm-download-report-settings__title`,children:`Comment`}),M(Rl,{value:f,onChange:p})]}),t===0&&M(l,{children:[M(`div`,{ref:w,children:M(ga,{checked:m,onChange:g,label:`Include query trace`})}),M(q,{variant:`info`,title:`Inspect raw samples`,children:[`To better understand the query results, view the raw samples for selected series in the `,M(()=>M(T,{className:`vm-link vm-link_underlined vm-link_colored`,to:z.rawQuery,children:`Raw Query`}),{}),` tab.`]})]})]}),_&&M(q,{variant:`error`,title:`Unable to generate report`,children:_}),M(`div`,{className:`vm-download-report__buttons`,children:[M(Y,{variant:`text`,onClick:I,children:`Help`}),M(`div`,{ref:E,children:M(Y,{onClick:oe,disabled:y,children:y?`Loading data...`:`Generate Report`})})]}),M(xi,{open:F,buttonRef:D[O],placement:`top-left`,variant:`dark`,onClose:ee,children:M(`div`,{className:`vm-download-report-helper`,children:[M(`div`,{className:`vm-download-report-helper__description`,children:Fl[O]}),M(`div`,{className:`vm-download-report-helper__buttons`,children:[O!==0&&M(Y,{onClick:R(-1),size:`small`,color:`white`,children:`Prev`}),M(Y,{onClick:O===D.length-1?ee:R(1),size:`small`,color:`white`,variant:`text`,children:O===D.length-1?`Close`:`Next`})]})]})})]})})]})},Hl=()=>{let{isEmptyHistogram:e}=Kr(),{handleChange:t}=xl();return e?M(q,{variant:`warning`,title:`Unable to display heatmap`,children:M(`div`,{className:`vm-warning-heatmap-to-line`,children:[M(`p`,{className:`vm-warning-heatmap-to-line__text`,children:`Switch to a line chart, disable the heatmap in the "Graph settings", or modify the expression to return histogram data.`}),M(Y,{size:`small`,color:`primary`,variant:`text`,onClick:()=>t(!1),children:`Switch to line chart`})]})}):null};j(),b();var Ul=({title:e,downloadFormatOptions:t,onDownload:n})=>{let{value:r,setTrue:i,setFalse:a}=Z(!1),o=A(null),s=h(()=>{if(r){a();return}t&&t.length>0?i():(n(),a())},[n,a,r,i]),c=h(e=>t?.includes(e),[t]),u=h(e=>{let t=e.currentTarget.textContent;t&&c(t)?n(t):n(),a()},[n]);return M(l,{children:[M(`div`,{ref:o,children:M(X,{title:e,children:M(Y,{variant:`text`,startIcon:M(_r,{}),onClick:s,ariaLabel:e})})}),t&&t.length>0&&M(xi,{open:r,onClose:a,buttonRef:o,placement:`bottom-right`,children:t.map(e=>M(`div`,{className:`vm-download-button__format-option`,children:M(Y,{variant:`text`,onClick:u,className:`vm-download-button__format-option-button`,children:e})},e))})]})},Wl=e=>e.includes(`,`)||e.includes(`
`)||e.includes(`"`)?`"`+e.replace(/"/g,`""`)+`"`:e,Gl=e=>[`__name__`,...Array.from(new Set(e.filter(e=>e&&e!==`__name__`))).sort(),`__value__`,`__timestamp__:unix_ms`],Kl=e=>[...Ol(e).map(({key:e})=>e),`__timestamp__`,`__value__`].join(`,`),ql=(e,t)=>e?.map(e=>{let n=t.map(t=>Wl(e.metric[t.key]||`-`)),r=e.value?Wl(String(e.value[0])):`-`,i=e.value?Wl(e.value[1]):`-`;return[...n,r,i].join(`,`)}),Jl=e=>e.length?[Kl(e),...ql(e,Ol(e))].join(`
`):``;j();var Yl=()=>{_s();let{isMobile:e}=J(),{displayType:t}=Br(),{query:n}=hn(),{effective:r}=ri(),i=qr(),[a,o]=s([]),[c,l]=s(!n[0]),[d,p]=s(!1),m=A(null),{fetchUrl:g,isLoading:_,liveData:v,graphData:y,error:b,queryErrors:x,setQueryErrors:S,queryStats:C,warning:w,traces:T,isHistogram:E,abortFetch:D}=hs({visible:!0,customStep:r,hideQuery:a,showAllSeries:d}),O=f(()=>{let e=e=>`vmui_export_${n.join(`_`)}.${e}`;return{csv:async()=>{v&&Ts(Jl(v),e(`csv`))},json:async()=>{Es(JSON.stringify(v),e(`json`))}}},[v,n]),k=h(e=>{e&&O[e]()},[O]),j=!v?.length&&t!==V.chart,N=!c&&b,P=h(e=>{o(e)},[]),F=h(()=>{l(!1)},[]);return u(()=>{i({type:`SET_IS_HISTOGRAM`,payload:E})},[E]),M(`div`,{className:(0,G.default)({"vm-custom-panel":!0,"vm-custom-panel_mobile":e}),children:[M(as,{queryErrors:c?void 0:x,setQueryErrors:S,setHideError:l,stats:C,isLoading:_,onHideQuery:P,onRunQuery:F,abortFetch:D,hideButtons:{reduceMemUsage:!0}}),M(Os,{traces:T,displayType:t}),N&&M(q,{variant:`error`,title:`Unable to load query results`,children:b}),j&&M(q,{variant:`info`,title:`Instant query results`,children:M(bs,{})}),M(Hl,{}),w&&M(ks,{warning:w,query:n,onChange:p}),M(`div`,{className:(0,G.default)({"vm-custom-panel-body":!0,"vm-custom-panel-body_mobile":e,"vm-block":!0,"vm-block_mobile":e}),children:[_&&M(gs,{}),M(`div`,{className:`vm-custom-panel-body-header`,ref:m,children:[M(`div`,{className:`vm-custom-panel-body-header__tabs`,children:M(Pr,{})}),t===`table`&&M(Ul,{title:`Export query`,onDownload:k,downloadFormatOptions:[`json`,`csv`]}),(y||v)&&t!==`code`&&M(Vl,{fetchUrl:g})]}),M(Pl,{graphData:y,liveData:v,isHistogram:E,displayType:t,controlsRef:m})]})]})},Xl=({containerStyles:e,message:t})=>{let{isDarkTheme:n}=H();return M(`div`,{className:(0,G.default)({"vm-spinner":!0,"vm-spinner_dark":n}),style:e,children:[M(`div`,{className:`half-circle-spinner`,children:[M(`div`,{className:`circle circle-1`}),M(`div`,{className:`circle circle-2`})]}),t&&M(`div`,{className:`vm-spinner__message`,children:t})]})};j(),b();var Zl=({title:e,description:t,unit:n,expr:r,showLegend:i,filename:a,alias:o})=>{let{isMobile:c}=J(),{period:d}=W(),{effective:p}=ri(),m=$t(),h=A(null),[g,_]=s(!1),[v,y]=s(!1),[b,x]=s(!1),[S,C]=s({limits:{enable:!1,range:{1:[0,0]}}}),w=f(()=>Array.isArray(r)&&r.every(e=>e),[r]),{isLoading:T,graphData:E,error:D,warning:O}=hs({predefinedQuery:w?r:[],display:V.chart,visible:g,customStep:p}),k=e=>{let t={...S};t.limits.range=e,C(t)};return u(()=>{let e=new IntersectionObserver(e=>{e.forEach(e=>_(e.isIntersecting))},{threshold:.1});return h.current&&e.observe(h.current),()=>{h.current&&e.unobserve(h.current)}},[h]),w?M(`div`,{className:`vm-predefined-panel`,ref:h,children:[M(`div`,{className:`vm-predefined-panel-header`,children:[M(X,{title:M(()=>M(`div`,{className:`vm-predefined-panel-header__description vm-default-styles`,children:[t&&M(l,{children:[M(`div`,{children:[M(`span`,{children:`Description:`}),M(So,{tagName:`div`,value:t,format:`markdown`})]}),M(`hr`,{})]}),M(`div`,{children:[M(`span`,{children:`Queries:`}),M(`div`,{children:r.map((e,t)=>M(`div`,{children:e},`${t}_${e}`))})]})]}),{}),children:M(`div`,{className:`vm-predefined-panel-header__info`,children:M(An,{})})}),M(`h3`,{className:`vm-predefined-panel-header__title`,children:e||``}),M(Tl,{data:E||[],yaxis:S,setYaxisLimits:k,toggleEnableLimits:()=>{let e={...S};e.limits.enable=!e.limits.enable,C(e)},spanGaps:{value:v,onChange:y},showAllPoints:{value:b,onChange:x}})]}),M(`div`,{className:`vm-predefined-panel-body`,children:[T&&M(Xl,{}),D&&M(q,{variant:`error`,title:`Unable to load query results`,children:D}),O&&M(q,{variant:`warning`,title:`Series limit reached`,children:O}),E&&M(vl,{isPredefinedPanel:!0,data:E,period:d,customStep:p,query:r,yaxis:S,unit:n,alias:o,showLegend:i,setYaxisLimits:k,setPeriod:({from:e,to:t})=>{m({type:`SET_PERIOD`,payload:{from:e,to:t}})},fullWidth:!1,height:c?window.innerHeight*.5:500,spanGaps:v,showAllPoints:b})]})]}):M(q,{variant:`error`,title:`Missing panel query`,children:[M(`code`,{children:`"expr"`}),` not found. Check the configuration file `,M(`b`,{children:a}),`.`]})};j();var Ql=({index:e,title:t,panels:n,filename:r})=>{let i=jr(),a=f(()=>i.width/12,[i]),[o,c]=s(!e),[l,d]=s([]);u(()=>{d(n&&n.map(e=>e.width||12))},[n]);let[p,m]=s({start:0,target:0,enable:!1}),g=h(e=>{if(!p.enable)return;let{start:t}=p,n=Math.ceil((t-e.clientX)/a);if(Math.abs(n)>=12)return;let r=l.map((e,t)=>e-(t===p.target?n:0));d(r)},[p,a]),_=(e,t)=>{m({start:e.clientX,target:t,enable:!0})},v=h(()=>{m({...p,enable:!1})},[p]),y=e=>c(e),b=e=>t=>{_(t,e)};return K(`mousemove`,g),K(`mouseup`,v),M(`div`,{className:`vm-predefined-dashboard`,children:M(ba,{defaultExpanded:o,onChange:y,title:M(()=>M(`div`,{className:(0,G.default)({"vm-predefined-dashboard-header":!0,"vm-predefined-dashboard-header_open":o}),children:[(t||r)&&M(`span`,{className:`vm-predefined-dashboard-header__title`,children:t||`${e+1}. ${r}`}),n&&M(`span`,{className:`vm-predefined-dashboard-header__count`,children:[ Line truncated
<p>
This table returns a list of metrics with the highest cardinality.
The cardinality of a metric is the number of time series associated with that metric,
where each time series is defined as a unique combination of key-value label pairs.
</p>
<p>
When looking to reduce the number of active series in your data source,
you can start by inspecting individual metrics with high cardinality
(i.e. that have lots of active time series associated with them),
since that single metric contributes a large fraction of the series that make up your total series count.
</p>`,seriesCountByLabelName:`
<p>
This table returns a list of the labels with the highest number of series.
</p>
<p>
Use this table to identify labels that are storing dimensions with high cardinality
(many different label values).
</p>
<p>
It is recommended to choose labels such that they have a finite set of values,
since every unique combination of key-value label pairs creates a new time series
and therefore can dramatically increase the number of time series in your system.
</p>`,seriesCountByFocusLabelValue:`
<p>
This table returns a list of unique label values per selected label.
</p>
<p>
Use this table to identify label values that are storing per each selected series.
</p>`,labelValueCountByLabelName:`
<p>
This table returns a list of labels with the highest number of the unique values.
</p>
`,seriesCountByLabelValuePair:`
<p>
This table returns a list of the label values pairs with the highest number of series.
</p>
<p>
Use this table to identify unique label values pairs. This helps to identify same labels
is applied to count timeseries in your system, since every unique combination of key-value label pairs
creates a new time series and therefore can dramatically increase the number of time series in your system
</p>`}}get tablesHeaders(){return{seriesCountByMetricName:su,seriesCountByLabelName:cu,seriesCountByFocusLabelValue:lu,seriesCountByLabelValuePair:uu,labelValueCountByLabelName:du}}totalSeries(e,t=!1){return e===`labelValueCountByLabelName`?-1:t?this.tsdbStatus.totalSeriesPrev:this.tsdbStatus.totalSeries}};j();var pu=()=>{let e=new fu,[t]=L(),n=t.get(`match`),r=t.get(`focusLabel`),i=+(t.get(`topN`)||10),a=t.get(`date`)||(0,R.default)().tz().format(`YYYY-MM-DD`),o=fa(a),c=A(),{tenantId:l,serverUrl:d}=H(),[f,p]=s(!1),[m,h]=s(),[g,_]=s(e.defaultTSDBStatus),[v,y]=s(e.defaultMetricNameStats),[b,x]=s(!1),S=async e=>{let t=await fetch(e),n=await t.json();if(t.ok)return n;console.error(`Error fetching ${e}:`,n);let r=[n.errorType||Ie.unknownType,n?.error||n?.message||`see console for more details`].join(`\r
`);throw Error(r)},C=(e,t)=>{Object.keys(e).forEach(n=>{let r=n,i=e[r],a=t[r];Array.isArray(i)&&Array.isArray(a)&&i.forEach(e=>{let t=a.find(t=>t.name===e.name)?.value,n=t?e.value-t:0,r=t?n/t*100:0;e.diff=n,e.diffPercent=r,e.valuePrev=t||0})})},w=async t=>{if(!d)return;h(``),p(!0),_(e.defaultTSDBStatus);let r={...t,date:t.date,topN:0,match:``,focusLabel:``},i={...t,date:(0,R.default)(t.date).subtract(1,`day`).format(ge)},s=[tu(d,t),tu(d,i)];o!==a&&(t.match||t.focusLabel)&&s.push(tu(d,r));try{let[e,t,r]=await Promise.all(s.map(S)),i={...t.data},{data:a}=r||c.current||e;c.current={data:a};let o={...e.data,totalSeries:e.data?.totalSeries||e.data?.headStats?.numSeries||0,totalLabelValuePairs:e.data?.totalLabelValuePairs||e.data?.headStats?.numLabelValuePairs||0,seriesCountByLabelName:e.data?.seriesCountByLabelName||[],seriesCountByFocusLabelValue:e.data?.seriesCountByFocusLabelValue||[],totalSeriesByAll:a?.totalSeries||a?.headStats?.numSeries||g.totalSeriesByAll||0,totalSeriesPrev:i?.totalSeries||i?.headStats?.numSeries||0},l=n?.replace(/[{}"]/g,``);o.seriesCountByLabelValuePair=o.seriesCountByLabelValuePair.filter(e=>e.name!==l),C(o,i),_(o),p(!1)}catch(e){p(!1),e instanceof Error&&h(`${e.name}: ${e.message}`)}},T=async()=>{if(!d)return;h(``),p(!0);let t=nu(d,{limit:1});try{let e=await S(t);y(e),p(!1)}catch(t){p(!1),y(e.defaultMetricNameStats),console.error(t)}};return u(()=>{w({topN:i,match:n,date:a,focusLabel:r})},[d,n,r,i,a]),u(()=>{T()},[d]),u(()=>{m&&(_(e.defaultTSDBStatus),p(!1))},[m]),u(()=>{x(!!l)},[l]),e.tsdbStatusData=g,e.metricNameStatsData=v,{isLoading:f,appConfigurator:e,error:m,isCluster:b}};b();var mu=({metricNameStats:e})=>{let{statsCollectedSince:t,statsCollectedRecordsTotal:n=0,trackerMemoryMaxSizeBytes:r=0,trackerCurrentMemoryUsageBytes:i=0}=e,a=t?R.default.unix(t).format(_e):` - `,o=r?`${(i/r*100).toFixed(2)}%`:` - `,s=n.toLocaleString(`en-US`);return M(`div`,{className:`vm-cardinality-totals-card`,children:[M(`h4`,{className:`vm-cardinality-totals-card__title`,children:[M(X,{placement:`bottom-left`,title:M(`div`,{className:`vm-cardinality-totals-card__tooltip`,children:t?M(l,{children:[M(`p`,{children:[`Total entries in cache since `,a]}),M(`p`,{children:[`Cache utilization: `,o]})]}):M(l,{children:[M(`p`,{children:`Metric names tracker is likely disabled.`}),M(`p`,{children:`No data available. See documentation for enabling the metric names tracker.`})]})}),children:M(`div`,{className:`vm-cardinality-totals-card__info-icon`,children:M(jn,{})})}),`Total metric names`]}),M(`span`,{className:`vm-cardinality-totals-card__value`,children:s}),M(`span`,{className:`vm-cardinality-totals-card__link`,children:M($,{href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#track-ingested-metrics-usage`,children:`Docs ↗`})})]})},hu=({totalSeries:e=0,totalSeriesPrev:t=0,totalSeriesAll:n=0,metricNameStats:r,isPrometheus:i})=>{let{isMobile:a}=J(),[o]=L(),s=o.get(`match`),c=o.get(`focusLabel`),l=/__name__/.test(s||``),u=!(s||c),d=e/n*100,f=e-t,p=Math.abs(f)/t*100,m=[{title:`Total series`,value:e.toLocaleString(`en-US`),dynamic:!e||!t||i?``:`${p.toFixed(2)}%`,display:!c,info:`The total number of unique time series for a selected day.
A time series is uniquely identified by its name plus a set of its labels.
For example, temperature{city="NY",country="US"} and temperature{city="SF",country="US"}
are two distinct series, since they differ by the "city" label.`},{title:`Percentage from total`,value:isNaN(d)?`-`:`${d.toFixed(2)}%`,display:l,info:`The share of these series in the total number of time series.`}].filter(e=>e.display);return!m.length&&!u?null:M(`div`,{className:(0,G.default)({"vm-cardinality-totals":!0,"vm-cardinality-totals_mobile":a}),children:[m.map(({title:e,value:n,info:r,dynamic:i})=>M(`div`,{className:`vm-cardinality-totals-card`,children:[M(`h4`,{className:`vm-cardinality-totals-card__title`,children:[r&&M(X,{title:M(`p`,{className:`vm-cardinality-totals-card__tooltip`,children:r}),children:M(`div`,{className:`vm-cardinality-totals-card__info-icon`,children:M(jn,{})})}),e]}),M(`span`,{className:`vm-cardinality-totals-card__value`,children:n}),!!i&&M(X,{title:`in relation to the previous day: ${t.toLocaleString(`en-US`)}`,placement:`bottom-left`,children:M(`span`,{className:(0,G.default)({"vm-dynamic-number":!0,"vm-dynamic-number_positive vm-dynamic-number_down":f<0,"vm-dynamic-number_negative vm-dynamic-number_up":f>0}),children:i})})]},e)),u&&M(mu,{metricNameStats:r})]})};j();var gu=(e,t)=>{let[n]=L(),r=n.get(t)?n.get(t):e,[i,a]=s(r);return u(()=>{r!==i&&a(r)},[r]),[i,a]};j();var _u=10,vu=({isPrometheus:e,isCluster:t,...n})=>{let{isMobile:r}=J(),[i]=L(),{setSearchParamsFromKeys:a}=ma(),o=i.get(`tips`)||``,[s,c]=gu(``,`match`),[l,d]=gu(``,`focusLabel`),[p,m]=gu(_u,`topN`),h=!!(s||l||p!==_u&&!e),g=f(()=>p<0?`Number must be bigger than zero`:``,[p]),_=e=>{let t=+e;m(isNaN(t)?0:t)},v=()=>{a({match:s,topN:p,focusLabel:l})},y=()=>{a({match:``,focusLabel:``,topN:``}),c(``),d(``),m(_u)},b=()=>{let e=i.get(`tips`)||``;a({tips:e?``:`true`})};return u(()=>{let e=i.get(`match`),t=+(i.get(`topN`)||_u),n=i.get(`focusLabel`);e!==s&&c(e||``),t!==p&&m(t),n!==l&&d(n||``)},[i]),M(`div`,{className:(0,G.default)({"vm-cardinality-configurator":!0,"vm-cardinality-configurator_mobile":r,"vm-block":!0,"vm-block_mobile":r}),children:[M(`div`,{className:`vm-cardinality-configurator-controls`,children:[M(`div`,{className:`vm-cardinality-configurator-controls__query`,children:M(Q,{label:`Time series selector`,type:`string`,value:s,onChange:c,onEnter:v})}),M(`div`,{className:`vm-cardinality-configurator-controls__item`,children:M(Q,{label:`Focus label`,type:`text`,value:l||``,onChange:d,onEnter:v,endIcon:M(X,{title:M(`div`,{children:M(`p`,{children:`To identify values with the highest number of series for the selected label.`})}),children:M(ar,{})})})}),M(`div`,{className:`vm-cardinality-configurator-controls__item vm-cardinality-configurator-controls__item_limit`,children:M(Q,{label:`Limit entries`,type:`number`,value:e?_u:p,error:g,disabled:e,helperText:e?`not available for Prometheus`:``,onChange:_,onEnter:v})})]}),M(`div`,{className:`vm-cardinality-configurator-bottom`,children:[M(hu,{isPrometheus:e,isCluster:t,...n}),t&&M(`div`,{className:`vm-cardinality-configurator-bottom-helpful`,children:M($,{href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#cardinality-explorer-statistic-inaccuracy`,withIcon:!0,children:[M(rr,{}),`Statistic inaccuracy explanation`]})}),M(`div`,{className:`vm-cardinality-configurator-bottom-helpful`,children:M($,{href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#cardinality-explorer`,withIcon:!0,children:[M(rr,{}),`Documentation`]})}),M(`div`,{className:`vm-cardinality-configurator-bottom__execute`,children:[M(X,{title:o?`Hide tips`:`Show tips`,children:M(Y,{variant:`text`,color:o?`warning`:`gray`,startIcon:M(lr,{}),onClick:b,ariaLabel:`visibility tips`})}),M(Y,{variant:`text`,startIcon:M(kn,{}),onClick:y,disabled:!h,children:`Reset filters`}),M(Y,{startIcon:M(Hn,{}),onClick:v,children:`Execute Query`})]})]})]})};function yu(e){let{order:t,orderBy:n,onRequestSort:r,headerCells:i}=e,a=e=>t=>{r(t,e)};return M(`thead`,{className:`vm-table-header vm-cardinality-panel-table__header`,children:M(`tr`,{className:`vm-table__row vm-table__row_header`,children:i.map(e=>M(`th`,{className:(0,G.default)({"vm-table-cell vm-table-cell_header":!0,"vm-table-cell_sort":e.sortable,"vm-table-cell_right":e.id===`action`}),onClick:e.sortable?a(e.id):void 0,children:M(`div`,{className:`vm-table-cell__content`,children:[e.info&&M(X,{title:e.info,children:M(`div`,{className:`vm-metrics-content-header__tip-icon`,children:M(jn,{})})}),e.label,e.sortable&&M(`div`,{className:(0,G.default)({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":n===e.id,"vm-table__sort-icon_desc":t===`desc`&&n===e.id}),children:M(Ln,{})})]})},e.id))})})}var bu=[`date`,`timestamp`,`time`];function xu(e,t,n){let r=e[n],i=t[n];if(r==null&&i==null)return 0;if(r==null)return 1;if(i==null)return-1;let a=String(r),o=String(i);if(bu.includes(String(n))){let e=qt(a),t=qt(o);return t<e?-1:+(t>e)}let s=Number(a),c=Number(o);return!isNaN(s)&&!isNaN(c)?c-s:o<a?-1:+(o>a)}function Su(e,t){return e===`desc`?(e,n)=>xu(e,n,t):(e,n)=>-xu(e,n,t)}function Cu(e,t){let Line truncated
This may take some time if the db contains big number of time series.`,Pu=()=>{let{isMobile:e}=J(),[t]=L(),{setSearchParamsFromKeys:n}=ma(),r=t.get(`tips`)||``,i=t.get(`match`)||``,a=t.get(`focusLabel`)||``,{isLoading:o,appConfigurator:s,error:c,isCluster:l}=pu(),{tsdbStatusData:u,metricNameStatsData:d,getDefaultState:f,tablesHeaders:p,sectionsTips:m}=s,h=f(i,a),g=e=>t=>{let r=t,o=[`labelValueCountByLabelName`,`seriesCountByLabelName`].includes(e);o&&(t=he(t));let s={match:xe[e]({query:t,focusLabel:a,match:i})};o&&(s.focusLabel=r),e===`seriesCountByFocusLabelValue`&&(s.focusLabel=``),n(s)};return M(`div`,{className:(0,G.default)({"vm-cardinality-panel":!0,"vm-cardinality-panel_mobile":e}),children:[o&&M(Xl,{message:Nu}),M(vu,{isPrometheus:s.isPrometheusData,totalSeries:u.totalSeries,totalSeriesPrev:u.totalSeriesPrev,totalSeriesAll:u.totalSeriesByAll,totalLabelValuePairs:u.totalLabelValuePairs,seriesCountByMetricName:u.seriesCountByMetricName,metricNameStats:d,isCluster:l}),r&&M(`div`,{className:`vm-cardinality-panel-tips`,children:[!i&&!a&&M(ku,{}),i&&!a&&M(ju,{}),!i&&!a&&M(Au,{}),a&&M(Mu,{})]}),c&&M(q,{variant:`error`,children:c}),s.keys(i,a).map(e=>M(Du,{sectionTitle:s.sectionsTitles(a)[e],tip:m[e],rows:u[e],onActionClick:g(e),tabs:h.tabs[e],chartContainer:h.containerRefs[e],totalSeriesPrev:s.totalSeries(e,!0),totalSeries:s.totalSeries(e),tableHeaderCells:p[e],isPrometheus:s.isPrometheusData},e))]})},Fu=(e,t,n)=>`${e}/api/v1/status/top_queries?topN=${t||``}&maxLifetime=${n||``}`;j();var Iu=(e,t)=>{let{query:n,timeRangeSeconds:r}=e,i=[`g0.expr=${encodeURIComponent(n)}`],a=Bt.find(e=>e.duration===t)?.id;return a&&i.push(`g0.relative_time=${a}`),r&&i.push(`g0.range_input=${t}`),`${z.home}?${i.join(`&`)}`},Lu=e=>([`topByAvgDuration`,`topByCount`,`topBySumDuration`,`topByAvgMemoryUsage`].forEach(t=>{let n=e[t];Array.isArray(n)&&n.forEach(e=>{let t=Lt(e.timeRangeSeconds*1e3);e.url=Iu(e,t),e.timeRange=t||`instant`})}),e),Ru=({topN:e,maxLifetime:t})=>{let{serverUrl:n}=H(),{setSearchParamsFromKeys:r}=ma(),[i,a]=s(null),[o,c]=s(!1),[l,d]=s(),p=A(),m=f(()=>Fu(n,e,t),[n,e,t]),g=h(async()=>{p.current?.abort();let n=new AbortController;p.current=n,c(!0),r({topN:e,maxLifetime:t});try{let e=await fetch(m,{signal:n.signal}),t=await e.json();if(n.signal.aborted)return;a(e.ok?Lu(t):null),d(String(t.error||``))}catch(e){!n.signal.aborted&&e instanceof Error&&d(`${e.name}: ${e.message}`)}finally{p.current===n&&(p.current=void 0,c(!1))}},[m,r]);return u(()=>()=>{p.current?.abort(),p.current=void 0},[]),{data:i,error:l,loading:o,fetch:g}};j();var zu=({rows:e,columns:t,defaultOrderBy:n})=>{let r=fo(),[i,a]=s(n||`count`),[o,c]=s(`desc`),l=f(()=>Cu(e,Su(o,i)),[e,i,o]),u=e=>{c(t=>t===`asc`&&i===e?`desc`:`asc`),a(e)},d=e=>()=>{u(e)},p=({query:e})=>async()=>{await r(e,`Query has been copied`)},m=t.filter(t=>!t.visible||e.some(e=>t.visible(e)));return M(`table`,{className:`vm-table`,children:[M(`thead`,{className:`vm-table-header`,children:M(`tr`,{className:`vm-table__row vm-table__row_header`,children:[m.map(e=>{let t=e.sortBy||e.key;return M(`th`,{className:(0,G.default)({"vm-table-cell":!0,"vm-table-cell_header":!0,"vm-table-cell_sort":e.sortable!==!1}),onClick:e.sortable===!1?void 0:d(t),children:M(`div`,{className:`vm-table-cell__content`,children:[e.title||e.key,e.tooltip&&M(X,{placement:`top-center`,title:e.tooltip,children:M(`span`,{className:`vm-top-queries-table__info-icon`,children:M(jn,{})})}),e.sortable!==!1&&M(`div`,{className:(0,G.default)({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":i===t,"vm-table__sort-icon_desc":o===`desc`&&i===t}),children:M(Ln,{})})]})},e.key)}),M(`th`,{className:`vm-table-cell vm-table-cell_header`}),` `]})}),M(`tbody`,{className:`vm-table-body`,children:l.map((e,t)=>M(`tr`,{className:`vm-table__row`,children:[m.map(t=>M(`td`,{className:`vm-table-cell`,children:t.visible&&!t.visible(e)?`-`:t.format?.(e)??e[t.key]??`-`},t.key)),M(`td`,{className:`vm-table-cell vm-table-cell_no-padding`,children:M(`div`,{className:`vm-top-queries-panels__table-actions`,children:[e.url&&M(X,{title:`Execute query`,children:M(T,{to:e.url,target:`_blank`,rel:`noreferrer`,"aria-disabled":!0,children:M(Y,{variant:`text`,size:`small`,startIcon:M(Un,{}),ariaLabel:`execute query`})})}),M(X,{title:`Copy query`,children:M(Y,{variant:`text`,size:`small`,startIcon:M(er,{}),onClick:p(e),ariaLabel:`copy query`})})]})})]},t))})]})};j();var Bu=[`table`,`JSON`].map((e,t)=>({value:String(t),label:e,icon:M(t===0?Gn:Kn,{})})),Vu=({rows:e,title:t,columns:n,defaultOrderBy:r})=>{let{isMobile:i}=J(),[a,o]=s(0);return M(`div`,{className:(0,G.default)({"vm-top-queries-panel":!0,"vm-block":!0,"vm-block_mobile":i}),children:[M(`div`,{className:(0,G.default)({"vm-top-queries-panel-header":!0,"vm-section-header":!0,"vm-top-queries-panel-header_mobile":i}),children:[M(`h5`,{className:(0,G.default)({"vm-section-header__title":!0,"vm-section-header__title_mobile":i}),children:t}),M(`div`,{className:`vm-section-heaLine truncated
`,`The file must contain tracing information in JSON format.`,`
`,`In order to use tracing please refer to the doc:\xA0`,M(`a`,{className:`vm-link vm-link_colored`,href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#query-tracing`,target:`_blank`,rel:`help noreferrer`,children:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#query-tracing`}),`
`,`Tracing graph will be displayed after file upload.`,`
`,`Attach files by dragging & dropping, selecting or pasting them.`]}),M(ed,{onOpenModal:o,onChange:m})]}),a&&M(Di,{title:`Paste JSON`,onClose:c,children:M(Cs,{editable:!0,displayTitle:!0,defaultTile:`JSON ${e.length+1}`,onClose:c,onUpload:d})}),y&&M(`div`,{className:`vm-trace-page__dropzone`})]})};j();var nd=({job:e,instance:t,metrics:n,size:r})=>{let{duration:i,relativeTime:a,period:{date:o}}=W(),{setSearchParamsFromKeys:s}=ma(),c=()=>{let c=Qc({"g0.range_input":i,"g0.end_input":o,"g0.relative_time":a,size:r,job:e,instance:t,metrics:n});s(c)};u(c,[i,a,o,e,t,n,r]),u(c,[])},rd=(e,t)=>`${e}/api/v1/label/job/values?start=${t.start}&end=${t.end}`,id=(e,t,n)=>{let r=`{job=${JSON.stringify(n)}}`;return`${e}/api/v1/label/instance/values?match[]=${encodeURIComponent(r)}&start=${t.start}&end=${t.end}`},ad=(e,t,n,r)=>{let i=`{${Object.entries({job:n,instance:r}).filter(e=>e[1]).map(([e,t])=>`${e}=${JSON.stringify(t)}`).join(`,`)}}`;return`${e}/api/v1/label/__name__/values?match[]=${encodeURIComponent(i)}&start=${t.start}&end=${t.end}`};j();var od=()=>{let{serverUrl:e}=H(),{period:t}=W(),[n,r]=s([]),[i,a]=s(!1),[o,c]=s(),l=f(()=>rd(e,t),[e,t]);return u(()=>{(async()=>{a(!0);try{let e=await fetch(l),t=await e.json(),n=t.data||[];r(n.sort((e,t)=>e.localeCompare(t))),e.ok?c(void 0):c(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&c(`${e.name}: ${e.message}`)}a(!1)})().catch(console.error)},[l]),{jobs:n,isLoading:i,error:o}};j();var sd=e=>{let{serverUrl:t}=H(),{period:n}=W(),[r,i]=s([]),[a,o]=s(!1),[c,l]=s(),d=f(()=>id(t,n,e),[t,n,e]);return u(()=>{e&&(async()=>{o(!0);try{let e=await fetch(d),t=await e.json(),n=t.data||[];i(n.sort((e,t)=>e.localeCompare(t))),e.ok?l(void 0):l(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&l(`${e.name}: ${e.message}`)}o(!1)})().catch(console.error)},[d]),{instances:r,isLoading:a,error:c}};j();var cd=(e,t)=>{let{serverUrl:n}=H(),{period:r}=W(),[i,a]=s([]),[o,c]=s(!1),[l,d]=s(),p=f(()=>ad(n,r,e,t),[n,r,e,t]);return u(()=>{e&&(async()=>{c(!0);try{let e=await fetch(p),t=await e.json(),n=t.data||[];a(n.sort((e,t)=>e.localeCompare(t))),e.ok?d(void 0):d(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&d(`${e.name}: ${e.message}`)}c(!1)})().catch(console.error)},[p]),{names:i,isLoading:o,error:l}};j();var ld=({name:e,job:t,instance:n,rateEnabled:r,isBucket:i,height:a})=>{let{isMobile:o}=J(),{yaxis:c}=Kr(),{period:l}=W(),d=qr(),p=$t(),{calculated:m,override:h}=ri(),[g,_]=s(!1),[v,y]=s(!1),b=Lt(Ot(m)*10*1e3),x=h??(g?b:m),S=f(()=>{let a=Object.entries({job:t,instance:n}).filter(e=>e[1]).map(([e,t])=>`${e}=${JSON.stringify(t)}`);a.push(`__name__=${JSON.stringify(e)}`),e==`node_cpu_seconds_total`&&a.push(`mode!="idle"`);let o=`{${a.join(`,`)}}`;return i?[`sum(increase_pure(${o})) by (vmrange, le)`]:[`
with (q = ${r?`rollup_rate(${o})`:`rollup(${o})`}) (
alias(min(label_match(q, "rollup", "min")), "min"),
alias(max(label_match(q, "rollup", "max")), "max"),
alias(avg(label_match(q, "rollup", "avg")), "avg"),
)`]},[e,t,n,r,i]),{isLoading:C,graphData:w,error:T,queryErrors:E,warning:D,isHistogram:O}=hs({predefinedQuery:S,visible:!0,customStep:x,showAllSeries:v,display:V.chart});return u(()=>{_(O)},[O]),M(`div`,{className:(0,G.default)({"vm-explore-metrics-graph":!0,"vm-explore-metrics-graph_mobile":o}),children:[C&&M(Xl,{}),T&&M(q,{variant:`error`,title:`Unable to load query results`,children:T}),E[0]&&M(q,{variant:`error`,title:`Query execution error`,children:E[0]}),D&&M(ks,{warning:D,query:S,onChange:y}),w&&l&&M(vl,{data:w,period:l,customStep:x,query:S,yaxis:c,setYaxisLimits:e=>{d({type:`SET_YAXIS_LIMITS`,payload:e})},setPeriod:({from:e,to:t})=>{p({type:`SET_PERIOD`,payload:{from:e,to:t}})},showLegend:!1,height:a,isHistogram:O})]})},ud=({name:e,index:t,length:n,isBucket:r,rateEnabled:i,onChangeRate:a,onRemoveItem:o,onChangeOrder:s})=>{let{isMobile:c}=J(),{value:l,setTrue:u,setFalse:d}=Z(!1),f=()=>{o(e)},p=()=>{s(e,t,t+1)},m=()=>{s(e,t,t-1)};return c?M(`div`,{className:`vm-explore-metrics-item-header vm-explore-metrics-item-header_mobile`,children:[M(`div`,{className:`vm-explore-metrics-item-header__name`,children:e}),M(Y,{variant:`text`,size:`small`,startIcon:M(sr,{}),onClick:u,ariaLabel:`open panel settings`}),l&&M(Di,{title:e,onClose:d,children:M(`div`,{className:`vm-explore-metrics-item-header-modal`,children:[M(`div`,{className:`vm-explore-metrics-item-header-modal-order`,children:[M(Y,{startIcon:M(Yn,{}),variant:`outlined`,onClick:m,disabled:t===0,ariaLabel:`move graph up`}),M(`p`,{children:[`position:`,M(`span`,{className:`vm-explore-metrics-item-header-modal-order__index`,children:[`#`,t+1]})]}),M(Y,{endIcon:M(Jn,{}),variant:`outlined`,onClick:p,disabled:t===n-1,ariaLabel:`move graph down`})]}),!r&&M(`div`,{className:`vm-explore-metrics-item-header-modal__rate`,children:[M(za,{label:M(`span`,{children:[`enable `,M(`code`,{children:`rate()`})]}),value:i,onChange:a,fullWidth:!0}),M(`p`,{children:`calculates the average per-second speed of metrics change`})]}),M(Y,{startIcon:M(On,{}),color:`error`,variant:`outlined`,onClick:f,fullWidth:!0,children:`Remove graph`})]})})]}):M(`div`,{className:`vm-explore-metrics-item-header`,children:[M(`div`,{className:`vm-explore-metrics-item-header-order`,children:[M(X,{title:`move graph up`,children:M(Y,{className:`vm-explore-metrics-item-header-order__up`,startIcon:M(In,{}),variant:`text`,color:`gray`,size:`small`,onClick:m,ariaLabel:`move graph up`})}),M(`div`,{className:`vm-explore-metrics-item-header__index`,children:[`#`,t+1]}),M(X,{title:`move graph down`,children:M(Y,{className:`vm-explore-metrics-item-header-order__down`,startIcon:M(In,{}),variant:`text`,color:`gray`,size:`small`,onClick:p,ariaLabel:`move graph down`})})]}),M(`div`,{className:`vm-explore-metrics-item-header__name`,children:e}),!r&&M(`div`,{className:`vm-explore-metrics-item-header__rate`,children:M(X,{title:`calculates the average per-second speed of metric's change`,children:M(za,{label:M(`span`,{children:[`enable `,M(`code`,{children:`rate()`})]}),value:i,onChange:a})})}),M(`div`,{className:`vm-explore-metrics-item-header__close`,children:M(X,{title:`close graph`,children:M(Y,{startIcon:M(On,{}),variant:`text`,color:`gray`,size:`small`,onClick:f,ariaLabel:`close graph`})})})]})};j();var dd=({name:e,job:t,instance:n,index:r,length:i,size:a,onRemoveItem:o,onChangeOrder:c})=>{let l=f(()=>/_sum$|_total$|_count$/.test(e),[e]),d=f(()=>/_bucket$/.test(e),[e]),[p,m]=s(l),h=jr(),g=f(a.height,[a,h]);return u(()=>{m(l)},[t]),M(`div`,{className:`vm-explore-metrics-item vm-block vm-block_empty-padding`,children:[M(ud,{name:e,index:r,length:i,isBucket:d,rateEnabled:p,size:a.id,onChangeRate:m,onRemoveItem:o,onChangeOrder:c}),M(ld,{name:e,job:t,instance:n,rateEnabled:p,isBucket:d,height:g},`${e}_${t}_${n}_${p}`)]})};j(),b();var fd=ot.map(e=>e.id),pd=({jobs:e,instances:t,names:n,job:r,instance:i,size:a,selectedMetrics:o,onChangeJob:s,onChangeInstance:c,onToggleMetric:d,onChangeSize:p})=>{let m=f(()=>r?``:`No instances. Please select job`,[r]),h=f(()=>r?``:`No metric names. Please select job`,[r]),{isMobile:g}=J(),{value:_,toggle:v,setFalse:y}=Z(B(`EXPLORE_METRICS_TIPS`)!==`false`);return u(()=>{je(`EXPLORE_METRICS_TIPS`,`${_}`)},[_]),M(l,{children:[M(`div`,{className:(0,G.default)({"vm-explore-metrics-header":!0,"vm-explore-metrics-header_mobile":g,"vm-block":!0,"vm-block_mobile":g}),children:[M(`div`,{className:`vm-explore-metrics-header__job`,children:M(dl,{value:r,list:e,label:`Job`,placeholder:`Please select job`,onChange:s,autofocus:!r&&!!e.length&&!g,searchable:!0})}),M(`div`,{className:`vm-explore-metrics-header__instance`,children:M(dl,{value:i,list:t,label:`Instance`,placeholder:`Please select instance`,onChange:c,noOptionsText:m,clearable:!0,searchable:!0})}),M(`div`,{className:`vm-explore-metrics-header__size`,children:[M(dl,{label:`Size graphs`,value:a,list:fd,onChange:p}),M(X,{title:`${_?`Hide`:`Show`} tip`,children:M(Y,{variant:`text`,color:_?`warning`:`gray`,startIcon:M(lr,{}),onClick:v,ariaLabel Line truncated
(
node_memory_MemTotal_bytes{instance=~"$node:$port", job=~"$job"}
-
node_memory_MemFree_bytes{instance=~"$node:$port", job=~"$job"}
)
/
node_memory_MemTotal_bytes{instance=~"$node:$port", job=~"$job"}
) * 100`}),M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`It is clear the query calculates the percentage of used memory for the given $node, $port and $job. Isn't it? :)`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`What's wrong with this query? Copy-pasted label filters for distinct timeseries which makes it easy to mistype these filters during modification. Let's simplify the query with WITH expressions:`}),M(xd,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"}
)
(
node_memory_MemTotal_bytes{commonFilters}
-
node_memory_MemFree_bytes{commonFilters}
)
/
node_memory_MemTotal_bytes{commonFilters} * 100`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:[`Now label filters are located in a single place instead of three distinct places. The query mentions node_memory_MemTotal_bytes metric twice and `,`{commonFilters}`,` three times. WITH expressions may improve this:`]}),M(xd,{code:`WITH (
my_resource_utilization(free, limit, filters) = (limit{filters} - free{filters}) / limit{filters} * 100
)
my_resource_utilization(
node_memory_MemFree_bytes,
node_memory_MemTotal_bytes,
{instance=~"$node:$port",job=~"$job"},
)`}),M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`Now the template function my_resource_utilization() may be used for monitoring arbitrary resources - memory, CPU, network, storage, you name it.`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:[`Let's take another nice query from `,M(Cd,{}),` dashboard:`]}),M(xd,{code:`(
(
(
count(
count(node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"}) by (cpu)
)
)
-
avg(
sum by (mode) (rate(node_cpu_seconds_total{mode='idle',instance=~"$node:$port",job=~"$job"}[5m]))
)
)
*
100
)
/
count(
count(node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"}) by (cpu)
)`}),M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`Do you understand what does this mess do? Is it manageable? :) WITH expressions are happy to help in a few iterations.`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`1. Extract common filters used in multiple places into a commonFilters variable:`}),M(xd,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"}
)
(
(
(
count(
count(node_cpu_seconds_total{commonFilters}) by (cpu)
)
)
-
avg(
sum by (mode) (rate(node_cpu_seconds_total{mode='idle',commonFilters}[5m]))
)
)
*
100
)
/
count(
count(node_cpu_seconds_total{commonFilters}) by (cpu)
)`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`2. Extract "count(count(...) by (cpu))" into cpuCount variable:`}),M(xd,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"},
cpuCount = count(count(node_cpu_seconds_total{commonFilters}) by (cpu))
)
(
(
cpuCount
-
avg(
sum by (mode) (rate(node_cpu_seconds_total{mode='idle',commonFilters}[5m]))
)
)
*
100
) / cpuCount`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`3. Extract rate(...) part into cpuIdle variable, since it is clear now that this part calculates the number of idle CPUs:`}),M(xd,{code:`WITH (
commonFilters = {instance=~"$node:$port",job=~"$job"},
cpuCount = count(count(node_cpu_seconds_total{commonFilters}) by (cpu)),
cpuIdle = sum(rate(node_cpu_seconds_total{mode='idle',commonFilters}[5m]))
)
((cpuCount - cpuIdle) * 100) / cpuCount`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:[`4. Put node_cpu_seconds_total`,`{commonFilters}`,` into its own variable with the name cpuSeconds:`]}),M(xd,{code:`WITH (
cpuSeconds = node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"},
cpuCount = count(count(cpuSeconds) by (cpu)),
cpuIdle = sum(rate(cpuSeconds{mode='idle'}[5m]))
)
((cpuCount - cpuIdle) * 100) / cpuCount`}),M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`Now the query became more clear comparing to the initial query.`})]}),M(`div`,{className:`vm-with-template-tutorial-section`,children:[M(`p`,{className:`vm-with-template-tutorial-section__text`,children:`WITH expressions may be nested and may be put anywhere. Try expanding the following query:`}),M(xd,{code:`WITH (
f(a, b) = WITH (
f1(x) = b-x,
f2(x) = x+x
) f1(a)*f2(b)
) f(foo, with(x=bar) x)`})]})]}),Td=(e,t)=>`${e}/expand-with-exprs?query=${encodeURIComponent(t)}&format=json`;j();var Ed=()=>{let{serverUrl:e}=H(),[t,n]=L(),[r,i]=s(``),[a,o]=s(!1),[c,l]=s();return{data:r,error:c,loading:a,expand:async r=>{t.set(`expr`,r),n(t);let a=Td(e,r);o(!0);try{let e=await(await fetch(a)).json();i(e?.expr||``),l(String(e.error||``))}catch(e){e instanceof Error&&e.name!==`AbortError`&&l(`${e.name}: ${e.message}`)}o(!1)}}};j();var Dd=()=>{let[e]=L(),{data:t,loading:n,error:r,expand:i}=Ed(),[a,o]=s(e.get(`expr`)||``),c=e=>{o(e)},l=()=>{i(a)};return u(()=>{a&&i(a)},[]),M(`section`,{className:`vm-with-template`,children:[n&&M(Xl,{}),M(`div`,{className:`vm-with-template-body vm-block`,children:[M(`div`,{className:`vm-with-template-body__expr`,children:M(Q,{type:`textarea`,label:`MetricsQL query with optional WITH expressions`,value:a,error:r,autofocus:!0,onEnter:l,onChange:c})}),M(`div`,{className:`vm-with-template-body__result`,children:M(Q,{type:`textarea`,label:`MetricsQL query after expanding WITH expressions and applying other optimizations`,value:t,readonly:!0})}),M(`div`,{className:`vm-with-template-body-top`,children:M(Y,{variant:`contained`,onClick:l,startIcon:M(Hn,{}),children:`Expand`})})]}),M(`div`,{className:`vm-block`,children:M(wd,{})})]})},Od=(e,t,n)=>`${e}/metric-relabel-debug?${[`format=json`,`relabel_configs=${encodeURIComponent(t)}`,`metric=${encodeURIComponent(n)}`].join(`&`)}`;j();var kd=()=>{let{serverUrl:e}=H(),[t,n]=s(null),[r,i]=s(!1),[a,o]=s();return{data:t,error:a,loading:r,fetchData:async(t,r)=>{let a=Od(e,t,r);i(!0);try{let e=await(await fetch(a)).json();n(e.error?null:e),o(String(e.error||``))}catch(e){e instanceof Error&&e.name!==`AbortError`&&o(`${e.name}: ${e.message}`)}i(!1)}}};j();var Ad={config:`- if: '{bar_label=~"b.*"}'
source_labels: [foo_label, bar_label]
separator: "_"
target_label: foobar
- action: labeldrop
regex: "foo_.*"
- target_label: job
replacement: "my-application-2"`,labels:`{__name__="my_metric", bar_label="bar", foo_label="foo", job="my-application", instance="192.168.0.1"}`},jd=()=>{let[e,t]=L(),{data:n,loading:r,error:i,fetchData:a}=kd(),[o,s]=gu(``,`config`),[c,l]=gu(``,`labels`),d=e=>{s(e||``)},f=e=>{l(e||``)},p=h(()=>{a(o,c),e.set(`config`,o),e.set(`labels`,c),t(e)},[o,c]);return u(()=>{let t=e.get(`config`)||``,n=e.get(`labels`)||``;(n||t)&&(a(t,n),s(t),l(n))},[]),M(`section`,{className:`vm-relabeling`,children:[r&&M(Xl,{}),M(`div`,{className:`vm-relabeling-header vm-block`,children:[M(`div`,{className:`vm-relabeling-header-configs`,children:M(Q,{type:`textarea`,label:`Config`,value:o,autofocus:!0,onChange:d,onEnter:p})}),M(`div`,{className:`vm-relabeling-header__labels`,children:M(Q,{type:`textarea`,label:`A time series`,value:c,placeholder:`up{job="job_name",instance="host:port"}`,onChange:f,onEnter:p})}),M(`div`,{className:`vm-relabeling-header-bottom`,children:[M(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/relabeling/`,rel:`help noreferrer`,children:M(Y,{variant:`text`,color:`gray`,startIcon:M(rr,{}),children:`Relabeling cookbook`})}),M(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/relabeling/#relabeling-stages`,rel:`help noreferrer`,children:M(Y,{variant:`text`,color:`gray`,startIcon:M(An,{}),children:`Relabeling Stages`})}),M(Y,{variant:`outlined`,onClick:()=>{let{config:n,labels:r}=Ad;s(n),l(r),a(n,r),e.set(`config`,n),e.set(`labels`,r),t(e)},children:`Try example`}),M(Y,{variant:`contained`,onClick:p,startIcon:M(Hn,{}),children:`Preview`})]})]}),i&&M(q,{variant:`error`,children:i}),n&&M(`div`,{className:`vm-relabeling-steps vm-block`,children:[n.originalLabels&&M(`div`,{className:`vm-relabeling-steps-item`,children:M(`div`,{className:`vm-relabeling-steps-item__row`,children:[M(`span`,{children:`Original labels:`}),M(So,{tagName:`code`,value:n.originalLabels})]})}),n.steps.map((e,t)=>M(`div`,{className:`vm-relabeling-steps-item`,children:[M(`div`,{className:`vm-relabeling-steps-item__row`,children:[M(`span`,{children:`Step:`}),t+1]}),M(`div`,{className:`vm-relabeling-steps-item__row`,children:[M(`span`,{children:`Relabeling Rule:`}),M(`code`,{children:M(`pre`,{children:e.rule})})]}),M(`div`,{className:`vm-relabeling-steps-item__row`,children:[M(`span`,{children:`Input Labels:`}),M(`code`,{children:e.errors?.inLabelsMsg?M(`pre`,{className:`vm-relabeling-steps-item__error`,children:e.errors.inLabelsMsg}):M(So,{tagName:`pre`,value:e.inLabels})})]}),M(`div`,{className:`vm-relabeling-steps-item__row`,children:[M(`span`,{children:`Output labels:`}),M(`code`,{children:e.errors?.outLabelsMsg?M(`pre`,{className:`vm-relabeling-steps-item__error`,children:e.errors.outLabelsMsg}):M(So,{tagName:`pre`,value:e.outLabels})})]})]},t)),n.resultingLabels&&M(`div`,{className:`vm-relabeling-steps-item`,children:M(`div`,{className:`vm-relabeling-steps-item__row`,children:[M(`span`,{children:`Resulting labels:`}),M(So,{tagName:`code`,value:n.resultingLabels})]})})]})]})},Md=e=>`${e}/api/v1/status/active_queries`;j();var Nd=()=>{let{serverUrl:e}=H(),[t,n]=s([]),[r,i]=s((0,R.default)().format(ve)),[a,o]=s(!1),[c,l]=s(),d=f(()=>Md(e),[e]),p=async()=>{o(!0);try{let e=await fetch(d),t=await e.json();n(t.data),i((0,R.default)().format(`HH:mm:ss:SSS`)),e.ok?l(void 0):l(`${t.errorType}\r\n${t?.error}`)}catch(e){e instanceof Error&&l(`${e.name}: ${e.message}`)}o(!1)};return u(()=>{p().catch(console.error)},[d]),{data:t,lastUpdated:r,isLoading:a,error:c,fetchData:p}};j();var Pd=({rows:e,columns:t,defaultOrderBy:n,defaultOrderDir:r,copyToClipboard:i,paginationOffset:a,rowClasses:o,rowAction:c=e=>()=>{}})=>{let l=fo(),[d,p]=s(n),[m,h]=s(r||`desc`),[g,_]=s(null),[v,b]=s(new Map);u(()=>{let t=new Map;e.forEach(e=>{t.set(e.id,y())}),b(t)},[e]);let x=f(()=>{let{startIndex:t,endIndex:n}=a;return Cu(e,Su(m,d)).slice(t,n)},[e,d,m,a]),S=e=>()=>{h(t=>t===`asc`&&d===e?`desc`:`asc`),p(e)},C=(e,t)=>async()=>{if(g!==t)try{await l(String(e)),_(t)}catch(e){console.error(e)}};u(()=>{if(g===null)return;let e=setTimeout(()=>_(null),2e3);return()=>clearTimeout(e)},[g]);let w=i&&t.find(e=>e.key==i);return M(`table`,{className:`vm-table`,children:[M(`thead`,{className:`vm-table-header`,children:M(`tr`,{className:`vm-table__row vm-table__row_header`,children:[t.map(e=>M(`th`,{className:`vm-table-cell vm-table-cell_header vm-table-cell_sort`,onClick:S(e.key),children:M(`div`,{className:`vm-table-cell__content`,children:[M(`div`,{children:String(e.title||e.key)}),M(`div`,{className:(0,G.default)({"vm-table__sort-icon":!0,"vm-table__sort-icon_active":d===e.key,"vm-table__sort-icon_desc":m===`desc`&&d===e.key}),children:M(Ln,{})})]})},String(e.key))),i&&M(`th`,{className:`vm-table-cell vm-table-cell_header`})]})}),M(`tbody`,{className:`vm-table-body`,children:x.map((e,n)=>M(`tr`,{className:(0,G.default)({"vm-table__row":!0,...o?o(e):{}}),id:e.id,ref:v.get(e.id),onClick:c(v.get(e.id)),children:[t.map(t=>M(`td`,{classNam Line truncated
`,`The file must contain query information in JSON format.`,`
`,`Graph will be displayed after file upload.`,`
`,`Attach files by dragging & dropping, selecting or pasting them.`]}),M(ed,{onOpenModal:o,onChange:h})]}),n&&M(`div`,{className:`vm-query-analyzer-error`,children:[M(q,{variant:`error`,title:`Unable to load query response`,children:n}),M(Y,{className:`vm-query-analyzer-error__close`,startIcon:M(On,{}),variant:`text`,color:`error`,onClick:g})]}),a&&M(Di,{title:`Paste JSON`,onClose:c,children:M(Id,{onClose:c,onUpload:p})}),v&&M(`div`,{className:`vm-trace-page__dropzone`})]})},Vd=(e,t,n)=>`${e}/downsampling-filters-debug?${[`flags=${encodeURIComponent(t)}`,`metrics=${encodeURIComponent(n)}`].join(`&`)}`;j();var Hd=()=>{let{serverUrl:e}=H(),[t,n]=L(),[r,i]=s(new Map),[a,o]=s(!1),[c,l]=s(),[u,d]=s(),[f,p]=s();return{data:r,error:f,metricsError:c,flagsError:u,loading:a,applyFilters:h(async(r,a)=>{if(l(a?``:`metrics are required`),d(r?``:`flags are required`),!a||!r)return;t.set(`flags`,r),t.set(`metrics`,a),n(t);let s=Vd(e,r,a);o(!0);try{let e=await(await fetch(s)).json();i(new Map(Object.entries(e.result||{}))),l(e.error?.metrics||``),d(e.error?.flags||``),p(``)}catch(e){e instanceof Error&&e.name!==`AbortError`&&p(`${e.name}: ${e.message}`)}o(!1)},[e])}};j();var Ud={flags:`-downsampling.period={env="dev"}:7d:5m,{env="dev"}:30d:30m
-downsampling.period=30d:1m
-downsampling.period=60d:5m
`,metrics:`up
up{env="dev"}
up{env="prod"}`},Wd=()=>{let[e]=L(),{data:t,loading:n,error:r,metricsError:i,flagsError:a,applyFilters:o}=Hd(),[c,l]=s(e.get(`metrics`)||``),[d,f]=s(e.get(`flags`)||``),p=h(e=>{l(e)},[l]),m=h(e=>{f(e)},[f]),g=h(()=>{o(d,c)},[o,d,c]),_=h(()=>{let{flags:t,metrics:n}=Ud;f(t),l(n),o(t,n),e.set(`flags`,t),e.set(`metrics`,n)},[Ud,f,l,e]);u(()=>{d&&c&&g()},[]);let v=[];for(let[e,n]of t)v.push(M(`tr`,{className:`vm-table__row`,children:[M(`td`,{className:`vm-table-cell`,children:e}),M(`td`,{className:(0,G.default)({"vm-table-cell":!0,"vm-table-cell_empty":!n}),children:n?n.join(` `):`No matching rules found!`})]}));return M(`section`,{className:`vm-downsampling-filters`,children:[n&&M(Xl,{}),M(`div`,{className:`vm-downsampling-filters-body vm-block`,children:[M(`div`,{className:`vm-downsampling-filters-body__expr`,children:[M(`div`,{className:`vm-retention-filters-body__title`,children:M(`p`,{children:[`Provide a list of flags for downsampling configuration. Note that only `,M(`code`,{children:`-downsampling.period`}),` and `,M(`code`,{children:`-dedup.minScrapeInterval`}),` flags are supported`]})}),M(Q,{type:`textarea`,label:`Flags`,value:d,error:r||a,autofocus:!0,onEnter:g,onChange:m,placeholder:`-downsampling.period=30d:1m -downsampling.period=7d:5m -dedup.minScrapeInterval=30s`})]}),M(`div`,{className:`vm-downsampling-filters-body__expr`,children:[M(`div`,{className:`vm-retention-filters-body__title`,children:M(`p`,{children:`Provide a list of metrics to check downsampling configuration.`})}),M(Q,{type:`textarea`,label:`Metrics`,value:c,error:r||i,onEnter:g,onChange:p,placeholder:`up{env="dev"}
up{env="prod"}
`})]}),M(`div`,{className:`vm-downsampling-filters-body__result`,children:M(`table`,{className:`vm-table`,children:[M(`thead`,{className:`vm-table-header`,children:M(`tr`,{children:[M(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Metric`}),M(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Applied downsampling rules`})]})}),M(`tbody`,{className:`vm-table-body`,children:v})]})}),M(`div`,{className:`vm-downsampling-filters-body-top`,children:[M(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#downsampling`,rel:`help noreferrer`,children:M(Y,{variant:`text`,color:`gray`,startIcon:M(rr,{}),children:`Documentation`})}),M(Y,{variant:`outlined`,onClick:_,children:`Try example`}),M(Y,{variant:`contained`,onClick:g,startIcon:M(Hn,{}),children:`Preview`})]})]})]})},Gd=(e,t,n)=>`${e}/retention-filters-debug?${[`flags=${encodeURIComponent(t)}`,`metrics=${encodeURIComponent(n)}`].join(`&`)}`;j();var Kd=()=>{let{serverUrl:e}=H(),[t,n]=L(),[r,i]=s(new Map),[a,o]=s(!1),[c,l]=s(),[u,d]=s(),[f,p]=s();return{data:r,error:f,metricsError:c,flagsError:u,loading:a,applyFilters:h(async(r,a)=>{if(l(a?``:`metrics are required`),d(r?``:`flags are required`),!a||!r)return;t.set(`flags`,r),t.set(`metrics`,a),n(t);let s=Gd(e,r,a);o(!0);try{let e=await(await fetch(s)).json();i(new Map(Object.entries(e.result||{}))),l(e.error?.metrics||``),d(e.error?.flags||``),p(``)}catch(e){e instanceof Error&&e.name!==`AbortError`&&p(`${e.name}: ${e.message}`)}o(!1)},[e])}};j();var qd={flags:`-retentionPeriod=1y
-retentionFilter={env!="prod"}:2w
`,metrics:`up
up{env="dev"}
up{env="prod"}`},Jd=()=>{let[e]=L(),{data:t,loading:n,error:r,metricsError:i,flagsError:a,applyFilters:o}=Kd(),[c,l]=s(e.get(`metrics`)||``),[d,f]=s(e.get(`flags`)||``),p=h(e=>{l(e)},[l]),m=h(e=>{f(e)},[f]),g=h(()=>{o(d,c)},[o,d,c]),_=h(()=>{let{flags:t,metrics:n}=qd;f(t),l(n),o(t,n),e.set(`flags`,t),e.set(`metrics`,n)},[qd,f,l,e]);u(()=>{d&&c&&g()},[]);let v=[];for(let[e,n]of t)v.push(M(`tr`,{className:`vm-table__row`,children:[M(`td`,{className:`vm-table-cell`,children:e}),M(`td`,{className:`vm-table-cell`,children:n})]}));return M(`section`,{className:`vm-retention-filters`,children:[n&&M(Xl,{}),M(`div`,{className:`vm-retention-filters-body vm-block`,children:[M(`div`,{className:`vm-retention-filters-body__expr`,children:[M(`div`,{className:`vm-retention-filters-body__title`,children:M(`p`,{children:[`Provide a list of flags for retention configuration. Note that only `,M(`code`,{children:`-retentionPeriod`}),` and `,M(`code`,{children:`-retentionFilter`}),` flags are supported.`]})}),M(Q,{type:`textarea`,label:`Flags`,value:d,error:r||a,autofocus:!0,onEnter:g,onChange:m,placeholder:`-retentionPeriod=4w -retentionFilter=up{env="dev"}:2w`})]}),M(`div`,{className:`vm-retention-filters-body__expr`,children:[M(`div`,{className:`vm-retention-filters-body__title`,children:M(`p`,{children:`Provide a list of metrics to check retention configuration.`})}),M(Q,{type:`textarea`,label:`Metrics`,value:c,error:r||i,onEnter:g,onChange:p,placeholder:`up{env="dev"}
up{env="prod"}
`})]}),M(`div`,{className:`vm-retention-filters-body__result`,children:M(`table`,{className:`vm-table`,children:[M(`thead`,{className:`vm-table-header`,children:M(`tr`,{children:[M(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Metric`}),M(`th`,{className:`vm-table-cell vm-table-cell_header`,children:`Applied retention`})]})}),M(`tbody`,{className:`vm-table-body`,children:v})]})}),M(`div`,{className:`vm-retention-filters-body-top`,children:[M(`a`,{target:`_blank`,href:`https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#retention-filters`,rel:`help noreferrer`,children:M(Y,{variant:`text`,color:`gray`,startIcon:M(rr,{}),children:`Documentation`})}),M(Y,{variant:`outlined`,onClick:_,children:`Try example`}),M(Y,{variant:`contained`,onClick:g,startIcon:M(Hn,{}),children:`Preview`})]})]})]})},Yd=async(e,t,n,r,i=fetch)=>{let a=await i(us(e,t,n));if(!a.ok)throw Error(await a.text());let{data:o=[]}=await a.json(),s=await i(ds(e,t,n,r,Gl(o).join(`,`)));if(!s.ok)throw Error(await s.text());return await s.text()};j();var Xd=({hideQuery:e,showAllSeries:t})=>{let{query:n}=hn(),{period:r}=W(),{displayType:i,reduceMemUsage:a,seriesLimits:o}=Br(),{serverUrl:c}=H(),{showInfoMessage:l}=di(),[d,p]=s(!1),[m,g]=s(),[_,v]=s(),[y,b]=s([]),[x,S]=s(),C=A(new AbortController),w=f(()=>{if(v(``),b([]),r){if(!c)v(Ie.emptyServer);else if(n.every(e=>!e.trim()))b(n.map(()=>Ie.validQuery));else if(Ue(c)){let e={...r};return n.map(t=>cs(c,t,e,a))}else v(Ie.validServer)}},[c,r,e,a]),T=f(()=>{let e=e=>`vmui_export_${n.join(`_`)}_${r.start}_${r.end}.${e}`;return{csv:async()=>{try{Ts(await Yd(c,n,r,a),e(`csv`))}catch(e){console.error(e),l({text:`Couldn't fetch data for CSV export. Please try again`,type:`error`})}},json:async()=>{let t=fs(c,n,r,a);try{Es(await(await fetch(t)).text(),e(`json`))}catch(e){console.error(e),l({text:`Couldn't fetch data for JSON export. Please try again`,type:`error`})}}}},[n,r,c,a]),E=h(async({fetchUrl:t,stateSeriesLimits:n,showAllSeries:r})=>{C.current.abort(),C.current=new AbortController;let{signal:a}=C.current;p(!0);try{let o=Math.floor(window.innerWidth/4),s=[],c=r?1/0:+n[i]||1/0,l=1,u=0;for await(let n of t){if(e?.includes(l-1)){b(e=>[...e,``]),l++;continue}let t=await fetch(n,{signal:a}),r=await t.text();if(new TextEncoder().encode(r).length>31457280){let e=`Response too large to display (over 30 MiB). Please narrow your query.`;v(e),b(t=>[...t,e]);continue}if(!t.ok||!t.body)s.push({metric:{},values:[],group:l}),v(r),b(e=>[...e,`${r}`]);else{b(e=>[...e,``]);let e=c-s.length,t=r.split(`
`).filter(e=>e),n=t.slice(0,e).sort();for(let e of n){let t=Il(e);if(!t)continue;let{values:n,timestamps:r}=t,i=n.length,a=i>o,c=a?o:i,u=a?i/o:1,d=Array(c),f=[];for(let e=0;e<c;e++){let t=a?Math.floor(e*u):e,i=r[t]/1e3,o=n[t];o===null&&f.push(i),d[e]=[i,o]}s.push({group:l,metric:t.metric,values:d,nullTimestamps:f})}u+=t.length}l++}let d=`Showing ${s.length} series out of ${u} series due to performance reasons. Please narrow down the query, so it returns fewer series`;S(u>c?d:``),g(s),p(!1)}catch(e){p(!1),e instanceof Error&&e.name!==`AbortError`&&(v(String(e)),console.error(e))}},[i,e]),D=h(e=>{if(_)return;let t={...r};T[e](c,n,t,a)},[c,n,r,a,_,T]),O=h(()=>{C.current.abort(),g([])},[C]);return u(()=>{if(!w?.length)return;let e=setTimeout(E,400,{fetchUrl:w,stateSeriesLimits:o,showAllSeries:t});return()=>{C.current?.abort(),clearTimeout(e)}},[w,o,t]),{fetchUrl:w,isLoading:d,data:m,error:_,queryErrors:y,setQueryErrors:b,warning:x,abortFetch:O,exportData:D}};j();var Zd=()=>M($,{href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#raw-samples`,underlined:!0,children:`raw samples`}),Qd=()=>M($,{underlined:!0,href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#query-data`,children:`Query API`}),$d=()=>M($,{underlined:!0,href:`https://docs.victoriametrics.com/victoriametrics/keyconcepts/#filtering`,children:`time series selector`}),ef=()=>{_s();let{isMobile:e}=J(),{displayType:t}=Br(),{query:n}=hn(),[r,i]=s([]),[a,o]=s(!n[0]),[c,l]=s(!1),[u,d]=s(!0),{data:f,error:p,isLoading:m,warning:g,queryErrors:_,setQueryErrors:v,abortFetch:y,exportData:b}=Xd({hideQuery:r,showAllSeries:c}),x=A(null),S=!a&&p,C=e=>{i(e)},w=()=>{o(!1)},T=()=>{d(!1)},E=h(async e=>{e&&b(e)},[b]);return M(`div`,{className:(0,G.default)({"vm-custom-panel":!0,"vm-custom-panel_mobile":e}),children:[M(as,{label:`Time series selector`,queryErrors:a?[]:_,setQueryErrors:v,setHideError:o,stats:[],isLoading:m,onHideQuery:C,onRunQuery:w,abortFetch:y,hideButtons:{traceQuery:!0,disableCache:!0},includeFunctions:!1}),u&&M(q,{variant:`info`,title:`Query raw samples`,children:M(`div`,{className:`vm-explore-metrics-header-description`,children:[M(`ul`,{children:[M(`li`,{children:[`This page provides a dedicated view for querying and displaying `,M(Zd,{}),` from VictoriaMetrics.`]}),M(`li`,{children:[`It expects only `,M($d,{}),` as a query argument.`]}),M(`li`,{children:[`Deduplication can only be disabled if it was previously enabled on the server (`,M(`code`,{children:`-dedup.minScrapeInterval`}),`).`]}),M(`li`,{children:[`Users often assume that the `,M(Qd,{}),` returns data exactly as stored, but data samples and timestamps may be modified by the API.`]})]}),M(Y,{variant:`text`,size:`small`,startIcon:M(On,{}),onClick:T,ariaLabel:`close tips`})]})}),S&&M(q,{variant:`error`,title:`Unable to load query results`,children:p}),g&&M(ks,{warning:g,query:n,onChange:l}),M(`div`,{className:(0,G.default)({"vm-custom-panel-body":!0,"vm-custom-panel-body_mobile":e,"vm-block":!0,"vm-block_mobile":e}),children:[m&&M(gs,{}),M(`div`,{className:`vm-custom-panel-body-header`,ref:x,children:[M(`div`,{className:`vm-custom-panel-body-header__tabs`,children:M(Pr,{tabFilter:e=>e.value!==V.table})}),f&&M(Ul,{title:`Export query`,downloadFormatOptions:[`json`,`csv`],onDownload:E})]}),M(Pl,{graphData:f,liveData:f,isHistogram:!1,displayType:t,controlsRef:x})]})]})};j();var tf=({type:e,states:t,search:n,rule_id:r,alert_id:i,group_id:a})=>{let{setSearchParamsFromKeys:o}=ma();u(()=>{let s=Qc({type:e,states:t,search:n,alert_id:i,rule_id:r,group_id:a});o(s)},[e,t,n,r,a,i])},nf=({kinds:e,search:t})=>{let{setSearchParamsFromKeys:n}=ma();u(()=>{let r=Qc({kinds:e,search:t});n(r)},[e,t])},rf=(e,t,n,r,i)=>`${e}/vmalert/api/v1/rules?datasource_type=prometheus&search=${encodeURIComponent(t)}&type=${encodeURIComponent(n)}&state=${r.map(encodeURIComponent).join(`,`)}&group_limit=${i}&extended_states=true`,af=(e,t,n,r)=>`${e}/vmalert/api/v1/${r}?group_id=${t}&${r}_id=${n}`,of=(e,t)=>`${e}/vmalert/api/v1/group?group_id=${t}`,sf=e=>`${e}/vmalert/api/v1/notifiers`;j();var cf=100,lf=({blockFetch:e,pageNum:t,search:n,ruleType:r,states:i,onPageChange:a})=>{let{serverUrl:o}=H(),{period:c}=W(),[l,d]=s([]),[p,m]=s(!1),[h,g]=s({page:t,total_pages:1,total_groups:0,total_rules:0}),[_,v]=s(),y=f(()=>rf(o,n,r,i,cf),[o,n,r,i]),b=!!l.length||!e;return u(()=>{e||(async()=>{m(!0);try{let e=`${y}&page_num=${t}`,n=await fetch(e),r=await n.json();if(n.ok){let e=r.data.groups||[];d(e),g({page:r.page||1,total_pages:r.total_pages||1,total_groups:r.total_groups||0,total_rules:r.total_rules||0}),v(void 0)}else n.status===400&&r?.error?.includes(`exceeds total amount of pages`)&&a(1)(),v(`${r.errorType}\r\n${r?.error}`)}catch(e){e instanceof Error&&v(`${e.name}: ${e.message}`)}m(!1)})().catch(console.error)},[y,c,b,t]),{groups:l,isLoading:p,error:_,pageInfo:h}};j(),b();var uf=({types:e,allRuleTypes:t,allStates:n,states:r,search:i,onChangeRuleType:a,onChangeStates:o,onChangeSearch:s})=>{let c=f(()=>e.l Line truncated
@@ -1,76 +0,0 @@
import{i as e,n as t,r as n,t as r}from"./rolldown-runtime-B0Z9INg1.js";function i(e,t){for(var n in t)e[n]=t[n];return e}function a(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function o(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?te.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return s(e,o,r,i,null)}function s(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++I,__i:-1,__u:0};return i==null&&F.vnode!=null&&F.vnode(a),a}function c(){return{current:null}}function l(e){return e.children}function u(e,t){this.props=e,this.context=t}function d(e,t){if(t==null)return e.__?d(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?d(e):null}function f(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],o=i({},t);o.__v=t.__v+1,F.vnode&&F.vnode(o),w(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??d(t),!!(32&t.__u),a),o.__v=t.__v,o.__.__k[o.__i]=o,E(r,o,a),t.__e=t.__=null,o.__e!=n&&p(o)}}function p(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),p(e)}function m(e){(!e.__d&&(e.__d=!0)&&L.push(e)&&!h.__r++||R!=F.debounceRendering)&&((R=F.debounceRendering)||z)(h)}function h(){try{for(var e,t=1;L.length;)L.length>t&&L.sort(ne),e=L.shift(),t=L.length,f(e)}finally{L.length=h.__r=0}}function g(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,y=r&&r.__k||H,b=t.length;for(c=_(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&y[p.__i]||le,p.__i=d,g=w(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&k(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=v(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function _(e,t,n,r,i){var a,o,c,u,f,p=n.length,m=p,h=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=s(null,o,null,null,null):de(o)?o=e.__k[a]=s(l,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=s(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,u=a+h,o.__=e,o.__b=e.__b+1,c=null,(f=o.__i=b(o,n,u,m))!=-1&&(m--,(c=n[f])&&(c.__u|=2)),c==null||c.__v==null?(f==-1&&(i>p?h--:i<p&&h++),typeof o.type!=`function`&&(o.__u|=4)):f!=u&&(f==u-1?h--:f==u+1?h++:(f>u?h--:h++,o.__u|=4))):e.__k[a]=null;if(m)for(a=0;a<p;a++)(c=n[a])!=null&&!(2&c.__u)&&(c.__e==r&&(r=d(c)),A(c,c));return r}function v(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=v(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=d(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function y(e,t){return t||=[],e==null||typeof e==`boolean`||(de(e)?e.some(function(e){y(e,t)}):t.push(e)),t}function b(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function x(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||ue.test(t)?n:n+`px`}function S(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||x(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||x(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ae,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[ie]=r[ie]:(n[ie]=oe,e.addEventListener(t,a?ce:se,a)):e.removeEventListener(t,a?ce:se,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function C(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[re]==null)t[re]=oe++;else if(t[re]<n[ie])return;return n(F.event?F.event(t):t)}}}function w(e,t,n,r,o,s,c,f,p,m){var h,_,v,y,b,x,S,C,w,E,k,A,M,ee,N,P,te=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(p=!!(32&n.__u),s=[f=t.__e=n.__e]),(h=F.__b)&&h(t);n:if(typeof te==`function`){_=c.length;try{if(w=t.props,E=te.prototype&&te.prototype.render,k=(h=te.contextType)&&r[h.__c],A=h?k?k.props.value:h.__:r,n.__c?C=(v=t.__c=n.__c).__=v.__E:(E?t.__c=v=new te(w,A):(t.__c=v=new u(w,A),v.constructor=te,v.render=j),k&&k.sub(v),v.state||(v.state={}),v.Line truncated
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=wr(),f;if(t){let e=typeof t==`string`?un(t):t;J(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let p=f.pathname||`/`,m=p;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let h=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):pn(e,{pathname:m});Y(u||h!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Y(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=Br(h&&h.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:Vn([l,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:Vn([l,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&g?o(mr.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},g):g}function Pr(){let e=qr(),t=qn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=o(l,null,o(`p`,null,`💿 Hey developer 👋`),o(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,o(`code`,{style:a},`ErrorBoundary`),` or`,` `,o(`code`,{style:a},`errorElement`),` prop on your route.`)),o(l,null,o(`h2`,null,`Unexpected Application Error!`),o(`h3`,{style:{fontStyle:`italic`}},t),n?o(`pre`,{style:i},n):null,s)}var Fr=o(Pr,null),Ir=class extends u{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=xr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:o(hr.Provider,{value:this.props.routeContext},o(gr.Provider,{value:e,children:this.props.component}));return this.context?o(Rr,{error:e},t):t}};Ir.contextType=cr;var Lr=new WeakMap;function Rr({children:e,error:t}){let{basename:n,navigator:r}=K(pr);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=br(t.digest);if(e){let i=Lr.get(t);if(i)throw i;let a=Xn(e.location,n),s=a.absoluteURL||a.to;if(tr(e.location,s,Qn(r),`allow-explicit`),ar(s))throw Error(`Invalid redirect location`);if(Yn&&!Lr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=s;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Lr.set(t,n),n}}return o(`meta`,{httpEquiv:`refresh`,content:`0;url=${s}`})}}return e}function zr({routeContext:e,match:t,children:n}){let r=K(or);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),o(hr.Provider,{value:e},n)}function Br(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);J(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,c=-1;if(n&&r){s=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:a}=r,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),i=c>=0?i.slice(0,c+1):[i[0]];break}}}}let lLine truncated
`)>=0)return!1;return!0}function xe(e,t){var n;if(e.indent===` `)n=` `;else if(typeof e.indent==`number`&&e.indent>0)n=C.call(Array(e.indent+1),` `);else return null;return{base:n,prev:C.call(Array(t+1),n)}}function Se(e,t){if(e.length===0)return``;var n=`
`+t.prev+t.base;return n+C.call(e,`,`+n)+`
`+t.prev}function Ce(e,t){var n=ne(e),r=[];if(n){r.length=e.length;for(var i=0;i<e.length;i++)r[i]=H(e,i)?t(e[i],e):``}var a=typeof D==`function`?D(e):[],o;if(k){o={};for(var s=0;s<a.length;s++)o[`$`+a[s]]=a[s]}for(var c in e)H(e,c)&&(n&&String(Number(c))===c&&c<e.length||k&&o[`$`+c]instanceof Symbol||(x.call(/[^\w$]/,c)?r.push(t(c,e)+`: `+t(e[c],e)):r.push(c+`: `+t(e[c],e))));if(typeof D==`function`)for(var l=0;l<a.length;l++)j.call(e,a[l])&&r.push(`[`+t(a[l])+`]: `+t(e[a[l]],e));return r}})),aa=r(((e,t)=>{var n=ia(),r=na(),i=function(e,t,n){for(var r=e,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},a=function(e,t){if(e){var n=i(e,t);return n&&n.value}},o=function(e,t,n){var r=i(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}},s=function(e,t){return e?!!i(e,t):!1},c=function(e,t){if(e)return i(e,t,!0)};t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new r(`Side channel does not contain `+n(e))},delete:function(t){var n=c(e,t);return n&&e&&!e.next&&(e=void 0),!!n},get:function(t){return a(e,t)},has:function(t){return s(e,t)},set:function(t,n){e||={next:void 0},o(e,t,n)}};return t}})),oa=r(((e,t)=>{t.exports=Object})),sa=r(((e,t)=>{t.exports=Error})),ca=r(((e,t)=>{t.exports=EvalError})),la=r(((e,t)=>{t.exports=RangeError})),ua=r(((e,t)=>{t.exports=ReferenceError})),da=r(((e,t)=>{t.exports=SyntaxError})),fa=r(((e,t)=>{t.exports=URIError})),pa=r(((e,t)=>{t.exports=Math.abs})),ma=r(((e,t)=>{t.exports=Math.floor})),ha=r(((e,t)=>{t.exports=Math.max})),ga=r(((e,t)=>{t.exports=Math.min})),_a=r(((e,t)=>{t.exports=Math.pow})),va=r(((e,t)=>{t.exports=Math.round})),ya=r(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),ba=r(((e,t)=>{var n=ya();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),xa=r(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),Sa=r(((e,t)=>{var n=xa();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),Ca=r(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),wa=r(((e,t)=>{t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}})),Ta=r(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=wa();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),Ea=r(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),Da=r(((e,t)=>{t.exports=oa().getPrototypeOf||null})),Oa=r(((e,t)=>{var n=Object.prototype.toString,r=Math.max,i=`[object Function]`,a=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},o=function(e,t){for(var n=[],r=t||0,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},s=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||n.apply(t)!==i)throw TypeError(`Function.prototype.bind called on incompatible `+t);for(var c=o(arguments,1),l,u=function(){if(this instanceof l){var n=t.apply(this,a(c,arguments));return Object(n)===n?n:this}return t.apply(e,a(c,arguments))},d=r(0,t.length-c.length),f=[],p=0;p<d;p++)f[p]=`$`+p;if(l=Function(`binder`,`return function (`+s(f,`,`)+`){ return binder.apply(this,arguments); }`)(u),t.prototype){var m=function(){};m.prototype=t.prototype,l.prototype=new m,m.prototype=null}return l}})),ka=r(((e,t)=>{var n=Oa();t.exports=Function.prototype.bind||n})),Aa=r(((e,t)=>{t.exports=Function.prototype.call})),ja=r(((e,t)=>{t.exports=Function.prototype.apply})),Ma=r(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),Na=r(((e,t)=>{var n=ka(),r=ja(),i=Aa();t.exports=Ma()||n.call(i,r)})),Pa=r(((e,t)=>{var n=ka(),r=na(),i=Aa(),a=Na();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),Fa=r(((e,t)=>{var n=Pa(),r=Sa(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`&&function(e){return s(e==null?e:o(e))}})),Ia=r(((e,t)=>{var n=Ea(),r=Da(),i=Fa();t.exports=n?function(e){return n(e)}:r?fu Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function no(e,t){return $a(e)||eo(e,t)||ro(e,t)||to()}function ro(e,t){if(e){if(typeof e==`string`)return Qa(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qa(e,t):void 0}}var io=Object.entries,ao=Object.setPrototypeOf,oo=Object.isFrozen,so=Object.getPrototypeOf,co=Object.getOwnPropertyDescriptor,lo=Object.freeze,uo=Object.seal,fo=Object.create,po=typeof Reflect<`u`&&Reflect,mo=po.apply,ho=po.construct;lo||=function(e){return e},uo||=function(e){return e},mo||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ho||=function(e){return new e(...[...arguments].slice(1))};var go=Io(Array.prototype.forEach),_o=Io(Array.prototype.lastIndexOf),vo=Io(Array.prototype.pop),yo=Io(Array.prototype.push),bo=Io(Array.prototype.splice),xo=Array.isArray,So=Io(String.prototype.toLowerCase),Co=Io(String.prototype.toString),wo=Io(String.prototype.match),To=Io(String.prototype.replace),Eo=Io(String.prototype.indexOf),Do=Io(String.prototype.trim),Oo=Io(Number.prototype.toString),ko=Io(Boolean.prototype.toString),Ao=typeof BigInt>`u`?null:Io(BigInt.prototype.toString),jo=typeof Symbol>`u`?null:Io(Symbol.prototype.toString),Mo=Io(Object.prototype.hasOwnProperty),No=Io(Object.prototype.toString),Po=Io(RegExp.prototype.test),Fo=Lo(TypeError);function Io(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return mo(e,t,n)}}function Lo(e){return function(){return ho(e,[...arguments])}}function X(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:So;if(ao&&ao(e,null),!xo(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(oo(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ro(e){for(let t=0;t<e.length;t++)Mo(e,t)||(e[t]=null);return e}function zo(e){let t=fo(null);for(let r of io(e)){var n=no(r,2);let i=n[0],a=n[1];Mo(e,i)&&(t[i]=xo(a)?Ro(a):a&&typeof a==`object`&&a.constructor===Object?zo(a):a)}return t}function Bo(e){switch(typeof e){case`string`:return e;case`number`:return Oo(e);case`boolean`:return ko(e);case`bigint`:return Ao?Ao(e):`0`;case`symbol`:return jo?jo(e):`Symbol()`;case`undefined`:return No(e);case`function`:case`object`:{if(e===null)return No(e);let t=e,n=Vo(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:No(e)}return No(e)}default:return No(e)}}function Vo(e,t){for(;e!==null;){let n=co(e,t);if(n){if(n.get)return Io(n.get);if(typeof n.value==`function`)return Io(n.value)}e=so(e)}function n(){return null}return n}function Ho(e){try{return Po(e,``),!0}catch{return!1}}var Uo=lo(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Wo=lo(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Go=lo([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ko=lo([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),qo=lo(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Jo=lo([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Yo=lo([`#text`]),Xo=lo(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.Line truncated
`+u),_e&&(u=_t(u)),T&&we?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et(e),K=!0,ye=V,be=H},t.clearConfig=function(){Ze=null,K=!1,ye=null,be=null,T=D,E=``},t.isValidAttribute=function(e,t,n){Ze||et({});let r=Xe(e),i=Xe(t);return kt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Mo(R,e)&&yo(R[e],t)},t.removeHook=function(e,t){if(Mo(R,e)){if(t!==void 0){let n=_o(R[e],t);return n===-1?void 0:bo(R[e],n,1)[0]}return vo(R[e])}},t.removeHooks=function(e){Mo(R,e)&&(R[e]=[])},t.removeAllHooks=function(){R=bs()},t}var ws=Cs();function Ts(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Es=Ts();function Ds(e){Es=e}var Os={exec:()=>null};function ks(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Z(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(js.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var As=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),js={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ks(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ks(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:ks(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ks(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ks(e=>RegExp(`^ {0,${e}}(?:</?(?:${Ks})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:ks(e=>RegExp(`^ {0,${e}}>`))},Ms=/^(?:[ \t]*(?:\n|$))+/,Ns=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ps=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Fs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Is=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ls=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Rs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,zs=Z(Rs).replace(/bull/g,Ls).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Bs=Z(Rs).replace(/bull/g,Ls).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Vs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Hs=/^[^\n]+/,Us=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ws=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Us).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gs=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ls).getRegex(),Ks=`address|article|aside|base|basefont|blockquote|body|caption|center|col|co Line truncated
]`).replace(`lheading`,zs).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},nc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ic=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ac=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,oc=/[\p{P}\p{S}]/u,sc=/[\s\p{P}\p{S}]/u,cc=/[^\s\p{P}\p{S}]/u,lc=Z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,sc).getRegex(),uc=/[\p{Pi}\p{Ps}"']/u,dc=/(?!~)[\p{P}\p{S}]/u,fc=/(?!~)[\s\p{P}\p{S}]/u,pc=/(?:[^\s\p{P}\p{S}]|~)/u,mc=Z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,As?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),hc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,gc=Z(hc,`u`).replace(/punct/g,oc).getRegex(),_c=Z(hc,`u`).replace(/punct/g,dc).getRegex(),vc=Z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,uc).replace(/punct/g,oc).getRegex(),yc=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,bc=Z(yc,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),xc=Z(yc,`gu`).replace(/notPunctSpace/g,pc).replace(/punctSpace/g,fc).replace(/punct/g,dc).getRegex(),Sc=Z(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),Cc=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),wc=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),Tc=Z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,oc).getRegex(),Ec=Z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),Dc=Z(/\\(punct)/,`gu`).replace(/punct/g,oc).getRegex(),Oc=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kc=Z(qs).replace(`(?:-->|$)`,`-->`).getRegex(),Ac=Z(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,kc).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jc=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Mc=Z(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,jc).getRegex(),Nc=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Mc).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pc=Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Mc).replace(`ref`,Us).getRegex(),Fc=Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Us).getRegex(),Ic=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Lc=Z(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,jc).getRegex(),Rc=Z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Lc).replace(`ref`,Ic).getRegex()).replace(`nolink`,Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ic).getRegex()).getRegex(),zc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bc=Z(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),Vc={_backpedal:Os,anyPunctLine truncated
`),n=t.length-1;for(;n>=0&&js.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
`)}function tl(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function nl(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function rl(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function il(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function al(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
`)}function ol(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var sl=class{options;rules;lexer;constructor(e){this.options=e||Es}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:el(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=al(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=$c(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:$c(t[0],`
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:$c(t[0],`
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=$c(t[0],`
`).split(`
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
${s}`:s,r=r?`${r}
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
`),o=t.raw+`
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
${d.join(`
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
`+e.join(`
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
`,1)[0],l=t[1].length,u=this.options.pedantic?rl(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>rl(e,l)),d=e.split(`
`,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
`,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
`,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
`+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
`+d}f=!d.trim(),r+=l+`
`,e=e.substring(l.length+1),u=m.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=el(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=tl(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:$c(t[0],`
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Qc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
`):[],a={type:`table`,raw:$c(t[0],`
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Qc(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:$c(t[0],`
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ol(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=$c(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=nl(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),il(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ol(e,n[1],r,this.rules))return;let i=t[tl((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return il(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Xc(t[0]),escaped:e}}}},cl=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Es,this.options.tokenizer=this.options.tokenizer||new sl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,in Line truncated
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(js.tabCharGlobal,` `).replace(js.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+i.raw,n.text+=`
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+i.raw,n.text+=`
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
`)?``:`
`)+i.raw,r.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+i.raw,n.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,tl(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,tl(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},ll=class{options;parser;constructor(e){this.options=e||Es}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(js.notSpaceStart)?.[0],i=e?e.replace(js.endingNewline,``)+`
`:``;return r?`<pre><code class="language-`+Yc(r)+`">`+(n?i:Yc(i,!0))+`</code></pre>
`:`<pre><code>`+(n?i:Yc(i,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
`+r+`</`+i+`>
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
<thead>
`+t+`</thead>
`+r+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Yc(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?Yc(n,!0):this.parser.parseInline(r),o=Zc(e);if(o===null)return a;e=Yc(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Yc(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Zc(e);if(i===null)return Yc(n);e=i;let a=`<img src="${Yc(e)}" alt="${Yc(n)}"`;return t&&(a+=` title="${Yc(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Yc(e.text)}},ul=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},dl=class e{options;renderer;textRenderer;constructor(e){this.options=e||Es,this.options.renderer=this.options.renderer||new ll,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ul}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},fl=class{options;block;constructor(e){this.options=e||Es}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?cl.lex:cl.lexInline}provideParser(e=this.block){return e?dl.parse:dl.parseInline}},pl=new class{defaults=Ts();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=dl;Renderer=ll;TextRenderer=ul;Lexer=cl;Tokenizer=sl;Hooks=fl;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renLine truncated
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Yc(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function ml(e,t){return pl.parse(e,t)}ml.options=ml.setOptions=function(e){return pl.setOptions(e),ml.defaults=pl.defaults,Ds(ml.defaults),ml},ml.getDefaults=Ts,ml.defaults=Es;function hl(...e){return pl.use(...e),ml.defaults=pl.defaults,Ds(ml.defaults),ml}ml.use=hl,ml.walkTokens=function(e,t){return pl.walkTokens(e,t)},ml.parseInline=pl.parseInline,ml.Parser=dl,ml.parser=dl.parse,ml.Renderer=ll,ml.TextRenderer=ul,ml.Lexer=cl,ml.lexer=cl.lex,ml.Tokenizer=sl,ml.Hooks=fl,ml.parse=ml,ml.options,ml.setOptions,ml.walkTokens,ml.parseInline,dl.parse,cl.lex;var gl=!0,_l=`uplot`,vl=`u-hz`,yl=`u-vt`,bl=`u-title`,xl=`u-wrap`,Sl=`u-under`,Cl=`u-over`,wl=`u-axis`,Tl=`u-off`,El=`u-select`,Dl=`u-cursor-x`,Ol=`u-cursor-y`,kl=`u-cursor-pt`,Al=`u-legend`,jl=`u-live`,Ml=`u-inline`,Nl=`u-series`,Pl=`u-marker`,Fl=`u-label`,Il=`u-value`,Ll=`width`,Rl=`height`,zl=`top`,Bl=`bottom`,Vl=`left`,Hl=`right`,Ul=`#000`,Wl=`#0000`,Gl=`mousemove`,Kl=`mousedown`,ql=`mouseup`,Jl=`mouseenter`,Yl=`mouseleave`,Xl=`dblclick`,Zl=`resize`,Ql=`scroll`,$l=`change`,eu=`dppxchange`,tu=`--`,nu=typeof window<`u`,ru=nu?document:null,iu=nu?window:null,au=nu?navigator:null,ou,su;function cu(){let e=devicePixelRatio;ou!=e&&(ou=e,su&&Cu($l,su,cu),su=matchMedia(`(min-resolution: ${ou-.001}dppx) and (max-resolution: ${ou+.001}dppx)`),Su($l,su,cu),iu.dispatchEvent(new CustomEvent(eu)))}function lu(e,t){if(t!=null){let n=e.classList;!n.contains(t)&&n.add(t)}}function uu(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function du(e,t,n){e.style[t]=n+`px`}function fu(e,t,n,r){let i=ru.createElement(e);return t!=null&&lu(i,t),n?.insertBefore(i,r),i}function pu(e,t){return fu(`div`,e,t)}var mu=new WeakMap;function hu(e,t,n,r,i){let a=`translate(`+t+`px,`+n+`px)`;a!=mu.get(e)&&(e.style.transform=a,mu.set(e,a),t<0||n<0||t>r||n>i?lu(e,Tl):uu(e,Tl))}var gu=new WeakMap;function _u(e,t,n){let r=t+n;r!=gu.get(e)&&(gu.set(e,r),e.style.background=t,e.style.borderColor=n)}var vu=new WeakMap;function yu(e,t,n,r){let i=t+``+n;i!=vu.get(e)&&(vu.set(e,i),e.style.height=n+`px`,e.style.width=t+`px`,e.style.marginLeft=r?-t/2+`px`:0,e.style.marginTop=r?-n/2+`px`:0)}var bu={passive:!0},xu={...bu,capture:!0};function Su(e,t,n,r){t.addEventListener(e,n,r?xu:bu)}function Cu(e,t,n,r){t.removeEventListener(e,n,bu)}nu&&cu();function wu(e,t,n,r){let i;n||=0,r||=t.length-1;let a=r<=2147483647;for(;r-n>1;)i=a?n+r>>1:Gu((n+r)/2),t[i]<e?n=i:r=i;return e-t[n]<=t[r]-e?n:r}function Tu(e){return(t,n,r)=>{let i=-1,a=-1;for(let a=n;a<=r;a++)if(e(t[a])){i=a;break}for(let i=r;i>=n;i--)if(e(t[i])){a=i;break}return[i,a]}}var Eu=e=>e!=null,Du=e=>e!=null&&e>0,Ou=Tu(Eu),ku=Tu(Du);function Au(e,t,n,r=0,i=!1){let a=i?ku:Ou,o=i?Du:Eu;[t,n]=a(e,t,n);let s=e[t],c=e[t];if(t>-1){if(r==1)s=e[t],c=e[n];else if(r==-1)s=e[n],c=e[t];else for(let r=t;r<=n;r++){let t=e[r];o(t)&&(t<s?s=t:t>c&&(c=t))}}return[s??nd,c??-nd]}function ju(e,t,n,r){let i=Zu(e),a=Zu(t);e==t&&(i==-1?(e*=n,t/=n):(e/=n,t*=n));let o=n==10?Qu:$u,s=i==1?Gu:qu,c=a==1?qu:Gu,l=s(o(Wu(e))),u=c(o(Wu(t))),d=Xu(n,l),f=Xu(n,u);return n==10&&(l<0&&(d=_d(d,-l)),u<0&&(f=_d(f,-u))),r||n==2?(e=d*i,t=f*a):(e=gd(e,d),t=hd(t,f)),[e,t]}function Mu(e,t,n,r){let i=ju(e,t,n,r);return e==0&&(i[0]=0),t==0&&(i[1]=0),i}var Nu=.1,Pu={mode:3,pad:Nu},Fu={pad:0,soft:null,mode:0},Iu={min:Fu,max:Fu};function Lu(e,t,n,r){return Od(n)?zu(e,t,n):(Fu.pad=n,Fu.soft=r?0:null,Fu.mode=r?3:0,zu(e,t,Iu))}function Q(e,t){return e??t}function Ru(e,t,n){for(t=Q(t,0),n=Q(n,e.length-1);t<=n;){if(e[t]!=null)return!0;t++}return!1}function zu(e,t,n){let r=n.min,i=n.max,a=Q(r.pad,0),o=Q(i.pad,0),s=Q(r.hard,-nd),c=Q(i.hard,nd),l=Q(r.soft,nd),u=Q(i.soft,-nd),d=Q(r.mode,0),f=Q(i.mode,0),p=t-e,m=Qu(p),h=Yu(Wu(e),Wu(t)),g=Wu(Qu(h)-m);(p<1e-24||g>10)&&(p=0,(e==0||t==0)&&(p=1e-24,d==2&&l!=nd&&(a=0),f==2&&u!=-nd&&(o=0)));let _=p||h||1e3,v=Xu(10,Gu(Qu(_))),y=_d(gd(e-_*(p==0?e==0?.1:1:a),v/10),24),b=e>=l&&(d==1||d==3&&y<=l||d==2&&y>=l)?l:nd,x=Yu(s,y<b&&e>=b?b:Ju(b,y)),S=_d(hd(t+_*(p==0?t==0?.1:1:o),v/10),24),C=t<=u&&(f==1||f==3&&S>=u||f==2&&S<=u)?u:-nd,w=Ju(c,S>C&&t<=C?C:Yu(C,S));return x==w&&x==0&&(w=100),[x,w]}var Bu=new Intl.NumberFormat(nu?au.language:`en-US`),Vu=e=>Bu.format(e),Hu=Math,Uu=Hu.PI,Wu=Hu.abs,Gu=Hu.floor,Ku=Hu.round,qu=Hu.ceil,Ju=Hu.min,Yu=Hu.max,Xu=Hu.pow,Zu=Hu.sign,Qu=Hu.log10,$u=Hu.log2,ed=(e,t=1)=>Hu.sinh(e)*t,td=(e,t=1)=>Hu.asinh(e/t),nd=1/0;function rd(e){return(Qu((e^e>>31)-(e>>31))|0)+1}function id(e,t,n){return Ju(Yu(e,t),n)}function ad(e){return typeof e==`function`}function $(e){return ad(e)?e:()=>e}var od=()=>{},sd=e=>e,cd=(e,t)=>t,ld=e=>null,ud=e=>!0,dd=(e,t)=>e==t,fd=/\.\d*?(?=9{6,}|0{6,})/gm,pd=e=>{if(Td(e)||vd.has(e))return e;let t=`${e}`,n=t.match(fd);if(n==null)return e;let r=n[0].length-1;if(t.indexOf(`e-`)!=-1){let[e,n]=t.split(`e`);return+`${pd(e)}e${n}`}return _d(e,r)};fun Line truncated
`,cf=`{YYYY}`,lf=sf+cf,uf=`{M}/{D}`,df=sf+uf,ff=df+`/{YY}`,pf=`{aa}`,mf=`{h}:{mm}`+pf,hf=sf+mf,gf=`:{ss}`,_f=null;function vf(e){let t=e*1e3,n=t*60,r=n*60,i=r*24,a=i*30,o=i*365,s=(e==1?bd(10,0,3,tf).filter(ef):bd(10,-3,0,tf)).concat([t,t*5,t*10,t*15,t*30,n,n*5,n*10,n*15,n*30,r,r*2,r*3,r*4,r*6,r*8,r*12,i,i*2,i*3,i*4,i*5,i*6,i*7,i*8,i*9,i*10,i*15,a,a*2,a*3,a*4,a*6,o,o*2,o*5,o*10,o*25,o*50,o*100]),c=[[o,cf,_f,_f,_f,_f,_f,_f,1],[i*28,`{MMM}`,lf,_f,_f,_f,_f,_f,1],[i,uf,lf,_f,_f,_f,_f,_f,1],[r,`{h}`+pf,ff,_f,df,_f,_f,_f,1],[n,mf,ff,_f,df,_f,_f,_f,1],[t,gf,ff+` `+mf,_f,df+` `+mf,_f,hf,_f,1],[e,gf+`.{fff}`,ff+` `+mf,_f,df+` `+mf,_f,hf,_f,1]];function l(t){return(s,c,l,u,d,f)=>{let p=[],m=d>=o,h=d>=a&&d<o,g=t(l),_=_d(g*e,3),v=Of(g.getFullYear(),m?0:g.getMonth(),h||m?1:g.getDate()),y=_d(v*e,3);if(h||m){let n=h?d/a:0,r=m?d/o:0,i=_==y?_:_d(Of(v.getFullYear()+r,v.getMonth()+n,1)*e,3),s=new Date(Ku(i/e)),c=s.getFullYear(),l=s.getMonth();for(let a=0;i<=u;a++){let o=Of(c+r*a,l+n*a,1),s=o-t(_d(o*e,3));i=_d((+o+s)*e,3),i<=u&&p.push(i)}}else{let a=d>=i?i:d,o=y+(Gu(l)-Gu(_))+hd(_-y,a);p.push(o);let m=t(o),h=m.getHours()+m.getMinutes()/n+m.getSeconds()/r,g=d/r,v=f/s.axes[c]._space;for(;o=_d(o+d,e==1?0:3),!(o>u);)if(g>1){let e=Gu(_d(h+g,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*r,h=(h+g)%24;let i=p[p.length-1];_d((o-i)/d,3)*v>=.7&&p.push(o)}else p.push(o)}return p}}return[s,c,l]}var[yf,bf,xf]=vf(1),[Sf,Cf,wf]=vf(.001);bd(2,-53,53,[1]);function Tf(e,t){return e.map(e=>e.map((n,r)=>r==0||r==8||n==null?n:t(r==1||e[8]==0?n:e[1]+n)))}function Ef(e,t){return(n,r,i,a,o)=>{let s=t.find(e=>o>=e[0])||t[t.length-1],c,l,u,d,f,p;return r.map(t=>{let n=e(t),r=n.getFullYear(),i=n.getMonth(),a=n.getDate(),o=n.getHours(),m=n.getMinutes(),h=n.getSeconds(),g=r!=c&&s[2]||i!=l&&s[3]||a!=u&&s[4]||o!=d&&s[5]||m!=f&&s[6]||h!=p&&s[7]||s[1];return c=r,l=i,u=a,d=o,f=m,p=h,g(n)})}}function Df(e,t){let n=Zd(t);return(t,r,i,a,o)=>r.map(t=>n(e(t)))}function Of(e,t,n){return new Date(e,t,n)}function kf(e,t){return t(e)}var Af=`{YYYY}-{MM}-{DD} {h}:{mm}{aa}`;function jf(e,t){return(n,r,i,a)=>a==null?tu:t(e(r))}function Mf(e,t){let n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null}function Nf(e,t){return e.series[t].fill(e,t)}var Pf={show:!0,live:!0,isolate:!1,mount:od,markers:{show:!0,width:2,stroke:Mf,fill:Nf,dash:`solid`},idx:null,idxs:null,values:[]};function Ff(e,t){let n=e.cursor.points,r=pu(),i=n.size(e,t);du(r,Ll,i),du(r,Rl,i);let a=i/-2;du(r,`marginLeft`,a),du(r,`marginTop`,a);let o=n.width(e,t,i);return o&&du(r,`borderWidth`,o),r}function If(e,t){let n=e.series[t].points;return n._fill||n._stroke}function Lf(e,t){let n=e.series[t].points;return n._stroke||n._fill}function Rf(e,t){return e.series[t].points.size}var zf=[0,0];function Bf(e,t,n){return zf[0]=t,zf[1]=n,zf}function Vf(e,t,n,r=!0){return e=>{e.button==0&&(!r||e.target==t)&&n(e)}}function Hf(e,t,n,r=!0){return e=>{(!r||e.target==t)&&n(e)}}var Uf={show:!0,x:!0,y:!0,lock:!1,move:Bf,points:{one:!1,show:Ff,size:Rf,width:0,stroke:Lf,fill:If},bind:{mousedown:Vf,mouseup:Vf,click:Vf,dblclick:Vf,mousemove:Hf,mouseleave:Hf,mouseenter:Hf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Wf={show:!0,stroke:`rgba(0,0,0,0.07)`,width:2},Gf=Nd({},Wf,{filter:cd}),Kf=Nd({},Gf,{size:10}),qf=Nd({},Wf,{show:!1}),Jf=`12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,Yf=`bold `+Jf,Xf=1.5,Zf={show:!0,scale:`x`,stroke:Ul,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Yf,side:2,grid:Gf,ticks:Kf,border:qf,font:Jf,lineGap:Xf,rotate:0},Qf=`Value`,$f=`Time`,ep={show:!0,scale:`x`,auto:!1,sorted:1,min:nd,max:-1/0,idxs:[]};function tp(e,t,n,r,i){return t.map(e=>e==null?``:Vu(e))}function np(e,t,n,r,i,a,o){let s=[],c=vd.get(i)||0;n=o?n:_d(hd(n,i),c);for(let e=n;e<=r;e=_d(e+i,c))s.push(Object.is(e,-0)?0:e);return s}function rp(e,t,n,r,i,a,o){let s=[],c=e.scales[e.axes[t].scale].log;i=Xu(c,Gu((c==10?Qu:$u)(n))),c==10&&(i=of[wu(i,of)]);let l=n,u=i*c;c==10&&(u=of[wu(u,of)]);do s.push(l),l+=i,c==10&&!vd.has(l)&&(l=_d(l,vd.get(i))),l>=u&&(i=l,u=i*c,c==10&&(u=of[wu(u,of)]));while(l<=r);return s}function ip(e,t,n,r,i,a,o){let s=e.scales[e.axes[t].scale].asinh,c=r>s?rp(e,t,Yu(s,n),r,i):[s],l=r>=0&&n<=0?[0]:[];return(n<-s?rp(e,t,Yu(s,-r),-n,i):[s]).reverse().map(e=>-e).concat(l,c)}var ap=/./,op=/[12357]/,sp=/[125]/,cp=/1/,lp=(e,t,n,r)=>e.map((e,i)=>t==4&&e==0||i%r==0&&n.test(e.toExponential()[+(e<0)])?e:null);function up(e,t,n,r,i){let a=e.axes[n],o=a.scale,s=e.scales[o],c=e.valToPos,l=a._space,u=c(10,o),d=c(9,o)-u>=l?ap:c(7,o)-u>=l?op:c(5,o)-u>=l?sp:cp;if(d==cp){let e=Wu(c(1,o)-u);if(e<l)return lp(t.slice().reverse(),s.distr,d,qu(l/e)).reve Line truncated
`)==-1?[t]:t.split(/\n/gm);for(let e=0;e<n.length;e++){let t=n[e];D?(d.save(),d.translate(a,o+e*j),d.rotate(D),d.fillText(t,0,0),d.restore()):d.fillText(t,a,o+e*j)}}}S.show&&jt(M,S.filter(r,v,e,f,x),i,n,O,T,_d(S.width*ou,3),S.stroke(r,e),S.dash,S.cap);let N=t.grid;N.show&&jt(M,N.filter(r,v,e,f,x),i,i==0?2:1,i==0?Se:xe,i==0?we:Ce,_d(N.width*ou,3),N.stroke(r,e),N.dash,N.cap),C.show&&jt([O],[1],+(i==0),i==0?1:2,i==1?Se:xe,i==1?we:Ce,_d(C.width*ou,3),C.stroke(r,e),C.dash,C.cap)}qn(`drawAxes`)}function Ft(e){v.forEach((t,n)=>{n>0&&(t._paths=null,e&&(i==1?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let It=!1,Lt=!1,Rt=[];function zt(){Lt=!1;for(let e=0;e<Rt.length;e++)qn(...Rt[e]);Rt.length=0}function Bt(){It||=(zd(Ht),!0)}function Vt(e,t=!1){It=!0,Lt=t,e(r),Ht(),t&&Rt.length>0&&queueMicrotask(zt)}r.batch=Vt;function Ht(){if(Te&&=(xt(),!1),De&&=(Me(),!1),Ee){if(du(p,Vl,_e),du(p,zl,G),du(p,Ll,U),du(p,Rl,W),du(m,Vl,_e),du(m,zl,G),du(m,Ll,U),du(m,Rl,W),du(f,Ll,he),du(f,Rl,ge),u.width=Ku(he*ou),u.height=Ku(ge*ou),y.forEach(({_el:e,_show:t,_size:n,_pos:r,side:i})=>{if(e!=null){if(t){let t=i===3||i===0?n:0,a=i%2==1;du(e,a?`left`:`top`,r-t),du(e,a?`width`:`height`,n),du(e,a?`top`:`left`,a?G:_e),du(e,a?`height`:`width`,a?W:U),uu(e,Tl)}else lu(e,Tl)}}),st=ct=lt=dt=ft=pt=mt=ht=ut=null,gt=1,jn(!0),_e!=ve||G!=K||U!=ye||W!=be){Ft(!1);let e=U/ye,t=W/be;if(z&&!Oe&&L.left>=0){L.left*=e,L.top*=t,Kt&&hu(Kt,Ku(L.left),0,U,W),qt&&hu(qt,0,Ku(L.top),U,W);for(let n=0;n<Ve.length;n++){let r=Ve[n];r!=null&&(He[n]*=e,Ue[n]*=t,hu(r,qu(He[n]),qu(Ue[n]),U,W))}}if(Y.show&&!q&&Y.left>=0&&Y.width>0){Y.left*=e,Y.width*=e,Y.top*=t,Y.height*=t;for(let e in Pn)du(on,e,Y[e])}ve=_e,K=G,ye=U,be=W}qn(`setSize`),Ee=!1}he>0&&ge>0&&(d.clearRect(0,0,u.width,u.height),qn(`drawClear`),w.forEach(e=>e()),qn(`draw`)),Y.show&&q&&(sn(Y),q=!1),z&&Oe&&(kn(null,!0,!1),Oe=!1),I.show&&I.live&&ke&&(Dn(),ke=!1),c||(c=!0,r.status=1,qn(`ready`)),it=!1,It=!1}r.redraw=(e,t)=>{De=t||!1,e===!1?Bt():ln(S,D.min,D.max)};function Ut(e,n){let i=b[e];if(i.from==null){if($e==0){let t=i.range(r,n.min,n.max,e);n.min=t[0],n.max=t[1]}if(n.min>n.max){let e=n.min;n.min=n.max,n.max=e}if($e>1&&n.min!=null&&n.max!=null&&n.max-n.min<1e-16)return;e==S&&i.distr==2&&$e>0&&(n.min=wu(n.min,t[0]),n.max=wu(n.max,t[0]),n.min==n.max&&n.max++),j[e]=n,Te=!0,Bt()}}r.setScale=Ut;let Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn=!1,rn=L.drag,an=rn.x,J=rn.y;z&&(L.x&&(Wt=pu(Dl,m)),L.y&&(Gt=pu(Ol,m)),D.ori==0?(Kt=Wt,qt=Gt):(Kt=Gt,qt=Wt),en=L.left,tn=L.top);let Y=r.select=Nd({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),on=Y.show?pu(El,Y.over?m:p):null;function sn(e,t){if(Y.show){for(let t in e)Y[t]=e[t],t in Pn&&du(on,t,e[t]);t!==!1&&qn(`setSelect`)}}r.setSelect=sn;function cn(e){if(v[e].show)R&&uu(ae[e],Tl);else if(R&&lu(ae[e],Tl),z){let t=Be?Ve[0]:Ve[e];t!=null&&hu(t,-10,-10,U,W)}}function ln(e,t,n){Ut(e,{min:t,max:n})}function un(e,t,n,a){t.focus!=null&&yn(e),t.show!=null&&v.forEach((n,r)=>{r>0&&(e==r||e==null)&&(n.show=t.show,cn(r),i==2?(ln(n.facets[0].scale,null,null),ln(n.facets[1].scale,null,null)):ln(n.scale,null,null),Bt())}),n!==!1&&qn(`setSeries`,e,t),a&&Qn(`setSeries`,r,e,t)}r.setSeries=un;function dn(e,t){Nd(x[e],t)}function fn(e,t){e.fill=$(e.fill||null),e.dir=Q(e.dir,-1),t??=x.length,x.splice(t,0,e)}function pn(e){e==null?x.length=0:x.splice(e,1)}r.addBand=fn,r.setBand=dn,r.delBand=pn;function mn(e,t){v[e].alpha=t,z&&Ve[e]!=null&&(Ve[e].style.opacity=t),R&&ae[e]&&(ae[e].style.opacity=t)}let hn,gn,_n,vn={focus:!0};function yn(e){if(e!=_n){let t=e==null,n=Re.alpha!=1;v.forEach((r,a)=>{if(i==1||a>0){let i=t||a==0||a==e;r._focus=t?null:i,n&&mn(a,i?1:Re.alpha)}}),_n=e,n&&Bt()}}R&&ze&&pe(Yl,B,e=>{L._lock||(Ie(e),_n!=null&&un(null,vn,!0,Yn.setSeries))});function bn(e,t,n){let r=b[t];n&&(e=e/ou-(r.ori==1?G:_e));let i=U;r.ori==1&&(i=W,e=i-e),r.dir==-1&&(e=i-e);let a=r._min,o=r._max,s=e/i,c=a+(o-a)*s,l=r.distr;return l==3?Xu(10,c):l==4?ed(c,r.asinh):l==100?r.bwd(c):c}function xn(e,n){return wu(bn(e,S,n),t[0],et,tt)}r.valToIdx=e=>wu(e,t[0]),r.posToIdx=xn,r.posToVal=bn,r.valToPos=(e,t,n)=>b[t].ori==0?a(e,b[t],n?Ce:U,n?xe:0):o(e,b[t],n?we:W,n?Se:0),r.setCursor=(e,t,n)=>{en=e.left,tn=e.top,kn(null,t,n)};function Sn(e,t){du(on,Vl,Y.left=e),du(on,Ll,Y.width=t)}function Cn(e,t){du(on,zl,Y.top=e),du(on,Rl,Y.height=t)}let wn=D.ori==0?Sn:Cn,Tn=D.ori==1?Sn:Cn;function En(){if(R&&I.live)for(let e=+(i==2);e<v.length;e++){if(e==0&&ce)continue;let t=I.values[e],n=0;for(let r in t)oe[e][n++].firstChild.nodeValue=t[r]}}function Dn(e,t){if(e!=null&&(e.idxs?e.idxs.forEach((e,t)=>{F[t]=e}):Ed(e.idx)||F.fill(e.idx),I.idx=F[0]),R&&I.live){for(let e=0;e<v.length;e++)(e>0||i==1&&!ce)&&On(e,F[e]);En()}ke=!1,t!==!1&&qn(`setLegend`)}r.setLegend=Dn;function On(e,n){let i=v[e],a=e==0&&O==2?rt:t[e],o;ce?o=i.values(r,e,n)??V:(o=i.value(r,n==null?null:a[n],e,n),o=o==null?V:{_:o}),I.values[e]=o}function kn(e,n,a){Qt=en,$t=tn,[en,tn]=L.move(r,en,tn),L.left=en,L.top=tn,z&&(Kt&&hu(Kt,Ku(en),0,U,W),qt&&hu(q Line truncated
@@ -0,0 +1,76 @@
import{i as e,n as t,r as n,t as r}from"./rolldown-runtime-B0Z9INg1.js";function i(e,t){for(var n in t)e[n]=t[n];return e}function a(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function o(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?te.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return s(e,o,r,i,null)}function s(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++I,__i:-1,__u:0};return i==null&&F.vnode!=null&&F.vnode(a),a}function c(){return{current:null}}function l(e){return e.children}function u(e,t){this.props=e,this.context=t}function d(e,t){if(t==null)return e.__?d(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?d(e):null}function f(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],o=i({},t);o.__v=t.__v+1,F.vnode&&F.vnode(o),w(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??d(t),!!(32&t.__u),a),o.__v=t.__v,o.__.__k[o.__i]=o,E(r,o,a),t.__e=t.__=null,o.__e!=n&&p(o)}}function p(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),p(e)}function m(e){(!e.__d&&(e.__d=!0)&&L.push(e)&&!h.__r++||R!=F.debounceRendering)&&((R=F.debounceRendering)||z)(h)}function h(){try{for(var e,t=1;L.length;)L.length>t&&L.sort(B),e=L.shift(),t=L.length,f(e)}finally{L.length=h.__r=0}}function g(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,y=r&&r.__k||U,b=t.length;for(c=_(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&y[p.__i]||ce,p.__i=d,g=w(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&k(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),4&p.__u?(c=v(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function _(e,t,n,r,i){var a,o,c,u,f,p=n.length,m=p,h=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=s(null,o,null,null,null):ue(o)?o=e.__k[a]=s(l,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=s(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,u=a+h,o.__=e,o.__b=e.__b+1,c=null,(f=o.__i=b(o,n,u,m))!=-1&&(m--,(c=n[f])&&(c.__u|=2)),c==null||c.__v==null?(f==-1&&(i>p?h--:i<p&&h++),typeof o.type!=`function`&&(o.__u|=4)):f!=u&&(f==u-1?h--:f==u+1?h++:(f>u?h--:h++,o.__u|=4))):e.__k[a]=null;if(m)for(a=0;a<p;a++)(c=n[a])!=null&&!(2&c.__u)&&(c.__e==r&&(r=d(c)),A(c,c));return r}function v(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=v(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=d(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function y(e,t){return t||=[],e==null||typeof e==`boolean`||(ue(e)?e.some(function(e){y(e,t)}):t.push(e)),t}function b(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function x(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||le.test(t)?n:n+`px`}function S(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||x(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||x(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ie,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[re]=r[re]:(n[re]=ae,e.addEventListener(t,a?se:oe,a)):e.removeEventListener(t,a?se:oe,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function C(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ne]==null)t[ne]=ae++;else if(t[ne]<n[re])return;return n(F.event?F.event(t):t)}}}function w(e,t,n,r,o,s,c,f,p,m){var h,_,v,y,b,x,S,C,w,E,k,A,M,ee,N,P,te=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(p=!!(32&n.__u),s=[f=t.__e=n.__e]),(h=F.__b)&&h(t);n:if(typeof te==`function`){_=c.length;try{if(w=t.props,E=te.prototype&&te.prototype.render,k=(h=te.contextType)&&r[h.__c],A=h?k?k.props.value:h.__:r,n.__c?C=(v=t.__c=n.__c).__=v.__E:(E?t.__c=v=new te(w,A):(t.__c=v=new u(w,A),v.constructor=te,v.render=j),k&&k.sub(v),v.state||(v.state={}),v._Line truncated
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=Cr(),f;if(t){let e=typeof t==`string`?ln(t):t;Y(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let p=f.pathname||`/`,m=p;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let h=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):fn(e,{pathname:m});X(u||h!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),X(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=Br(h&&h.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:Bn([l,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:Bn([l,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&g?o(pr.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},g):g}function Pr(){let e=qr(),t=Kn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=o(l,null,o(`p`,null,`💿 Hey developer 👋`),o(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,o(`code`,{style:a},`ErrorBoundary`),` or`,` `,o(`code`,{style:a},`errorElement`),` prop on your route.`)),o(l,null,o(`h2`,null,`Unexpected Application Error!`),o(`h3`,{style:{fontStyle:`italic`}},t),n?o(`pre`,{style:i},n):null,s)}var Fr=o(Pr,null),Ir=class extends u{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=br(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:o(mr.Provider,{value:this.props.routeContext},o(hr.Provider,{value:e,children:this.props.component}));return this.context?o(Rr,{error:e},t):t}};Ir.contextType=sr;var Lr=new WeakMap;function Rr({children:e,error:t}){let{basename:n,navigator:r}=q(fr);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=yr(t.digest);if(e){let i=Lr.get(t);if(i)throw i;let a=Yn(e.location,n),s=a.absoluteURL||a.to;if(er(e.location,s,Zn(r),`allow-explicit`),ir(s))throw Error(`Invalid redirect location`);if(Jn&&!Lr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=s;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Lr.set(t,n),n}}return o(`meta`,{httpEquiv:`refresh`,content:`0;url=${s}`})}}return e}function zr({routeContext:e,match:t,children:n}){let r=q(ar);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),o(mr.Provider,{value:e},n)}function Br(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);Y(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,c=-1;if(n&&r){s=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:a}=r,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),i=c>=0?i.slice(0,c+1):[i[0]];break}}}}let lLine truncated
`)>=0)return!1;return!0}function be(e,t){var n;if(e.indent===` `)n=` `;else if(typeof e.indent==`number`&&e.indent>0)n=C.call(Array(e.indent+1),` `);else return null;return{base:n,prev:C.call(Array(t+1),n)}}function xe(e,t){if(e.length===0)return``;var n=`
`+t.prev+t.base;return n+C.call(e,`,`+n)+`
`+t.prev}function Se(e,t){var n=B(e),r=[];if(n){r.length=e.length;for(var i=0;i<e.length;i++)r[i]=U(e,i)?t(e[i],e):``}var a=typeof D==`function`?D(e):[],o;if(k){o={};for(var s=0;s<a.length;s++)o[`$`+a[s]]=a[s]}for(var c in e)U(e,c)&&(n&&String(Number(c))===c&&c<e.length||k&&o[`$`+c]instanceof Symbol||(x.call(/[^\w$]/,c)?r.push(t(c,e)+`: `+t(e[c],e)):r.push(c+`: `+t(e[c],e))));if(typeof D==`function`)for(var l=0;l<a.length;l++)j.call(e,a[l])&&r.push(`[`+t(a[l])+`]: `+t(e[a[l]],e));return r}})),aa=r(((e,t)=>{var n=ia(),r=na(),i=function(e,t,n){for(var r=e,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},a=function(e,t){if(e){var n=i(e,t);return n&&n.value}},o=function(e,t,n){var r=i(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}},s=function(e,t){return e?!!i(e,t):!1},c=function(e,t){if(e)return i(e,t,!0)};t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new r(`Side channel does not contain `+n(e))},delete:function(t){var n=c(e,t);return n&&e&&!e.next&&(e=void 0),!!n},get:function(t){return a(e,t)},has:function(t){return s(e,t)},set:function(t,n){e||={next:void 0},o(e,t,n)}};return t}})),oa=r(((e,t)=>{t.exports=Object})),sa=r(((e,t)=>{t.exports=Error})),ca=r(((e,t)=>{t.exports=EvalError})),la=r(((e,t)=>{t.exports=RangeError})),ua=r(((e,t)=>{t.exports=ReferenceError})),da=r(((e,t)=>{t.exports=SyntaxError})),fa=r(((e,t)=>{t.exports=URIError})),pa=r(((e,t)=>{t.exports=Math.abs})),ma=r(((e,t)=>{t.exports=Math.floor})),ha=r(((e,t)=>{t.exports=Math.max})),ga=r(((e,t)=>{t.exports=Math.min})),_a=r(((e,t)=>{t.exports=Math.pow})),va=r(((e,t)=>{t.exports=Math.round})),ya=r(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),ba=r(((e,t)=>{var n=ya();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),xa=r(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),Sa=r(((e,t)=>{var n=xa();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),Ca=r(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),wa=r(((e,t)=>{t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}})),Ta=r(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=wa();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),Ea=r(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),Da=r(((e,t)=>{t.exports=oa().getPrototypeOf||null})),Oa=r(((e,t)=>{var n=Object.prototype.toString,r=Math.max,i=`[object Function]`,a=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},o=function(e,t){for(var n=[],r=t||0,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},s=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||n.apply(t)!==i)throw TypeError(`Function.prototype.bind called on incompatible `+t);for(var c=o(arguments,1),l,u=function(){if(this instanceof l){var n=t.apply(this,a(c,arguments));return Object(n)===n?n:this}return t.apply(e,a(c,arguments))},d=r(0,t.length-c.length),f=[],p=0;p<d;p++)f[p]=`$`+p;if(l=Function(`binder`,`return function (`+s(f,`,`)+`){ return binder.apply(this,arguments); }`)(u),t.prototype){var m=function(){};m.prototype=t.prototype,l.prototype=new m,m.prototype=null}return l}})),ka=r(((e,t)=>{var n=Oa();t.exports=Function.prototype.bind||n})),Aa=r(((e,t)=>{t.exports=Function.prototype.call})),ja=r(((e,t)=>{t.exports=Function.prototype.apply})),Ma=r(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),Na=r(((e,t)=>{var n=ka(),r=ja(),i=Aa();t.exports=Ma()||n.call(i,r)})),Pa=r(((e,t)=>{var n=ka(),r=na(),i=Aa(),a=Na();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),Fa=r(((e,t)=>{var n=Pa(),r=Sa(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`&&function(e){return s(e==null?e:o(e))}})),Ia=r(((e,t)=>{var n=Ea(),r=Da(),i=Fa();t.exports=n?function(e){return n(e)}:r?fun Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function no(e,t){return $a(e)||eo(e,t)||ro(e,t)||to()}function ro(e,t){if(e){if(typeof e==`string`)return Qa(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qa(e,t):void 0}}var io=Object.entries,ao=Object.setPrototypeOf,oo=Object.isFrozen,so=Object.getPrototypeOf,co=Object.getOwnPropertyDescriptor,lo=Object.freeze,uo=Object.seal,fo=Object.create,po=typeof Reflect<`u`&&Reflect,mo=po.apply,ho=po.construct;lo||=function(e){return e},uo||=function(e){return e},mo||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ho||=function(e){return new e(...[...arguments].slice(1))};var go=Io(Array.prototype.forEach),_o=Io(Array.prototype.lastIndexOf),vo=Io(Array.prototype.pop),yo=Io(Array.prototype.push),bo=Io(Array.prototype.splice),xo=Array.isArray,So=Io(String.prototype.toLowerCase),Co=Io(String.prototype.toString),wo=Io(String.prototype.match),To=Io(String.prototype.replace),Eo=Io(String.prototype.indexOf),Do=Io(String.prototype.trim),Oo=Io(Number.prototype.toString),ko=Io(Boolean.prototype.toString),Ao=typeof BigInt>`u`?null:Io(BigInt.prototype.toString),jo=typeof Symbol>`u`?null:Io(Symbol.prototype.toString),Mo=Io(Object.prototype.hasOwnProperty),No=Io(Object.prototype.toString),Po=Io(RegExp.prototype.test),Fo=Lo(TypeError);function Io(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return mo(e,t,n)}}function Lo(e){return function(){return ho(e,[...arguments])}}function Z(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:So;if(ao&&ao(e,null),!xo(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(oo(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ro(e){for(let t=0;t<e.length;t++)Mo(e,t)||(e[t]=null);return e}function zo(e){let t=fo(null);for(let r of io(e)){var n=no(r,2);let i=n[0],a=n[1];Mo(e,i)&&(t[i]=xo(a)?Ro(a):a&&typeof a==`object`&&a.constructor===Object?zo(a):a)}return t}function Bo(e){switch(typeof e){case`string`:return e;case`number`:return Oo(e);case`boolean`:return ko(e);case`bigint`:return Ao?Ao(e):`0`;case`symbol`:return jo?jo(e):`Symbol()`;case`undefined`:return No(e);case`function`:case`object`:{if(e===null)return No(e);let t=e,n=Vo(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:No(e)}return No(e)}default:return No(e)}}function Vo(e,t){for(;e!==null;){let n=co(e,t);if(n){if(n.get)return Io(n.get);if(typeof n.value==`function`)return Io(n.value)}e=so(e)}function n(){return null}return n}function Ho(e){try{return Po(e,``),!0}catch{return!1}}var Uo=lo(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Wo=lo(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Go=lo([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ko=lo([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),qo=lo(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Jo=lo([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Yo=lo([`#text`]),Xo=lo(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.Line truncated
`+u),ge&&(u=gt(u)),T&&Ce?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$e(e),q=!0,ve=H,ye=U},t.clearConfig=function(){Xe=null,q=!1,ve=null,ye=null,T=D,E=``},t.isValidAttribute=function(e,t,n){Xe||$e({});let r=Ye(e),i=Ye(t);return Ot(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Mo(R,e)&&yo(R[e],t)},t.removeHook=function(e,t){if(Mo(R,e)){if(t!==void 0){let n=_o(R[e],t);return n===-1?void 0:bo(R[e],n,1)[0]}return vo(R[e])}},t.removeHooks=function(e){Mo(R,e)&&(R[e]=[])},t.removeAllHooks=function(){R=bs()},t}var ws=Cs();function Ts(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Es=Ts();function Ds(e){Es=e}var Os={exec:()=>null};function ks(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Q(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(js.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var As=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),js={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ks(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ks(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:ks(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ks(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ks(e=>RegExp(`^ {0,${e}}(?:</?(?:${Ks})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:ks(e=>RegExp(`^ {0,${e}}>`))},Ms=/^(?:[ \t]*(?:\n|$))+/,Ns=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ps=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Fs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Is=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ls=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Rs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,zs=Q(Rs).replace(/bull/g,Ls).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Bs=Q(Rs).replace(/bull/g,Ls).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Vs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Hs=/^[^\n]+/,Us=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ws=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Us).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gs=Q(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ls).getRegex(),Ks=`address|article|aside|base|basefont|blockquote|body|caption|center|col|co Line truncated
]`).replace(`lheading`,zs).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},nc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ic=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ac=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,oc=/[\p{P}\p{S}]/u,sc=/[\s\p{P}\p{S}]/u,cc=/[^\s\p{P}\p{S}]/u,lc=Q(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,sc).getRegex(),uc=/[\p{Pi}\p{Ps}"']/u,dc=/(?!~)[\p{P}\p{S}]/u,fc=/(?!~)[\s\p{P}\p{S}]/u,pc=/(?:[^\s\p{P}\p{S}]|~)/u,mc=Q(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,As?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),hc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,gc=Q(hc,`u`).replace(/punct/g,oc).getRegex(),_c=Q(hc,`u`).replace(/punct/g,dc).getRegex(),vc=Q(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,uc).replace(/punct/g,oc).getRegex(),yc=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,bc=Q(yc,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),xc=Q(yc,`gu`).replace(/notPunctSpace/g,pc).replace(/punctSpace/g,fc).replace(/punct/g,dc).getRegex(),Sc=Q(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),Cc=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),wc=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),Tc=Q(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,oc).getRegex(),Ec=Q(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,cc).replace(/punctSpace/g,sc).replace(/punct/g,oc).getRegex(),Dc=Q(/\\(punct)/,`gu`).replace(/punct/g,oc).getRegex(),Oc=Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kc=Q(qs).replace(`(?:-->|$)`,`-->`).getRegex(),Ac=Q(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,kc).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jc=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Mc=Q(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,jc).getRegex(),Nc=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Mc).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pc=Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Mc).replace(`ref`,Us).getRegex(),Fc=Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Us).getRegex(),Ic=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Lc=Q(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,jc).getRegex(),Rc=Q(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Lc).replace(`ref`,Ic).getRegex()).replace(`nolink`,Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ic).getRegex()).getRegex(),zc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bc=Q(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),Vc={_backpedal:Os,anyPunctLine truncated
`),n=t.length-1;for(;n>=0&&js.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
`)}function tl(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function nl(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function rl(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function il(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function al(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
`)}function ol(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var sl=class{options;rules;lexer;constructor(e){this.options=e||Es}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:el(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=al(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=$c(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:$c(t[0],`
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:$c(t[0],`
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=$c(t[0],`
`).split(`
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
${s}`:s,r=r?`${r}
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
`),o=t.raw+`
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
${d.join(`
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
`+e.join(`
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
`,1)[0],l=t[1].length,u=this.options.pedantic?rl(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>rl(e,l)),d=e.split(`
`,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
`,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
`,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
`+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
`+d}f=!d.trim(),r+=l+`
`,e=e.substring(l.length+1),u=m.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=el(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=tl(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:$c(t[0],`
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Qc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
`):[],a={type:`table`,raw:$c(t[0],`
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Qc(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:$c(t[0],`
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ol(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=$c(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=nl(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),il(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ol(e,n[1],r,this.rules))return;let i=t[tl((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return il(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Xc(t[0]),escaped:e}}}},cl=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Es,this.options.tokenizer=this.options.tokenizer||new sl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,in Line truncated
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(js.tabCharGlobal,` `).replace(js.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+i.raw,n.text+=`
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+i.raw,n.text+=`
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
`)?``:`
`)+i.raw,r.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+i.raw,n.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,tl(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,tl(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},ll=class{options;parser;constructor(e){this.options=e||Es}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(js.notSpaceStart)?.[0],i=e?e.replace(js.endingNewline,``)+`
`:``;return r?`<pre><code class="language-`+Yc(r)+`">`+(n?i:Yc(i,!0))+`</code></pre>
`:`<pre><code>`+(n?i:Yc(i,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
`+r+`</`+i+`>
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
<thead>
`+t+`</thead>
`+r+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Yc(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?Yc(n,!0):this.parser.parseInline(r),o=Zc(e);if(o===null)return a;e=Yc(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Yc(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Zc(e);if(i===null)return Yc(n);e=i;let a=`<img src="${Yc(e)}" alt="${Yc(n)}"`;return t&&(a+=` title="${Yc(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Yc(e.text)}},ul=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},dl=class e{options;renderer;textRenderer;constructor(e){this.options=e||Es,this.options.renderer=this.options.renderer||new ll,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ul}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},fl=class{options;block;constructor(e){this.options=e||Es}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?cl.lex:cl.lexInline}provideParser(e=this.block){return e?dl.parse:dl.parseInline}},pl=new class{defaults=Ts();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=dl;Renderer=ll;TextRenderer=ul;Lexer=cl;Tokenizer=sl;Hooks=fl;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renLine truncated
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Yc(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function ml(e,t){return pl.parse(e,t)}ml.options=ml.setOptions=function(e){return pl.setOptions(e),ml.defaults=pl.defaults,Ds(ml.defaults),ml},ml.getDefaults=Ts,ml.defaults=Es;function hl(...e){return pl.use(...e),ml.defaults=pl.defaults,Ds(ml.defaults),ml}ml.use=hl,ml.walkTokens=function(e,t){return pl.walkTokens(e,t)},ml.parseInline=pl.parseInline,ml.Parser=dl,ml.parser=dl.parse,ml.Renderer=ll,ml.TextRenderer=ul,ml.Lexer=cl,ml.lexer=cl.lex,ml.Tokenizer=sl,ml.Hooks=fl,ml.parse=ml,ml.options,ml.setOptions,ml.walkTokens,ml.parseInline,dl.parse,cl.lex;var gl=!0,_l=`uplot`,vl=`u-hz`,yl=`u-vt`,bl=`u-title`,xl=`u-wrap`,Sl=`u-under`,Cl=`u-over`,wl=`u-axis`,Tl=`u-off`,El=`u-select`,Dl=`u-cursor-x`,Ol=`u-cursor-y`,kl=`u-cursor-pt`,Al=`u-legend`,jl=`u-live`,Ml=`u-inline`,Nl=`u-series`,Pl=`u-marker`,Fl=`u-label`,Il=`u-value`,Ll=`width`,Rl=`height`,zl=`top`,Bl=`bottom`,Vl=`left`,Hl=`right`,Ul=`#000`,Wl=`#0000`,Gl=`mousemove`,Kl=`mousedown`,ql=`mouseup`,Jl=`mouseenter`,Yl=`mouseleave`,Xl=`dblclick`,Zl=`resize`,Ql=`scroll`,$l=`change`,eu=`dppxchange`,tu=`--`,nu=typeof window<`u`,ru=nu?document:null,iu=nu?window:null,au=nu?navigator:null,ou,su;function cu(){let e=devicePixelRatio;ou!=e&&(ou=e,su&&Cu($l,su,cu),su=matchMedia(`(min-resolution: ${ou-.001}dppx) and (max-resolution: ${ou+.001}dppx)`),Su($l,su,cu),iu.dispatchEvent(new CustomEvent(eu)))}function lu(e,t){if(t!=null){let n=e.classList;!n.contains(t)&&n.add(t)}}function uu(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function du(e,t,n){e.style[t]=n+`px`}function fu(e,t,n,r){let i=ru.createElement(e);return t!=null&&lu(i,t),n?.insertBefore(i,r),i}function pu(e,t){return fu(`div`,e,t)}var mu=new WeakMap;function hu(e,t,n,r,i){let a=`translate(`+t+`px,`+n+`px)`;a!=mu.get(e)&&(e.style.transform=a,mu.set(e,a),t<0||n<0||t>r||n>i?lu(e,Tl):uu(e,Tl))}var gu=new WeakMap;function _u(e,t,n){let r=t+n;r!=gu.get(e)&&(gu.set(e,r),e.style.background=t,e.style.borderColor=n)}var vu=new WeakMap;function yu(e,t,n,r){let i=t+``+n;i!=vu.get(e)&&(vu.set(e,i),e.style.height=n+`px`,e.style.width=t+`px`,e.style.marginLeft=r?-t/2+`px`:0,e.style.marginTop=r?-n/2+`px`:0)}var bu={passive:!0},xu={...bu,capture:!0};function Su(e,t,n,r){t.addEventListener(e,n,r?xu:bu)}function Cu(e,t,n,r){t.removeEventListener(e,n,bu)}nu&&cu();function wu(e,t,n,r){let i;n||=0,r||=t.length-1;let a=r<=2147483647;for(;r-n>1;)i=a?n+r>>1:Ku((n+r)/2),t[i]<e?n=i:r=i;return e-t[n]<=t[r]-e?n:r}function Tu(e){return(t,n,r)=>{let i=-1,a=-1;for(let a=n;a<=r;a++)if(e(t[a])){i=a;break}for(let i=r;i>=n;i--)if(e(t[i])){a=i;break}return[i,a]}}var Eu=e=>e!=null,Du=e=>e!=null&&e>0,Ou=Tu(Eu),ku=Tu(Du);function Au(e,t,n,r=0,i=!1){let a=i?ku:Ou,o=i?Du:Eu;[t,n]=a(e,t,n);let s=e[t],c=e[t];if(t>-1){if(r==1)s=e[t],c=e[n];else if(r==-1)s=e[n],c=e[t];else for(let r=t;r<=n;r++){let t=e[r];o(t)&&(t<s?s=t:t>c&&(c=t))}}return[s??rd,c??-rd]}function ju(e,t,n,r){let i=Qu(e),a=Qu(t);e==t&&(i==-1?(e*=n,t/=n):(e/=n,t*=n));let o=n==10?$u:ed,s=i==1?Ku:Ju,c=a==1?Ju:Ku,l=s(o(Gu(e))),u=c(o(Gu(t))),d=Zu(n,l),f=Zu(n,u);return n==10&&(l<0&&(d=vd(d,-l)),u<0&&(f=vd(f,-u))),r||n==2?(e=d*i,t=f*a):(e=_d(e,d),t=gd(t,f)),[e,t]}function Mu(e,t,n,r){let i=ju(e,t,n,r);return e==0&&(i[0]=0),t==0&&(i[1]=0),i}var Nu=.1,Pu={mode:3,pad:Nu},Fu={pad:0,soft:null,mode:0},Iu={min:Fu,max:Fu};function Lu(e,t,n,r){return kd(n)?Bu(e,t,n):(Fu.pad=n,Fu.soft=r?0:null,Fu.mode=r?3:0,Bu(e,t,Iu))}function Ru(e,t){return e??t}function zu(e,t,n){for(t=Ru(t,0),n=Ru(n,e.length-1);t<=n;){if(e[t]!=null)return!0;t++}return!1}function Bu(e,t,n){let r=n.min,i=n.max,a=Ru(r.pad,0),o=Ru(i.pad,0),s=Ru(r.hard,-rd),c=Ru(i.hard,rd),l=Ru(r.soft,rd),u=Ru(i.soft,-rd),d=Ru(r.mode,0),f=Ru(i.mode,0),p=t-e,m=$u(p),h=Xu(Gu(e),Gu(t)),g=Gu($u(h)-m);(p<1e-24||g>10)&&(p=0,(e==0||t==0)&&(p=1e-24,d==2&&l!=rd&&(a=0),f==2&&u!=-rd&&(o=0)));let _=p||h||1e3,v=Zu(10,Ku($u(_))),y=vd(_d(e-_*(p==0?e==0?.1:1:a),v/10),24),b=e>=l&&(d==1||d==3&&y<=l||d==2&&y>=l)?l:rd,x=Xu(s,y<b&&e>=b?b:Yu(b,y)),S=vd(gd(t+_*(p==0?t==0?.1:1:o),v/10),24),C=t<=u&&(f==1||f==3&&S>=u||f==2&&S<=u)?u:-rd,w=Yu(c,S>C&&t<=C?C:Xu(C,S));return x==w&&x==0&&(w=100),[x,w]}var Vu=new Intl.NumberFormat(nu?au.language:`en-US`),Hu=e=>Vu.format(e),Uu=Math,Wu=Uu.PI,Gu=Uu.abs,Ku=Uu.floor,qu=Uu.round,Ju=Uu.ceil,Yu=Uu.min,Xu=Uu.max,Zu=Uu.pow,Qu=Uu.sign,$u=Uu.log10,ed=Uu.log2,td=(e,t=1)=>Uu.sinh(e)*t,nd=(e,t=1)=>Uu.asinh(e/t),rd=1/0;function id(e){return($u((e^e>>31)-(e>>31))|0)+1}function ad(e,t,n){return Yu(Xu(e,t),n)}function od(e){return typeof e==`function`}function $(e){return od(e)?e:()=>e}var sd=()=>{},cd=e=>e,ld=(e,t)=>t,ud=e=>null,dd=e=>!0,fd=(e,t)=>e==t,pd=/\.\d*?(?=9{6,}|0{6,})/gm,md=e=>{if(Ed(e)||yd.has(e))return e;let t=`${e}`,n=t.match(pd);if(n==null)return e;let r=n[0].length-1;if(t.indexOf(`e-`)!=-1){let[e,n]=t.split(`e`);return+`${md(e)}e${n}`}return v Line truncated
`,lf=`{YYYY}`,uf=cf+lf,df=`{M}/{D}`,ff=cf+df,pf=ff+`/{YY}`,mf=`{aa}`,hf=`{h}:{mm}`+mf,gf=cf+hf,_f=`:{ss}`,vf=null;function yf(e){let t=e*1e3,n=t*60,r=n*60,i=r*24,a=i*30,o=i*365,s=(e==1?xd(10,0,3,nf).filter(tf):xd(10,-3,0,nf)).concat([t,t*5,t*10,t*15,t*30,n,n*5,n*10,n*15,n*30,r,r*2,r*3,r*4,r*6,r*8,r*12,i,i*2,i*3,i*4,i*5,i*6,i*7,i*8,i*9,i*10,i*15,a,a*2,a*3,a*4,a*6,o,o*2,o*5,o*10,o*25,o*50,o*100]),c=[[o,lf,vf,vf,vf,vf,vf,vf,1],[i*28,`{MMM}`,uf,vf,vf,vf,vf,vf,1],[i,df,uf,vf,vf,vf,vf,vf,1],[r,`{h}`+mf,pf,vf,ff,vf,vf,vf,1],[n,hf,pf,vf,ff,vf,vf,vf,1],[t,_f,pf+` `+hf,vf,ff+` `+hf,vf,gf,vf,1],[e,_f+`.{fff}`,pf+` `+hf,vf,ff+` `+hf,vf,gf,vf,1]];function l(t){return(s,c,l,u,d,f)=>{let p=[],m=d>=o,h=d>=a&&d<o,g=t(l),_=vd(g*e,3),v=kf(g.getFullYear(),m?0:g.getMonth(),h||m?1:g.getDate()),y=vd(v*e,3);if(h||m){let n=h?d/a:0,r=m?d/o:0,i=_==y?_:vd(kf(v.getFullYear()+r,v.getMonth()+n,1)*e,3),s=new Date(qu(i/e)),c=s.getFullYear(),l=s.getMonth();for(let a=0;i<=u;a++){let o=kf(c+r*a,l+n*a,1),s=o-t(vd(o*e,3));i=vd((+o+s)*e,3),i<=u&&p.push(i)}}else{let a=d>=i?i:d,o=y+(Ku(l)-Ku(_))+gd(_-y,a);p.push(o);let m=t(o),h=m.getHours()+m.getMinutes()/n+m.getSeconds()/r,g=d/r,v=f/s.axes[c]._space;for(;o=vd(o+d,e==1?0:3),!(o>u);)if(g>1){let e=Ku(vd(h+g,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*r,h=(h+g)%24;let i=p[p.length-1];vd((o-i)/d,3)*v>=.7&&p.push(o)}else p.push(o)}return p}}return[s,c,l]}var[bf,xf,Sf]=yf(1),[Cf,wf,Tf]=yf(.001);xd(2,-53,53,[1]);function Ef(e,t){return e.map(e=>e.map((n,r)=>r==0||r==8||n==null?n:t(r==1||e[8]==0?n:e[1]+n)))}function Df(e,t){return(n,r,i,a,o)=>{let s=t.find(e=>o>=e[0])||t[t.length-1],c,l,u,d,f,p;return r.map(t=>{let n=e(t),r=n.getFullYear(),i=n.getMonth(),a=n.getDate(),o=n.getHours(),m=n.getMinutes(),h=n.getSeconds(),g=r!=c&&s[2]||i!=l&&s[3]||a!=u&&s[4]||o!=d&&s[5]||m!=f&&s[6]||h!=p&&s[7]||s[1];return c=r,l=i,u=a,d=o,f=m,p=h,g(n)})}}function Of(e,t){let n=Qd(t);return(t,r,i,a,o)=>r.map(t=>n(e(t)))}function kf(e,t,n){return new Date(e,t,n)}function Af(e,t){return t(e)}var jf=`{YYYY}-{MM}-{DD} {h}:{mm}{aa}`;function Mf(e,t){return(n,r,i,a)=>a==null?tu:t(e(r))}function Nf(e,t){let n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null}function Pf(e,t){return e.series[t].fill(e,t)}var Ff={show:!0,live:!0,isolate:!1,mount:sd,markers:{show:!0,width:2,stroke:Nf,fill:Pf,dash:`solid`},idx:null,idxs:null,values:[]};function If(e,t){let n=e.cursor.points,r=pu(),i=n.size(e,t);du(r,Ll,i),du(r,Rl,i);let a=i/-2;du(r,`marginLeft`,a),du(r,`marginTop`,a);let o=n.width(e,t,i);return o&&du(r,`borderWidth`,o),r}function Lf(e,t){let n=e.series[t].points;return n._fill||n._stroke}function Rf(e,t){let n=e.series[t].points;return n._stroke||n._fill}function zf(e,t){return e.series[t].points.size}var Bf=[0,0];function Vf(e,t,n){return Bf[0]=t,Bf[1]=n,Bf}function Hf(e,t,n,r=!0){return e=>{e.button==0&&(!r||e.target==t)&&n(e)}}function Uf(e,t,n,r=!0){return e=>{(!r||e.target==t)&&n(e)}}var Wf={show:!0,x:!0,y:!0,lock:!1,move:Vf,points:{one:!1,show:If,size:zf,width:0,stroke:Rf,fill:Lf},bind:{mousedown:Hf,mouseup:Hf,click:Hf,dblclick:Hf,mousemove:Uf,mouseleave:Uf,mouseenter:Uf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Gf={show:!0,stroke:`rgba(0,0,0,0.07)`,width:2},Kf=Pd({},Gf,{filter:ld}),qf=Pd({},Kf,{size:10}),Jf=Pd({},Gf,{show:!1}),Yf=`12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,Xf=`bold `+Yf,Zf=1.5,Qf={show:!0,scale:`x`,stroke:Ul,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Xf,side:2,grid:Kf,ticks:qf,border:Jf,font:Yf,lineGap:Zf,rotate:0},$f=`Value`,ep=`Time`,tp={show:!0,scale:`x`,auto:!1,sorted:1,min:rd,max:-1/0,idxs:[]};function np(e,t,n,r,i){return t.map(e=>e==null?``:Hu(e))}function rp(e,t,n,r,i,a,o){let s=[],c=yd.get(i)||0;n=o?n:vd(gd(n,i),c);for(let e=n;e<=r;e=vd(e+i,c))s.push(Object.is(e,-0)?0:e);return s}function ip(e,t,n,r,i,a,o){let s=[],c=e.scales[e.axes[t].scale].log;i=Zu(c,Ku((c==10?$u:ed)(n))),c==10&&(i=sf[wu(i,sf)]);let l=n,u=i*c;c==10&&(u=sf[wu(u,sf)]);do s.push(l),l+=i,c==10&&!yd.has(l)&&(l=vd(l,yd.get(i))),l>=u&&(i=l,u=i*c,c==10&&(u=sf[wu(u,sf)]));while(l<=r);return s}function ap(e,t,n,r,i,a,o){let s=e.scales[e.axes[t].scale].asinh,c=r>s?ip(e,t,Xu(s,n),r,i):[s],l=r>=0&&n<=0?[0]:[];return(n<-s?ip(e,t,Xu(s,-r),-n,i):[s]).reverse().map(e=>-e).concat(l,c)}var op=/./,sp=/[12357]/,cp=/[125]/,lp=/1/,up=(e,t,n,r)=>e.map((e,i)=>t==4&&e==0||i%r==0&&n.test(e.toExponential()[+(e<0)])?e:null);function dp(e,t,n,r,i){let a=e.axes[n],o=a.scale,s=e.scales[o],c=e.valToPos,l=a._space,u=c(10,o),d=c(9,o)-u>=l?op:c(7,o)-u>=l?sp:c(5,o)-u>=l?cp:lp;if(d==lp){let e=Gu(c(1,o)-u);if(e<l)return up(t.slice().reverse(),s.distr,d,Ju(l/e)).reve Line truncated
`)==-1?[t]:t.split(/\n/gm);for(let e=0;e<n.length;e++){let t=n[e];D?(d.save(),d.translate(a,o+e*j),d.rotate(D),d.fillText(t,0,0),d.restore()):d.fillText(t,a,o+e*j)}}}S.show&&At(M,S.filter(r,v,e,f,x),i,n,O,T,vd(S.width*ou,3),S.stroke(r,e),S.dash,S.cap);let N=t.grid;N.show&&At(M,N.filter(r,v,e,f,x),i,i==0?2:1,i==0?xe:be,i==0?Ce:Se,vd(N.width*ou,3),N.stroke(r,e),N.dash,N.cap),C.show&&At([O],[1],+(i==0),i==0?1:2,i==1?xe:be,i==1?Ce:Se,vd(C.width*ou,3),C.stroke(r,e),C.dash,C.cap)}Kn(`drawAxes`)}function Pt(e){v.forEach((t,n)=>{n>0&&(t._paths=null,e&&(i==1?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let Ft=!1,It=!1,Lt=[];function Rt(){It=!1;for(let e=0;e<Lt.length;e++)Kn(...Lt[e]);Lt.length=0}function zt(){Ft||=(Bd(Vt),!0)}function Bt(e,t=!1){Ft=!0,It=t,e(r),Vt(),t&&Lt.length>0&&queueMicrotask(Rt)}r.batch=Bt;function Vt(){if(we&&=(bt(),!1),Ee&&=(je(),!1),Te){if(du(p,Vl,ge),du(p,zl,K),du(p,Ll,W),du(p,Rl,G),du(m,Vl,ge),du(m,zl,K),du(m,Ll,W),du(m,Rl,G),du(f,Ll,me),du(f,Rl,he),u.width=qu(me*ou),u.height=qu(he*ou),y.forEach(({_el:e,_show:t,_size:n,_pos:r,side:i})=>{if(e!=null){if(t){let t=i===3||i===0?n:0,a=i%2==1;du(e,a?`left`:`top`,r-t),du(e,a?`width`:`height`,n),du(e,a?`top`:`left`,a?K:ge),du(e,a?`height`:`width`,a?G:W),uu(e,Tl)}else lu(e,Tl)}}),ot=st=ct=ut=dt=ft=pt=mt=lt=null,ht=1,An(!0),ge!=_e||K!=q||W!=ve||G!=ye){Pt(!1);let e=W/ve,t=G/ye;if(z&&!De&&L.left>=0){L.left*=e,L.top*=t,Gt&&hu(Gt,qu(L.left),0,W,G),Kt&&hu(Kt,0,qu(L.top),W,G);for(let n=0;n<Be.length;n++){let r=Be[n];r!=null&&(Ve[n]*=e,He[n]*=t,hu(r,Ju(Ve[n]),Ju(He[n]),W,G))}}if(X.show&&!J&&X.left>=0&&X.width>0){X.left*=e,X.width*=e,X.top*=t,X.height*=t;for(let e in Nn)du(an,e,X[e])}_e=ge,q=K,ve=W,ye=G}Kn(`setSize`),Te=!1}me>0&&he>0&&(d.clearRect(0,0,u.width,u.height),Kn(`drawClear`),w.forEach(e=>e()),Kn(`draw`)),X.show&&J&&(on(X),J=!1),z&&De&&(On(null,!0,!1),De=!1),I.show&&I.live&&Oe&&(En(),Oe=!1),c||(c=!0,r.status=1,Kn(`ready`)),rt=!1,Ft=!1}r.redraw=(e,t)=>{Ee=t||!1,e===!1?zt():cn(S,D.min,D.max)};function Ht(e,n){let i=b[e];if(i.from==null){if(Qe==0){let t=i.range(r,n.min,n.max,e);n.min=t[0],n.max=t[1]}if(n.min>n.max){let e=n.min;n.min=n.max,n.max=e}if(Qe>1&&n.min!=null&&n.max!=null&&n.max-n.min<1e-16)return;e==S&&i.distr==2&&Qe>0&&(n.min=wu(n.min,t[0]),n.max=wu(n.max,t[0]),n.min==n.max&&n.max++),j[e]=n,we=!0,zt()}}r.setScale=Ht;let Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn=!1,nn=L.drag,rn=nn.x,Y=nn.y;z&&(L.x&&(Ut=pu(Dl,m)),L.y&&(Wt=pu(Ol,m)),D.ori==0?(Gt=Ut,Kt=Wt):(Gt=Wt,Kt=Ut),$t=L.left,en=L.top);let X=r.select=Pd({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),an=X.show?pu(El,X.over?m:p):null;function on(e,t){if(X.show){for(let t in e)X[t]=e[t],t in Nn&&du(an,t,e[t]);t!==!1&&Kn(`setSelect`)}}r.setSelect=on;function sn(e){if(v[e].show)R&&uu(ie[e],Tl);else if(R&&lu(ie[e],Tl),z){let t=ze?Be[0]:Be[e];t!=null&&hu(t,-10,-10,W,G)}}function cn(e,t,n){Ht(e,{min:t,max:n})}function ln(e,t,n,a){t.focus!=null&&vn(e),t.show!=null&&v.forEach((n,r)=>{r>0&&(e==r||e==null)&&(n.show=t.show,sn(r),i==2?(cn(n.facets[0].scale,null,null),cn(n.facets[1].scale,null,null)):cn(n.scale,null,null),zt())}),n!==!1&&Kn(`setSeries`,e,t),a&&Zn(`setSeries`,r,e,t)}r.setSeries=ln;function un(e,t){Pd(x[e],t)}function dn(e,t){e.fill=$(e.fill||null),e.dir=Ru(e.dir,-1),t??=x.length,x.splice(t,0,e)}function fn(e){e==null?x.length=0:x.splice(e,1)}r.addBand=dn,r.setBand=un,r.delBand=fn;function pn(e,t){v[e].alpha=t,z&&Be[e]!=null&&(Be[e].style.opacity=t),R&&ie[e]&&(ie[e].style.opacity=t)}let mn,hn,gn,_n={focus:!0};function vn(e){if(e!=gn){let t=e==null,n=Le.alpha!=1;v.forEach((r,a)=>{if(i==1||a>0){let i=t||a==0||a==e;r._focus=t?null:i,n&&pn(a,i?1:Le.alpha)}}),gn=e,n&&zt()}}R&&Re&&fe(Yl,V,e=>{L._lock||(Fe(e),gn!=null&&ln(null,_n,!0,Jn.setSeries))});function yn(e,t,n){let r=b[t];n&&(e=e/ou-(r.ori==1?K:ge));let i=W;r.ori==1&&(i=G,e=i-e),r.dir==-1&&(e=i-e);let a=r._min,o=r._max,s=e/i,c=a+(o-a)*s,l=r.distr;return l==3?Zu(10,c):l==4?td(c,r.asinh):l==100?r.bwd(c):c}function bn(e,n){return wu(yn(e,S,n),t[0],$e,et)}r.valToIdx=e=>wu(e,t[0]),r.posToIdx=bn,r.posToVal=yn,r.valToPos=(e,t,n)=>b[t].ori==0?a(e,b[t],n?Se:W,n?be:0):o(e,b[t],n?Ce:G,n?xe:0),r.setCursor=(e,t,n)=>{$t=e.left,en=e.top,On(null,t,n)};function xn(e,t){du(an,Vl,X.left=e),du(an,Ll,X.width=t)}function Sn(e,t){du(an,zl,X.top=e),du(an,Rl,X.height=t)}let Cn=D.ori==0?xn:Sn,wn=D.ori==1?xn:Sn;function Tn(){if(R&&I.live)for(let e=+(i==2);e<v.length;e++){if(e==0&&se)continue;let t=I.values[e],n=0;for(let r in t)ae[e][n++].firstChild.nodeValue=t[r]}}function En(e,t){if(e!=null&&(e.idxs?e.idxs.forEach((e,t)=>{F[t]=e}):Dd(e.idx)||F.fill(e.idx),I.idx=F[0]),R&&I.live){for(let e=0;e<v.length;e++)(e>0||i==1&&!se)&&Dn(e,F[e]);Tn()}Oe=!1,t!==!1&&Kn(`setLegend`)}r.setLegend=En;function Dn(e,n){let i=v[e],a=e==0&&O==2?nt:t[e],o;se?o=i.values(r,e,n)??H:(o=i.value(r,n==null?null:a[n],e,n),o=o==null?H:{_:o}),I.values[e]=o}function On(e,n,a){Zt=$t,Qt=en,[$t,en]=L.move(r,$t,en),L.left=$t,L.top=en,z&&(Gt&&hu(Gt,qu($t),0,W,G),Kt&&hu( Line truncated
+3 -3
View File
@@ -37,11 +37,11 @@
<meta property="og:title" content="UI for VictoriaMetrics">
<meta property="og:url" content="https://victoriametrics.com/">
<meta property="og:description" content="Explore and troubleshoot your VictoriaMetrics data">
<script type="module" crossorigin src="./assets/index-B9npz-Jn.js"></script>
<script type="module" crossorigin src="./assets/index-DqVYYV1R.js"></script>
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-B0Z9INg1.js">
<link rel="modulepreload" crossorigin href="./assets/vendor-CtnKy-8i.js">
<link rel="modulepreload" crossorigin href="./assets/vendor-U2Dx9M-W.js">
<link rel="stylesheet" crossorigin href="./assets/vendor-CnsZ1jie.css">
<link rel="stylesheet" crossorigin href="./assets/index-DZBo_jn_.css">
<link rel="stylesheet" crossorigin href="./assets/index-BIgfk_tx.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
+1 -1
View File
@@ -1,4 +1,4 @@
FROM node:22-alpine3.22
FROM node:22-alpine3.24
# Sets a custom location for the npm cache, preventing access errors in system directories
ENV NPM_CONFIG_CACHE=/build/.npm
+2 -2
View File
@@ -1,4 +1,4 @@
FROM golang:1.27.2 AS build-web-stage
FROM golang:1.27.3 AS build-web-stage
COPY build /build
WORKDIR /build
@@ -6,7 +6,7 @@ COPY web/ /build/
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o web-amd64 github.com/VictoriMetrics/vmui/ && \
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o web-windows github.com/VictoriMetrics/vmui/
FROM alpine:3.24.2
FROM alpine:3.24.3
USER root
COPY --from=build-web-stage /build/web-amd64 /app/web
+10 -1
View File
@@ -1,2 +1,11 @@
import { getUrlWithoutTenant } from "../utils/tenants";
export const getAccountIds = (server: string) => `${getUrlWithoutTenant(server)}/admin/tenants`;
import { TimeParams } from "../types";
export const getAccountIds = (server: string, period: TimeParams) => {
const params = new URLSearchParams({
start: period.start.toString(),
end: period.end.toString(),
});
return `${getUrlWithoutTenant(server)}/admin/tenants?${params}`;
};
+6
View File
@@ -41,3 +41,9 @@ export interface ReportMetaData {
comment: string;
params: Record<string, string>;
}
export interface TenantInfo {
multiTenant?: boolean;
accountID?: number;
projectID?: number;
}
@@ -61,6 +61,7 @@ const CardinalityDatePicker: FC = () => {
format={DATE_FORMAT}
onChange={handleChangeDate}
targetRef={buttonRef}
maxDate={dayjs().tz().endOf("day")}
/>
</div>
);
@@ -3,26 +3,28 @@ import { ErrorTypes } from "../../../../types";
import TextField from "../../../Main/TextField/TextField";
import { isValidHttpUrl } from "../../../../utils/url";
import Button from "../../../Main/Button/Button";
import { StorageIcon } from "../../../Main/Icons";
import Tooltip from "../../../Main/Tooltip/Tooltip";
import { UnlockIcon } from "../../../Main/Icons";
import { getFromStorage, removeFromStorage, saveToStorage } from "../../../../utils/storage";
import useBoolean from "../../../../hooks/useBoolean";
import { ChildComponentHandle } from "../GlobalSettings";
import { useAppDispatch, useAppState } from "../../../../state/common/StateContext";
import Checkbox from "../../../Main/Checkbox/Checkbox";
import Hyperlink from "../../../Main/Hyperlink/Hyperlink";
import Alert from "../../../Main/Alert/Alert";
interface ServerConfiguratorProps {
onClose: () => void;
}
const tooltipSave = {
enable: "Enable to save the modified server URL to local storage, preventing reset upon page refresh.",
disable: "Disable to stop saving the server URL to local storage, reverting to the default URL on page refresh."
};
const ServerConfigurator = forwardRef<ChildComponentHandle, ServerConfiguratorProps>(({ onClose }, ref) => {
const { serverUrl: stateServerUrl } = useAppState();
const dispatch = useAppDispatch();
const {
value: editable,
setTrue: setEditable,
} = useBoolean(false);
const {
value: enabledStorage,
toggle: handleToggleStorage,
@@ -76,16 +78,39 @@ const ServerConfigurator = forwardRef<ChildComponentHandle, ServerConfiguratorPr
onChange={handleChange}
onEnter={handleApply}
inputmode="url"
disabled={!editable}
/>
<Tooltip title={enabledStorage ? tooltipSave.disable : tooltipSave.enable}>
{!editable && (
<Button
className="vm-server-configurator-url__button"
variant="text"
color={enabledStorage ? "primary" : "gray"}
onClick={handleToggleStorage}
startIcon={<StorageIcon/>}
/>
</Tooltip>
color="primary"
onClick={setEditable}
startIcon={<UnlockIcon/>}
>
Enable editing
</Button>
)}
</div>
<Checkbox
label="Keep this URL after page refresh"
color="primary"
checked={enabledStorage}
onChange={handleToggleStorage}
/>
<div className="vm-server-configurator-url__warning">
<Alert
variant="warning"
title="Server URL editing will be removed in a future release."
>
<p>
Need a custom URL? <Hyperlink
href="https://github.com/VictoriaMetrics/VictoriaMetrics/issues/11735"
text="Share your use case in #11735."
/>
</p>
</Alert>
</div>
</div>
);
@@ -0,0 +1,70 @@
import { FC, useEffect, useState } from "preact/compat";
import Alert from "../../../Main/Alert/Alert";
import Hyperlink from "../../../Main/Hyperlink/Hyperlink";
import { getFromStorage } from "../../../../utils/storage";
import { useAppState } from "../../../../state/common/StateContext";
import { getDefaultURL } from "../../../../utils/default-server-url";
import { replaceTenantId } from "../../../../utils/tenants";
import { removeTrailingSlash } from "../../../../utils/url";
import "../style.scss";
const normalizeServerUrl = (url: string) => {
try {
const normalizedUrl = new URL(url).href;
return replaceTenantId(removeTrailingSlash(normalizedUrl), "0");
} catch {
return replaceTenantId(removeTrailingSlash(url), "0");
}
};
const isServerUrlSaved = () => {
try {
return !!getFromStorage("SERVER_URL");
} catch {
return false;
}
};
type Props = {
onOpenSettings?: () => void;
}
const ServerUrlDeprecationWarning: FC<Props> = ({ onOpenSettings }) => {
const { serverUrl } = useAppState();
const [enabledStorage, setEnabledStorage] = useState(isServerUrlSaved);
const defaultServerUrl = getDefaultURL(window.location.href);
const isCustomServerUrl = normalizeServerUrl(serverUrl) !== normalizeServerUrl(defaultServerUrl);
useEffect(() => {
const updateEnabledStorage = () => setEnabledStorage(isServerUrlSaved());
updateEnabledStorage();
window.addEventListener("storage", updateEnabledStorage);
return () => window.removeEventListener("storage", updateEnabledStorage);
}, []);
if (!enabledStorage || !isCustomServerUrl) return null;
return (
<div className="vm-server-url-deprecation-warning">
<Alert variant="warning">
<p>
You are using a custom Server URL. This option will be removed in a future release.{" "}
<button
type="button"
className="vm-link vm-link_colored"
onClick={onOpenSettings}
>
Open settings
</button>{" "}
to review your URL, or{" "}
<Hyperlink
href="https://github.com/VictoriaMetrics/VictoriaMetrics/issues/11735"
text={onOpenSettings ? "share your use case in #11735." : "Share your use case in #11735."}
/>
</p>
</Alert>
</div>
);
};
export default ServerUrlDeprecationWarning;
@@ -1,7 +1,7 @@
import { FC, useState, useRef, useMemo } from "preact/compat";
import { useAppDispatch, useAppState } from "../../../../state/common/StateContext";
import { useTimeDispatch } from "../../../../state/time/TimeStateContext";
import { ArrowDownIcon, StorageIcon } from "../../../Main/Icons";
import { ArrowDownIcon, RefreshIcon, StorageIcon } from "../../../Main/Icons";
import Button from "../../../Main/Button/Button";
import "./style.scss";
import classNames from "classnames";
@@ -12,8 +12,10 @@ import useDeviceDetect from "../../../../hooks/useDeviceDetect";
import TextField from "../../../Main/TextField/TextField";
import { replaceTenantId } from "../../../../utils/tenants";
import useBoolean from "../../../../hooks/useBoolean";
import { useFetchAccountIds } from "./hooks/useFetchAccountIds";
import Alert from "../../../Main/Alert/Alert";
const TenantsConfiguration: FC<{accountIds: string[]}> = ({ accountIds }) => {
const TenantsConfiguration: FC = () => {
const appModeEnable = getAppModeEnable();
const { isMobile } = useDeviceDetect();
@@ -21,6 +23,9 @@ const TenantsConfiguration: FC<{accountIds: string[]}> = ({ accountIds }) => {
const dispatch = useAppDispatch();
const timeDispatch = useTimeDispatch();
const { accountIds, fetchAccountIds, cancelFetchAccountIds, isLoading, error } = useFetchAccountIds();
const showResults = !isLoading && !error;
const [search, setSearch] = useState("");
const optionsButtonRef = useRef<HTMLDivElement>(null);
@@ -35,29 +40,38 @@ const TenantsConfiguration: FC<{accountIds: string[]}> = ({ accountIds }) => {
try {
const regexp = new RegExp(search, "i");
const found = accountIds.filter((item) => regexp.test(item));
return found.sort((a,b) => (a.match(regexp)?.index || 0) - (b.match(regexp)?.index || 0));
return found.sort((a, b) => (a.match(regexp)?.index || 0) - (b.match(regexp)?.index || 0));
} catch (e) {
return [];
}
}, [search, accountIds]);
const showTenantSelector = useMemo(() => {
const emptyAccountIds = !accountIds.length;
const onlyDefaultTenant = accountIds.length === 1 && accountIds[0] === "0:0";
return !emptyAccountIds && !onlyDefaultTenant;
}, [accountIds]);
const createHandlerChange = (value: string) => () => {
if (serverUrl) {
const updateServerUrl = replaceTenantId(serverUrl, value);
if (updateServerUrl === serverUrl) return;
dispatch({ type: "SET_SERVER", payload: updateServerUrl });
timeDispatch({ type: "RUN_QUERY" });
}
const handleClose = () => {
cancelFetchAccountIds();
handleCloseOptions();
};
if (!showTenantSelector) return null;
const createHandlerChange = (value: string) => () => {
const updateServerUrl = replaceTenantId(serverUrl, value);
if (updateServerUrl === serverUrl) return;
dispatch({ type: "SET_SERVER", payload: updateServerUrl });
timeDispatch({ type: "RUN_QUERY" });
handleClose();
};
const handleToggleOptions = () => {
if (openOptions) {
handleClose();
return;
}
setSearch("");
void fetchAccountIds();
toggleOpenOptions();
};
if (!tenantId) return null;
return (
<div className="vm-tenant-input">
@@ -66,7 +80,7 @@ const TenantsConfiguration: FC<{accountIds: string[]}> = ({ accountIds }) => {
{isMobile ? (
<div
className="vm-mobile-option"
onClick={toggleOpenOptions}
onClick={handleToggleOptions}
>
<span className="vm-mobile-option__icon"><StorageIcon/></span>
<div className="vm-mobile-option-text">
@@ -92,7 +106,7 @@ const TenantsConfiguration: FC<{accountIds: string[]}> = ({ accountIds }) => {
<ArrowDownIcon/>
</div>
)}
onClick={toggleOpenOptions}
onClick={handleToggleOptions}
>
{tenantId}
</Button>
@@ -102,7 +116,7 @@ const TenantsConfiguration: FC<{accountIds: string[]}> = ({ accountIds }) => {
<Popper
open={openOptions}
placement="bottom-right"
onClose={handleCloseOptions}
onClose={handleClose}
buttonRef={optionsButtonRef}
title={isMobile ? "Define Tenant ID" : undefined}
>
@@ -112,16 +126,30 @@ const TenantsConfiguration: FC<{accountIds: string[]}> = ({ accountIds }) => {
"vm-list vm-tenant-input-list_mobile": isMobile,
})}
>
<div className="vm-tenant-input-list__search">
<TextField
autofocus
label="Search"
value={search}
onChange={setSearch}
type="search"
/>
</div>
{accountIdsFiltered.map(id => (
{isLoading && <div className="vm-tenant-input-list__loader"><RefreshIcon/><span>Loading...</span></div>}
{error && <div className="vm-tenant-input-list__search"><Alert variant="error">{error}</Alert></div>}
{showResults && accountIds.length > 5 && (
<div className="vm-tenant-input-list__search">
<TextField
autofocus
value={search}
onChange={setSearch}
type="search"
placeholder="Search tenant ID"
/>
</div>
)}
{showResults && !accountIds.length && (
<div className="vm-tenant-input-list__empty">
{"No tenants found\nin the selected time range"}
</div>
)}
{showResults && accountIds.length > 0 && !accountIdsFiltered.length && (
<div className="vm-tenant-input-list__empty">
{"No matching tenants"}
</div>
)}
{showResults && accountIdsFiltered.map(id => (
<div
className={classNames({
"vm-list-item": true,
@@ -1,47 +1,85 @@
import { useAppState } from "../../../../../state/common/StateContext";
import { useEffect, useMemo, useState } from "preact/compat";
import { useMemo, useState, useRef, useCallback, useEffect } from "preact/compat";
import { ErrorTypes } from "../../../../../types";
import { getAccountIds } from "../../../../../api/accountId";
import { getAppModeEnable, getAppModeParams } from "../../../../../utils/app-mode";
import { useTimeState } from "../../../../../state/time/TimeStateContext";
import { routerOptions } from "../../../../../router";
import { useSearchParams } from "react-router";
import { useLocation } from "react-router-dom";
const collator = new Intl.Collator();
export const useFetchAccountIds = () => {
const { useTenantID } = getAppModeParams();
const appModeEnable = getAppModeEnable();
const { tenantId, serverUrl } = useAppState();
const { pathname } = useLocation();
const { serverUrl } = useAppState();
const { period } = useTimeState();
const [searchParams] = useSearchParams();
const route = routerOptions[pathname];
const tenantPeriod = route?.getTenantPeriod?.({ searchParams }) ?? period;
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<ErrorTypes | string>();
const [accountIds, setAccountIds] = useState<string[]>([]);
const lastRequestKey = useRef<string>();
const abortControllerRef = useRef<AbortController>();
const fetchUrl = useMemo(() => getAccountIds(serverUrl), [serverUrl]);
const isServerUrlWithTenant = useMemo(() => !!tenantId, [tenantId]);
const preventFetch = appModeEnable ? !useTenantID : !isServerUrlWithTenant;
const fetchUrl = useMemo(() => getAccountIds(serverUrl, tenantPeriod), [serverUrl, tenantPeriod]);
useEffect(() => {
if (preventFetch) return;
const fetchData = async () => {
setIsLoading(true);
try {
const response = await fetch(fetchUrl);
const resp = await response.json();
const fetchAccountIds = useCallback(async () => {
setError(undefined);
abortControllerRef.current?.abort();
if (lastRequestKey.current === fetchUrl) return;
setIsLoading(true);
const currentAbortController = new AbortController();
abortControllerRef.current = currentAbortController;
try {
const response = await fetch(fetchUrl, { signal: currentAbortController.signal });
const resp = await response.json();
if (currentAbortController.signal.aborted) return;
if (response.ok) {
const data = (resp.data || []) as string[];
setAccountIds(data.sort((a, b) => a.localeCompare(b)));
if (response.ok) {
setError(undefined);
} else {
setError(`${resp.errorType}\r\n${resp?.error}`);
}
} catch (e) {
if (e instanceof Error) {
setError(`${e.name}: ${e.message}`);
}
setAccountIds(data.sort(collator.compare));
lastRequestKey.current = fetchUrl;
} else {
setError(`${resp.errorType}\r\n${resp?.error}`);
}
setIsLoading(false);
};
fetchData().catch(console.error);
} catch (e) {
if (!currentAbortController.signal.aborted && e instanceof Error) {
setError(`${e.name}: ${e.message}`);
}
} finally {
if (abortControllerRef.current === currentAbortController) {
abortControllerRef.current = undefined;
setIsLoading(false);
}
}
}, [fetchUrl]);
return { accountIds, isLoading, error };
const cancelFetchAccountIds = useCallback(() => {
abortControllerRef.current?.abort();
abortControllerRef.current = undefined;
setIsLoading(false);
}, []);
useEffect(() => {
return () => {
abortControllerRef.current?.abort();
abortControllerRef.current = undefined;
};
}, []);
return {
accountIds,
isLoading,
error,
fetchAccountIds,
cancelFetchAccountIds
};
};
@@ -8,8 +8,11 @@
overflow: auto;
overscroll-behavior: none;
border-radius: $border-radius-medium;
min-width: 120px;
max-width: 320px;
&_mobile {
max-width: none;
max-height: calc(($vh * 100) - 70px);
}
@@ -35,5 +38,30 @@
justify-content: space-between;
gap: $padding-small;
}
&__empty {
padding: $padding-small $padding-global;
font-size: $font-size-small;
color: $color-text-secondary;
text-align: center;
white-space: pre-wrap;
line-height: 1.3;
}
&__loader {
display: grid;
grid-template-columns: 14px auto;
align-items: center;
justify-content: center;
gap: $padding-small;
padding: $padding-global;
color: $color-text-secondary;
z-index: 2;
pointer-events: none;
svg {
animation: half-circle-spinner-animation 1s infinite linear, vm-fade 0.5s ease-in;
}
}
}
}
@@ -54,6 +54,15 @@
&__button {
margin-top: $padding-small;
}
&__warning {
margin-top: $padding-global;
}
& + .vm-checkbox {
margin-top: $padding-tiny;
font-size: $font-size-small;
}
}
&-footer {
@@ -70,3 +79,7 @@
grid-template-columns: 1fr 1fr;
}
}
.vm-server-url-deprecation-warning {
padding: $padding-small $padding-small 0;
}
@@ -1,40 +1,27 @@
import { FC, useEffect, useMemo, useRef, useState } from "preact/compat";
import { useStep } from "../../../state/step/StepStateContext";
import { FC, useEffect, useRef, useState } from "preact/compat";
import { ArrowDownIcon, RestartIcon, TimelineIcon } from "../../Main/Icons";
import TextField from "../../Main/TextField/TextField";
import Button from "../../Main/Button/Button";
import Tooltip from "../../Main/Tooltip/Tooltip";
import { ErrorTypes } from "../../../types";
import { getStepFromDuration, supportedDurations } from "../../../utils/time";
import { useTimeState } from "../../../state/time/TimeStateContext";
import { useGraphDispatch, useGraphState } from "../../../state/graph/GraphStateContext";
import usePrevious from "../../../hooks/usePrevious";
import { supportedDurations } from "../../../utils/time";
import "./style.scss";
import { getAppModeEnable } from "../../../utils/app-mode";
import Popper from "../../Main/Popper/Popper";
import useDeviceDetect from "../../../hooks/useDeviceDetect";
import classNames from "classnames";
import useBoolean from "../../../hooks/useBoolean";
import { useCustomPanelState } from "../../../state/customPanel/CustomPanelStateContext";
import Hyperlink from "../../Main/Hyperlink/Hyperlink";
const StepConfigurator: FC = () => {
const appModeEnable = getAppModeEnable();
const { isMobile } = useDeviceDetect();
const { customStep: value, isHistogram } = useGraphState();
const { period: { end, start } } = useTimeState();
const graphDispatch = useGraphDispatch();
const { displayType } = useCustomPanelState();
const defaultStep = useMemo(() => {
return getStepFromDuration(end - start, isHistogram, displayType);
}, [end, start, isHistogram, displayType]);
const prevDefaultStep = usePrevious(defaultStep);
const [customStep, setCustomStep] = useState(value || defaultStep);
const { calculated, override, effective, setOverride, reset } = useStep();
const [customStep, setCustomStep] = useState(effective);
const [error, setError] = useState("");
const isAutoStep = value === defaultStep;
const edited = useRef(false);
const {
value: openOptions,
@@ -44,13 +31,14 @@ const StepConfigurator: FC = () => {
const buttonRef = useRef<HTMLDivElement>(null);
const handleApply = (value?: string) => {
const step = value || customStep || defaultStep || "1s";
const durations = step.match(/[a-zA-Z]+/g) || [];
const stepDur = !durations.length ? `${step}s` : step;
graphDispatch({ type: "SET_CUSTOM_STEP", payload: stepDur });
setCustomStep(stepDur);
setError("");
const handleApply = () => {
if (!edited.current || error) return;
const normalized = (customStep.match(/([0-9]*\.[0-9]+|[0-9]+)([a-zA-Z]+)?/g) || []).join("");
const durations = normalized.match(/[a-zA-Z]+/g) || [];
const value = durations.length ? normalized : `${normalized}s`;
setOverride(value);
setCustomStep(value);
edited.current = false;
};
const handleCloseOptions = () => {
@@ -70,13 +58,15 @@ const StepConfigurator: FC = () => {
};
const handleChangeStep = (value: string) => {
const numbers = value.match(/[-+]?([0-9]*\.[0-9]+|[0-9]+)/g) || [];
const durations = value.match(/[a-zA-Z]+/g) || [];
const normalized = value.replace(/,/g, ".").replace(/[^0-9.a-zA-Z]/g, "");
const numbers = normalized.match(/[-+]?([0-9]*\.[0-9]+|[0-9]+)/g) || [];
const durations = normalized.match(/[a-zA-Z]+/g) || [];
const isValidNumbers = numbers.length && numbers.every(num => parseFloat(num) > 0);
const isValidDuration = durations.every(d => supportedDurations.find(dur => dur.short === d));
const isValidStep = isValidNumbers && isValidDuration;
setCustomStep(value);
setCustomStep(normalized);
edited.current = true;
if (isValidStep) {
setError("");
@@ -86,34 +76,19 @@ const StepConfigurator: FC = () => {
};
const handleReset = () => {
const value = defaultStep || "1s";
handleChangeStep(value);
handleApply(value);
reset();
setCustomStep(calculated);
setError("");
edited.current = false;
};
useEffect(() => {
if (value) {
handleApply(value);
}
}, [value]);
useEffect(() => {
if (!value && defaultStep) {
handleApply(defaultStep);
}
}, [defaultStep]);
useEffect(() => {
if (!prevDefaultStep) return;
if (value !== prevDefaultStep) return;
if (value === defaultStep) return;
graphDispatch({ type: "SET_CUSTOM_STEP", payload: defaultStep });
setCustomStep(defaultStep);
setCustomStep(effective);
setError("");
}, [defaultStep, prevDefaultStep, value, graphDispatch]);
edited.current = false;
}, [effective, override]);
const textValue = isAutoStep ? `auto (${customStep})` : customStep;
const textValue = override === null ? `auto (${effective})` : effective;
return (
<div
@@ -166,7 +141,7 @@ const StepConfigurator: FC = () => {
onFocus={handleFocus}
onBlur={handleApply}
endIcon={(
<Tooltip title={`Reset to auto step (${defaultStep})`}>
<Tooltip title={`Reset to auto step (${calculated})`}>
<Button
size="small"
variant="text"
@@ -102,7 +102,12 @@ const BaseRule = ({ item, group }: BaseRuleProps) => {
<tr>
<td>Last error</td>
<td>
<Alert variant="error">{item.lastError}</Alert>
<Alert
variant="error"
title="Rule evaluation failed"
>
{item.lastError}
</Alert>
</td>
</tr>
)}
@@ -44,7 +44,12 @@ const Target: FC<TargetProps> = ({ target }) => {
<tr>
<td className="vm-col-md">Last error</td>
<td>
<Alert variant="error">{target.lastError}</Alert>
<Alert
variant="error"
title="Notification delivery failed"
>
{target.lastError}
</Alert>
</td>
</tr>
)}
@@ -1,3 +1,4 @@
import { useStep } from "../../../state/step/StepStateContext";
import { FC, useEffect, useMemo, useState } from "preact/compat";
import { useFetchQuery } from "../../../hooks/useFetchQuery";
import { useGraphDispatch, useGraphState } from "../../../state/graph/GraphStateContext";
@@ -9,8 +10,10 @@ import Alert from "../../Main/Alert/Alert";
import "./style.scss";
import classNames from "classnames";
import useDeviceDetect from "../../../hooks/useDeviceDetect";
import { getDurationFromMilliseconds, getSecondsFromDuration, getStepFromDuration } from "../../../utils/time";
import WarningLimitSeries from "../../../pages/CustomPanel/WarningLimitSeries/WarningLimitSeries";
import { DisplayType } from "../../../types";
import { getDurationFromMilliseconds, getSecondsFromDuration } from "../../../utils/time";
import { HEATMAP_STEP_MULTIPLIER } from "../../../constants/graph";
interface ExploreMetricItemGraphProps {
name: string,
@@ -30,17 +33,16 @@ const ExploreMetricItem: FC<ExploreMetricItemGraphProps> = ({
height,
}) => {
const { isMobile } = useDeviceDetect();
const { customStep, yaxis } = useGraphState();
const { yaxis } = useGraphState();
const { period } = useTimeState();
const graphDispatch = useGraphDispatch();
const timeDispatch = useTimeDispatch();
const defaultStep = getStepFromDuration(period.end - period.start);
const stepSeconds = getSecondsFromDuration(customStep);
const heatmapStep = getDurationFromMilliseconds(stepSeconds * 10 * 1000);
const { calculated, override } = useStep();
const [isHeatmap, setIsHeatmap] = useState(false);
const [showAllSeries, setShowAllSeries] = useState(false);
const step = isHeatmap && customStep === defaultStep ? heatmapStep : customStep;
const heatmapStep = getDurationFromMilliseconds(getSecondsFromDuration(calculated) * HEATMAP_STEP_MULTIPLIER * 1000);
const step = override ?? (isHeatmap ? heatmapStep : calculated);
const queries = useMemo(() => {
@@ -70,7 +72,8 @@ with (q = ${queryBase}) (
predefinedQuery: queries,
visible: true,
customStep: step,
showAllSeries
showAllSeries,
display: DisplayType.chart
});
const setYaxisLimits = (limits: AxisRange) => {
@@ -93,8 +96,22 @@ with (q = ${queryBase}) (
})}
>
{isLoading && <Spinner />}
{error && <Alert variant="error">{error}</Alert>}
{queryErrors[0] && <Alert variant="error">{queryErrors[0]}</Alert>}
{error && (
<Alert
variant="error"
title="Unable to load query results"
>
{error}
</Alert>
)}
{queryErrors[0] && (
<Alert
variant="error"
title="Query execution error"
>
{queryErrors[0]}
</Alert>
)}
{warning && (
<WarningLimitSeries
warning={warning}
@@ -119,10 +119,12 @@ const ExploreMetricsHeader: FC<ExploreMetricsHeaderProps> = ({
</div>
{showTips && (
<Alert variant={"warning"}>
<Alert
variant="warning"
title="Prometheus metrics only"
>
<div className="vm-explore-metrics-header-description">
<p>
Please note: this page is solely designed for exploring Prometheus metrics.
Prometheus metrics always contain <code>job</code> and <code>instance</code> labels
(see <a
className="vm-link vm-link_colored"
@@ -1,40 +1,43 @@
import { FC } from "preact/compat";
import { ReactNode } from "react";
import { FC, ReactNode } from "preact/compat";
import classNames from "classnames";
import { ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "../Icons";
import { DoneIcon, ErrorIcon, InfoIcon, WarningIcon } from "../Icons";
import "./style.scss";
import { useAppState } from "../../../state/common/StateContext";
import useDeviceDetect from "../../../hooks/useDeviceDetect";
interface AlertProps {
variant?: "success" | "error" | "info" | "warning"
children: ReactNode
title?: string;
}
const icons = {
success: <SuccessIcon/>,
success: <DoneIcon/>,
error: <ErrorIcon/>,
warning: <WarningIcon/>,
info: <InfoIcon/>
};
const Alert: FC<AlertProps> = ({
variant,
children }) => {
const { isDarkTheme } = useAppState();
const { isMobile } = useDeviceDetect();
variant = "info",
title,
children
}) => {
return (
<div
className={classNames({
"vm-alert": true,
[`vm-alert_${variant}`]: variant,
"vm-alert_dark": isDarkTheme,
"vm-alert_mobile": isMobile
[`vm-alert_${variant}`]: true
})}
>
<div className="vm-alert__icon">{icons[variant || "info"]}</div>
<div className="vm-alert__content">{children}</div>
<div className="vm-alert__backdrop"/>
<div className="vm-alert__icon">{icons[variant]}</div>
{title && <div className="vm-alert__title">{title}</div>}
{children && <div
className={classNames({
"vm-alert__content": title,
"vm-alert__title": !title
})}
>{children}</div>}
</div>
);
};
@@ -3,82 +3,84 @@
.vm-alert {
position: relative;
display: grid;
grid-template-columns: 20px 1fr;
align-items: center;
gap: $padding-small;
grid-template-columns: 16px 1fr;
align-items: center;
padding: $padding-global;
border-radius: $border-radius-medium;
box-shadow: $box-shadow;
font-size: $font-size;
font-weight: normal;
color: $color-text;
line-height: 1.5;
opacity: 0.8;
font-size: $font-size-small;
z-index: 8;
&_mobile {
align-items: flex-start;
border-radius: 0;
}
&__icon,
&__content {
position: relative;
z-index: 2;
}
&__icon {
display: flex;
align-items: center;
justify-content: center;
align-self: flex-start;
min-height: 24px;
filter: brightness(0.6);
&__backdrop {
position: absolute;
width: 100%;
height: 100%;
border-radius: $border-radius-medium;
background: $color-background-block;
z-index: -1;
}
&:before,
&:after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: $border-radius-medium;
z-index: -1;
}
&:after {
opacity: 0.04;
}
&:before {
opacity: 0.4;
transform: translate(-1px, -1px);
}
&__title,
&__content {
min-width: 0;
white-space: pre-line;
text-wrap: balance;
overflow-wrap: anywhere;
filter: brightness(0.6);
}
&_success {
color: $color-success;
background-color: $color-background-success;
&__title {
font-weight: 500;
}
&_error {
color: $color-error;
background-color: $color-background-error;
&__content {
grid-column: 1/span 2;
line-height: 1.3;
color: $color-text-secondary;
word-break: break-word;
text-wrap: pretty;
}
&_info {
color: $color-info;
background-color: $color-background-info;
@mixin variant-alert($name, $color: $color-white) {
&_#{"" + $name} &__icon {
color: $color;
}
&_#{"" + $name}:after {
background-color: $color;
}
&_#{"" + $name}::before {
border: 1px solid $color;
}
}
&_warning {
color: $color-warning;
background-color: $color-background-warning;
}
$alert-colors: (
info: $color-info,
warning: $color-warning,
error: $color-error,
success: $color-success,
);
&_dark &__content, &_dark &__icon {
filter: none;
}
&_dark:is(&_success) {
border: 0.5px solid $color-success;
}
&_dark:is(&_error) {
border: 0.5px solid $color-error;
}
&_dark:is(&_info) {
border: 0.5px solid $color-info;
}
&_dark:is(&_warning) {
border: 0.5px solid $color-warning;
@each $name, $color in $alert-colors {
@include variant-alert($name, $color);
}
}
@@ -5,7 +5,9 @@ export const LinkIcon = () => (
viewBox="0 0 24 24"
fill="currentColor"
>
<path d="M10.975 14.51a1.05 1.05 0 0 0 0-1.485 2.95 2.95 0 0 1 0-4.172l3.536-3.535a2.95 2.95 0 1 1 4.172 4.172l-1.093 1.092a1.05 1.05 0 0 0 1.485 1.485l1.093-1.092a5.05 5.05 0 0 0-7.142-7.142L9.49 7.368a5.05 5.05 0 0 0 0 7.142c.41.41 1.075.41 1.485 0m2.05-5.02a1.05 1.05 0 0 0 0 1.485 2.95 2.95 0 0 1 0 4.172l-3.5 3.5a2.95 2.95 0 1 1-4.171-4.172l1.025-1.025a1.05 1.05 0 0 0-1.485-1.485L3.87 12.99a5.05 5.05 0 0 0 7.142 7.142l3.5-3.5a5.05 5.05 0 0 0 0-7.142 1.05 1.05 0 0 0-1.485 0z"/>
<path
d="M10.975 14.51a1.05 1.05 0 0 0 0-1.485 2.95 2.95 0 0 1 0-4.172l3.536-3.535a2.95 2.95 0 1 1 4.172 4.172l-1.093 1.092a1.05 1.05 0 0 0 1.485 1.485l1.093-1.092a5.05 5.05 0 0 0-7.142-7.142L9.49 7.368a5.05 5.05 0 0 0 0 7.142c.41.41 1.075.41 1.485 0m2.05-5.02a1.05 1.05 0 0 0 0 1.485 2.95 2.95 0 0 1 0 4.172l-3.5 3.5a2.95 2.95 0 1 1-4.171-4.172l1.025-1.025a1.05 1.05 0 0 0-1.485-1.485L3.87 12.99a5.05 5.05 0 0 0 7.142 7.142l3.5-3.5a5.05 5.05 0 0 0 0-7.142 1.05 1.05 0 0 0-1.485 0z"
/>
</svg>
);
@@ -14,7 +16,9 @@ export const GroupIcon = () => (
fill="currentColor"
viewBox="0 0 512 512"
>
<path d="M170.667 64v42.667h-64v298.666h64V448H64V64zM448 64v384H341.333v-42.667h64V106.667h-64V64zm-85.333 256v42.667H149.333V320zm0-85.333v42.666H149.333v-42.666zm0-85.334V192H149.333v-42.667z"/>
<path
d="M170.667 64v42.667h-64v298.666h64V448H64V64zM448 64v384H341.333v-42.667h64V106.667h-64V64zm-85.333 256v42.667H149.333V320zm0-85.333v42.666H149.333v-42.666zm0-85.334V192H149.333v-42.667z"
/>
</svg>
);
@@ -32,7 +36,9 @@ export const AlertIcon = () => (
viewBox="-1 0 30 30"
fill="currentColor"
>
<path d="m3 24 3-6v-8a8 8 0 0 1 16 0v8l3 6zm11 4a2.99 2.99 0 0 1-2.816-2h5.632A2.99 2.99 0 0 1 14 28m10-10v-8c0-5.522-4.478-10-10-10S4 4.478 4 10v8l-4 8h9.101a5 5 0 0 0 9.798 0H28z"/>
<path
d="m3 24 3-6v-8a8 8 0 0 1 16 0v8l3 6zm11 4a2.99 2.99 0 0 1-2.816-2h5.632A2.99 2.99 0 0 1 14 28m10-10v-8c0-5.522-4.478-10-10-10S4 4.478 4 10v8l-4 8h9.101a5 5 0 0 0 9.798 0H28z"
/>
</svg>
);
@@ -41,7 +47,9 @@ export const AlertingRuleIcon = () => (
viewBox="411.014 448.582 21.637 17.836"
fill="currentColor"
>
<path d="M411.47 453.837a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m-.016 5.54c-.284.124-.44.372-.439.701.001.354.204.614.553.708.092.025 1.214.034 3.267.028 3.481-.011 3.23.008 3.468-.264a.714.714 0 0 0-.003-.963c-.249-.283-.03-.267-3.564-.266-2.735 0-3.171.008-3.282.056m-.018 5.016a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m.161-15.761a.85.85 0 0 0-.389.417c-.023.07-.034.224-.026.343.018.239.078.345.301.525l.139.112 8.729.01 8.73.009.163-.079c.193-.093.36-.332.395-.565a.75.75 0 0 0-.388-.75c-.142-.072-.227-.073-8.844-.072-7.105.002-8.721.011-8.81.05m14.005 2.595c-.286.18-.371.401-.371.961v.334l-.499.024c-.598.028-.961.126-1.456.392a3.5 3.5 0 0 0-1.721 2.199c-.081.307-.091.479-.115 1.923-.027 1.566-.028 1.59-.138 1.966-.145.496-.557 1.361-.929 1.945a5 5 0 0 0-.368.677c-.1.292-.095.679.013.982.112.32.461.686.75.789.276.099 1.255.259 2.268.373l.84.095.028.287q.089.935.767 1.579a2.383 2.383 0 0 0 3.659-.434c.227-.351.36-.745.396-1.161l.023-.283.291-.027c.956-.093 2.47-.32 2.715-.408.393-.14.694-.464.817-.875.16-.539.093-.833-.354-1.554-.373-.601-.832-1.565-.956-2.007-.083-.29-.093-.448-.119-1.903-.027-1.427-.039-1.619-.118-1.924a3.5 3.5 0 0 0-1.895-2.327c-.422-.202-.758-.282-1.309-.312l-.489-.025-.022-.473c-.022-.521-.062-.621-.325-.806-.124-.088-.182-.096-.69-.096-.489.001-.57.012-.693.089m2.696 2.786c.546.176.994.583 1.249 1.135l.149.326.025 1.543c.027 1.672.046 1.837.286 2.598.166.52.621 1.468.974 2.028.189.303.274.472.244.492-.104.066-1.778.288-2.915.387-.788.068-3.246.068-4.037 0-1.154-.099-2.811-.32-2.919-.39-.035-.023.03-.16.223-.469.375-.603.805-1.493.976-2.024.246-.763.272-1 .272-2.426 0-.701.019-1.398.043-1.549.083-.554.47-1.148.931-1.429.103-.063.308-.157.453-.209.258-.092.315-.094 2.025-.096 1.642-.001 1.776.005 2.021.083m-1.384 10.771a1.06 1.06 0 0 1-.748.2c-.394-.066-.776-.451-.835-.841l-.026-.168h2.005v.108z"/>
<path
d="M411.47 453.837a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m-.016 5.54c-.284.124-.44.372-.439.701.001.354.204.614.553.708.092.025 1.214.034 3.267.028 3.481-.011 3.23.008 3.468-.264a.714.714 0 0 0-.003-.963c-.249-.283-.03-.267-3.564-.266-2.735 0-3.171.008-3.282.056m-.018 5.016a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m.161-15.761a.85.85 0 0 0-.389.417c-.023.07-.034.224-.026.343.018.239.078.345.301.525l.139.112 8.729.01 8.73.009.163-.079c.193-.093.36-.332.395-.565a.75.75 0 0 0-.388-.75c-.142-.072-.227-.073-8.844-.072-7.105.002-8.721.011-8.81.05m14.005 2.595c-.286.18-.371.401-.371.961v.334l-.499.024c-.598.028-.961.126-1.456.392a3.5 3.5 0 0 0-1.721 2.199c-.081.307-.091.479-.115 1.923-.027 1.566-.028 1.59-.138 1.966-.145.496-.557 1.361-.929 1.945a5 5 0 0 0-.368.677c-.1.292-.095.679.013.982.112.32.461.686.75.789.276.099 1.255.259 2.268.373l.84.095.028.287q.089.935.767 1.579a2.383 2.383 0 0 0 3.659-.434c.227-.351.36-.745.396-1.161l.023-.283.291-.027c.956-.093 2.47-.32 2.715-.408.393-.14.694-.464.817-.875.16-.539.093-.833-.354-1.554-.373-.601-.832-1.565-.956-2.007-.083-.29-.093-.448-.119-1.903-.027-1.427-.039-1.619-.118-1.924a3.5 3.5 0 0 0-1.895-2.327c-.422-.202-.758-.282-1.309-.312l-.489-.025-.022-.473c-.022-.521-.062-.621-.325-.806-.124-.088-.182-.096-.69-.096-.489.001-.57.012-.693.089m2.696 2.786c.546.176.994.583 1.249 1.135l.149.326.025 1.543c.027 1.672.046 1.837.286 2.598.166.52.621 1.468.974 2.028.189.303.274.472.244.492-.104.066-1.778.288-2.915.387-.788.068-3.246.068-4.037 0-1.154-.099-2.811-.32-2.919-.39-.035-.023.03-.16.223-.469.375-.603.805-1.493.976-2.024.246-.763.272-1 .272-2.426 0-.701.019-1.398.043-1.549.083-.554.47-1.148.931-1.429.103-.063.308-.157.453-.209.258-.092.315-.094 2.025-.096 1.642-.001 1.776.005 2.021.083m-1.384 10.771a1.06 1.06 0 0 1-.748.2c-.394-.066-.776-.451-.835-.841l-.026-.168h2.005v.108z"
/>
</svg>
);
@@ -50,9 +58,15 @@ export const RecordingRuleIcon = () => (
viewBox="411.014 448.582 23.358 18.492"
fill="currentColor"
>
<path d="M411.47 453.837a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m15.967 7.103a1.592 1.612 0 1 1 1.592-1.612 1.592 1.612 0 0 1-1.592 1.612m0-1.612"/>
<path d="M427.405 466.377a6.966 7.052 0 1 1 6.965-7.053 6.974 7.06 0 0 1-6.965 7.053m0-12.09a4.975 5.037 0 1 0 4.975 5.037 4.981 5.043 0 0 0-4.975-5.037"/>
<path d="M421.832 467.074a.996 1.008 0 0 1-.708-1.715l3.582-3.675a.995 1.008 0 0 1 1.417 1.415l-3.582 3.675a.995 1.007 0 0 1-.709.3m-10.378-7.697c-.284.124-.44.372-.439.701.001.354.204.614.553.708.092.025 1.214.034 3.267.028 3.481-.011 3.23.008 3.468-.264a.714.714 0 0 0-.003-.963c-.249-.283-.03-.267-3.564-.266-2.735 0-3.171.008-3.282.056m-.018 5.016a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m.161-15.761a.85.85 0 0 0-.389.417c-.023.07-.034.224-.026.343.018.239.078.345.301.525l.139.112 8.729.01 8.73.009.163-.079c.193-.093.36-.332.395-.565a.75.75 0 0 0-.388-.75c-.142-.072-.227-.073-8.844-.072-7.105.002-8.721.011-8.81.05"/>
<path
d="M411.47 453.837a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m15.967 7.103a1.592 1.612 0 1 1 1.592-1.612 1.592 1.612 0 0 1-1.592 1.612m0-1.612"
/>
<path
d="M427.405 466.377a6.966 7.052 0 1 1 6.965-7.053 6.974 7.06 0 0 1-6.965 7.053m0-12.09a4.975 5.037 0 1 0 4.975 5.037 4.981 5.043 0 0 0-4.975-5.037"
/>
<path
d="M421.832 467.074a.996 1.008 0 0 1-.708-1.715l3.582-3.675a.995 1.008 0 0 1 1.417 1.415l-3.582 3.675a.995 1.007 0 0 1-.709.3m-10.378-7.697c-.284.124-.44.372-.439.701.001.354.204.614.553.708.092.025 1.214.034 3.267.028 3.481-.011 3.23.008 3.468-.264a.714.714 0 0 0-.003-.963c-.249-.283-.03-.267-3.564-.266-2.735 0-3.171.008-3.282.056m-.018 5.016a.72.72 0 0 0-.422.679c0 .319.137.535.422.667.139.065.322.068 3.814.069l3.668.001.164-.083c.484-.245.535-.904.096-1.254l-.141-.112-3.746-.008c-3.05-.006-3.766.001-3.855.041m.161-15.761a.85.85 0 0 0-.389.417c-.023.07-.034.224-.026.343.018.239.078.345.301.525l.139.112 8.729.01 8.73.009.163-.079c.193-.093.36-.332.395-.565a.75.75 0 0 0-.388-.75c-.142-.072-.227-.073-8.844-.072-7.105.002-8.721.011-8.81.05"
/>
</svg>
);
@@ -701,3 +715,14 @@ export const DarkIcon = () => (
/>
</svg>
);
export const UnlockIcon = () => (
<svg
viewBox="0 0 24 24"
fill="currentColor"
>
<path
d="M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h1.9c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m0 12H6V10h12z"
></path>
</svg>
);
@@ -7,7 +7,8 @@ import {
useRef,
useState,
useCallback,
createPortal
createPortal,
useLayoutEffect
} from "react";
import classNames from "classnames";
import "./style.scss";
@@ -17,6 +18,7 @@ import Button from "../Button/Button";
import { CloseIcon } from "../Icons";
import { useLocation, useNavigate } from "react-router-dom";
import useEventListener from "../../../hooks/useEventListener";
import useWindowSize from "../../../hooks/useWindowSize";
interface PopperProps {
children: ReactNode
@@ -51,6 +53,7 @@ const Popper: FC<PopperProps> = ({
variant
}) => {
const { isMobile } = useDeviceDetect();
const { width: windowWidth, height: windowHeight } = useWindowSize();
const navigate = useNavigate();
const location = useLocation();
const [popperSize, setPopperSize] = useState({ width: 0, height: 0 });
@@ -71,14 +74,6 @@ const Popper: FC<PopperProps> = ({
};
}, [open]);
useEffect(() => {
setPopperSize({
width: popperRef?.current?.clientWidth || 0,
height: popperRef?.current?.clientHeight || 0
});
setIsOpen(false);
}, [popperRef]);
const popperStyle = useMemo(() => {
if (!buttonRef) return {};
const buttonEl = buttonRef.current;
@@ -100,7 +95,7 @@ const Popper: FC<PopperProps> = ({
const offsetTop = offset?.top || 0;
const offsetLeft = offset?.left || 0;
position.left = position.left = buttonPos.left + offsetLeft;
position.left = buttonPos.left + offsetLeft;
position.top = buttonPos.height + buttonPos.top + offsetTop;
if (needAlignRight) position.left = buttonPos.right - popperSize.width;
@@ -130,7 +125,20 @@ const Popper: FC<PopperProps> = ({
if (position.left < 0) position.left = 0;
return position;
}, [buttonRef, placement, isOpen, children, fullWidth]);
}, [
buttonRef,
placement,
isOpen,
popperSize.width,
popperSize.height,
windowWidth,
windowHeight,
fullWidth,
offset.top,
offset.left,
placementPosition?.top,
placementPosition?.left,
]);
const handleClickClose = (e: ReactMouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
@@ -147,14 +155,39 @@ const Popper: FC<PopperProps> = ({
handleClose();
};
useEffect(() => {
if (!popperRef.current || !isOpen || (isMobile && !disabledFullScreen)) return;
const { right, width } = popperRef.current.getBoundingClientRect();
if (right > window.innerWidth) {
const left = window.innerWidth - width;
popperRef.current.style.left = `${left}px`;
useLayoutEffect(() => {
const element = popperRef.current;
if (!element || !isOpen) return;
const updateSize = () => {
const width = element.offsetWidth;
const height = element.offsetHeight;
setPopperSize(prev => {
if (
prev.width === width &&
prev.height === height
) {
return prev;
}
return { width, height };
});
};
if (typeof ResizeObserver === "undefined") {
updateSize();
return;
}
}, [isOpen, popperRef, placementPosition]);
const observer = new ResizeObserver(updateSize);
observer.observe(element);
updateSize();
return () => observer.disconnect();
}, [isOpen]);
const handlePopstate = useCallback(() => {
if (isOpen && isMobile && !disabledFullScreen) {
@@ -173,7 +206,7 @@ const Popper: FC<PopperProps> = ({
return (
<>
{(isOpen || !popperSize.width) && createPortal((
{isOpen && createPortal((
<div
className={classNames({
"vm-popper": true,
@@ -28,3 +28,6 @@ export const GRAPH_SIZES: GraphSize[] = [
export const STATS_ORDER_LEGEND: (keyof SeriesItemStatsFormatted)[] = ["min", "median", "max", "range", "last"];
export const STATS_ORDER_TOOLTIP: (keyof SeriesItemStatsFormatted)[] = ["min", "median", "max"];
// Use a larger auto step for heatmap readability and rendering performance.
export const HEATMAP_STEP_MULTIPLIER = 10;
@@ -4,6 +4,7 @@ import { QueryStateProvider } from "../state/query/QueryStateContext";
import { CustomPanelStateProvider } from "../state/customPanel/CustomPanelStateContext";
import { GraphStateProvider } from "../state/graph/GraphStateContext";
import { DashboardsStateProvider } from "../state/dashboards/DashboardsStateContext";
import { StepStateProvider } from "../state/step/StepStateContext";
import { SnackbarProvider } from "./Snackbar";
import { combineComponents } from "../utils/combine-components";
@@ -14,6 +15,7 @@ const providers = [
QueryStateProvider,
CustomPanelStateProvider,
GraphStateProvider,
StepStateProvider,
SnackbarProvider,
DashboardsStateProvider,
];
@@ -10,8 +10,6 @@ import { useQueryState } from "../state/query/QueryStateContext";
import { useTimeState } from "../state/time/TimeStateContext";
import { useCustomPanelState } from "../state/customPanel/CustomPanelStateContext";
import { isHistogramData } from "../utils/metric";
import { useGraphState } from "../state/graph/GraphStateContext";
import { getStepFromDuration } from "../utils/time";
import { getQueryStringValue } from "../utils/query-string";
interface FetchQueryParams {
@@ -59,10 +57,10 @@ export const useFetchQuery = ({
const { period } = useTimeState();
const { displayType, nocache, isTracingEnabled, seriesLimits: stateSeriesLimits } = useCustomPanelState();
const { serverUrl } = useAppState();
const { isHistogram: isHistogramState } = useGraphState();
const [isLoading, setIsLoading] = useState(false);
const [graphData, setGraphData] = useState<MetricResult[]>();
const [graphResult, setGraphResult] = useState<{ data: MetricResult[], step: string }>();
const graphData = graphResult?.step === customStep ? graphResult.data : undefined;
const [liveData, setLiveData] = useState<InstantMetricResult[]>();
const [traces, setTraces] = useState<Trace[]>();
const [error, setError] = useState<ErrorTypes | string>();
@@ -72,11 +70,6 @@ export const useFetchQuery = ({
const [fetchQueue, setFetchQueue] = useState<AbortController[]>([]);
const [isHistogram, setIsHistogram] = useState(false);
const defaultStep = useMemo(() => {
const { end, start } = period;
return getStepFromDuration(end - start, isHistogramState, displayType);
}, [period, isHistogramState, displayType]);
const fetchData = async ({
fetchUrl,
displayType,
@@ -162,7 +155,11 @@ export const useFetchQuery = ({
: ""
);
isDisplayChart ? setGraphData(tempData as MetricResult[]) : setLiveData(tempData as InstantMetricResult[]);
if (isDisplayChart) {
setGraphResult({ data: tempData as MetricResult[], step: new URL(fetchUrl[0]).searchParams.get("step") || "" });
} else {
setLiveData(tempData as InstantMetricResult[]);
}
setTraces(tempTraces);
setIsHistogram(prev => totalLength ? isHistogramResult : prev);
} catch (e) {
@@ -200,7 +197,7 @@ export const useFetchQuery = ({
fetchQueue.forEach(f => f.abort());
setFetchQueue([]);
setGraphData([]);
setGraphResult(undefined);
setLiveData([]);
}, [fetchQueue]);
@@ -230,10 +227,6 @@ export const useFetchQuery = ({
setFetchQueue(prev => prev.filter(f => !f.signal.aborted));
}, [fetchQueue]);
useEffect(() => {
if (defaultStep === customStep) setGraphData([]);
}, [isHistogram]);
useEffect(() => {
setError("");
setQueryErrors([]);
@@ -1,9 +1,8 @@
import { FC, useMemo } from "preact/compat";
import { RouterOptions, routerOptions, RouterOptionsHeader } from "../../../router";
import { useLocation } from "react-router-dom";
import {
useFetchAccountIds
} from "../../../components/Configurators/GlobalSettings/TenantsConfiguration/hooks/useFetchAccountIds";
import Button from "../../../components/Main/Button/Button";
import { MoreIcon } from "../../../components/Main/Icons";
import classNames from "classnames";
@@ -17,7 +16,6 @@ export interface ControlsProps {
displaySidebar: boolean;
isMobile?: boolean;
headerSetup?: RouterOptionsHeader;
accountIds?: string[];
closeModal: () => void;
}
@@ -28,7 +26,6 @@ const HeaderControls: FC<ControlsProps & HeaderProps> = ({
}) => {
const appModeEnable = getAppModeEnable();
const { pathname } = useLocation();
const { accountIds } = useFetchAccountIds();
const {
value: openList,
@@ -44,7 +41,6 @@ const HeaderControls: FC<ControlsProps & HeaderProps> = ({
<ControlsComponent
{...props}
isMobile={isMobile}
accountIds={accountIds}
headerSetup={headerSetup}
closeModal={handleCloseList}
/>
@@ -1,4 +1,4 @@
import { FC } from "preact/compat";
import { createPortal, FC, useEffect } from "preact/compat";
import classNames from "classnames";
import TenantsConfiguration
from "../../components/Configurators/GlobalSettings/TenantsConfiguration/TenantsConfiguration";
@@ -8,17 +8,31 @@ import CardinalityDatePicker from "../../components/Configurators/CardinalityDat
import GlobalSettings, { GlobalSettingsHandle } from "../../components/Configurators/GlobalSettings/GlobalSettings";
import ShortcutKeys from "../../components/Main/ShortcutKeys/ShortcutKeys";
import { ControlsProps } from "../Header/HeaderControls/HeaderControls";
import { useRef } from "react";
import { useRef, useState } from "react";
import TimeZonePreview from "../../components/Configurators/GlobalSettings/TimeZonePreview/TimeZonePreview";
import ServerUrlDeprecationWarning
from "../../components/Configurators/GlobalSettings/ServerConfigurator/ServerUrlDeprecationWarning";
const ControlsMainLayout: FC<ControlsProps> = ({
displaySidebar,
isMobile,
headerSetup,
accountIds,
}) => {
const settingsRef = useRef<GlobalSettingsHandle>(null);
const [warningContainer, setWarningContainer] = useState<HTMLDivElement | null>(null);
useEffect(() => {
const header = document.querySelector(".vm-header");
if (!header) return;
const container = document.createElement("div");
header.after(container);
setWarningContainer(container);
return () => container.remove();
}, []);
return (
<div
className={classNames({
@@ -26,13 +40,22 @@ const ControlsMainLayout: FC<ControlsProps> = ({
"vm-header-controls_mobile": isMobile,
})}
>
{headerSetup?.tenant && <TenantsConfiguration accountIds={accountIds || []}/>}
{headerSetup?.tenant && <TenantsConfiguration />}
{headerSetup?.stepControl && <StepConfigurator/>}
{headerSetup?.timeSelector && <TimeSelector onOpenSettings={() => settingsRef.current?.open()}/>}
{headerSetup?.cardinalityDatePicker && <CardinalityDatePicker/>}
<TimeZonePreview onOpenSettings={() => settingsRef.current?.open()}/>
<GlobalSettings ref={settingsRef}/>
{!displaySidebar && <ShortcutKeys/>}
{/* TODO: Remove this warning when Server URL editing is removed.
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/11735 */}
{warningContainer && createPortal(
<ServerUrlDeprecationWarning
onOpenSettings={() => settingsRef.current?.open()}
/>,
warningContainer
)}
</div>
);
};
@@ -2,7 +2,7 @@ import { FC, useMemo } from "preact/compat";
import { useFetchActiveQueries } from "./hooks/useFetchActiveQueries";
import Alert from "../../components/Main/Alert/Alert";
import Spinner from "../../components/Main/Spinner/Spinner";
import Table from "../../components/Table/Table";
import Table, { TableColumn } from "../../components/Table/Table";
import { ActiveQueriesType } from "../../types";
import dayjs from "dayjs";
import { useTimeState } from "../../state/time/TimeStateContext";
@@ -13,6 +13,7 @@ import { RefreshIcon } from "../../components/Main/Icons";
import "./style.scss";
import { DATE_TIME_FORMAT } from "../../constants/date";
import { roundStep } from "../../utils/time";
import { formatTenant } from "../../utils/tenants";
const ActiveQueries: FC = () => {
const { isMobile } = useDeviceDetect();
@@ -23,29 +24,54 @@ const ActiveQueries: FC = () => {
const activeQueries = useMemo(() => data.map((item: ActiveQueriesType) => {
const from = dayjs(item.start).tz().format(DATE_TIME_FORMAT);
const to = dayjs(item.end).tz().format(DATE_TIME_FORMAT);
const accountID = Number(item.account_id);
const projectID = Number(item.project_id);
return {
duration: item.duration,
remote_addr: item.remote_addr,
query: item.query,
args: `${from} to ${to}, step=${roundStep(item.step)}`,
data: JSON.stringify(item, null, 2),
// Normalize tenant fields
multiTenant: item.is_multitenant,
accountID: Number.isFinite(accountID) ? accountID : undefined,
projectID: Number.isFinite(projectID) ? projectID : undefined,
} as ActiveQueriesType;
}), [data, timezone]);
const columns = useMemo(() => {
const tenantColumn: TableColumn<ActiveQueriesType> | null = useMemo(() => {
if (!data?.length) return null;
const someHasTenant = activeQueries.some(q => !!formatTenant(q));
if (!someHasTenant) return null;
return {
key: "accountID",
title: "tenant",
format: (q: ActiveQueriesType) => formatTenant(q) || ""
};
}, [activeQueries]);
const columns: TableColumn<ActiveQueriesType>[] = useMemo(() => {
if (!activeQueries?.length) return [];
const keys = Object.keys(activeQueries[0]) as (keyof ActiveQueriesType)[];
const titles: Partial<Record<keyof ActiveQueriesType, string>> = {
remote_addr: "client address",
};
const hideColumns = ["data"];
const hideColumns = ["data", "multiTenant", "accountID", "projectID"];
return keys.filter((col) => !hideColumns.includes(col)).map((key) => ({
const baseCols = keys.filter((col) => !hideColumns.includes(col)).map((key) => ({
key: key,
title: titles[key] || key,
}));
}, [activeQueries]);
if (tenantColumn) return [...baseCols, tenantColumn];
return baseCols;
}, [activeQueries, tenantColumn]);
const handleRefresh = async () => {
fetchData().catch(console.error);
@@ -1,5 +1,9 @@
import { QueryUpdater } from "./types";
import { escapeLabelName } from "../../utils/metric";
import dayjs from "dayjs";
import { TenantPeriodContext } from "../../router";
import { TimeParams } from "../../types";
import { DATE_FORMAT } from "../../constants/date";
export const queryUpdater: QueryUpdater = {
seriesCountByMetricName: ({ query }): string => {
@@ -31,3 +35,16 @@ const getSeriesSelector = (label: string | null, value: string): string => {
}
return "{" + escapeLabelName(label) + "=" + JSON.stringify(value) + "}";
};
export const getCardinalityTenantPeriod = ({ searchParams }: TenantPeriodContext): TimeParams => {
const raw = searchParams.get("date") || dayjs().tz().format(DATE_FORMAT);
const date = dayjs.utc(raw).startOf("day");
const endOfDay = date.endOf("day").valueOf();
const now = Date.now();
return {
date: date.format(DATE_FORMAT),
start: date.unix(),
end: (date.valueOf() > now ? endOfDay : Math.min(endOfDay, now)) / 1000,
};
};
@@ -1,3 +1,4 @@
import { useStep } from "../../../state/step/StepStateContext";
import { FC, createPortal, useCallback, RefObject } from "preact/compat";
import GraphView from "../../../components/Views/GraphView/GraphView";
import GraphTips from "../../../components/Chart/GraphTips/GraphTips";
@@ -18,7 +19,8 @@ type Props = {
const GraphTab: FC<Props> = ({ isHistogram, graphData, controlsRef }) => {
const { isMobile } = useDeviceDetect();
const { customStep, yaxis, spanGaps, showAllPoints } = useGraphState();
const { effective: customStep } = useStep();
const { yaxis, spanGaps, showAllPoints } = useGraphState();
const { period } = useTimeState();
const { query } = useQueryState();
@@ -263,14 +263,24 @@ const DownloadReport: FC<Props> = ({ fetchUrl, reportType = ReportType.QUERY_DAT
label={"Include query trace"}
/>
</div>
<Alert variant="info">
If confused with the query results,
try viewing the raw samples for selected series in <RawQueryLink/> tab.
<Alert
variant="info"
title="Inspect raw samples"
>
To better understand the query results, view the raw samples
for selected series in the <RawQueryLink/> tab.
</Alert>
</>
)}
</div>
{error && <Alert variant="error">{error}</Alert>}
{error && (
<Alert
variant="error"
title="Unable to generate report"
>
{error}
</Alert>
)}
<div className="vm-download-report__buttons">
<Button
variant="text"
@@ -1,6 +1,6 @@
import { useStep } from "../../../state/step/StepStateContext";
import { FC } from "preact/compat";
import Hyperlink from "../../../components/Main/Hyperlink/Hyperlink";
import { useGraphState } from "../../../state/graph/GraphStateContext";
const last_over_time = <Hyperlink
text="last_over_time"
@@ -15,7 +15,7 @@ const instant_query = <Hyperlink
/>;
const InstantQueryTip: FC = () => {
const { customStep } = useGraphState();
const { effective: customStep } = useStep();
return (
<div>
@@ -14,11 +14,14 @@ const WarningHeatmapToLine:FC = () => {
if (!isEmptyHistogram) return null;
return (
<Alert variant="warning">
<Alert
variant="warning"
title="Unable to display heatmap"
>
<div className="vm-warning-heatmap-to-line">
<p className="vm-warning-heatmap-to-line__text">
The expression cannot be displayed as a heatmap.
To make the graph work, disable the heatmap in the &quot;Graph settings&quot; or modify the expression.
Switch to a line chart, disable the heatmap in the &quot;Graph settings&quot;,
or modify the expression to return histogram data.
</p>
<Button
@@ -27,7 +27,10 @@ const WarningLimitSeries: FC<Props> = ({ warning, query, onChange }) => {
}, [showAllSeries]);
return (
<Alert variant="warning">
<Alert
variant="warning"
title="Series limit reached"
>
<div
className={classNames({
"vm-custom-panel__warning": true,
@@ -3,7 +3,6 @@ import { useTimeDispatch, useTimeState } from "../../../state/time/TimeStateCont
import { useCustomPanelDispatch, useCustomPanelState } from "../../../state/customPanel/CustomPanelStateContext";
import { useQueryDispatch, useQueryState } from "../../../state/query/QueryStateContext";
import { displayTypeTabs } from "../DisplayTypeSwitch";
import { useGraphDispatch, useGraphState } from "../../../state/graph/GraphStateContext";
import { useSearchParams } from "react-router-dom";
import { useCallback } from "preact/compat";
import { getInitialDisplayType } from "../../../state/customPanel/reducer";
@@ -16,12 +15,10 @@ import { isEqualURLSearchParams } from "../../../utils/url";
export const useSetQueryParams = () => {
const { displayType } = useCustomPanelState();
const { query } = useQueryState();
const { duration, relativeTime, period: { date, step } } = useTimeState();
const { customStep } = useGraphState();
const { duration, relativeTime, period: { date } } = useTimeState();
const [searchParams, setSearchParams] = useSearchParams();
const timeDispatch = useTimeDispatch();
const graphDispatch = useGraphDispatch();
const queryDispatch = useQueryDispatch();
const customPanelDispatch = useCustomPanelDispatch();
@@ -60,11 +57,6 @@ export const useSetQueryParams = () => {
newSearchParams.set("expr.hide", exprHide);
}
const stepFromUrl = searchParams.get(`${group}.step_input`) || step;
if (stepFromUrl && (stepFromUrl !== customStep)) {
newSearchParams.set(`${group}.step_input`, customStep);
}
const displayTypeCode = `${displayTypeTabs.find(t => t.value === displayType)?.prometheusCode || 0}`;
if (searchParams.get(`${group}.tab`) !== displayTypeCode) {
newSearchParams.set(`${group}.tab`, `${displayTypeCode}`);
@@ -82,7 +74,7 @@ export const useSetQueryParams = () => {
if (isEqualURLSearchParams(newSearchParams, searchParams) || !newSearchParams.size) return;
setSearchParams(newSearchParams);
}, [displayType, query, duration, relativeTime, date, step, customStep]);
}, [displayType, query, duration, relativeTime, date, searchParams, isPopstate]);
useEffect(() => {
const timer = setTimeout(setterSearchParams, 200);
@@ -113,15 +105,6 @@ export const useSetQueryParams = () => {
timeDispatch({ type: "RUN_QUERY" });
}
// Timer prevents customStep reset on time range change.
const timer = setTimeout(() => {
const customStepFromUrl = searchParams.get("g0.step_input") || step;
if (customStepFromUrl && customStepFromUrl !== customStep) {
graphDispatch({ type: "SET_CUSTOM_STEP", payload: customStepFromUrl });
}
}, 50);
return () => clearTimeout(timer);
}, [searchParams, isPopstate]);
useEventListener("popstate", () => {
@@ -1,8 +1,9 @@
import { useStep } from "../../state/step/StepStateContext";
import { FC, useEffect, useState, useMemo, useRef, useCallback } from "preact/compat";
import QueryConfigurator from "./QueryConfigurator/QueryConfigurator";
import { useFetchQuery } from "../../hooks/useFetchQuery";
import { DisplayTypeSwitch } from "./DisplayTypeSwitch";
import { useGraphDispatch, useGraphState } from "../../state/graph/GraphStateContext";
import { useGraphDispatch } from "../../state/graph/GraphStateContext";
import LineLoader from "../../components/Main/LineLoader/LineLoader";
import { useCustomPanelState } from "../../state/customPanel/CustomPanelStateContext";
import { useQueryState } from "../../state/query/QueryStateContext";
@@ -30,7 +31,7 @@ const CustomPanel: FC = () => {
const { displayType } = useCustomPanelState();
const { query } = useQueryState();
const { customStep } = useGraphState();
const { effective: customStep } = useStep();
const graphDispatch = useGraphDispatch();
const [hideQuery, setHideQuery] = useState<number[]>([]);
@@ -117,8 +118,22 @@ const CustomPanel: FC = () => {
traces={traces}
displayType={displayType}
/>
{showError && <Alert variant="error">{error}</Alert>}
{showInstantQueryTip && <Alert variant="info"><InstantQueryTip/></Alert>}
{showError && (
<Alert
variant="error"
title="Unable to load query results"
>
{error}
</Alert>
)}
{showInstantQueryTip && (
<Alert
variant="info"
title="Instant query results"
>
<InstantQueryTip/>
</Alert>
)}
<WarningHeatmapToLine/>
{warning && (
<WarningLimitSeries
@@ -1,7 +1,6 @@
import { useEffect } from "react";
import { compactObject } from "../../../utils/object";
import { useTimeState } from "../../../state/time/TimeStateContext";
import { useGraphState } from "../../../state/graph/GraphStateContext";
import useSearchParamsFromObject from "../../../hooks/useSearchParamsFromObject";
interface queryProps {
@@ -13,14 +12,12 @@ interface queryProps {
export const useSetQueryParams = ({ job, instance, metrics, size }: queryProps) => {
const { duration, relativeTime, period: { date } } = useTimeState();
const { customStep } = useGraphState();
const { setSearchParamsFromKeys } = useSearchParamsFromObject();
const setSearchParamsFromState = () => {
const params = compactObject({
["g0.range_input"]: duration,
["g0.end_input"]: date,
["g0.step_input"]: customStep,
["g0.relative_time"]: relativeTime,
size,
job,
@@ -31,6 +28,6 @@ export const useSetQueryParams = ({ job, instance, metrics, size }: queryProps)
setSearchParamsFromKeys(params);
};
useEffect(setSearchParamsFromState, [duration, relativeTime, date, customStep, job, instance, metrics, size]);
useEffect(setSearchParamsFromState, [duration, relativeTime, date, job, instance, metrics, size]);
useEffect(setSearchParamsFromState, []);
};
@@ -113,7 +113,10 @@ const PredefinedDashboard: FC<PredefinedDashboardProps> = ({
</div>
)
: <div className="vm-predefined-dashboard-panels-panel__alert">
<Alert variant="error">
<Alert
variant="error"
title="Missing dashboard panels"
>
<code>&quot;panels&quot;</code> not found. Check the configuration file <b>{filename}</b>.
</Alert>
</div>
@@ -1,3 +1,4 @@
import { useStep } from "../../../state/step/StepStateContext";
import { FC, useEffect, useMemo, useRef, useState } from "preact/compat";
import { DisplayType, PanelSettings } from "../../../types";
import { AxisRange, YaxisState } from "../../../state/graph/reducer";
@@ -10,7 +11,6 @@ import { InfoIcon } from "../../../components/Main/Icons";
import "./style.scss";
import Alert from "../../../components/Main/Alert/Alert";
import Tooltip from "../../../components/Main/Tooltip/Tooltip";
import { useGraphState } from "../../../state/graph/GraphStateContext";
import useDeviceDetect from "../../../hooks/useDeviceDetect";
import SafeHtml from "../../../components/Main/SafeHtml/SafeHtml";
@@ -29,7 +29,7 @@ const PredefinedPanel: FC<PredefinedPanelsProps> = ({
}) => {
const { isMobile } = useDeviceDetect();
const { period } = useTimeState();
const { customStep } = useGraphState();
const { effective: customStep } = useStep();
const dispatch = useTimeDispatch();
const containerRef = useRef<HTMLDivElement>(null);
@@ -79,7 +79,10 @@ const PredefinedPanel: FC<PredefinedPanelsProps> = ({
}, [containerRef]);
if (!validExpr) return (
<Alert variant="error">
<Alert
variant="error"
title="Missing panel query"
>
<code>&quot;expr&quot;</code> not found. Check the configuration file <b>{filename}</b>.
</Alert>
);
@@ -134,8 +137,22 @@ const PredefinedPanel: FC<PredefinedPanelsProps> = ({
</div>
<div className="vm-predefined-panel-body">
{isLoading && <Spinner/>}
{error && <Alert variant="error">{error}</Alert>}
{warning && <Alert variant="warning">{warning}</Alert>}
{error && (
<Alert
variant="error"
title="Unable to load query results"
>
{error}
</Alert>
)}
{warning && (
<Alert
variant="warning"
title="Series limit reached"
>
{warning}
</Alert>
)}
{graphData && <GraphView
isPredefinedPanel
data={graphData}
@@ -3,15 +3,12 @@ import { useSearchParams } from "react-router-dom";
import { compactObject } from "../../../utils/object";
import { useTimeDispatch, useTimeState } from "../../../state/time/TimeStateContext";
import { getInitialTimeState } from "../../../state/time/reducer";
import { useGraphDispatch, useGraphState } from "../../../state/graph/GraphStateContext";
import useSearchParamsFromObject from "../../../hooks/useSearchParamsFromObject";
import useEventListener from "../../../hooks/useEventListener";
export const useSetQueryParams = () => {
const { duration, relativeTime, period: { date } } = useTimeState();
const timeDispatch = useTimeDispatch();
const { customStep } = useGraphState();
const graphDispatch = useGraphDispatch();
const [searchParams] = useSearchParams();
const [isPopstate, setIsPopstate] = useState(false);
const skipNextUrlUpdate = useRef(false);
@@ -28,14 +25,13 @@ export const useSetQueryParams = () => {
const params = compactObject({
["g0.range_input"]: duration,
["g0.end_input"]: date,
["g0.step_input"]: customStep,
["g0.relative_time"]: relativeTime
});
setSearchParamsFromKeys(params);
};
useEffect(setSearchParamsFromState, [duration, relativeTime, date, customStep, isPopstate]);
useEffect(setSearchParamsFromState, [duration, relativeTime, date, isPopstate]);
useEffect(() => {
if (!isPopstate) return;
@@ -49,13 +45,7 @@ export const useSetQueryParams = () => {
timeDispatch({ type: "SET_TIME_STATE", payload: timeFromUrl });
}
// Apply the URL step after the time range's automatic step update.
// Keep state-to-URL synchronization paused until both have been restored.
const timer = setTimeout(() => {
const customStepFromUrl = searchParams.get("g0.step_input") || timeFromUrl.period.step;
if (customStepFromUrl && customStepFromUrl !== customStep) {
graphDispatch({ type: "SET_CUSTOM_STEP", payload: customStepFromUrl });
}
// Restoring a relative range recalculates its end time. Do not push a new
// history entry for that update, otherwise Forward navigation is lost.
skipNextUrlUpdate.current = true;
@@ -63,7 +53,7 @@ export const useSetQueryParams = () => {
}, 50);
return () => clearTimeout(timer);
}, [searchParams, isPopstate, customStep]);
}, [searchParams, isPopstate]);
useEventListener("popstate", () => {
setIsPopstate(true);
@@ -53,7 +53,14 @@ const DashboardsLayout: FC = () => {
/>
</div>
{dashboardsLoading && <Spinner />}
{!dashboardsSettings.length && dashboardsError && <Alert variant="error">{dashboardsError}</Alert>}
{!dashboardsSettings.length && dashboardsError && (
<Alert
variant="error"
title="Unable to load dashboards"
>
{dashboardsError}
</Alert>
)}
{!dashboardsSettings.length && <Alert variant="info">Dashboards not found</Alert>}
{dashboards.length > 1 && (
<div
@@ -88,7 +95,10 @@ const DashboardsLayout: FC = () => {
/>)
)}
{!!dashboardsSettings.length && !validDashboardRows && (
<Alert variant="error">
<Alert
variant="error"
title="Missing dashboard rows"
>
<code>&quot;rows&quot;</code> not found. Check the configuration file <b>{filename}</b>.
</Alert>
)}
@@ -168,7 +168,12 @@ const QueryAnalyzer: FC = () => {
{error && (
<div className="vm-query-analyzer-error">
<Alert variant="error">{error}</Alert>
<Alert
variant="error"
title="Unable to load query response"
>
{error}
</Alert>
<Button
className="vm-query-analyzer-error__close"
startIcon={<CloseIcon/>}
@@ -111,7 +111,10 @@ const RawQueryPage: FC = () => {
includeFunctions={false}
/>
{showPageDescription && (
<Alert variant="info">
<Alert
variant="info"
title="Query raw samples"
>
<div className="vm-explore-metrics-header-description">
<ul>
<li>
@@ -139,7 +142,14 @@ const RawQueryPage: FC = () => {
</div>
</Alert>
)}
{showError && <Alert variant="error">{error}</Alert>}
{showError && (
<Alert
variant="error"
title="Unable to load query results"
>
{error}
</Alert>
)}
{warning && (
<WarningLimitSeries
warning={warning}
@@ -12,8 +12,10 @@ export interface TopQueryColumn {
title?: string;
tooltip?: string;
key: keyof TopQuery;
sortable?: boolean;
sortBy?: keyof TopQuery;
format?: (row: TopQuery) => ReactNode;
visible?: (row: TopQuery) => boolean;
}
export interface TopQueryPanelProps {
@@ -31,17 +31,25 @@ const TopQueryTable:FC<TopQueryPanelProps> = ({ rows, columns, defaultOrderBy })
await copyToClipboard(query, "Query has been copied");
};
const visibleColumns = columns.filter(column => {
return !column.visible || rows.some(row => column.visible!(row));
});
return (
<table className="vm-table">
<thead className="vm-table-header">
<tr className="vm-table__row vm-table__row_header">
{columns.map((col) => {
{visibleColumns.map((col) => {
const sortKey = col.sortBy || col.key;
return (
<th
className="vm-table-cell vm-table-cell_header vm-table-cell_sort"
onClick={createSortHandler(sortKey)}
className={classNames({
"vm-table-cell": true,
"vm-table-cell_header": true,
"vm-table-cell_sort": col.sortable !== false,
})}
onClick={col.sortable !== false ? createSortHandler(sortKey) : undefined}
key={col.key}
>
<div className="vm-table-cell__content">
@@ -56,15 +64,17 @@ const TopQueryTable:FC<TopQueryPanelProps> = ({ rows, columns, defaultOrderBy })
</span>
</Tooltip>
)}
<div
className={classNames({
"vm-table__sort-icon": true,
"vm-table__sort-icon_active": orderBy === sortKey,
"vm-table__sort-icon_desc": orderDir === "desc" && orderBy === sortKey
})}
>
<ArrowDropDownIcon/>
</div>
{col.sortable !== false && (
<div
className={classNames({
"vm-table__sort-icon": true,
"vm-table__sort-icon_active": orderBy === sortKey,
"vm-table__sort-icon_desc": orderDir === "desc" && orderBy === sortKey
})}
>
<ArrowDropDownIcon/>
</div>
)}
</div>
</th>
);
@@ -78,12 +88,16 @@ const TopQueryTable:FC<TopQueryPanelProps> = ({ rows, columns, defaultOrderBy })
className="vm-table__row"
key={rowIndex}
>
{columns.map((col) => (
{visibleColumns.map((col) => (
<td
className="vm-table-cell"
key={col.key}
>
{col.format?.(row) ?? row[col.key] ?? "-"}
{
col.visible && !col.visible(row)
? "-"
: col.format?.(row) ?? row[col.key] ?? "-"
}
</td>
))}
<td className="vm-table-cell vm-table-cell_no-padding">
@@ -1,6 +1,6 @@
import { ErrorTypes, TopQuery } from "../../../types";
import { useAppState } from "../../../state/common/StateContext";
import { useMemo, useState } from "preact/compat";
import { useMemo, useState, useRef, useEffect, useCallback } from "preact/compat";
import { getTopQueries } from "../../../api/top-queries";
import { TopQueriesData } from "../../../types";
import { getDurationFromMilliseconds, relativeTimeOptions } from "../../../utils/time";
@@ -48,24 +48,42 @@ export const useFetchTopQueries = ({ topN, maxLifetime }: useFetchTopQueriesProp
const [data, setData] = useState<TopQueriesData | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<ErrorTypes | string>();
const abortControllerRef = useRef<AbortController>();
const fetchUrl = useMemo(() => getTopQueries(serverUrl, topN, maxLifetime), [serverUrl, topN, maxLifetime]);
const fetchData = async () => {
const fetchData = useCallback(async () => {
abortControllerRef.current?.abort();
const controller = new AbortController();
abortControllerRef.current = controller;
setLoading(true);
setSearchParamsFromKeys({ topN, maxLifetime });
try {
const response = await fetch(fetchUrl);
const response = await fetch(fetchUrl, { signal: controller.signal });
const resp = await response.json();
if (controller.signal.aborted) return;
setData(response.ok ? processResponse(resp) : null);
setError(String(resp.error || ""));
} catch (e) {
if (e instanceof Error && e.name !== "AbortError") {
if (!controller.signal.aborted && e instanceof Error) {
setError(`${e.name}: ${e.message}`);
}
} finally {
if (abortControllerRef.current === controller) {
abortControllerRef.current = undefined;
setLoading(false);
}
}
setLoading(false);
};
}, [fetchUrl, setSearchParamsFromKeys]);
useEffect(() => {
return () => {
abortControllerRef.current?.abort();
abortControllerRef.current = undefined;
};
}, []);
return {
data,
@@ -2,6 +2,7 @@ import { useMemo } from "react";
import { TopQueryColumn } from "../TopQueryPanel/TopQueryPanel";
import { humanizeSeconds } from "../../../utils/time";
import { formatBytes } from "../../../utils/bytes";
import { formatTenant } from "../../../utils/tenants";
type UseTopQueriesColumns = {
maxLifetime: string;
@@ -25,6 +26,14 @@ export const useTopQueriesColumns = ({ maxLifetime }: UseTopQueriesColumns) => {
tooltip: `The number of times the query was executed over the last ${maxLifetime}`,
};
const tenantCol: TopQueryColumn = {
key: "accountID",
title: "tenant",
sortable: false,
visible: row => !!formatTenant(row),
format: formatTenant,
};
const topBySumDuration: TopQueryColumn[] = [
queryCol,
{
@@ -35,6 +44,7 @@ export const useTopQueriesColumns = ({ maxLifetime }: UseTopQueriesColumns) => {
},
timeRangeCol,
countCol,
tenantCol,
];
const topByAvgDuration: TopQueryColumn[] = [
@@ -47,12 +57,14 @@ export const useTopQueriesColumns = ({ maxLifetime }: UseTopQueriesColumns) => {
},
timeRangeCol,
countCol,
tenantCol,
];
const topByCount: TopQueryColumn[] = [
queryCol,
timeRangeCol,
countCol,
tenantCol,
];
const topByAvgMemoryUsage: TopQueryColumn[] = [
@@ -65,6 +77,7 @@ export const useTopQueriesColumns = ({ maxLifetime }: UseTopQueriesColumns) => {
},
timeRangeCol,
countCol,
tenantCol,
];
return {
@@ -16,11 +16,14 @@ import useDeviceDetect from "../../hooks/useDeviceDetect";
import classNames from "classnames";
import useStateSearchParams from "../../hooks/useStateSearchParams";
import { useTopQueriesColumns } from "./hooks/useTopQueriesColumns";
import { useAppState } from "../../state/common/StateContext";
import useEventListener from "../../hooks/useEventListener";
const exampleDuration = "30ms, 15s, 3d4h, 1y2w";
const TopQueries: FC = () => {
const { isMobile } = useDeviceDetect();
const { serverUrl } = useAppState();
const [topN, setTopN] = useStateSearchParams(10, "topN");
const [maxLifetime, setMaxLifetime] = useStateSearchParams("10m", "maxLifetime");
@@ -68,13 +71,10 @@ const TopQueries: FC = () => {
}, [data]);
useEffect(() => {
fetch();
window.addEventListener("popstate", fetch);
void fetch();
}, [serverUrl]);
return () => {
window.removeEventListener("popstate", fetch);
};
}, []);
useEventListener("popstate", fetch);
return (
<div
@@ -92,7 +92,10 @@ const TracePage: FC = () => {
className="vm-trace-page-header-errors-item"
key={`${error}_${i}`}
>
<Alert variant="error">
<Alert
variant="error"
title="Unable to load trace"
>
<b className="vm-trace-page-header-errors-item__filename">{error.filename}</b>
<span>{error.text}</span>
</Alert>
@@ -1,3 +1,5 @@
import { TimeParams } from "../types";
import { getCardinalityTenantPeriod } from "../pages/CardinalityPanel/helpers";
const router = {
home: "/",
@@ -19,6 +21,10 @@ const router = {
notifiers: "/notifiers",
};
export interface TenantPeriodContext {
searchParams: URLSearchParams;
}
export interface RouterOptionsHeader {
tenant?: boolean;
stepControl?: boolean;
@@ -30,6 +36,7 @@ export interface RouterOptionsHeader {
export interface RouterOptions {
title?: string;
header: RouterOptionsHeader;
getTenantPeriod?: (context: TenantPeriodContext) => TimeParams;
}
const routerOptionsDefault = {
@@ -67,11 +74,13 @@ export const routerOptions: { [key: string]: RouterOptions } = {
tenant: true,
cardinalityDatePicker: true,
},
getTenantPeriod: getCardinalityTenantPeriod,
},
[router.topQueries]: {
title: "Top queries",
header: {
tenant: true,
timeSelector: true,
},
},
[router.trace]: {
@@ -1,4 +1,3 @@
import { getQueryStringValue } from "../../utils/query-string";
import { getFromStorage, saveToStorage } from "../../utils/storage";
export interface AxisRange {
@@ -13,7 +12,6 @@ export interface YaxisState {
}
export interface GraphState {
customStep: string
yaxis: YaxisState
isHistogram: boolean
isEmptyHistogram: boolean
@@ -26,7 +24,6 @@ export interface GraphState {
export type GraphAction =
| { type: "TOGGLE_ENABLE_YAXIS_LIMITS" }
| { type: "SET_YAXIS_LIMITS", payload: AxisRange }
| { type: "SET_CUSTOM_STEP", payload: string}
| { type: "SET_IS_HISTOGRAM", payload: boolean }
| { type: "SET_IS_EMPTY_HISTOGRAM", payload: boolean }
| { type: "SET_SPAN_GAPS", payload: boolean }
@@ -34,7 +31,6 @@ export type GraphAction =
| { type: "SET_OPEN_SETTINGS", payload: boolean }
export const initialGraphState: GraphState = {
customStep: getQueryStringValue("g0.step_input", "") as string,
yaxis: {
limits: { enable: false, range: { "1": [0, 0] } }
},
@@ -58,11 +54,6 @@ export function reducer(state: GraphState, action: GraphAction): GraphState {
}
}
};
case "SET_CUSTOM_STEP":
return {
...state,
customStep: action.payload
};
case "SET_YAXIS_LIMITS":
return {
...state,
@@ -0,0 +1,83 @@
import { createContext, FC, useCallback, useContext, useLayoutEffect, useMemo, useState } from "preact/compat";
import { useLocation, useNavigationType, useSearchParams } from "react-router-dom";
import { useTimeState } from "../time/TimeStateContext";
import { useCustomPanelState } from "../customPanel/CustomPanelStateContext";
import { useGraphState } from "../graph/GraphStateContext";
import { DisplayType } from "../../types";
import { getStepFromDuration } from "../../utils/time";
import router from "../../router";
interface StepContextValue {
calculated: string;
override: string | null;
effective: string;
setOverride: (value: string) => void;
reset: () => void;
}
const StepContext = createContext<StepContextValue>({} as StepContextValue);
const normalizeStep = (value: string | null): string | null => {
if (!value) return null;
if (!/^[0-9]*\.?[0-9]+$/.test(value)) return value;
return `${value.startsWith(".") ? "0" : ""}${value}s`;
};
export const useStep = (): StepContextValue => useContext(StepContext);
export const StepStateProvider: FC = ({ children }) => {
const { period: { start, end } } = useTimeState();
const { displayType } = useCustomPanelState();
const { isHistogram } = useGraphState();
const { pathname } = useLocation();
const navigationType = useNavigationType();
const [searchParams, setSearchParams] = useSearchParams();
const fromUrl = normalizeStep(searchParams.get("g0.step_input"));
const [previous, setPrevious] = useState({ pathname, override: fromUrl });
// Ordinary page navigation keeps the manual setting. History navigation and
// explicit URL values restore the setting from that history entry instead.
const carryOverride = pathname !== previous.pathname && navigationType !== "POP" && !fromUrl;
const override = carryOverride ? previous.override : fromUrl;
const isQueryPage = pathname === router.home || pathname === router.query;
const calculated = getStepFromDuration(
end - start,
isQueryPage && isHistogram,
isQueryPage ? displayType : DisplayType.chart
);
const writeOverride = useCallback((value: string | null, replace = false) => {
const normalized = normalizeStep(value);
setSearchParams(current => {
const next = new URLSearchParams(current);
const keys = Array.from(next.keys()).filter(key => /^g\d+\.step_input$/.test(key));
keys.forEach(key => normalized ? next.set(key, normalized) : next.delete(key));
if (normalized) next.set("g0.step_input", normalized);
return next;
}, { replace });
}, [setSearchParams]);
useLayoutEffect(() => {
if (pathname !== previous.pathname || override !== previous.override) {
setPrevious({ pathname, override });
}
if (carryOverride && override) writeOverride(override, true);
}, [pathname, override, previous, carryOverride, writeOverride]);
const setOverride = useCallback((value: string) => writeOverride(value || null), [writeOverride]);
const reset = useCallback(() => writeOverride(null), [writeOverride]);
const contextValue = useMemo(() => ({
// Automatic step derived from the time range, page, display type, and histogram mode.
calculated,
// Manual step from the URL; null means automatic mode.
override,
// Shared step used by the header, API requests, and graphs.
effective: override ?? calculated,
setOverride,
reset,
}), [calculated, override, setOverride, reset]);
return <StepContext.Provider value={contextValue}>{children}</StepContext.Provider>;
};
+6 -5
View File
@@ -1,4 +1,4 @@
import { MetricBase } from "../api/types";
import { MetricBase, TenantInfo } from "../api/types";
export * from "./uplot";
declare global {
@@ -84,11 +84,9 @@ export interface RelativeTimeOption {
isDefault?: boolean;
}
export interface TopQuery {
accountID: number;
export interface TopQuery extends TenantInfo {
avgDurationSeconds: number;
count: number;
projectID: number;
query: string;
timeRangeSeconds: number;
sumDurationSeconds: number;
@@ -161,7 +159,7 @@ export interface RelabelData {
steps: RelabelStep[];
}
export interface ActiveQueriesType {
export interface ActiveQueriesType extends TenantInfo {
duration: string;
end: number;
start: number;
@@ -171,6 +169,9 @@ export interface ActiveQueriesType {
step: number;
args?: string;
data?: string;
account_id?: string;
project_id?: string;
is_multitenant?: boolean;
}
export enum QueryContextType {
@@ -1,3 +1,5 @@
import { TenantInfo } from "../api/types";
const TENANT_REGEXP = /(\/select\/)(\d+(?::\d+)?)(\/.*)?$/;
export const replaceTenantId = (serverUrl: string, tenantId: string) => {
@@ -19,3 +21,12 @@ export const updateBrowserUrlTenant = (tenantId: string) => {
const nextUrl = `${nextBase}${window.location.hash}`;
window.history.replaceState(null, "", nextUrl);
};
export const formatTenant = (tenantInfo: TenantInfo): string | undefined => {
const { multiTenant, accountID, projectID } = tenantInfo;
if (multiTenant === true) return "multitenant";
if (accountID === undefined || projectID === undefined) return undefined;
return `${accountID}:${projectID}`;
};
+6 -1
View File
@@ -607,7 +607,12 @@ func (c *vmselectClient) PrometheusAPIV1AdminStatusMetricNamesStatsReset(t *test
// /admin/tenants endpoint.
func (c *vmselectClient) APIV1AdminTenants(t *testing.T, opts QueryOpts) *AdminTenantsResponse {
t.Helper()
res, statusCode := c.cli.Get(t, c.tenantsURL, opts.Headers)
values := opts.asURLValues()
url := c.tenantsURL
if query := values.Encode(); query != "" {
url += "?" + query
}
res, statusCode := c.cli.Get(t, url, opts.Headers)
if statusCode != http.StatusOK {
t.Fatalf("unexpected status code: got %d, want %d, resp text=%q", statusCode, http.StatusOK, res)
}
+114
View File
@@ -0,0 +1,114 @@
package tests
import (
"fmt"
"slices"
"testing"
"time"
"github.com/VictoriaMetrics/VictoriaMetrics/apptest"
"github.com/google/go-cmp/cmp"
)
func TestClusterTenantsSearch(t *testing.T) {
tc := apptest.NewTestCase(t)
defer tc.Stop()
sut := tc.MustStartDefaultCluster()
const numDays = 100
now := time.Now().UTC()
samples := make([]string, numDays)
tenantIDs := make([]string, numDays)
for i := range numDays {
d := now.Add(-time.Duration(i) * 24 * time.Hour)
metricName := fmt.Sprintf("metric_%04d_%02d_%02d", d.Year(), d.Month(), d.Day())
accountID := fmt.Sprintf("%d", d.Year())
projectID := fmt.Sprintf("%d", 10000+100*int(d.Month())+d.Day())
value := i
timestamp := d.UnixMilli()
samples[i] = fmt.Sprintf(`%s{vm_account_id="%s", vm_project_id="%s"} %d %d`, metricName, accountID, projectID, value, timestamp)
tenantIDs[i] = fmt.Sprintf("%s:%s", accountID, projectID)
}
sut.PrometheusAPIV1ImportPrometheus(t, samples, apptest.QueryOpts{Tenant: "multitenant"})
sut.ForceFlush(t)
f := func(start, end *time.Time, wantTenants []string) {
t.Helper()
var opts apptest.QueryOpts
if start != nil {
opts.Start = fmt.Sprintf("%d", start.UnixMilli())
}
if end != nil {
opts.End = fmt.Sprintf("%d", end.UnixMilli())
}
got := sut.APIV1AdminTenants(t, opts)
wantData := slices.Clone(wantTenants)
slices.Sort(wantData)
want := &apptest.AdminTenantsResponse{
Status: "success",
Data: wantData,
}
if diff := cmp.Diff(want, got); diff != "" {
t.Fatalf("unexpected response (-want, +got):\n%s", diff)
}
}
var start, end time.Time
// Get tenants for unset start and end params.
f(nil, nil, tenantIDs[:1])
// Get tenants for unset start and yesterday end.
end = now.Add(-24 * time.Hour)
f(nil, &end, tenantIDs[1:])
// Get tenants for zero start and yesterday end.
start = time.UnixMilli(0)
end = now.Add(-24 * time.Hour)
f(&start, &end, tenantIDs[1:])
// Get tenants for first Unix milli start and yesterday end.
start = time.UnixMilli(1)
end = now.Add(-24 * time.Hour)
f(&start, &end, tenantIDs[1:])
// Get tenants for first last milli of the first Unix day start and
// yesterday end.
start = time.UnixMilli(24*3600*1000 - 1)
end = now.Add(-24 * time.Hour)
f(&start, &end, tenantIDs[1:])
// Get tenants for yesterday start and unset end.
// By default, end is zero, thus the time range is incorrect and empty
// result is expected.
start = now.Add(-24 * time.Hour)
f(&start, nil, tenantIDs[:0])
// Get tenants for yesterday start and zero end.
// The time range is incorrect and empty result is expected.
start = now.Add(-24 * time.Hour)
end = time.UnixMilli(0)
f(&start, &end, tenantIDs[:0])
// Get tenants for current day.
start = now
end = now
f(&start, &end, tenantIDs[:1])
// Get tenants for the last 2 days.
start = now.Add(-24 * time.Hour)
end = now
f(&start, &end, tenantIDs[:2])
// Get tenants for last 30 days
start = now.Add(-29 * 24 * time.Hour)
end = now
f(&start, &end, tenantIDs[:30])
// Get tenants for last 60 numDays
start = now.Add(-59 * 24 * time.Hour)
end = now
f(&start, &end, tenantIDs[:60])
}
+4 -5
View File
@@ -86,7 +86,8 @@ func TestClusterTenantsToTenantsVmctlNativeProtocol(t *testing.T) {
`--vm-native-src-addr=` + vmSrcAddr,
`--vm-native-dst-addr=` + vmDstAddr,
`--vm-native-filter-match={__name__=~".*"}`,
`--vm-native-filter-time-start=2025-05-30T16:39:00Z`,
`--vm-native-filter-time-start=2025-05-30T00:00:00Z`,
`--vm-native-filter-time-end=2025-05-30T23:59:59Z`,
`--disable-progress-bar=true`,
`--vm-intercluster`,
}
@@ -96,7 +97,6 @@ func TestClusterTenantsToTenantsVmctlNativeProtocol(t *testing.T) {
func testVmctlNativeProtocol(tc *apptest.TestCase, srcSut apptest.PrometheusWriteQuerier, dstSut apptest.PrometheusWriteQuerier, vmctlFlags []string) {
t := tc.T()
t.Helper()
cmpOpt := cmpopts.IgnoreFields(apptest.PrometheusAPIV1QueryResponse{}, "Status", "Data.ResultType")
@@ -111,7 +111,7 @@ func testVmctlNativeProtocol(tc *apptest.TestCase, srcSut apptest.PrometheusWrit
t.Errorf("unexpected response (-want, +got):\n%s", diff)
}
// Prepare the source vmsingle with some data
// Prepare the source with some data
// Insert some data.
const numSamples = 1000
const ingestTimestamp = " 1748623176000" // 2025-05-30T16:39:36Z
@@ -148,8 +148,7 @@ func testVmctlNativeProtocol(tc *apptest.TestCase, srcSut apptest.PrometheusWrit
dstSut.ForceFlush(t)
tc.Assert(&apptest.AssertOptions{
Retries: 300,
Msg: `unexpected metrics stored on vmsingle via the native protocol`,
Msg: "unexpected /prometheus/api/v1/export response",
Got: func() any {
exported := dstSut.PrometheusAPIV1Export(t, `{__name__=~".*"}`, apptest.QueryOpts{
Start: "2025-05-30T16:39:36Z",
+13 -13
View File
@@ -2050,7 +2050,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_cpu_waiting_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_cpu_waiting_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -2064,7 +2064,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_cpu_stalled_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_cpu_stalled_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2173,7 +2173,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_memory_waiting_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_memory_waiting_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -2187,7 +2187,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_memory_stalled_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_memory_stalled_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2312,7 +2312,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(process_io_storage_read_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_storage_read_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2327,7 +2327,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "sum(rate(process_io_storage_written_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_storage_written_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2581,7 +2581,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(process_io_read_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_read_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2596,7 +2596,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "sum(rate(process_io_write_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_write_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2817,7 +2817,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_io_waiting_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_io_waiting_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -2831,7 +2831,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_io_stalled_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_io_stalled_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -3373,7 +3373,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(go_memstats_alloc_bytes_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(go_memstats_alloc_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -6439,7 +6439,7 @@
"type": "prometheus",
"uid": "$ds"
},
"description": "Shows the number of ongoing Cluster Native insert API operations sent to `vmstorage`, where:\n* `max` - the maximum number of calls that can be processed in parallel;\n* `current` - Shows the number of ongoing insert operations being processed by the storage.\n\nEach successful API call results in a flush to disk. The `max` value is controlled by the `-maxConcurrentInserts` flag set on the storage (2 * cgroup.AvailableCPUs() by default). \n\nIf `current` consistently reaches `max`, it indicates that the storage is overloaded and likely requires more CPU (see CPU usage) or disks with higher IOPS (see disk read/write panels in the Resource Usage row)",
"description": "Shows the number of data ingestion requests from `vminsert` nodes that are being processed by `vmstorage` at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, the `vmstorage` node likely doesn't have enough resources to keep up with the ingestion rate. Add more `vmstorage` nodes to the cluster, or add more CPU (see CPU usage) or faster disks (see disk read/write panels in the Resource Usage row) to the `vmstorage` node.\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag at `vmstorage`, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
@@ -9295,7 +9295,7 @@
"type": "prometheus",
"uid": "$ds"
},
"description": "Shows the max number of ongoing insertions.\n* `max` - equal to number of CPU * 2 by default. May be configured with `maxConcurrentInserts` flag;\n* `current` - current number of goroutines busy with processing requests.\n\n`-maxConcurrentInserts` limits the number of insert requests which may be actively processed at any given point in time. All the other insert requests are queued for up to `-insert.maxQueueDuration` in the hope they will get a chance to be processed. This queue is used mostly for absorbing spikes for incoming insert request rate.\n\nWhen `current` hits `max` constantly, it means vminsert node is overloaded and requires more CPU or higher limits.",
"description": "Shows the number of data ingestion requests that are being processed by `vminsert` at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, the `vminsert` node likely doesn't have enough resources to keep up with the ingestion rate. Add more `vminsert` nodes to the cluster, or add more CPU (see CPU usage) to the `vminsert` node.\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag at `vminsert`, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
+4 -4
View File
@@ -5605,7 +5605,7 @@
"type": "prometheus",
"uid": "$ds"
},
"description": "Shows how many ongoing insertions (not API /write calls) on disk are taking place, where:\n* `max` - equal to number of CPUs;\n* `current` - current number of goroutines busy with inserting rows into underlying storage.\n\nEvery successful API /write call results into flush on disk. The `max` is an internal limit and can't be changed. It is always equal to the number of CPUs. \n\nWhen `current` hits `max` constantly, it means storage is overloaded and requires more CPU (see CPU usage) or disks with more IOPS (see disk writes and reads panels in Resource Usage row).",
"description": "Shows the number of data ingestion requests that are being processed at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, VictoriaMetrics likely doesn't have enough resources to keep up with the ingestion rate. Add more CPU (see CPU usage) or faster disks (see disk read/write panels in the Resource Usage row).\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
@@ -5741,7 +5741,7 @@
"refId": "B"
}
],
"title": "Concurrent flushes on disk ($instance)",
"title": "Concurrent inserts ($instance)",
"type": "timeseries"
},
{
@@ -7137,7 +7137,7 @@
"type": "prometheus",
"uid": "$ds"
},
"description": "Shows how many ongoing insertions (not API /write calls) on disk are taking place, where:\n* `max` - equal to number of CPUs;\n* `current` - current number of goroutines busy with inserting rows into underlying storage.\n\nEvery successful API /write call results into flush on disk. However, these two actions are separated and controlled via different concurrency limiters. The `max` on this panel can't be changed and always equal to number of CPUs. \n\nWhen `current` hits `max` constantly, it means storage is overloaded and requires more CPU.\n\n",
"description": "Shows the number of data ingestion requests that are being processed at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, VictoriaMetrics likely doesn't have enough resources to keep up with the ingestion rate. Add more CPU (see CPU usage) or faster disks (see disk read/write panels in the Resource Usage row).\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
@@ -7267,7 +7267,7 @@
"refId": "B"
}
],
"title": "Concurrent flushes on disk {$instance}",
"title": "Concurrent inserts ($instance)",
"type": "timeseries"
},
{
+13 -13
View File
@@ -2051,7 +2051,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_cpu_waiting_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_cpu_waiting_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -2065,7 +2065,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_cpu_stalled_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_cpu_stalled_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2174,7 +2174,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_memory_waiting_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_memory_waiting_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -2188,7 +2188,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_memory_stalled_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_memory_stalled_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2313,7 +2313,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(process_io_storage_read_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_storage_read_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2328,7 +2328,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "sum(rate(process_io_storage_written_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_storage_written_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2582,7 +2582,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(process_io_read_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_read_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2597,7 +2597,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "sum(rate(process_io_write_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job) > 0",
"expr": "sum(rate(process_io_write_syscalls_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by(job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -2818,7 +2818,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_io_waiting_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_io_waiting_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -2832,7 +2832,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(process_pressure_io_stalled_seconds_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(process_pressure_io_stalled_seconds_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"hide": false,
"interval": "",
@@ -3374,7 +3374,7 @@
"uid": "$ds"
},
"editorMode": "code",
"expr": "max(rate(go_memstats_alloc_bytes_total{job=~\"$job\"}[$__rate_interval])) by (job)",
"expr": "max(rate(go_memstats_alloc_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])) by (job)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
@@ -6440,7 +6440,7 @@
"type": "victoriametrics-metrics-datasource",
"uid": "$ds"
},
"description": "Shows the number of ongoing Cluster Native insert API operations sent to `vmstorage`, where:\n* `max` - the maximum number of calls that can be processed in parallel;\n* `current` - Shows the number of ongoing insert operations being processed by the storage.\n\nEach successful API call results in a flush to disk. The `max` value is controlled by the `-maxConcurrentInserts` flag set on the storage (2 * cgroup.AvailableCPUs() by default). \n\nIf `current` consistently reaches `max`, it indicates that the storage is overloaded and likely requires more CPU (see CPU usage) or disks with higher IOPS (see disk read/write panels in the Resource Usage row)",
"description": "Shows the number of data ingestion requests from `vminsert` nodes that are being processed by `vmstorage` at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, the `vmstorage` node likely doesn't have enough resources to keep up with the ingestion rate. Add more `vmstorage` nodes to the cluster, or add more CPU (see CPU usage) or faster disks (see disk read/write panels in the Resource Usage row) to the `vmstorage` node.\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag at `vmstorage`, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
@@ -9296,7 +9296,7 @@
"type": "victoriametrics-metrics-datasource",
"uid": "$ds"
},
"description": "Shows the max number of ongoing insertions.\n* `max` - equal to number of CPU * 2 by default. May be configured with `maxConcurrentInserts` flag;\n* `current` - current number of goroutines busy with processing requests.\n\n`-maxConcurrentInserts` limits the number of insert requests which may be actively processed at any given point in time. All the other insert requests are queued for up to `-insert.maxQueueDuration` in the hope they will get a chance to be processed. This queue is used mostly for absorbing spikes for incoming insert request rate.\n\nWhen `current` hits `max` constantly, it means vminsert node is overloaded and requires more CPU or higher limits.",
"description": "Shows the number of data ingestion requests that are being processed by `vminsert` at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, the `vminsert` node likely doesn't have enough resources to keep up with the ingestion rate. Add more `vminsert` nodes to the cluster, or add more CPU (see CPU usage) to the `vminsert` node.\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag at `vminsert`, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
+4 -4
View File
@@ -5606,7 +5606,7 @@
"type": "victoriametrics-metrics-datasource",
"uid": "$ds"
},
"description": "Shows how many ongoing insertions (not API /write calls) on disk are taking place, where:\n* `max` - equal to number of CPUs;\n* `current` - current number of goroutines busy with inserting rows into underlying storage.\n\nEvery successful API /write call results into flush on disk. The `max` is an internal limit and can't be changed. It is always equal to the number of CPUs. \n\nWhen `current` hits `max` constantly, it means storage is overloaded and requires more CPU (see CPU usage) or disks with more IOPS (see disk writes and reads panels in Resource Usage row).",
"description": "Shows the number of data ingestion requests that are being processed at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, VictoriaMetrics likely doesn't have enough resources to keep up with the ingestion rate. Add more CPU (see CPU usage) or faster disks (see disk read/write panels in the Resource Usage row).\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
@@ -5742,7 +5742,7 @@
"refId": "B"
}
],
"title": "Concurrent flushes on disk ($instance)",
"title": "Concurrent inserts ($instance)",
"type": "timeseries"
},
{
@@ -7138,7 +7138,7 @@
"type": "victoriametrics-metrics-datasource",
"uid": "$ds"
},
"description": "Shows how many ongoing insertions (not API /write calls) on disk are taking place, where:\n* `max` - equal to number of CPUs;\n* `current` - current number of goroutines busy with inserting rows into underlying storage.\n\nEvery successful API /write call results into flush on disk. However, these two actions are separated and controlled via different concurrency limiters. The `max` on this panel can't be changed and always equal to number of CPUs. \n\nWhen `current` hits `max` constantly, it means storage is overloaded and requires more CPU.\n\n",
"description": "Shows the number of data ingestion requests that are being processed at the same time, where:\n* `max` - the maximum number of requests that can be processed in parallel;\n* `current` - the number of requests currently being processed.\n\nIf `current` frequently reaches `max`, VictoriaMetrics likely doesn't have enough resources to keep up with the ingestion rate. Add more CPU (see CPU usage) or faster disks (see disk read/write panels in the Resource Usage row).\n\nThe limit can be adjusted with the `-maxConcurrentInserts` command-line flag, but this isn't recommended in general, since it may increase memory usage.",
"fieldConfig": {
"defaults": {
"color": {
@@ -7268,7 +7268,7 @@
"refId": "B"
}
],
"title": "Concurrent flushes on disk {$instance}",
"title": "Concurrent inserts ($instance)",
"type": "timeseries"
},
{
+3 -3
View File
@@ -3,11 +3,11 @@
DOCKER_REGISTRIES ?= docker.io quay.io
DOCKER_NAMESPACE ?= victoriametrics
ROOT_IMAGE ?= alpine:3.24.2
ROOT_IMAGE ?= alpine:3.24.3
ROOT_IMAGE_SCRATCH ?= scratch
CERTS_IMAGE := alpine:3.24.2
CERTS_IMAGE := alpine:3.24.3
GO_BUILDER_IMAGE := golang:1.27.2
GO_BUILDER_IMAGE := golang:1.27.3
BUILDER_IMAGE := local/builder:2.0.0-$(shell echo $(GO_BUILDER_IMAGE) | tr :/ __)-1
BASE_IMAGE := local/base:1.1.4-$(shell echo $(ROOT_IMAGE) | tr :/ __)-$(shell echo $(CERTS_IMAGE) | tr :/ __)
+9 -9
View File
@@ -3,7 +3,7 @@ services:
# It scrapes targets defined in --promscrape.config
# And forward them to --remoteWrite.url
vmagent:
image: victoriametrics/vmagent:v1.153.0
image: victoriametrics/vmagent:v1.154.1
depends_on:
- "vmauth"
ports:
@@ -42,14 +42,14 @@ services:
# vmstorage shards. Each shard receives 1/N of all metrics sent to vminserts,
# where N is number of vmstorages (2 in this case).
vmstorage-1:
image: victoriametrics/vmstorage:v1.153.0-cluster
image: victoriametrics/vmstorage:v1.154.1-cluster
volumes:
- strgdata-1:/storage
command:
- "--storageDataPath=/storage"
restart: always
vmstorage-2:
image: victoriametrics/vmstorage:v1.153.0-cluster
image: victoriametrics/vmstorage:v1.154.1-cluster
volumes:
- strgdata-2:/storage
command:
@@ -59,7 +59,7 @@ services:
# vminsert is ingestion frontend. It receives metrics pushed by vmagent,
# pre-process them and distributes across configured vmstorage shards.
vminsert-1:
image: victoriametrics/vminsert:v1.153.0-cluster
image: victoriametrics/vminsert:v1.154.1-cluster
depends_on:
- "vmstorage-1"
- "vmstorage-2"
@@ -68,7 +68,7 @@ services:
- "--storageNode=vmstorage-2:8400"
restart: always
vminsert-2:
image: victoriametrics/vminsert:v1.153.0-cluster
image: victoriametrics/vminsert:v1.154.1-cluster
depends_on:
- "vmstorage-1"
- "vmstorage-2"
@@ -80,7 +80,7 @@ services:
# vmselect is a query fronted. It serves read queries in MetricsQL or PromQL.
# vmselect collects results from configured `--storageNode` shards.
vmselect-1:
image: victoriametrics/vmselect:v1.153.0-cluster
image: victoriametrics/vmselect:v1.154.1-cluster
depends_on:
- "vmstorage-1"
- "vmstorage-2"
@@ -90,7 +90,7 @@ services:
- "--vmalert.proxyURL=http://vmalert:8880"
restart: always
vmselect-2:
image: victoriametrics/vmselect:v1.153.0-cluster
image: victoriametrics/vmselect:v1.154.1-cluster
depends_on:
- "vmstorage-1"
- "vmstorage-2"
@@ -105,7 +105,7 @@ services:
# read requests from Grafana, vmui, vmalert among vmselects.
# It can be used as an authentication proxy.
vmauth:
image: victoriametrics/vmauth:v1.153.0
image: victoriametrics/vmauth:v1.154.1
depends_on:
- "vmselect-1"
- "vmselect-2"
@@ -119,7 +119,7 @@ services:
# vmalert executes alerting and recording rules
vmalert:
image: victoriametrics/vmalert:v1.153.0
image: victoriametrics/vmalert:v1.154.1
depends_on:
- "vmauth"
ports:
+3 -3
View File
@@ -3,7 +3,7 @@ services:
# It scrapes targets defined in --promscrape.config
# And forward them to --remoteWrite.url
vmagent:
image: victoriametrics/vmagent:v1.153.0
image: victoriametrics/vmagent:v1.154.1
depends_on:
- "victoriametrics"
ports:
@@ -18,7 +18,7 @@ services:
# VictoriaMetrics instance, a single process responsible for
# storing metrics and serve read requests.
victoriametrics:
image: victoriametrics/victoria-metrics:v1.153.0
image: victoriametrics/victoria-metrics:v1.154.1
ports:
- 8428:8428
- 8089:8089
@@ -59,7 +59,7 @@ services:
# vmalert executes alerting and recording rules
vmalert:
image: victoriametrics/vmalert:v1.153.0
image: victoriametrics/vmalert:v1.154.1
depends_on:
- "victoriametrics"
- "alertmanager"
+28
View File
@@ -158,3 +158,31 @@ groups:
summary: "Some rows are rejected on \"{{ $labels.instance }}\" on ingestion attempt"
description: "Ingested rows on instance \"{{ $labels.instance }}\" are rejected due to the
following reason: \"{{ $labels.reason }}\""
- alert: TooManySnapshots
expr: vm_snapshots > 2
for: 2h
labels:
severity: warning
annotations:
summary: "Too many snapshots on \"{{ $labels.job }}\"(\"{{ $labels.instance }}\")"
description: |
More than 2 snapshots were present on "{{ $labels.instance }}" during the last 2 hours.
`vmbackup` and `vmbackupmanager` delete the snapshot right after the backup is completed,
so at most a single snapshot is expected to exist at any point in time.
Manually created snapshots will be removed automatically when they become older than `-snapshotsMaxAge` (`3d` by default)
The growing number of snapshots means that something on "{{ $labels.instance }}" isn't working as expected.
Old snapshots keep references to the data parts they were created from. This prevents
background merges from deleting these parts and from freeing the occupied disk space,
so snapshots may end up consuming more and more disk space with time.
Actions:
- Inspect the snapshots list via `/snapshot/list` API. See https://docs.victoriametrics.com/victoriametrics/#how-to-work-with-snapshots.
- Delete unneeded snapshots via `/snapshot/delete?snapshot=<snapshot-name>` API.
- Check error logs of `vmbackup` / `vmbackupmanager` to find out what caused the backup failure.
- Make sure that every backup completes before the next backup starts.
- Make sure that `-snapshotsMaxAge` is set to a non-zero value, which is big enough for the backup to complete.
See https://docs.victoriametrics.com/victoriametrics/#snapshot-troubleshooting
and https://docs.victoriametrics.com/victoriametrics/vmbackup/#troubleshooting for details.
@@ -1,6 +1,6 @@
services:
vmagent:
image: victoriametrics/vmagent:v1.153.0
image: victoriametrics/vmagent:v1.154.1
depends_on:
- "victoriametrics"
ports:
@@ -14,7 +14,7 @@ services:
restart: always
victoriametrics:
image: victoriametrics/victoria-metrics:v1.153.0
image: victoriametrics/victoria-metrics:v1.154.1
ports:
- 8428:8428
volumes:
@@ -40,7 +40,7 @@ services:
restart: always
vmalert:
image: victoriametrics/vmalert:v1.153.0
image: victoriametrics/vmalert:v1.154.1
depends_on:
- "victoriametrics"
ports:
@@ -59,7 +59,7 @@ services:
- '--external.alert.source=explore?orgId=1&left=["now-1h","now","VictoriaMetrics",{"expr": },{"mode":"Metrics"},{"ui":[true,true,true,"none"]}]'
restart: always
vmanomaly:
image: victoriametrics/vmanomaly:v1.30.7
image: victoriametrics/vmanomaly:v1.31.1
depends_on:
- "victoriametrics"
ports:
+19
View File
@@ -20,6 +20,25 @@ Please find the changelog for VictoriaMetrics Anomaly Detection below.
{{% collapse name="2026" open=true %}}
## v1.31.1
Released: 2026-10-15
- BUGFIX: Schedule data reads for [peer-group models](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-group-models) using the [periodic scheduler](https://docs.victoriametrics.com/anomaly-detection/components/scheduler/#periodic-scheduler), preventing the first fit from waiting indefinitely for data.
## v1.31.0
Released: 2026-10-09
- UI: Updated from v1.9.2 to [v1.10.0](https://docs.victoriametrics.com/anomaly-detection/ui/#v1100). Added a [Tune workflow](https://docs.victoriametrics.com/anomaly-detection/ui/#tune-a-model) for supervised tuning with marked anomalies or unsupervised tuning with an expected anomaly rate. Review suggested parameters and apply them directly; this is the preferred UI workflow over the `auto` model option, which is planned for removal from the selector. Also added peer-group investigation with searchable groups, affected-peer activity and theme-aware charts. See the full UI changelog for details.
- FEATURE: Added [peer-group outlier detection](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-outlier). The online `peer_outlier` model learns an asymmetric accepted range for comparable entities, supports changing membership and missing peers, and scores each peer separately. It supports [AutoTuned models and shared tuning](https://docs.victoriametrics.com/anomaly-detection/components/models/#autotuned), including supervised per-peer labels, while keeping query populations isolated. It is also supported in [deployment sizing](https://docs.victoriametrics.com/anomaly-detection/components/server/#deployment-sizing) for fixed, equal-size peer groups; these estimates are experimental, so allow extra headroom and validate with your workload.
- FEATURE: Added [deployment sizing](https://docs.victoriametrics.com/anomaly-detection/components/server/#deployment-sizing) APIs for CPU, peak RAM, disk and output estimates, plus inference-only capacity estimates for a resource budget. Results include assumptions and extrapolation warnings; validate estimates with representative workloads.
- IMPROVEMENT: Increased inference throughput by up to 25% in tested workloads, depending on the models and workload configuration.
- IMPROVEMENT: Updated the [anomaly-score dashboard](https://docs.victoriametrics.com/anomaly-detection/presets/#grafana-dashboard) with sample-weighted statistics, consistent filters and univariate/multivariate forecast-disagreement trends.
- BUGFIX: Prevented duplicate-label inference failures in [`std`](https://docs.victoriametrics.com/anomaly-detection/components/models/#seasonal-trend-decomposition) when buffered history overlaps new observations, including after restoring state. Preserved alignment for repeated, reordered and gapped inference timestamps.
- BUGFIX: Kept [backtesting](https://docs.victoriametrics.com/anomaly-detection/components/scheduler/#backtesting-scheduler) inference intervals contiguous when query sampling is finer than inference cadence, including ranges not aligned with fit cadence.
- BUGFIX: Preserved client certificates when datasource proxies use a custom TLS CA bundle.
- BUGFIX: Preserved non-optimized model settings during [tuning and replay](https://docs.victoriametrics.com/anomaly-detection/components/models/#shared-asynchronous-autotune-workflow), with explicit per-query business policies taking precedence.
- SECURITY: Removed SUID/SGID permission bits from the standard runtime image to reduce attack surface. Removed the unused PyCryptodome dependency from both image variants, eliminating bundled private-key test fixtures that could trigger false-positive scanner alerts.
## v1.30.7
Released: 2026-09-24
+46 -28
View File
@@ -60,6 +60,52 @@ Please see example graph illustrating this logic below:
> Please note that only LogsQL queries with [stats pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe) functions [subset](https://docs.victoriametrics.com/anomaly-detection/components/reader/#valid-stats-functions) are supported, as they produce **numeric** time series.
## Choosing the right model for vmanomaly
Start with what you want to compare: a metric with its own history, related signals with each other, or an entity with its peers. Then choose a model for the data's behavior and the [types of anomalies](https://victoriametrics.com/blog/victoriametrics-anomaly-detection-handbook-chapter-2/#categories-of-anomalies) you want to detect.
### Independent time series
[Univariate models](https://docs.victoriametrics.com/anomaly-detection/components/models/#univariate-models) evaluate each time series independently, using its own history. Choose this type when metrics have different behavior or need separate anomaly decisions.
- Use [Online MAD](https://docs.victoriametrics.com/anomaly-detection/components/models/#online-mad) for simple, mostly stationary data with no-to-slow trend, when robustness to outliers is important.
- Use [Online Z-score](https://docs.victoriametrics.com/anomaly-detection/components/models/#online-z-score) for simple, light-tailed data where standard-deviation units are meaningful.
- Use [Temporal Envelope](https://docs.victoriametrics.com/anomaly-detection/components/models/#temporal-envelope) {{% available_from "v1.30.0" anomaly %}} for complex data with trends, calendar patterns, holidays, or persistent shifts. It is the preferred online migration target for existing Prophet configurations.
### Related signals
[Multivariate models](https://docs.victoriametrics.com/anomaly-detection/components/models/#multivariate-models) learn relationships across a fixed set of related signals and produce a joint anomaly decision per group, for example CPU, memory and request rate for one service.
Use multivariate [Temporal Envelope](https://docs.victoriametrics.com/anomaly-detection/components/models/#temporal-envelope) when normal relationships between aligned metrics matter. It is the recommended replacement for [Isolation Forest](https://docs.victoriametrics.com/anomaly-detection/components/models/#isolation-forest-multivariate), which is planned for deprecation in a future release.
### Comparable peers
[Peer-group models](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-group-models) compare similar entities at the same timestamp and score each peer separately. Use [Peer Outlier](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-outlier) {{% available_from "v1.31.0" anomaly %}} to find unusual members among comparable replicas or hosts. Queries remain isolated, and `groupby` separates populations within each query.
A new peer can use an existing, warmed-up group's learned state without a separate per-peer fit. Missing or departed peers do not reset that state, but each timestamp still needs enough valid peers to score. A new group requires its own fit and warmup. See the [peer-group lifecycle](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-group-models).
Peer Outlier assumes a strict majority of peers behave normally. It is not intended to detect a coordinated shift affecting every peer. Use a temporal model such as [Temporal Envelope](https://docs.victoriametrics.com/anomaly-detection/components/models/#temporal-envelope) alongside it when shared changes matter.
### Tuning the selected model
You can auto-tune supported parameters of a selected model class {{% available_from "v1.12.0" anomaly %}}. The asynchronous autotune API {{% available_from "v1.30.0" anomaly %}} can first profile a bounded sample through `/api/v1/timeseries/characteristics`, then tune a shared concrete configuration through `/api/v1/autotune/tasks`. See the [autotune workflow](https://docs.victoriametrics.com/anomaly-detection/components/models/#shared-asynchronous-autotune-workflow) or use [Tune in the UI](https://docs.victoriametrics.com/anomaly-detection/ui/#tune-a-model) {{% available_from "v1.31.0" anomaly %}}.
Still not sure what to use? We are [here to help](https://docs.victoriametrics.com/anomaly-detection/#get-in-touch).
## Output produced by vmanomaly
`vmanomaly` models generate [metrics](https://docs.victoriametrics.com/anomaly-detection/components/models/#vmanomaly-output) like `anomaly_score`, `yhat`, `yhat_lower`, `yhat_upper`, and `y`. These metrics provide a comprehensive view of the detected anomalies. The service also produces [health check metrics](https://docs.victoriametrics.com/anomaly-detection/components/monitoring/#metrics-generated-by-vmanomaly) for monitoring its performance.
## Visualizations
To visualize and interact with both [self-monitoring metrics](https://docs.victoriametrics.com/anomaly-detection/components/monitoring/) and [produced anomaly scores](#what-is-anomaly-score), `vmanomaly` provides respective Grafana dashboards:
- For guidance on using the `vmanomaly` Grafana dashboard and drilling down into anomaly score visualizations, refer to the [default preset section](https://docs.victoriametrics.com/anomaly-detection/presets/#default).
- To monitor `vmanomaly` health, operational performance, and potential issues in real time, visit the [self-monitoring section](https://docs.victoriametrics.com/anomaly-detection/self-monitoring/).
- {{% available_from "v1.26.0" anomaly %}} For rapid exploration of how different models, their configurations and included domain knowledge impact the results of anomaly detection, use the built-in [vmanomaly UI](https://docs.victoriametrics.com/anomaly-detection/ui/).
![vmanomaly-ui-overview](vmanomaly-ui-overview.webp)
## Using offsets
`vmanomaly` supports {{% available_from "v1.25.3" anomaly %}} the use of offsets in the [`reader`](https://docs.victoriametrics.com/anomaly-detection/components/reader/#vm-reader) section to adjust the time range of the data being queried. This can be particularly useful for correcting for data collection delays or other timing issues. It can be also defined or overridden on [per-query basis](https://docs.victoriametrics.com/anomaly-detection/components/reader/#per-query-parameters).
@@ -106,34 +152,6 @@ models:
seasonalities: ['hod_smooth', 'dow_smooth']
```
## Output produced by vmanomaly
`vmanomaly` models generate [metrics](https://docs.victoriametrics.com/anomaly-detection/components/models/#vmanomaly-output) like `anomaly_score`, `yhat`, `yhat_lower`, `yhat_upper`, and `y`. These metrics provide a comprehensive view of the detected anomalies. The service also produces [health check metrics](https://docs.victoriametrics.com/anomaly-detection/components/monitoring/#metrics-generated-by-vmanomaly) for monitoring its performance.
## Visualizations
To visualize and interact with both [self-monitoring metrics](https://docs.victoriametrics.com/anomaly-detection/components/monitoring/) and [produced anomaly scores](#what-is-anomaly-score), `vmanomaly` provides respective Grafana dashboards:
- For guidance on using the `vmanomaly` Grafana dashboard and drilling down into anomaly score visualizations, refer to the [default preset section](https://docs.victoriametrics.com/anomaly-detection/presets/#default).
- To monitor `vmanomaly` health, operational performance, and potential issues in real time, visit the [self-monitoring section](https://docs.victoriametrics.com/anomaly-detection/self-monitoring/).
- {{% available_from "v1.26.0" anomaly %}} For rapid exploration of how different models, their configurations and included domain knowledge impacts the results of anomaly detection, use the built-in [vmanomaly UI](https://docs.victoriametrics.com/anomaly-detection/ui/).
![vmanomaly-ui-overview](vmanomaly-ui-overview.webp)
## Choosing the right model for vmanomaly
Selecting the best model for `vmanomaly` depends on the data's nature and the [types of anomalies](https://victoriametrics.com/blog/victoriametrics-anomaly-detection-handbook-chapter-2/#categories-of-anomalies) to detect:
- Use [Online MAD](https://docs.victoriametrics.com/anomaly-detection/components/models/#online-mad) for simple, mostly stationary data with no-to-slow trend, when robustness to outliers is important.
- Use [Online Z-score](https://docs.victoriametrics.com/anomaly-detection/components/models/#online-z-score) for simple, light-tailed data where standard-deviation units are meaningful.
- Use [Temporal Envelope](https://docs.victoriametrics.com/anomaly-detection/components/models/#temporal-envelope) {{% available_from "v1.30.0" anomaly %}} for complex data with trends, calendar patterns, holidays, or persistent shifts. It is the preferred online migration target for existing Prophet configurations.
- Use multivariate Temporal Envelope when normal relationships between aligned metrics matter. This should replace [Isolation Forest](https://docs.victoriametrics.com/anomaly-detection/components/models/#isolation-forest-multivariate) used in previous versions of `vmanomaly`, which will be deprecated in future releases.
There is also an option to auto-tune the most important parameters of a selected model class {{% available_from "v1.12.0" anomaly %}}. {{% available_from "v1.30.0" anomaly %}} The asynchronous autotune API can first profile a bounded sample through `/api/v1/timeseries/characteristics`, then tune a shared concrete configuration through `/api/v1/autotune/tasks`. See the [autotune workflow](https://docs.victoriametrics.com/anomaly-detection/components/models/#shared-asynchronous-autotune-workflow).
Please refer to [respective blogpost on anomaly types and alerting heuristics](https://victoriametrics.com/blog/victoriametrics-anomaly-detection-handbook-chapter-2/) for more details.
Still not 100% sure what to use? We are [here to help](https://docs.victoriametrics.com/anomaly-detection/#get-in-touch).
## Incorporating domain knowledge
Anomaly detection models can significantly improve when incorporating business-specific assumptions about the data and what constitutes an anomaly. `vmanomaly` supports [business policies](https://docs.victoriametrics.com/anomaly-detection/components/models/#common-args) across built-in models to **reduce [false positives](https://victoriametrics.com/blog/victoriametrics-anomaly-detection-handbook-chapter-1/#false-positive)** and **align model behavior with business needs**, for example:
+4
View File
@@ -63,6 +63,8 @@ Read each row as **source persisted state → target runtime**. The upgrade and
| Source state | Target runtime | Action and compatibility boundary |
| --- | --- | --- |
| v1.31.0 | v1.31.1 | Existing saved built-in model state remains compatible. No manual state migration or upgrade-only refit is required. |
| v1.30.7 | v1.31.0 | Reuse compatible existing built-in state; no upgrade-only refit is required. New peer models have no state from older releases. |
| v1.30.6 | v1.30.7 | Reuse compatible built-in state. |
| v1.30.5 | v1.30.6–v1.30.7 | Reuse compatible built-in state. |
| v1.30.4 | v1.30.5–v1.30.7 | Reuse compatible built-in state. Its UI and named-query changes require no state-format migration. |
@@ -86,6 +88,8 @@ Read each row as **source persisted state → target runtime**. The upgrade and
| Source state | Target runtime | Action and compatibility boundary |
| --- | --- | --- |
| v1.31.1 | v1.31.0 or earlier | The older shipped runtime does not recognize v1.31.1 provenance. Reinitialize/refit on rollback. |
| v1.31.0 | v1.30.7 or earlier | The older shipped runtime does not recognize v1.31.0 provenance. Reinitialize/refit on rollback, and replace peer-model configurations unsupported by the target version. |
| v1.30.7 | v1.30.6 or earlier | The older shipped runtime does not recognize v1.30.7 provenance. Reinitialize/refit on rollback. |
| v1.30.6 | v1.30.5 or earlier | The older shipped runtime does not recognize v1.30.6 provenance. Plan to reinitialize/refit on rollback even though v1.30.6 introduces no new state format. The standard and experimental [hardened image](https://docs.victoriametrics.com/anomaly-detection/quickstart/#experimental-hardened-image) use the same state format at the same application version. |
| v1.30.5 | v1.30.4 or earlier | The older shipped runtime does not know v1.30.5 provenance. Plan to reinitialize/refit state even where the newer matrix says the underlying formats are compatible. Do not edit the saved version. |
+11 -9
View File
@@ -138,13 +138,13 @@ groups:
{{% available_from "v1.30.6" anomaly %}} An experimental [Docker Hardened Images](https://www.docker.com/products/hardened-images/)-based variant is available on Docker Hub and Quay for `linux/amd64` and `linux/arm64`:
```text
victoriametrics/vmanomaly:v1.30.7-dhi
victoriametrics/vmanomaly:v1.30.7-enterprise-dhi
quay.io/victoriametrics/vmanomaly:v1.30.7-dhi
quay.io/victoriametrics/vmanomaly:v1.30.7-enterprise-dhi
victoriametrics/vmanomaly:v1.31.1-dhi
victoriametrics/vmanomaly:v1.31.1-enterprise-dhi
quay.io/victoriametrics/vmanomaly:v1.31.1-dhi
quay.io/victoriametrics/vmanomaly:v1.31.1-enterprise-dhi
```
These are aliases of the same application image and have the same license requirements. The `-enterprise-dhi` ordering supports Helm's `image.variant: dhi` when enterprise mode is enabled, `image.tag` is empty, and the chart appVersion matches the desired release. With an older chart, set `image.tag: v1.30.7-enterprise-dhi` explicitly. Standard `v1.30.7`, `v1.30.7-enterprise` and `latest` tags retain their existing base image.
These are aliases of the same application image and have the same license requirements. The `-enterprise-dhi` ordering supports Helm's `image.variant: dhi` when enterprise mode is enabled, `image.tag` is empty, and the chart appVersion matches the desired release. With an older chart, set `image.tag: v1.31.1-enterprise-dhi` explicitly. Standard `v1.31.1`, `v1.31.1-enterprise` and `latest` tags retain their existing base image.
> [!WARNING]
> The hardened image runs as a non-root user and contains no runtime shell or package manager. Ensure mounted configuration and license files are readable and state directories are writable by the container user; shell-based entrypoint overrides and `docker exec ... sh` are unavailable.
@@ -158,7 +158,7 @@ Below are the steps to get `vmanomaly` up and running inside a Docker container:
1. Pull Docker image:
```sh
docker pull victoriametrics/vmanomaly:v1.30.7
docker pull victoriametrics/vmanomaly:v1.31.1
```
2. Create the license file with your license key.
@@ -178,7 +178,7 @@ docker run -it \
-v ./license:/license \
-v ./config.yaml:/config.yaml \
-p 8490:8490 \
victoriametrics/vmanomaly:v1.30.7 \
victoriametrics/vmanomaly:v1.31.1 \
/config.yaml \
--licenseFile=/license \
--loggerLevel=INFO \
@@ -195,7 +195,7 @@ docker run -it \
-e VMANOMALY_DATA_DUMPS_DIR=/tmp/vmanomaly/data \
-e VMANOMALY_MODEL_DUMPS_DIR=/tmp/vmanomaly/models \
-p 8490:8490 \
victoriametrics/vmanomaly:v1.30.7 \
victoriametrics/vmanomaly:v1.31.1 \
/config.yaml \
--licenseFile=/license \
--loggerLevel=INFO \
@@ -208,7 +208,7 @@ services:
# ...
vmanomaly:
container_name: vmanomaly
image: victoriametrics/vmanomaly:v1.30.7
image: victoriametrics/vmanomaly:v1.31.1
# ...
restart: always
volumes:
@@ -339,6 +339,8 @@ writer:
### UI
{{% available_from "v1.31.0" anomaly %}} For comparable hosts or replicas, try the [peer-group model](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-outlier): retain entity labels in the query and use `groupby` for the population, such as `service`. The UI provides a dedicated peer investigation panel. You can also [tune a model](https://docs.victoriametrics.com/anomaly-detection/ui/#tune-a-model) using marked anomalies or an expected anomaly rate. For deployment planning, start with the [sizing APIs](https://docs.victoriametrics.com/anomaly-detection/components/server/#deployment-sizing), then validate their estimates under representative load.
{{% available_from "v1.26.0" anomaly %}} `vmanomaly`'s built-in web UI supports prototyping and interactive generation of `vmanomaly` and `vmalert` configuration files. See the [UI documentation](https://docs.victoriametrics.com/anomaly-detection/ui/) for instructions and examples. For optional AI-assisted workflows, use the [UI Copilot](https://docs.victoriametrics.com/anomaly-detection/ui/#ai-assistance), connect the [vmanomaly MCP server](https://docs.victoriametrics.com/ai-tools/#vmanomaly-mcp-server), or follow the published [agent skills](https://docs.victoriametrics.com/ai-tools/#agent-skills).
![vmanomaly-ui-overview](vmanomaly-ui-overview.webp)
+1 -1
View File
@@ -50,7 +50,7 @@ VictoriaMetrics Anomaly Detection **continuously re-fit and apply machine learni
- **Handling complex metrics** – effectively detects anomalies in **trending, seasonal, or dynamically scaling data**, where **fixed thresholds and simpler models usually fail**.
- **Detecting anomalies in interconnected metrics** – supports **[multivariate anomaly detection](http://docs.victoriametrics.com/anomaly-detection/components/models#multivariate-models)**, identifying patterns across **related metrics** instead of treating them in isolation as [univariate metrics](http://docs.victoriametrics.com/anomaly-detection/components/models#univariate-models).
- **Different ways to detect anomalies** – use [univariate models](https://docs.victoriametrics.com/anomaly-detection/components/models/#univariate-models) for each metric independently, [multivariate models](https://docs.victoriametrics.com/anomaly-detection/components/models/#multivariate-models) for relationships across related metrics, or [peer-group models](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-group-models) {{% available_from "v1.31.0" anomaly %}} to find unusual members among comparable replicas or hosts, even as membership changes.
## Practical guides and installation
+53 -4
View File
@@ -362,7 +362,7 @@ docker run -it --rm \
-e VMANOMALY_MCP_SERVER_URL=http://mcp-vmanomaly:8081/mcp \
-p 8080:8080 \
-p 8490:8490 \
victoriametrics/vmanomaly:v1.30.7 \
victoriametrics/vmanomaly:v1.31.1 \
vmanomaly_config.yaml
```
@@ -721,20 +721,69 @@ If the **results** look good and the **model configuration should be deployed in
![vmanomaly-ui-example-alert-menu](vmanomaly-ui-example-alert-menu.webp)
## Peer-group investigation
Selecting the [`peer_outlier` model](https://docs.victoriametrics.com/anomaly-detection/components/models/#peer-outlier) {{% available_from "v1.31.0" anomaly %}} opens a dedicated results panel. It overlays peers and their learned accepted range, highlights qualified anomaly regions, and ranks individual peers with score histories. Select a peer to inspect its observations and range; use **Show all** to return to the population.
![Peer-group investigation with a selected peer, accepted range and anomaly tooltip](vmanomaly-ui-peer-investigation.webp)
The group picker searches all labels, including hidden common labels. Its **Peak affected %** order compares the peak affected proportion in the visible window, then anomalous-peer count, region count and alphabetical labels. Common labels are shown once, and full labels remain available without expanding the layout indefinitely.
The **Affected peers** curve measures the percentage of reporting peers anomalous at each timestamp, not anomaly severity. Horizontal extent represents duration. All loaded groups share an adaptive vertical scale, which stays unchanged during group switches and zoom. Hover shows exact affected/reporting counts and percentages. This distinguishes a widespread event from an extreme value in only one peer, including when population size changes.
Use **Peer anomaly ranking** to filter peers by label or value and compare their anomaly regions and score histories. Color swatches match the plotted series.
![Peer anomaly ranking with label filtering, matching series colors and score histories](vmanomaly-ui-peer-ranking.webp)
In multivariate results, **Channels outside expected range** is a diagnostic view, not the joint detection decision. Use **Joint anomaly score** to identify multivariate anomalies; individual channels may exceed their ranges without the joint score crossing its threshold.
## Tune a model
Open **Tune** {{% available_from "v1.31.0" anomaly %}} in the model card to try experimental shared parameter tuning. Choose **Marked anomalies** for supervised tuning using regions you mark on the query chart, or an expected anomaly rate (including **No anomalies**) for unsupervised tuning. Set the trial/time budget, run tuning, then review the suggested parameters and, for marked anomalies, the detection-quality report before **Apply and detect**.
![Tune model panel with objectives, trial budget, suggested candidate and detection-quality statistics](vmanomaly-ui-tune-model.webp)
For supervised tuning, use **Mark on chart** to select expected anomalous regions. Resize marks to adjust their boundaries and use the scope selector to choose which series they apply to.
![Chart marking mode with selected anomaly regions and the series-scope toolbar](vmanomaly-ui-mark-anomalies.webp)
Quality metrics are point-level results, not counts of visual spikes. Marked regions guide tuning, so this is not an independent test. For multivariate models, a group timestamp is marked when any channel is marked; channels do not count as separate detections. Check the report's evaluated coverage and replay settings when comparing results.
For peer models, scope marks to all or selected peer groups, or individual series. Quality counts are per peer and timestamp, while multivariate quality uses the joint decision. Applying a candidate retains non-optimized model settings and explicit query policies. Changing model type preserves shared domain-knowledge settings.
Prefer **Tune** to obtain a concrete configuration you can review and deploy. The `auto` wrapper appears in its own final selector group and is planned for removal from the UI selector. This does not deprecate backend `auto` configurations, which remain available for retuning during each fit.
## Changelog
<div class="collapse-group mb-3">
{{% collapse name="Release history" %}}
### v1.10.0
Released: 2026-10-09
Recommended vmanomaly version: [v1.31.1](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1311) or newer, which fixes data fetching for peer-group models in periodic deployments.
- FEATURE: Added experimental [model tuning](#tune-a-model) with supervised marked-anomaly and unsupervised expected-anomaly-rate objectives, progress, suggested parameters and point-level detection-quality statistics for marked anomalies.
- FEATURE: Added [peer-group investigation](#peer-group-investigation), searchable group labels, accepted-range overlays, peer rankings and percentage activity with exact hover counts.
- IMPROVEMENT: Made **Tune** the preferred UI tuning workflow. Moved `auto` to its own final model-selector group with a planned UI removal notice; backend `auto` configurations remain supported.
- IMPROVEMENT: Distinguished multivariate channel-range diagnostics from the joint anomaly decision.
- IMPROVEMENT: Prediction clipping defaults to enabled in the UI, while explicit opt-outs are preserved.
- IMPROVEMENT: Expanded theme-aware series colors, matched table swatches to plotted peers and improved accepted-range contrast.
- IMPROVEMENT: Simplified model/query controls, collapsed domain-knowledge defaults, and scrolled successful manual detection to the results header.
- BUGFIX: Preserved shared business settings across model changes and non-optimized settings when applying tuning candidates.
- BUGFIX: Aligned supervised replay with query policies and restored multivariate drag zoom across signal-selection modes.
- BUGFIX: Selected fresh results using each view's active ranking policy while preserving manual selections within the current results.
- BUGFIX: Fixed drag-selection focus changes, drawer-edge pointer actions, theme updates and asynchronous configuration highlighting.
### v1.9.2
Released: 2026-09-24
Recommended vmanomaly version: [v1.30.7](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1307)
- Added [incident investigation links](#investigate-a-firing-alert) for persisted results.
- Added configurable model choices through `server.ui_allowed_models`.
- Changed generated alert rules from `>=` to `>` for anomaly-score thresholds and fixed metric selectors to preserve preset version suffixes.
- FEATURE: Added [incident investigation links](#investigate-a-firing-alert) for persisted results.
- IMPROVEMENT: Added configurable model choices through `server.ui_allowed_models`.
- BUGFIX: Changed generated alert rules from `>=` to `>` for anomaly-score thresholds and fixed metric selectors to preserve preset version suffixes.
### v1.9.1
Released: 2026-09-17
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 850" role="img" aria-labelledby="title description">
<title id="title">Peer-group models lifecycle</title>
<desc id="description">Queries retrieve peers from VictoriaMetrics. Each query and group owns one fitted model. At inference, existing and new peers use the same warmed-up group state and receive individual scores when enough valid peers are present. Missing peers do not reset the group. New groups require their own fit and warmup. Writer stores per-peer output in VictoriaMetrics.</desc>
<defs>
<marker id="arrow" viewBox="0 0 12 12" refX="10" refY="6" markerWidth="12" markerHeight="12" orient="auto-start-reverse" markerUnits="userSpaceOnUse"><path d="M2 2 10 6 2 10" fill="none" stroke="#303038" stroke-width="2"/></marker>
<style>
text { font-family: Arial, Helvetica, sans-serif; fill: #303038; }
.title { font-size: 32px; }
.heading { font-size: 23px; }
.label { font-size: 19px; }
.box { fill: #fff; stroke: #303038; stroke-width: 2; }
.group { fill: #fff; stroke: #303038; stroke-width: 2; stroke-dasharray: 10 8; }
.line { fill: none; stroke: #303038; stroke-width: 2; marker-end: url(#arrow); }
.blue { fill: #1478c9; }
</style>
</defs>
<rect width="1200" height="850" fill="#fff"/>
<text x="30" y="48" class="title">Peer-group Models Lifecycle</text>
<rect x="30" y="90" width="300" height="100" rx="8" class="box"/>
<text x="180" y="129" text-anchor="middle" class="heading">VictoriaMetrics TSDB</text>
<text x="180" y="161" text-anchor="middle" class="label">Queries retain peer identities</text>
<path d="M330 140 H400" class="line"/>
<rect x="400" y="90" width="350" height="100" rx="8" class="box"/>
<text x="575" y="129" text-anchor="middle" class="heading">Reader: aligned snapshots</text>
<text x="575" y="161" text-anchor="middle" class="label">Separate by query + groupby</text>
<path d="M750 140 H820" class="line"/>
<rect x="820" y="90" width="350" height="100" rx="8" class="group"/>
<text x="995" y="129" text-anchor="middle" class="heading">Fit and warm up each group</text>
<text x="995" y="161" text-anchor="middle" class="label">One model per query / group</text>
<path d="M995 190 V240 H600 V282" class="line"/>
<rect x="340" y="282" width="520" height="95" rx="8" class="group"/>
<text x="600" y="320" text-anchor="middle" class="heading">Existing, warmed-up group at inference</text>
<text x="600" y="351" text-anchor="middle" class="label">Reuse learned state, not a fixed member list</text>
<path d="M450 377 V407 H210 V437" class="line"/>
<path d="M600 377 V437" class="line"/>
<path d="M750 377 V407 H990 V437" class="line"/>
<rect x="40" y="437" width="340" height="100" rx="8" class="box"/>
<text x="210" y="476" text-anchor="middle" class="heading">Existing peers</text>
<text x="210" y="507" text-anchor="middle" class="label">Continue scoring</text>
<rect x="430" y="437" width="340" height="100" rx="8" class="box"/>
<text x="600" y="476" text-anchor="middle" class="heading blue">New peer, same group</text>
<text x="600" y="507" text-anchor="middle" class="label blue">No separate per-peer fit</text>
<rect x="820" y="437" width="340" height="100" rx="8" class="box"/>
<text x="990" y="476" text-anchor="middle" class="heading">Missing / departed peers</text>
<text x="990" y="507" text-anchor="middle" class="label">Do not reset the group</text>
<path d="M210 537 V570 H600 V600" class="line"/>
<path d="M600 537 V600" class="line"/>
<path d="M990 537 V570 H600" fill="none" stroke="#303038" stroke-width="2"/>
<rect x="230" y="600" width="740" height="85" rx="8" class="box"/>
<text x="600" y="635" text-anchor="middle" class="heading">Enough valid, aligned peers at this timestamp?</text>
<text x="600" y="665" text-anchor="middle" class="label">If yes: score each reporting peer using the group model</text>
<path d="M600 685 V718" class="line"/>
<text x="600" y="750" text-anchor="middle" class="heading">Writer → VictoriaMetrics: individual per-peer output</text>
<text x="600" y="809" text-anchor="middle" class="label blue">New group identity? It needs its own fit and warmup before scoring.</text>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

+67 -7
View File
@@ -280,7 +280,7 @@ models:
### Group by
> The `groupby` argument works only in combination with [multivariate models](#multivariate-models).
> The `groupby` argument applies to [multivariate models](#multivariate-models) and [peer-group models](#peer-group-models). For peer groups {{% available_from "v1.31.0" anomaly %}}, it defines independent populations within each query; keep peer identity labels out of `groupby`.
The `groupby` argument{{% available_from "v1.13.0" anomaly %}} (`list[string]`) enables logical grouping within [multivariate models](#multivariate-models). When specified, **a separate multivariate model is trained for each unique combination of label values present in the `groupby` columns**.
@@ -520,11 +520,12 @@ models:
## Model types
Models are classified along **two dimensions**, resulting in four possible combinations:
Models are classified along **two dimensions**: input/output topology and update strategy.
By input data handling:
- [Univariate models](#univariate-models) - models fit/used per each individual time series, producing **individual** [output](#vmanomaly-output)
- [Multivariate models](#multivariate-models) - models fit/used on a set of time series simultaneously, producing shared [output](#vmanomaly-output)
- [Peer-group models](#peer-group-models) - models fit/used on a changing population within one query, producing individual [output](#vmanomaly-output) for each member.
By update strategy:
- [Offline models](#offline-models) - models that require **full re-fit** on a defined `fit_window` of data to update their parameters defined by `fit_every` schedule in [scheduler](https://docs.victoriametrics.com/anomaly-detection/components/scheduler/#periodic-scheduler)
@@ -579,6 +580,24 @@ models:
```
### Peer-group Models
For a peer-group model {{% available_from "v1.31.0" anomaly %}}, **one shared model instance per query and group** compares comparable entities at each timestamp and produces a **separate anomaly score for each peer**. Unlike multivariate models, the population is not a fixed set of channels. Unlike univariate models, each member does not need its own fitted model.
Each query defines an independent population; queries are never pooled together. Use `groupby` to divide it by labels such as `service` or `region`. Retain identity labels such as `instance` in the query results, but leave them out of `groupby`. For example, two queries each returning three services create six group models, regardless of how many instances belong to each service.
**Membership and cold starts:**
- A new peer joining an existing, warmed-up group can be scored using the group's learned state without a separate per-peer fit.
- Missing or departed peers do not invalidate the remaining population. Scoring still requires enough valid, aligned peers at that timestamp (`min_peer_count` for [Peer Outlier](#peer-outlier)).
- A new query/group identity needs its own fitted model and warmup; it cannot reuse another group's state. Membership changes within an existing group do not reset that group's warmup.
**Implications:** Use peer groups for comparable replicas, load balancers or hosts with similar roles. They detect unusual members relative to their population, rather than replacing temporal detection for changes shared by the whole population.
**Implementation:** [Peer Outlier](#peer-outlier), an online model. See its configuration, assumptions and parameters below.
![Peer-group model lifecycle: fit per query and group, score each peer, and reuse group state when membership changes](model-lifecycle-peer-group.svg)
### Online Models
> Online models are best used **in combination with [stateful service](https://docs.victoriametrics.com/anomaly-detection/components/settings/#state-restoration) {{% available_from "v1.24.0" anomaly %}} to ensure that the model state is preserved if the service restarts and any aggregated model updates are not lost**. E.g. if the model was already trained on many weeks of data and is being updated on new datapoints every minute, there is no need to re-train it from scratch on the same data after each restart, as it can continue to update restored state on new datapoints. Also it is worth setting [retention policy](https://docs.victoriametrics.com/anomaly-detection/components/settings/#retention) {{% available_from "v1.28.1" anomaly %}} for such models to periodically clean up outdated artifacts, e.g. due to high churn rate of unique labelsets in input data.
@@ -634,6 +653,7 @@ Built-in models support 2 groups of arguments:
**Models**:
- [Peer Outlier](#peer-outlier) - an online model for finding unusual members of comparable peer populations, with independent grouping and changing membership.
- [AutoTuned](#autotuned) - designed to take the cognitive load off the user, allowing any of built-in models below to be re-tuned for best hyperparameters on data seen during each `fit` phase of the algorithm. Tradeoff is between increased computational time and optimized results / simpler maintenance.
- [Temporal Envelope](#temporal-envelope) - the preferred **online model for complex operational data** with trends, changepoints, multiple calendar patterns, holidays, capable of [forecasting](https://docs.victoriametrics.com/anomaly-detection/faq/#forecasting). Its multivariate form also learns cross-series relationships.
- [Online Z-score](#online-z-score) - useful for initial testing and for simpler data ([de-trended](https://victoriametrics.com/blog/victoriametrics-anomaly-detection-handbook-chapter-1/#trend) data without strict [seasonality](https://victoriametrics.com/blog/victoriametrics-anomaly-detection-handbook-chapter-1/#seasonality) and with anomalies of similar magnitude as your "normal" data)
@@ -647,10 +667,50 @@ Built-in models support 2 groups of arguments:
- [Custom model](#custom-model-guide) - benefit from your own models and expertise to better support your **unique use case**.
### AutoTuned
Selecting model [hyperparameters](https://en.wikipedia.org/wiki/Hyperparameter_(machine_learning)) can require detailed knowledge of both the model and the data. The `AutoTunedModel` wrapper searches supported parameters during each fit. At minimum, configure `tuned_model_class` and the expected upper bound for anomalous observations through `optimization_params.anomaly_percentage`.
### Peer Outlier
> Using autotune on `tuned_model_class` if run on a [query](#queries) that returns more than 1 timeseries, will result in **one model per each unique labelset** with **probably different [hyperparameters](https://en.wikipedia.org/wiki/Hyperparameter_(machine_learning))** found for each of them. This is useful for further context separation in contrast to using `tuned_model_class` directly, which will result in the same amount of models as there are timeseries returned by the query, but with **the same hyperparameters** for each of them. E.g.
**Experimental.** `peer_outlier` {{% available_from "v1.31.0" anomaly %}} (`model.online.PeerOutlierModel`) is an online implementation of [peer-group detection](#peer-group-models). Use it to detect unusual resource utilization or other measurements among comparable replicas or hosts. A snapshot needs at least `min_peer_count` aligned peers to train or score.
```yaml
models:
cpu_peers:
class: peer_outlier
queries: [cpu_utilization]
groupby: [service]
min_peer_count: 5
epsilon_quantile: 0.75
tolerance: 4.0
decay: 1.0
clip_predictions: true
reader:
queries:
cpu_utilization:
expr: '100 * (1 - avg by (service, instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])))'
data_range: [0, 100]
# other components like writer, schedulers, monitoring ...
```
The model learns historical cross-sectional spread and residual distributions. Its accepted peer range can be asymmetric; it is not a statistical confidence interval. It relies on a strict-majority normal population, so it is not intended to detect a coordinated change affecting every peer. Use a [temporal model](#temporal-envelope) alongside it when shared shifts matter.
| Parameter | Default | Meaning |
| --- | --- | --- |
| `groupby` | omitted | Labels defining independent populations within each query. |
| `min_peer_count` | `5` | Minimum aligned peers; must be at least `3`. |
| `epsilon_quantile` | `0.75` | Historical spread quantile, strictly between `0` and `1`. Higher values tolerate wider populations. |
| `tolerance` | `4.0` | Positive multiplier for the learned neighborhood and accepted range; not a number of standard deviations. |
| `decay` | `1.0` | Weight decay per valid snapshot, in `(0, 1]`. Values below `1` prioritize recent populations. |
| `min_n_samples_seen` | derived | Minimum effective valid snapshots before scoring. When omitted, the upper tail must have at least eight observations: `ceil(8 / (1 - epsilon_quantile))`, or `32` with defaults. Scores remain zero during warmup. |
The effective warmup must be reachable with the selected decay. Shared [domain-knowledge parameters](#common-args), including query-level policies, still apply. Set `data_range` and `clip_predictions: true` to keep predictions within known physical bounds; absence of negative training observations alone does not impose a zero lower bound. Configure model parameters at the top level; nonempty `args` is rejected.
Use the [peer-group investigation view](https://docs.victoriametrics.com/anomaly-detection/ui/#peer-group-investigation) to inspect the accepted range, rank anomalous peers and compare group activity.
### AutoTuned
Selecting model [hyperparameters](https://en.wikipedia.org/wiki/Hyperparameter_(machine_learning)) can require detailed knowledge of both the model and the data. The `AutoTunedModel` wrapper searches supported parameters during each fit. At minimum, configure `tuned_class_name` and the expected upper bound for anomalous observations through `optimization_params.anomaly_percentage`.
The wrapper follows the selected model's grouping: one model per series for univariate detection, one per aligned group for multivariate detection, and one per query-isolated population for peer-group detection. {{% available_from "v1.31.0" anomaly %}} To tune `peer_outlier`, set `tuned_class_name: peer_outlier` and put any grouping labels in `optimization_params.frozen_params.groupby`. Validation keeps population snapshots intact. Keep `optimized_business_params: []` and define stable business policies on the queries. Use [shared tuning](#shared-asynchronous-autotune-workflow) to obtain a concrete configuration without retuning on every fit; capacity estimates for that configuration exclude the tuning search.
> For a univariate `tuned_class_name`, a [query](#queries) returning multiple series produces one independently tuned model per unique labelset. Using the concrete class directly instead gives those models the same configured hyperparameters. For example:
> ```yaml
> models:
> # this may result in 1 model per each unique labelset with different hyperparameters, such as z_threshold
@@ -1677,7 +1737,7 @@ See the [component configuration reference](https://docs.victoriametrics.com/ano
Pull the `vmanomaly` image:
```sh
docker pull victoriametrics/vmanomaly:v1.30.7
docker pull victoriametrics/vmanomaly:v1.31.1
```
Mount the module at `/vmanomaly/src/model/custom.py`, which matches the configured import path `model.custom.CustomModel`. Validate the complete configuration with `--dryRun` before starting the long-running service.
@@ -1687,7 +1747,7 @@ docker run --rm \
-v "$PWD/license:/license:ro" \
-v "$PWD/custom_model.py:/vmanomaly/src/model/custom.py:ro" \
-v "$PWD/config.yaml:/config.yaml:ro" \
victoriametrics/vmanomaly:v1.30.7 \
victoriametrics/vmanomaly:v1.31.1 \
/config.yaml \
--licenseFile=/license \
--dryRun
@@ -73,6 +73,19 @@ Open `/docs` on your running vmanomaly server to inspect generated request and r
The reference describes the API exposed in that runtime’s OpenAPI schema; separately mounted applications may expose their own routes. **Try it out** sends real requests and can start or cancel tasks. Restrict access to these documentation routes together with the API through your deployment’s authentication proxy or network controls. Hiding the documentation alone does not secure the API.
### Deployment sizing
Estimate deployment resources {{% available_from "v1.31.0" anomaly %}} before running a representative load test:
- `POST /api/v1/deployment-sizing/estimate` estimates CPU, peak RAM, disk, output volume and writer-network requirements for a specified workload.
- `POST /api/v1/deployment-sizing/throughput` estimates inference-only workload capacity for a resource budget, with an optional RAM limit.
Use the [interactive API reference](#interactive-api-reference) for request schemas. For a forward estimate, provide the model, series or group count, data frequency, inference cadence and storage mode. Fit history (also called training history) is the amount of past data used to train a model, expressed by `fit.window_seconds`. The separate optional `fit.fit_every_seconds` sets how often to repeat training. Online models default to one initial fit when this interval is omitted. Initial fit duration is advisory for online models, but peak memory and disk requirements still matter.
Estimates combine shipped calibration profiles with bounded live calibration when supported. Results describe assumptions, margins, feasibility and extrapolation. They are not performance guarantees: validate with your data, hardware, datasource and writer. Treat reverse-sizing alternatives as separate scenarios, not additive capacity. Protect these endpoints with the same access controls as other server APIs.
For experimental `peer_outlier` sizing, use `topology: wide`: `entity_count` counts pools and `channels_per_entity` counts peers per pool. Supported estimates cover equal-size fixed pools of 3–10,000 peers, meeting `min_peer_count` (default 5), with complete observations and unchanged membership. Omit the workload's `retention` field: peer sizing does not estimate resources retained for inactive groups after membership changes. This is a sizing limitation, not a restriction on the model's support for changing populations. Use one query per workload and separate workloads for different queries or pool widths; omit `model_params.groupby` because the declared pools are already grouped. Preserve the requested width, including populations above 64 peers. Reverse sizing returns pool-model capacity and input-series counts separately. Peer estimates are less calibrated than regular profiles: allow extra headroom and validate with your workload. Size a concrete tuned model, not the `auto` search itself; tuning costs are not included.
### Time-series analysis and autotune API
{{% available_from "v1.30.0" anomaly %}} The server exposes bounded endpoints for UI, MCP, and automation workflows:
@@ -88,5 +101,7 @@ The reference describes the API exposed in that runtime’s OpenAPI schema; sepa
For multivariate tuning, request the multivariate class directly and supply grouping labels in `frozen_params.groupby`. The server aligns channels before evaluating each candidate across groups in one study; the result is one shared `modelConfig`, not a different hyperparameter configuration per group. Per-query policies remain attached to their channels. An assembled group missing a requested alias fails rather than silently tuning a partial input set. Inspect `inputQueryCount` and `tunedInputCount` in result data for input-query and assembled-input counts.
{{% available_from "v1.31.0" anomaly %}} Shared tuning also supports `peer_outlier`. Supply population grouping through `frozen_params.groupby`, retaining peer identity labels in the query results. Queries form independent populations; each validation split keeps all peers at a timestamp together. Supervised labels are evaluated per peer, not as a joint group decision. Non-optimized model settings are preserved, and explicit per-query policies remain authoritative through evaluation and application.
> [!TIP]
> For a complete request and recommended workflow, see [Shared asynchronous autotune workflow](https://docs.victoriametrics.com/anomaly-detection/components/models/#shared-asynchronous-autotune-workflow). See the [interactive API reference](#interactive-api-reference) for schemas from your running version.
@@ -10,9 +10,9 @@ sitemap:
- To use *vmanomaly*, part of the enterprise package, a license key is required. Obtain your key [here](https://victoriametrics.com/products/enterprise/trial/) for this tutorial or for enterprise use.
- In the tutorial, we'll be using the following VictoriaMetrics components:
- [VictoriaMetrics Single-Node](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/) (v1.153.0)
- [vmalert](https://docs.victoriametrics.com/victoriametrics/vmalert/) (v1.153.0)
- [vmagent](https://docs.victoriametrics.com/victoriametrics/vmagent/) (v1.153.0)
- [VictoriaMetrics Single-Node](https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/) (v1.154.1)
- [vmalert](https://docs.victoriametrics.com/victoriametrics/vmalert/) (v1.154.1)
- [vmagent](https://docs.victoriametrics.com/victoriametrics/vmagent/) (v1.154.1)
- [Grafana](https://grafana.com/) (v12.2.0)
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/)
- [Node exporter](https://github.com/prometheus/node_exporter#node-exporter) (v1.9.1) and [Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) (v0.28.1)
@@ -328,7 +328,7 @@ Let's wrap it all up together into the `docker-compose.yml` file.
services:
vmagent:
container_name: vmagent
image: victoriametrics/vmagent:v1.153.0
image: victoriametrics/vmagent:v1.154.1
depends_on:
- "victoriametrics"
ports:
@@ -345,7 +345,7 @@ services:
victoriametrics:
container_name: victoriametrics
image: victoriametrics/victoria-metrics:v1.153.0
image: victoriametrics/victoria-metrics:v1.154.1
ports:
- 8428:8428
volumes:
@@ -378,7 +378,7 @@ services:
vmalert:
container_name: vmalert
image: victoriametrics/vmalert:v1.153.0
image: victoriametrics/vmalert:v1.154.1
depends_on:
- "victoriametrics"
ports:
@@ -400,7 +400,7 @@ services:
restart: always
vmanomaly:
container_name: vmanomaly
image: victoriametrics/vmanomaly:v1.30.7
image: victoriametrics/vmanomaly:v1.31.1
depends_on:
- "victoriametrics"
ports:
Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@@ -248,23 +248,23 @@ vmagent will write data into VictoriaMetrics single-node and cluster (with tenan
# compose.yaml
services:
vmsingle:
image: victoriametrics/victoria-metrics:v1.153.0
image: victoriametrics/victoria-metrics:v1.154.1
vmstorage:
image: victoriametrics/vmstorage:v1.153.0-cluster
image: victoriametrics/vmstorage:v1.154.1-cluster
vminsert:
image: victoriametrics/vminsert:v1.153.0-cluster
image: victoriametrics/vminsert:v1.154.1-cluster
command:
- -storageNode=vmstorage:8400
vmselect:
image: victoriametrics/vmselect:v1.153.0-cluster
image: victoriametrics/vmselect:v1.154.1-cluster
command:
- -storageNode=vmstorage:8401
vmagent:
image: victoriametrics/vmagent:v1.153.0
image: victoriametrics/vmagent:v1.154.1
volumes:
- ./scrape.yaml:/etc/vmagent/config.yaml
command:
@@ -316,7 +316,7 @@ Now add the vmauth service to `compose.yaml`:
# compose.yaml
services:
vmauth:
image: docker.io/victoriametrics/vmauth:v1.153.0
image: docker.io/victoriametrics/vmauth:v1.154.1
ports:
- 8427:8427
volumes:
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff. Show more