@perses-dev/prometheus-plugin 0.54.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/__mf/css/async/1339.d3010b86.css +1 -0
  2. package/__mf/css/async/1576.d3010b86.css +1 -0
  3. package/__mf/css/async/4576.d3010b86.css +1 -0
  4. package/__mf/js/{Prometheus.7a79b403.js → Prometheus.4d0d5812.js} +3 -3
  5. package/__mf/js/async/1339.194207db.js +1 -0
  6. package/__mf/js/async/212.5fcca998.js +1 -0
  7. package/__mf/js/async/3749.3ecd9372.js +1 -0
  8. package/__mf/js/async/{4075.88e3f633.js → 4075.dab1b7b8.js} +1 -1
  9. package/__mf/js/async/{4238.422a1b1c.js → 4238.c48b1950.js} +1 -1
  10. package/__mf/js/async/4421.1fcb466e.js +1 -0
  11. package/__mf/js/async/4557.f3eb9456.js +2 -0
  12. package/__mf/js/async/4576.f42daf99.js +1 -0
  13. package/__mf/js/async/4676.b7a22f90.js +22 -0
  14. package/__mf/js/async/58.1c9a8daa.js +2 -0
  15. package/__mf/js/async/6341.20eccf91.js +7 -0
  16. package/__mf/js/async/684.4495f632.js +1 -0
  17. package/__mf/js/async/8164.bb3d3363.js +1 -0
  18. package/__mf/js/async/8706.89677575.js +1 -0
  19. package/__mf/js/async/{2675.27451820.js → 9010.bdb2ef97.js} +1 -1
  20. package/__mf/js/async/__federation_expose_PrometheusDatasource.45ee94e2.js +1 -0
  21. package/__mf/js/async/__federation_expose_PrometheusExplorer.b8e555e1.js +1 -0
  22. package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.00dfb1dd.js +1 -0
  23. package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.956ef2d0.js +1 -0
  24. package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.59f2d170.js +1 -0
  25. package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.d7143352.js +1 -0
  26. package/__mf/js/{main.d2018d3d.js → main.afc2ee60.js} +3 -3
  27. package/lib/cjs/explore/PrometheusExplorer.js +7 -2
  28. package/lib/cjs/model/prometheus-client.js +4 -2
  29. package/lib/cjs/plugins/PrometheusLabelNamesVariable.js +8 -2
  30. package/lib/cjs/plugins/PrometheusLabelValuesVariable.js +10 -2
  31. package/lib/cjs/plugins/PrometheusPromQLVariable.js +10 -2
  32. package/lib/cjs/plugins/prometheus-datasource.js +21 -14
  33. package/lib/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +7 -43
  34. package/lib/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +3 -3
  35. package/lib/cjs/plugins/prometheus-variables.js +20 -73
  36. package/lib/explore/PrometheusExplorer.d.ts.map +1 -1
  37. package/lib/explore/PrometheusExplorer.js +7 -2
  38. package/lib/explore/PrometheusExplorer.js.map +1 -1
  39. package/lib/model/prometheus-client.d.ts +8 -7
  40. package/lib/model/prometheus-client.d.ts.map +1 -1
  41. package/lib/model/prometheus-client.js +4 -2
  42. package/lib/model/prometheus-client.js.map +1 -1
  43. package/lib/model/prometheus-selectors.d.ts +2 -2
  44. package/lib/model/prometheus-selectors.d.ts.map +1 -1
  45. package/lib/model/prometheus-selectors.js.map +1 -1
  46. package/lib/plugins/PrometheusLabelNamesVariable.d.ts.map +1 -1
  47. package/lib/plugins/PrometheusLabelNamesVariable.js +10 -4
  48. package/lib/plugins/PrometheusLabelNamesVariable.js.map +1 -1
  49. package/lib/plugins/PrometheusLabelValuesVariable.d.ts.map +1 -1
  50. package/lib/plugins/PrometheusLabelValuesVariable.js +12 -4
  51. package/lib/plugins/PrometheusLabelValuesVariable.js.map +1 -1
  52. package/lib/plugins/PrometheusPromQLVariable.d.ts.map +1 -1
  53. package/lib/plugins/PrometheusPromQLVariable.js +12 -4
  54. package/lib/plugins/PrometheusPromQLVariable.js.map +1 -1
  55. package/lib/plugins/prometheus-datasource.d.ts.map +1 -1
  56. package/lib/plugins/prometheus-datasource.js +21 -14
  57. package/lib/plugins/prometheus-datasource.js.map +1 -1
  58. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
  59. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +7 -43
  60. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
  61. package/lib/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -1
  62. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js +3 -3
  63. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
  64. package/lib/plugins/prometheus-variables.d.ts.map +1 -1
  65. package/lib/plugins/prometheus-variables.js +22 -81
  66. package/lib/plugins/prometheus-variables.js.map +1 -1
  67. package/lib/plugins/types.d.ts +2 -1
  68. package/lib/plugins/types.d.ts.map +1 -1
  69. package/lib/plugins/types.js.map +1 -1
  70. package/mf-manifest.json +103 -97
  71. package/mf-stats.json +106 -100
  72. package/package.json +6 -6
  73. package/__mf/css/async/1576.dacad691.css +0 -1
  74. package/__mf/css/async/2188.dacad691.css +0 -1
  75. package/__mf/css/async/2341.dacad691.css +0 -1
  76. package/__mf/js/async/212.69f85c2b.js +0 -1
  77. package/__mf/js/async/2188.d2c5eadd.js +0 -1
  78. package/__mf/js/async/2275.95fa6219.js +0 -7
  79. package/__mf/js/async/3391.eced295d.js +0 -73
  80. package/__mf/js/async/4323.fdf7d039.js +0 -1
  81. package/__mf/js/async/4368.38ebfc12.js +0 -2
  82. package/__mf/js/async/4421.b5492f46.js +0 -1
  83. package/__mf/js/async/6714.fd02e782.js +0 -2
  84. package/__mf/js/async/684.f7b5c16e.js +0 -1
  85. package/__mf/js/async/7239.2619666a.js +0 -1
  86. package/__mf/js/async/8706.70f829fc.js +0 -1
  87. package/__mf/js/async/__federation_expose_PrometheusDatasource.8b4b16ca.js +0 -1
  88. package/__mf/js/async/__federation_expose_PrometheusExplorer.8faab52f.js +0 -1
  89. package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.baed70be.js +0 -1
  90. package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.86fed903.js +0 -1
  91. package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.8eb55b7f.js +0 -1
  92. package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.66df70ad.js +0 -1
  93. /package/__mf/js/async/{4368.38ebfc12.js.LICENSE.txt → 4557.f3eb9456.js.LICENSE.txt} +0 -0
  94. /package/__mf/js/async/{3391.eced295d.js.LICENSE.txt → 4676.b7a22f90.js.LICENSE.txt} +0 -0
  95. /package/__mf/js/async/{6714.fd02e782.js.LICENSE.txt → 58.1c9a8daa.js.LICENSE.txt} +0 -0
  96. /package/__mf/js/async/{2275.95fa6219.js.LICENSE.txt → 6341.20eccf91.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["684"],{35015:function(t,s,e){async function o(...t){let s=await globalThis.fetch(...t);if(!1===s.ok){let t=s.headers.get("content-type");if(t?.includes("application/json")){let t=await s.clone().json();if(t.error)throw new n(t.error,s.status);if(t.message)throw new n(t.message,s.status)}let e=await s.clone().text();if(e)throw new n(e,s.status);throw new a(s)}return s}async function r(...t){let s=await o(...t);if(!s.ok)throw new a(s);return await s.json()}e.d(s,{he:()=>o,kp:()=>a,rd:()=>r,yh:()=>n});class a extends Error{status;constructor(t){super(`${t.status} ${t.statusText}`),this.status=t.status,Object.setPrototypeOf(this,a.prototype)}}class n extends Error{status;constructor(t,s){super(t),this.status=s,Object.setPrototypeOf(this,n.prototype)}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["8164"],{35015:function(e,t,i){async function a(...e){let t=await globalThis.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.clone().json();if(e.error)throw new s(e.error,t.status);if(e.message)throw new s(e.message,t.status)}let i=await t.clone().text();if(i)throw new s(i,t.status);throw new n(t)}return t}async function r(...e){let t=await a(...e);if(!t.ok)throw new n(t);return await t.json()}i.d(t,{he:()=>a,kp:()=>n,rd:()=>r,yh:()=>s});class n extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,n.prototype)}}class s extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,s.prototype)}}},91542:function(e,t,i){i.d(t,{q9:()=>en});var a,r,n,s,o,l,c,h,u=i(7749),d=i(94197);let p={inf:158,nan:159,bool:1,ignoring:2,on:3,group_left:4,group_right:5,offset:6},O=(e,t)=>p[e.toLowerCase()]||-1,f={avg:8,atan2:7,bottomk:9,count:10,count_values:11,group:12,max:13,min:14,quantile:15,limitk:16,limit_ratio:17,stddev:18,stdvar:19,sum:20,topk:21,by:22,without:23,and:24,or:25,unless:26,start:27,end:28},m=(e,t)=>f[e.toLowerCase()]||-1,v=(0,d.Gv)({LineComment:d.pJ.comment,LabelName:d.pJ.labelName,StringLiteral:d.pJ.string,NumberDurationLiteral:d.pJ.number,NumberDurationLiteralInDurationContext:d.pJ.number,Identifier:d.pJ.variableName,"Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramAvg HistogramCount HistogramFraction HistogramQuantile HistogramSum DoubleExponentialSmoothing Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc SortByLabel SortByLabelDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year":d.pJ.function(d.pJ.variableName),"Avg Bottomk Count Count_values Group LimitK LimitRatio Max Min Quantile Stddev Stdvar Sum Topk":d.pJ.operatorKeyword,"By Without Bool On Ignoring GroupLeft GroupRight Offset Start End":d.pJ.modifier,"And Unless Or":d.pJ.logicOperator,"Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At":d.pJ.operator,UnaryOp:d.pJ.arithmeticOperator,"( )":d.pJ.paren,"[ ]":d.pJ.squareBracket,"{ }":d.pJ.brace,"⚠":d.pJ.invalid}),g={__proto__:null,absent_over_time:335,absent:337,abs:339,acos:341,acosh:343,asin:345,asinh:347,atan:349,atanh:351,avg_over_time:353,ceil:355,changes:357,clamp:359,clamp_max:361,clamp_min:363,cos:365,cosh:367,count_over_time:369,days_in_month:371,day_of_month:373,day_of_week:375,day_of_year:377,deg:379,delta:381,deriv:383,exp:385,floor:387,histogram_count:389,histogram_fraction:391,histogram_quantile:393,histogram_stddev:395,histogram_stdvar:397,histogram_sum:399,histogram_avg:401,double_exponential_smoothing:403,hour:405,idelta:407,increase:409,info:411,irate:413,label_replace:415,label_join:417,last_over_time:419,ln:421,log10:423,log2:425,mad_over_time:427,max_over_time:429,min_over_time:431,minute:433,month:435,pi:437,predict_linear:439,present_over_time:441,quantile_over_time:443,rad:445,rate:447,resets:449,round:451,scalar:453,sgn:455,sin:457,sinh:459,sort:461,sort_desc:463,sort_by_label:465,sort_by_label_desc:467,sqrt:469,stddev_over_time:471,stdvar_over_time:473,sum_over_time:475,tan:477,tanh:479,timestamp:481,time:483,vector:485,year:487},$=u.WQ.deserialize({version:14,states:"9bOYQPOOO'tQPOOOOQO'#C|'#C|O'yQPO'#C{Q(UQQOOOOQO'#De'#DeO(PQPO'#DdOOQO'#FY'#FYO)cQPO'#F_OYQPO'#F[OYQPO'#F^O0WQSO'#FaO0cQQO'#F`OOQO'#F`'#F`OOQO'#Ft'#FtOOQO'#Df'#DfOOQO'#Dh'#DhOOQO'#Di'#DiOOQO'#Dj'#DjOOQO'#Dk'#DkOOQO'#Dl'#DlOOQO'#Dm'#DmOOQO'#Dn'#DnOOQO'#Do'#DoOOQO'#Dp'#DpOOQO'#Dq'#DqOOQO'#Dr'#DrOOQO'#Ds'#DsOOQO'#Dt'#DtOOQO'#Du'#DuOOQO'#Dv'#DvOOQO'#Dw'#DwOOQO'#Dx'#DxOOQO'#Dy'#DyOOQO'#Dz'#DzOOQO'#D{'#D{OOQO'#D|'#D|OOQO'#D}'#D}OOQO'#EO'#EOOOQO'#EP'#EPOOQO'#EQ'#EQOOQO'#ER'#EROOQO'#ES'#ESOOQO'#ET'#ETOOQO'#EU'#EUOOQO'#EV'#EVOOQO'#EW'#EWOOQO'#EX'#EXOOQO'#EY'#EYOOQO'#EZ'#EZOOQO'#E['#E[OOQO'#E]'#E]OOQO'#E^'#E^OOQO'#E_'#E_OOQO'#E`'#E`OOQO'#Ea'#EaOOQO'#Eb'#EbOOQO'#Ec'#EcOOQO'#Ed'#EdOOQO'#Ee'#EeOOQO'#Ef'#EfOOQO'#Eg'#EgOOQO'#Eh'#EhOOQO'#Ei'#EiOOQO'#Ej'#EjOOQO'#Ek'#EkOOQO'#El'#ElOOQO'#Em'#EmOOQO'#En'#EnOOQO'#Eo'#EoOOQO'#Ep'#EpOOQO'#Eq'#EqOOQO'#Er'#ErOOQO'#Es'#EsOOQO'#Et'#EtOOQO'#Eu'#EuOOQO'#Ev'#EvOOQO'#Ew'#EwOOQO'#Ex'#ExOOQO'#Ey'#EyOOQO'#Ez'#EzOOQO'#E{'#E{OOQO'#E|'#E|OOQO'#E}'#E}OOQO'#FO'#FOOOQO'#FP'#FPOOQO'#FQ'#FQOOQO'#FR'#FROOQO'#FS'#FSOOQO'#FT'#FTOOQO'#FU'#FUOOQO'#FV'#FVQOQPOOO1|QPO'#C}O2RQPO'#DSO(PQPO,59gO2YQQO,59gO3vQPO,59oO3vQPO,59oO3vQPO,59oO3vQPO,59oO3vQPO,59oO:kQPO,5;rO:kQPO,5;uO:|QPO,5<SOOQO,5:O,5:OOOQO,5;t,5;tO;eQQO,5;vO;lQQO,5;xOOQO'#DQ'#DQO=SQPO'#FbO=bQPO,5;{OOQO,5;{,5;{O=nQPO,5;{OOQO,5;z,5;zO=vQSO'#DOOOQO,59i,59iOOQO,59n,59nO>RQQO,59nOOQO1G/R1G/ROOQO'#DV'#DVO1|QPO'#DWOOQO'#Fx'#FxO>]QPO'#FxOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOOQO'#FX'#FXOD}QPO'#FXOEYQSO1G1^OOQO1G1a1G1aOEbQPO'#FYOOQO'#Fj'#FjOOQO1G1n1G1nOEmQPO1G1nOOQO1G1b1G1bOOQO'#Fc'#FcOErQPO,5;|OEwQPO,5<ROE|QSO1G1gOFXQPO1G1gOOQO1G1g1G1gOOQO,59j,59jOFaQPO,59jOYQPO'#FmOFiQPO1G/YOOQO1G/Y1G/YOFqQPO,59rOOQO,5<d,5<dONmQQO7+$uON}QQO7+$uO!!cQQO7+$uO!!yQQO7+$uO!$bQQO7+$uOOQO,5;s,5;sOOQO7+&x7+&xO!${QPO7+&}O!%SQPO7+'YOOQO1G1h1G1hOOQO1G1m1G1mO!%XQPO,5<YOOQO,5<Y,5<YOOQO7+'R7+'RO!%mQSO7+'ROOQO-E9l-E9lO!%xQSO1G/UO!&TQPO1G/UOOQO1G/U1G/UO!&]QQO,5<XOOQO-E9k-E9kOOQO7+$t7+$tO!&gQPO1G/^OOQO<<Ji<<JiO!-RQPO<<JiOOQO<<Jt<<JtOOQO<<Jm<<JmP!-WQSO'#FnOOQO,5<W,5<WOOQO7+$p7+$pO!-`QSO7+$pOOQO-E9j-E9jOOQO7+$x7+$xOOQOAN@TAN@TOOQO<<H[<<H[P!-kQSO'#Fl",stateData:"!-s~O$gOSmOS~OWQOXQOYQOZQO[QO]QO^QO_QO`QOaQObQOcQOdQOeQOu^O!Z[O$dVO$eVO$iXO$m_O$n`O$oaO$pbO$qcO$rdO$seO$tfO$ugO$vhO$wiO$xjO$ykO$zlO${mO$|nO$}oO%OpO%PqO%QrO%RsO%StO%TuO%UvO%VwO%WxO%XyO%YzO%Z{O%[|O%]}O%^!OO%_!PO%`!QO%a!RO%b!SO%c!TO%d!UO%e!VO%f!WO%g!XO%h!YO%i!ZO%j![O%k!]O%l!^O%m!_O%n!`O%o!aO%p!bO%q!cO%r!dO%s!eO%t!fO%u!gO%v!hO%w!iO%x!jO%y!kO%z!lO%{!mO%|!nO%}!oO&O!pO&P!qO&Q!rO&R!sO&S!tO&T!uO&U!vO&V!wO&W!xO&X!yO&Y!zO&Z!{O&[!|O&]!}O&_WO&`WO&aVO&dZO~O!Z#OO~Of#POg#PO$i#QO~OU#ZOV#TOh#WOi#XOj#WOx#TO{#TO|#TO}#TO!O#UO!P#UO!Q#VO!R#VO!S#VO!T#VO!U#VO!V#VO$]#[O&^#YO~O$d#^O$e#^O&a#^OW$RXX$RXY$RXZ$RX[$RX]$RX^$RX_$RX`$RXa$RXb$RXc$RXd$RXe$RXu$RX!Z$RX$d$RX$e$RX$i$RX$m$RX$n$RX$o$RX$p$RX$q$RX$r$RX$s$RX$t$RX$u$RX$v$RX$w$RX$x$RX$y$RX$z$RX${$RX$|$RX$}$RX%O$RX%P$RX%Q$RX%R$RX%S$RX%T$RX%U$RX%V$RX%W$RX%X$RX%Y$RX%Z$RX%[$RX%]$RX%^$RX%_$RX%`$RX%a$RX%b$RX%c$RX%d$RX%e$RX%f$RX%g$RX%h$RX%i$RX%j$RX%k$RX%l$RX%m$RX%n$RX%o$RX%p$RX%q$RX%r$RX%s$RX%t$RX%u$RX%v$RX%w$RX%x$RX%y$RX%z$RX%{$RX%|$RX%}$RX&O$RX&P$RX&Q$RX&R$RX&S$RX&T$RX&U$RX&V$RX&W$RX&X$RX&Y$RX&Z$RX&[$RX&]$RX&_$RX&`$RX&a$RX&d$RX~Os#bOu#aO&e#dO~O&dZOU$SXV$SXh$SXi$SXj$SXx$SX{$SX|$SX}$SX!O$SX!P$SX!Q$SX!R$SX!S$SX!T$SX!U$SX!V$SX$]$SX$c$SX&^$SX$k$SX$j$SX~O$i#gO~O$k#iO~PYOf#POg#POUoaVoahoaioajoaxoa{oa|oa}oa!Ooa!Poa!Qoa!Roa!Soa!Toa!Uoa!Voa$]oa$coa&^oa$koa$joa~OP#lOQ#mOR#mOW$lPX$lPY$lPZ$lP[$lP]$lP^$lP_$lP`$lPa$lPb$lPc$lPd$lPe$lPu$lP!Z$lP$d$lP$e$lP$i$lP$m$lP$n$lP$o$lP$p$lP$q$lP$r$lP$s$lP$t$lP$u$lP$v$lP$w$lP$x$lP$y$lP$z$lP${$lP$|$lP$}$lP%O$lP%P$lP%Q$lP%R$lP%S$lP%T$lP%U$lP%V$lP%W$lP%X$lP%Y$lP%Z$lP%[$lP%]$lP%^$lP%_$lP%`$lP%a$lP%b$lP%c$lP%d$lP%e$lP%f$lP%g$lP%h$lP%i$lP%j$lP%k$lP%l$lP%m$lP%n$lP%o$lP%p$lP%q$lP%r$lP%s$lP%t$lP%u$lP%v$lP%w$lP%x$lP%y$lP%z$lP%{$lP%|$lP%}$lP&O$lP&P$lP&Q$lP&R$lP&S$lP&T$lP&U$lP&V$lP&W$lP&X$lP&Y$lP&Z$lP&[$lP&]$lP&_$lP&`$lP&a$lP&d$lP~O$d#uO$e#uO&_#vO&`#vO&a#uO~Ok#zOl#zO$dVO$eVO&_#yO&`#yO&aVO~O$k#}O~P(UOx#TOU$QaV$Qah$Qai$Qaj$Qa{$Qa|$Qa}$Qa!O$Qa!P$Qa!Q$Qa!R$Qa!S$Qa!T$Qa!U$Qa!V$Qa$]$Qa$c$Qa&^$Qa$k$Qa$j$Qa~O!V$OO$W$OO$X$OO$Y$OO~O!V$OO$W$OO$X$OO$Y$OO$j$RO&e$TO~Os$VOu#aO$k$UO~O$j$WO$k$YO~P(UOQ#mOR#mOW$lXX$lXY$lXZ$lX[$lX]$lX^$lX_$lX`$lXa$lXb$lXc$lXd$lXe$lXu$lX!Z$lX$d$lX$e$lX$i$lX$m$lX$n$lX$o$lX$p$lX$q$lX$r$lX$s$lX$t$lX$u$lX$v$lX$w$lX$x$lX$y$lX$z$lX${$lX$|$lX$}$lX%O$lX%P$lX%Q$lX%R$lX%S$lX%T$lX%U$lX%V$lX%W$lX%X$lX%Y$lX%Z$lX%[$lX%]$lX%^$lX%_$lX%`$lX%a$lX%b$lX%c$lX%d$lX%e$lX%f$lX%g$lX%h$lX%i$lX%j$lX%k$lX%l$lX%m$lX%n$lX%o$lX%p$lX%q$lX%r$lX%s$lX%t$lX%u$lX%v$lX%w$lX%x$lX%y$lX%z$lX%{$lX%|$lX%}$lX&O$lX&P$lX&Q$lX&R$lX&S$lX&T$lX&U$lX&V$lX&W$lX&X$lX&Y$lX&Z$lX&[$lX&]$lX&_$lX&`$lX&a$lX&d$lX~O$d$bO$e$bO&a$bO~O&b$cO&c$dO~O$d#^O$e#^O&a#^O~O$i$eO~Ou$fO~Ou$gO~Os#bOu#aO&e$jO~O$j$kO&e$jO~O$j$mO$k$oO~O$j$WO$k$rO~OS$sOT$sOWzaXzaYzaZza[za]za^za_za`zaazabzaczadzaezauza!Zza$dza$eza$iza$mza$nza$oza$pza$qza$rza$sza$tza$uza$vza$wza$xza$yza$zza${za$|za$}za%Oza%Pza%Qza%Rza%Sza%Tza%Uza%Vza%Wza%Xza%Yza%Zza%[za%]za%^za%_za%`za%aza%bza%cza%dza%eza%fza%gza%hza%iza%jza%kza%lza%mza%nza%oza%pza%qza%rza%sza%tza%uza%vza%wza%xza%yza%zza%{za%|za%}za&Oza&Pza&Qza&Rza&Sza&Tza&Uza&Vza&Wza&Xza&Yza&Zza&[za&]za&_za&`za&aza&dza~Ox#TOUwqhwqiwqjwq!Owq!Pwq!Qwq!Rwq!Swq!Twq!Uwq!Vwq$]wq$cwq&^wq$kwq$jwq~OVwq{wq|wq}wq~PMcOV#TO{#TO|#TO}#TO~PMcOV#TOx#TO{#TO|#TO}#TO!O#UO!P#UOUwqhwqiwqjwq$]wq$cwq&^wq$kwq$jwq~O!Qwq!Rwq!Swq!Twq!Uwq!Vwq~P! _O!Q#VO!R#VO!S#VO!T#VO!U#VO!V#VO~P! _OV#TOh#WOj#WOx#TO{#TO|#TO}#TO!O#UO!P#UO!Q#VO!R#VO!S#VO!T#VO!U#VO!V#VO~OUwqiwq$]wq$cwq&^wq$kwq$jwq~P!#aO&b$tO~P:kO$k$vO~O!V$OO$W$OO$X$OO$Y$OO$j$ba&e$ba~Os#bOu#aO&e$wO~Os$yOu#aO$k$zO~O$j${O$k$zO~O$j$aa$k$aa~P(UO$i#gOWziXziYziZzi[zi]zi^zi_zi`ziazibziczidzieziuzi!Zzi$dzi$ezi$mzi$nzi$ozi$pzi$qzi$rzi$szi$tzi$uzi$vzi$wzi$xzi$yzi$zzi${zi$|zi$}zi%Ozi%Pzi%Qzi%Rzi%Szi%Tzi%Uzi%Vzi%Wzi%Xzi%Yzi%Zzi%[zi%]zi%^zi%_zi%`zi%azi%bzi%czi%dzi%ezi%fzi%gzi%hzi%izi%jzi%kzi%lzi%mzi%nzi%ozi%pzi%qzi%rzi%szi%tzi%uzi%vzi%wzi%xzi%yzi%zzi%{zi%|zi%}zi&Ozi&Pzi&Qzi&Rzi&Szi&Tzi&Uzi&Vzi&Wzi&Xzi&Yzi&Zzi&[zi&]zi&_zi&`zi&azi&dzi~O&b%OO~Os#bOu#aO~Os$yOu#aO$k%PO~Os$yOu#aO~O",goto:")v$mPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP$n$z%W%^P%gP%w$nP&Q&XPPPPPPPPPPP$n&c&oP&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o&o$n&{'U$n$n$n$n'e$n'q(Q(YPPP(Q$nP(aP(d(j(pPPPPP(wPPP)ge^OXY#Q#p#q#r#s#t$WeROXY#Q#p#q#r#s#t$WQ#RRR#k#SQ#h#PQ$Z#mR$}$sQ#cZQ$V#gU$h$R$k$xV$y$m${%QQ#SRQ#]UR#k#RZ#o#T#U#V#W#XY#n#T#U#V#W#XR$[#oeUOXY#Q#p#q#r#s#t$WeTOXY#Q#p#q#r#s#t$WQ#w#YQ#x#ZR$u$dd^OXY#Q#p#q#r#s#t$WR#{#[eYOXY#Q#p#q#r#s#t$Wd]OXY#Q#p#q#r#s#t$WR#f[Q#eZV$i$R$k$xQ$P#bT$Q#c$hR#|#[Q$n$VR$|$nQ$X#jR$q$XS$S#c#eR$l$SQSOQ#_XQ#`YQ#j#QQ$]#pQ$^#qQ$_#rQ$`#sQ$a#tR$p$WQ#p#TQ#q#UQ#r#VQ#s#WR#t#X",nodeNames:"⚠ Bool Ignoring On GroupLeft GroupRight Offset Atan2 Avg Bottomk Count CountValues Group Max Min Quantile LimitK LimitRatio Stddev Stdvar Sum Topk By Without And Or Unless Start End LineComment PromQL AggregateExpr AggregateOp AggregateModifier GroupingLabels LabelName QuotedLabelName StringLiteral FunctionCallBody BinaryExpr Pow BoolModifier MatchingModifierClause Mul Div Mod Add Sub Eql Gte Gtr Lte Lss Neq FunctionCall FunctionIdentifier AbsentOverTime Identifier Absent Abs Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramCount HistogramFraction HistogramQuantile HistogramStdDev HistogramStdVar HistogramSum HistogramAvg DoubleExponentialSmoothing Hour Idelta Increase Info Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MadOverTime MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc SortByLabel SortByLabelDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Timestamp Time Vector Year MatrixSelector NumberDurationLiteralInDurationContext NumberDurationLiteral OffsetExpr ParenExpr SubqueryExpr UnaryExpr UnaryOp VectorSelector LabelMatchers UnquotedLabelMatcher MatchOp EqlSingle EqlRegex NeqRegex QuotedLabelMatcher StepInvariantExpr At AtModifierPreprocessors MetricName",maxTerm:251,nodeProps:[["group",-12,31,37,39,54,134,136,137,138,139,140,142,150,"Expr"]],propSources:[v],skippedNodes:[0,29],repeatNodeCount:3,tokenData:"4k~RwX^#lpq#lqr$ars$tst&luv'Twx'Yxy({yz)Qz{)V{|)[|})c}!O)h!O!P)o!P!Q*u!Q!R*z!R![+u![!]1O!^!_1z!_!`2X!`!a2n!b!c2{!c!}3Q!}#O3h#P#Q3m#Q#R3r#R#S3Q#S#T3w#T#o3Q#o#p4a#q#r4f#y#z#l$f$g#l#BY#BZ#l$IS$I_#l$I|$JO#l$JT$JU#l$KV$KW#l&FU&FV#l~#qY$g~X^#lpq#l#y#z#l$f$g#l#BY#BZ#l$IS$I_#l$I|$JO#l$JT$JU#l$KV$KW#l&FU&FV#l~$dQ!_!`$j#r#s$o~$oO!V~~$tO$Y~~$yWu~OY$tZr$trs%cs#O$t#O#P%h#P;'S$t;'S;=`&f<%lO$t~%hOu~~%kRO;'S$t;'S;=`%t;=`O$t~%yXu~OY$tZr$trs%cs#O$t#O#P%h#P;'S$t;'S;=`&f;=`<%l$t<%lO$t~&iP;=`<%l$t~&qSm~OY&lZ;'S&l;'S;=`&}<%lO&l~'QP;=`<%l&l~'YO}~~'_Wu~OY'YZw'Ywx%cx#O'Y#O#P'w#P;'S'Y;'S;=`(u<%lO'Y~'zRO;'S'Y;'S;=`(T;=`O'Y~(YXu~OY'YZw'Ywx%cx#O'Y#O#P'w#P;'S'Y;'S;=`(u;=`<%l'Y<%lO'Y~(xP;=`<%l'Y~)QO$i~~)VO$k~~)[O{~R)cO&`P!OQ~)hO$j~R)oO&_P!PQ~)rP!Q![)u~)zS&a~!Q![)u!g!h*W#R#S)o#X#Y*W~*ZR{|*d}!O*d!Q![*j~*gP!Q![*j~*oQ&a~!Q![*j#R#S*d~*zO|~~+P[&a~!O!P)o!Q![+u!g!h*W#R#S,m#W#X-X#X#Y*W#[#]-p#a#b.U#g#h.x#k#l/Z#l#m0d#m#n/u~+zZ&a~!O!P)o!Q![+u!g!h*W#R#S,m#W#X-X#X#Y*W#[#]-p#a#b.U#g#h.x#k#l/Z#m#n/u~,pP!Q![,s~,xT&a~!O!P)o!Q![,s!g!h*W#R#S,m#X#Y*W~-^P&a~!Q![-a~-dS!Q![-a#[#]-p#a#b.U#g#h.x~-uP&a~!Q![-x~-{R!Q![-x#a#b.U#g#h.x~.ZQ&a~!Q![.a#g#h.s~.dR!Q![.a#a#b.m#g#h.x~.pP#g#h.s~.xO&a~~.}P&a~!Q![/Q~/TQ!Q![/Q#a#b.m~/`P&a~!Q![/c~/fT!Q![/c#W#X-X#[#]-p#a#b.U#g#h.x~/zP&a~!Q![/}~0QU!Q![/}#W#X-X#[#]-p#a#b.U#g#h.x#k#l/Z~0gR!Q![0p!c!i0p#T#Z0p~0uR&a~!Q![0p!c!i0p#T#Z0pV1VT&cS!ZR!Q![1f![!]1f!c!}1f#R#S1f#T#o1fR1kT!ZR!Q![1f![!]1f!c!}1f#R#S1f#T#o1f~2PP!U~!_!`2S~2XO!T~~2^Q$WP!_!`2d#r#s2iQ2iO!QQ~2nO$X~~2sP!S~!_!`2v~2{O!R~~3QO$]~V3XT!ZRsS!Q![3Q![!]1f!c!}3Q#R#S3Q#T#o3Q~3mO&^~~3rO&b~~3wOx~~3zTO#S3w#S#T%c#T;'S3w;'S;=`4Z<%lO3w~4^P;=`<%l3w~4fO&d~~4kO&e~",tokenizers:[0,1,2],topRules:{PromQL:[0,30],MetricName:[1,153]},specialized:[{term:57,get:(e,t)=>O(e)<<1,external:O},{term:57,get:(e,t)=>m(e)<<1|1,external:m,extend:!0},{term:57,get:e=>g[e]||-1}],tokenPrec:0});(a=o||(o={})).none="none",a.vector="vector",a.scalar="scalar",a.matrix="matrix",a.string="string";let y={59:{name:"abs",argTypes:[o.vector],variadic:0,returnType:o.vector},58:{name:"absent",argTypes:[o.vector],variadic:0,returnType:o.vector},56:{name:"absent_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},60:{name:"acos",argTypes:[o.vector],variadic:0,returnType:o.vector},61:{name:"acosh",argTypes:[o.vector],variadic:0,returnType:o.vector},62:{name:"asin",argTypes:[o.vector],variadic:0,returnType:o.vector},63:{name:"asinh",argTypes:[o.vector],variadic:0,returnType:o.vector},64:{name:"atan",argTypes:[o.vector],variadic:0,returnType:o.vector},65:{name:"atanh",argTypes:[o.vector],variadic:0,returnType:o.vector},66:{name:"avg_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},67:{name:"ceil",argTypes:[o.vector],variadic:0,returnType:o.vector},68:{name:"changes",argTypes:[o.matrix],variadic:0,returnType:o.vector},69:{name:"clamp",argTypes:[o.vector,o.scalar,o.scalar],variadic:0,returnType:o.vector},70:{name:"clamp_max",argTypes:[o.vector,o.scalar],variadic:0,returnType:o.vector},71:{name:"clamp_min",argTypes:[o.vector,o.scalar],variadic:0,returnType:o.vector},72:{name:"cos",argTypes:[o.vector],variadic:0,returnType:o.vector},73:{name:"Cosh",argTypes:[o.vector],variadic:0,returnType:o.vector},74:{name:"count_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},75:{name:"days_in_month",argTypes:[o.vector],variadic:1,returnType:o.vector},76:{name:"day_of_month",argTypes:[o.vector],variadic:1,returnType:o.vector},77:{name:"day_of_week",argTypes:[o.vector],variadic:1,returnType:o.vector},78:{name:"day_of_year",argTypes:[o.vector],variadic:1,returnType:o.vector},79:{name:"deg",argTypes:[o.vector],variadic:0,returnType:o.vector},80:{name:"delta",argTypes:[o.matrix],variadic:0,returnType:o.vector},81:{name:"deriv",argTypes:[o.matrix],variadic:0,returnType:o.vector},82:{name:"exp",argTypes:[o.vector],variadic:0,returnType:o.vector},83:{name:"floor",argTypes:[o.vector],variadic:0,returnType:o.vector},90:{name:"histogram_avg",argTypes:[o.vector],variadic:0,returnType:o.vector},84:{name:"histogram_count",argTypes:[o.vector],variadic:0,returnType:o.vector},85:{name:"histogram_fraction",argTypes:[o.scalar,o.scalar,o.vector],variadic:0,returnType:o.vector},86:{name:"histogram_quantile",argTypes:[o.scalar,o.vector],variadic:0,returnType:o.vector},87:{name:"histogram_stddev",argTypes:[o.vector],variadic:0,returnType:o.vector},88:{name:"histogram_stdvar",argTypes:[o.vector],variadic:0,returnType:o.vector},89:{name:"histogram_sum",argTypes:[o.vector],variadic:0,returnType:o.vector},91:{name:"double_exponential_smoothing",argTypes:[o.matrix,o.scalar,o.scalar],variadic:0,returnType:o.vector},92:{name:"hour",argTypes:[o.vector],variadic:1,returnType:o.vector},93:{name:"idelta",argTypes:[o.matrix],variadic:0,returnType:o.vector},94:{name:"increase",argTypes:[o.matrix],variadic:0,returnType:o.vector},95:{name:"info",argTypes:[o.vector,o.vector],variadic:1,returnType:o.vector},96:{name:"irate",argTypes:[o.matrix],variadic:0,returnType:o.vector},97:{name:"label_replace",argTypes:[o.vector,o.string,o.string,o.string,o.string],variadic:0,returnType:o.vector},98:{name:"label_join",argTypes:[o.vector,o.string,o.string,o.string],variadic:-1,returnType:o.vector},99:{name:"last_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},100:{name:"ln",argTypes:[o.vector],variadic:0,returnType:o.vector},101:{name:"log10",argTypes:[o.vector],variadic:0,returnType:o.vector},102:{name:"log2",argTypes:[o.vector],variadic:0,returnType:o.vector},103:{name:"mad_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},104:{name:"max_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},105:{name:"min_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},106:{name:"minute",argTypes:[o.vector],variadic:1,returnType:o.vector},107:{name:"month",argTypes:[o.vector],variadic:1,returnType:o.vector},108:{name:"pi",argTypes:[],variadic:0,returnType:o.vector},109:{name:"predict_linear",argTypes:[o.matrix,o.scalar],variadic:0,returnType:o.vector},110:{name:"present_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},111:{name:"quantile_over_time",argTypes:[o.scalar,o.matrix],variadic:0,returnType:o.vector},112:{name:"rad",argTypes:[o.vector],variadic:0,returnType:o.vector},113:{name:"rate",argTypes:[o.matrix],variadic:0,returnType:o.vector},114:{name:"resets",argTypes:[o.matrix],variadic:0,returnType:o.vector},115:{name:"round",argTypes:[o.vector,o.scalar],variadic:1,returnType:o.vector},116:{name:"scalar",argTypes:[o.vector],variadic:0,returnType:o.scalar},117:{name:"sgn",argTypes:[o.vector],variadic:0,returnType:o.vector},118:{name:"sin",argTypes:[o.vector],variadic:0,returnType:o.vector},119:{name:"Sinh",argTypes:[o.vector],variadic:0,returnType:o.vector},120:{name:"sort",argTypes:[o.vector],variadic:0,returnType:o.vector},121:{name:"sort_desc",argTypes:[o.vector],variadic:0,returnType:o.vector},122:{name:"sort_by_label",argTypes:[o.vector,o.string],variadic:-1,returnType:o.vector},123:{name:"sort_by_label_desc",argTypes:[o.vector,o.string],variadic:-1,returnType:o.vector},124:{name:"sqrt",argTypes:[o.vector],variadic:0,returnType:o.vector},125:{name:"stddev_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},126:{name:"stdvar_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},127:{name:"sum_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},128:{name:"tan",argTypes:[o.vector],variadic:0,returnType:o.vector},129:{name:"tanh",argTypes:[o.vector],variadic:0,returnType:o.vector},131:{name:"time",argTypes:[],variadic:0,returnType:o.scalar},130:{name:"timestamp",argTypes:[o.vector],variadic:0,returnType:o.vector},132:{name:"vector",argTypes:[o.scalar],variadic:0,returnType:o.vector},133:{name:"year",argTypes:[o.vector],variadic:1,returnType:o.vector}};class b{constructor(e,t,i){this.type=e,this.name=t,this.value=i}matchesEmpty(){switch(this.type){case 146:return""===this.value;case 53:return""!==this.value;default:return!1}}}function _(e,t){let i=[];return e.forEach(e=>{i.push(function(e,t){let i=new b(0,"",""),a=e.cursor();switch(a.type.id){case 149:if(!a.next())break;do switch(a.type.id){case 36:i.name=t.sliceDoc(a.from,a.to).slice(1,-1);break;case 145:{let e=a.node.firstChild;e&&(i.type=e.type.id);break}case 37:i.value=t.sliceDoc(a.from,a.to).slice(1,-1)}while(a.nextSibling());break;case 144:if(!a.next())break;do switch(a.type.id){case 35:i.name=t.sliceDoc(a.from,a.to);break;case 145:{let e=a.node.firstChild;e&&(i.type=e.type.id);break}case 37:i.value=t.sliceDoc(a.from,a.to).slice(1,-1)}while(a.nextSibling());break;case 36:i.name="__name__",i.value=t.sliceDoc(a.from,a.to).slice(1,-1),i.type=146}return i}(e,t))}),i}function T(e,t){for(;;){if(!e||e.type.id===t)return e;e=e.parent}return null}function Q(e,...t){let i=e.cursor();if(!i.next())return!1;let a=!1;do a=t.some(e=>i.type.id===e||i.type.name===e);while(!a&&i.nextSibling());return a}function z(e,...t){let i=e.cursor();if(!i.next())return!1;let a=0;do i.type.is(t[a])&&a++;while(a<t.length&&i.nextSibling());return a>=t.length}(r=l||(l={})).CardOneToOne="one-to-one",r.CardManyToOne="many-to-one",r.CardOneToMany="one-to-many",r.CardManyToMany="many-to-many";var k=i(61262);class P{constructor(e){this.tree=(0,k.qz)(e),this.state=e,this.diagnostics=[]}getDiagnostics(){return this.diagnostics.sort((e,t)=>e.from-t.from)}analyze(){this.checkAST(this.tree.topNode.firstChild),this.diagnoseAllErrorNodes()}diagnoseAllErrorNodes(){let e=this.tree.cursor();for(;e.next();)if(0===e.type.id&&e.to!==this.tree.topNode.to){let t=e.node.parent;this.diagnostics.push({severity:"error",message:"unexpected expression",from:t?t.from:e.from,to:t?t.to:e.to})}}checkAST(e){if(!e)return o.none;switch(e.type.id){case 31:this.checkAggregationExpr(e);break;case 39:this.checkBinaryExpr(e);break;case 54:this.checkCallFunction(e);break;case 138:case 134:this.checkAST(e.getChild("Expr"));break;case 140:{let t=this.checkAST(e.getChild("Expr"));t!==o.scalar&&t!==o.vector&&this.addDiagnostic(e,`unary expression only allowed on expressions of type scalar or instant vector, got ${t}`);break}case 139:{let t=this.checkAST(e.getChild("Expr"));t!==o.vector&&this.addDiagnostic(e,`subquery is only allowed on instant vector, got ${t} in ${e.name} instead`);break}case 142:this.checkVectorSelector(e);break;case 150:{let t=this.checkAST(e.getChild("Expr"));t!==o.vector&&t!==o.matrix&&this.addDiagnostic(e,"@ modifier must be preceded by an instant selector vector or range vector selector or a subquery")}}return function e(t){var i;if(!t)return o.none;switch(t.type.id){case 31:case 142:return o.vector;case 137:return e(t.firstChild);case 37:return o.string;case 136:return o.scalar;case 134:case 139:return o.matrix;case 138:case 140:case 150:return e(t.getChild("Expr"));case 39:{let i=e(t.firstChild),a=e(t.lastChild);if(i===o.scalar&&a===o.scalar)return o.scalar;return o.vector}case 54:{let e=null==(i=t.firstChild)?void 0:i.firstChild;if(!e)return o.none;return y[e.type.id].returnType}default:return o.none}}(e)}checkAggregationExpr(e){var t;let i=null==(t=e.firstChild)?void 0:t.firstChild;if(!i)return void this.addDiagnostic(e,"aggregation operator expected in aggregation expression but got nothing");let a=e.getChild(38),r=a?a.getChildren("Expr"):[];if(!r.length)return void this.addDiagnostic(e,"unable to find the parameter for the expression");this.expectType(r[r.length-1],o.vector,"aggregation expression"),(21===i.type.id||9===i.type.id||16===i.type.id||17===i.type.id||15===i.type.id)&&this.expectType(r[0],o.scalar,"aggregation parameter"),11===i.type.id&&this.expectType(r[0],o.string,"aggregation parameter")}checkBinaryExpr(e){let t=e.firstChild,i=e.lastChild;if(!t||!i)return void this.addDiagnostic(e,"left or right expression is missing in binary expression");let a=this.checkAST(t),r=this.checkAST(i),n=e.getChild(41),s=Q(e,48,53,51,52,49,50),c=Q(e,24,25,26);n?s||this.addDiagnostic(e,"bool modifier can only be used on comparison operators"):s&&a===o.scalar&&r===o.scalar&&this.addDiagnostic(e,"comparisons between scalars must use BOOL modifier");let h=function(e,t){if(!t||39!==t.type.id)return null;let i={card:l.CardOneToOne,matchingLabels:[],on:!1,include:[]},a=t.getChild(42);if(a){i.on=null!==a.getChild(3);let t=a.getChild(34);for(let a of t?t.getChildren(35):[])i.matchingLabels.push(e.sliceDoc(a.from,a.to));let r=a.getChild(4),n=a.getChild(5),s=r||n;if(s){i.card=r?l.CardManyToOne:l.CardOneToMany;let t=s.nextSibling;for(let a of(null==t?void 0:t.getChildren(35))||[])i.include.push(e.sliceDoc(a.from,a.to))}}return Q(t,24,25,26)&&i.card===l.CardOneToOne&&(i.card=l.CardManyToMany),i}(this.state,e);if(null!==h&&h.on)for(let t of h.matchingLabels)for(let i of h.include)t===i&&this.addDiagnostic(e,`label "${t}" must not occur in ON and GROUP clause at once`);a!==o.scalar&&a!==o.vector&&this.addDiagnostic(t,"binary expression must contain only scalar and instant vector types"),r!==o.scalar&&r!==o.vector&&this.addDiagnostic(i,"binary expression must contain only scalar and instant vector types"),(a!==o.vector||r!==o.vector)&&null!==h?h.matchingLabels.length>0&&this.addDiagnostic(e,"vector matching only allowed between instant vectors"):c&&(((null==h?void 0:h.card)===l.CardOneToMany||(null==h?void 0:h.card)===l.CardManyToOne)&&this.addDiagnostic(e,"no grouping allowed for set operations"),(null==h?void 0:h.card)!==l.CardManyToMany&&this.addDiagnostic(e,"set operations must always be many-to-many")),(a===o.scalar||r===o.scalar)&&c&&this.addDiagnostic(e,"set operator not allowed in binary scalar expression")}checkCallFunction(e){var t;let i=null==(t=e.firstChild)?void 0:t.firstChild;if(!i)return void this.addDiagnostic(e,"function not defined");let a=e.getChild(38),r=a?a.getChildren("Expr"):[],n=y[i.type.id],s=n.argTypes.length;if(0===n.variadic)r.length!==s&&this.addDiagnostic(e,`expected ${s} argument(s) in call to "${n.name}", got ${r.length}`);else{let t=s-1;if(t>r.length)this.addDiagnostic(e,`expected at least ${t} argument(s) in call to "${n.name}", got ${r.length}`);else{let i=t+n.variadic;n.variadic>0&&i<r.length&&this.addDiagnostic(e,`expected at most ${i} argument(s) in call to "${n.name}", got ${r.length}`)}}"info"===n.name&&r.length>1&&r[1].getChild(57)&&this.addDiagnostic(e,`expected label selectors as the second argument to "info" function, got ${r[1].type}`);let o=0;for(let e=0;e<r.length;e++){if((o=e)>=n.argTypes.length){if(0===n.variadic)break;o=n.argTypes.length-1}this.expectType(r[e],n.argTypes[o],`call to function "${n.name}"`)}}checkVectorSelector(e){let t=e.getChild(143),i=[];for(let e of[36,149,144])i=i.concat(_(t?t.getChildren(e):[],this.state));let a="",r=e.getChild(57);if(r&&(a=this.state.sliceDoc(r.from,r.to)),""!==a){let t=i.find(e=>"__name__"===e.name);t&&this.addDiagnostic(e,`metric name must not be set twice: ${a} or ${t.value}`),i.push(new b(146,"__name__",a))}else{let t=i.filter(e=>"__name__"===e.name);t.length>1&&this.addDiagnostic(e,`metric name must not be set twice: ${t[0].value} or ${t[1].value}`)}i.every(e=>e.matchesEmpty())&&this.addDiagnostic(e,"vector selector must contain at least one non-empty matcher")}expectType(e,t,i){let a=this.checkAST(e);a!==t&&this.addDiagnostic(e,`expected type ${t} in ${i}, got ${a}`)}addDiagnostic(e,t){this.diagnostics.push({severity:"error",message:t,from:e.from,to:e.to})}}var S=i(13018);let x=[{label:"y"},{label:"w"},{label:"d"},{label:"h"},{label:"m"},{label:"s"},{label:"ms"}],X=[{label:"^"},{label:"*"},{label:"/"},{label:"%"},{label:"+"},{label:"-"},{label:"=="},{label:">="},{label:">"},{label:"<"},{label:"<="},{label:"!="},{label:"atan2"},{label:"and"},{label:"or"},{label:"unless"}],w=[{label:"avg",detail:"aggregation",info:"Calculate the average over dimensions",type:"keyword"},{label:"bottomk",detail:"aggregation",info:"Smallest k elements by sample value",type:"keyword"},{label:"count",detail:"aggregation",info:"Count number of elements in the vector",type:"keyword"},{label:"count_values",detail:"aggregation",info:"Count number of elements with the same value",type:"keyword"},{label:"group",detail:"aggregation",info:"Group series, while setting the sample value to 1",type:"keyword"},{label:"limitk",detail:"aggregation",info:"Sample k elements",type:"keyword"},{label:"limit_ratio",detail:"aggregation",info:"Sample given ratio of elements",type:"keyword"},{label:"max",detail:"aggregation",info:"Select maximum over dimensions",type:"keyword"},{label:"min",detail:"aggregation",info:"Select minimum over dimensions",type:"keyword"},{label:"quantile",detail:"aggregation",info:"Calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions",type:"keyword"},{label:"stddev",detail:"aggregation",info:"Calculate population standard deviation over dimensions",type:"keyword"},{label:"stdvar",detail:"aggregation",info:"Calculate population standard variance over dimensions",type:"keyword"},{label:"sum",detail:"aggregation",info:"Calculate sum over dimensions",type:"keyword"},{label:"topk",detail:"aggregation",info:"Largest k elements by sample value",type:"keyword"}],R=[{label:"sum(rate(__input_vector__[5m]))",type:"function",detail:"snippet",info:"Sum over rates of increase",apply:(0,S.DB)("sum(rate(${__input_vector__}[5m]))")},{label:"histogram_quantile(__quantile__, sum by(le) (rate(__histogram_metric__[5m])))",type:"function",detail:"snippet",info:"Approximate a quantile value from an aggregated histogram",apply:(0,S.DB)("histogram_quantile(${__quantile__}, sum by(le) (rate(${__histogram_metric__}[5m])))")},{label:'label_replace(__input_vector__, "__dst__", "__replacement__", "__src__", "__regex__")',type:"function",detail:"snippet",info:"Set or replace a label value in an input vector",apply:(0,S.DB)('label_replace(${__input_vector__}, "${__dst__}", "${__replacement__}", "${__src__}", "${__regex__}")')},{label:"topk(__rank_number__, __input_vector__)",type:"function",detail:"snippet",info:"Largest k elements by sample value",apply:(0,S.DB)("topk(${__rank_number__}, ${__input_vector__})")},{label:"bottomk(__rank_number__, __input_vector__)",type:"function",detail:"snippet",info:"Smallest k elements by sample value",apply:(0,S.DB)("bottomk(${__rank_number__}, ${__input_vector__})")},{label:'count_values("__label_name__", __input_vector__)',type:"function",detail:"snippet",info:"Count the number of series per distinct sample value",apply:(0,S.DB)('count_values("${__label_name__}", ${__metric__})')}],E=[{label:"="},{label:"!="},{label:"=~"},{label:"!~"}],L=[{label:"on",info:"Match only on specified labels",type:"keyword"},{label:"ignoring",info:"Ignore specified labels for matching",type:"keyword"},{label:"group_left",info:"Allow many-to-one matching",type:"keyword"},{label:"group_right",info:"Allow one-to-many matching",type:"keyword"}],C=[{label:"start()",info:"resolve to the start of the query",type:"keyword"},{label:"end()",info:"resolve to the end of the query",type:"keyword"}],D=[{label:"abs",detail:"function",info:"Return absolute values of input series",type:"function"},{label:"absent",detail:"function",info:"Determine whether input vector is empty",type:"function"},{label:"absent_over_time",detail:"function",info:"Determine whether input range vector is empty",type:"function"},{label:"acos",detail:"function",info:"Calculate the arccosine, in radians, for input series",type:"function"},{label:"acosh",detail:"function",info:"Calculate the inverse hyperbolic cosine, in radians, for input series",type:"function"},{label:"asin",detail:"function",info:"Calculate the arcsine, in radians, for input series",type:"function"},{label:"asinh",detail:"function",info:"Calculate the inverse hyperbolic sine, in radians, for input series",type:"function"},{label:"atan",detail:"function",info:"Calculate the arctangent, in radians, for input series",type:"function"},{label:"atanh",detail:"function",info:"Calculate the inverse hyperbolic tangent, in radians, for input series",type:"function"},{label:"avg_over_time",detail:"function",info:"Average series values over time",type:"function"},{label:"ceil",detail:"function",info:"Round up values of input series to nearest integer",type:"function"},{label:"changes",detail:"function",info:"Return number of value changes in input series over time",type:"function"},{label:"clamp",detail:"function",info:"Limit the value of input series between a minimum and a maximum",type:"function"},{label:"clamp_max",detail:"function",info:"Limit the value of input series to a maximum",type:"function"},{label:"clamp_min",detail:"function",info:"Limit the value of input series to a minimum",type:"function"},{label:"cos",detail:"function",info:"Calculate the cosine, in radians, for input series",type:"function",boost:-1},{label:"cosh",detail:"function",info:"Calculate the hyperbolic cosine, in radians, for input series",type:"function",boost:-1},{label:"count_over_time",detail:"function",info:"Count the number of values for each input series",type:"function"},{label:"days_in_month",detail:"function",info:"Return the number of days in current month for provided timestamps",type:"function"},{label:"day_of_month",detail:"function",info:"Return the day of the month for provided timestamps",type:"function"},{label:"day_of_week",detail:"function",info:"Return the day of the week for provided timestamps",type:"function"},{label:"day_of_year",detail:"function",info:"Return the day of the year for provided timestamps",type:"function"},{label:"deg",detail:"function",info:"Convert radians to degrees for input series",type:"function",boost:-1},{label:"delta",detail:"function",info:"Calculate the difference between beginning and end of a range vector (for gauges)",type:"function"},{label:"deriv",detail:"function",info:"Calculate the per-second derivative over series in a range vector (for gauges)",type:"function"},{label:"exp",detail:"function",info:"Calculate exponential function for input vector values",type:"function"},{label:"floor",detail:"function",info:"Round down values of input series to nearest integer",type:"function"},{label:"histogram_avg",detail:"function",info:"Return the average of observations from a native histogram (experimental feature)",type:"function"},{label:"histogram_count",detail:"function",info:"Return the count of observations from a native histogram (experimental feature)",type:"function"},{label:"histogram_fraction",detail:"function",info:"Calculate fractions of observations within an interval from a native histogram (experimental feature)",type:"function"},{label:"histogram_quantile",detail:"function",info:"Calculate quantiles from native histograms (experimental) and from conventional histogram buckets",type:"function"},{label:"histogram_sum",detail:"function",info:"Return the sum of observations from a native histogram (experimental feature)",type:"function"},{label:"histogram_stddev",detail:"function",info:"Estimate the standard deviation of observations from a native histogram (experimental feature)",type:"function"},{label:"histogram_stdvar",detail:"function",info:"Estimate the standard variance of observations from a native histogram (experimental feature)",type:"function"},{label:"double_exponential_smoothing",detail:"function",info:"Calculate smoothed value of input series",type:"function"},{label:"hour",detail:"function",info:"Return the hour of the day for provided timestamps",type:"function"},{label:"idelta",detail:"function",info:"Calculate the difference between the last two samples of a range vector (for counters)",type:"function"},{label:"increase",detail:"function",info:"Calculate the increase in value over a range of time (for counters)",type:"function"},{label:"info",detail:"function",info:"Add data labels from corresponding info metrics",type:"function"},{label:"irate",detail:"function",info:"Calculate the per-second increase over the last two samples of a range vector (for counters)",type:"function"},{label:"label_replace",detail:"function",info:"Set or replace label values",type:"function"},{label:"label_join",detail:"function",info:"Join together label values into new label",type:"function"},{label:"last_over_time",detail:"function",info:"The most recent point value in specified interval.",type:"function"},{label:"ln",detail:"function",info:"Calculate natural logarithm of input series",type:"function"},{label:"log10",detail:"function",info:"Calulcate base-10 logarithm of input series",type:"function"},{label:"log2",detail:"function",info:"Calculate base-2 logarithm of input series",type:"function"},{label:"mad_over_time",detail:"function",info:"Return the median absolute deviation over time for input series",type:"function"},{label:"max_over_time",detail:"function",info:"Return the maximum value over time for input series",type:"function"},{label:"min_over_time",detail:"function",info:"Return the minimum value over time for input series",type:"function"},{label:"minute",detail:"function",info:"Return the minute of the hour for provided timestamps",type:"function"},{label:"month",detail:"function",info:"Return the month for provided timestamps",type:"function"},{label:"pi",detail:"function",info:"Return pi",type:"function"},{label:"predict_linear",detail:"function",info:"Predict the value of a gauge into the future",type:"function"},{label:"present_over_time",detail:"function",info:"the value 1 for any series in the specified interval",type:"function"},{label:"quantile_over_time",detail:"function",info:"Calculate value quantiles over time for input series",type:"function"},{label:"rad",detail:"function",info:"Convert degrees to radians for input series",type:"function",boost:-1},{label:"rate",detail:"function",info:"Calculate per-second increase over a range vector (for counters)",type:"function"},{label:"resets",detail:"function",info:"Return number of value decreases (resets) in input series of time",type:"function"},{label:"round",detail:"function",info:"Round values of input series to nearest integer",type:"function"},{label:"scalar",detail:"function",info:"Convert single-element series vector into scalar value",type:"function"},{label:"sgn",detail:"function",info:"Returns the sign of the instant vector",type:"function"},{label:"sin",detail:"function",info:"Calculate the sine, in radians, for input series",type:"function"},{label:"sinh",detail:"function",info:"Calculate the hyperbolic sine, in radians, for input series",type:"function"},{label:"sort",detail:"function",info:"Sort input series ascendingly by value",type:"function"},{label:"sort_desc",detail:"function",info:"Sort input series descendingly by value",type:"function"},{label:"sort_by_label",detail:"function",info:"Sort input series ascendingly by label value",type:"function"},{label:"sort_by_label_desc",detail:"function",info:"Sort input series descendingly by value value",type:"function"},{label:"sqrt",detail:"function",info:"Return the square root for input series",type:"function"},{label:"stddev_over_time",detail:"function",info:"Calculate the standard deviation within input series over time",type:"function"},{label:"stdvar_over_time",detail:"function",info:"Calculate the standard variance within input series over time",type:"function"},{label:"sum_over_time",detail:"function",info:"Calculate the sum over the values of input series over time",type:"function"},{label:"tan",detail:"function",info:"Calculate the tangent, in radians, for input series",type:"function"},{label:"tanh",detail:"function",info:"Calculate the hyperbolic tangent, in radians, for input series",type:"function"},{label:"time",detail:"function",info:"Return the Unix timestamp at the current evaluation time",type:"function"},{label:"timestamp",detail:"function",info:"Return the Unix timestamp for the samples in the input vector",type:"function"},{label:"vector",detail:"function",info:"Convert a scalar value into a single-element series vector",type:"function"},{label:"year",detail:"function",info:"Return the year for provided timestamps",type:"function"}],A=[{label:"by",info:"Keep the listed labels, remove all others.",type:"keyword"},{label:"without",info:"Remove the listed labels, preserve all others.",type:"keyword"}],M=[{label:"nan",info:"Floating-point NaN value",type:"constant"},{label:"inf",info:"Floating-point infinity",type:"constant"}];function F(e,t){let i=T(e,142);return i&&(i=i.getChild(57))?t.sliceDoc(i.from,i.to):""}function q(e){var t;let i=e.parent;if(null!==i&&(null==(t=i.firstChild)?void 0:t.type.id)===32){let e=i.firstChild.firstChild;if(null!==e&&[21,9,16,17,11].includes(e.type.id))return!0}return!1}(n=c||(c={}))[n.MetricName=0]="MetricName",n[n.LabelName=1]="LabelName",n[n.LabelValue=2]="LabelValue",n[n.Function=3]="Function",n[n.Aggregation=4]="Aggregation",n[n.BinOpModifier=5]="BinOpModifier",n[n.BinOp=6]="BinOp",n[n.MatchOp=7]="MatchOp",n[n.AggregateOpModifier=8]="AggregateOpModifier",n[n.Duration=9]="Duration",n[n.Offset=10]="Offset",n[n.Bool=11]="Bool",n[n.AtModifiers=12]="AtModifiers",n[n.Number=13]="Number";class V{constructor(e,t=1e4){this.prometheusClient=e,this.maxMetricsMetadata=t}getPrometheusClient(){return this.prometheusClient}promQL(e){let{state:t,pos:i}=e,a=(0,k.qz)(t).resolve(i,-1),r=function(e,t,i){var a,r,n,s,o,l,h,u,d,p,O,f,m,v,g,$,y,b,k,P,S;let x=[];switch(t.type.id){case 0:{if((null==(a=t.parent)?void 0:a.type.id)===137){x.push({kind:c.Duration});break}if((null==(r=t.parent)?void 0:r.type.id)===144||(null==(n=t.parent)?void 0:n.type.id)===149){x.push({kind:c.MatchOp});break}if((null==(s=t.parent)?void 0:s.type.id)===134||(null==(o=t.parent)?void 0:o.type.id)===139&&Q(t.parent,135)){x.push({kind:c.Duration});break}let i=e.sliceDoc(t.from,t.to);X.filter(e=>e.label.includes(i)).length>0&&x.push({kind:c.BinOp});break}case 57:{if((null==(l=t.parent)?void 0:l.type.id)===0){let i=t.parent.parent;if((null==i?void 0:i.type.id)===150){x.push({kind:c.AtModifiers});break}if((null==i?void 0:i.type.id)===31){x.push({kind:c.AggregateOpModifier},{kind:c.BinOp});break}if((null==i?void 0:i.type.id)===142){let i=F(t,e);w.filter(e=>e.label===i).length>0&&x.push({kind:c.AggregateOpModifier}),x.push({kind:c.BinOp},{kind:c.Offset});break}if(i&&z(i,"Expr")){x.push({kind:c.BinOp},{kind:c.Offset});break}}let i=null==(h=t.parent)?void 0:h.parent;if(!i){x.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)});break}z(i,"Expr","Expr")&&38!==i.type.id?39!==i.type.id||Q(i,0)||(x.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:c.Function},{kind:c.Aggregation},{kind:c.BinOpModifier},{kind:c.Number}),Q(i,48,49,50,51,52,53)&&!Q(i,41)&&x.push({kind:c.Bool})):(x.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:c.Function},{kind:c.Aggregation}),38!==i.type.id&&134!==i.type.id&&x.push({kind:c.Number}));break}case 30:null!==t.firstChild&&0===t.firstChild.type.id&&x.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation},{kind:c.Number});break;case 34:x.push({kind:c.LabelName,metricName:function(e,t){let i=T(e,31);if(!i)return"";let a="";return i.cursor().iterate(e=>{if(142===e.type.id&&(a=F(e.node,t)))return!1}),a}(t,e)});break;case 143:x.push({kind:c.LabelName,metricName:F(t,e)});break;case 35:(null==(u=t.parent)?void 0:u.type.id)===34?x.push({kind:c.LabelName}):(null==(d=t.parent)?void 0:d.type.id)===144&&x.push({kind:c.LabelName,metricName:F(t,e)});break;case 37:if((null==(p=t.parent)?void 0:p.type.id)===144||(null==(O=t.parent)?void 0:O.type.id)===149){let i="";(null==(f=t.parent.firstChild)?void 0:f.type.id)===35?i=e.sliceDoc(t.parent.firstChild.from,t.parent.firstChild.to):(null==(m=t.parent.firstChild)?void 0:m.type.id)===36&&(i=e.sliceDoc(t.parent.firstChild.from,t.parent.firstChild.to).slice(1,-1));let a=F(t,e),r=T(t,143),n=[];for(let t of[36,149,144])n=n.concat(_(r?r.getChildren(t):[],e));x.push({kind:c.LabelValue,metricName:a,labelName:i,matchers:n})}else(null==(g=null==(v=t.parent)?void 0:v.parent)?void 0:g.type.id)===34?x.push({kind:c.LabelName}):(null==(y=null==($=t.parent)?void 0:$.parent)?void 0:y.type.id)===143&&x.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to).slice(1,-1)});break;case 136:(null==(b=t.parent)?void 0:b.type.id)===0&&(null==(k=t.parent.parent)?void 0:k.type.id)===139?x.push({kind:c.Duration}):x.push({kind:c.Number});break;case 135:case 137:x.push({kind:c.Duration});break;case 38:if(q(t)){if(null===t.firstChild||t.firstChild.from<=i&&t.firstChild.to>=i){x.push({kind:c.Number});break}x.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation});break}x.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation});break;case 53:(null==(P=t.parent)?void 0:P.type.id)===145?x.push({kind:c.MatchOp}):(null==(S=t.parent)?void 0:S.type.id)===39&&x.push({kind:c.BinOp});break;case 146:case 147:case 148:case 145:x.push({kind:c.MatchOp});break;case 40:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 24:case 26:case 25:case 39:x.push({kind:c.BinOp})}return x}(t,a,i),n=Promise.resolve([]),s=!1,o=!0;for(let e of r)switch(e.kind){case c.Aggregation:s=!0,n=n.then(e=>e.concat(w));break;case c.Function:s=!0,n=n.then(e=>e.concat(D));break;case c.BinOpModifier:n=n.then(e=>e.concat(L));break;case c.BinOp:n=n.then(e=>e.concat(X));break;case c.MatchOp:n=n.then(e=>e.concat(E));break;case c.AggregateOpModifier:n=n.then(e=>e.concat(A));break;case c.Duration:o=!1,n=n.then(e=>e.concat(x));break;case c.Offset:n=n.then(e=>e.concat([{label:"offset"}]));break;case c.Bool:n=n.then(e=>e.concat([{label:"bool"}]));break;case c.AtModifiers:n=n.then(e=>e.concat(C));break;case c.Number:n=n.then(e=>e.concat(M));break;case c.MetricName:n=n.then(t=>this.autocompleteMetricName(t,e));break;case c.LabelName:n=n.then(t=>this.autocompleteLabelName(t,e));break;case c.LabelValue:n=n.then(t=>this.autocompleteLabelValue(t,e))}return n.then(e=>(function(e,t,i,a=!1,r=!0){return a&&e.push(...R),{from:t,to:i,options:e,validFor:r?/^[a-zA-Z0-9_:]+$/:void 0}})(e,function(e,t,i){var a,r,n,s,o,l,c;let h=e.doc.slice(t.from,i).toString(),u=t.from;if(143===t.type.id||34===t.type.id){let e;e=t.from+1,null!==t.firstChild&&(e=i),u=e}else 38===t.type.id&&null===t.firstChild||37===t.type.id&&((null==(a=t.parent)?void 0:a.type.id)===144||(null==(r=t.parent)?void 0:r.type.id)===149)?u++:(137===t.type.id||135===t.type.id&&!x.map(e=>e.label).includes(h[h.length-1])||136===t.type.id&&(null==(n=t.parent)?void 0:n.type.id)===0&&(null==(s=t.parent.parent)?void 0:s.type.id)===139||38===t.type.id&&q(t)&&null!==t.firstChild||0===t.type.id&&((null==(o=t.parent)?void 0:o.type.id)===137||(null==(l=t.parent)?void 0:l.type.id)===134||(null==(c=t.parent)?void 0:c.type.id)===139&&Q(t.parent,135)))&&(u=i);return u}(t,a,i),i,s,o))}autocompleteMetricName(e,t){if(!this.prometheusClient)return e;let i=new Map;return this.prometheusClient.metricNames(t.metricName).then(e=>{var t;for(let t of e)i.set(t,{label:t,type:"constant"});if(e.length<=this.maxMetricsMetadata)return null==(t=this.prometheusClient)?void 0:t.metricMetadata()}).then(t=>{if(t)for(let[e,a]of i){let i=t[e.replace(/(_count|_sum|_bucket)$/,"")];if(i){if(i.length>1)for(let e of i)""===a.detail?a.detail=e.type:a.detail!==e.type&&(a.detail="unknown",a.info="multiple different definitions for this metric"),""===a.info?a.info=e.help:a.info!==e.help&&(a.info="multiple different definitions for this metric");else if(1===i.length){let{type:t,help:r}=i[0];("histogram"===t||"summary"===t)&&(e.endsWith("_count")&&(t="counter",r=`The total number of observations for: ${r}`),e.endsWith("_sum")&&(t="counter",r=`The total sum of observations for: ${r}`),e.endsWith("_bucket")&&(t="counter",r=`The total count of observations for a bucket in the histogram: ${r}`)),a.detail=t,a.info=r}}}return e.concat(Array.from(i.values()))})}autocompleteLabelName(e,t){return this.prometheusClient?this.prometheusClient.labelNames(t.metricName).then(t=>e.concat(t.map(e=>({label:e,type:"constant"})))):e}autocompleteLabelValue(e,t){return this.prometheusClient&&t.labelName?this.prometheusClient.labelValues(t.labelName,t.metricName,t.matchers).then(t=>e.concat(t.map(e=>({label:e,type:"text"})))):e}}let N="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,W=new Set,U="object"==typeof process&&process?process:{},Y=(e,t,i,a)=>{"function"==typeof U.emitWarning?U.emitWarning(e,t,i,a):console.error(`[${i}] ${t}: ${e}`)},I=globalThis.AbortController,j=globalThis.AbortSignal;if(void 0===I){j=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},I=class{constructor(){t()}signal=new j;abort(e){if(!this.signal.aborted){for(let t of(this.signal.reason=e,this.signal.aborted=!0,this.signal._onabort))t(e);this.signal.onabort?.(e)}}};let e=U.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,Y("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}Symbol("type");let B=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Z=e=>B(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?G:null:null;class G extends Array{constructor(e){super(e),this.fill(0)}}class H{heap;length;static #e=!1;static create(e){let t=Z(e);if(!t)return[];H.#e=!0;let i=new H(e,t);return H.#e=!1,i}constructor(e,t){if(!H.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class J{#t;#i;#a;#r;#n;#s;#o;#l;get perf(){return this.#l}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#h;#u;#d;#p;#O;#f;#m;#v;#g;#$;#y;#b;#_;#T;#Q;#z;#k;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#_,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#p,next:e.#O,prev:e.#f,get head(){return e.#m},get tail(){return e.#v},free:e.#g,isBackgroundFetch:t=>e.#P(t),backgroundFetch:(t,i,a,r)=>e.#S(t,i,a,r),moveToTail:t=>e.#x(t),indexes:t=>e.#X(t),rindexes:t=>e.#w(t),isStale:t=>e.#R(t)}}get max(){return this.#t}get maxSize(){return this.#i}get calculatedSize(){return this.#h}get size(){return this.#c}get fetchMethod(){return this.#s}get memoMethod(){return this.#o}get dispose(){return this.#a}get onInsert(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:t=0,ttl:i,ttlResolution:a=1,ttlAutopurge:r,updateAgeOnGet:n,updateAgeOnHas:s,allowStale:o,dispose:l,onInsert:c,disposeAfter:h,noDisposeOnSet:u,noUpdateTTL:d,maxSize:p=0,maxEntrySize:O=0,sizeCalculation:f,fetchMethod:m,memoMethod:v,noDeleteOnFetchRejection:g,noDeleteOnStaleGet:$,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:b,ignoreFetchAbort:_,perf:T}=e;if(void 0!==T&&"function"!=typeof T?.now)throw TypeError("perf option must have a now() method if specified");if(this.#l=T??N,0!==t&&!B(t))throw TypeError("max option must be a nonnegative integer");let Q=t?Z(t):Array;if(!Q)throw Error("invalid max value: "+t);if(this.#t=t,this.#i=p,this.maxEntrySize=O||this.#i,this.sizeCalculation=f,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==v&&"function"!=typeof v)throw TypeError("memoMethod must be a function if defined");if(this.#o=v,void 0!==m&&"function"!=typeof m)throw TypeError("fetchMethod must be a function if specified");if(this.#s=m,this.#Q=!!m,this.#u=new Map,this.#d=Array(t).fill(void 0),this.#p=Array(t).fill(void 0),this.#O=new Q(t),this.#f=new Q(t),this.#m=0,this.#v=0,this.#g=H.create(t),this.#c=0,this.#h=0,"function"==typeof l&&(this.#a=l),"function"==typeof c&&(this.#r=c),"function"==typeof h?(this.#n=h,this.#$=[]):(this.#n=void 0,this.#$=void 0),this.#T=!!this.#a,this.#k=!!this.#r,this.#z=!!this.#n,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!g,this.allowStaleOnFetchRejection=!!y,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!_,0!==this.maxEntrySize){if(0!==this.#i&&!B(this.#i))throw TypeError("maxSize must be a positive integer if specified");if(!B(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#E()}if(this.allowStale=!!o,this.noDeleteOnStaleGet=!!$,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!s,this.ttlResolution=B(a)||0===a?a:1,this.ttlAutopurge=!!r,this.ttl=i||0,this.ttl){if(!B(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#L()}if(0===this.#t&&0===this.ttl&&0===this.#i)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#i){let e="LRU_CACHE_UNBOUNDED";W.has(e)||(W.add(e),Y("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,J))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#L(){let e=new G(this.#t),t=new G(this.#t);this.#_=e,this.#b=t,this.#C=(i,a,r=this.#l.now())=>{if(t[i]=0!==a?r:0,e[i]=a,0!==a&&this.ttlAutopurge){let e=setTimeout(()=>{this.#R(i)&&this.#D(this.#d[i],"expire")},a+1);e.unref&&e.unref()}},this.#A=i=>{t[i]=0!==e[i]?this.#l.now():0},this.#M=(r,n)=>{if(e[n]){let s=e[n],o=t[n];if(!s||!o)return;r.ttl=s,r.start=o,r.now=i||a();let l=r.now-o;r.remainingTTL=s-l}};let i=0,a=()=>{let e=this.#l.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=r=>{let n=this.#u.get(r);if(void 0===n)return 0;let s=e[n],o=t[n];return s&&o?s-((i||a())-o):1/0},this.#R=r=>{let n=t[r],s=e[r];return!!s&&!!n&&(i||a())-n>s}}#A=()=>{};#M=()=>{};#C=()=>{};#R=()=>!1;#E(){let e=new G(this.#t);this.#h=0,this.#y=e,this.#F=t=>{this.#h-=e[t],e[t]=0},this.#q=(e,t,i,a)=>{if(this.#P(t))return 0;if(!B(i))if(a){if("function"!=typeof a)throw TypeError("sizeCalculation must be a function");if(!B(i=a(t,e)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#V=(t,i,a)=>{if(e[t]=i,this.#i){let i=this.#i-e[t];for(;this.#h>i;)this.#N(!0)}this.#h+=e[t],a&&(a.entrySize=i,a.totalCalculatedSize=this.#h)}}#F=e=>{};#V=(e,t,i)=>{};#q=(e,t,i,a)=>{if(i||a)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#X({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#v;this.#W(t)&&((e||!this.#R(t))&&(yield t),t!==this.#m);)t=this.#f[t]}*#w({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#m;this.#W(t)&&((e||!this.#R(t))&&(yield t),t!==this.#v);)t=this.#O[t]}#W(e){return void 0!==e&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#X())void 0===this.#p[e]||void 0===this.#d[e]||this.#P(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*rentries(){for(let e of this.#w())void 0===this.#p[e]||void 0===this.#d[e]||this.#P(this.#p[e])||(yield[this.#d[e],this.#p[e]])}*keys(){for(let e of this.#X()){let t=this.#d[e];void 0===t||this.#P(this.#p[e])||(yield t)}}*rkeys(){for(let e of this.#w()){let t=this.#d[e];void 0===t||this.#P(this.#p[e])||(yield t)}}*values(){for(let e of this.#X())void 0===this.#p[e]||this.#P(this.#p[e])||(yield this.#p[e])}*rvalues(){for(let e of this.#w())void 0===this.#p[e]||this.#P(this.#p[e])||(yield this.#p[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#X()){let a=this.#p[i],r=this.#P(a)?a.__staleWhileFetching:a;if(void 0!==r&&e(r,this.#d[i],this))return this.get(this.#d[i],t)}}forEach(e,t=this){for(let i of this.#X()){let a=this.#p[i],r=this.#P(a)?a.__staleWhileFetching:a;void 0!==r&&e.call(t,r,this.#d[i],this)}}rforEach(e,t=this){for(let i of this.#w()){let a=this.#p[i],r=this.#P(a)?a.__staleWhileFetching:a;void 0!==r&&e.call(t,r,this.#d[i],this)}}purgeStale(){let e=!1;for(let t of this.#w({allowStale:!0}))this.#R(t)&&(this.#D(this.#d[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let i=this.#p[t],a=this.#P(i)?i.__staleWhileFetching:i;if(void 0===a)return;let r={value:a};if(this.#_&&this.#b){let e=this.#_[t],i=this.#b[t];e&&i&&(r.ttl=e-(this.#l.now()-i),r.start=Date.now())}return this.#y&&(r.size=this.#y[t]),r}dump(){let e=[];for(let t of this.#X({allowStale:!0})){let i=this.#d[t],a=this.#p[t],r=this.#P(a)?a.__staleWhileFetching:a;if(void 0===r||void 0===i)continue;let n={value:r};if(this.#_&&this.#b){n.ttl=this.#_[t];let e=this.#l.now()-this.#b[t];n.start=Math.floor(Date.now()-e)}this.#y&&(n.size=this.#y[t]),e.unshift([i,n])}return e}load(e){for(let[t,i]of(this.clear(),e)){if(i.start){let e=Date.now()-i.start;i.start=this.#l.now()-e}this.set(t,i.value,i)}}set(e,t,i={}){if(void 0===t)return this.delete(e),this;let{ttl:a=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:o}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#q(e,t,i.size||0,s);if(this.maxEntrySize&&c>this.maxEntrySize)return o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this.#D(e,"set"),this;let h=0===this.#c?void 0:this.#u.get(e);if(void 0===h)h=0===this.#c?this.#v:0!==this.#g.length?this.#g.pop():this.#c===this.#t?this.#N(!1):this.#c,this.#d[h]=e,this.#p[h]=t,this.#u.set(e,h),this.#O[this.#v]=h,this.#f[h]=this.#v,this.#v=h,this.#c++,this.#V(h,c,o),o&&(o.set="add"),l=!1,this.#k&&this.#r?.(t,e,"add");else{this.#x(h);let i=this.#p[h];if(t!==i){if(this.#Q&&this.#P(i)){i.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=i;void 0!==t&&!n&&(this.#T&&this.#a?.(t,e,"set"),this.#z&&this.#$?.push([t,e,"set"]))}else!n&&(this.#T&&this.#a?.(i,e,"set"),this.#z&&this.#$?.push([i,e,"set"]));if(this.#F(h),this.#V(h,c,o),this.#p[h]=t,o){o.set="replace";let e=i&&this.#P(i)?i.__staleWhileFetching:i;void 0!==e&&(o.oldValue=e)}}else o&&(o.set="update");this.#k&&this.onInsert?.(t,e,t===i?"update":"replace")}if(0===a||this.#_||this.#L(),this.#_&&(l||this.#C(h,a,r),o&&this.#M(o,h)),!n&&this.#z&&this.#$){let e,t=this.#$;for(;e=t?.shift();)this.#n?.(...e)}return this}pop(){try{for(;this.#c;){let e=this.#p[this.#m];if(this.#N(!0),this.#P(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#z&&this.#$){let e,t=this.#$;for(;e=t?.shift();)this.#n?.(...e)}}}#N(e){let t=this.#m,i=this.#d[t],a=this.#p[t];return this.#Q&&this.#P(a)?a.__abortController.abort(Error("evicted")):(this.#T||this.#z)&&(this.#T&&this.#a?.(a,i,"evict"),this.#z&&this.#$?.push([a,i,"evict"])),this.#F(t),e&&(this.#d[t]=void 0,this.#p[t]=void 0,this.#g.push(t)),1===this.#c?(this.#m=this.#v=0,this.#g.length=0):this.#m=this.#O[t],this.#u.delete(i),this.#c--,t}has(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:a}=t,r=this.#u.get(e);if(void 0!==r){let e=this.#p[r];if(this.#P(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#R(r))return i&&this.#A(r),a&&(a.has="hit",this.#M(a,r)),!0;a&&(a.has="stale",this.#M(a,r))}else a&&(a.has="miss");return!1}peek(e,t={}){let{allowStale:i=this.allowStale}=t,a=this.#u.get(e);if(void 0===a||!i&&this.#R(a))return;let r=this.#p[a];return this.#P(r)?r.__staleWhileFetching:r}#S(e,t,i,a){let r=void 0===t?void 0:this.#p[t];if(this.#P(r))return r;let n=new I,{signal:s}=i;s?.addEventListener("abort",()=>n.abort(s.reason),{signal:n.signal});let o={signal:n.signal,options:i,context:a},l=(a,r=!1)=>{let{aborted:s}=n.signal,l=i.ignoreFetchAbort&&void 0!==a;return(i.status&&(s&&!r?(i.status.fetchAborted=!0,i.status.fetchError=n.signal.reason,l&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),!s||l||r)?(this.#p[t]===u&&(void 0===a?void 0!==u.__staleWhileFetching?this.#p[t]=u.__staleWhileFetching:this.#D(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,a,o.options))),a):c(n.signal.reason)},c=a=>{let{aborted:r}=n.signal,s=r&&i.allowStaleOnFetchAbort,o=s||i.allowStaleOnFetchRejection,l=o||i.noDeleteOnFetchRejection;if(this.#p[t]===u&&(l&&void 0!==u.__staleWhileFetching?s||(this.#p[t]=u.__staleWhileFetching):this.#D(e,"fetch")),o)return i.status&&void 0!==u.__staleWhileFetching&&(i.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw a},h=(t,a)=>{let s=this.#s?.(e,r,o);s&&s instanceof Promise&&s.then(e=>t(void 0===e?void 0:e),a),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(t(void 0),i.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(h).then(l,e=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=e),c(e))),d=Object.assign(u,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return void 0===t?(this.set(e,d,{...o.options,status:void 0}),t=this.#u.get(e)):this.#p[t]=d,d}#P(e){return!!this.#Q&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof I}async fetch(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:o=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:O,forceRefresh:f=!1,status:m,signal:v}=t;if(!this.#Q)return m&&(m.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:a,noDeleteOnStaleGet:r,status:m});let g={allowStale:i,updateAgeOnGet:a,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:s,size:o,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:m,signal:v},$=this.#u.get(e);if(void 0===$){m&&(m.fetch="miss");let t=this.#S(e,$,g,O);return t.__returned=t}{let t=this.#p[$];if(this.#P(t)){let e=i&&void 0!==t.__staleWhileFetching;return m&&(m.fetch="inflight",e&&(m.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let r=this.#R($);if(!f&&!r)return m&&(m.fetch="hit"),this.#x($),a&&this.#A($),m&&this.#M(m,$),t;let n=this.#S(e,$,g,O),s=void 0!==n.__staleWhileFetching&&i;return m&&(m.fetch=r?"stale":"refresh",s&&r&&(m.returnedStale=!0)),s?n.__staleWhileFetching:n.__returned=n}}async forceFetch(e,t={}){let i=await this.fetch(e,t);if(void 0===i)throw Error("fetch() returned undefined");return i}memo(e,t={}){let i=this.#o;if(!i)throw Error("no memoMethod provided to constructor");let{context:a,forceRefresh:r,...n}=t,s=this.get(e,n);if(!r&&void 0!==s)return s;let o=i(e,s,{options:n,context:a});return this.set(e,o,n),o}get(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=t,s=this.#u.get(e);if(void 0!==s){let t=this.#p[s],o=this.#P(t);return(n&&this.#M(n,s),this.#R(s))?(n&&(n.get="stale"),o)?(n&&i&&void 0!==t.__staleWhileFetching&&(n.returnedStale=!0),i?t.__staleWhileFetching:void 0):(r||this.#D(e,"expire"),n&&i&&(n.returnedStale=!0),i?t:void 0):(n&&(n.get="hit"),o)?t.__staleWhileFetching:(this.#x(s),a&&this.#A(s),t)}n&&(n.get="miss")}#U(e,t){this.#f[t]=e,this.#O[e]=t}#x(e){e!==this.#v&&(e===this.#m?this.#m=this.#O[e]:this.#U(this.#f[e],this.#O[e]),this.#U(this.#v,e),this.#v=e)}delete(e){return this.#D(e,"delete")}#D(e,t){let i=!1;if(0!==this.#c){let a=this.#u.get(e);if(void 0!==a)if(i=!0,1===this.#c)this.#Y(t);else{this.#F(a);let i=this.#p[a];if(this.#P(i)?i.__abortController.abort(Error("deleted")):(this.#T||this.#z)&&(this.#T&&this.#a?.(i,e,t),this.#z&&this.#$?.push([i,e,t])),this.#u.delete(e),this.#d[a]=void 0,this.#p[a]=void 0,a===this.#v)this.#v=this.#f[a];else if(a===this.#m)this.#m=this.#O[a];else{let e=this.#f[a];this.#O[e]=this.#O[a];let t=this.#O[a];this.#f[t]=this.#f[a]}this.#c--,this.#g.push(a)}}if(this.#z&&this.#$?.length){let e,t=this.#$;for(;e=t?.shift();)this.#n?.(...e)}return i}clear(){return this.#Y("delete")}#Y(e){for(let t of this.#w({allowStale:!0})){let i=this.#p[t];if(this.#P(i))i.__abortController.abort(Error("deleted"));else{let a=this.#d[t];this.#T&&this.#a?.(i,a,e),this.#z&&this.#$?.push([i,a,e])}}if(this.#u.clear(),this.#p.fill(void 0),this.#d.fill(void 0),this.#_&&this.#b&&(this.#_.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#m=0,this.#v=0,this.#g.length=0,this.#h=0,this.#c=0,this.#z&&this.#$){let e,t=this.#$;for(;e=t?.shift();)this.#n?.(...e)}}}class K{constructor(e){this.lookbackInterval=432e5,this.httpMethod="POST",this.apiPrefix="/api/v1",this.fetchFn=(e,t)=>fetch(e,t),this.requestHeaders=new Headers,this.url=e.url?e.url:"",this.errorHandler=e.httpErrorHandler,e.lookbackInterval&&(this.lookbackInterval=e.lookbackInterval),e.fetchFn&&(this.fetchFn=e.fetchFn),e.httpMethod&&(this.httpMethod=e.httpMethod),e.apiPrefix&&(this.apiPrefix=e.apiPrefix),e.requestHeaders&&(this.requestHeaders=e.requestHeaders)}labelNames(e){let t=new Date,i=new Date(t.getTime()-this.lookbackInterval);if(void 0===e||""===e){let e=this.buildRequest(this.labelsEndpoint(),new URLSearchParams({start:i.toISOString(),end:t.toISOString()}));return this.fetchAPI(e.uri,{method:this.httpMethod,body:e.body}).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}return this.series(e).then(e=>{let t=new Set;for(let i of e)for(let[e]of Object.entries(i))"__name__"!==e&&t.add(e);return Array.from(t)})}labelValues(e,t,i){let a=new Date,r=new Date(a.getTime()-this.lookbackInterval);if(!t||0===t.length){let t=new URLSearchParams({start:r.toISOString(),end:a.toISOString()});return this.fetchAPI(`${this.labelValuesEndpoint().replace(/:name/gi,e)}?${t}`).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}return this.series(t,i,e).then(t=>{let i=new Set;for(let a of t)for(let[t,r]of Object.entries(a))"__name__"!==t&&t===e&&i.add(r);return Array.from(i)})}metricMetadata(){return this.fetchAPI(this.metricMetadataEndpoint()).catch(e=>(this.errorHandler&&this.errorHandler(e),{}))}series(e,t,i){let a=new Date,r=new Date(a.getTime()-this.lookbackInterval),n=this.buildRequest(this.seriesEndpoint(),new URLSearchParams({start:r.toISOString(),end:a.toISOString(),"match[]":function(e,t,i){if(!t||0===t.length)return e;let a="";for(let e of t){if(e.name===i||""===e.value)continue;let t="";switch(e.type){case 146:default:t="=";break;case 53:t="!=";break;case 148:t="!~";break;case 147:t="=~"}let r=`${e.name}${t}"${e.value}"`;a=""===a?r:`${a},${r}`}return`${e}{${a}}`}(e,t,i)}));return this.fetchAPI(n.uri,{method:this.httpMethod,body:n.body}).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}metricNames(){return this.labelValues("__name__")}flags(){return this.fetchAPI(this.flagsEndpoint()).catch(e=>(this.errorHandler&&this.errorHandler(e),{}))}fetchAPI(e,t){return t?t.headers=this.requestHeaders:t={headers:this.requestHeaders},this.fetchFn(this.url+e,t).then(e=>{if(!e.ok&&![400,422,503].includes(e.status))throw Error(e.statusText);return e}).then(e=>e.json()).then(e=>{if("error"===e.status)throw Error(void 0!==e.error?e.error:'missing "error" field in response JSON');if(void 0===e.data)throw Error('missing "data" field in response JSON');return e.data})}buildRequest(e,t){let i=e,a=t;return"GET"===this.httpMethod&&(i=`${i}?${t}`,a=null),{uri:i,body:a}}labelsEndpoint(){return`${this.apiPrefix}/labels`}labelValuesEndpoint(){return`${this.apiPrefix}/label/:name/values`}seriesEndpoint(){return`${this.apiPrefix}/series`}metricMetadataEndpoint(){return`${this.apiPrefix}/metadata`}flagsEndpoint(){return`${this.apiPrefix}/status/flags`}}class ee{constructor(e){let t={ttl:e&&e.maxAge?e.maxAge:3e5,ttlAutopurge:!0};this.completeAssociation=new J(t),this.metricMetadata={},this.labelValues=new J(t),this.labelNames=[],this.flags={},(null==e?void 0:e.initialMetricList)&&this.setLabelValues("__name__",e.initialMetricList)}setAssociations(e,t){t.forEach(t=>{let i=this.completeAssociation.get(e);for(let[a,r]of(i||(i=new Map,this.completeAssociation.set(e,i)),Object.entries(t))){if("__name__"===a)continue;let e=i.get(a);void 0===e?i.set(a,new Set([r])):e.add(r)}})}setFlags(e){this.flags=e}getFlags(){return this.flags}setMetricMetadata(e){this.metricMetadata=e}getMetricMetadata(){return this.metricMetadata}setLabelNames(e){this.labelNames=e}getLabelNames(e){if(!e||0===e.length)return this.labelNames;let t=this.completeAssociation.get(e);return t?Array.from(t.keys()):[]}setLabelValues(e,t){this.labelValues.set(e,t)}getLabelValues(e,t){if(!t||0===t.length)return this.labelValues.get(e)||[];let i=this.completeAssociation.get(t);if(i){let t=i.get(e);return t?Array.from(t):[]}return[]}}class et{constructor(e,t){this.client=e,this.cache=new ee(t)}labelNames(e){let t=this.cache.getLabelNames(e);return t&&t.length>0?Promise.resolve(t):void 0===e||""===e?this.client.labelNames().then(e=>(this.cache.setLabelNames(e),e)):this.series(e).then(()=>this.cache.getLabelNames(e))}labelValues(e,t){let i=this.cache.getLabelValues(e,t);return i&&i.length>0?Promise.resolve(i):void 0===t||""===t?this.client.labelValues(e).then(t=>(this.cache.setLabelValues(e,t),t)):this.series(t).then(()=>this.cache.getLabelValues(e,t))}metricMetadata(){let e=this.cache.getMetricMetadata();return e&&Object.keys(e).length>0?Promise.resolve(e):this.client.metricMetadata().then(e=>(this.cache.setMetricMetadata(e),e))}series(e){return this.client.series(e).then(t=>(this.cache.setAssociations(e,t),t))}metricNames(){return this.labelValues("__name__")}flags(){let e=this.cache.getFlags();return e&&Object.keys(e).length>0?Promise.resolve(e):this.client.flags().then(e=>(this.cache.setFlags(e),e))}}function ei(e){if(null==e?void 0:e.completeStrategy)return e.completeStrategy;if(null==e?void 0:e.remote){var t;return"function"==typeof(t=e.remote).labelNames&&"function"==typeof t.labelValues&&"function"==typeof t.metricMetadata&&"function"==typeof t.series&&"function"==typeof t.metricNames?new V(e.remote,e.maxMetricsMetadata):new V(new et(new K(e.remote),e.remote.cache),e.maxMetricsMetadata)}return new V}var ea=i(68799);class er{promQL(){return e=>{let t=new P(e.state);return t.analyze(),t.getDiagnostics()}}}(s=h||(h={})).PromQL="PromQL",s.MetricName="MetricName";class en{constructor(){this.complete=ei(),this.lint=new er,this.enableLinter=!0,this.enableCompletion=!0}setComplete(e){return this.complete=ei(e),this}getComplete(){return this.complete}activateCompletion(e){return this.enableCompletion=e,this}setLinter(e){return this.lint=e,this}getLinter(){return this.lint}activateLinter(e){return this.enableLinter=e,this}asExtension(e=h.PromQL){var t,i;let a=k.qp.define({parser:$.configure({top:e}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}}),r=[a];if(this.enableCompletion){let e=a.data.of({autocomplete:e=>this.complete.promQL(e)});r=r.concat(e)}return this.enableLinter&&(r=r.concat((t=this.lint.promQL,i=this.lint,(0,ea.ir)(t.call(i))))),r}}},78277:function(e,t,i){var a;t.default=void 0,t.default=(0,((a=i(30265))&&a.__esModule?a:{default:a}).default)("M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z","AlertCircle")},10763:function(e,t,i){var a;t.default=void 0,t.default=(0,((a=i(30265))&&a.__esModule?a:{default:a}).default)("M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z","Close")},96402:function(e,t,i){var a;t.default=void 0,t.default=(0,((a=i(30265))&&a.__esModule?a:{default:a}).default)("M3,3H9V7H3V3M15,10H21V14H15V10M15,17H21V21H15V17M13,13H7V18H13V20H7L5,20V9H7V11H13V13Z","FileTree")}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["8706"],{64001:function(e,r,a){a.d(r,{P:()=>ep});var t,n,i,s,o,c=a(24246),l=a(46359),d=a(91542),p=a(69485),u=a(94776),m=a(25283),v=a(68808),g=a(32964),y=a(75094),x=a(50898),h=a(96402),T=a(54538),j=a(19154),_=a(10763),f=a(72),b=a(17197),$=a(91909),w=a(36372),S=a(52054),Z=a(71852),E=a(2259),L=a(20791),k=a(78277),F=((t={}).aggregation="aggregation",t.binaryExpr="binaryExpr",t.call="call",t.matrixSelector="matrixSelector",t.subquery="subquery",t.numberLiteral="numberLiteral",t.parenExpr="parenExpr",t.stringLiteral="stringLiteral",t.unaryExpr="unaryExpr",t.vectorSelector="vectorSelector",t.placeholder="placeholder",t),q=((n={}).add="+",n.sub="-",n.mul="*",n.div="/",n.mod="%",n.pow="^",n.eql="==",n.neq="!=",n.gtr=">",n.lss="<",n.gte=">=",n.lte="<=",n.and="and",n.or="or",n.unless="unless",n.atan2="atan2",n),C=((i={}).oneToOne="one-to-one",i.manyToOne="many-to-one",i.oneToMany="one-to-many",i.manyToMany="many-to-many",i),P=((s={}).none="none",s.vector="vector",s.scalar="scalar",s.matrix="matrix",s.string="string",s),O=((o={}).equal="=",o.notEqual="!=",o.matchRegexp="=~",o.matchNotRegexp="!~",o);let R={[q.add]:3,[q.sub]:3,[q.mul]:2,[q.div]:2,[q.mod]:2,[q.pow]:1,[q.eql]:4,[q.neq]:4,[q.gtr]:4,[q.lss]:4,[q.gte]:4,[q.lte]:4,[q.and]:5,[q.or]:6,[q.unless]:5,[q.atan2]:2},M=(e,r)=>r.type!==F.binaryExpr||R[e]>R[r.op]?r:{type:F.parenExpr,expr:r},U=["topk","bottomk","quantile","count_values","limitk","limit_ratio"],K=e=>e.replace(/([\\"])/g,"\\$1");var B=a(12709),I=a(29085);let z=(0,B.ZP)("span")(()=>({fontFamily:'"DejaVu Sans Mono", monospace'})),V=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#e5c07b":"#708"}}),Q=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#61afef":"#2a2e42"}}),D=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#e06c75":"#2a2e42"}}),N=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#61afef":"#219"}}),A=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#98c379":"#a31515"}}),G=(0,B.ZP)("span")(()=>({color:"#aaaaaa"})),Y=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#e5c07b":"#09885a"}}),W=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#e5c07b":"#164"}}),X=(0,B.ZP)("span")(e=>{let{theme:r}=e;return{color:"dark"===r.palette.mode?"#56b6c2":"#708"}}),J=e=>e.map((e,r)=>(0,c.jsxs)("span",{children:[0!==r&&", ",(0,c.jsx)(N,{children:e})]},r)),H=(e,r,a)=>(0,c.jsxs)(c.Fragment,{children:[null!==e?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(X,{children:"@"})," ",(0,c.jsx)(W,{children:(e/1e3).toFixed(3)})]}):null!==r?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(X,{children:"@"})," ",(0,c.jsx)(V,{children:r}),(0,c.jsx)("span",{children:"("}),(0,c.jsx)("span",{children:")"})]}):(0,c.jsx)(c.Fragment,{}),0===a?(0,c.jsx)(c.Fragment,{}):a>0?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(V,{children:"offset"})," ",(0,c.jsx)(Y,{children:(0,I.LU)((0,I.oK)(a))})]}):(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(V,{children:"offset"})," ",(0,c.jsxs)(Y,{children:["-",(0,I.LU)((0,I.oK)(-a))]})]})]}),ee=(0,c.jsx)(G,{children:"…"}),er=(e,r,a)=>(0,c.jsx)(z,{children:((e,r,a)=>{if(0===a)return ee;let t=void 0===a?void 0:a-1;switch(e.type){case F.aggregation:return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(X,{children:e.op}),e.without?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(V,{children:"without"}),(0,c.jsx)("span",{children:"("}),J(e.grouping),(0,c.jsx)("span",{children:")"})," "]}):e.grouping.length>0&&(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(V,{children:"by"}),(0,c.jsx)("span",{children:"("}),J(e.grouping),(0,c.jsx)("span",{children:")"})," "]}),r&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{children:"("}),null!==e.param&&(0,c.jsxs)(c.Fragment,{children:[er(e.param,r,t),", "]}),er(e.expr,r,t),(0,c.jsx)("span",{children:")"})]})]});case F.subquery:return(0,c.jsxs)(c.Fragment,{children:[r&&er(e.expr,r,t),"[",(0,c.jsx)(Y,{children:(0,I.LU)((0,I.oK)(e.range))}),":",0!==e.step&&(0,c.jsx)(Y,{children:(0,I.LU)((0,I.oK)(e.step))}),"]",H(e.timestamp,e.startOrEnd,e.offset)]});case F.parenExpr:return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{children:"("}),r&&er(e.expr,r,t),(0,c.jsx)("span",{children:")"})]});case F.call:{let a=void 0===t||t>0?e.args.map((e,a)=>(0,c.jsxs)("span",{children:[0!==a&&", ",er(e,r)]},a)):e.args.length>0?ee:"";return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Q,{children:e.func.name}),r&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{children:"("}),a,(0,c.jsx)("span",{children:")"})]})]})}case F.matrixSelector:case F.vectorSelector:let n=e.matchers.filter(r=>"__name__"!==r.name||r.type!==O.equal||r.value!==e.name).map((e,r)=>(0,c.jsxs)("span",{children:[0!==r&&",",(0,c.jsx)(N,{children:e.name}),e.type,(0,c.jsxs)(A,{children:['"',K(e.value),'"']})]},r));return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(D,{children:e.name}),n.length>0&&(0,c.jsxs)(c.Fragment,{children:["{",(0,c.jsx)("span",{children:n}),"}"]}),e.type===F.matrixSelector&&(0,c.jsxs)(c.Fragment,{children:["[",(0,c.jsx)(Y,{children:(0,I.LU)((0,I.oK)(e.range))}),"]"]}),H(e.timestamp,e.startOrEnd,e.offset)]});case F.numberLiteral:return(0,c.jsx)(W,{children:e.val});case F.stringLiteral:return(0,c.jsxs)(A,{children:['"',K(e.val),'"']});case F.unaryExpr:return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(X,{children:e.op}),r&&er(e.expr,r,t)]});case F.binaryExpr:{let a=(0,c.jsx)(c.Fragment,{}),n=(0,c.jsx)(c.Fragment,{}),i=e.matching;return null!==i&&(i.labels.length>0||i.on)&&(a=i.on?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(V,{children:"on"}),(0,c.jsx)("span",{children:"("}),J(i.labels),(0,c.jsx)("span",{children:")"})]}):(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(V,{children:"ignoring"}),(0,c.jsx)("span",{children:"("}),J(i.labels),(0,c.jsx)("span",{children:")"})]}),(i.card===C.manyToOne||i.card===C.oneToMany)&&(n=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(V,{children:[" ","group_",i.card===C.manyToOne?"left":"right"]}),(0,c.jsx)("span",{children:"("}),J(i.include),(0,c.jsx)("span",{children:")"})]}))),(0,c.jsxs)(c.Fragment,{children:[r&&er(M(e.op,e.lhs),r,t)," ",(["atan2","and","or","unless"].includes(e.op),(0,c.jsx)(X,{children:e.op})),e.bool&&(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)(V,{children:"bool"})]}),a,n," ",r&&er(M(e.op,e.rhs),r,t)]})}case F.placeholder:return ee;default:throw Error("unsupported node type")}})(e,r,a)}),ea=(e,r,a)=>`${null!==e?` @ ${(e/1e3).toFixed(3)}`:null!==r?` @ ${r}()`:""}${0===a?"":a>0?` offset ${(0,I.LU)((0,I.oK)(a))}`:` offset -${(0,I.LU)((0,I.oK)(-a))}`}`,et=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=!(arguments.length>3)||void 0===arguments[3]||arguments[3],n=a?"\n":"",i=a?"\n":" ",s=r+2,o=a?" ".repeat(r):"",c=t?o:"";switch(e.type){case F.aggregation:return`${c}${e.op}${e.without?` without(${e.grouping.join(", ")}) `:e.grouping.length>0?` by(${e.grouping.join(", ")}) `:""}(${n}${U.includes(e.op)&&null!==e.param?`${et(e.param,s,a)},${i}`:""}${et(e.expr,s,a)}${n}${o})`;case F.subquery:return`${c}${et(e.expr,r,a)}[${(0,I.LU)((0,I.oK)(e.range))}:${0!==e.step?(0,I.LU)((0,I.oK)(e.step)):""}]${ea(e.timestamp,e.startOrEnd,e.offset)}`;case F.parenExpr:return`${c}(${n}${et(e.expr,s,a)}${n}${o})`;case F.call:{let r=e.args.length>0?n:"";return`${c}${e.func.name}(${r}${e.args.map(e=>et(e,s,a)).join(","+i)}${r}${e.args.length>0?o:""})`}case F.matrixSelector:case F.vectorSelector:return`${c}${(e=>{let r=e.matchers.filter(r=>"__name__"!==r.name||r.type!==O.equal||r.value!==e.name).map(e=>`${e.name}${e.type}"${K(e.value)}"`),a=e.type===F.matrixSelector?`[${(0,I.LU)((0,I.oK)(e.range))}]`:"",t=ea(e.timestamp,e.startOrEnd,e.offset);return`${e.name}${r.length>0?`{${r.join(",")}}`:""}${a}${t}`})(e)}`;case F.numberLiteral:return`${c}${e.val}`;case F.stringLiteral:return`${c}"${K(e.val)}"`;case F.unaryExpr:return`${c}${e.op}${et(e.expr,r,a,!1)}`;case F.binaryExpr:{let r="",t="",n=e.matching;return null!==n&&(n.labels.length>0||n.on)&&(r=n.on?` on(${n.labels.join(", ")})`:` ignoring(${n.labels.join(", ")})`,(n.card===C.manyToOne||n.card===C.oneToMany)&&(t=` group_${n.card===C.manyToOne?"left":"right"}(${n.include.join(",")})`)),`${et(M(e.op,e.lhs),s,a)}${i}${o}${e.op}${e.bool?" bool":""}${r}${t}${i}${et(M(e.op,e.rhs),s,a)}`}case F.placeholder:return`${c}\u{2026}${e.children.length>0?`(${n}${e.children.map(e=>et(e,s,a)).join(","+i)}${n}${o})`:""}`;default:throw Error("unsupported node type")}},en={abs:{name:"abs",argTypes:[P.vector],variadic:0,returnType:P.vector},absent:{name:"absent",argTypes:[P.vector],variadic:0,returnType:P.vector},absent_over_time:{name:"absent_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},acos:{name:"acos",argTypes:[P.vector],variadic:0,returnType:P.vector},acosh:{name:"acosh",argTypes:[P.vector],variadic:0,returnType:P.vector},asin:{name:"asin",argTypes:[P.vector],variadic:0,returnType:P.vector},asinh:{name:"asinh",argTypes:[P.vector],variadic:0,returnType:P.vector},atan:{name:"atan",argTypes:[P.vector],variadic:0,returnType:P.vector},atanh:{name:"atanh",argTypes:[P.vector],variadic:0,returnType:P.vector},avg_over_time:{name:"avg_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},ceil:{name:"ceil",argTypes:[P.vector],variadic:0,returnType:P.vector},changes:{name:"changes",argTypes:[P.matrix],variadic:0,returnType:P.vector},clamp:{name:"clamp",argTypes:[P.vector,P.scalar,P.scalar],variadic:0,returnType:P.vector},clamp_max:{name:"clamp_max",argTypes:[P.vector,P.scalar],variadic:0,returnType:P.vector},clamp_min:{name:"clamp_min",argTypes:[P.vector,P.scalar],variadic:0,returnType:P.vector},cos:{name:"cos",argTypes:[P.vector],variadic:0,returnType:P.vector},cosh:{name:"cosh",argTypes:[P.vector],variadic:0,returnType:P.vector},count_over_time:{name:"count_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},day_of_month:{name:"day_of_month",argTypes:[P.vector],variadic:1,returnType:P.vector},day_of_week:{name:"day_of_week",argTypes:[P.vector],variadic:1,returnType:P.vector},day_of_year:{name:"day_of_year",argTypes:[P.vector],variadic:1,returnType:P.vector},days_in_month:{name:"days_in_month",argTypes:[P.vector],variadic:1,returnType:P.vector},deg:{name:"deg",argTypes:[P.vector],variadic:0,returnType:P.vector},delta:{name:"delta",argTypes:[P.matrix],variadic:0,returnType:P.vector},deriv:{name:"deriv",argTypes:[P.matrix],variadic:0,returnType:P.vector},exp:{name:"exp",argTypes:[P.vector],variadic:0,returnType:P.vector},floor:{name:"floor",argTypes:[P.vector],variadic:0,returnType:P.vector},histogram_avg:{name:"histogram_avg",argTypes:[P.vector],variadic:0,returnType:P.vector},histogram_count:{name:"histogram_count",argTypes:[P.vector],variadic:0,returnType:P.vector},histogram_fraction:{name:"histogram_fraction",argTypes:[P.scalar,P.scalar,P.vector],variadic:0,returnType:P.vector},histogram_quantile:{name:"histogram_quantile",argTypes:[P.scalar,P.vector],variadic:0,returnType:P.vector},histogram_stddev:{name:"histogram_stddev",argTypes:[P.vector],variadic:0,returnType:P.vector},histogram_stdvar:{name:"histogram_stdvar",argTypes:[P.vector],variadic:0,returnType:P.vector},histogram_sum:{name:"histogram_sum",argTypes:[P.vector],variadic:0,returnType:P.vector},double_exponential_smoothing:{name:"double_exponential_smoothing",argTypes:[P.matrix,P.scalar,P.scalar],variadic:0,returnType:P.vector},hour:{name:"hour",argTypes:[P.vector],variadic:1,returnType:P.vector},idelta:{name:"idelta",argTypes:[P.matrix],variadic:0,returnType:P.vector},increase:{name:"increase",argTypes:[P.matrix],variadic:0,returnType:P.vector},irate:{name:"irate",argTypes:[P.matrix],variadic:0,returnType:P.vector},label_join:{name:"label_join",argTypes:[P.vector,P.string,P.string,P.string],variadic:-1,returnType:P.vector},label_replace:{name:"label_replace",argTypes:[P.vector,P.string,P.string,P.string,P.string],variadic:0,returnType:P.vector},last_over_time:{name:"last_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},ln:{name:"ln",argTypes:[P.vector],variadic:0,returnType:P.vector},log10:{name:"log10",argTypes:[P.vector],variadic:0,returnType:P.vector},log2:{name:"log2",argTypes:[P.vector],variadic:0,returnType:P.vector},mad_over_time:{name:"mad_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},max_over_time:{name:"max_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},min_over_time:{name:"min_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},minute:{name:"minute",argTypes:[P.vector],variadic:1,returnType:P.vector},month:{name:"month",argTypes:[P.vector],variadic:1,returnType:P.vector},pi:{name:"pi",argTypes:[],variadic:0,returnType:P.scalar},predict_linear:{name:"predict_linear",argTypes:[P.matrix,P.scalar],variadic:0,returnType:P.vector},present_over_time:{name:"present_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},quantile_over_time:{name:"quantile_over_time",argTypes:[P.scalar,P.matrix],variadic:0,returnType:P.vector},rad:{name:"rad",argTypes:[P.vector],variadic:0,returnType:P.vector},rate:{name:"rate",argTypes:[P.matrix],variadic:0,returnType:P.vector},resets:{name:"resets",argTypes:[P.matrix],variadic:0,returnType:P.vector},round:{name:"round",argTypes:[P.vector,P.scalar],variadic:1,returnType:P.vector},scalar:{name:"scalar",argTypes:[P.vector],variadic:0,returnType:P.scalar},sgn:{name:"sgn",argTypes:[P.vector],variadic:0,returnType:P.vector},sin:{name:"sin",argTypes:[P.vector],variadic:0,returnType:P.vector},sinh:{name:"sinh",argTypes:[P.vector],variadic:0,returnType:P.vector},sort:{name:"sort",argTypes:[P.vector],variadic:0,returnType:P.vector},sort_by_label:{name:"sort_by_label",argTypes:[P.vector,P.string],variadic:-1,returnType:P.vector},sort_by_label_desc:{name:"sort_by_label_desc",argTypes:[P.vector,P.string],variadic:-1,returnType:P.vector},sort_desc:{name:"sort_desc",argTypes:[P.vector],variadic:0,returnType:P.vector},sqrt:{name:"sqrt",argTypes:[P.vector],variadic:0,returnType:P.vector},stddev_over_time:{name:"stddev_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},stdvar_over_time:{name:"stdvar_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},sum_over_time:{name:"sum_over_time",argTypes:[P.matrix],variadic:0,returnType:P.vector},tan:{name:"tan",argTypes:[P.vector],variadic:0,returnType:P.vector},tanh:{name:"tanh",argTypes:[P.vector],variadic:0,returnType:P.vector},time:{name:"time",argTypes:[],variadic:0,returnType:P.scalar},timestamp:{name:"timestamp",argTypes:[P.vector],variadic:0,returnType:P.vector},vector:{name:"vector",argTypes:[P.scalar],variadic:0,returnType:P.vector},year:{name:"year",argTypes:[P.vector],variadic:1,returnType:P.vector}};function ei(e){let{node:r,parentEl:a,reverse:t,datasource:n,childIdx:i,reportNodeState:s}=e,o=(0,u.Z)(),l=(e=>{switch(e.type){case F.aggregation:return null===e.param?[e.expr]:[e.param,e.expr];case F.subquery:case F.parenExpr:return[e.expr];case F.call:return e.args;case F.matrixSelector:case F.vectorSelector:case F.numberLiteral:case F.stringLiteral:return[];case F.placeholder:return e.children;case F.unaryExpr:return[e.expr];case F.binaryExpr:return[e.lhs,e.rhs];default:throw Error("unsupported node type")}})(r),[d,p]=(0,T.useState)(null),v=(0,T.useCallback)(e=>p(e),[]),[g,y]=(0,T.useState)({numSeries:0,labelExamples:{},sortedLabelCards:[]}),[x,h]=(0,T.useState)({borderColor:o.palette.grey["500"],borderLeftStyle:"solid",borderLeftWidth:2,width:25,left:-25}),[j,_]=(0,T.useState)(l.map(()=>"waiting")),b=(0,T.useMemo)(()=>j.includes("error")?"error":j.includes("waiting")?"waiting":j.includes("running")?"running":"success",[j]),S=r;S.type===F.matrixSelector&&(S={type:F.call,func:en.last_over_time,args:[r]});let{data:Z,isFetching:E,error:L}=function(e,r,a){let{data:t}=(0,f.useDatasourceClient)(r);return(0,$.useQuery)({enabled:!!t&&a,queryKey:["instantQuery",e,"datasource",r.kind],queryFn:async()=>{let r=performance.now(),a=await t.instantQuery({query:e}),n=performance.now()-r;return{...a,responseTime:n}}})}(et(S)??"",n,"success"===b);(0,T.useEffect)(()=>{s&&("error"===b||L?s(i,"error"):E&&s(i,"running"))},[b,L,E,s,i]);let k=(0,T.useCallback)((e,r)=>{_(a=>{let t=[...a];return t[e]=r,t})},[_]);(0,T.useLayoutEffect)(()=>{if(void 0===a||null===a||null===d)return;let e=a.getBoundingClientRect(),r=d.getBoundingClientRect();t?h(a=>({...a,top:"calc(50% - 1px)",bottom:r.bottom-e.top,borderTopLeftRadius:10,borderTopStyle:"solid",borderBottomLeftRadius:void 0})):h(a=>({...a,top:e.bottom-r.top,bottom:"calc(50% - 1px)",borderBottomLeftRadius:10,borderBottomStyle:"solid",borderTopLeftRadius:void 0}))},[a,d,t,v,h]),(0,T.useEffect)(()=>{if((null==Z?void 0:Z.status)!=="success")return;s&&s(i,"success");let e=0,r={},{resultType:a,result:t}=Z.data;"scalar"===a||"string"===a?e=1:t&&t.length>0&&(e=t.length,t.forEach(e=>{Object.entries(e.metric).forEach(e=>{let[a,t]=e;"__name__"!==a&&(r[a]=r[a]??{},r[a][t]=(r[a][t]??0)+1)})}));let n={},o={};Object.entries(r).forEach(e=>{let[r,a]=e;n[r]=Object.keys(a).length,o[r]=Object.entries(a).sort((e,r)=>{let[,a]=e,[,t]=r;return t-a}).slice(0,10).map(e=>{let[r,a]=e;return{value:r,count:a}})}),y({numSeries:e,sortedLabelCards:Object.entries(n).sort((e,r)=>r[1]-e[1]),labelExamples:o})},[Z,s,i]);let q=(0,c.jsxs)(m.Z,{direction:"row",gap:2,children:[(0,c.jsxs)(w.Z,{ref:v,sx:{position:"relative",display:"inline-block",padding:1,marginBottom:1.5,borderRadius:2,backgroundColor:o.palette.background.code},children:[void 0!==a&&(0,c.jsx)(w.Z,{sx:{position:"absolute",display:"inline-block",...x}}),er(r,!1,1)]}),(0,c.jsx)(es,{mergedChildState:b,isFetching:E,error:L,resultStats:g,responseTime:null==Z?void 0:Z.responseTime})]});return r.type===F.binaryExpr?(0,c.jsxs)("div",{children:[(0,c.jsx)(w.Z,{ml:5,children:(0,c.jsx)(ei,{node:l[0],parentEl:d,reverse:!0,datasource:n,childIdx:0,reportNodeState:k})}),q,(0,c.jsx)(w.Z,{ml:5,children:(0,c.jsx)(ei,{node:l[1],parentEl:d,reverse:!1,datasource:n,childIdx:1,reportNodeState:k})})]}):(0,c.jsxs)("div",{children:[q,l.map((e,r)=>(0,c.jsx)(w.Z,{ml:5,children:(0,c.jsx)(ei,{node:e,parentEl:d,reverse:!1,datasource:n,childIdx:r,reportNodeState:k})},r))]})}function es(e){let{mergedChildState:r,isFetching:a,error:t,resultStats:n,responseTime:i}=e;return"waiting"===r?(0,c.jsx)(eo,{text:"Waiting for child query"}):"running"===r?(0,c.jsx)(eo,{text:"Running"}):"error"===r?(0,c.jsxs)(m.Z,{children:[(0,c.jsx)(k.default,{}),"Blocked on child query error"]}):a?(0,c.jsx)(eo,{text:"Loading"}):t?(0,c.jsxs)(w.Z,{display:"flex",alignItems:"center",gap:1,sx:{color:e=>e.palette.error.main},marginBottom:1.5,children:[(0,c.jsx)(k.default,{}),(0,c.jsxs)(S.Z,{variant:"body2",children:[(0,c.jsx)("strong",{children:"Error executing query:"})," ",t.message]})]}):(0,c.jsxs)(m.Z,{direction:"row",gap:1,alignItems:"center",marginBottom:1.5,children:[(0,c.jsxs)(S.Z,{variant:"body2",component:"span",sx:{color:e=>e.palette.grey[500]},children:[n.numSeries," result",1!==n.numSeries&&"s","\xa0\xa0–\xa0\xa0",i?`${Math.round(i)}ms`:"? ms",n.sortedLabelCards.length>0&&(0,c.jsx)(c.Fragment,{children:"\xa0\xa0–"})]}),n.sortedLabelCards.slice(0,10).map(e=>{var r;let[a,t]=e;return(0,c.jsx)(g.Z,{title:(0,c.jsx)(w.Z,{children:(0,c.jsxs)(Z.Z,{dense:!0,children:[null==(r=n.labelExamples[a])?void 0:r.map(e=>{let{value:r,count:a}=e;return(0,c.jsxs)(E.ZP,{sx:{display:"flex",gap:1,py:0,px:.5},children:[(0,c.jsx)(L.default,{sx:{fontSize:8}}),(0,c.jsx)(S.Z,{variant:"body2",component:"span",sx:{color:e=>"dark"===e.palette.mode?e.palette.warning.dark:e.palette.warning.main,fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexGrow:1},children:K(r)}),(0,c.jsxs)(S.Z,{variant:"body2",component:"span",sx:{whiteSpace:"nowrap",flexShrink:0},children:["(",a,"x)"]})]},r)}),t>10&&(0,c.jsxs)(E.ZP,{sx:{display:"flex",gap:1,py:0,px:.5},children:[(0,c.jsx)(L.default,{sx:{fontSize:8}}),(0,c.jsx)(S.Z,{variant:"body2",children:". . ."})]})]})}),arrow:!0,children:(0,c.jsxs)("span",{style:{cursor:"pointer",whiteSpace:"nowrap"},children:[(0,c.jsx)(S.Z,{variant:"body2",component:"span",sx:{fontFamily:"monospace",color:e=>e.palette.success.main},children:a}),(0,c.jsxs)(S.Z,{variant:"body2",component:"span",sx:{color:e=>e.palette.grey[500]},children:[": ",t]})]})},a)}),n.sortedLabelCards.length>10?(0,c.jsxs)(S.Z,{variant:"body2",children:["...",n.sortedLabelCards.length-10," more..."]}):null]})}function eo(e){let{text:r}=e;return(0,c.jsxs)(w.Z,{display:"flex",alignItems:"center",gap:1,marginBottom:1.5,children:[(0,c.jsx)(x.Z,{size:16,color:"secondary"}),(0,c.jsxs)(S.Z,{variant:"body2",color:"text.secondary",children:[r,"..."]})]})}let ec="Tree View",el="Open "+ec,ed="Close "+ec;function ep(e){let{completeConfig:r,datasource:a,isReadOnly:t,...n}=e,i=(0,u.Z)(),s="dark"===i.palette.mode,[o,w]=(0,T.useState)(!1),S=(0,T.useMemo)(()=>new d.q9().activateLinter(!1).setComplete(r).asExtension(),[r]),Z=(0,f.useReplaceVariablesInString)(n.value);Z&&(Z=(0,b.d)(Z,12345,12345));let{data:E,isLoading:L,error:k}=function(e,r,a){let{data:t}=(0,f.useDatasourceClient)(r);return(0,$.useQuery)({enabled:!!t&&a,queryKey:["parseQuery",e,"datasource",r],queryFn:async()=>await t.parseQuery({query:e})})}(Z??"",a,o);return(0,c.jsxs)(m.Z,{position:"relative",children:[(0,c.jsx)(v.Z,{shrink:!0,sx:{position:"absolute",top:"-12px",left:"10px",padding:"0 4px",color:i.palette.text.primary,zIndex:1},children:"PromQL Expression"}),(0,c.jsx)(l.ZP,{"data-testid":"promql_expression_editor",...n,style:{border:`1px solid ${i.palette.divider}`},theme:s?"dark":"light",readOnly:t??!1,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1,foldGutter:!1},extensions:[p.tk.lineWrapping,S,p.tk.theme({".cm-content":{paddingTop:"8px",paddingBottom:"8px",paddingRight:"40px"}})],placeholder:"Example: sum(rate(http_requests_total[5m]))"}),Z&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(g.Z,{title:o?ed:el,children:(0,c.jsx)(y.Z,{"aria-label":o?ed:el,onClick:()=>{w(!o)},sx:{position:"absolute",right:"5px",top:"5px"},size:"small",children:(0,c.jsx)(h.default,{sx:{fontSize:"18px"}})},"tree-view-button")}),o&&(0,c.jsxs)("div",{style:{border:`1px solid ${i.palette.divider}`,position:"relative"},children:[(0,c.jsx)(g.Z,{title:ed,children:(0,c.jsx)(y.Z,{"aria-label":ed,onClick:()=>w(!1),sx:{position:"absolute",top:"5px",right:"5px"},size:"small",children:(0,c.jsx)(_.default,{sx:{fontSize:"18px"}})},"tree-view-close-button")}),k?(0,c.jsx)(j.ErrorAlert,{error:{name:`${ec} not available`,message:k.message}}):(0,c.jsx)("div",{style:{padding:`${i.spacing(1.5)} ${i.spacing(1.5)} 0 ${i.spacing(1.5)}`,overflowX:"auto",backgroundColor:i.palette.background.default},children:L?(0,c.jsx)(x.Z,{}):(null==E?void 0:E.data)?(0,c.jsx)(ei,{node:E.data,reverse:!1,childIdx:0,datasource:a}):null})]})]})]})}},99176:function(e,r,a){function t(e){let[r,a]=e;return[1e3*r,function(e){let r;switch(e){case"+Inf":r=1/0;break;case"-Inf":r=-1/0;break;default:r=parseFloat(e)}return r}(a)]}a.d(r,{Mm:()=>x.Mm,nY:()=>x.nY,k7:()=>f,wd:()=>_,Nr:()=>s,mB:()=>u,Bf:()=>j,PL:()=>l,c4:()=>i,Fp:()=>o,Rv:()=>x.Rv,sv:()=>x.sv,ac:()=>p,mY:()=>c,qJ:()=>t,X2:()=>d});var n=a(35015);function i(e){return async()=>{let r=`${e.datasourceUrl}/-/healthy`;try{let a=await (0,n.he)(r,{headers:e.headers,signal:e.abortSignal});return 200===a.status}catch{return!1}}}function s(e,r){return v("/api/v1/query",e,r)}function o(e,r){return v("/api/v1/query_range",e,r)}function c(e,r){return v("/api/v1/labels",e,r)}function l(e,r){let{labelName:a,...t}=e;return 0===a.length?new Promise(e=>{e({data:[]})}):m(`/api/v1/label/${encodeURIComponent(a)}/values`,t,r)}function d(e,r){return m("/api/v1/metadata",e,r)}function p(e,r){return v("/api/v1/series",e,r)}function u(e,r){return v("/api/v1/parse_query",e,r)}function m(e,r,a){let{datasourceUrl:t,headers:i}=a,s=`${t}${e}`,o=g(r).toString();return""!==o&&(s+=`?${o}`),(0,n.rd)(s,{method:"GET",headers:i})}function v(e,r,a){let{datasourceUrl:t,headers:n,abortSignal:i}=a;return y(`${t}${e}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...n},signal:i,body:g(r)})}function g(e){let r=new URLSearchParams;for(let a in e){let t=e[a];if(void 0!==t){if("string"==typeof t){r.append(a,t);continue}if("number"==typeof t){r.append(a,t.toString());continue}for(let e of t)r.append(a,e)}}return r}async function y(){for(var e=arguments.length,r=Array(e),a=0;a<e;a++)r[a]=arguments[a];let t=await (0,n.he)(...r);return{...await t.json(),rawResponse:t}}var x=a(21969),h=a(29085),T=a(20461);function j(e){let{start:r,end:a}=e;return{start:Math.ceil((0,T.getUnixTime)(r)),end:Math.ceil((0,T.getUnixTime)(a))}}function _(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=(e.end-e.start)/1e4;return n>1&&(n=Math.ceil(n)),Math.max(t/1e3*a,r,n)}function f(e){if(!e)return;let r=(0,h.Ib)(e);return Math.floor((0,T.milliseconds)(r)/1e3)}},21969:function(e,r,a){a.d(r,{Mm:()=>i,Rv:()=>s,nY:()=>n,sv:()=>o});var t=a(72);let n="PrometheusDatasource",i={kind:n};function s(e){return!(0,t.isVariableDatasource)(e)&&void 0===e.name}function o(e){return(0,t.isVariableDatasource)(e)||e.kind===n}},17197:function(e,r,a){a.d(r,{d:()=>i});var t=a(72),n=a(29085);function i(e,r,a){let i=(0,t.replaceVariable)(e,"__interval_ms",a.toString());i=(0,t.replaceVariable)(i,"__interval",(0,n.LU)((0,n.oK)(a)));let s=Math.max(a+r,4*r);return(0,t.replaceVariable)(i,"__rate_interval",(0,n.LU)((0,n.oK)(s)))}}}]);
@@ -1 +1 @@
1
- "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["2675"],{32964:function(e,t,o){o.d(t,{Z:()=>k});var r=o(54538),p=o(90496),n=o(47126),a=o(82267),i=o(16838),l=o(6595),s=o(74111),c=o(94680),m=o(12709),u=o(94776),d=o(82319),g=o(51751),h=o(51640),f=o(23382),Z=o(75651),y=o(67151),w=o(51183),v=o(56839),b=o(18817),x=o(16351),T=o(87143),R=o(24246);let $=(0,m.ZP)(Z.Z,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.popper,!o.disableInteractive&&t.popperInteractive,o.arrow&&t.popperArrow,!o.open&&t.popperClose]}})((0,d.Z)(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:e})=>!e.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:e})=>!e,style:{pointerEvents:"none"}},{props:({ownerState:e})=>e.arrow,style:{[`&[data-popper-placement*="bottom"] .${T.Z.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${T.Z.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${T.Z.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${T.Z.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="right"] .${T.Z.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="right"] .${T.Z.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="left"] .${T.Z.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="left"] .${T.Z.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),L=(0,m.ZP)("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.tooltip,o.touch&&t.touch,o.arrow&&t.tooltipArrow,t[`tooltipPlacement${(0,h.Z)(o.placement.split("-")[0])}`]]}})((0,d.Z)(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:(0,i.Fq)(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${T.Z.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${T.Z.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:e})=>e.arrow,style:{position:"relative",margin:0}},{props:({ownerState:e})=>e.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${Math.round(16/14*1e5)/1e5}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:e})=>!e.isRtl,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:e})=>!e.isRtl&&e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:e})=>!!e.isRtl,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:e})=>!!e.isRtl&&e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),M=(0,m.ZP)("span",{name:"MuiTooltip",slot:"Arrow",overridesResolver:(e,t)=>t.arrow})((0,d.Z)(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:(0,i.Fq)(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}}))),O=!1,P=new n.V,E={x:0,y:0};function S(e,t){return(o,...r)=>{t&&t(o,...r),e(o,...r)}}let k=r.forwardRef(function(e,t){let o=(0,g.i)({props:e,name:"MuiTooltip"}),{arrow:i=!1,children:m,classes:d,components:k={},componentsProps:W={},describeChild:A=!1,disableFocusListener:C=!1,disableHoverListener:B=!1,disableInteractive:F=!1,disableTouchListener:I=!1,enterDelay:N=100,enterNextDelay:j=0,enterTouchDelay:z=700,followCursor:U=!1,id:_,leaveDelay:V=0,leaveTouchDelay:q=1500,onClose:Q,onOpen:H,open:X,placement:Y="bottom",PopperComponent:D,PopperProps:G={},slotProps:J={},slots:K={},title:ee,TransitionComponent:et,TransitionProps:eo,...er}=o,ep=r.isValidElement(m)?m:(0,R.jsx)("span",{children:m}),en=(0,u.Z)(),ea=(0,l.V)(),[ei,el]=r.useState(),[es,ec]=r.useState(null),em=r.useRef(!1),eu=F||U,ed=(0,n.Z)(),eg=(0,n.Z)(),eh=(0,n.Z)(),ef=(0,n.Z)(),[eZ,ey]=(0,b.Z)({controlled:X,default:!1,name:"Tooltip",state:"open"}),ew=eZ,ev=(0,v.Z)(_),eb=r.useRef(),ex=(0,y.Z)(()=>{void 0!==eb.current&&(document.body.style.WebkitUserSelect=eb.current,eb.current=void 0),ef.clear()});r.useEffect(()=>ex,[ex]);let eT=e=>{P.clear(),O=!0,ey(!0),H&&!ew&&H(e)},eR=(0,y.Z)(e=>{P.start(800+V,()=>{O=!1}),ey(!1),Q&&ew&&Q(e),ed.start(en.transitions.duration.shortest,()=>{em.current=!1})}),e$=e=>{em.current&&"touchstart"!==e.type||(ei&&ei.removeAttribute("title"),eg.clear(),eh.clear(),N||O&&j?eg.start(O?j:N,()=>{eT(e)}):eT(e))},eL=e=>{eg.clear(),eh.start(V,()=>{eR(e)})},[,eM]=r.useState(!1),eO=e=>{(0,s.Z)(e.target)||(eM(!1),eL(e))},eP=e=>{ei||el(e.currentTarget),(0,s.Z)(e.target)&&(eM(!0),e$(e))},eE=e=>{em.current=!0;let t=ep.props;t.onTouchStart&&t.onTouchStart(e)};r.useEffect(()=>{if(ew)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){"Escape"===e.key&&eR(e)}},[eR,ew]);let eS=(0,w.Z)((0,c.Z)(ep),el,t);ee||0===ee||(ew=!1);let ek=r.useRef(),eW={},eA="string"==typeof ee;A?(eW.title=ew||!eA||B?null:ee,eW["aria-describedby"]=ew?ev:null):(eW["aria-label"]=eA?ee:null,eW["aria-labelledby"]=ew&&!eA?ev:null);let eC={...eW,...er,...ep.props,className:(0,p.Z)(er.className,ep.props.className),onTouchStart:eE,ref:eS,...U?{onMouseMove:e=>{let t=ep.props;t.onMouseMove&&t.onMouseMove(e),E={x:e.clientX,y:e.clientY},ek.current&&ek.current.update()}}:{}},eB={};I||(eC.onTouchStart=e=>{eE(e),eh.clear(),ed.clear(),ex(),eb.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",ef.start(z,()=>{document.body.style.WebkitUserSelect=eb.current,e$(e)})},eC.onTouchEnd=e=>{ep.props.onTouchEnd&&ep.props.onTouchEnd(e),ex(),eh.start(q,()=>{eR(e)})}),!B&&(eC.onMouseOver=S(e$,eC.onMouseOver),eC.onMouseLeave=S(eL,eC.onMouseLeave),eu||(eB.onMouseOver=e$,eB.onMouseLeave=eL)),!C&&(eC.onFocus=S(eP,eC.onFocus),eC.onBlur=S(eO,eC.onBlur),eu||(eB.onFocus=eP,eB.onBlur=eO));let eF={...o,isRtl:ea,arrow:i,disableInteractive:eu,placement:Y,PopperComponentProp:D,touch:em.current},eI="function"==typeof J.popper?J.popper(eF):J.popper,eN=r.useMemo(()=>{let e=[{name:"arrow",enabled:!!es,options:{element:es,padding:4}}];return G.popperOptions?.modifiers&&(e=e.concat(G.popperOptions.modifiers)),eI?.popperOptions?.modifiers&&(e=e.concat(eI.popperOptions.modifiers)),{...G.popperOptions,...eI?.popperOptions,modifiers:e}},[es,G.popperOptions,eI?.popperOptions]),ej=(e=>{let{classes:t,disableInteractive:o,arrow:r,touch:p,placement:n}=e,i={popper:["popper",!o&&"popperInteractive",r&&"popperArrow"],tooltip:["tooltip",r&&"tooltipArrow",p&&"touch",`tooltipPlacement${(0,h.Z)(n.split("-")[0])}`],arrow:["arrow"]};return(0,a.Z)(i,T.Q,t)})(eF),ez="function"==typeof J.transition?J.transition(eF):J.transition,eU={slots:{popper:k.Popper,transition:k.Transition??et,tooltip:k.Tooltip,arrow:k.Arrow,...K},slotProps:{arrow:J.arrow??W.arrow,popper:{...G,...eI??W.popper},tooltip:J.tooltip??W.tooltip,transition:{...eo,...ez??W.transition}}},[e_,eV]=(0,x.Z)("popper",{elementType:$,externalForwardedProps:eU,ownerState:eF,className:(0,p.Z)(ej.popper,G?.className)}),[eq,eQ]=(0,x.Z)("transition",{elementType:f.Z,externalForwardedProps:eU,ownerState:eF}),[eH,eX]=(0,x.Z)("tooltip",{elementType:L,className:ej.tooltip,externalForwardedProps:eU,ownerState:eF}),[eY,eD]=(0,x.Z)("arrow",{elementType:M,className:ej.arrow,externalForwardedProps:eU,ownerState:eF,ref:ec});return(0,R.jsxs)(r.Fragment,{children:[r.cloneElement(ep,eC),(0,R.jsx)(e_,{as:D??Z.Z,placement:Y,anchorEl:U?{getBoundingClientRect:()=>({top:E.y,left:E.x,right:E.x,bottom:E.y,width:0,height:0})}:ei,popperRef:ek,open:!!ei&&ew,id:ev,transition:!0,...eB,...eV,popperOptions:eN,children:({TransitionProps:e})=>(0,R.jsx)(eq,{timeout:en.transitions.duration.shorter,...e,...eQ,children:(0,R.jsxs)(eH,{...eX,children:[ee,i?(0,R.jsx)(eY,{...eD}):null]})})})]})})},87143:function(e,t,o){o.d(t,{Q:()=>n,Z:()=>a});var r=o(44124),p=o(6749);function n(e){return(0,p.ZP)("MuiTooltip",e)}let a=(0,r.Z)("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"])},10763:function(e,t,o){var r;t.default=void 0,t.default=(0,((r=o(30265))&&r.__esModule?r:{default:r}).default)("M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z","Close")}}]);
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["9010"],{32964:function(e,t,o){o.d(t,{Z:()=>L});var r=o(54538),p=o(90496),n=o(47126),a=o(82267),i=o(16838),l=o(6595),s=o(74111),c=o(94680),m=o(12709),u=o(94776),d=o(82319),g=o(51751),h=o(51640),f=o(23382),Z=o(75651),y=o(67151),w=o(51183),v=o(56839),b=o(18817),x=o(16351),T=o(87143),R=o(24246);let $=(0,m.ZP)(Z.Z,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.popper,!o.disableInteractive&&t.popperInteractive,o.arrow&&t.popperArrow,!o.open&&t.popperClose]}})((0,d.Z)(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:e})=>!e.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:e})=>!e,style:{pointerEvents:"none"}},{props:({ownerState:e})=>e.arrow,style:{[`&[data-popper-placement*="bottom"] .${T.Z.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${T.Z.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${T.Z.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${T.Z.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="right"] .${T.Z.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="right"] .${T.Z.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!e.isRtl,style:{[`&[data-popper-placement*="left"] .${T.Z.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:e})=>e.arrow&&!!e.isRtl,style:{[`&[data-popper-placement*="left"] .${T.Z.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),M=(0,m.ZP)("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.tooltip,o.touch&&t.touch,o.arrow&&t.tooltipArrow,t[`tooltipPlacement${(0,h.Z)(o.placement.split("-")[0])}`]]}})((0,d.Z)(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:(0,i.Fq)(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${T.Z.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${T.Z.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:e})=>e.arrow,style:{position:"relative",margin:0}},{props:({ownerState:e})=>e.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${Math.round(16/14*1e5)/1e5}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:e})=>!e.isRtl,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:e})=>!e.isRtl&&e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:e})=>!!e.isRtl,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:e})=>!!e.isRtl&&e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${T.Z.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:e})=>e.touch,style:{[`.${T.Z.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),O=(0,m.ZP)("span",{name:"MuiTooltip",slot:"Arrow",overridesResolver:(e,t)=>t.arrow})((0,d.Z)(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:(0,i.Fq)(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}}))),P=!1,E=new n.V,S={x:0,y:0};function k(e,t){return(o,...r)=>{t&&t(o,...r),e(o,...r)}}let L=r.forwardRef(function(e,t){let o=(0,g.i)({props:e,name:"MuiTooltip"}),{arrow:i=!1,children:m,classes:d,components:L={},componentsProps:W={},describeChild:A=!1,disableFocusListener:B=!1,disableHoverListener:C=!1,disableInteractive:F=!1,disableTouchListener:I=!1,enterDelay:N=100,enterNextDelay:j=0,enterTouchDelay:z=700,followCursor:U=!1,id:V,leaveDelay:q=0,leaveTouchDelay:Q=1500,onClose:_,onOpen:H,open:X,placement:Y="bottom",PopperComponent:D,PopperProps:G={},slotProps:J={},slots:K={},title:ee,TransitionComponent:et,TransitionProps:eo,...er}=o,ep=r.isValidElement(m)?m:(0,R.jsx)("span",{children:m}),en=(0,u.Z)(),ea=(0,l.V)(),[ei,el]=r.useState(),[es,ec]=r.useState(null),em=r.useRef(!1),eu=F||U,ed=(0,n.Z)(),eg=(0,n.Z)(),eh=(0,n.Z)(),ef=(0,n.Z)(),[eZ,ey]=(0,b.Z)({controlled:X,default:!1,name:"Tooltip",state:"open"}),ew=eZ,ev=(0,v.Z)(V),eb=r.useRef(),ex=(0,y.Z)(()=>{void 0!==eb.current&&(document.body.style.WebkitUserSelect=eb.current,eb.current=void 0),ef.clear()});r.useEffect(()=>ex,[ex]);let eT=e=>{E.clear(),P=!0,ey(!0),H&&!ew&&H(e)},eR=(0,y.Z)(e=>{E.start(800+q,()=>{P=!1}),ey(!1),_&&ew&&_(e),ed.start(en.transitions.duration.shortest,()=>{em.current=!1})}),e$=e=>{em.current&&"touchstart"!==e.type||(ei&&ei.removeAttribute("title"),eg.clear(),eh.clear(),N||P&&j?eg.start(P?j:N,()=>{eT(e)}):eT(e))},eM=e=>{eg.clear(),eh.start(q,()=>{eR(e)})},[,eO]=r.useState(!1),eP=e=>{(0,s.Z)(e.target)||(eO(!1),eM(e))},eE=e=>{ei||el(e.currentTarget),(0,s.Z)(e.target)&&(eO(!0),e$(e))},eS=e=>{em.current=!0;let t=ep.props;t.onTouchStart&&t.onTouchStart(e)};r.useEffect(()=>{if(ew)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){"Escape"===e.key&&eR(e)}},[eR,ew]);let ek=(0,w.Z)((0,c.Z)(ep),el,t);ee||0===ee||(ew=!1);let eL=r.useRef(),eW={},eA="string"==typeof ee;A?(eW.title=ew||!eA||C?null:ee,eW["aria-describedby"]=ew?ev:null):(eW["aria-label"]=eA?ee:null,eW["aria-labelledby"]=ew&&!eA?ev:null);let eB={...eW,...er,...ep.props,className:(0,p.Z)(er.className,ep.props.className),onTouchStart:eS,ref:ek,...U?{onMouseMove:e=>{let t=ep.props;t.onMouseMove&&t.onMouseMove(e),S={x:e.clientX,y:e.clientY},eL.current&&eL.current.update()}}:{}},eC={};I||(eB.onTouchStart=e=>{eS(e),eh.clear(),ed.clear(),ex(),eb.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",ef.start(z,()=>{document.body.style.WebkitUserSelect=eb.current,e$(e)})},eB.onTouchEnd=e=>{ep.props.onTouchEnd&&ep.props.onTouchEnd(e),ex(),eh.start(Q,()=>{eR(e)})}),!C&&(eB.onMouseOver=k(e$,eB.onMouseOver),eB.onMouseLeave=k(eM,eB.onMouseLeave),eu||(eC.onMouseOver=e$,eC.onMouseLeave=eM)),!B&&(eB.onFocus=k(eE,eB.onFocus),eB.onBlur=k(eP,eB.onBlur),eu||(eC.onFocus=eE,eC.onBlur=eP));let eF={...o,isRtl:ea,arrow:i,disableInteractive:eu,placement:Y,PopperComponentProp:D,touch:em.current},eI="function"==typeof J.popper?J.popper(eF):J.popper,eN=r.useMemo(()=>{let e=[{name:"arrow",enabled:!!es,options:{element:es,padding:4}}];return G.popperOptions?.modifiers&&(e=e.concat(G.popperOptions.modifiers)),eI?.popperOptions?.modifiers&&(e=e.concat(eI.popperOptions.modifiers)),{...G.popperOptions,...eI?.popperOptions,modifiers:e}},[es,G.popperOptions,eI?.popperOptions]),ej=(e=>{let{classes:t,disableInteractive:o,arrow:r,touch:p,placement:n}=e,i={popper:["popper",!o&&"popperInteractive",r&&"popperArrow"],tooltip:["tooltip",r&&"tooltipArrow",p&&"touch",`tooltipPlacement${(0,h.Z)(n.split("-")[0])}`],arrow:["arrow"]};return(0,a.Z)(i,T.Q,t)})(eF),ez="function"==typeof J.transition?J.transition(eF):J.transition,eU={slots:{popper:L.Popper,transition:L.Transition??et,tooltip:L.Tooltip,arrow:L.Arrow,...K},slotProps:{arrow:J.arrow??W.arrow,popper:{...G,...eI??W.popper},tooltip:J.tooltip??W.tooltip,transition:{...eo,...ez??W.transition}}},[eV,eq]=(0,x.Z)("popper",{elementType:$,externalForwardedProps:eU,ownerState:eF,className:(0,p.Z)(ej.popper,G?.className)}),[eQ,e_]=(0,x.Z)("transition",{elementType:f.Z,externalForwardedProps:eU,ownerState:eF}),[eH,eX]=(0,x.Z)("tooltip",{elementType:M,className:ej.tooltip,externalForwardedProps:eU,ownerState:eF}),[eY,eD]=(0,x.Z)("arrow",{elementType:O,className:ej.arrow,externalForwardedProps:eU,ownerState:eF,ref:ec});return(0,R.jsxs)(r.Fragment,{children:[r.cloneElement(ep,eB),(0,R.jsx)(eV,{as:D??Z.Z,placement:Y,anchorEl:U?{getBoundingClientRect:()=>({top:S.y,left:S.x,right:S.x,bottom:S.y,width:0,height:0})}:ei,popperRef:eL,open:!!ei&&ew,id:ev,transition:!0,...eC,...eq,popperOptions:eN,children:({TransitionProps:e})=>(0,R.jsx)(eQ,{timeout:en.transitions.duration.shorter,...e,...e_,children:(0,R.jsxs)(eH,{...eX,children:[ee,i?(0,R.jsx)(eY,{...eD}):null]})})})]})})},87143:function(e,t,o){o.d(t,{Q:()=>n,Z:()=>a});var r=o(44124),p=o(6749);function n(e){return(0,p.ZP)("MuiTooltip",e)}let a=(0,r.Z)("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["1301"],{35015:function(e,t,n){async function a(...e){let t=await globalThis.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.clone().json();if(e.error)throw new s(e.error,t.status);if(e.message)throw new s(e.message,t.status)}let n=await t.clone().text();if(n)throw new s(n,t.status);throw new i(t)}return t}async function r(...e){let t=await a(...e);if(!t.ok)throw new i(t);return await t.json()}n.d(t,{he:()=>a,kp:()=>i,rd:()=>r,yh:()=>s});class i extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,i.prototype)}}class s extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,s.prototype)}}},99176:function(e,t,n){function a(e){let[t,n]=e;return[1e3*t,function(e){let t;switch(e){case"+Inf":t=1/0;break;case"-Inf":t=-1/0;break;default:t=parseFloat(e)}return t}(n)]}n.d(t,{Mm:()=>_.Mm,nY:()=>_.nY,k7:()=>b,wd:()=>P,Nr:()=>s,mB:()=>h,Bf:()=>w,PL:()=>u,c4:()=>i,Fp:()=>o,Rv:()=>_.Rv,sv:()=>_.sv,ac:()=>d,mY:()=>l,qJ:()=>a,X2:()=>c});var r=n(35015);function i(e){return async()=>{let t=`${e.datasourceUrl}/-/healthy`;try{let n=await (0,r.he)(t,{headers:e.headers,signal:e.abortSignal});return 200===n.status}catch{return!1}}}function s(e,t){return f("/api/v1/query",e,t)}function o(e,t){return f("/api/v1/query_range",e,t)}function l(e,t){return f("/api/v1/labels",e,t)}function u(e,t){let{labelName:n,...a}=e;return 0===n.length?new Promise(e=>{e({data:[]})}):p(`/api/v1/label/${encodeURIComponent(n)}/values`,a,t)}function c(e,t){return p("/api/v1/metadata",e,t)}function d(e,t){return f("/api/v1/series",e,t)}function h(e,t){return f("/api/v1/parse_query",e,t)}function p(e,t,n){let{datasourceUrl:a,headers:i}=n,s=`${a}${e}`,o=v(t).toString();return""!==o&&(s+=`?${o}`),(0,r.rd)(s,{method:"GET",headers:i})}function f(e,t,n){let{datasourceUrl:a,headers:r,abortSignal:i}=n;return m(`${a}${e}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...r},signal:i,body:v(t)})}function v(e){let t=new URLSearchParams;for(let n in e){let a=e[n];if(void 0!==a){if("string"==typeof a){t.append(n,a);continue}if("number"==typeof a){t.append(n,a.toString());continue}for(let e of a)t.append(n,e)}}return t}async function m(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let a=await (0,r.he)(...t);return{...await a.json(),rawResponse:a}}var _=n(21969),y=n(29085),g=n(20461);function w(e){let{start:t,end:n}=e;return{start:Math.ceil((0,g.getUnixTime)(t)),end:Math.ceil((0,g.getUnixTime)(n))}}function P(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=(e.end-e.start)/1e4;return r>1&&(r=Math.ceil(r)),Math.max(a/1e3*n,t,r)}function b(e){if(!e)return;let t=(0,y.Ib)(e);return Math.floor((0,g.milliseconds)(t)/1e3)}},21969:function(e,t,n){n.d(t,{Mm:()=>i,Rv:()=>s,nY:()=>r,sv:()=>o});var a=n(72);let r="PrometheusDatasource",i={kind:r};function s(e){return!(0,a.isVariableDatasource)(e)&&void 0===e.name}function o(e){return(0,a.isVariableDatasource)(e)||e.kind===r}},46595:function(e,t,n){n.r(t),n.d(t,{PrometheusDatasource:()=>u});var a=n(99176),r=n(24246),i=n(72),s=n(52054),o=n(8695);n(54538);var l=n(16146);let u={createClient:(e,t)=>{let{directUrl:n,proxy:r}=e,{proxyUrl:i}=t,s=n??i;if(void 0===s)throw Error("No URL specified for Prometheus client. You can use directUrl in the spec to configure it.");let o=null==r?void 0:r.spec.headers;return{options:{datasourceUrl:s},healthCheck:(0,a.c4)({datasourceUrl:s,headers:o}),instantQuery:(e,t,n)=>(0,a.Nr)(e,{datasourceUrl:s,headers:t??o,abortSignal:n}),rangeQuery:(e,t,n)=>(0,a.Fp)(e,{datasourceUrl:s,headers:t??o,abortSignal:n}),labelNames:(e,t,n)=>(0,a.mY)(e,{datasourceUrl:s,headers:t??o,abortSignal:n}),labelValues:(e,t,n)=>(0,a.PL)(e,{datasourceUrl:s,headers:t??o,abortSignal:n}),metricMetadata:(e,t,n)=>(0,a.X2)(e,{datasourceUrl:s,headers:t??o,abortSignal:n}),series:(e,t,n)=>(0,a.ac)(e,{datasourceUrl:s,headers:t??o,abortSignal:n}),parseQuery:(e,t,n)=>(0,a.mB)(e,{datasourceUrl:s,headers:t??o,abortSignal:n})}},getBuiltinVariableDefinitions:()=>[{kind:"BuiltinVariable",spec:{name:"__interval",value:()=>"$__interval",source:"Prometheus",display:{name:"__interval",description:'For dynamic queries that adapt across different time ranges, use $__interval instead of hardcoded intervals. It represents the actual spacing between data points: it’s calculated based on the current time range and the panel pixel width (taking the "Min step" as a lower bound).',hidden:!0}}},{kind:"BuiltinVariable",spec:{name:"__interval_ms",value:()=>"$__interval_ms",source:"Prometheus",display:{name:"__interval_ms",description:"Same as $__interval but in milliseconds.",hidden:!0}}},{kind:"BuiltinVariable",spec:{name:"__rate_interval",value:()=>"$__rate_interval",source:"Prometheus",display:{name:"__rate_interval",description:"Use this one rather than $__interval as the range parameter of functions like rate, increase, etc. With such function it is advised to choose a range that is at least 4x the scrape interval (this is to allow for various races, and to be resilient to a failed scrape). $__rate_interval provides that, as it is defined as `max($__interval + Min Step, 4 * Min Step)`, where Min Step value should represent the scrape interval of the metrics.",hidden:!0}}}],OptionsEditorComponent:function(e){let{value:t,onChange:n,isReadonly:a}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.Z,{variant:"h4",mb:2,children:"General Settings"}),(0,r.jsx)(o.Z,{fullWidth:!0,label:"Scrape Interval",value:t.scrapeInterval||"",placeholder:`Default: ${l.v}`,InputProps:{readOnly:a},InputLabelProps:{shrink:!!a||void 0},onChange:e=>n({...t,scrapeInterval:e.target.value})}),(0,r.jsx)(i.HTTPSettingsEditor,{value:t,onChange:n,isReadonly:a,initialSpecDirect:{directUrl:""},initialSpecProxy:{proxy:{kind:"HTTPProxy",spec:{allowedEndpoints:[{endpointPattern:"/api/v1/labels",method:"POST"},{endpointPattern:"/api/v1/series",method:"POST"},{endpointPattern:"/api/v1/metadata",method:"GET"},{endpointPattern:"/api/v1/query",method:"POST"},{endpointPattern:"/api/v1/query_range",method:"POST"},{endpointPattern:"/api/v1/label/([a-zA-Z0-9_-]+)/values",method:"GET"},{endpointPattern:"/api/v1/parse_query",method:"POST"}],url:""}}}})]})},createInitialOptions:()=>({directUrl:""})}},16146:function(e,t,n){n.d(t,{v:()=>a});let a="1m"}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["5742"],{35015:function(e,t,n){async function l(...e){let t=await globalThis.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.clone().json();if(e.error)throw new i(e.error,t.status);if(e.message)throw new i(e.message,t.status)}let n=await t.clone().text();if(n)throw new i(n,t.status);throw new r(t)}return t}async function a(...e){let t=await l(...e);if(!t.ok)throw new r(t);return await t.json()}n.d(t,{he:()=>l,kp:()=>r,rd:()=>a,yh:()=>i});class r extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,r.prototype)}}class i extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,i.prototype)}}},30666:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(30265))&&l.__esModule?l:{default:l}).default)("M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z","ArrowLeft")},82562:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(30265))&&l.__esModule?l:{default:l}).default)("M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z","Check")},10763:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(30265))&&l.__esModule?l:{default:l}).default)("M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z","Close")},77463:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(30265))&&l.__esModule?l:{default:l}).default)("M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z","Cog")},50737:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(30265))&&l.__esModule?l:{default:l}).default)("M14.19,14.19L6,18L9.81,9.81L18,6M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,10.9A1.1,1.1 0 0,0 10.9,12A1.1,1.1 0 0,0 12,13.1A1.1,1.1 0 0,0 13.1,12A1.1,1.1 0 0,0 12,10.9Z","Compass")},88160:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(30265))&&l.__esModule?l:{default:l}).default)("M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z","HelpCircleOutline")},66268:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(30265))&&l.__esModule?l:{default:l}).default)("M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z","Magnify")},93822:function(e,t,n){n.r(t),n.d(t,{PrometheusExplorer:()=>ey});var l=n(24246),a=n(36372),r=n(25283),i=n(51781),s=n(49408),o=n(72),d=n(6145),u=n(75276),c=n(37054),h=n(21969),x=n(75094),f=n(5549),p=n(10517),m=n(28797),g=n(82707),j=n(50898),b=n(8695),v=n(76992),Z=n(76439),C=n(94776),w=n(48565);function y(e){return e.to-e.from+1}function M(e,t){let n=e[t],l=null;return 0===t&&0!==n.from&&(l={from:0,to:n.from-1}),t>0&&(l={from:e[t-1].to+1,to:n.from-1}),l}class L{constructor(e){this.conf={caseSensitive:(null==e?void 0:e.caseSensitive)!==void 0&&e.caseSensitive,excludedChars:(null==e?void 0:e.excludedChars)===void 0?[]:e.excludedChars,includeMatches:(null==e?void 0:e.includeMatches)!==void 0&&e.includeMatches,shouldSort:(null==e?void 0:e.shouldSort)!==void 0&&e.shouldSort,shouldRender:(null==e?void 0:e.shouldRender)===void 0||e.shouldRender,escapeHTML:(null==e?void 0:e.escapeHTML)!==void 0&&e.escapeHTML,pre:(null==e?void 0:e.pre)===void 0?"":e.pre,post:(null==e?void 0:e.post)===void 0?"":e.post}}filter(e,t,n){let l=(null==n?void 0:n.shouldSort)!==void 0?n.shouldSort:this.conf.shouldSort,a=[];for(let l=0;l<t.length;l++){let r=this.match(e,t[l],n);null!==r&&(r.index=l,a.push(r))}return l&&(a=a.sort((e,t)=>t.score-e.score)),a}match(e,t,n){let l=e,a=t,r=(null==n?void 0:n.caseSensitive)!==void 0?n.caseSensitive:this.conf.caseSensitive,i=(null==n?void 0:n.includeMatches)!==void 0?n.includeMatches:this.conf.includeMatches,s=(null==n?void 0:n.shouldRender)!==void 0?n.shouldRender:this.conf.shouldRender;if(r||(l=l.toLowerCase(),a=a.toLowerCase()),l===a){let l=[{from:0,to:e.length-1}],a={original:t,rendered:s?this.render(t,l,n):t,score:1/0};return i&&(a.intervals=l),a}let o=[],d=0;for(let e=0;e<a.length-l.length+1;e++)if(a[e]===l[0]){let t=this.generateMatchingInterval(l,a,e,n);if(null===t)break;t.score>d&&(d=t.score,o=t.intervals)}if(0===o.length)return null;let u={original:t,rendered:s?this.render(t,o,n):t,score:d};return i&&(u.intervals=o),u}render(e,t,n){if(0==t.length)return e;let l="",a=(null==n?void 0:n.pre)?n.pre:this.conf.pre,r=(null==n?void 0:n.post)?n.post:this.conf.post;for(let i=0;i<t.length;i++){let s=t[i],o=M(t,i),d="";null!==o&&(d=this.extractSubString(e,o,n));let u=this.extractSubString(e,s,n);l=`${l}${d}${a}${u}${r}`}let i=t[t.length-1];return i.to<e.length-1&&(l+=this.extractSubString(e,{from:i.to+1,to:e.length},n)),l}extractSubString(e,t,n){let l=(null==n?void 0:n.escapeHTML)!==void 0?n.escapeHTML:this.conf.escapeHTML,a=e.substr(t.from,y(t));return l&&(a=a.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";default:return"&#039;"}})),a}generateMatchingInterval(e,t,n,l){let a=[];(null==l?void 0:l.excludedChars)!==void 0?a=l.excludedChars:void 0!==this.conf.excludedChars&&(a=this.conf.excludedChars);let r=0,i=[];for(let l=n;l<t.length&&r<e.length;){if(a.includes(t[l])){l++;continue}if(a.includes(e[r])){r++;continue}if(t[l]===e[r]){let n={from:l,to:l};r++,l++;for(let a=l;a<t.length&&r<e.length&&t[a]===e[r];a++)n.to=a,r++,l=a;i.push(n)}l++}return 0===i.length||r!==e.length?null:{score:function(e,t){let n=0;for(let l=0;l<e.length;l++){let a=e[l],r=M(e,l);null!==r&&(n-=y(r)/t),n+=y(a)**2}return n}(i,t.length),intervals:i}}}new L;var S=n(30666),_=n(77463),k=n(66268),E=n(54538),T=n(67430),I=n(99176),A=n(96205),V=n(52054),P=n(66224),R=n(79119),$=n(50737),O=n(83675),q=n(91909);function F(e){return`${e.map(e=>`${e.label}${e.operator}"${e.labelValues.join("|")}"`).join(",")}`}function H(e,t,n){let{data:l}=(0,o.useDatasourceClient)(t),a=e.replace(/(_count|_sum|_bucket)$/,""),{data:r,isLoading:i,error:s}=(0,q.useQuery)({enabled:!!l&&n,queryKey:["metricMetadata",a],queryFn:async()=>await l.metricMetadata({metric:a})});return{metadata:(0,E.useMemo)(()=>{var e;for(let t of(null==r||null==(e=r.data)?void 0:e[a])??[])if(t.help.length>0)return t},[r,a]),isLoading:i,error:s}}function D(e,t,n){let{absoluteTimeRange:{start:l,end:a}}=(0,o.useTimeRange)(),{data:r}=(0,o.useDatasourceClient)(n);return(0,q.useQuery)({enabled:!!r,queryKey:["labelValues",e,"datasource",n.name,"start",l,"end","filters",...t],queryFn:async()=>{let n={labelName:e,start:l.valueOf()/1e3,end:a.valueOf()/1e3};return t.length&&(n["match[]"]=[`{${F(t)}}`]),await r.labelValues(n)}})}var N=n(52889);function Q(e){let{label:t,...n}=e;return"gauge"===t?(0,l.jsx)(N.Z,{label:t,color:"success",...n}):"counter"===t?(0,l.jsx)(N.Z,{label:t,color:"primary",...n}):"histogram"===t?(0,l.jsx)(N.Z,{label:t,color:"warning",...n}):"summary"===t?(0,l.jsx)(N.Z,{label:t,color:"secondary",...n}):(0,l.jsx)(N.Z,{label:t,sx:{fontStyle:"unknown"===t?"italic":"initial"},...n})}function z(e){let{children:t,metricName:n,datasource:a,filters:r,isMetadataEnabled:i,onExplore:s}=e,{metadata:o,isLoading:u}=H(n,a,i),c=(0,d.useExplorerQueryParams)({data:{tab:"finder",datasource:a,filters:r,exploredMetric:n}});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(A.Z,{style:{width:"300px"},children:(0,l.jsx)(V.Z,{sx:{fontFamily:"monospace"},children:t??n})}),(0,l.jsx)(A.Z,{style:{width:115,textAlign:"center"},children:i&&u?(0,l.jsx)(P.Z,{variant:"rounded",width:75}):(0,l.jsx)(Q,{label:(null==o?void 0:o.type)??"unknown"})}),(0,l.jsx)(A.Z,{style:{width:"100%"},children:i&&u?(0,l.jsx)(P.Z,{variant:"text",width:180}):(0,l.jsx)(V.Z,{sx:{fontStyle:(null==o?void 0:o.help)?"initial":"italic",minWidth:"30vw"},children:o?o.help:"unknown"})}),(0,l.jsx)(A.Z,{style:{width:140},children:(0,l.jsx)(w.Z,{"aria-label":`explore metric ${n}`,variant:"contained",startIcon:(0,l.jsx)($.default,{}),style:{textWrap:"nowrap"},onClick:()=>null==s?void 0:s(n),component:T.Link,to:`?${c}`,children:"Explore"})})]})}function W(e){let{metricNames:t,filteredResults:n,datasource:a,filters:i,isMetadataEnabled:s,onExplore:o,...d}=e,u=new L,c=(0,E.useMemo)(()=>n||t.map(e=>({original:e})),[n,t]);return(0,l.jsxs)(r.Z,{gap:2,width:"100%",divider:(0,l.jsx)(R.Z,{orientation:"horizontal",flexItem:!0}),...d,children:[(0,l.jsx)(O._n,{style:{height:"70vh",width:"100%"},totalCount:c.length,itemContent:e=>(0,l.jsx)(z,{metricName:c[e].original,datasource:a,filters:i,isMetadataEnabled:s,onExplore:o,children:(0,l.jsx)("span",{dangerouslySetInnerHTML:{__html:u.render(c[e].original,c[e].intervals??[],{pre:'<strong style="color:darkorange">',post:"</strong>",escapeHTML:!0})}})})}),(0,l.jsx)(r.Z,{sx:{width:"100%"},textAlign:"end",children:(0,l.jsxs)(V.Z,{"data-testid":"finder-total",children:["Total: ",(0,l.jsx)("strong",{children:t.length})," metrics"]})})]})}var B=n(90192),Y=n(33755),J=n(11774),K=n(63767),U=n(80354);function G(e){let{datasource:t,value:n,filters:a,onChange:r,onDelete:i}=e,s=(0,E.useMemo)(()=>a.filter(e=>e.label!==n.label),[a,n.label]),{data:d,isLoading:u}=function(e,t){let{absoluteTimeRange:{start:n,end:l}}=(0,o.useTimeRange)(),{data:a}=(0,o.useDatasourceClient)(t);return(0,q.useQuery)({enabled:!!a,queryKey:["labels","datasource",t.name,"start",n,"end",l,"filters",...e],queryFn:async()=>{let t={start:n.valueOf()/1e3,end:l.valueOf()/1e3};return e.length&&(t["match[]"]=[`{${F(e)}}`]),await a.labelNames(t)}})}(s,t),{data:c,isLoading:h}=D(n.label,s,t);return(0,l.jsx)(ee,{value:n,labelOptions:(null==d?void 0:d.data)??[],labelValuesOptions:(null==c?void 0:c.data)??[],isLabelOptionsLoading:u,isLabelValuesOptionsLoading:h,onChange:r,onDelete:i})}let X=(0,E.forwardRef)((e,t)=>{let{children:n,...a}=e,r=(0,E.useRef)("500px"),[i,s]=(0,E.useState)(0);return(0,l.jsx)("ul",{style:{overflow:"hidden",padding:"0",height:i?`min(40vh, ${i}px)`:"40vh"},ref:e=>{let n=e?getComputedStyle(e).maxHeight:null;n&&n!==r.current&&(r.current=n),"function"==typeof t&&t(e)},...a,children:(0,l.jsx)(O.OO,{style:{height:r.current,padding:"10px 0"},data:n,totalListHeightChanged:s,itemContent:(e,t)=>(0,E.cloneElement)(t,{index:e,title:t.props.children})})})});function ee(e){let{value:t,labelOptions:n,labelValuesOptions:a,isLabelOptionsLoading:i,isLabelValuesOptionsLoading:s,onChange:o,onDelete:d}=e;return(0,l.jsxs)(r.Z,{gap:0,flexDirection:"row",alignItems:"center",children:[(0,l.jsx)(J.Z,{freeSolo:!0,disableClearable:!0,options:n??[],value:t.label,sx:{minWidth:200},ListboxComponent:X,loading:i,renderInput:e=>(0,l.jsx)(b.Z,{...e,label:"Label Name",variant:"outlined",fullWidth:!0,size:"medium",sx:{"& .MuiOutlinedInput-root":{borderTopRightRadius:0,borderBottomRightRadius:0}}}),onInputChange:(e,n)=>{o({label:n??"",labelValues:t.labelValues,operator:t.operator})}}),(0,l.jsxs)(K.Z,{value:t.operator,variant:"outlined",onChange:e=>"="===t.operator||"!="===t.operator?o({label:t.label,labelValues:[],operator:e.target.value}):"=~"===t.operator||"!~"===t.operator?o({label:t.label,labelValues:t.labelValues.slice(0,1),operator:e.target.value}):void o({label:t.label,labelValues:t.labelValues,operator:e.target.value}),size:"medium",sx:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0},children:[(0,l.jsx)(p.Z,{value:"=",children:"="}),(0,l.jsx)(p.Z,{value:"!=",children:"!="}),(0,l.jsx)(p.Z,{value:"=~",children:"=~"}),(0,l.jsx)(p.Z,{value:"!~",children:"!~"})]}),(0,l.jsx)(J.Z,{freeSolo:!0,multiple:"=~"===t.operator||"!~"===t.operator,limitTags:1,disableClearable:!0,options:a??[],value:t.labelValues,ListboxComponent:X,sx:{minWidth:200},loading:s,renderInput:e=>(0,l.jsx)(b.Z,{...e,label:"=~"===t.operator||"!~"===t.operator?"Label Values":"Label Value",variant:"outlined",fullWidth:!0,size:"medium",sx:{"& .MuiOutlinedInput-root":{borderTopLeftRadius:0,borderBottomLeftRadius:0}},slotProps:{input:{...e.InputProps,style:{maxHeight:"53.13px"},endAdornment:(0,l.jsxs)(v.Z,{position:"end",children:[s?(0,l.jsx)(j.Z,{color:"inherit",size:20}):null,(0,l.jsx)(x.Z,{"aria-label":"delete label filter",onClick:()=>d(),edge:"end",children:(0,l.jsx)(U.default,{})})]})}}}),onInputChange:(e,n)=>{("="===t.operator||"!="===t.operator)&&o({label:t.label,labelValues:[n],operator:t.operator})},onChange:(e,n)=>{Array.isArray(n)&&o({label:t.label,labelValues:n,operator:t.operator})}})]})}function et(e){let{datasource:t,filters:n,filteredFilters:a,onDatasourceChange:i,onFiltersChange:s,...d}=e,{data:u}=(0,o.useListDatasourceSelectItems)(h.nY);return(0,l.jsxs)(r.Z,{...d,direction:"row",alignItems:"center",flexWrap:"wrap",gap:1,sx:{width:"100%"},children:[(0,l.jsx)(B.Z,{sx:{width:500},children:(0,l.jsx)(o.DatasourceSelect,{size:"medium",datasourcePluginKind:h.nY,value:t,onChange:function(e){i((0,o.datasourceSelectValueToSelector)(e,{},u)??{kind:h.nY})},label:"Prometheus Datasource",fullWidth:!0})}),n.map((e,r)=>(0,l.jsx)(G,{datasource:t,filters:a,value:e,onChange:e=>{let t=[...n];t[r]=e,s(t)},onDelete:()=>{let e=[...n];e.splice(r,1),s(e)}},r)),(0,l.jsx)(w.Z,{startIcon:(0,l.jsx)(Y.default,{}),"aria-label":"add filter",onClick:()=>{s([...n,{label:"",labelValues:[""],operator:"="}])},children:"Add filter"})]})}X.displayName="ListboxComponent";var en=n(32964),el=n(88160),ea=n(82562),er=n(10763),ei=n(19154);function es(e){let{label:t,valueCounters:n,onFilterAdd:a,...i}=e,[s,o]=(0,E.useState)(!1),[d,u]=(0,E.useState)("="),[c,h]=(0,E.useState)(""),[f,m]=(0,E.useState)(!1),g=(0,Z.Z)((0,C.Z)().breakpoints.down("md")),j=(0,E.useMemo)(()=>f?n:n.slice(0,5),[f,n]);return(0,l.jsxs)(r.Z,{sx:{width:"100%"},direction:g?"column":"row",alignItems:"center",gap:2,...i,children:[(0,l.jsxs)(r.Z,{sx:{width:"100%",height:"100%"},justifyContent:"space-between",alignContent:"center",direction:g?"column":"row",children:[(0,l.jsx)(V.Z,{sx:{fontFamily:"monospace"},pl:+!g,children:t}),(0,l.jsx)(r.Z,{direction:"row",gap:1,alignItems:"center",children:s?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(K.Z,{size:"small",value:d,variant:"outlined",onChange:e=>{u(e.target.value)},children:[(0,l.jsx)(p.Z,{value:"=",children:"="}),(0,l.jsx)(p.Z,{value:"!=",children:"!="}),(0,l.jsx)(p.Z,{value:"=~",children:"=~"}),(0,l.jsx)(p.Z,{value:"!~",children:"!~"})]}),(0,l.jsx)(J.Z,{freeSolo:!0,limitTags:1,disableClearable:!0,options:n.map(e=>e.labelValue),value:c,ListboxComponent:X,sx:{width:250},renderInput:e=>(0,l.jsx)(b.Z,{...e,label:"Value",variant:"outlined",fullWidth:!0,size:"small"}),onInputChange:(e,t)=>{h(t)}}),(0,l.jsx)(x.Z,{"aria-label":"confirm",onClick:()=>{a({label:t,labelValues:[c],operator:d}),o(!1)},children:(0,l.jsx)(ea.default,{})}),(0,l.jsx)(x.Z,{"aria-label":"cancel",onClick:()=>{o(!1)},children:(0,l.jsx)(er.default,{})})]}):(0,l.jsx)(w.Z,{startIcon:(0,l.jsx)(Y.default,{}),"aria-label":"add filter",onClick:()=>o(!0),children:"Add filter"})})]}),(0,l.jsxs)(r.Z,{sx:{width:"100%"},gap:.5,children:[(0,l.jsxs)(r.Z,{direction:"row",gap:.5,children:[(0,l.jsxs)(V.Z,{variant:"subtitle1",children:[n.length," values"]}),n.length>5&&(0,l.jsx)(w.Z,{variant:"text",size:"small",sx:{padding:0},onClick:()=>m(e=>!e),children:f?"[-]":"[+]"})]}),(0,l.jsx)(r.Z,{sx:{overflow:g?"auto":"unset"},children:j.map(e=>(0,l.jsxs)(r.Z,{direction:"row",gap:2,children:[(0,l.jsx)(V.Z,{sx:{color:e=>e.palette.success.main,fontFamily:"monospace",":hover":{backgroundColor:"rgba(127,127,127,0.35)",cursor:"pointer"},textWrap:g?"nowrap":"unset"},onClick:()=>a({label:t,labelValues:[e.labelValue],operator:"="}),children:e.labelValue}),(0,l.jsxs)(V.Z,{sx:{textWrap:"nowrap"},children:["(",e.counter," series)"]})]},`${t}-${e.labelValue}`))}),(0,l.jsx)(r.Z,{width:"100%",textAlign:g?"center":"unset",children:f?(0,l.jsx)(w.Z,{variant:"text",sx:{width:"fit-content"},onClick:()=>m(!1),children:"Hide full values"}):(0,l.jsx)(l.Fragment,{children:n.length>5&&(0,l.jsxs)(w.Z,{variant:"text",sx:{width:"fit-content"},onClick:()=>m(!0),children:["Show ",n.length-5," more values"]})})})]})]},t)}function eo(e){let{labelValueCounters:t,isLoading:n,onFilterAdd:a,...i}=e,s=(0,E.useMemo)(()=>[...t.keys()].sort(),[t]);return n?(0,l.jsx)(r.Z,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(j.Z,{})}):(0,l.jsxs)(r.Z,{sx:{width:"100%"},divider:(0,l.jsx)(R.Z,{flexItem:!0,orientation:"horizontal"}),gap:2,...i,children:[(0,l.jsxs)(r.Z,{gap:2,direction:"row",sx:{width:"100%"},children:[(0,l.jsx)(r.Z,{sx:{width:"100%"},children:(0,l.jsx)(V.Z,{variant:"h3",children:"Label"})}),(0,l.jsx)(r.Z,{sx:{width:"100%"},children:(0,l.jsx)(V.Z,{variant:"h3",children:"Values"})})]}),s.map(e=>(0,l.jsx)(es,{label:e,valueCounters:t.get(e)??[],onFilterAdd:a},e))]})}function ed(e){let{metricName:t,datasource:n,filters:a,onFilterAdd:i,...s}=e,{metadata:d,isLoading:u,error:c}=H(t,n),{series:h,labelValueCounters:x,isLoading:f,error:p}=function(e,t,n){let{absoluteTimeRange:{start:l,end:a}}=(0,o.useTimeRange)(),{data:r}=(0,o.useDatasourceClient)(n),{data:i,isLoading:s,isError:d,error:u}=(0,q.useQuery)({enabled:!!r,queryKey:["series",e,"datasource",n,"start",l,"end","filters",...t],queryFn:async()=>{let e={"match[]":[`{${F(t)}}`],start:l.valueOf()/1e3,end:a.valueOf()/1e3};return await r.series(e)}}),c=(0,E.useMemo)(()=>{let e=new Map;if((null==i?void 0:i.data)===void 0)return e;for(let t of i.data)for(let[n,l]of Object.entries(t)){let t=e.get(n);if(void 0===t){e.set(n,[{labelValue:l,counter:1}]);continue}let a=t.find(e=>e.labelValue===l);void 0===a?t.push({labelValue:l,counter:1}):a.counter+=1}return e},[i]);return{series:null==i?void 0:i.data,labelValueCounters:c,isLoading:s,isError:d,error:u}}(t,a,n);return(0,l.jsxs)(r.Z,{gap:2,...s,children:[(0,l.jsxs)(r.Z,{direction:"row",gap:3,mt:1,justifyContent:"space-between",children:[(0,l.jsxs)(r.Z,{gap:1,children:[(0,l.jsx)(V.Z,{variant:"h1",sx:{fontFamily:"monospace"},children:t}),(0,l.jsx)(V.Z,{children:"Description:"}),u?(0,l.jsx)(P.Z,{variant:"text",width:180}):(0,l.jsx)(V.Z,{style:{fontStyle:(null==d?void 0:d.help)?"initial":"italic"},children:c?"Failed to fetch metadata":(null==d?void 0:d.help)??"unknown"})]}),(0,l.jsxs)(r.Z,{gap:1,justifyContent:"center",children:[u?(0,l.jsx)(P.Z,{variant:"rounded",width:75}):c?(0,l.jsx)(N.Z,{label:"failed to fetch",color:"error",sx:{fontStyle:"italic"}}):(0,l.jsx)(Q,{label:(null==d?void 0:d.type)??"unknown"}),(0,l.jsxs)(V.Z,{children:["Result:"," ",f?(0,l.jsx)(P.Z,{variant:"text",width:20,sx:{display:"inline-block"}}):p?(0,l.jsx)("strong",{children:"failed to fetch series"}):(0,l.jsxs)("strong",{children:[(null==h?void 0:h.length)??"unknown"," series"]})]})]})]}),p?(0,l.jsx)(ei.ErrorAlert,{error:{name:`Failed to fetch series ${(null==p?void 0:p.status)&&`(${p.status})`}`,message:(null==p?void 0:p.message)??"Failed to fetch series"}}):(null==h?void 0:h.length)===0?(0,l.jsx)(r.Z,{...s,children:(0,l.jsx)(V.Z,{sx:{color:e=>e.palette.warning.main},children:"No series found with current filters."})}):(0,l.jsx)(eo,{labelValueCounters:x,onFilterAdd:i,isLoading:f})]})}var eu=n(68808);function ec(e){let{job:t,filters:n,datasource:a,isMetadataEnabled:i,onExplore:s,...o}=e,d=(0,E.useMemo)(()=>{let e=n.filter(e=>"__name__"!==e.label&&"job"!==e.label);return e.push({label:"job",labelValues:[t],operator:"="}),e},[n,t]),{data:u,isLoading:c}=D("__name__",d,a);return c?(0,l.jsx)(r.Z,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(j.Z,{})}):(0,l.jsx)(W,{metricNames:(null==u?void 0:u.data)??[],datasource:a,filters:d,isMetadataEnabled:i,onExplore:s,...o})}function eh(e){let{jobs:t,filters:n,datasource:a,isMetadataEnabled:i,onExplore:s,...o}=e,[d,u]=(0,E.useState)(t[0]??"");return d?(0,l.jsxs)(r.Z,{gap:2,...o,children:[t.length>2&&(0,l.jsxs)(B.Z,{fullWidth:!0,children:[(0,l.jsx)(eu.Z,{id:"job-select-label",children:"Job"}),(0,l.jsx)(K.Z,{labelId:"job-select-label",id:"job-select",label:"Job",variant:"outlined",value:d,onChange:e=>u(e.target.value),children:t.map(e=>(0,l.jsx)(p.Z,{value:e,children:e},e))})]}),d&&(0,l.jsx)(ec,{job:d,filters:n,datasource:a,isMetadataEnabled:i,onExplore:s})]}):(0,l.jsx)(V.Z,{children:"Something went wrong..."})}function ex(e){let{filters:t,datasource:n,isMetadataEnabled:a,onExplore:i,...s}=e,{data:o,isLoading:d}=D("job",t,n);return d?(0,l.jsx)(r.Z,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(j.Z,{})}):(null==o?void 0:o.data)&&0!==o.data.length?(0,l.jsx)(eh,{jobs:o.data,filters:t,datasource:n,isMetadataEnabled:a,onExplore:i,...s}):(0,l.jsx)(r.Z,{...s,children:(0,l.jsx)(V.Z,{children:"No jobs found"})})}function ef(e){let{filters:t,datasource:n,isMetadataEnabled:a,onExplore:i,...s}=e,o=(0,E.useMemo)(()=>t.filter(e=>"__name__"!==e.label),[t]),{data:d,isLoading:u}=D("__name__",o,n);return u?(0,l.jsx)(r.Z,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(j.Z,{})}):(0,l.jsx)(W,{metricNames:(null==d?void 0:d.data)??[],datasource:n,filters:o,isMetadataEnabled:a,onExplore:i,...s})}function ep(e){let{metricName:t,datasource:n,filters:a,type:i,isLoading:s,...d}=e,{width:h,ref:x}=(0,u.default)(),f=(0,o.useSuggestedStepMs)(h),[p,j]=(0,E.useState)(!0),{queries:b,definitions:v}=(0,E.useMemo)(()=>{let e=[{kind:"TimeSeriesQuery",spec:{plugin:{kind:"PrometheusTimeSeriesQuery",spec:{datasource:n,query:"counter"===i||p&&(void 0===i||"summary"===i||"histogram"===i)?`rate({__name__="${t}", ${F(a)}}[5m])`:`{__name__="${t}", ${F(a)}}`}}}}],l=e.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec}));return{queries:e,definitions:l}},[n,a,t,p,i]);return s?(0,l.jsx)(r.Z,{...d,children:(0,l.jsx)(P.Z,{variant:"rectangular",height:"100%"})}):(0,l.jsxs)(r.Z,{ref:x,alignItems:"end",...d,children:[(void 0===i||"summary"===i||"histogram"===i)&&(0,l.jsx)(m.Z,{control:(0,l.jsx)(g.Z,{size:"small"}),label:"Enable rate",checked:p,onChange:(e,t)=>j(t)}),(0,l.jsx)(o.DataQueriesProvider,{definitions:v,options:{suggestedStepMs:f,mode:"range"},children:(0,l.jsx)(c.Panel,{panelOptions:{hideHeader:!0},definition:{kind:"Panel",spec:{queries:b,display:{name:""},plugin:{kind:"TimeSeriesChart",spec:{}}}}})})]})}function em(e){let{metricName:t,datasource:n,filters:a,isMetadataEnabled:o,isPanelEnabled:d,onExplore:u,onFiltersChange:c,...h}=e,[x,f]=(0,E.useState)(0),{metadata:p,isLoading:m}=H(t,n),g=(0,E.useMemo)(()=>{let e=a.filter(e=>"__name__"!==e.label);return e.push({label:"__name__",labelValues:[t],operator:"="}),e},[a,t]);function j(e,t){null==u||u(e),void 0!==t&&f(t)}return(0,l.jsxs)(r.Z,{sx:{width:"100%"},...h,children:[d&&(0,l.jsx)(ep,{metricName:t,filters:a,datasource:n,type:null==p?void 0:p.type,height:"250px",isLoading:o&&m}),(0,l.jsxs)(i.Z,{value:x,onChange:(e,t)=>f(t),variant:"scrollable",sx:{borderBottom:1,borderColor:"divider"},children:[(0,l.jsx)(s.Z,{label:"Overview"}),(0,l.jsx)(s.Z,{label:"Job related metrics",icon:(0,l.jsx)(en.Z,{title:"All metrics scraped from the same job",placement:"top",children:(0,l.jsx)(el.default,{})}),iconPosition:"end"}),a.length>0&&(0,l.jsx)(s.Z,{label:"Similar metrics",icon:(0,l.jsx)(en.Z,{title:"All metrics matching current filters",placement:"top",children:(0,l.jsx)(el.default,{})}),iconPosition:"end"})]}),(0,l.jsxs)(r.Z,{gap:1,children:[0===x&&(0,l.jsx)(ed,{metricName:t,datasource:n,filters:g,onFilterAdd:function(e){c([...a,e])}}),1===x&&(0,l.jsx)(ex,{filters:g,datasource:n,isMetadataEnabled:o,onExplore:e=>j(e,0)}),2===x&&(0,l.jsx)(ef,{filters:g,datasource:n,isMetadataEnabled:o,onExplore:e=>j(e,0)})]})]})}let eg="PERSES_METRICS_FINDER_SETTINGS";function ej(e){let{value:t,onChange:n}=e,[a,r]=(0,E.useState)(null);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x.Z,{"aria-label":"settings",size:"large",onClick:e=>{r(e.currentTarget)},children:(0,l.jsx)(_.default,{})}),(0,l.jsxs)(f.Z,{id:"finder-settings-menu",anchorEl:a,open:!!a,onClose:()=>{r(null)},children:[(0,l.jsx)(p.Z,{onClick:e=>e.preventDefault(),children:(0,l.jsx)(m.Z,{control:(0,l.jsx)(g.Z,{}),label:"Enable Metadata",checked:t.isMetadataEnabled,onClick:()=>n({...t,isMetadataEnabled:!t.isMetadataEnabled})})}),(0,l.jsx)(p.Z,{onClick:e=>e.preventDefault(),children:(0,l.jsx)(m.Z,{control:(0,l.jsx)(g.Z,{}),label:"Enable Time Series Chart",checked:t.isPanelEnabled,onClick:()=>n({...t,isPanelEnabled:!t.isPanelEnabled})})})]})]})}function eb(e){let{datasource:t,filters:n,isMetadataEnabled:a,onExplore:i,...s}=e,{data:o,isLoading:d,error:u}=D("__name__",n,t),[c,h]=(0,E.useState)(""),x=(0,E.useMemo)(()=>new L({includeMatches:!0,excludedChars:[" "]}),[]),f=(0,E.useMemo)(()=>{if(c&&(null==o?void 0:o.data))return x.filter(c,o.data).sort((e,t)=>t.score-e.score)},[o,x,c]);return u?(0,l.jsxs)(r.Z,{width:"100%",children:["Error: ",u.message]}):d?(0,l.jsx)(r.Z,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(j.Z,{})}):(0,l.jsxs)(r.Z,{...s,children:[(0,l.jsx)(b.Z,{value:c,onChange:e=>h(e.target.value),placeholder:"Search metric name...",slotProps:{input:{startAdornment:(0,l.jsx)(v.Z,{position:"start",children:(0,l.jsx)(k.default,{})})}}}),(0,l.jsx)(W,{metricNames:(null==o?void 0:o.data)??[],filteredResults:f,datasource:t,filters:n,isMetadataEnabled:a,onExplore:i})]})}function ev(e){let{value:{datasource:t=I.Mm,filters:n=[],exploredMetric:a},onChange:i,onExplore:s,...o}=e,u=localStorage.getItem(eg),[c,h]=(0,E.useState)(u?JSON.parse(u):{isMetadataEnabled:!0}),x=(0,Z.Z)((0,C.Z)().breakpoints.down("md")),f=(0,E.useMemo)(()=>n.filter(e=>{let{label:t,labelValues:n}=e;return t&&(null==n?void 0:n[0])}),[n]),p=(0,d.useExplorerQueryParams)({data:{tab:"finder",datasource:t,filters:n,exploredMetric:void 0}});function m(e){i({datasource:t,filters:e,exploredMetric:a})}return(0,l.jsxs)(r.Z,{...o,gap:1,children:[(0,l.jsxs)(r.Z,{direction:x?"column":"row",gap:2,justifyContent:"space-between",children:[(0,l.jsx)(et,{datasource:t??I.Mm,filters:n??[],filteredFilters:f,onDatasourceChange:function(e){i({datasource:e,filters:n,exploredMetric:a})},onFiltersChange:m}),(0,l.jsxs)(r.Z,{direction:"row",gap:1,alignItems:"center",children:[a&&(0,l.jsx)(w.Z,{variant:"contained","aria-label":"back to metric explorer",startIcon:(0,l.jsx)(S.default,{}),component:T.Link,to:`?${p}`,children:"Back"}),(0,l.jsx)(r.Z,{direction:"row",sx:{width:x?"100%":"unset"},justifyContent:x?"end":"unset",alignItems:"center",children:(0,l.jsx)(ej,{value:c,onChange:function(e){h(e),localStorage.setItem(eg,JSON.stringify(e))}})})]})]}),a?(0,l.jsx)(em,{metricName:a,datasource:t??I.Mm,filters:f,isMetadataEnabled:c.isMetadataEnabled,isPanelEnabled:c.isPanelEnabled,onFiltersChange:m,onExplore:s}):(0,l.jsx)(eb,{datasource:t??I.Mm,filters:f,isMetadataEnabled:c.isMetadataEnabled,onExplore:s})]})}let eZ=["PrometheusTimeSeriesQuery"];function eC(e){let{queries:t}=e,{width:n,ref:r}=(0,u.default)(),i=(0,o.useSuggestedStepMs)(n),s=t.length?t.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec})):[];return(0,l.jsx)(a.Z,{ref:r,height:700,children:(0,l.jsx)(o.DataQueriesProvider,{definitions:s,options:{suggestedStepMs:i,mode:"range"},children:(0,l.jsx)(c.Panel,{panelOptions:{hideHeader:!0},definition:{kind:"Panel",spec:{queries:t,display:{name:""},plugin:{kind:"TimeSeriesChart",spec:{}}}}})})})}function ew(e){let{queries:t}=e,n=t.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec}));return(0,l.jsx)(a.Z,{height:700,children:(0,l.jsx)(o.DataQueriesProvider,{definitions:n,options:{mode:"instant"},children:(0,l.jsx)(c.Panel,{panelOptions:{hideHeader:!0},definition:{kind:"Panel",spec:{queries:t,display:{name:""},plugin:{kind:"TimeSeriesTable",spec:{}}}}})})})}function ey(){let{data:{tab:e="table",queries:t=[],datasource:n=h.Mm,filters:a=[],exploredMetric:u},setData:c}=(0,d.useExplorerManagerContext)();return(0,l.jsxs)(r.Z,{gap:2,sx:{width:"100%"},children:[(0,l.jsxs)(i.Z,{value:e,onChange:(e,n)=>c({tab:n,queries:t}),variant:"scrollable",sx:{borderBottom:1,borderColor:"divider"},children:[(0,l.jsx)(s.Z,{value:"table",label:"Table"}),(0,l.jsx)(s.Z,{value:"graph",label:"Graph"}),(0,l.jsx)(s.Z,{value:"finder",label:"Finder"})]}),(0,l.jsxs)(r.Z,{gap:1,children:["table"===e&&(0,l.jsxs)(r.Z,{children:[(0,l.jsx)(o.MultiQueryEditor,{queryTypes:["TimeSeriesQuery"],onChange:t=>c({tab:e,queries:t}),queries:t,filteredQueryPlugins:eZ}),(0,l.jsx)(ew,{queries:t})]}),"graph"===e&&(0,l.jsxs)(r.Z,{children:[(0,l.jsx)(o.MultiQueryEditor,{queryTypes:["TimeSeriesQuery"],onChange:t=>c({tab:e,queries:t}),queries:t,filteredQueryPlugins:eZ}),(0,l.jsx)(eC,{queries:t})]}),"finder"===e&&(0,l.jsx)(r.Z,{children:(0,l.jsx)(ev,{onChange:t=>c({tab:e,...t}),value:{datasource:n,filters:a,exploredMetric:u}})})]})]})}},99176:function(e,t,n){function l(e){let[t,n]=e;return[1e3*t,function(e){let t;switch(e){case"+Inf":t=1/0;break;case"-Inf":t=-1/0;break;default:t=parseFloat(e)}return t}(n)]}n.d(t,{Mm:()=>g.Mm,nY:()=>g.nY,k7:()=>C,wd:()=>Z,Nr:()=>i,mB:()=>h,Bf:()=>v,PL:()=>d,c4:()=>r,Fp:()=>s,Rv:()=>g.Rv,sv:()=>g.sv,ac:()=>c,mY:()=>o,qJ:()=>l,X2:()=>u});var a=n(35015);function r(e){return async()=>{let t=`${e.datasourceUrl}/-/healthy`;try{let n=await (0,a.he)(t,{headers:e.headers,signal:e.abortSignal});return 200===n.status}catch{return!1}}}function i(e,t){return f("/api/v1/query",e,t)}function s(e,t){return f("/api/v1/query_range",e,t)}function o(e,t){return f("/api/v1/labels",e,t)}function d(e,t){let{labelName:n,...l}=e;return 0===n.length?new Promise(e=>{e({data:[]})}):x(`/api/v1/label/${encodeURIComponent(n)}/values`,l,t)}function u(e,t){return x("/api/v1/metadata",e,t)}function c(e,t){return f("/api/v1/series",e,t)}function h(e,t){return f("/api/v1/parse_query",e,t)}function x(e,t,n){let{datasourceUrl:l,headers:r}=n,i=`${l}${e}`,s=p(t).toString();return""!==s&&(i+=`?${s}`),(0,a.rd)(i,{method:"GET",headers:r})}function f(e,t,n){let{datasourceUrl:l,headers:a,abortSignal:r}=n;return m(`${l}${e}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...a},signal:r,body:p(t)})}function p(e){let t=new URLSearchParams;for(let n in e){let l=e[n];if(void 0!==l){if("string"==typeof l){t.append(n,l);continue}if("number"==typeof l){t.append(n,l.toString());continue}for(let e of l)t.append(n,e)}}return t}async function m(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let l=await (0,a.he)(...t);return{...await l.json(),rawResponse:l}}var g=n(21969),j=n(29085),b=n(20461);function v(e){let{start:t,end:n}=e;return{start:Math.ceil((0,b.getUnixTime)(t)),end:Math.ceil((0,b.getUnixTime)(n))}}function Z(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=(e.end-e.start)/1e4;return a>1&&(a=Math.ceil(a)),Math.max(l/1e3*n,t,a)}function C(e){if(!e)return;let t=(0,j.Ib)(e);return Math.floor((0,b.milliseconds)(t)/1e3)}},21969:function(e,t,n){n.d(t,{Mm:()=>r,Rv:()=>i,nY:()=>a,sv:()=>s});var l=n(72);let a="PrometheusDatasource",r={kind:a};function i(e){return!(0,l.isVariableDatasource)(e)&&void 0===e.name}function s(e){return(0,l.isVariableDatasource)(e)||e.kind===a}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["8035"],{74081:function(e,a,r){var l;a.default=void 0,a.default=(0,((l=r(30265))&&l.__esModule?l:{default:l}).default)("M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z","TrashCan")},24867:function(e,a,r){r.r(a),r.d(a,{PrometheusLabelNamesVariable:()=>o});var l=r(72),t=r(99176),s=r(62284);let o={getVariableOptions:async(e,a)=>{let r=(0,l.datasourceSelectValueToSelector)(e.datasource??t.Mm,a.variables,await a.datasourceStore.listDatasourceSelectItems(t.nY))??t.Mm,o=await a.datasourceStore.getDatasourceClient(r),u=e.matchers?e.matchers.map(e=>(0,l.replaceVariables)(e,a.variables)):void 0,n=(0,t.Bf)(a.timeRange),{data:i}=await o.labelNames({"match[]":u,...n});return{data:(0,s.LY)(i)}},dependsOn:e=>{var a;return{variables:[...(null==(a=e.matchers)?void 0:a.map(e=>(0,l.parseVariables)(e)).flat())||[],...e.datasource&&(0,l.isVariableDatasource)(e.datasource)?(0,l.parseVariables)(e.datasource):[]]}},OptionsEditorComponent:s.g3,createInitialOptions:()=>({})}},62284:function(e,a,r){r.d(a,{gB:()=>y,g3:()=>g,xA:()=>f,qT:()=>x,ik:()=>C,LY:()=>V});var l=r(24246),t=r(25283),s=r(90192),o=r(8695),u=r(72),n=r(75586),i=r(54538),c=r(64001),d=r(99176),m=r(36372),h=r(75094),b=r(48565),v=r(74081);function p(e){let{matchers:a,onChange:r,isReadonly:s}=e;return(0,l.jsxs)(t.Z,{spacing:1,mb:2,children:[a.map((e,t)=>(0,l.jsxs)(m.Z,{display:"flex",children:[(0,l.jsx)(o.Z,{fullWidth:!0,label:"Series Selector",value:e,InputProps:{readOnly:s},onChange:e=>{r((0,n.Uy)(a,a=>{a[t]=e.target.value}))}}),(0,l.jsx)(h.Z,{onClick:()=>{r((0,n.Uy)(a,e=>{e.splice(t,1)}))},disabled:s,children:(0,l.jsx)(v.default,{})})]},t)),(0,l.jsx)(m.Z,{children:(0,l.jsx)(b.Z,{fullWidth:!1,color:"secondary",variant:"outlined",onClick:()=>{r((0,n.Uy)(a,e=>{e.push("")}))},disabled:s,children:"Add Series Selector"})})]})}function f(e){let{onChange:a,value:r,value:{datasource:c}}=e,m=c??d.Mm,[h,b]=(0,i.useState)(e.value.labelName),[v,f]=(0,i.useState)(e.value.matchers??[]),g=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(r,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[a,r]),x=(0,i.useCallback)(e=>{b(e.target.value)},[]),y=(0,i.useCallback)(e=>{f(e)},[]);return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(s.Z,{margin:"dense",children:(0,l.jsx)(u.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:m,onChange:g,readOnly:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(o.Z,{label:"Label Name",required:!0,value:h,onChange:x,InputProps:{readOnly:e.isReadonly}}),(0,l.jsx)(p,{matchers:v,onChange:y,isReadonly:e.isReadonly})]})}function g(e){let{onChange:a,value:r,value:{datasource:o}}=e,c=o??d.Mm,[m,h]=(0,i.useState)(e.value.matchers??[]),b=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(r,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[a,r]),v=(0,i.useCallback)(e=>{h(e)},[]);return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(s.Z,{margin:"dense",children:(0,l.jsx)(u.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:c,onChange:b,disabled:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(p,{matchers:m,isReadonly:e.isReadonly,onChange:v})]})}function x(e){let{onChange:a,value:r,value:{datasource:m}}=e,h=m??d.Mm,b=(0,u.useDatasourceSelectValueToSelector)(h,d.nY),{data:v}=(0,u.useDatasourceClient)(b),p=null==v?void 0:v.options.datasourceUrl,[f,g]=(0,i.useState)(e.value.labelName),x=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(r,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[r,a]),y=(0,i.useCallback)(e=>{a({...r,expr:e.target.textContent??""})},[a,r]),C=(0,i.useCallback)(e=>{g(e.target.value)},[]);return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(s.Z,{margin:"dense",children:(0,l.jsx)(u.DatasourceSelect,{datasourcePluginKind:d.nY,value:h,onChange:x,labelId:"prom-datasource-label",label:"Prometheus Datasource",disabled:e.isReadonly})}),(0,l.jsx)(c.P,{completeConfig:{remote:{url:p}},value:r.expr,datasource:b,onBlur:y,readOnly:e.isReadonly,width:"100%"}),(0,l.jsx)(o.Z,{label:"Label Name",required:!0,value:f,InputProps:{readOnly:e.isReadonly},onChange:C})]})}function y(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}function C(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}let V=e=>e?e.map(e=>({value:e,label:e})):[]}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["6925"],{74081:function(e,a,l){var r;a.default=void 0,a.default=(0,((r=l(30265))&&r.__esModule?r:{default:r}).default)("M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z","TrashCan")},41233:function(e,a,l){l.r(a),l.d(a,{PrometheusLabelValuesVariable:()=>o});var r=l(72),t=l(99176),s=l(62284);let o={getVariableOptions:async(e,a)=>{let l=(0,r.datasourceSelectValueToSelector)(e.datasource??t.Mm,a.variables,await a.datasourceStore.listDatasourceSelectItems(t.nY))??t.Mm,o=await a.datasourceStore.getDatasourceClient(l),u=e.matchers?e.matchers.map(e=>(0,r.replaceVariables)(e,a.variables)):void 0,n=(0,t.Bf)(a.timeRange),{data:i}=await o.labelValues({labelName:(0,r.replaceVariables)(e.labelName,a.variables),"match[]":u,...n});return{data:(0,s.LY)(i)}},dependsOn:e=>{var a;let l=(null==(a=e.matchers)?void 0:a.map(e=>(0,r.parseVariables)(e)).flat())||[];return{variables:[...l,...(0,r.parseVariables)(e.labelName),...e.datasource&&(0,r.isVariableDatasource)(e.datasource)?(0,r.parseVariables)(e.datasource):[]]}},OptionsEditorComponent:s.xA,createInitialOptions:()=>({labelName:""})}},62284:function(e,a,l){l.d(a,{gB:()=>V,g3:()=>x,xA:()=>f,qT:()=>g,ik:()=>y,LY:()=>C});var r=l(24246),t=l(25283),s=l(90192),o=l(8695),u=l(72),n=l(75586),i=l(54538),c=l(64001),d=l(99176),b=l(36372),m=l(75094),h=l(48565),v=l(74081);function p(e){let{matchers:a,onChange:l,isReadonly:s}=e;return(0,r.jsxs)(t.Z,{spacing:1,mb:2,children:[a.map((e,t)=>(0,r.jsxs)(b.Z,{display:"flex",children:[(0,r.jsx)(o.Z,{fullWidth:!0,label:"Series Selector",value:e,InputProps:{readOnly:s},onChange:e=>{l((0,n.Uy)(a,a=>{a[t]=e.target.value}))}}),(0,r.jsx)(m.Z,{onClick:()=>{l((0,n.Uy)(a,e=>{e.splice(t,1)}))},disabled:s,children:(0,r.jsx)(v.default,{})})]},t)),(0,r.jsx)(b.Z,{children:(0,r.jsx)(h.Z,{fullWidth:!1,color:"secondary",variant:"outlined",onClick:()=>{l((0,n.Uy)(a,e=>{e.push("")}))},disabled:s,children:"Add Series Selector"})})]})}function f(e){let{onChange:a,value:l,value:{datasource:c}}=e,b=c??d.Mm,[m,h]=(0,i.useState)(e.value.labelName),[v,f]=(0,i.useState)(e.value.matchers??[]),x=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(l,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[a,l]),g=(0,i.useCallback)(e=>{h(e.target.value)},[]),V=(0,i.useCallback)(e=>{f(e)},[]);return(0,r.jsxs)(t.Z,{spacing:2,children:[(0,r.jsx)(s.Z,{margin:"dense",children:(0,r.jsx)(u.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:b,onChange:x,readOnly:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,r.jsx)(o.Z,{label:"Label Name",required:!0,value:m,onChange:g,InputProps:{readOnly:e.isReadonly}}),(0,r.jsx)(p,{matchers:v,onChange:V,isReadonly:e.isReadonly})]})}function x(e){let{onChange:a,value:l,value:{datasource:o}}=e,c=o??d.Mm,[b,m]=(0,i.useState)(e.value.matchers??[]),h=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(l,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[a,l]),v=(0,i.useCallback)(e=>{m(e)},[]);return(0,r.jsxs)(t.Z,{spacing:2,children:[(0,r.jsx)(s.Z,{margin:"dense",children:(0,r.jsx)(u.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:c,onChange:h,disabled:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,r.jsx)(p,{matchers:b,isReadonly:e.isReadonly,onChange:v})]})}function g(e){let{onChange:a,value:l,value:{datasource:b}}=e,m=b??d.Mm,h=(0,u.useDatasourceSelectValueToSelector)(m,d.nY),{data:v}=(0,u.useDatasourceClient)(h),p=null==v?void 0:v.options.datasourceUrl,[f,x]=(0,i.useState)(e.value.labelName),g=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(l,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[l,a]),V=(0,i.useCallback)(e=>{a({...l,expr:e.target.textContent??""})},[a,l]),y=(0,i.useCallback)(e=>{x(e.target.value)},[]);return(0,r.jsxs)(t.Z,{spacing:2,children:[(0,r.jsx)(s.Z,{margin:"dense",children:(0,r.jsx)(u.DatasourceSelect,{datasourcePluginKind:d.nY,value:m,onChange:g,labelId:"prom-datasource-label",label:"Prometheus Datasource",disabled:e.isReadonly})}),(0,r.jsx)(c.P,{completeConfig:{remote:{url:p}},value:l.expr,datasource:h,onBlur:V,readOnly:e.isReadonly,width:"100%"}),(0,r.jsx)(o.Z,{label:"Label Name",required:!0,value:f,InputProps:{readOnly:e.isReadonly},onChange:y})]})}function V(e,a){let l=new Set;for(let r of e.result){let e=r.metric[a];void 0!==e&&l.add(e)}return Array.from(l.values())}function y(e,a){let l=new Set;for(let r of e.result){let e=r.metric[a];void 0!==e&&l.add(e)}return Array.from(l.values())}let C=e=>e?e.map(e=>({value:e,label:e})):[]}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["3520"],{74081:function(e,a,r){var l;a.default=void 0,a.default=(0,((l=r(30265))&&l.__esModule?l:{default:l}).default)("M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z","TrashCan")},7909:function(e,a,r){r.r(a),r.d(a,{PrometheusPromQLVariable:()=>o});var l=r(72),t=r(99176),s=r(62284);let o={getVariableOptions:async(e,a)=>{let r=(0,l.datasourceSelectValueToSelector)(e.datasource??t.Mm,a.variables,await a.datasourceStore.listDatasourceSelectItems(t.nY))??t.Mm,o=await a.datasourceStore.getDatasourceClient(r),{data:u}=await o.instantQuery({query:(0,l.replaceVariables)(e.expr,a.variables)}),n=(0,l.replaceVariables)(e.labelName,a.variables),i=[];return(null==u?void 0:u.resultType)==="matrix"?i=(0,s.gB)(u,n):(null==u?void 0:u.resultType)==="vector"&&(i=(0,s.ik)(u,n)),{data:(0,s.LY)(i)}},dependsOn:e=>{let a=(0,l.parseVariables)(e.expr);return{variables:[...a,...(0,l.parseVariables)(e.labelName),...e.datasource&&(0,l.isVariableDatasource)(e.datasource)?(0,l.parseVariables)(e.datasource):[]]}},OptionsEditorComponent:s.qT,createInitialOptions:()=>({expr:"",labelName:""})}},62284:function(e,a,r){r.d(a,{gB:()=>g,g3:()=>y,xA:()=>x,qT:()=>f,ik:()=>V,LY:()=>C});var l=r(24246),t=r(25283),s=r(90192),o=r(8695),u=r(72),n=r(75586),i=r(54538),c=r(64001),d=r(99176),b=r(36372),m=r(75094),v=r(48565),h=r(74081);function p(e){let{matchers:a,onChange:r,isReadonly:s}=e;return(0,l.jsxs)(t.Z,{spacing:1,mb:2,children:[a.map((e,t)=>(0,l.jsxs)(b.Z,{display:"flex",children:[(0,l.jsx)(o.Z,{fullWidth:!0,label:"Series Selector",value:e,InputProps:{readOnly:s},onChange:e=>{r((0,n.Uy)(a,a=>{a[t]=e.target.value}))}}),(0,l.jsx)(m.Z,{onClick:()=>{r((0,n.Uy)(a,e=>{e.splice(t,1)}))},disabled:s,children:(0,l.jsx)(h.default,{})})]},t)),(0,l.jsx)(b.Z,{children:(0,l.jsx)(v.Z,{fullWidth:!1,color:"secondary",variant:"outlined",onClick:()=>{r((0,n.Uy)(a,e=>{e.push("")}))},disabled:s,children:"Add Series Selector"})})]})}function x(e){let{onChange:a,value:r,value:{datasource:c}}=e,b=c??d.Mm,[m,v]=(0,i.useState)(e.value.labelName),[h,x]=(0,i.useState)(e.value.matchers??[]),y=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(r,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[a,r]),f=(0,i.useCallback)(e=>{v(e.target.value)},[]),g=(0,i.useCallback)(e=>{x(e)},[]);return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(s.Z,{margin:"dense",children:(0,l.jsx)(u.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:b,onChange:y,readOnly:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(o.Z,{label:"Label Name",required:!0,value:m,onChange:f,InputProps:{readOnly:e.isReadonly}}),(0,l.jsx)(p,{matchers:h,onChange:g,isReadonly:e.isReadonly})]})}function y(e){let{onChange:a,value:r,value:{datasource:o}}=e,c=o??d.Mm,[b,m]=(0,i.useState)(e.value.matchers??[]),v=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(r,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[a,r]),h=(0,i.useCallback)(e=>{m(e)},[]);return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(s.Z,{margin:"dense",children:(0,l.jsx)(u.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:c,onChange:v,disabled:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(p,{matchers:b,isReadonly:e.isReadonly,onChange:h})]})}function f(e){let{onChange:a,value:r,value:{datasource:b}}=e,m=b??d.Mm,v=(0,u.useDatasourceSelectValueToSelector)(m,d.nY),{data:h}=(0,u.useDatasourceClient)(v),p=null==h?void 0:h.options.datasourceUrl,[x,y]=(0,i.useState)(e.value.labelName),f=(0,i.useCallback)(e=>{if((0,u.isVariableDatasource)(e)||(0,d.sv)(e))return void a((0,n.Uy)(r,a=>{a.datasource=!(0,u.isVariableDatasource)(e)&&(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},[r,a]),g=(0,i.useCallback)(e=>{a({...r,expr:e.target.textContent??""})},[a,r]),V=(0,i.useCallback)(e=>{y(e.target.value)},[]);return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(s.Z,{margin:"dense",children:(0,l.jsx)(u.DatasourceSelect,{datasourcePluginKind:d.nY,value:m,onChange:f,labelId:"prom-datasource-label",label:"Prometheus Datasource",disabled:e.isReadonly})}),(0,l.jsx)(c.P,{completeConfig:{remote:{url:p}},value:r.expr,datasource:v,onBlur:g,readOnly:e.isReadonly,width:"100%"}),(0,l.jsx)(o.Z,{label:"Label Name",required:!0,value:x,InputProps:{readOnly:e.isReadonly},onChange:V})]})}function g(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}function V(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}let C=e=>e?e.map(e=>({value:e,label:e})):[]}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["9606"],{44301:function(e,t,a){a.r(t),a.d(t,{PrometheusTimeSeriesQuery:()=>b});var r=a(72),s=a(29085),n=a(20461),l=a(99176);function u(e,t){let a=[];return Object.keys(e).sort().forEach(r=>{let s=e[r];void 0!==s&&(t?a.push(`"${r}":"${s}"`):a.push(`${r}="${s}"`))}),`{${a.join(",")}}`}function i(e,t,a){let r=function(e){let{removeExprWrap:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a="__name__";if(Object.prototype.hasOwnProperty.call(e,a)){let r=u({...e,[a]:void 0},t);return t?`${r}`:`${e[a]}${r}`}return u(e,t)}(t),s=a?a.replace(/\{\{\s*(.+?)\s*\}\}/g,(e,a)=>t[a]??""):r;return{name:r,formattedName:s}}var o=a(16146),c=a(17197);let d=async(e,t,a)=>{let u;if(void 0===e.query||null===e.query||""===e.query)return{series:[]};let d=await t.datasourceStore.listDatasourceSelectItems(l.nY),m=(0,r.datasourceSelectValueToSelector)(e.datasource??l.Mm,t.variableState,d)??l.Mm,p=await t.datasourceStore.getDatasource(m),h=Math.trunc((0,n.milliseconds)((0,s.Ib)(p.plugin.spec.scrapeInterval??o.v))/1e3),v=(0,l.k7)((0,r.replaceVariables)(e.minStep,t.variableState))??h,g=(0,l.Bf)(t.timeRange),y=(0,l.wd)(g,v,void 0,t.suggestedStepMs),{start:S,end:f}=g,b=60*new Date().getTimezoneOffset(),w=Math.floor((f+b)/y)*y-b;S=Math.floor((S+b)/y)*y-b,(f=w)===S&&(f=S+y,console.warn(`Step (${y}) was larger than the time range! end of time range was set accordingly.`));let x=(0,c.d)(e.query,1e3*v,1e3*y);x=(0,r.replaceVariables)(x,t.variableState);let q=e.seriesNameFormat;q&&(q=(0,r.replaceVariables)(q,t.variableState));let C=await t.datasourceStore.getDatasourceClient(m),D=(u="instant"===t.mode?await C.instantQuery({query:x,time:f},void 0,a):await C.rangeQuery({query:x,start:S,end:f,step:y},void 0,a)).data,M=[];if("success"===u.status){let e=(u.warnings??[])[0]??"";""!==e&&M.push({type:"warning",message:e})}return{timeRange:{start:(0,n.fromUnixTime)(S),end:(0,n.fromUnixTime)(f)},stepMs:1e3*y,series:function(e,t,a){if(!t)return[];let r=t.resultType;switch(r){case"vector":return t.result.map(t=>{let{metric:r,value:s,histogram:n}=t,{name:u,formattedName:o}=i(e,r,a);return n?{name:u,formattedName:o,labels:r,values:[(0,l.qJ)([n[0],n[1].sum])],histograms:[n]}:{name:u,formattedName:o,labels:r,values:[(0,l.qJ)(s)]}});case"matrix":return t.result.map(t=>{let{metric:r,values:s,histograms:n}=t,{name:u,formattedName:o}=i(e,r,a);return n?{name:u,formattedName:o,labels:r,values:n.map(e=>(0,l.qJ)([e[0],e[1].sum])),histograms:n.map(e=>e)}:{name:u,formattedName:o,labels:r,values:s.map(l.qJ)}});case"scalar":let{name:s,formattedName:n}=i(e,{},a);return[{name:s,values:[(0,l.qJ)(t.result)],formattedName:n}];default:return console.warn("Unknown result type",r,t),[]}}(x,D,q),metadata:{notices:M,executedQueryString:x}}};var m=a(24246),p=a(75586),h=a(19154),v=a(25283),g=a(90192),y=a(8695),S=a(64001),f=a(54538);let b={getTimeSeriesData:d,OptionsEditorComponent:function(e){let{onChange:t,value:a,value:{query:s,datasource:n},isReadonly:u}=e,i=n??l.Mm,c=(0,h.useId)("prom-datasource-label"),d=(0,r.useDatasourceSelectValueToSelector)(i,l.nY),{data:b}=(0,r.useDatasourceClient)(d),w=null==b?void 0:b.options.datasourceUrl,{data:x}=(0,r.useDatasource)(d),{handleQueryChange:q,handleQueryBlur:C}=function(e){let{onChange:t,value:a}=e,[r,s]=(0,f.useState)(a.query),[n,l]=(0,f.useState)(a.query);return a.query!==n&&(s(a.query),l(a.query)),{query:r,handleQueryChange:e=>{s(e)},handleQueryBlur:()=>{l(r),t((0,p.Uy)(a,e=>{e.query=r}))}}}(e),{format:D,handleFormatChange:M,handleFormatBlur:O}=function(e){let{onChange:t,value:a}=e,[r,s]=(0,f.useState)(a.seriesNameFormat),[n,l]=(0,f.useState)(a.seriesNameFormat);return a.seriesNameFormat!==n&&(s(a.seriesNameFormat),l(a.seriesNameFormat)),{format:r,handleFormatChange:e=>{s(e)},handleFormatBlur:()=>{l(r),t((0,p.Uy)(a,e=>{e.seriesNameFormat=r}))}}}(e),{minStep:T,handleMinStepChange:j,handleMinStepBlur:F}=function(e){let{onChange:t,value:a}=e,[r,s]=(0,f.useState)(a.minStep),[n,l]=(0,f.useState)(a.minStep);return a.minStep!==n&&(s(a.minStep),l(a.minStep)),{minStep:r,handleMinStepChange:e=>{s(e)},handleMinStepBlur:()=>{l(r),t((0,p.Uy)(a,e=>{e.minStep=r}))}}}(e),P=T??(x&&(null==x?void 0:x.plugin.spec).scrapeInterval)??o.v;return(0,m.jsxs)(v.Z,{spacing:2,children:[(0,m.jsx)(g.Z,{margin:"dense",fullWidth:!1,children:(0,m.jsx)(r.DatasourceSelect,{datasourcePluginKind:l.nY,value:i,onChange:e=>{if((0,l.sv)(e))return void t((0,p.Uy)(a,t=>{t.datasource=(0,l.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},labelId:c,label:"Prometheus Datasource",notched:!0,readOnly:u})}),(0,m.jsx)(S.P,{completeConfig:{remote:{url:w}},value:s,datasource:d,onChange:q,onBlur:C,isReadOnly:u}),(0,m.jsxs)(v.Z,{direction:"row",spacing:2,children:[(0,m.jsx)(y.Z,{fullWidth:!0,label:"Legend",placeholder:"Example: '{{instance}}' will generate series names like 'webserver-123', 'webserver-456'...",helperText:"Text to be displayed in the legend and the tooltip. Use {{label_name}} to interpolate label values.",value:D??"",onChange:e=>M(e.target.value),onBlur:O,slotProps:{inputLabel:{shrink:!!u||void 0},input:{readOnly:u}}}),(0,m.jsx)(y.Z,{label:"Min Step",placeholder:P,helperText:"Lower bound for the step. If not provided, the scrape interval of the datasource is used.",value:T??"",onChange:e=>j(e.target.value?e.target.value:void 0),onBlur:F,sx:{width:"250px"},slotProps:{inputLabel:{shrink:!!u||void 0},input:{readOnly:u}}})]})]})},createInitialOptions:()=>({query:"",datasource:void 0}),dependsOn:e=>{let t=(0,r.parseVariables)(e.query);return{variables:[...new Set([...t,...(0,r.parseVariables)(e.seriesNameFormat||""),...(0,r.isVariableDatasource)(e.datasource)?(0,r.parseVariables)(e.datasource??""):[]])]}}}},16146:function(e,t,a){a.d(t,{v:()=>r});let r="1m"}}]);