@perses-dev/prometheus-plugin 0.58.0-beta.0 → 0.58.0-beta.1

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 (129) hide show
  1. package/__mf/js/Prometheus.d3a12aa6.js +7 -0
  2. package/__mf/js/async/1728.e8350fb6.js +1 -0
  3. package/__mf/js/async/1872.7a33d27d.js +7 -0
  4. package/__mf/js/async/2228.53db17f4.js +2 -0
  5. package/__mf/js/async/{7462.e9a1c8bc.js.LICENSE.txt → 2228.53db17f4.js.LICENSE.txt} +17 -1
  6. package/__mf/js/async/2340.1f49ce2e.js +1 -0
  7. package/__mf/js/async/2979.1d711dae.js +1 -0
  8. package/__mf/js/async/425.b9d2dc6f.js +1 -0
  9. package/__mf/js/async/4402.2c6a54dd.js +1 -0
  10. package/__mf/js/async/4626.90ae092f.js +1 -0
  11. package/__mf/js/async/7670.3e71874a.js +1 -0
  12. package/__mf/js/async/8356.6a2bfd53.js +1 -0
  13. package/__mf/js/async/8750.7d02f3b6.js +3 -0
  14. package/__mf/js/async/9594.d1a3d0d9.js +1 -0
  15. package/__mf/js/async/9916.11d16715.js +22 -0
  16. package/__mf/js/async/__federation_expose_PrometheusDatasource.2d013450.js +1 -0
  17. package/__mf/js/async/__federation_expose_PrometheusExplorer.f82cdff6.js +1 -0
  18. package/__mf/js/async/{__federation_expose_PrometheusLabelNamesVariable.86c44577.js → __federation_expose_PrometheusLabelNamesVariable.c01296a1.js} +1 -1
  19. package/__mf/js/async/{__federation_expose_PrometheusLabelValuesVariable.ff683936.js → __federation_expose_PrometheusLabelValuesVariable.e47f56d4.js} +1 -1
  20. package/__mf/js/async/{__federation_expose_PrometheusPromQLVariable.bac03b61.js → __federation_expose_PrometheusPromQLVariable.593376e2.js} +1 -1
  21. package/__mf/js/async/{__federation_expose_PrometheusTimeSeriesQuery.9a495e56.js → __federation_expose_PrometheusTimeSeriesQuery.ee2d94d2.js} +1 -1
  22. package/__mf/js/main.31c60b65.js +7 -0
  23. package/lib/cjs/components/promql/format.js +6 -6
  24. package/lib/cjs/components/promql/serialize.js +4 -4
  25. package/lib/cjs/model/prometheus-client.js +4 -4
  26. package/lib/cjs/model/time.js +2 -2
  27. package/lib/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +2 -2
  28. package/lib/cjs/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +3 -3
  29. package/lib/components/TreeNode.d.ts.map +1 -1
  30. package/lib/components/TreeNode.js.map +1 -1
  31. package/lib/components/promql/format.d.ts.map +1 -1
  32. package/lib/components/promql/format.js +6 -6
  33. package/lib/components/promql/format.js.map +1 -1
  34. package/lib/components/promql/serialize.js +4 -4
  35. package/lib/components/promql/serialize.js.map +1 -1
  36. package/lib/components/query.d.ts +2 -1
  37. package/lib/components/query.d.ts.map +1 -1
  38. package/lib/components/query.js.map +1 -1
  39. package/lib/explore/PrometheusExplorer.d.ts.map +1 -1
  40. package/lib/explore/PrometheusExplorer.js +1 -1
  41. package/lib/explore/PrometheusExplorer.js.map +1 -1
  42. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.d.ts +1 -1
  43. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.d.ts.map +1 -1
  44. package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js.map +1 -1
  45. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.d.ts +1 -1
  46. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.d.ts.map +1 -1
  47. package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js.map +1 -1
  48. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.d.ts +1 -1
  49. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.d.ts.map +1 -1
  50. package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js.map +1 -1
  51. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.d.ts +1 -1
  52. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.d.ts.map +1 -1
  53. package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js.map +1 -1
  54. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.d.ts +1 -1
  55. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.d.ts.map +1 -1
  56. package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js.map +1 -1
  57. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.d.ts +1 -1
  58. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.d.ts.map +1 -1
  59. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +1 -1
  60. package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js.map +1 -1
  61. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.d.ts +1 -1
  62. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.d.ts.map +1 -1
  63. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +1 -1
  64. package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js.map +1 -1
  65. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.d.ts +1 -1
  66. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.d.ts.map +1 -1
  67. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +1 -1
  68. package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js.map +1 -1
  69. package/lib/explore/PrometheusMetricsFinder/types.d.ts +1 -1
  70. package/lib/explore/PrometheusMetricsFinder/types.js.map +1 -1
  71. package/lib/explore/PrometheusMetricsFinder/utils.d.ts +2 -1
  72. package/lib/explore/PrometheusMetricsFinder/utils.d.ts.map +1 -1
  73. package/lib/explore/PrometheusMetricsFinder/utils.js.map +1 -1
  74. package/lib/model/api-types.d.ts +1 -1
  75. package/lib/model/api-types.js.map +1 -1
  76. package/lib/model/prometheus-client.d.ts +1 -1
  77. package/lib/model/prometheus-client.d.ts.map +1 -1
  78. package/lib/model/prometheus-client.js +1 -1
  79. package/lib/model/prometheus-client.js.map +1 -1
  80. package/lib/model/prometheus-selectors.d.ts +1 -1
  81. package/lib/model/prometheus-selectors.d.ts.map +1 -1
  82. package/lib/model/prometheus-selectors.js.map +1 -1
  83. package/lib/model/time.d.ts +1 -1
  84. package/lib/model/time.d.ts.map +1 -1
  85. package/lib/model/time.js +1 -1
  86. package/lib/model/time.js.map +1 -1
  87. package/lib/plugins/PrometheusDatasourceEditor.d.ts.map +1 -1
  88. package/lib/plugins/PrometheusDatasourceEditor.js.map +1 -1
  89. package/lib/plugins/interpolation.d.ts +1 -1
  90. package/lib/plugins/interpolation.d.ts.map +1 -1
  91. package/lib/plugins/interpolation.js.map +1 -1
  92. package/lib/plugins/prometheus-datasource.d.ts.map +1 -1
  93. package/lib/plugins/prometheus-datasource.js.map +1 -1
  94. package/lib/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -1
  95. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js +1 -1
  96. package/lib/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
  97. package/lib/plugins/prometheus-time-series-query/query-editor-model.d.ts +1 -1
  98. package/lib/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -1
  99. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +3 -3
  100. package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js.map +1 -1
  101. package/lib/plugins/prometheus-time-series-query/time-series-query-model.d.ts +1 -1
  102. package/lib/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +1 -1
  103. package/lib/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -1
  104. package/lib/plugins/types.d.ts +1 -1
  105. package/lib/plugins/types.d.ts.map +1 -1
  106. package/lib/plugins/types.js.map +1 -1
  107. package/mf-manifest.json +122 -116
  108. package/mf-stats.json +125 -119
  109. package/package.json +8 -7
  110. package/__mf/js/Prometheus.c5cd832d.js +0 -7
  111. package/__mf/js/async/1728.310a7d33.js +0 -1
  112. package/__mf/js/async/2292.27a5ec4d.js +0 -4
  113. package/__mf/js/async/2292.27a5ec4d.js.LICENSE.txt +0 -15
  114. package/__mf/js/async/3829.f250b55a.js +0 -7
  115. package/__mf/js/async/4402.99ae853d.js +0 -1
  116. package/__mf/js/async/4626.e7ed0d7d.js +0 -1
  117. package/__mf/js/async/4800.cc42977e.js +0 -22
  118. package/__mf/js/async/4887.8af3673d.js +0 -1
  119. package/__mf/js/async/5697.e17ba256.js +0 -1
  120. package/__mf/js/async/7462.e9a1c8bc.js +0 -2
  121. package/__mf/js/async/8292.11dc2ca3.js +0 -1
  122. package/__mf/js/async/8356.e845a073.js +0 -1
  123. package/__mf/js/async/8634.e3cfb057.js +0 -1
  124. package/__mf/js/async/__federation_expose_PrometheusDatasource.d4892cae.js +0 -1
  125. package/__mf/js/async/__federation_expose_PrometheusExplorer.681841d8.js +0 -1
  126. package/__mf/js/main.afe2fc64.js +0 -7
  127. /package/__mf/css/async/{3829.85c2cbf6.css → 1872.85c2cbf6.css} +0 -0
  128. /package/__mf/js/async/{3829.f250b55a.js.LICENSE.txt → 1872.7a33d27d.js.LICENSE.txt} +0 -0
  129. /package/__mf/js/async/{4800.cc42977e.js.LICENSE.txt → 9916.11d16715.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self["chunk_Prometheus "]=self["chunk_Prometheus "]||[]).push([["8292"],{315(e,t,s){s.d(t,{A:()=>a});var o=s(68335),r=s(77308),n=s(72052);let a=(0,o.A)({createStyledComponent:(0,r.A)("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root}),useThemeProps:e=>(0,n.b)({props:e,name:"MuiStack"})})},68335(e,t,s){s.d(t,{A:()=>v});var o=s(70451),r=s(11750),n=s(6121),a=s(46733),u=s(81023),i=s(7939),l=s(51327),c=s(20523),d=s(80787),p=s(85351),h=s(89187),f=s(62540);let m=(0,d.A)(),y=(0,i.A)("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root});function w(e){return(0,l.A)({props:e,name:"MuiStack",defaultTheme:m})}let k=({ownerState:e,theme:t})=>{let s={display:"flex",flexDirection:"column",...(0,p.NI)({theme:t},(0,p.kW)({values:e.direction,breakpoints:t.breakpoints.values}),e=>({flexDirection:e}))};if(e.spacing){let o=(0,h.LX)(t),r=Object.keys(t.breakpoints.values).reduce((t,s)=>(("object"==typeof e.spacing&&null!=e.spacing[s]||"object"==typeof e.direction&&null!=e.direction[s])&&(t[s]=!0),t),{}),a=(0,p.kW)({values:e.direction,base:r}),u=(0,p.kW)({values:e.spacing,base:r});"object"==typeof a&&Object.keys(a).forEach((e,t,s)=>{if(!a[e]){let o=t>0?a[s[t-1]]:"column";a[e]=o}}),s=(0,n.A)(s,(0,p.NI)({theme:t},u,(t,s)=>e.useFlexGap?{gap:(0,h._W)(o,t)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[s?a[s]:e.direction]}`]:(0,h._W)(o,t)}}))}return(0,p.iZ)(t.breakpoints,s)};function v(e={}){let{createStyledComponent:t=y,useThemeProps:s=w,componentName:n="MuiStack"}=e,i=t(k);return o.forwardRef(function(e,t){let l,d=s(e),{component:p="div",direction:h="column",spacing:m=0,divider:y,children:w,className:k,useFlexGap:v=!1,...A}=(0,c.A)(d),g=(0,u.A)({root:["root"]},e=>(0,a.Ay)(n,e),{});return(0,f.jsx)(i,{as:p,ownerState:{direction:h,spacing:m,useFlexGap:v},ref:t,className:(0,r.A)(g.root,k),...A,children:y?(l=o.Children.toArray(w).filter(Boolean)).reduce((e,t,s)=>(e.push(t),s<l.length-1&&e.push(o.cloneElement(y,{key:`separator-${s}`})),e),[]):w})})}},7939(e,t,s){s.d(t,{A:()=>o});let o=(0,s(57867).Ay)()},70320(e,t,s){s.d(t,{A:()=>r});var o=s(52215);function r(e){let{theme:t,name:s,props:r}=e;return t&&t.components&&t.components[s]&&t.components[s].defaultProps?(0,o.A)(t.components[s].defaultProps,r):r}},51327(e,t,s){s.d(t,{A:()=>n});var o=s(70320),r=s(26041);function n({props:e,name:t,defaultTheme:s,themeId:a}){let u=(0,r.A)(s);return a&&(u=u[a]||u),(0,o.A)({theme:u,name:t,props:e})}},69791(e,t,s){s.d(t,{a3:()=>a,eo:()=>n,pW:()=>r}),s(94461);let o=/^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;function r(e){let t=o.exec(e);if(null===t)throw Error(`Invalid duration string '${e}'`);return{years:parseInt(t[1]??"0"),months:0,weeks:parseInt(t[2]??"0"),days:parseInt(t[3]??"0"),hours:parseInt(t[4]??"0"),minutes:parseInt(t[5]??"0"),seconds:parseInt(t[6]??"0")+parseInt(t[7]??"0")/1e3}}function n(e){let t=Math.trunc(e/31536e6);t>0&&(e-=31536e6*t);let s=Math.trunc(e/6048e5);s>0&&(e-=6048e5*s);let o=Math.trunc(e/864e5);o>0&&(e-=864e5*o);let r=Math.trunc(e/36e5);r>0&&(e-=36e5*r);let n=Math.trunc(e/6e4);return n>0&&(e-=6e4*n),{years:t,months:0,weeks:s,days:o,hours:r,minutes:n,seconds:e/1e3}}function a(e){let t=[];if(e.years&&t.push(`${e.years}y`),e.weeks&&t.push(`${e.weeks}w`),e.days&&t.push(`${e.days}d`),e.hours&&t.push(`${e.hours}h`),e.minutes&&t.push(`${e.minutes}m`),e.seconds){let s=Math.trunc(e.seconds);s&&t.push(`${s}s`);let o=Math.round((e.seconds-s)*1e3);o&&t.push(`${o}ms`)}return t.join("")}},37856(e,t,s){async function o(...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 a(e.error,t.status);if(e.message)throw new a(e.message,t.status)}let s=await t.clone().text();if(s)throw new a(s,t.status);throw new n(t)}return t}async function r(...e){let t=await o(...e);if(!t.ok)throw new n(t);return await t.json()}s.d(t,{hd:()=>o,x6:()=>r});class n extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,n.prototype)}}class a extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,a.prototype)}}},7800(e,t,s){var o;t.default=void 0,t.default=(0,((o=s(1448))&&o.__esModule?o:{default:o}).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 +0,0 @@
1
- "use strict";(self["chunk_Prometheus "]=self["chunk_Prometheus "]||[]).push([["8356"],{79215(e,t,r){r.r(t),r.d(t,{Controller:()=>P,Form:()=>H,FormProvider:()=>q,FormStateSubscribe:()=>z,Watch:()=>eT,appendErrors:()=>J,createFormControl:()=>eF,get:()=>b,set:()=>g,useController:()=>L,useFieldArray:()=>eN,useForm:()=>eM,useFormContext:()=>W,useFormState:()=>N,useWatch:()=>B});var a=r(70451),s=r.n(a),i=e=>e instanceof Date,l=e=>null==e;let o=e=>"object"==typeof e;var n=e=>!l(e)&&!Array.isArray(e)&&o(e)&&!i(e),u=e=>n(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,d=(e,t)=>t.split(".").some((t,r,a)=>!isNaN(Number(t))&&e.has(a.slice(0,r).join("."))),f="u">typeof window&&void 0!==window.HTMLElement&&"u">typeof document;function c(e){let t;if(e instanceof Date)return new Date(e);let r="u">typeof FileList&&e instanceof FileList;if(f&&(e instanceof Blob||r))return e;let a=Array.isArray(e);if(!a&&!(n(e)&&n(t=e.constructor&&e.constructor.prototype)&&t.hasOwnProperty("isPrototypeOf")))return e;let s=a?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(s[t]=c(e[t]));return s}var y=e=>void 0===e,m=e=>Array.isArray(e)?e.filter(Boolean):[],p=e=>m(e.replace(/["|']|\]/g,"").split(/\.|\[/)),b=(e,t,r)=>{if(!t||!n(e))return r;let a=(/^\w*$/.test(t)?[t]:p(t)).reduce((e,t)=>l(e)?void 0:e[t],e);return y(a)||a===e?y(e[t])?r:e[t]:a},_=e=>"function"==typeof e,g=(e,t,r)=>{let a=-1,s=/^\w*$/.test(t)?[t]:p(t),i=s.length,l=i-1;for(;++a<i;){let t=s[a],i=r;if(a!==l){let r=e[t];i=n(r)||Array.isArray(r)?r:isNaN(+s[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};let v="blur",h="trigger",V="onChange",F="onSubmit",x="maxLength",A="minLength",k="pattern",S="required",w="validate",D="form",C="root",O=s().createContext(null);O.displayName="HookFormControlContext";var E=(e,t,r,a=!0)=>{let s={defaultValues:t._defaultValues};for(let i in e)Object.defineProperty(s,i,{get:()=>("all"!==t._proxyFormState[i]&&(t._proxyFormState[i]=!a||"all"),r&&(r[i]=!0),e[i])});return s};let j="u">typeof window?s().useLayoutEffect:s().useEffect;function N(e){let t=s().useContext(O),{control:r=t,disabled:a,name:i,exact:l}=e||{},[o,n]=s().useState(r._formState),u=s().useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return j(()=>r._subscribe({name:i,formState:u.current,exact:l,callback:e=>{a||n({...r._formState,...e})}}),[i,a,l]),s().useEffect(()=>{u.current.isValid&&r._setValid(!0)},[r]),s().useMemo(()=>E(o,r,u.current,!1),[o,r])}var M=e=>"string"==typeof e,T=(e,t,r,a,s)=>M(e)?(a&&t.watch.add(e),b(r,e,s)):Array.isArray(e)?e.map(e=>(a&&t.watch.add(e),b(r,e))):(a&&(t.watchAll=!0),r),R=e=>l(e)||!o(e);function U(e,t,r=new WeakSet){if(e===t)return!0;if(R(e)||R(t))return Object.is(e,t);if(i(e)&&i(t))return Object.is(e.getTime(),t.getTime());let a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;for(let s of(r.add(e),r.add(t),a)){let a=e[s];if(!(s in t))return!1;if("ref"!==s){let e=t[s];if(i(a)&&i(e)||(n(a)||Array.isArray(a))&&(n(e)||Array.isArray(e))?!U(a,e,r):!Object.is(a,e))return!1}}return!0}function B(e){let t=s().useContext(O),{control:r=t,name:a,defaultValue:i,disabled:l,exact:o,compute:n}=e||{},u=s().useRef(i),d=s().useRef(n),f=s().useRef(void 0),c=s().useRef(r),y=s().useRef(a);d.current=n;let[m,p]=s().useState(()=>{let e=r._getWatch(a,u.current);return d.current?d.current(e):e}),b=s().useCallback(e=>{let t=T(a,r._names,e||r._formValues,!1,u.current);return d.current?d.current(t):t},[r._formValues,r._names,a]),_=s().useCallback(e=>{if(!l){let t=T(a,r._names,e||r._formValues,!1,u.current);if(d.current){let e=d.current(t);U(e,f.current)||(p(e),f.current=e)}else p(t)}},[r._formValues,r._names,l,a]);j(()=>(c.current===r&&U(y.current,a)||(c.current=r,y.current=a,_()),r._subscribe({name:a,formState:{values:!0},exact:o,callback:e=>{_(e.values)}})),[r,o,a,_]),s().useEffect(()=>r._removeUnmounted());let g=c.current!==r,v=y.current,h=s().useMemo(()=>{if(l)return null;let e=!g&&!U(v,a);return g||e?b():null},[l,g,a,v,b]);return null!==h?h:m}function L(e){let t=s().useContext(O),{name:r,disabled:a,control:i=t,shouldUnregister:l,defaultValue:o,exact:n=!0}=e,f=d(i._names.array,r),m=s().useMemo(()=>b(i._formValues,r,b(i._defaultValues,r,o)),[i,r,o]),p=B({control:i,name:r,defaultValue:m,exact:n}),h=N({control:i,name:r,exact:n}),V=s().useRef(e),F=s().useRef(i.register(r,{...e.rules,value:p,..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}));V.current=e;let x=s().useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!b(h.errors,r)},isDirty:{enumerable:!0,get:()=>!!b(h.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!b(h.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!b(h.validatingFields,r)},error:{enumerable:!0,get:()=>b(h.errors,r)}}),[h,r]),A=s().useCallback(e=>F.current.onChange({target:{value:u(e),name:r},type:"change"}),[r]),k=s().useCallback(()=>F.current.onBlur({target:{value:b(i._formValues,r),name:r},type:v}),[r,i._formValues]),S=s().useCallback(e=>{let t=b(i._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>_(e.focus)&&e.focus(),select:()=>_(e.select)&&e.select(),setCustomValidity:t=>_(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>_(e.reportValidity)&&e.reportValidity()})},[i._fields,r]),w=s().useMemo(()=>({name:r,value:p,..."boolean"==typeof a||h.disabled?{disabled:h.disabled||a}:{},onChange:A,onBlur:k,ref:S}),[r,a,h.disabled,A,k,S,p]);return s().useEffect(()=>{let e=i._options.shouldUnregister||l;i.register(r,{...V.current.rules,..."boolean"==typeof V.current.disabled?{disabled:V.current.disabled}:{}});let t=(e,t)=>{let r=b(i._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){let e=c(b(i._options.defaultValues,r,V.current.defaultValue));g(i._defaultValues,r,e),y(b(i._formValues,r))&&g(i._formValues,r,e)}return f||i.register(r),()=>{(f?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}},[r,i,f,l]),s().useEffect(()=>{i._setDisabledField({disabled:a,name:r})},[a,r,i]),s().useMemo(()=>({field:w,formState:h,fieldState:x}),[w,h,x])}let P=e=>e.render(L(e)),I=e=>{let t={};for(let r of Object.keys(e))if(o(e[r])&&null!==e[r]){let a=I(e[r]);for(let e of Object.keys(a))t[`${r}.${e}`]=a[e]}else t[r]=e[r];return t},$=s().createContext(null);$.displayName="HookFormContext";let W=()=>s().useContext($),q=e=>{let{children:t,watch:r,getValues:a,getFieldState:i,setError:l,clearErrors:o,setValue:n,trigger:u,formState:d,resetField:f,reset:c,handleSubmit:y,unregister:m,control:p,register:b,setFocus:_,subscribe:g}=e,v=s().useMemo(()=>({watch:r,getValues:a,getFieldState:i,setError:l,clearErrors:o,setValue:n,trigger:u,formState:d,resetField:f,reset:c,handleSubmit:y,unregister:m,control:p,register:b,setFocus:_,subscribe:g}),[o,p,d,i,a,y,b,c,f,l,_,n,g,u,m,r]);return s().createElement($.Provider,{value:v},s().createElement(O.Provider,{value:v.control},t))};function H(e){let t=W(),[r,a]=s().useState(!1),{control:i=t.control,onSubmit:l,children:o,action:n,method:u="post",headers:d,encType:f,onError:c,render:y,onSuccess:m,validateStatus:p,...b}=e,_=s().useCallback(async e=>{let t=!1,r="";await i.handleSubmit(async a=>{let s=new FormData,i="";try{i=JSON.stringify(a)}catch(e){}let o=I(a);for(let e in o)s.append(e,o[e]);if(l&&await l({data:a,event:e,method:u,formData:s,formDataJson:i}),n)try{let e=[d&&d["Content-Type"],f].some(e=>e&&e.includes("json")),a=await fetch(String(n),{method:u,headers:{...d,...f&&"multipart/form-data"!==f?{"Content-Type":f}:{}},body:e?i:s});a&&(p?!p(a.status):a.status<200||a.status>=300)?(t=!0,c&&c({response:a}),r=String(a.status)):m&&m({response:a})}catch(e){t=!0,c&&c({error:e})}})(e),t&&i&&(i._subjects.state.next({isSubmitSuccessful:!1}),i.setError("root.server",{type:r}))},[i,l,u,n,d,f,p,c,m]);return s().useEffect(()=>{a(!0)},[]),y?s().createElement(s().Fragment,null,y({submit:_})):s().createElement("form",{noValidate:r,action:n,method:u,encType:f,onSubmit:_,...b},o)}let z=({control:e,disabled:t,exact:r,name:a,render:s})=>s(N({control:e,name:a,disabled:t,exact:r}));var J=(e,t,r,a,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[a]:s||!0}}:{},G=e=>Array.isArray(e)?e:[e],K=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},Q=e=>n(e)&&!Object.keys(e).length,X=e=>{if(!f)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Y=e=>X(e)&&e.isConnected;function Z(e,t){if(M(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let r=Array.isArray(t)?t:/^\w*$/.test(t)?[t]:p(t),a=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,a=0;for(;a<r;){if(l(e)){e=void 0;break}e=e[t[a]],a++}return e}(e,r),s=r.length-1,i=r[s];return a&&delete a[i],0!==s&&(n(a)&&Q(a)||Array.isArray(a)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!y(e[t]))return!1;return!0}(a))&&Z(e,r.slice(0,-1)),e}function ee(e){return Array.isArray(e)||n(e)&&!(e=>{for(let t in e)if(_(e[t]))return!0;return!1})(e)}function et(e,t={}){for(let r in e){let a=e[r];ee(a)?(t[r]=Array.isArray(a)?[]:{},et(a,t[r])):y(a)||(t[r]=!0)}return t}function er(e,t,r){for(let a in r||(r=et(t)),e){let s=e[a];if(ee(s))y(t)||R(r[a])?r[a]=et(s,Array.isArray(s)?[]:{}):er(s,l(t)?{}:t[a],r[a]);else{let e=t[a];r[a]=!U(s,e)}}return r}let ea={value:!1,isValid:!1},es={value:!0,isValid:!0};var ei=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!y(e[0].attributes.value)?y(e[0].value)||""===e[0].value?es:{value:e[0].value,isValid:!0}:es:ea}return ea},el=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:a})=>y(e)?e:t?""===e?NaN:e?+e:e:r&&M(e)?new Date(e):a?a(e):e;let eo={isValid:!1,value:null};var en=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,eo):eo;function eu(e){let t=e.ref;return"file"===t.type?t.files:"radio"===t.type?en(e.refs).value:"select-multiple"===t.type?[...t.selectedOptions].map(({value:e})=>e):"checkbox"===t.type?ei(e.refs).value:el(y(t.value)?e.ref.value:t.value,e)}var ed=e=>y(e)?e:e instanceof RegExp?e.source:n(e)?e.value instanceof RegExp?e.value.source:e.value:e,ef=e=>({isOnSubmit:!e||e===F,isOnBlur:"onBlur"===e,isOnChange:e===V,isOnAll:"all"===e,isOnTouch:"onTouched"===e});let ec="AsyncFunction";var ey=e=>!!e&&!!e.validate&&!!(_(e.validate)&&e.validate.constructor.name===ec||n(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===ec)),em=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let ep=(e,t,r,a)=>{for(let s of r||Object.keys(e)){let r=b(e,s);if(r){let{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],s)&&!a)return!0;else if(e.ref&&t(e.ref,e.name)&&!a)return!0;else if(ep(i,t))break}else if(n(i)&&ep(i,t))break}}};function eb(e,t,r){let a=b(e,r);if(a||/^\w*$/.test(r))return{error:a,name:r};let s=r.split(".");for(;s.length;){let a=s.join("."),i=b(t,a),l=b(e,a);if(i&&!Array.isArray(i)&&r!==a)break;if(l&&l.type)return{name:a,error:l};if(l&&l.root&&l.root.type)return{name:`${a}.root`,error:l.root};s.pop()}return{name:r}}var e_=(e,t,r)=>{let a=G(b(e,r));return g(a,C,t[r]),g(e,r,a),e};function eg(e,t,r="validate"){if(M(e)||Array.isArray(e)&&e.every(M)||"boolean"==typeof e&&!e)return{type:r,message:M(e)?e:"",ref:t}}var ev=e=>!n(e)||e instanceof RegExp?{value:e,message:""}:e,eh=async(e,t,r,a,s,i)=>{let{ref:o,refs:u,required:d,maxLength:f,minLength:c,min:m,max:p,pattern:g,validate:v,name:h,valueAsNumber:V,mount:F}=e._f,D=b(r,h);if(!F||t.has(h))return{};let C=u?u[0]:o,O=e=>{s&&C.reportValidity&&(C.setCustomValidity("boolean"==typeof e?"":e||""),C.reportValidity())},E={},j="radio"===o.type,N="checkbox"===o.type,T=(V||"file"===o.type)&&y(o.value)&&y(D)||X(o)&&""===o.value||""===D||Array.isArray(D)&&!D.length||V&&"number"==typeof D&&isNaN(D),R=J.bind(null,h,a,E),U=(e,t,r,a=x,s=A)=>{let i=e?t:r;E[h]={type:e?a:s,message:i,ref:o,...R(e?a:s,i)}};if(i?!Array.isArray(D)||!D.length:d&&(!(j||N)&&(T||l(D))||"boolean"==typeof D&&!D||N&&!ei(u).isValid||j&&!en(u).isValid)){let{value:e,message:t}=M(d)?{value:!!d,message:d}:ev(d);if(e&&(E[h]={type:S,message:t,ref:C,...R(S,t)},!a))return O(t),E}if(!T&&(!l(m)||!l(p))){let e,t,r=ev(p),s=ev(m);if(l(D)||isNaN(D)){let a=o.valueAsDate||new Date(D),i=e=>new Date(new Date().toDateString()+" "+e),l="time"==o.type,n="week"==o.type;M(r.value)&&D&&(e=l?i(D)>i(r.value):n?D>r.value:a>new Date(r.value)),M(s.value)&&D&&(t=l?i(D)<i(s.value):n?D<s.value:a<new Date(s.value))}else{let a=o.valueAsNumber||(D?+D:D);l(r.value)||(e=a>r.value),l(s.value)||(t=a<s.value)}if((e||t)&&(U(!!e,r.message,s.message,"max","min"),!a))return O(E[h].message),E}if((f||c)&&!T&&(M(D)||i&&Array.isArray(D))){let e=ev(f),t=ev(c),r=!l(e.value)&&D.length>+e.value,s=!l(t.value)&&D.length<+t.value;if((r||s)&&(U(r,e.message,t.message),!a))return O(E[h].message),E}if(g&&!T&&M(D)){let{value:e,message:t}=ev(g);if(e instanceof RegExp&&!D.match(e)&&(E[h]={type:k,message:t,ref:o,...R(k,t)},!a))return O(t),E}if(v){if(_(v)){let e=eg(await v(D,r),C);if(e&&(E[h]={...e,...R(w,e.message)},!a))return O(e.message),E}else if(n(v)){let e={};for(let t in v){if(!Q(e)&&!a)break;let s=eg(await v[t](D,r),C,t);s&&(e={...s,...R(t,s.message)},O(s.message),a&&(E[h]=e))}if(!Q(e)&&(E[h]={ref:C,...e},!a))return E}}return O(!0),E};let eV={mode:F,reValidateMode:V,shouldFocusError:!0};function eF(e={}){let t,r={...eV,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:_(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},s={},o=(n(r.defaultValues)||n(r.values))&&c(r.defaultValues||r.values)||{},p=r.shouldUnregister?{}:c(o),V={action:!1,mount:!1,watch:!1,keepIsValid:!1},F={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},x=0,A={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},k={...A},S={...k},O={array:K(),state:K()},E="all"===r.criteriaMode,j=async e=>{if(!V.keepIsValid&&!r.disabled&&(k.isValid||S.isValid||e)){let e;r.resolver?(e=Q((await P()).errors),N()):e=await W({fields:s,onlyCheckValid:!0,eventType:"valid"}),e!==a.isValid&&O.state.next({isValid:e})}},N=(e,t)=>{!r.disabled&&(k.isValidating||k.validatingFields||S.isValidating||S.validatingFields)&&((e||Array.from(F.mount)).forEach(e=>{e&&(t?g(a.validatingFields,e,t):Z(a.validatingFields,e))}),O.state.next({validatingFields:a.validatingFields,isValidating:!Q(a.validatingFields)}))},R=e=>{let t=er(o,p),r=e.substring(0,e.search(/\.\d+(\.|$)/))||e;g(a.dirtyFields,r,b(t,r))},B=(e,t,r,a)=>{let i=b(s,e);if(i){let s=b(p,e,y(r)?b(o,e):r);y(s)||a&&a.defaultChecked||t?g(p,e,t?s:eu(i._f)):z(e,s),V.mount&&!V.action&&j()}},L=(e,t,s,i,l)=>{let n=!1,u=!1,d={name:e};if(!r.disabled){if(!s||i){(k.isDirty||S.isDirty)&&(u=a.isDirty,a.isDirty=d.isDirty=q(),n=u!==d.isDirty);let r=U(b(o,e),t);u=!!b(a.dirtyFields,e),r?Z(a.dirtyFields,e):g(a.dirtyFields,e,!0),d.dirtyFields=a.dirtyFields,n=n||(k.dirtyFields||S.dirtyFields)&&!r!==u}if(s){let t=b(a.touchedFields,e);t||(g(a.touchedFields,e,s),d.touchedFields=a.touchedFields,n=n||(k.touchedFields||S.touchedFields)&&t!==s)}n&&l&&O.state.next(d)}return n?d:{}},P=async e=>(N(e,!0),await r.resolver(p,r.context,((e,t,r,a)=>{let s={};for(let r of e){let e=b(t,r);e&&g(s,r,e._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:a}})(e||F.mount,s,r.criteriaMode,r.shouldUseNativeValidation))),I=async e=>{let{errors:t}=await P(e);if(N(e),e)for(let r of e){let e=b(t,r);e?g(a.errors,r,e):Z(a.errors,r)}else a.errors=t;return t},$=async({name:t,eventType:r})=>{if(e.validate){let s=await e.validate({formValues:p,formState:a,name:t,eventType:r});if(n(s))for(let e in s)s[e]&&ec(`${D}.${e}`,{message:M(s.message)?s.message:"",type:w});else M(s)||!s?ec(D,{message:s||"",type:w}):en(D);return s}return!0},W=async({fields:t,onlyCheckValid:s,name:i,eventType:l,context:o={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(o.runRootValidation=!0,!await $({name:i,eventType:l}))&&(o.valid=!1,s))return o.valid;for(let i in t){let n=t[i];if(n){let{_f:t,...u}=n;if(t){let i=F.array.has(t.name),l=n._f&&ey(n._f);l&&k.validatingFields&&N([t.name],!0);let u=await eh(n,F.disabled,p,E,r.shouldUseNativeValidation&&!s,i);if(l&&k.validatingFields&&N([t.name]),u[t.name]&&(o.valid=!1,s)||(s||(b(u,t.name)?i?e_(a.errors,u,t.name):g(a.errors,t.name,u[t.name]):Z(a.errors,t.name)),e.shouldUseNativeValidation&&u[t.name]))break}Q(u)||await W({context:o,onlyCheckValid:s,fields:u,name:i,eventType:l})}}return o.valid},q=(e,t)=>!r.disabled&&(e&&t&&g(p,e,t),!U(ei(),o)),H=(e,t,r)=>T(e,F,{...V.mount?p:y(t)?o:M(e)?{[e]:t}:t},r,t),z=(e,t,r={})=>{let a=b(s,e),i=t;if(a){let r=a._f;r&&(r.disabled||g(p,e,el(t,r)),i=X(r.ref)&&l(t)?"":t,"select-multiple"===r.ref.type?[...r.ref.options].forEach(e=>e.selected=i.includes(e.value)):r.refs?"checkbox"===r.ref.type?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(i)?e.checked=!!i.find(t=>t===e.value):e.checked=i===e.value||!!i)}):r.refs.forEach(e=>e.checked=e.value===i):"file"===r.ref.type?r.ref.value="":(r.ref.value=i,r.ref.type||O.state.next({name:e,values:c(p)})))}(r.shouldDirty||r.shouldTouch)&&L(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&es(e)},J=(e,t,r)=>{for(let a in t){if(!t.hasOwnProperty(a))return;let l=t[a],o=e+"."+a,u=b(s,o);(F.array.has(e)||n(l)||u&&!u._f)&&!i(l)?J(o,l,r):z(o,l,r)}},ee=(e,t,r={})=>{let i=b(s,e),o=F.array.has(e),n=c(t),u=U(b(p,e),n);if(g(p,e,n),o)O.array.next({name:e,values:c(p)}),r.shouldDirty&&(R(e),O.state.next({name:e,dirtyFields:a.dirtyFields,isDirty:q(e,n)}));else{let t=Array.isArray(n)&&!n.length||Q(n);!i||i._f||l(n)||t?z(e,n,r):J(e,n,r)}u||(em(e,F)?O.state.next({...a,name:e,values:c(p)}):O.state.next({name:V.mount?e:void 0,values:c(p)}))},et=async l=>{V.mount=!0;let o=l.target,n=o.name,d=!0,f=b(s,n),y=e=>{d=Number.isNaN(e)||i(e)&&isNaN(e.getTime())||U(e,b(p,n,e))},m=ef(r.mode),_=ef(r.reValidateMode);if(f){var h,A,w,D,C;let i,V,B,I=o.type?eu(f._f):u(l),q=l.type===v||"focusout"===l.type,H=!((B=f._f).mount&&(B.required||B.min||B.max||B.maxLength||B.minLength||B.pattern||B.validate))&&!e.validate&&!r.resolver&&!b(a.errors,n)&&!f._f.deps||(h=q,A=b(a.touchedFields,n),w=a.isSubmitted,D=_,!(C=m).isOnAll&&(!w&&C.isOnTouch?!(A||h):(w?D.isOnBlur:C.isOnBlur)?!h:(w?!D.isOnChange:!C.isOnChange)||h)),z=em(n,F,q);g(p,n,I),q?o&&o.readOnly||(f._f.onBlur&&f._f.onBlur(l),t&&t(0)):f._f.onChange&&f._f.onChange(l);let J=L(n,I,q),G=!Q(J)||z;if(q||O.state.next({name:n,type:l.type,values:c(p)}),H)return(k.isValid||S.isValid)&&("onBlur"===r.mode?q&&j():q||j()),G&&O.state.next({name:n,...z?{}:J});if(!r.resolver&&e.validate&&await $({name:n,eventType:l.type}),!q&&z&&O.state.next({...a}),r.resolver){let{errors:e}=await P([n]);if(N([n]),y(I),d){let t=eb(a.errors,s,n),r=eb(e,s,t.name||n);i=r.error,n=r.name,V=Q(e)}}else N([n],!0),i=(await eh(f,F.disabled,p,E,r.shouldUseNativeValidation))[n],N([n]),y(I),d&&(i?V=!1:(k.isValid||S.isValid)&&(V=await W({fields:s,onlyCheckValid:!0,name:n,eventType:l.type})));if(d){f._f.deps&&(!Array.isArray(f._f.deps)||f._f.deps.length>0)&&es(f._f.deps);var M=n,T=V,R=i;let e=b(a.errors,M),s=(k.isValid||S.isValid)&&"boolean"==typeof T&&a.isValid!==T;if(r.delayError&&R){let e;e=()=>{g(a.errors,M,R),O.state.next({errors:a.errors})},(t=t=>{clearTimeout(x),x=setTimeout(e,t)})(r.delayError)}else clearTimeout(x),t=null,R?g(a.errors,M,R):Z(a.errors,M);if((R?!U(e,R):e)||!Q(J)||s){let e={...J,...s&&"boolean"==typeof T?{isValid:T}:{},errors:a.errors,name:M};a={...a,...e},O.state.next(e)}}}},ea=(e,t)=>{if(b(a.errors,t)&&e.focus)return e.focus(),1},es=async(e,t={})=>{let i,l,o=G(e);if(r.resolver){let t=await I(y(e)?e:o);i=Q(t),l=e?!o.some(e=>b(t,e)):i}else e?((l=(await Promise.all(o.map(async e=>{let t=b(s,e);return await W({fields:t&&t._f?{[e]:t}:t,eventType:h})}))).every(Boolean))||a.isValid)&&j():l=i=await W({fields:s,name:e,eventType:h});return O.state.next({...!M(e)||(k.isValid||S.isValid)&&i!==a.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:a.errors}),t.shouldFocus&&!l&&ep(s,ea,e?o:F.mount),l},ei=(e,t)=>{let r={...V.mount?p:o};return t&&(r=function e(t,r){let a={};for(let s in t)if(t.hasOwnProperty(s)){let i=t[s],l=r[s];if(i&&n(i)&&l){let t=e(i,l);n(t)&&(a[s]=t)}else t[s]&&(a[s]=l)}return a}(t.dirtyFields?a.dirtyFields:a.touchedFields,r)),y(e)?r:M(e)?b(r,e):e.map(e=>b(r,e))},eo=(e,t)=>({invalid:!!b((t||a).errors,e),isDirty:!!b((t||a).dirtyFields,e),error:b((t||a).errors,e),isValidating:!!b(a.validatingFields,e),isTouched:!!b((t||a).touchedFields,e)}),en=e=>{let t=e?G(e):void 0;null==t||t.forEach(e=>Z(a.errors,e)),t?t.forEach(e=>{O.state.next({name:e,errors:a.errors})}):O.state.next({errors:{}})},ec=(e,t,r)=>{let i=(b(s,e,{_f:{}})._f||{}).ref,{ref:l,message:o,type:n,...u}=b(a.errors,e)||{};g(a.errors,e,{...u,...t,ref:i}),O.state.next({name:e,errors:a.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},eg=e=>O.state.subscribe({next:t=>{let r,s,i;if(r=e.name,s=t.name,i=e.exact,(!r||!s||r===s||G(r).some(e=>e&&(i?e===s:e.startsWith(s)||s.startsWith(e))))&&((e,t,r,a)=>{r(e);let{name:s,...i}=e;return Q(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(e=>t[e]===(!a||"all"))})(t,e.formState||k,eC,e.reRenderRoot)){let r={...p};e.callback({values:r,...a,...t,defaultValues:o})}}}).unsubscribe,ev=(e,t={})=>{for(let i of e?G(e):F.mount)F.mount.delete(i),F.array.delete(i),t.keepValue||(Z(s,i),Z(p,i)),t.keepError||Z(a.errors,i),t.keepDirty||Z(a.dirtyFields,i),t.keepTouched||Z(a.touchedFields,i),t.keepIsValidating||Z(a.validatingFields,i),r.shouldUnregister||t.keepDefaultValue||Z(o,i);O.state.next({values:c(p)}),O.state.next({...a,...!t.keepDirty?{}:{isDirty:q()}}),t.keepIsValid||j()},ex=({disabled:e,name:t})=>{if("boolean"==typeof e&&V.mount||e||F.disabled.has(t)){let r=F.disabled.has(t);e?F.disabled.add(t):F.disabled.delete(t),!!e!==r&&V.mount&&!V.action&&j()}},eA=(e,t={})=>{let a=b(s,e),i="boolean"==typeof t.disabled||"boolean"==typeof r.disabled,l=!F.registerName.has(e)&&a&&a._f&&!a._f.mount;return(g(s,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...t}}),F.mount.add(e),a&&!l)?ex({disabled:"boolean"==typeof t.disabled?t.disabled:r.disabled,name:e}):B(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:ed(t.min),max:ed(t.max),minLength:ed(t.minLength),maxLength:ed(t.maxLength),pattern:ed(t.pattern)}:{},name:e,onChange:et,onBlur:et,ref:i=>{if(i){let r;F.registerName.add(e),eA(e,t),F.registerName.delete(e),a=b(s,e);let l=y(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,n="radio"===(r=l).type||"checkbox"===r.type,u=a._f.refs||[];(n?u.find(e=>e===l):l===a._f.ref)||(g(s,e,{_f:{...a._f,...n?{refs:[...u.filter(Y),l,...Array.isArray(b(o,e))?[{}]:[]],ref:{type:l.type,name:e}}:{ref:l}}}),B(e,!1,void 0,l))}else(a=b(s,e,{}))._f&&(a._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&!(d(F.array,e)&&V.action)&&F.unMount.add(e)}}},ek=()=>r.shouldFocusError&&ep(s,ea,F.mount),eS=(e,t)=>async i=>{let l;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let o=c(p);if(O.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await P();N(),a.errors=e,o=c(t)}else await W({fields:s,eventType:"submit"});if(F.disabled.size)for(let e of F.disabled)Z(o,e);if(Z(a.errors,C),Q(a.errors)){O.state.next({errors:{}});try{await e(o,i)}catch(e){l=e}}else t&&await t({...a.errors},i),ek(),setTimeout(ek);if(O.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Q(a.errors)&&!l,submitCount:a.submitCount+1,errors:a.errors}),l)throw l},ew=(e,t={})=>{let i=e?c(e):o,l=c(i),n=Q(e),u=n?o:l;if(t.keepDefaultValues||(o=i),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...F.mount,...Object.keys(er(o,p))]))){let t=b(a.dirtyFields,e),r=b(p,e),s=b(u,e);t&&!y(r)?g(u,e,r):t||y(s)||ee(e,s)}else{if(f&&y(e))for(let e of F.mount){let t=b(s,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(X(e)){let t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(let e of F.mount)ee(e,b(u,e));else s={}}p=r.shouldUnregister?t.keepDefaultValues?c(o):{}:c(u),O.array.next({values:{...u}}),O.state.next({values:{...u}})}F={mount:t.keepDirtyValues?F.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},V.mount=!k.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!Q(u),V.watch=!!r.shouldUnregister,V.keepIsValid=!!t.keepIsValid,V.action=!1,t.keepErrors||(a.errors={}),O.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:!n&&(t.keepDirty?a.isDirty:!!(t.keepDefaultValues&&!U(e,o))),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:n?{}:t.keepDirtyValues?t.keepDefaultValues&&p?er(o,p):a.dirtyFields:t.keepDefaultValues&&e?er(o,e):t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&a.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},eD=(e,t)=>ew(_(e)?e(p):e,{...r.resetOptions,...t}),eC=e=>{a={...a,...e}},eO={control:{register:eA,unregister:ev,getFieldState:eo,handleSubmit:eS,setError:ec,_subscribe:eg,_runSchema:P,_updateIsValidating:N,_focusError:ek,_getWatch:H,_getDirty:q,_setValid:j,_setFieldArray:(e,t=[],i,l,o=!0,n=!0)=>{if(l&&i&&!r.disabled){if(V.action=!0,n&&Array.isArray(b(s,e))){let t=i(b(s,e),l.argA,l.argB);o&&g(s,e,t)}if(n&&Array.isArray(b(a.errors,e))){let t,r=i(b(a.errors,e),l.argA,l.argB);o&&g(a.errors,e,r),m(b(t=a.errors,e)).length||Z(t,e)}if((k.touchedFields||S.touchedFields)&&n&&Array.isArray(b(a.touchedFields,e))){let t=i(b(a.touchedFields,e),l.argA,l.argB);o&&g(a.touchedFields,e,t)}(k.dirtyFields||S.dirtyFields)&&R(e),O.state.next({name:e,isDirty:q(e,t),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else g(p,e,t)},_setDisabledField:ex,_setErrors:e=>{a.errors=e,O.state.next({errors:a.errors,isValid:!1})},_getFieldArray:e=>m(b(V.mount?p:o,e,r.shouldUnregister?b(o,e,[]):[])),_reset:ew,_resetDefaultValues:()=>_(r.defaultValues)&&r.defaultValues().then(e=>{eD(e,r.resetOptions),O.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(let e of F.unMount){let t=b(s,e);t&&(t._f.refs?t._f.refs.every(e=>!Y(e)):!Y(t._f.ref))&&ev(e)}F.unMount=new Set},_disableForm:e=>{"boolean"==typeof e&&(O.state.next({disabled:e}),ep(s,(t,r)=>{let a=b(s,r);a&&(t.disabled=a._f.disabled||e,Array.isArray(a._f.refs)&&a._f.refs.forEach(t=>{t.disabled=a._f.disabled||e}))},0,!1))},_subjects:O,_proxyFormState:k,get _fields(){return s},get _formValues(){return p},get _state(){return V},set _state(value){V=value},get _defaultValues(){return o},get _names(){return F},set _names(value){F=value},get _formState(){return a},get _options(){return r},set _options(value){r={...r,...value}}},subscribe:e=>(V.mount=!0,S={...S,...e.formState},eg({...e,formState:{...A,...e.formState}})),trigger:es,register:eA,handleSubmit:eS,watch:(e,t)=>_(e)?O.state.subscribe({next:r=>"values"in r&&e(r.values||H(void 0,t),r)}):H(e,t,!0),setValue:ee,setValues:e=>{let t=_(e)?e(p):e;U(p,t)||(p={...p,...t},O.state.next({...a,values:p}))},getValues:ei,reset:eD,resetField:(e,t={})=>{b(s,e)&&(y(t.defaultValue)?ee(e,c(b(o,e))):(ee(e,t.defaultValue),g(o,e,c(t.defaultValue))),t.keepTouched||Z(a.touchedFields,e),t.keepDirty||(Z(a.dirtyFields,e),a.isDirty=t.defaultValue?q(e,c(b(o,e))):q()),!t.keepError&&(Z(a.errors,e),k.isValid&&j()),O.state.next({...a}))},clearErrors:en,unregister:ev,setError:ec,setFocus:(e,t={})=>{let r=b(s,e),a=r&&r._f;if(a){let e=a.refs?a.refs[0]:a.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&_(e.select)&&e.select()})}},getFieldState:eo};return{...eO,formControl:eO}}var ex=()=>{if("u">typeof crypto&&crypto.randomUUID)return crypto.randomUUID();let e="u"<typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)})},eA=(e,t,r={})=>r.shouldFocus||y(r.shouldFocus)?r.focusName||`${e}.${y(r.focusIndex)?t:r.focusIndex}.`:"",ek=(e,t)=>[...e,...G(t)],eS=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function ew(e,t,r){return[...e.slice(0,t),...G(r),...e.slice(t)]}var eD=(e,t,r)=>Array.isArray(e)?(y(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],eC=(e,t)=>[...G(t),...G(e)],eO=(e,t)=>y(t)?[]:function(e,t){let r=0,a=[...e];for(let e of t)a.splice(e-r,1),r++;return m(a).length?a:[]}(e,G(t).sort((e,t)=>e-t)),eE=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},ej=(e,t,r)=>(e[t]=r,e);function eN(e){let t=s().useContext(O),{control:r=t,name:a,keyName:i="id",shouldUnregister:l,rules:o}=e,[n,u]=s().useState(r._getFieldArray(a)),d=s().useRef(r._getFieldArray(a).map(ex)),f=s().useRef(!1);r._names.array.add(a),s().useMemo(()=>o&&n.length>=0&&r.register(a,o),[r,a,n.length,o]),j(()=>r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===a||!t){let t=b(e,a);Array.isArray(t)&&(u(t),d.current=t.map(ex))}}}).unsubscribe,[r,a]);let y=s().useCallback(e=>{f.current=!0,r._setFieldArray(a,e)},[r,a]);return s().useEffect(()=>{r._state.action=!1,em(a,r._names)&&r._subjects.state.next({...r._formState});let e=ef(r._options.mode);if(f.current&&(!e.isOnSubmit||r._formState.isSubmitted)&&!ef(r._options.reValidateMode).isOnSubmit&&!e.isOnBlur)if(r._options.resolver)r._runSchema([a]).then(e=>{r._updateIsValidating([a]);let t=b(e.errors,a),s=b(r._formState.errors,a);(s?!t&&s.type||t&&(s.type!==t.type||s.message!==t.message):t&&t.type)&&(t?g(r._formState.errors,a,t):Z(r._formState.errors,a),r._subjects.state.next({errors:r._formState.errors}))});else{let e=b(r._fields,a);e&&e._f&&!(ef(r._options.reValidateMode).isOnSubmit&&ef(r._options.mode).isOnSubmit)&&eh(e,r._names.disabled,r._formValues,"all"===r._options.criteriaMode,r._options.shouldUseNativeValidation,!0).then(e=>!Q(e)&&r._subjects.state.next({errors:e_(r._formState.errors,e,a)}))}r._subjects.state.next({name:a,values:c(r._formValues)}),r._names.focus&&ep(r._fields,(e,t)=>{if(r._names.focus&&t.startsWith(r._names.focus)&&e.focus)return e.focus(),1}),r._names.focus="",r._setValid(),f.current=!1},[n,a,r]),s().useEffect(()=>(b(r._formValues,a)||r._setFieldArray(a),()=>{let e;r._options.shouldUnregister||l?r.unregister(a):(e=b(r._fields,a))&&e._f&&(e._f.mount=!1)}),[a,r,i,l]),{swap:s().useCallback((e,t)=>{let s=r._getFieldArray(a);eE(s,e,t),eE(d.current,e,t),y(s),u(s),r._setFieldArray(a,s,eE,{argA:e,argB:t},!1)},[y,a,r]),move:s().useCallback((e,t)=>{let s=r._getFieldArray(a);eD(s,e,t),eD(d.current,e,t),y(s),u(s),r._setFieldArray(a,s,eD,{argA:e,argB:t},!1)},[y,a,r]),prepend:s().useCallback((e,t)=>{let s=G(c(e)),i=eC(r._getFieldArray(a),s);r._names.focus=eA(a,0,t),d.current=eC(d.current,s.map(ex)),y(i),u(i),r._setFieldArray(a,i,eC,{argA:eS(e)})},[y,a,r]),append:s().useCallback((e,t)=>{let s=G(c(e)),i=ek(r._getFieldArray(a),s);r._names.focus=eA(a,i.length-1,t),d.current=ek(d.current,s.map(ex)),y(i),u(i),r._setFieldArray(a,i,ek,{argA:eS(e)})},[y,a,r]),remove:s().useCallback(e=>{let t=eO(r._getFieldArray(a),e);d.current=eO(d.current,e),y(t),u(t),Array.isArray(b(r._fields,a))||g(r._fields,a,void 0),r._setFieldArray(a,t,eO,{argA:e})},[y,a,r]),insert:s().useCallback((e,t,s)=>{let i=G(c(t)),l=ew(r._getFieldArray(a),e,i);r._names.focus=eA(a,e,s),d.current=ew(d.current,e,i.map(ex)),y(l),u(l),r._setFieldArray(a,l,ew,{argA:e,argB:eS(t)})},[y,a,r]),update:s().useCallback((e,t)=>{let s=c(t),i=ej(r._getFieldArray(a),e,s);d.current=[...i].map((t,r)=>t&&r!==e?d.current[r]:ex()),y(i),u([...i]),r._setFieldArray(a,i,ej,{argA:e,argB:s},!0,!1)},[y,a,r]),replace:s().useCallback(e=>{let t=G(c(e));d.current=t.map(ex),y([...t]),u([...t]),r._setFieldArray(a,[...t],e=>e,{},!0,!1)},[y,a,r]),fields:s().useMemo(()=>n.map((e,t)=>({...e,[i]:d.current[t]||ex()})),[n,i])}}function eM(e={}){let t=s().useRef(void 0),r=s().useRef(void 0),[a,i]=s().useState({isDirty:!1,isValidating:!1,isLoading:_(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:_(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:a},e.defaultValues&&!_(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:r,...s}=eF(e);t.current={...s,formState:a}}let l=t.current.control;return l._options=e,j(()=>{let e=l._subscribe({formState:l._proxyFormState,callback:()=>i({...l._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),l._formState.isReady=!0,e},[l]),s().useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),s().useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),s().useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),s().useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),s().useEffect(()=>{if(l._proxyFormState.isDirty){let e=l._getDirty();e!==a.isDirty&&l._subjects.state.next({isDirty:e})}},[l,a.isDirty]),s().useEffect(()=>{var t;e.values&&!U(e.values,r.current)?(l._reset(e.values,{keepFieldsRef:!0,...l._options.resetOptions}),(null==(t=l._options.resetOptions)?void 0:t.keepIsValid)||l._setValid(),r.current=e.values,i(e=>({...e}))):l._resetDefaultValues()},[l,e.values]),s().useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),t.current.formState=s().useMemo(()=>E(a,l),[l,a]),t.current}let eT=e=>e.render(B({name:e.names,...e}))}}]);
@@ -1 +0,0 @@
1
- "use strict";(self["chunk_Prometheus "]=self["chunk_Prometheus "]||[]).push([["8634"],{99123(e,t,i){i.d(t,{TI:()=>en});var a,r,n,s,o,l,c,u,h=i(782),d=i(31650);let O={inf:167,nan:168,bool:1,ignoring:2,on:3,group_left:4,group_right:5,offset:6},p=(e,t)=>O[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,smoothed:29,anchored:30},m=(e,t)=>f[e.toLowerCase()]||-1,v=(0,d.pn)({LineComment:d._A.comment,LabelName:d._A.labelName,StringLiteral:d._A.string,NumberDurationLiteral:d._A.number,NumberDurationLiteralInDurationContext:d._A.number,Identifier:d._A.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._A.function(d._A.variableName),"Avg Bottomk Count Count_values Group LimitK LimitRatio Max Min Quantile Stddev Stdvar Sum Topk":d._A.operatorKeyword,"By Without Bool On Ignoring GroupLeft GroupRight Offset Start End Smoothed Anchored":d._A.modifier,"And Unless Or":d._A.logicOperator,"Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At":d._A.operator,UnaryOp:d._A.arithmeticOperator,"( )":d._A.paren,"[ ]":d._A.squareBracket,"{ }":d._A.brace,"⚠":d._A.invalid}),g={__proto__:null,absent_over_time:353,absent:355,abs:357,acos:359,acosh:361,asin:363,asinh:365,atan:367,atanh:369,avg_over_time:371,ceil:373,changes:375,clamp:377,clamp_max:379,clamp_min:381,cos:383,cosh:385,count_over_time:387,days_in_month:389,day_of_month:391,day_of_week:393,day_of_year:395,deg:397,delta:399,deriv:401,exp:403,first_over_time:405,floor:407,histogram_count:409,histogram_fraction:411,histogram_quantile:413,histogram_stddev:415,histogram_stdvar:417,histogram_sum:419,histogram_avg:421,double_exponential_smoothing:423,hour:425,idelta:427,increase:429,info:431,irate:433,label_replace:435,label_join:437,last_over_time:439,ln:441,log10:443,log2:445,mad_over_time:447,max_over_time:449,min_over_time:451,ts_of_first_over_time:453,ts_of_max_over_time:455,ts_of_min_over_time:457,ts_of_last_over_time:459,minute:461,month:463,pi:465,predict_linear:467,present_over_time:469,quantile_over_time:471,rad:473,rate:475,resets:477,round:479,scalar:481,sgn:483,sin:485,sinh:487,sort:489,sort_desc:491,sort_by_label:493,sort_by_label_desc:495,sqrt:497,stddev_over_time:499,stdvar_over_time:501,sum_over_time:503,tan:505,tanh:507,timestamp:509,time:511,vector:513,year:515},$=h.U1.deserialize({version:14,states:":^OYQPOOO(TQPOOOOQO'#DO'#DOO(YQPO'#C}Q(eQQOOOOQO'#Dg'#DgO(`QPO'#DfOOQO'#Fa'#FaO)xQPO'#FhOYQPO'#FeOYQPO'#FgO0|QSO'#FjO1XQQO'#FiOOQO'#Fi'#FiOOQO'#F}'#F}OOQO'#Dh'#DhOOQO'#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'#FVOOQO'#FW'#FWOOQO'#FX'#FXOOQO'#FY'#FYOOQO'#FZ'#FZOOQO'#F['#F[OOQO'#F]'#F]OOQO'#F^'#F^QOQPOOO2xQPO'#DPO2}QPO'#DUO(`QPO,59iO3UQQO,59iO4xQPO,59qO4xQPO,59qO4xQPO,59qO4xQPO,59qO4xQPO,59qO;|QPO,5;yO;|QPO,5;|OOQO,5;},5;}OOQO,5<O,5<OO<_QPO,5<]OOQO,5:Q,5:QOOQO,5;{,5;{O<vQQO,5<PO<}QQO,5<ROOQO'#DS'#DSO>kQPO'#FkO>yQPO,5<UOOQO,5<U,5<UO?VQPO,5<UOOQO,5<T,5<TO?_QSO'#DQOOQO,59k,59kOOQO,59p,59pO?jQQO,59pOOQO1G/T1G/TOOQO'#DX'#DXO2xQPO'#DYOOQO'#GR'#GRO?tQPO'#GROYQPO1G/]OYQPO1G/]OYQPO1G/]OYQPO1G/]OYQPO1G/]OOQO'#F`'#F`OFuQPO'#F`OGQQSO1G1eOOQO1G1h1G1hOGYQPO'#FaOOQO'#Fs'#FsOOQO1G1w1G1wOGeQPO1G1wOOQO1G1k1G1kOOQO'#Fl'#FlOGjQPO,5<VOGoQPO,5<[OGtQSO1G1pOHPQPO1G1pOOQO1G1p1G1pOOQO,59l,59lOHXQPO,59lOYQPO'#FvOHaQPO1G/[OOQO1G/[1G/[OHiQPO,59tOOQO,5<m,5<mO!!zQQO7+$wO!#[QQO7+$wO!$vQQO7+$wO!%^QQO7+$wO!&uQQO7+$wOOQO,5;z,5;zOOQO7+'P7+'PO!'fQPO7+'WO!'mQPO7+'cOOQO1G1q1G1qOOQO1G1v1G1vO!'rQPO,5<cOOQO,5<c,5<cOOQO7+'[7+'[O!(WQSO7+'[OOQO-E9u-E9uO!(cQSO1G/WO!(nQPO1G/WOOQO1G/W1G/WO!(vQQO,5<bOOQO-E9t-E9tOOQO7+$v7+$vO!)QQPO1G/`OOQO<<Jr<<JrO!/{QPO<<JrOOQO<<J}<<J}OOQO<<Jv<<JvP!0QQSO'#FwOOQO,5<a,5<aOOQO7+$r7+$rO!0YQSO7+$rOOQO-E9s-E9sOOQO7+$z7+$zOOQOAN@^AN@^OOQO<<H^<<H^P!0eQSO'#Fu",stateData:"!0m~O$pOSoOS~OWQOXQOYQOZQO[QO]QO^QO_QO`QOaQObQOcQOdQOeQOw^O!][O$mVO$nVO$rXO$v_O$w`O$xaO$ybO$zcO${dO$|eO$}fO%OgO%PhO%QiO%RjO%SkO%TlO%UmO%VnO%WoO%XpO%YqO%ZrO%[sO%]tO%^uO%_vO%`wO%axO%byO%czO%d{O%e|O%f}O%g!OO%h!PO%i!QO%j!RO%k!SO%l!TO%m!UO%n!VO%o!WO%p!XO%q!YO%r!ZO%s![O%t!]O%u!^O%v!_O%w!`O%x!aO%y!bO%z!cO%{!dO%|!eO%}!fO&O!gO&P!hO&Q!iO&R!jO&S!kO&T!lO&U!mO&V!nO&W!oO&X!pO&Y!qO&Z!rO&[!sO&]!tO&^!uO&_!vO&`!wO&a!xO&b!yO&c!zO&d!{O&e!|O&f!}O&g#OO&h#PO&i#QO&j#RO&k#SO&mWO&nWO&oVO&rZO~O!]#TO~Of#UOg#UO$r#VO~OU#`OV#YOh#]Oi#^Oj#]Om#bOn#aOz#YO}#YO!O#YO!P#YO!Q#ZO!R#ZO!S#[O!T#[O!U#[O!V#[O!W#[O!X#[O$f#cO&l#_O~O$m#eO$n#eO&o#eOW$[XX$[XY$[XZ$[X[$[X]$[X^$[X_$[X`$[Xa$[Xb$[Xc$[Xd$[Xe$[Xw$[X!]$[X$m$[X$n$[X$r$[X$v$[X$w$[X$x$[X$y$[X$z$[X${$[X$|$[X$}$[X%O$[X%P$[X%Q$[X%R$[X%S$[X%T$[X%U$[X%V$[X%W$[X%X$[X%Y$[X%Z$[X%[$[X%]$[X%^$[X%_$[X%`$[X%a$[X%b$[X%c$[X%d$[X%e$[X%f$[X%g$[X%h$[X%i$[X%j$[X%k$[X%l$[X%m$[X%n$[X%o$[X%p$[X%q$[X%r$[X%s$[X%t$[X%u$[X%v$[X%w$[X%x$[X%y$[X%z$[X%{$[X%|$[X%}$[X&O$[X&P$[X&Q$[X&R$[X&S$[X&T$[X&U$[X&V$[X&W$[X&X$[X&Y$[X&Z$[X&[$[X&]$[X&^$[X&_$[X&`$[X&a$[X&b$[X&c$[X&d$[X&e$[X&f$[X&g$[X&h$[X&i$[X&j$[X&k$[X&m$[X&n$[X&o$[X&r$[X~Ou#iOw#hO&s#kO~O&rZOU$]XV$]Xh$]Xi$]Xj$]Xm$]Xn$]Xz$]X}$]X!O$]X!P$]X!Q$]X!R$]X!S$]X!T$]X!U$]X!V$]X!W$]X!X$]X$f$]X$l$]X&l$]X$t$]X$s$]X~O$r#nO~O$t#pO~PYOf#UOg#UOUqaVqahqaiqajqamqanqazqa}qa!Oqa!Pqa!Qqa!Rqa!Sqa!Tqa!Uqa!Vqa!Wqa!Xqa$fqa$lqa&lqa$tqa$sqa~OP#sOQ#tOR#tOW$uPX$uPY$uPZ$uP[$uP]$uP^$uP_$uP`$uPa$uPb$uPc$uPd$uPe$uPw$uP!]$uP$m$uP$n$uP$r$uP$v$uP$w$uP$x$uP$y$uP$z$uP${$uP$|$uP$}$uP%O$uP%P$uP%Q$uP%R$uP%S$uP%T$uP%U$uP%V$uP%W$uP%X$uP%Y$uP%Z$uP%[$uP%]$uP%^$uP%_$uP%`$uP%a$uP%b$uP%c$uP%d$uP%e$uP%f$uP%g$uP%h$uP%i$uP%j$uP%k$uP%l$uP%m$uP%n$uP%o$uP%p$uP%q$uP%r$uP%s$uP%t$uP%u$uP%v$uP%w$uP%x$uP%y$uP%z$uP%{$uP%|$uP%}$uP&O$uP&P$uP&Q$uP&R$uP&S$uP&T$uP&U$uP&V$uP&W$uP&X$uP&Y$uP&Z$uP&[$uP&]$uP&^$uP&_$uP&`$uP&a$uP&b$uP&c$uP&d$uP&e$uP&f$uP&g$uP&h$uP&i$uP&j$uP&k$uP&m$uP&n$uP&o$uP&r$uP~O$m#|O$n#|O&m#}O&n#}O&o#|O~Ok$ROl$RO$mVO$nVO&m$QO&n$QO&oVO~O$t$UO~P(eOz#YOU$ZaV$Zah$Zai$Zaj$Zam$Zan$Za}$Za!O$Za!P$Za!Q$Za!R$Za!S$Za!T$Za!U$Za!V$Za!W$Za!X$Za$f$Za$l$Za&l$Za$t$Za$s$Za~O!X$VO$a$VO$b$VO$c$VO~O!X$VO$a$VO$b$VO$c$VO$s$YO&s$[O~Ou$^Ow#hO$t$]O~O$s$_O$t$aO~P(eOQ#tOR#tOW$uXX$uXY$uXZ$uX[$uX]$uX^$uX_$uX`$uXa$uXb$uXc$uXd$uXe$uXw$uX!]$uX$m$uX$n$uX$r$uX$v$uX$w$uX$x$uX$y$uX$z$uX${$uX$|$uX$}$uX%O$uX%P$uX%Q$uX%R$uX%S$uX%T$uX%U$uX%V$uX%W$uX%X$uX%Y$uX%Z$uX%[$uX%]$uX%^$uX%_$uX%`$uX%a$uX%b$uX%c$uX%d$uX%e$uX%f$uX%g$uX%h$uX%i$uX%j$uX%k$uX%l$uX%m$uX%n$uX%o$uX%p$uX%q$uX%r$uX%s$uX%t$uX%u$uX%v$uX%w$uX%x$uX%y$uX%z$uX%{$uX%|$uX%}$uX&O$uX&P$uX&Q$uX&R$uX&S$uX&T$uX&U$uX&V$uX&W$uX&X$uX&Y$uX&Z$uX&[$uX&]$uX&^$uX&_$uX&`$uX&a$uX&b$uX&c$uX&d$uX&e$uX&f$uX&g$uX&h$uX&i$uX&j$uX&k$uX&m$uX&n$uX&o$uX&r$uX~O$m$iO$n$iO&o$iO~O&p$jO&q$kO~O$m#eO$n#eO&o#eO~O$r$lO~Ow$mO~Ow$nO~Ou#iOw#hO&s$qO~O$s$rO&s$qO~O$s$tO$t$vO~O$s$_O$t$yO~OS$zOT$zOW|aX|aY|aZ|a[|a]|a^|a_|a`|aa|ab|ac|ad|ae|aw|a!]|a$m|a$n|a$r|a$v|a$w|a$x|a$y|a$z|a${|a$||a$}|a%O|a%P|a%Q|a%R|a%S|a%T|a%U|a%V|a%W|a%X|a%Y|a%Z|a%[|a%]|a%^|a%_|a%`|a%a|a%b|a%c|a%d|a%e|a%f|a%g|a%h|a%i|a%j|a%k|a%l|a%m|a%n|a%o|a%p|a%q|a%r|a%s|a%t|a%u|a%v|a%w|a%x|a%y|a%z|a%{|a%||a%}|a&O|a&P|a&Q|a&R|a&S|a&T|a&U|a&V|a&W|a&X|a&Y|a&Z|a&[|a&]|a&^|a&_|a&`|a&a|a&b|a&c|a&d|a&e|a&f|a&g|a&h|a&i|a&j|a&k|a&m|a&n|a&o|a&r|a~Oz#YOUyqhyqiyqjyqmyqnyq!Qyq!Ryq!Syq!Tyq!Uyq!Vyq!Wyq!Xyq$fyq$lyq&lyq$tyq$syq~OVyq}yq!Oyq!Pyq~P! jOV#YO}#YO!O#YO!P#YO~P! jOV#YOz#YO}#YO!O#YO!P#YO!Q#ZO!R#ZOUyqhyqiyqjyqmyqnyq$fyq$lyq&lyq$tyq$syq~O!Syq!Tyq!Uyq!Vyq!Wyq!Xyq~P!#lO!S#[O!T#[O!U#[O!V#[O!W#[O!X#[O~P!#lOV#YOh#]Oj#]Oz#YO}#YO!O#YO!P#YO!Q#ZO!R#ZO!S#[O!T#[O!U#[O!V#[O!W#[O!X#[O~OUyqiyqmyqnyq$fyq$lyq&lyq$tyq$syq~P!%tO&p${O~P;|O$t$}O~O!X$VO$a$VO$b$VO$c$VO$s$ka&s$ka~Ou#iOw#hO&s%OO~Ou%QOw#hO$t%RO~O$s%SO$t%RO~O$s$ja$t$ja~P(eO$r#nOW|iX|iY|iZ|i[|i]|i^|i_|i`|ia|ib|ic|id|ie|iw|i!]|i$m|i$n|i$v|i$w|i$x|i$y|i$z|i${|i$||i$}|i%O|i%P|i%Q|i%R|i%S|i%T|i%U|i%V|i%W|i%X|i%Y|i%Z|i%[|i%]|i%^|i%_|i%`|i%a|i%b|i%c|i%d|i%e|i%f|i%g|i%h|i%i|i%j|i%k|i%l|i%m|i%n|i%o|i%p|i%q|i%r|i%s|i%t|i%u|i%v|i%w|i%x|i%y|i%z|i%{|i%||i%}|i&O|i&P|i&Q|i&R|i&S|i&T|i&U|i&V|i&W|i&X|i&Y|i&Z|i&[|i&]|i&^|i&_|i&`|i&a|i&b|i&c|i&d|i&e|i&f|i&g|i&h|i&i|i&j|i&k|i&m|i&n|i&o|i&r|i~O&p%VO~Ou#iOw#hO~Ou%QOw#hO$t%WO~Ou%QOw#hO~O",goto:"*P$vPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP$w%T%a%gP%pP&Q$wP&Z&bPPPPPPPPPPP$w&l&xP&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x&x$w'U'_$w$w$w$w$w$w'n$w'z(Z(cPPP(Z$wP(jP(m(s(yPPPPP)QPPP)pe^OXY#V#w#x#y#z#{$_eROXY#V#w#x#y#z#{$_Q#WRR#r#XQ#o#UQ$b#tR%U$zQ#jZQ$^#nU$o$Y$r%PV%Q$t%S%XQ#XRQ#dUR#r#WZ#v#Y#Z#[#]#^Y#u#Y#Z#[#]#^R$c#veUOXY#V#w#x#y#z#{$_eTOXY#V#w#x#y#z#{$_Q$O#_Q$P#`R$|$kd^OXY#V#w#x#y#z#{$_R$S#ceYOXY#V#w#x#y#z#{$_d]OXY#V#w#x#y#z#{$_R#m[Q#lZV$p$Y$r%PQ$W#iT$X#j$oR$T#cQ$u$^R%T$uQ$`#qR$x$`S$Z#j#lR$s$ZQSOQ#fXQ#gYQ#q#VQ$d#wQ$e#xQ$f#yQ$g#zQ$h#{R$w$_Q#w#YQ#x#ZQ#y#[Q#z#]R#{#^",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 Smoothed Anchored 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 FirstOverTime Floor HistogramCount HistogramFraction HistogramQuantile HistogramStdDev HistogramStdVar HistogramSum HistogramAvg DoubleExponentialSmoothing Hour Idelta Increase Info Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MadOverTime MaxOverTime MinOverTime TsOfFirstOverTime TsOfMaxOverTime TsOfMinOverTime TsOfLastOverTime 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 AnchoredExpr SmoothedExpr ParenExpr SubqueryExpr UnaryExpr UnaryOp VectorSelector LabelMatchers UnquotedLabelMatcher MatchOp EqlSingle EqlRegex NeqRegex QuotedLabelMatcher StepInvariantExpr At AtModifierPreprocessors MetricName",maxTerm:265,nodeProps:[["group",-14,33,39,41,56,141,143,144,145,146,147,148,149,151,159,"Expr"]],propSources:[v],skippedNodes:[0,31],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$p~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!X~~$tO$c~~$yWw~OY$tZr$trs%cs#O$t#O#P%h#P;'S$t;'S;=`&f<%lO$t~%hOw~~%kRO;'S$t;'S;=`%t;=`O$t~%yXw~OY$tZr$trs%cs#O$t#O#P%h#P;'S$t;'S;=`&f;=`<%l$t<%lO$t~&iP;=`<%l$t~&qSo~OY&lZ;'S&l;'S;=`&}<%lO&l~'QP;=`<%l&l~'YO!P~~'_Ww~OY'YZw'Ywx%cx#O'Y#O#P'w#P;'S'Y;'S;=`(u<%lO'Y~'zRO;'S'Y;'S;=`(T;=`O'Y~(YXw~OY'YZw'Ywx%cx#O'Y#O#P'w#P;'S'Y;'S;=`(u;=`<%l'Y<%lO'Y~(xP;=`<%l'Y~)QO$r~~)VO$t~~)[O}~R)cO&nP!QQ~)hO$s~R)oO&mP!RQ~)rP!Q![)u~)zS&o~!Q![)u!g!h*W#R#S)o#X#Y*W~*ZR{|*d}!O*d!Q![*j~*gP!Q![*j~*oQ&o~!Q![*j#R#S*d~*zO!O~~+P[&o~!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&o~!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&o~!O!P)o!Q![,s!g!h*W#R#S,m#X#Y*W~-^P&o~!Q![-a~-dS!Q![-a#[#]-p#a#b.U#g#h.x~-uP&o~!Q![-x~-{R!Q![-x#a#b.U#g#h.x~.ZQ&o~!Q![.a#g#h.s~.dR!Q![.a#a#b.m#g#h.x~.pP#g#h.s~.xO&o~~.}P&o~!Q![/Q~/TQ!Q![/Q#a#b.m~/`P&o~!Q![/c~/fT!Q![/c#W#X-X#[#]-p#a#b.U#g#h.x~/zP&o~!Q![/}~0QU!Q![/}#W#X-X#[#]-p#a#b.U#g#h.x#k#l/Z~0gR!Q![0p!c!i0p#T#Z0p~0uR&o~!Q![0p!c!i0p#T#Z0pV1VT&qS!]R!Q![1f![!]1f!c!}1f#R#S1f#T#o1fR1kT!]R!Q![1f![!]1f!c!}1f#R#S1f#T#o1f~2PP!W~!_!`2S~2XO!V~~2^Q$aP!_!`2d#r#s2iQ2iO!SQ~2nO$b~~2sP!U~!_!`2v~2{O!T~~3QO$f~V3XT!]RuS!Q![3Q![!]1f!c!}3Q#R#S3Q#T#o3Q~3mO&l~~3rO&p~~3wOz~~3zTO#S3w#S#T%c#T;'S3w;'S;=`4Z<%lO3w~4^P;=`<%l3w~4fO&r~~4kO&s~",tokenizers:[0,1,2],topRules:{PromQL:[0,32],MetricName:[1,162]},specialized:[{term:59,get:(e,t)=>p(e)<<1,external:p},{term:59,get:(e,t)=>m(e)<<1|1,external:m,extend:!0},{term:59,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={61:{name:"abs",argTypes:[o.vector],variadic:0,returnType:o.vector},60:{name:"absent",argTypes:[o.vector],variadic:0,returnType:o.vector},58:{name:"absent_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},62:{name:"acos",argTypes:[o.vector],variadic:0,returnType:o.vector},63:{name:"acosh",argTypes:[o.vector],variadic:0,returnType:o.vector},64:{name:"asin",argTypes:[o.vector],variadic:0,returnType:o.vector},65:{name:"asinh",argTypes:[o.vector],variadic:0,returnType:o.vector},66:{name:"atan",argTypes:[o.vector],variadic:0,returnType:o.vector},67:{name:"atanh",argTypes:[o.vector],variadic:0,returnType:o.vector},68:{name:"avg_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},69:{name:"ceil",argTypes:[o.vector],variadic:0,returnType:o.vector},70:{name:"changes",argTypes:[o.matrix],variadic:0,returnType:o.vector},71:{name:"clamp",argTypes:[o.vector,o.scalar,o.scalar],variadic:0,returnType:o.vector},72:{name:"clamp_max",argTypes:[o.vector,o.scalar],variadic:0,returnType:o.vector},73:{name:"clamp_min",argTypes:[o.vector,o.scalar],variadic:0,returnType:o.vector},74:{name:"cos",argTypes:[o.vector],variadic:0,returnType:o.vector},75:{name:"Cosh",argTypes:[o.vector],variadic:0,returnType:o.vector},76:{name:"count_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},77:{name:"days_in_month",argTypes:[o.vector],variadic:1,returnType:o.vector},78:{name:"day_of_month",argTypes:[o.vector],variadic:1,returnType:o.vector},79:{name:"day_of_week",argTypes:[o.vector],variadic:1,returnType:o.vector},80:{name:"day_of_year",argTypes:[o.vector],variadic:1,returnType:o.vector},81:{name:"deg",argTypes:[o.vector],variadic:0,returnType:o.vector},82:{name:"delta",argTypes:[o.matrix],variadic:0,returnType:o.vector},83:{name:"deriv",argTypes:[o.matrix],variadic:0,returnType:o.vector},84:{name:"exp",argTypes:[o.vector],variadic:0,returnType:o.vector},85:{name:"first_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},86:{name:"floor",argTypes:[o.vector],variadic:0,returnType:o.vector},93:{name:"histogram_avg",argTypes:[o.vector],variadic:0,returnType:o.vector},87:{name:"histogram_count",argTypes:[o.vector],variadic:0,returnType:o.vector},88:{name:"histogram_fraction",argTypes:[o.scalar,o.scalar,o.vector],variadic:0,returnType:o.vector},89:{name:"histogram_quantile",argTypes:[o.scalar,o.vector],variadic:0,returnType:o.vector},90:{name:"histogram_stddev",argTypes:[o.vector],variadic:0,returnType:o.vector},91:{name:"histogram_stdvar",argTypes:[o.vector],variadic:0,returnType:o.vector},92:{name:"histogram_sum",argTypes:[o.vector],variadic:0,returnType:o.vector},94:{name:"double_exponential_smoothing",argTypes:[o.matrix,o.scalar,o.scalar],variadic:0,returnType:o.vector},95:{name:"hour",argTypes:[o.vector],variadic:1,returnType:o.vector},96:{name:"idelta",argTypes:[o.matrix],variadic:0,returnType:o.vector},97:{name:"increase",argTypes:[o.matrix],variadic:0,returnType:o.vector},98:{name:"info",argTypes:[o.vector,o.vector],variadic:1,returnType:o.vector},99:{name:"irate",argTypes:[o.matrix],variadic:0,returnType:o.vector},100:{name:"label_replace",argTypes:[o.vector,o.string,o.string,o.string,o.string],variadic:0,returnType:o.vector},101:{name:"label_join",argTypes:[o.vector,o.string,o.string,o.string],variadic:-1,returnType:o.vector},102:{name:"last_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},103:{name:"ln",argTypes:[o.vector],variadic:0,returnType:o.vector},104:{name:"log10",argTypes:[o.vector],variadic:0,returnType:o.vector},105:{name:"log2",argTypes:[o.vector],variadic:0,returnType:o.vector},106:{name:"mad_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},107:{name:"max_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},108:{name:"min_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},109:{name:"ts_of_first_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},110:{name:"ts_of_max_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},111:{name:"ts_of_min_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},112:{name:"ts_of_last_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},113:{name:"minute",argTypes:[o.vector],variadic:1,returnType:o.vector},114:{name:"month",argTypes:[o.vector],variadic:1,returnType:o.vector},115:{name:"pi",argTypes:[],variadic:0,returnType:o.vector},116:{name:"predict_linear",argTypes:[o.matrix,o.scalar],variadic:0,returnType:o.vector},117:{name:"present_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},118:{name:"quantile_over_time",argTypes:[o.scalar,o.matrix],variadic:0,returnType:o.vector},119:{name:"rad",argTypes:[o.vector],variadic:0,returnType:o.vector},120:{name:"rate",argTypes:[o.matrix],variadic:0,returnType:o.vector},121:{name:"resets",argTypes:[o.matrix],variadic:0,returnType:o.vector},122:{name:"round",argTypes:[o.vector,o.scalar],variadic:1,returnType:o.vector},123:{name:"scalar",argTypes:[o.vector],variadic:0,returnType:o.scalar},124:{name:"sgn",argTypes:[o.vector],variadic:0,returnType:o.vector},125:{name:"sin",argTypes:[o.vector],variadic:0,returnType:o.vector},126:{name:"Sinh",argTypes:[o.vector],variadic:0,returnType:o.vector},127:{name:"sort",argTypes:[o.vector],variadic:0,returnType:o.vector},128:{name:"sort_desc",argTypes:[o.vector],variadic:0,returnType:o.vector},129:{name:"sort_by_label",argTypes:[o.vector,o.string],variadic:-1,returnType:o.vector},130:{name:"sort_by_label_desc",argTypes:[o.vector,o.string],variadic:-1,returnType:o.vector},131:{name:"sqrt",argTypes:[o.vector],variadic:0,returnType:o.vector},132:{name:"stddev_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},133:{name:"stdvar_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},134:{name:"sum_over_time",argTypes:[o.matrix],variadic:0,returnType:o.vector},135:{name:"tan",argTypes:[o.vector],variadic:0,returnType:o.vector},136:{name:"tanh",argTypes:[o.vector],variadic:0,returnType:o.vector},138:{name:"time",argTypes:[],variadic:0,returnType:o.scalar},137:{name:"timestamp",argTypes:[o.vector],variadic:0,returnType:o.vector},139:{name:"vector",argTypes:[o.scalar],variadic:0,returnType:o.vector},140:{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 155:return""===this.value;case 55: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 158:if(!a.next())break;do switch(a.type.id){case 38:i.name=t.sliceDoc(a.from,a.to).slice(1,-1);break;case 154:{let e=a.node.firstChild;e&&(i.type=e.type.id);break}case 39:i.value=t.sliceDoc(a.from,a.to).slice(1,-1)}while(a.nextSibling());break;case 153:if(!a.next())break;do switch(a.type.id){case 37:i.name=t.sliceDoc(a.from,a.to);break;case 154:{let e=a.node.firstChild;e&&(i.type=e.type.id);break}case 39:i.value=t.sliceDoc(a.from,a.to).slice(1,-1)}while(a.nextSibling());break;case 38:i.name="__name__",i.value=t.sliceDoc(a.from,a.to).slice(1,-1),i.type=155}return i}(e,t))}),i}function T(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 155:default:t="=";break;case 55:t="!=";break;case 157:t="!~";break;case 156:t="=~"}let r=`${e.name}${t}"${e.value}"`;a=""===a?r:`${a},${r}`}return`${e}{${a}}`}function Q(e,t){for(;;){if(!e||e.type.id===t)return e;e=e.parent}return null}function x(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 P(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}function S(e){var t;if(!e)return o.none;switch(e.type.id){case 33:case 151:return o.vector;case 144:case 146:case 145:return S(e.firstChild);case 39:return o.string;case 143:return o.scalar;case 141:case 148:return o.matrix;case 147:case 149:case 159:return S(e.getChild("Expr"));case 41:{let t=S(e.firstChild),i=S(e.lastChild);if(t===o.scalar&&i===o.scalar)return o.scalar;return o.vector}case 56:{let i=null==(t=e.firstChild)?void 0:t.firstChild;if(!i)return o.none;return y[i.type.id].returnType}default:return o.none}}(r=l||(l={})).CardOneToOne="one-to-one",r.CardManyToOne="many-to-one",r.CardOneToMany="one-to-many",r.CardManyToMany="many-to-many";var X=i(63960);class w{constructor(e){this.tree=(0,X.mv)(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 33:this.checkAggregationExpr(e);break;case 41:this.checkBinaryExpr(e);break;case 56:this.checkCallFunction(e);break;case 147:case 141:this.checkAST(e.getChild("Expr"));break;case 149:{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 146:this.checkAnchoredSmoothedExpr(e,[120,97,82]);break;case 145:this.checkAnchoredSmoothedExpr(e,[121,70,120,97,82]);break;case 148:{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 151:this.checkVectorSelector(e);break;case 159:{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 S(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(40),r=a?a.getChildren("Expr"):[];r.length?(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")):this.addDiagnostic(e,"unable to find the parameter for the expression")}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(43),s=x(e,50,55,53,54,51,52),c=x(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 u=function(e,t){if(!t||41!==t.type.id)return null;let i={card:l.CardOneToOne,matchingLabels:[],on:!1,include:[]},a=t.getChild(44);if(a){i.on=null!==a.getChild(3);let t=a.getChild(36);for(let a of t?t.getChildren(37):[])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(37))||[])i.include.push(e.sliceDoc(a.from,a.to))}}return x(t,24,25,26)&&i.card===l.CardOneToOne&&(i.card=l.CardManyToMany),i}(this.state,e);if(null!==u&&u.on)for(let t of u.matchingLabels)for(let i of u.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!==u?u.matchingLabels.length>0&&this.addDiagnostic(e,"vector matching only allowed between instant vectors"):c&&(((null==u?void 0:u.card)===l.CardOneToMany||(null==u?void 0:u.card)===l.CardManyToOne)&&this.addDiagnostic(e,"no grouping allowed for set operations"),(null==u?void 0:u.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(40),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(59)&&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}"`)}}checkAnchoredSmoothedExpr(e,t){var i,a;let r=S(e);if(r!==o.vector&&r!==o.matrix)return void this.addDiagnostic(e,`smoothed/anchored expression only allowed on instant vector or range vector selector, got ${r} instead`);let n=null==(i=e.parent)?void 0:i.parent;if(!n||56!==n.type.id)return;let s=null==(a=n.firstChild)?void 0:a.firstChild;s?t.includes(s.type.id)||this.addDiagnostic(e,"smoothed/anchored expression can only be used in specific functions"):this.addDiagnostic(e,"function not defined")}checkVectorSelector(e){let t=e.getChild(152),i=[];for(let e of[38,158,153])i=i.concat(_(t?t.getChildren(e):[],this.state));let a="",r=e.getChild(59);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(155,"__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 k=i(9714);let E=[{label:"y"},{label:"w"},{label:"d"},{label:"h"},{label:"m"},{label:"s"},{label:"ms"}],A=[{label:"^"},{label:"*"},{label:"/"},{label:"%"},{label:"+"},{label:"-"},{label:"=="},{label:">="},{label:">"},{label:"<"},{label:"<="},{label:"!="},{label:"atan2"},{label:"and"},{label:"or"},{label:"unless"}],C=[{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"}],D=[{label:"sum(rate(__input_vector__[5m]))",type:"function",detail:"snippet",info:"Sum over rates of increase",apply:(0,k.UA)("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,k.UA)("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,k.UA)('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,k.UA)("topk(${__rank_number__}, ${__input_vector__})")},{label:"bottomk(__rank_number__, __input_vector__)",type:"function",detail:"snippet",info:"Smallest k elements by sample value",apply:(0,k.UA)("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,k.UA)('count_values("${__label_name__}", ${__metric__})')}],R=[{label:"="},{label:"!="},{label:"=~"},{label:"!~"}],F=[{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"}],q=[{label:"start()",info:"resolve to the start of the query",type:"keyword"},{label:"end()",info:"resolve to the end of the query",type:"keyword"}],M=[{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",type:"function"},{label:"histogram_count",detail:"function",info:"Return the count of observations from a native histogram",type:"function"},{label:"histogram_fraction",detail:"function",info:"Calculate fractions of observations within an interval from a native histogram",type:"function"},{label:"histogram_quantile",detail:"function",info:"Calculate quantiles from native histograms and from conventional histogram buckets",type:"function"},{label:"histogram_sum",detail:"function",info:"Return the sum of observations from a native histogram",type:"function"},{label:"histogram_stddev",detail:"function",info:"Estimate the standard deviation of observations from a native histogram",type:"function"},{label:"histogram_stdvar",detail:"function",info:"Estimate the standard variance of observations from a native histogram",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:"ts_of_max_over_time",detail:"function",info:"Return the timestamp of the maximum value over time for input series",type:"function"},{label:"ts_of_min_over_time",detail:"function",info:"Return the timestamp of the minimum value over time for input series",type:"function"},{label:"ts_of_last_over_time",detail:"function",info:"Return the timestamp of the last 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"}],L=[{label:"by",info:"Keep the listed labels, remove all others.",type:"keyword"},{label:"without",info:"Remove the listed labels, preserve all others.",type:"keyword"}],V=[{label:"nan",info:"Floating-point NaN value",type:"constant"},{label:"inf",info:"Floating-point infinity",type:"constant"}];function z(e,t){let i=Q(e,151);return i&&(i=i.getChild(59))?t.sliceDoc(i.from,i.to):""}function Y(e){var t;let i=e.parent;if(null!==i&&(null==(t=i.firstChild)?void 0:t.type.id)===34){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 N{constructor(e,t=1e4){this.prometheusClient=e,this.maxMetricsMetadata=t}getPrometheusClient(){return this.prometheusClient}promQL(e){let{state:t,pos:i}=e,a=(0,X.mv)(t).resolve(i,-1),r=function(e,t,i){var a,r,n,s,o,l,u,h,d,O,p,f,m,v,g,$,y,b,T,S,X;let w=[];switch(t.type.id){case 0:{if((null==(a=t.parent)?void 0:a.type.id)===144){w.push({kind:c.Duration});break}if((null==(r=t.parent)?void 0:r.type.id)===153||(null==(n=t.parent)?void 0:n.type.id)===158){w.push({kind:c.MatchOp});break}if((null==(s=t.parent)?void 0:s.type.id)===141||(null==(o=t.parent)?void 0:o.type.id)===148&&x(t.parent,142)){w.push({kind:c.Duration});break}let i=e.sliceDoc(t.from,t.to);A.filter(e=>e.label.includes(i)).length>0&&w.push({kind:c.BinOp});break}case 59:{if((null==(l=t.parent)?void 0:l.type.id)===0){let i=t.parent.parent;if((null==i?void 0:i.type.id)===159){w.push({kind:c.AtModifiers});break}if((null==i?void 0:i.type.id)===33){w.push({kind:c.AggregateOpModifier},{kind:c.BinOp});break}if((null==i?void 0:i.type.id)===151){let i=z(t,e);C.filter(e=>e.label===i).length>0&&w.push({kind:c.AggregateOpModifier}),w.push({kind:c.BinOp},{kind:c.Offset});break}if(i&&P(i,"Expr")){w.push({kind:c.BinOp},{kind:c.Offset});break}}let i=null==(u=t.parent)?void 0:u.parent;if(!i){w.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)});break}P(i,"Expr","Expr")&&40!==i.type.id?41!==i.type.id||x(i,0)||(w.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:c.Function},{kind:c.Aggregation},{kind:c.BinOpModifier},{kind:c.Number}),x(i,50,51,52,53,54,55)&&!x(i,43)&&w.push({kind:c.Bool})):(w.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:c.Function},{kind:c.Aggregation}),40!==i.type.id&&141!==i.type.id&&w.push({kind:c.Number}));break}case 32:null!==t.firstChild&&0===t.firstChild.type.id&&w.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation},{kind:c.Number});break;case 36:w.push({kind:c.LabelName,metricName:function(e,t){let i=Q(e,33);if(!i)return"";let a="";return i.cursor().iterate(e=>{if(151===e.type.id&&(a=z(e.node,t)))return!1}),a}(t,e)});break;case 152:w.push({kind:c.LabelName,metricName:z(t,e)});break;case 37:(null==(h=t.parent)?void 0:h.type.id)===36?w.push({kind:c.LabelName}):(null==(d=t.parent)?void 0:d.type.id)===153&&w.push({kind:c.LabelName,metricName:z(t,e)});break;case 39:if((null==(O=t.parent)?void 0:O.type.id)===153||(null==(p=t.parent)?void 0:p.type.id)===158){let i="";(null==(f=t.parent.firstChild)?void 0:f.type.id)===37?i=e.sliceDoc(t.parent.firstChild.from,t.parent.firstChild.to):(null==(m=t.parent.firstChild)?void 0:m.type.id)===38&&(i=e.sliceDoc(t.parent.firstChild.from,t.parent.firstChild.to).slice(1,-1));let a=z(t,e),r=Q(t,152),n=[];for(let t of[38,158,153])n=n.concat(_(r?r.getChildren(t):[],e));w.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)===36?w.push({kind:c.LabelName}):(null==(y=null==($=t.parent)?void 0:$.parent)?void 0:y.type.id)===152&&w.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to).slice(1,-1)});break;case 143:(null==(b=t.parent)?void 0:b.type.id)===0&&(null==(T=t.parent.parent)?void 0:T.type.id)===148?w.push({kind:c.Duration}):w.push({kind:c.Number});break;case 142:case 144:w.push({kind:c.Duration});break;case 40:if(Y(t)){if(null===t.firstChild||t.firstChild.from<=i&&t.firstChild.to>=i){w.push({kind:c.Number});break}w.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation});break}w.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation});break;case 55:(null==(S=t.parent)?void 0:S.type.id)===154?w.push({kind:c.MatchOp}):(null==(X=t.parent)?void 0:X.type.id)===41&&w.push({kind:c.BinOp});break;case 155:case 156:case 157:case 154:w.push({kind:c.MatchOp});break;case 42:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 24:case 26:case 25:case 41:w.push({kind:c.BinOp})}return w}(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(C));break;case c.Function:s=!0,n=n.then(e=>e.concat(M));break;case c.BinOpModifier:n=n.then(e=>e.concat(F));break;case c.BinOp:n=n.then(e=>e.concat(A));break;case c.MatchOp:n=n.then(e=>e.concat(R));break;case c.AggregateOpModifier:n=n.then(e=>e.concat(L));break;case c.Duration:o=!1,n=n.then(e=>e.concat(E));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(q));break;case c.Number:n=n.then(e=>e.concat(V));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(...D),{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 u=e.doc.slice(t.from,i).toString(),h=t.from;if(152===t.type.id||36===t.type.id){let e;e=t.from+1,null!==t.firstChild&&(e=i),h=e}else 40===t.type.id&&null===t.firstChild||39===t.type.id&&((null==(a=t.parent)?void 0:a.type.id)===153||(null==(r=t.parent)?void 0:r.type.id)===158)?h++:(144===t.type.id||142===t.type.id&&!E.map(e=>e.label).includes(u[u.length-1])||143===t.type.id&&(null==(n=t.parent)?void 0:n.type.id)===0&&(null==(s=t.parent.parent)?void 0:s.type.id)===148||40===t.type.id&&Y(t)&&null!==t.firstChild||0===t.type.id&&((null==(o=t.parent)?void 0:o.type.id)===144||(null==(l=t.parent)?void 0:l.type.id)===141||(null==(c=t.parent)?void 0:c.type.id)===148&&x(t.parent,142)))&&(h=i);return h}(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=>{var a;if(t)for(let[e,r]of i){let i=null!=(a=t[e])?a:t[e.replace(/(_count|_sum|_bucket)$/,"")];if(i){if(i.length>1)for(let e of i)""===r.detail?r.detail=e.type:r.detail!==e.type&&(r.detail="unknown",r.info="multiple different definitions for this metric"),""===r.info?r.info=e.help:r.info!==e.help&&(r.info="multiple different definitions for this metric");else if(1===i.length){let{type:t,help:a}=i[0];("histogram"===t||"summary"===t)&&(e.endsWith("_count")&&(t="counter",a=`The total number of observations for: ${a}`),e.endsWith("_sum")&&(t="counter",a=`The total sum of observations for: ${a}`),e.endsWith("_bucket")&&(t="counter",a=`The total count of observations for a bucket in the histogram: ${a}`)),r.detail=t,r.info=a}}}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}}var W={hasSubscribers:!1},U="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,Z=new Set,G="object"==typeof process&&process?process:{},j=(Symbol("type"),e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e)),H=e=>j(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?I:null:null,I=class extends Array{constructor(e){super(e),this.fill(0)}},B=class e{heap;length;static #e=!1;static create(t){let i=H(t);if(!i)return[];e.#e=!0;let a=new e(t,i);return e.#e=!1,a}constructor(t,i){if(!e.#e)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},J=class e{#e;#t;#i;#a;#r;#n;#s;#o;get perf(){return this.#o}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#c;#u;#h;#d;#O;#p;#f;#m;#v;#g;#$;#y;#b;#_;#T;#Q;#x;#P;static unsafeExposeInternals(e){return{starts:e.#y,ttls:e.#b,autopurgeTimers:e.#_,sizes:e.#$,keyMap:e.#u,keyList:e.#h,valList:e.#d,next:e.#O,prev:e.#p,get head(){return e.#f},get tail(){return e.#m},free:e.#v,isBackgroundFetch:t=>e.#S(t),backgroundFetch:(t,i,a,r)=>e.#X(t,i,a,r),moveToTail:t=>e.#w(t),indexes:t=>e.#k(t),rindexes:t=>e.#E(t),isStale:t=>e.#A(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#c}get size(){return this.#l}get fetchMethod(){return this.#n}get memoMethod(){return this.#s}get dispose(){return this.#i}get onInsert(){return this.#a}get disposeAfter(){return this.#r}constructor(t){let{max:i=0,ttl:a,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:l,dispose:c,onInsert:u,disposeAfter:h,noDisposeOnSet:d,noUpdateTTL:O,maxSize:p=0,maxEntrySize:f=0,sizeCalculation:m,fetchMethod:v,memoMethod:g,noDeleteOnFetchRejection:$,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:_,ignoreFetchAbort:T,perf:Q}=t;if(void 0!==Q&&"function"!=typeof Q?.now)throw TypeError("perf option must have a now() method if specified");if(this.#o=Q??U,0!==i&&!j(i))throw TypeError("max option must be a nonnegative integer");let x=i?H(i):Array;if(!x)throw Error("invalid max value: "+i);if(this.#e=i,this.#t=p,this.maxEntrySize=f||this.#t,this.sizeCalculation=m,this.sizeCalculation){if(!this.#t&&!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!==g&&"function"!=typeof g)throw TypeError("memoMethod must be a function if defined");if(this.#s=g,void 0!==v&&"function"!=typeof v)throw TypeError("fetchMethod must be a function if specified");if(this.#n=v,this.#Q=!!v,this.#u=new Map,this.#h=Array.from({length:i}).fill(void 0),this.#d=Array.from({length:i}).fill(void 0),this.#O=new x(i),this.#p=new x(i),this.#f=0,this.#m=0,this.#v=B.create(i),this.#l=0,this.#c=0,"function"==typeof c&&(this.#i=c),"function"==typeof u&&(this.#a=u),"function"==typeof h?(this.#r=h,this.#g=[]):(this.#r=void 0,this.#g=void 0),this.#T=!!this.#i,this.#P=!!this.#a,this.#x=!!this.#r,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!$,this.allowStaleOnFetchRejection=!!b,this.allowStaleOnFetchAbort=!!_,this.ignoreFetchAbort=!!T,0!==this.maxEntrySize){if(0!==this.#t&&!j(this.#t))throw TypeError("maxSize must be a positive integer if specified");if(!j(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=j(r)||0===r?r:1,this.ttlAutopurge=!!n,this.ttl=a||0,this.ttl){if(!j(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#D()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!Z.has(e))(t)&&(Z.add(t),((e,t,i,a)=>{"function"==typeof G.emitWarning?G.emitWarning(e,t,i,a):console.error(`[${i}] ${t}: ${e}`)})("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new I(this.#e),t=new I(this.#e);this.#b=e,this.#y=t;let i=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#_=i,this.#R=(i,r,n=this.#o.now())=>{t[i]=0!==r?n:0,e[i]=r,a(i,r)},this.#F=i=>{t[i]=0!==e[i]?this.#o.now():0,a(i,e[i])};let a=this.ttlAutopurge?(e,t)=>{if(i?.[e]&&(clearTimeout(i[e]),i[e]=void 0),t&&0!==t&&i){let a=setTimeout(()=>{this.#A(e)&&this.#q(this.#h[e],"expire")},t+1);a.unref&&a.unref(),i[e]=a}}:()=>{};this.#M=(i,a)=>{if(e[a]){let s=e[a],o=t[a];if(!s||!o)return;i.ttl=s,i.start=o,i.now=r||n();let l=i.now-o;i.remainingTTL=s-l}};let r=0,n=()=>{let e=this.#o.now();if(this.ttlResolution>0){r=e;let t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=i=>{let a=this.#u.get(i);if(void 0===a)return 0;let s=e[a],o=t[a];return s&&o?s-((r||n())-o):1/0},this.#A=i=>{let a=t[i],s=e[i];return!!s&&!!a&&(r||n())-a>s}}#F=()=>{};#M=()=>{};#R=()=>{};#A=()=>!1;#C(){let e=new I(this.#e);this.#c=0,this.#$=e,this.#L=t=>{this.#c-=e[t],e[t]=0},this.#V=(e,t,i,a)=>{if(this.#S(t))return 0;if(!j(i))if(a){if("function"!=typeof a)throw TypeError("sizeCalculation must be a function");if(!j(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.#z=(t,i,a)=>{if(e[t]=i,this.#t){let i=this.#t-e[t];for(;this.#c>i;)this.#Y(!0)}this.#c+=e[t],a&&(a.entrySize=i,a.totalCalculatedSize=this.#c)}}#L=e=>{};#z=(e,t,i)=>{};#V=(e,t,i,a)=>{if(i||a)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#m;this.#N(t)&&((e||!this.#A(t))&&(yield t),t!==this.#f);)t=this.#p[t]}*#E({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#f;this.#N(t)&&((e||!this.#A(t))&&(yield t),t!==this.#m);)t=this.#O[t]}#N(e){return void 0!==e&&this.#u.get(this.#h[e])===e}*entries(){for(let e of this.#k())void 0===this.#d[e]||void 0===this.#h[e]||this.#S(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*rentries(){for(let e of this.#E())void 0===this.#d[e]||void 0===this.#h[e]||this.#S(this.#d[e])||(yield[this.#h[e],this.#d[e]])}*keys(){for(let e of this.#k()){let t=this.#h[e];void 0===t||this.#S(this.#d[e])||(yield t)}}*rkeys(){for(let e of this.#E()){let t=this.#h[e];void 0===t||this.#S(this.#d[e])||(yield t)}}*values(){for(let e of this.#k())void 0===this.#d[e]||this.#S(this.#d[e])||(yield this.#d[e])}*rvalues(){for(let e of this.#E())void 0===this.#d[e]||this.#S(this.#d[e])||(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#k()){let a=this.#d[i],r=this.#S(a)?a.__staleWhileFetching:a;if(void 0!==r&&e(r,this.#h[i],this))return this.#W(this.#h[i],t)}}forEach(e,t=this){for(let i of this.#k()){let a=this.#d[i],r=this.#S(a)?a.__staleWhileFetching:a;void 0!==r&&e.call(t,r,this.#h[i],this)}}rforEach(e,t=this){for(let i of this.#E()){let a=this.#d[i],r=this.#S(a)?a.__staleWhileFetching:a;void 0!==r&&e.call(t,r,this.#h[i],this)}}purgeStale(){let e=!1;for(let t of this.#E({allowStale:!0}))this.#A(t)&&(this.#q(this.#h[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let i=this.#d[t],a=this.#S(i)?i.__staleWhileFetching:i;if(void 0===a)return;let r={value:a};if(this.#b&&this.#y){let e=this.#b[t],i=this.#y[t];e&&i&&(r.ttl=e-(this.#o.now()-i),r.start=Date.now())}return this.#$&&(r.size=this.#$[t]),r}dump(){let e=[];for(let t of this.#k({allowStale:!0})){let i=this.#h[t],a=this.#d[t],r=this.#S(a)?a.__staleWhileFetching:a;if(void 0===r||void 0===i)continue;let n={value:r};if(this.#b&&this.#y){n.ttl=this.#b[t];let e=this.#o.now()-this.#y[t];n.start=Math.floor(Date.now()-e)}this.#$&&(n.size=this.#$[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.#o.now()-e}this.#U(t,i.value,i)}}set(e,t,i={}){let{status:a=W.hasSubscribers?{}:void 0}=i;i.status=a,a&&(a.op="set",a.key=e,void 0!==t&&(a.value=t));let r=this.#U(e,t,i);return a&&W.hasSubscribers&&W.publish(a),r}#U(e,t,i={}){let{ttl:a=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:o}=i;if(void 0===t)return o&&(o.set="deleted"),this.delete(e),this;let{noUpdateTTL:l=this.noUpdateTTL}=i;o&&!this.#S(t)&&(o.value=t);let c=this.#V(e,t,i.size||0,s,o);if(this.maxEntrySize&&c>this.maxEntrySize)return this.#q(e,"set"),o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this;let u=0===this.#l?void 0:this.#u.get(e);if(void 0===u)u=0===this.#l?this.#m:0!==this.#v.length?this.#v.pop():this.#l===this.#e?this.#Y(!1):this.#l,this.#h[u]=e,this.#d[u]=t,this.#u.set(e,u),this.#O[this.#m]=u,this.#p[u]=this.#m,this.#m=u,this.#l++,this.#z(u,c,o),o&&(o.set="add"),l=!1,this.#P&&this.#a?.(t,e,"add");else{this.#w(u);let i=this.#d[u];if(t!==i){if(this.#Q&&this.#S(i)){i.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=i;void 0!==t&&!n&&(this.#T&&this.#i?.(t,e,"set"),this.#x&&this.#g?.push([t,e,"set"]))}else n||(this.#T&&this.#i?.(i,e,"set"),this.#x&&this.#g?.push([i,e,"set"]));if(this.#L(u),this.#z(u,c,o),this.#d[u]=t,o){o.set="replace";let e=i&&this.#S(i)?i.__staleWhileFetching:i;void 0!==e&&(o.oldValue=e)}}else o&&(o.set="update");this.#P&&this.onInsert?.(t,e,t===i?"update":"replace")}if(0===a||this.#b||this.#D(),this.#b&&(l||this.#R(u,a,r),o&&this.#M(o,u)),!n&&this.#x&&this.#g){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}return this}pop(){try{for(;this.#l;){let e=this.#d[this.#f];if(this.#Y(!0),this.#S(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#x&&this.#g){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}}}#Y(e){let t=this.#f,i=this.#h[t],a=this.#d[t];return this.#Q&&this.#S(a)?a.__abortController.abort(Error("evicted")):(this.#T||this.#x)&&(this.#T&&this.#i?.(a,i,"evict"),this.#x&&this.#g?.push([a,i,"evict"])),this.#L(t),this.#_?.[t]&&(clearTimeout(this.#_[t]),this.#_[t]=void 0),e&&(this.#h[t]=void 0,this.#d[t]=void 0,this.#v.push(t)),1===this.#l?(this.#f=this.#m=0,this.#v.length=0):this.#f=this.#O[t],this.#u.delete(i),this.#l--,t}has(e,t={}){let{status:i=W.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="has",i.key=e);let a=this.#Z(e,t);return W.hasSubscribers&&W.publish(i),a}#Z(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:a}=t,r=this.#u.get(e);if(void 0!==r){let e=this.#d[r];if(this.#S(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#A(r))return i&&this.#F(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{status:i=W.hasSubscribers||W.hasSubscribers?{}:void 0}=t;i&&(i.op="peek",i.key=e),t.status=i;let a=this.#G(e,t);return W.hasSubscribers&&W.publish(i),a}#G(e,t){let{status:i,allowStale:a=this.allowStale}=t,r=this.#u.get(e);if(void 0===r||!a&&this.#A(r)){i&&(i.peek=void 0===r?"miss":"stale");return}let n=this.#d[r],s=this.#S(n)?n.__staleWhileFetching:n;return i&&(void 0!==s?(i.peek="hit",i.value=s):i.peek="miss"),s}#X(e,t,i,a){let r=void 0===t?void 0:this.#d[t];if(this.#S(r))return r;let n=new AbortController,{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,u=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&void 0!==a);if(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)return c(n.signal.reason,u);let d=this.#d[t];return(d===h||void 0===d&&l&&r)&&(void 0===a?void 0!==h.__staleWhileFetching?this.#d[t]=h.__staleWhileFetching:this.#q(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#U(e,a,o.options))),a},c=(a,r)=>{let{aborted:s}=n.signal,o=s&&i.allowStaleOnFetchAbort,l=o||i.allowStaleOnFetchRejection,c=l||i.noDeleteOnFetchRejection;if(this.#d[t]===h&&(c&&(r||void 0!==h.__staleWhileFetching)?o||(this.#d[t]=h.__staleWhileFetching):this.#q(e,"fetch")),l)return i.status&&void 0!==h.__staleWhileFetching&&(i.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw a},u=(t,a)=>{let s=this.#n?.(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 h=new Promise(u).then(l,e=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=e),c(e,!1))),d=Object.assign(h,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return void 0===t?(this.#U(e,d,{...o.options,status:void 0}),t=this.#u.get(e)):this.#d[t]=d,d}#S(e){return!!this.#Q&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(e,t={}){let i=W.hasSubscribers,{status:a=W.hasSubscribers||W.hasSubscribers?{}:void 0}=t;t.status=a,a&&t.context&&(a.context=t.context);let r=this.#j(e,t);return a&&(W.hasSubscribers||W.hasSubscribers)&&i&&(a.trace=!0,W.tracePromise(()=>r,a).catch(()=>{})),r}async #j(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:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:O=this.allowStaleOnFetchAbort,context:p,forceRefresh:f=!1,status:m,signal:v}=t;if(m&&(m.op="fetch",m.key=e,f&&(m.forceRefresh=!0)),!this.#Q)return m&&(m.fetch="get"),this.#W(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:u,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:O,ignoreFetchAbort:d,status:m,signal:v},$=this.#u.get(e);if(void 0===$){m&&(m.fetch="miss");let t=this.#X(e,$,g,p);return t.__returned=t}{let t=this.#d[$];if(this.#S(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.#A($);if(!f&&!r)return m&&(m.fetch="hit"),this.#w($),a&&this.#F($),m&&this.#M(m,$),t;let n=this.#X(e,$,g,p),s=void 0!==n.__staleWhileFetching&&i;return m&&(m.fetch=r?"stale":"refresh",s&&r&&(m.returnedStale=!0)),s?n.__staleWhileFetching:n.__returned=n}}forceFetch(e,t={}){let i=W.hasSubscribers,{status:a=W.hasSubscribers||W.hasSubscribers?{}:void 0}=t;t.status=a,a&&t.context&&(a.context=t.context);let r=this.#H(e,t);return a&&(W.hasSubscribers||W.hasSubscribers)&&i&&(a.trace=!0,W.tracePromise(()=>r,a).catch(()=>{})),r}async #H(e,t={}){let i=await this.#j(e,t);if(void 0===i)throw Error("fetch() returned undefined");return i}memo(e,t={}){let{status:i=W.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="memo",i.key=e,t.context&&(i.context=t.context));let a=this.#I(e,t);return i&&(i.value=a),W.hasSubscribers&&W.publish(i),a}#I(e,t={}){let i=this.#s;if(!i)throw Error("no memoMethod provided to constructor");let{context:a,status:r,forceRefresh:n,...s}=t;r&&n&&(r.forceRefresh=!0);let o=this.#W(e,s),l=n||void 0===o;if(r&&(r.memo=l?"miss":"hit",l||(r.value=o)),!l)return o;let c=i(e,o,{options:s,context:a});return r&&(r.value=c),this.#U(e,c,s),c}get(e,t={}){let{status:i=W.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="get",i.key=e);let a=this.#W(e,t);return i&&(void 0!==a&&(i.value=a),W.hasSubscribers&&W.publish(i)),a}#W(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){n&&(n.get="miss");return}let o=this.#d[s],l=this.#S(o);return n&&this.#M(n,s),this.#A(s)?l?(n&&(n.get="stale-fetching"),i&&void 0!==o.__staleWhileFetching?(n&&(n.returnedStale=!0),o.__staleWhileFetching):void 0):(r||this.#q(e,"expire"),n&&(n.get="stale"),i?(n&&(n.returnedStale=!0),o):void 0):(n&&(n.get=l?"fetching":"hit"),this.#w(s),a&&this.#F(s),l?o.__staleWhileFetching:o)}#B(e,t){this.#p[t]=e,this.#O[e]=t}#w(e){e!==this.#m&&(e===this.#f?this.#f=this.#O[e]:this.#B(this.#p[e],this.#O[e]),this.#B(this.#m,e),this.#m=e)}delete(e){return this.#q(e,"delete")}#q(e,t){W.hasSubscribers&&W.publish({op:"delete",delete:t,key:e});let i=!1;if(0!==this.#l){let a=this.#u.get(e);if(void 0!==a)if(this.#_?.[a]&&(clearTimeout(this.#_?.[a]),this.#_[a]=void 0),i=!0,1===this.#l)this.#J(t);else{this.#L(a);let i=this.#d[a];if(this.#S(i)?i.__abortController.abort(Error("deleted")):(this.#T||this.#x)&&(this.#T&&this.#i?.(i,e,t),this.#x&&this.#g?.push([i,e,t])),this.#u.delete(e),this.#h[a]=void 0,this.#d[a]=void 0,a===this.#m)this.#m=this.#p[a];else if(a===this.#f)this.#f=this.#O[a];else{let e=this.#p[a];this.#O[e]=this.#O[a];let t=this.#O[a];this.#p[t]=this.#p[a]}this.#l--,this.#v.push(a)}}if(this.#x&&this.#g?.length){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}return i}clear(){return this.#J("delete")}#J(e){for(let t of this.#E({allowStale:!0})){let i=this.#d[t];if(this.#S(i))i.__abortController.abort(Error("deleted"));else{let a=this.#h[t];this.#T&&this.#i?.(i,a,e),this.#x&&this.#g?.push([i,a,e])}}if(this.#u.clear(),this.#d.fill(void 0),this.#h.fill(void 0),this.#b&&this.#y){for(let e of(this.#b.fill(0),this.#y.fill(0),this.#_??[]))void 0!==e&&clearTimeout(e);this.#_?.fill(void 0)}if(this.#$&&this.#$.fill(0),this.#f=0,this.#m=0,this.#v.length=0,this.#c=0,this.#l=0,this.#x&&this.#g){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}}};class K{constructor(e){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,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 URLSearchParams;if(this.lookbackInterval){let e=new Date,i=new Date(e.getTime()-this.lookbackInterval);t.set("start",i.toISOString()),t.set("end",e.toISOString())}e&&e.length>0&&t.set("match[]",T(e));let i=this.buildRequest(this.labelsEndpoint(),t);return this.fetchAPI(i.uri,{method:this.httpMethod,body:i.body}).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}labelValues(e,t,i){let a=new URLSearchParams;if(this.lookbackInterval){let e=new Date,t=new Date(e.getTime()-this.lookbackInterval);a.set("start",t.toISOString()),a.set("end",e.toISOString())}return t&&t.length>0&&a.set("match[]",T(t,i,e)),this.fetchAPI(`${this.labelValuesEndpoint().replace(/:name/gi,e)}?${a}`).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}metricMetadata(){return this.fetchAPI(this.metricMetadataEndpoint()).catch(e=>(this.errorHandler&&this.errorHandler(e),{}))}series(e,t,i){let a=new URLSearchParams;if(this.lookbackInterval){let e=new Date,t=new Date(e.getTime()-this.lookbackInterval);a.set("start",t.toISOString()),a.set("end",e.toISOString())}a.set("match[]",T(e,t,i));let r=this.buildRequest(this.seriesEndpoint(),a);return this.fetchAPI(r.uri,{method:this.httpMethod,body:r.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){const 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)}getAssociations(e){let t=this.completeAssociation.get(e);return t||(t=new Map,this.completeAssociation.set(e,t)),t}setAssociations(e,t){t.forEach(t=>{let i=this.getAssociations(e);for(let[e,a]of Object.entries(t)){if("__name__"===e)continue;let t=i.get(e);void 0===t?i.set(e,new Set([a])):t.add(a)}})}setLabelValuesAssociation(e,t,i){let a=this.getAssociations(e),r=a.get(t);void 0===r?a.set(t,new Set(i)):i.forEach(e=>{r.add(e)})}setLabelNamesAssociation(e,t){let i=this.getAssociations(e);t.forEach(e=>{"__name__"!==e&&(i.has(e)||i.set(e,new Set))})}setFlags(e){this.flags=e}getFlags(){return this.flags}setMetricMetadata(e){this.metricMetadata=e}getMetricMetadata(){return this.metricMetadata}setLabelNames(e,t){t&&t.length>0&&this.setLabelNamesAssociation(t,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,i){i&&i.length>0&&this.setLabelValuesAssociation(i,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):this.client.labelNames(e).then(t=>(this.cache.setLabelNames(t,e),this.cache.getLabelNames(e)))}labelValues(e,t){let i=this.cache.getLabelValues(e,t);return i&&i.length>0?Promise.resolve(i):this.client.labelValues(e,t).then(i=>(this.cache.setLabelValues(e,i,t),i))}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 N(e.remote,e.maxMetricsMetadata):new N(new et(new K(e.remote),e.remote.cache),e.maxMetricsMetadata)}return new N}var ea=i(13313);class er{promQL(){return e=>{let t=new w(e.state);return t.analyze(),t.getDiagnostics()}}}(s=u||(u={})).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=u.PromQL){var t,i;let a=X.bj.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.bu)(t.call(i))))),r}}},74830(e,t,i){var a;t.default=void 0,t.default=(0,((a=i(1448))&&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")},93196(e,t,i){var a;t.default=void 0,t.default=(0,((a=i(1448))&&a.__esModule?a:{default:a}).default)("M3,3H9V7H3V3M15,10H21V14H15V10M15,17H21V21H15V17M13,13H7V18H13V20H7L5,20V9H7V11H13V13Z","FileTree")}}]);
@@ -1 +0,0 @@
1
- "use strict";(self["chunk_Prometheus "]=self["chunk_Prometheus "]||[]).push([["5412"],{69791(e,t,a){a.d(t,{a3:()=>s,eo:()=>i,pW:()=>n}),a(94461);let r=/^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;function n(e){let t=r.exec(e);if(null===t)throw Error(`Invalid duration string '${e}'`);return{years:parseInt(t[1]??"0"),months:0,weeks:parseInt(t[2]??"0"),days:parseInt(t[3]??"0"),hours:parseInt(t[4]??"0"),minutes:parseInt(t[5]??"0"),seconds:parseInt(t[6]??"0")+parseInt(t[7]??"0")/1e3}}function i(e){let t=Math.trunc(e/31536e6);t>0&&(e-=31536e6*t);let a=Math.trunc(e/6048e5);a>0&&(e-=6048e5*a);let r=Math.trunc(e/864e5);r>0&&(e-=864e5*r);let n=Math.trunc(e/36e5);n>0&&(e-=36e5*n);let i=Math.trunc(e/6e4);return i>0&&(e-=6e4*i),{years:t,months:0,weeks:a,days:r,hours:n,minutes:i,seconds:e/1e3}}function s(e){let t=[];if(e.years&&t.push(`${e.years}y`),e.weeks&&t.push(`${e.weeks}w`),e.days&&t.push(`${e.days}d`),e.hours&&t.push(`${e.hours}h`),e.minutes&&t.push(`${e.minutes}m`),e.seconds){let a=Math.trunc(e.seconds);a&&t.push(`${a}s`);let r=Math.round((e.seconds-a)*1e3);r&&t.push(`${r}ms`)}return t.join("")}},37856(e,t,a){async function r(...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 a=await t.clone().text();if(a)throw new s(a,t.status);throw new i(t)}return t}async function n(...e){let t=await r(...e);if(!t.ok)throw new i(t);return await t.json()}a.d(t,{hd:()=>r,x6:()=>n});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)}}},42524(e,t,a){var r;t.default=void 0,t.default=(0,((r=a(1448))&&r.__esModule?r:{default:r}).default)("M19,13H5V11H19V13Z","Minus")},86742(e,t,a){var r;t.default=void 0,t.default=(0,((r=a(1448))&&r.__esModule?r:{default:r}).default)("M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z","Plus")},3412(e,t,a){function r(e){let[t,a]=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}(a)]}a.d(t,{OM:()=>h,l3:()=>d,Vx:()=>c,eU:()=>g.eU,_H:()=>o,z:()=>w,Ul:()=>p,bZ:()=>l,ZO:()=>g.ZO,mA:()=>m,gM:()=>u,lS:()=>r,hu:()=>g.hu,LY:()=>b,$c:()=>s,kG:()=>x,do:()=>g.do});var n=a(37856);function i(e,t){let a=t||new URLSearchParams;e&&Object.entries(e).forEach(e=>{let[r,n]=e;null!=t&&t.has(r)||(Array.isArray(n)?n.forEach(e=>a.append(r,e)):a.set(r,n))});let r=a.toString();return""!==r?`?${r}`:""}function s(e,t){if(e||t)return{...e,...t}}function l(e){return async()=>{let t=`${e.datasourceUrl}/-/healthy${i(e.queryParams)}`;try{let a=await (0,n.hd)(t,{headers:e.headers,signal:e.signal});return 200===a.status}catch{return!1}}}function o(e,t){return v("/api/v1/query",e,t)}function u(e,t){return v("/api/v1/query_range",e,t)}function d(e,t){return v("/api/v1/labels",e,t)}function c(e,t){let{labelName:a,...r}=e;return 0===a.length?new Promise(e=>{e({data:[]})}):f(`/api/v1/label/${encodeURIComponent(a)}/values`,r,t)}function h(e,t){return f("/api/v1/metadata",e,t)}function p(e,t){return v("/api/v1/series",e,t)}function m(e,t){return v("/api/v1/parse_query",e,t)}function f(e,t,a){let{datasourceUrl:r,headers:s,queryParams:l,signal:o}=a,u=`${r}${e}${i(l,y(t))}`;return(0,n.x6)(u,{method:"GET",headers:s,signal:o})}function v(e,t,a){let{datasourceUrl:r,headers:s,signal:l,queryParams:o}=a,u=`${r}${e}${i(o)}`,d={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...s},signal:l,body:y(t)};return(0,n.x6)(u,d)}function y(e){let t=new URLSearchParams;for(let a in e){let r=e[a];if(void 0!==r){if("string"==typeof r){t.append(a,r);continue}if("number"==typeof r){t.append(a,r.toString());continue}for(let e of r)t.append(a,e)}}return t}var g=a(24381),_=a(69791),P=a(94461);function b(e){let{start:t,end:a}=e;return{start:Math.ceil((0,P.getUnixTime)(t)),end:Math.ceil((0,P.getUnixTime)(a))}}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=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(r/1e3*a,t,n)}function w(e){if(!e)return;let t=(0,_.pW)(e);return Math.floor((0,P.milliseconds)(t)/1e3)}},24381(e,t,a){a.d(t,{ZO:()=>l,do:()=>s,eU:()=>n,hu:()=>i});var r=a(47414);let n="PrometheusDatasource",i={kind:n};function s(e){return!(0,r.isVariableDatasource)(e)&&void 0===e.name}function l(e){return(0,r.isVariableDatasource)(e)||e.kind===n}},40759(e,t,a){a.r(t),a.d(t,{PrometheusDatasource:()=>m});var r=a(3412),n=a(62540),i=a(88091),s=a(93648),l=a(74628),o=a(47095),u=a(47414),d=a(42524),c=a(86742),h=a(70451);function p(e,t,a,n){return(i,s)=>e(i,{datasourceUrl:t,headers:(null==s?void 0:s.headers)??a,signal:null==s?void 0:s.signal,queryParams:(0,r.$c)(n,null==s?void 0:s.queryParams)})}let m={createClient:(e,t)=>{let{directUrl:a,proxy:n,queryParams:i}=e,{proxyUrl:s}=t,l=a??s;if(void 0===l)throw Error("No URL specified for Prometheus client. You can use directUrl in the spec to configure it.");let o=null==n?void 0:n.spec.headers;return{options:{datasourceUrl:l},healthCheck:(0,r.bZ)({datasourceUrl:l,headers:o,queryParams:i}),instantQuery:p(r._H,l,o,i),rangeQuery:p(r.gM,l,o,i),labelNames:p(r.l3,l,o,i),labelValues:p(r.Vx,l,o,i),metricMetadata:p(r.OM,l,o,i),series:p(r.Ul,l,o,i),parseQuery:p(r.mA,l,o,i)}},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:a,isReadonly:r}=e,p=(0,h.useRef)(0),[m,f]=(0,h.useState)(()=>Object.entries(t.queryParams??{}).map(e=>{let[t,a]=e;return{id:String(p.current++),key:t,value:Array.isArray(a)?a.join(","):a}})),v=new Map,y=new Set;m.forEach(e=>{let{key:t}=e;if(""!==t){let e=(v.get(t)||0)+1;v.set(t,e),e>1&&y.add(t)}});let g=y.size>0,_=e=>{let r={};e.forEach(e=>{let{key:t,value:a}=e;if(""!==t){let e=a.split(",");r[t]=e.length>1?e:a}}),a({...t,queryParams:Object.keys(r).length>0?r:void 0})},P=(e,t,a)=>{let r=m.map(r=>r.id!==e?r:"key"===t?{...r,key:a}:{...r,value:a});f(r),_(r)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.A,{variant:"h4",mb:2,children:"General Settings"}),(0,n.jsx)(s.A,{size:"small",fullWidth:!0,label:"Scrape Interval",value:t.scrapeInterval||"",placeholder:"Default: 1m",InputProps:{readOnly:r},InputLabelProps:{shrink:!!r||void 0},onChange:e=>a({...t,scrapeInterval:e.target.value}),helperText:"Set it to match the typical scrape interval used in your Prometheus instance."}),(0,n.jsx)(u.HTTPSettingsEditor,{value:t,onChange:a,isReadonly:r,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:""}}}}),(0,n.jsx)(i.A,{variant:"h5",mt:2,mb:1,children:"Query Parameters"}),m.length>0&&(0,n.jsx)(n.Fragment,{children:m.map(e=>(0,n.jsxs)(l.A,{display:"flex",alignItems:"center",gap:2,mb:1,children:[(0,n.jsx)(s.A,{size:"small",label:"Key",value:e.key,placeholder:"Parameter name",disabled:r,onChange:t=>P(e.id,"key",t.target.value),error:y.has(e.key),sx:{minWidth:150}}),(0,n.jsx)(s.A,{size:"small",label:"Value",value:e.value,placeholder:"Parameter value",disabled:r,onChange:t=>P(e.id,"value",t.target.value),sx:{minWidth:150,flexGrow:1}}),!r&&(0,n.jsx)(o.A,{onClick:()=>{var t;let a;return t=e.id,void(f(a=m.filter(e=>e.id!==t)),_(a))},children:(0,n.jsx)(d.default,{})})]},e.id))}),g&&(0,n.jsx)(i.A,{variant:"body2",color:"error",mb:1,children:"Duplicate parameter keys detected. Each key must be unique."}),0===m.length&&(0,n.jsx)(i.A,{variant:"body2",color:"textSecondary",children:"No query parameters configured. Use query parameters to pass additional options to Prometheus (e.g., dedup=false for Thanos)."}),!r&&(0,n.jsx)(o.A,{onClick:()=>{let e=[...m,{id:String(p.current++),key:"",value:""}];f(e),_(e)},children:(0,n.jsx)(c.default,{})})]})},createInitialOptions:()=>({directUrl:""})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self["chunk_Prometheus "]=self["chunk_Prometheus "]||[]).push([["1454"],{19056(e,t,l){var n;t.default=void 0,t.default=(0,((n=l(1448))&&n.__esModule?n:{default:n}).default)("M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z","ArrowLeft")},3908(e,t,l){var n;t.default=void 0,t.default=(0,((n=l(1448))&&n.__esModule?n:{default:n}).default)("M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z","Check")},10871(e,t,l){var n;t.default=void 0,t.default=(0,((n=l(1448))&&n.__esModule?n:{default:n}).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")},23652(e,t,l){var n;t.default=void 0,t.default=(0,((n=l(1448))&&n.__esModule?n:{default:n}).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")},13915(e,t,l){var n;t.default=void 0,t.default=(0,((n=l(1448))&&n.__esModule?n:{default:n}).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")},79440(e,t,l){l.r(t),l.d(t,{PrometheusExplorer:()=>ew});var n=l(62540),a=l(74628),r=l(315),i=l(87034),s=l(33868),o=l(47414),d=l(32918),u=l(85180),c=l(1566),h=l(70451),x=l(24381),p=l(47095),f=l(30145),m=l(97653),g=l(10740),j=l(42927),b=l(25742),v=l(93648),A=l(2582),C=l(8072),y=l(56599),w=l(7013);function M(e){return e.to-e.from+1}function S(e,t){let l=e[t],n=null;return 0===t&&0!==l.from&&(n={from:0,to:l.from-1}),t>0&&(n={from:e[t-1].to+1,to:l.from-1}),n}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,l){let n=(null==l?void 0:l.shouldSort)!==void 0?l.shouldSort:this.conf.shouldSort,a=[];for(let n=0;n<t.length;n++){let r=this.match(e,t[n],l);null!==r&&(r.index=n,a.push(r))}return n&&(a=a.sort((e,t)=>t.score-e.score)),a}match(e,t,l){let n=e,a=t,r=(null==l?void 0:l.caseSensitive)!==void 0?l.caseSensitive:this.conf.caseSensitive,i=(null==l?void 0:l.includeMatches)!==void 0?l.includeMatches:this.conf.includeMatches,s=(null==l?void 0:l.shouldRender)!==void 0?l.shouldRender:this.conf.shouldRender;if(r||(n=n.toLowerCase(),a=a.toLowerCase()),n===a){let n=[{from:0,to:e.length-1}],a={original:t,rendered:s?this.render(t,n,l):t,score:1/0};return i&&(a.intervals=n),a}let o=[],d=0;for(let e=0;e<a.length-n.length+1;e++)if(a[e]===n[0]){let t=this.generateMatchingInterval(n,a,e,l);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,l):t,score:d};return i&&(u.intervals=o),u}render(e,t,l){if(0==t.length)return e;let n="",a=(null==l?void 0:l.pre)?l.pre:this.conf.pre,r=(null==l?void 0:l.post)?l.post:this.conf.post;for(let i=0;i<t.length;i++){let s=t[i],o=S(t,i),d="";null!==o&&(d=this.extractSubString(e,o,l));let u=this.extractSubString(e,s,l);n=`${n}${d}${a}${u}${r}`}let i=t[t.length-1];return i.to<e.length-1&&(n+=this.extractSubString(e,{from:i.to+1,to:e.length},l)),n}extractSubString(e,t,l){let n=(null==l?void 0:l.escapeHTML)!==void 0?l.escapeHTML:this.conf.escapeHTML,a=e.substr(t.from,M(t));return n&&(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,l,n){let a=[];(null==n?void 0:n.excludedChars)!==void 0?a=n.excludedChars:void 0!==this.conf.excludedChars&&(a=this.conf.excludedChars);let r=0,i=[];for(let n=l;n<t.length&&r<e.length;){if(a.includes(t[n])){n++;continue}if(a.includes(e[r])){r++;continue}if(t[n]===e[r]){let l={from:n,to:n};r++,n++;for(let a=n;a<t.length&&r<e.length&&t[a]===e[r];a++)l.to=a,r++,n=a;i.push(l)}n++}return 0===i.length||r!==e.length?null:{score:function(e,t){let l=0;for(let n=0;n<e.length;n++){let a=e[n],r=S(e,n);null!==r&&(l-=M(r)/t),l+=M(a)**2}return l}(i,t.length),intervals:i}}}new L;var k=l(19056),_=l(10871),E=l(98599),T=l(33261),I=l(3412),V=l(45271),P=l(88091),R=l(33313),$=l(6227),O=l(23652),q=l(74649),H=l(91807);function F(e){return`${e.map(e=>`${e.label}${e.operator}"${e.labelValues.join("|")}"`).join(",")}`}function D(e,t,l){let{data:n}=(0,o.useDatasourceClient)(t),a=e.replace(/(_count|_sum|_bucket)$/,""),{data:r,isLoading:i,error:s}=(0,H.useQuery)({enabled:!!n&&l,queryKey:["metricMetadata",a],queryFn:async()=>await n.metricMetadata({metric:a})});return{metadata:(0,h.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 Q(e,t,l){let{absoluteTimeRange:{start:n,end:a}}=(0,o.useTimeRange)(),{data:r}=(0,o.useDatasourceClient)(l);return(0,H.useQuery)({enabled:!!r,queryKey:["labelValues",e,"datasource",l.name,"start",n,"end","filters",...t],queryFn:async()=>{let l={labelName:e,start:n.valueOf()/1e3,end:a.valueOf()/1e3};return t.length&&(l["match[]"]=[`{${F(t)}}`]),await r.labelValues(l)}})}var N=l(47601);function z(e){let{label:t,...l}=e;return"gauge"===t?(0,n.jsx)(N.A,{label:t,color:"success",...l}):"counter"===t?(0,n.jsx)(N.A,{label:t,color:"primary",...l}):"histogram"===t?(0,n.jsx)(N.A,{label:t,color:"warning",...l}):"summary"===t?(0,n.jsx)(N.A,{label:t,color:"secondary",...l}):(0,n.jsx)(N.A,{label:t,sx:{fontStyle:"unknown"===t?"italic":"initial"},...l})}function U(e){let{children:t,metricName:l,datasource:a,filters:r,isMetadataEnabled:i,onExplore:s}=e,{metadata:o,isLoading:u}=D(l,a,i),c=(0,d.useExplorerQueryParams)({data:{tab:"finder",datasource:a,filters:r,exploredMetric:l}});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(V.A,{style:{width:"300px"},children:(0,n.jsx)(P.A,{sx:{fontFamily:"monospace"},children:t??l})}),(0,n.jsx)(V.A,{style:{width:115,textAlign:"center"},children:i&&u?(0,n.jsx)(R.A,{variant:"rounded",width:75}):(0,n.jsx)(z,{label:(null==o?void 0:o.type)??"unknown"})}),(0,n.jsx)(V.A,{style:{width:"100%"},children:i&&u?(0,n.jsx)(R.A,{variant:"text",width:180}):(0,n.jsx)(P.A,{sx:{fontStyle:(null==o?void 0:o.help)?"initial":"italic",minWidth:"30vw"},children:o?o.help:"unknown"})}),(0,n.jsx)(V.A,{style:{width:140},children:(0,n.jsx)(w.A,{"aria-label":`explore metric ${l}`,variant:"contained",startIcon:(0,n.jsx)(O.default,{}),style:{textWrap:"nowrap"},onClick:()=>null==s?void 0:s(l),component:T.Link,to:`?${c}`,children:"Explore"})})]})}function W(e){let{metricNames:t,filteredResults:l,datasource:a,filters:i,isMetadataEnabled:s,onExplore:o,...d}=e,u=new L,c=(0,h.useMemo)(()=>l||t.map(e=>({original:e})),[l,t]);return(0,n.jsxs)(r.A,{gap:2,width:"100%",divider:(0,n.jsx)($.A,{orientation:"horizontal",flexItem:!0}),...d,children:[(0,n.jsx)(q.Sd,{style:{height:"70vh",width:"100%"},totalCount:c.length,itemContent:e=>(0,n.jsx)(U,{metricName:c[e].original,datasource:a,filters:i,isMetadataEnabled:s,onExplore:o,children:(0,n.jsx)("span",{dangerouslySetInnerHTML:{__html:u.render(c[e].original,c[e].intervals??[],{pre:'<strong style="color:darkorange">',post:"</strong>",escapeHTML:!0})}})})}),(0,n.jsx)(r.A,{sx:{width:"100%"},textAlign:"end",children:(0,n.jsxs)(P.A,{"data-testid":"finder-total",children:["Total: ",(0,n.jsx)("strong",{children:t.length})," metrics"]})})]})}var Z=l(67987),B=l(86742),J=l(5611),K=l(76795),G=l(98029);function Y(e){let{datasource:t,value:l,filters:a,onChange:r,onDelete:i}=e,s=(0,h.useMemo)(()=>a.filter(e=>e.label!==l.label),[a,l.label]),{data:d,isLoading:u}=function(e,t){let{absoluteTimeRange:{start:l,end:n}}=(0,o.useTimeRange)(),{data:a}=(0,o.useDatasourceClient)(t);return(0,H.useQuery)({enabled:!!a,queryKey:["labels","datasource",t.name,"start",l,"end",n,"filters",...e],queryFn:async()=>{let t={start:l.valueOf()/1e3,end:n.valueOf()/1e3};return e.length&&(t["match[]"]=[`{${F(e)}}`]),await a.labelNames(t)}})}(s,t),{data:c,isLoading:x}=Q(l.label,s,t);return(0,n.jsx)(ee,{value:l,labelOptions:(null==d?void 0:d.data)??[],labelValuesOptions:(null==c?void 0:c.data)??[],isLabelOptionsLoading:u,isLabelValuesOptionsLoading:x,onChange:r,onDelete:i})}let X=(0,h.forwardRef)((e,t)=>{let{children:l,...a}=e,r=(0,h.useRef)("500px"),[i,s]=(0,h.useState)(0);return(0,n.jsx)("ul",{style:{overflow:"hidden",padding:"0",height:i?`min(40vh, ${i}px)`:"40vh"},ref:e=>{let l=e?getComputedStyle(e).maxHeight:null;l&&l!==r.current&&(r.current=l),"function"==typeof t&&t(e)},...a,children:(0,n.jsx)(q.aY,{style:{height:r.current,padding:"10px 0"},data:l,totalListHeightChanged:s,itemContent:(e,t)=>(0,h.cloneElement)(t,{index:e,title:t.props.children})})})});function ee(e){let{value:t,labelOptions:l,labelValuesOptions:a,isLabelOptionsLoading:i,isLabelValuesOptionsLoading:s,onChange:o,onDelete:d}=e;return(0,n.jsxs)(r.A,{gap:0,flexDirection:"row",alignItems:"center",children:[(0,n.jsx)(J.A,{freeSolo:!0,disableClearable:!0,options:l??[],value:t.label,sx:{minWidth:200},ListboxComponent:X,loading:i,renderInput:e=>(0,n.jsx)(v.A,{...e,label:"Label Name",variant:"outlined",fullWidth:!0,size:"medium",sx:{"& .MuiOutlinedInput-root":{borderTopRightRadius:0,borderBottomRightRadius:0}}}),onInputChange:(e,l)=>{o({label:l??"",labelValues:t.labelValues,operator:t.operator})}}),(0,n.jsxs)(K.A,{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,n.jsx)(m.A,{value:"=",children:"="}),(0,n.jsx)(m.A,{value:"!=",children:"!="}),(0,n.jsx)(m.A,{value:"=~",children:"=~"}),(0,n.jsx)(m.A,{value:"!~",children:"!~"})]}),(0,n.jsx)(J.A,{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,n.jsx)(v.A,{...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,n.jsxs)(A.A,{position:"end",children:[s?(0,n.jsx)(b.A,{color:"inherit",size:20}):null,(0,n.jsx)(p.A,{"aria-label":"delete label filter",onClick:()=>d(),edge:"end",children:(0,n.jsx)(G.default,{})})]})}}}),onInputChange:(e,l)=>{("="===t.operator||"!="===t.operator)&&o({label:t.label,labelValues:[l],operator:t.operator})},onChange:(e,l)=>{Array.isArray(l)&&o({label:t.label,labelValues:l,operator:t.operator})}})]})}function et(e){let{datasource:t,filters:l,filteredFilters:a,onDatasourceChange:i,onFiltersChange:s,...d}=e,{data:u}=(0,o.useListDatasourceSelectItems)(x.eU);return(0,n.jsxs)(r.A,{...d,direction:"row",alignItems:"center",flexWrap:"wrap",gap:1,sx:{width:"100%"},children:[(0,n.jsx)(Z.A,{sx:{width:500},children:(0,n.jsx)(o.DatasourceSelect,{size:"medium",datasourcePluginKind:x.eU,value:t,onChange:function(e){i((0,o.datasourceSelectValueToSelector)(e,{},u)??{kind:x.eU})},label:"Prometheus Datasource",fullWidth:!0})}),l.map((e,r)=>(0,n.jsx)(Y,{datasource:t,filters:a,value:e,onChange:e=>{let t=[...l];t[r]=e,s(t)},onDelete:()=>{let e=[...l];e.splice(r,1),s(e)}},r)),(0,n.jsx)(w.A,{startIcon:(0,n.jsx)(B.default,{}),"aria-label":"add filter",onClick:()=>{s([...l,{label:"",labelValues:[""],operator:"="}])},children:"Add filter"})]})}X.displayName="ListboxComponent";var el=l(65211),en=l(13915),ea=l(3908),er=l(7800),ei=l(87836);function es(e){let{label:t,valueCounters:l,onFilterAdd:a,...i}=e,[s,o]=(0,h.useState)(!1),[d,u]=(0,h.useState)("="),[c,x]=(0,h.useState)(""),[f,g]=(0,h.useState)(!1),j=(0,C.A)((0,y.A)().breakpoints.down("md")),b=(0,h.useMemo)(()=>f?l:l.slice(0,5),[f,l]);return(0,n.jsxs)(r.A,{sx:{width:"100%"},direction:j?"column":"row",alignItems:"center",gap:2,...i,children:[(0,n.jsxs)(r.A,{sx:{width:"100%",height:"100%"},justifyContent:"space-between",alignContent:"center",direction:j?"column":"row",children:[(0,n.jsx)(P.A,{sx:{fontFamily:"monospace"},pl:+!j,children:t}),(0,n.jsx)(r.A,{direction:"row",gap:1,alignItems:"center",children:s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(K.A,{size:"small",value:d,variant:"outlined",onChange:e=>{u(e.target.value)},children:[(0,n.jsx)(m.A,{value:"=",children:"="}),(0,n.jsx)(m.A,{value:"!=",children:"!="}),(0,n.jsx)(m.A,{value:"=~",children:"=~"}),(0,n.jsx)(m.A,{value:"!~",children:"!~"})]}),(0,n.jsx)(J.A,{freeSolo:!0,limitTags:1,disableClearable:!0,options:l.map(e=>e.labelValue),value:c,ListboxComponent:X,sx:{width:250},renderInput:e=>(0,n.jsx)(v.A,{...e,label:"Value",variant:"outlined",fullWidth:!0,size:"small"}),onInputChange:(e,t)=>{x(t)}}),(0,n.jsx)(p.A,{"aria-label":"confirm",onClick:()=>{a({label:t,labelValues:[c],operator:d}),o(!1)},children:(0,n.jsx)(ea.default,{})}),(0,n.jsx)(p.A,{"aria-label":"cancel",onClick:()=>{o(!1)},children:(0,n.jsx)(er.default,{})})]}):(0,n.jsx)(w.A,{startIcon:(0,n.jsx)(B.default,{}),"aria-label":"add filter",onClick:()=>o(!0),children:"Add filter"})})]}),(0,n.jsxs)(r.A,{sx:{width:"100%"},gap:.5,children:[(0,n.jsxs)(r.A,{direction:"row",gap:.5,children:[(0,n.jsxs)(P.A,{variant:"subtitle1",children:[l.length," values"]}),l.length>5&&(0,n.jsx)(w.A,{variant:"text",size:"small",sx:{padding:0},onClick:()=>g(e=>!e),children:f?"[-]":"[+]"})]}),(0,n.jsx)(r.A,{sx:{overflow:j?"auto":"unset"},children:b.map(e=>(0,n.jsxs)(r.A,{direction:"row",gap:2,children:[(0,n.jsx)(P.A,{sx:{color:e=>e.palette.success.main,fontFamily:"monospace",":hover":{backgroundColor:"rgba(127,127,127,0.35)",cursor:"pointer"},textWrap:j?"nowrap":"unset"},onClick:()=>a({label:t,labelValues:[e.labelValue],operator:"="}),children:e.labelValue}),(0,n.jsxs)(P.A,{sx:{textWrap:"nowrap"},children:["(",e.counter," series)"]})]},`${t}-${e.labelValue}`))}),(0,n.jsx)(r.A,{width:"100%",textAlign:j?"center":"unset",children:f?(0,n.jsx)(w.A,{variant:"text",sx:{width:"fit-content"},onClick:()=>g(!1),children:"Hide full values"}):(0,n.jsx)(n.Fragment,{children:l.length>5&&(0,n.jsxs)(w.A,{variant:"text",sx:{width:"fit-content"},onClick:()=>g(!0),children:["Show ",l.length-5," more values"]})})})]})]},t)}function eo(e){let{labelValueCounters:t,isLoading:l,onFilterAdd:a,...i}=e,s=(0,h.useMemo)(()=>[...t.keys()].sort(),[t]);return l?(0,n.jsx)(r.A,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(b.A,{})}):(0,n.jsxs)(r.A,{sx:{width:"100%"},divider:(0,n.jsx)($.A,{flexItem:!0,orientation:"horizontal"}),gap:2,...i,children:[(0,n.jsxs)(r.A,{gap:2,direction:"row",sx:{width:"100%"},children:[(0,n.jsx)(r.A,{sx:{width:"100%"},children:(0,n.jsx)(P.A,{variant:"h3",children:"Label"})}),(0,n.jsx)(r.A,{sx:{width:"100%"},children:(0,n.jsx)(P.A,{variant:"h3",children:"Values"})})]}),s.map(e=>(0,n.jsx)(es,{label:e,valueCounters:t.get(e)??[],onFilterAdd:a},e))]})}function ed(e){let{metricName:t,datasource:l,filters:a,onFilterAdd:i,...s}=e,{metadata:d,isLoading:u,error:c}=D(t,l),{series:x,labelValueCounters:p,isLoading:f,error:m}=function(e,t,l){let{absoluteTimeRange:{start:n,end:a}}=(0,o.useTimeRange)(),{data:r}=(0,o.useDatasourceClient)(l),{data:i,isLoading:s,isError:d,error:u}=(0,H.useQuery)({enabled:!!r,queryKey:["series",e,"datasource",l,"start",n,"end","filters",...t],queryFn:async()=>{let e={"match[]":[`{${F(t)}}`],start:n.valueOf()/1e3,end:a.valueOf()/1e3};return await r.series(e)}}),c=(0,h.useMemo)(()=>{let e=new Map;if((null==i?void 0:i.data)===void 0)return e;for(let t of i.data)for(let[l,n]of Object.entries(t)){let t=e.get(l);if(void 0===t){e.set(l,[{labelValue:n,counter:1}]);continue}let a=t.find(e=>e.labelValue===n);void 0===a?t.push({labelValue:n,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,l);return(0,n.jsxs)(r.A,{gap:2,...s,children:[(0,n.jsxs)(r.A,{direction:"row",gap:3,mt:1,justifyContent:"space-between",children:[(0,n.jsxs)(r.A,{gap:1,children:[(0,n.jsx)(P.A,{variant:"h1",sx:{fontFamily:"monospace"},children:t}),(0,n.jsx)(P.A,{children:"Description:"}),u?(0,n.jsx)(R.A,{variant:"text",width:180}):(0,n.jsx)(P.A,{style:{fontStyle:(null==d?void 0:d.help)?"initial":"italic"},children:c?"Failed to fetch metadata":(null==d?void 0:d.help)??"unknown"})]}),(0,n.jsxs)(r.A,{gap:1,justifyContent:"center",children:[u?(0,n.jsx)(R.A,{variant:"rounded",width:75}):c?(0,n.jsx)(N.A,{label:"failed to fetch",color:"error",sx:{fontStyle:"italic"}}):(0,n.jsx)(z,{label:(null==d?void 0:d.type)??"unknown"}),(0,n.jsxs)(P.A,{children:["Result:"," ",f?(0,n.jsx)(R.A,{variant:"text",width:20,sx:{display:"inline-block"}}):m?(0,n.jsx)("strong",{children:"failed to fetch series"}):(0,n.jsxs)("strong",{children:[(null==x?void 0:x.length)??"unknown"," series"]})]})]})]}),m?(0,n.jsx)(ei.ErrorAlert,{error:{name:`Failed to fetch series ${(null==m?void 0:m.status)&&`(${m.status})`}`,message:(null==m?void 0:m.message)??"Failed to fetch series"}}):(null==x?void 0:x.length)===0?(0,n.jsx)(r.A,{...s,children:(0,n.jsx)(P.A,{sx:{color:e=>e.palette.warning.main},children:"No series found with current filters."})}):(0,n.jsx)(eo,{labelValueCounters:p,onFilterAdd:i,isLoading:f})]})}var eu=l(54227);function ec(e){let{job:t,filters:l,datasource:a,isMetadataEnabled:i,onExplore:s,...o}=e,d=(0,h.useMemo)(()=>{let e=l.filter(e=>"__name__"!==e.label&&"job"!==e.label);return e.push({label:"job",labelValues:[t],operator:"="}),e},[l,t]),{data:u,isLoading:c}=Q("__name__",d,a);return c?(0,n.jsx)(r.A,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(b.A,{})}):(0,n.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:l,datasource:a,isMetadataEnabled:i,onExplore:s,...o}=e,[d,u]=(0,h.useState)(t[0]??"");return d?(0,n.jsxs)(r.A,{gap:2,...o,children:[t.length>2&&(0,n.jsxs)(Z.A,{fullWidth:!0,children:[(0,n.jsx)(eu.A,{id:"job-select-label",children:"Job"}),(0,n.jsx)(K.A,{labelId:"job-select-label",id:"job-select",label:"Job",variant:"outlined",value:d,onChange:e=>u(e.target.value),children:t.map(e=>(0,n.jsx)(m.A,{value:e,children:e},e))})]}),d&&(0,n.jsx)(ec,{job:d,filters:l,datasource:a,isMetadataEnabled:i,onExplore:s})]}):(0,n.jsx)(P.A,{children:"Something went wrong..."})}function ex(e){let{filters:t,datasource:l,isMetadataEnabled:a,onExplore:i,...s}=e,{data:o,isLoading:d}=Q("job",t,l);return d?(0,n.jsx)(r.A,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(b.A,{})}):(null==o?void 0:o.data)&&0!==o.data.length?(0,n.jsx)(eh,{jobs:o.data,filters:t,datasource:l,isMetadataEnabled:a,onExplore:i,...s}):(0,n.jsx)(r.A,{...s,children:(0,n.jsx)(P.A,{children:"No jobs found"})})}function ep(e){let{filters:t,datasource:l,isMetadataEnabled:a,onExplore:i,...s}=e,o=(0,h.useMemo)(()=>t.filter(e=>"__name__"!==e.label),[t]),{data:d,isLoading:u}=Q("__name__",o,l);return u?(0,n.jsx)(r.A,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(b.A,{})}):(0,n.jsx)(W,{metricNames:(null==d?void 0:d.data)??[],datasource:l,filters:o,isMetadataEnabled:a,onExplore:i,...s})}function ef(e){let{metricName:t,datasource:l,filters:a,type:i,isLoading:s,...d}=e,{width:x,ref:p}=(0,u.default)(),f=(0,o.useSuggestedStepMs)(x),[m,b]=(0,h.useState)(!0),{queries:v,definitions:A}=(0,h.useMemo)(()=>{let e=[{kind:"TimeSeriesQuery",spec:{plugin:{kind:"PrometheusTimeSeriesQuery",spec:{datasource:l,query:"counter"===i||m&&(void 0===i||"summary"===i||"histogram"===i)?`rate({__name__="${t}", ${F(a)}}[5m])`:`{__name__="${t}", ${F(a)}}`}}}}],n=e.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec}));return{queries:e,definitions:n}},[l,a,t,m,i]);return s?(0,n.jsx)(r.A,{...d,children:(0,n.jsx)(R.A,{variant:"rectangular",height:"100%"})}):(0,n.jsxs)(r.A,{ref:p,alignItems:"end",...d,children:[(void 0===i||"summary"===i||"histogram"===i)&&(0,n.jsx)(g.A,{control:(0,n.jsx)(j.A,{size:"small"}),label:"Enable rate",checked:m,onChange:(e,t)=>b(t)}),(0,n.jsx)(o.DataQueriesProvider,{definitions:A,options:{suggestedStepMs:f,mode:"range"},children:(0,n.jsx)(c.Panel,{panelOptions:{hideHeader:!0},definition:{kind:"Panel",spec:{queries:v,display:{name:""},plugin:{kind:"TimeSeriesChart",spec:{}}}}})})]})}function em(e){let{metricName:t,datasource:l,filters:a,isMetadataEnabled:o,isPanelEnabled:d,onExplore:u,onFiltersChange:c,...x}=e,[p,f]=(0,h.useState)(0),{metadata:m,isLoading:g}=D(t,l),j=(0,h.useMemo)(()=>{let e=a.filter(e=>"__name__"!==e.label);return e.push({label:"__name__",labelValues:[t],operator:"="}),e},[a,t]);function b(e,t){null==u||u(e),void 0!==t&&f(t)}return(0,n.jsxs)(r.A,{sx:{width:"100%"},...x,children:[d&&(0,n.jsx)(ef,{metricName:t,filters:a,datasource:l,type:null==m?void 0:m.type,height:"250px",isLoading:o&&g}),(0,n.jsxs)(i.A,{value:p,onChange:(e,t)=>f(t),variant:"scrollable",sx:{borderBottom:1,borderColor:"divider"},children:[(0,n.jsx)(s.A,{label:"Overview"}),(0,n.jsx)(s.A,{label:"Job related metrics",icon:(0,n.jsx)(el.A,{title:"All metrics scraped from the same job",placement:"top",children:(0,n.jsx)(en.default,{})}),iconPosition:"end"}),a.length>0&&(0,n.jsx)(s.A,{label:"Similar metrics",icon:(0,n.jsx)(el.A,{title:"All metrics matching current filters",placement:"top",children:(0,n.jsx)(en.default,{})}),iconPosition:"end"})]}),(0,n.jsxs)(r.A,{gap:1,children:[0===p&&(0,n.jsx)(ed,{metricName:t,datasource:l,filters:j,onFilterAdd:function(e){c([...a,e])}}),1===p&&(0,n.jsx)(ex,{filters:j,datasource:l,isMetadataEnabled:o,onExplore:e=>b(e,0)}),2===p&&(0,n.jsx)(ep,{filters:j,datasource:l,isMetadataEnabled:o,onExplore:e=>b(e,0)})]})]})}let eg="PERSES_METRICS_FINDER_SETTINGS";function ej(e){let{value:t,onChange:l}=e,[a,r]=(0,h.useState)(null);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.A,{"aria-label":"settings",size:"large",onClick:e=>{r(e.currentTarget)},children:(0,n.jsx)(_.default,{})}),(0,n.jsxs)(f.A,{id:"finder-settings-menu",anchorEl:a,open:!!a,onClose:()=>{r(null)},children:[(0,n.jsx)(m.A,{onClick:e=>e.preventDefault(),children:(0,n.jsx)(g.A,{control:(0,n.jsx)(j.A,{}),label:"Enable Metadata",checked:t.isMetadataEnabled,onClick:()=>l({...t,isMetadataEnabled:!t.isMetadataEnabled})})}),(0,n.jsx)(m.A,{onClick:e=>e.preventDefault(),children:(0,n.jsx)(g.A,{control:(0,n.jsx)(j.A,{}),label:"Enable Time Series Chart",checked:t.isPanelEnabled,onClick:()=>l({...t,isPanelEnabled:!t.isPanelEnabled})})})]})]})}function eb(e){let{datasource:t,filters:l,isMetadataEnabled:a,onExplore:i,...s}=e,{data:o,isLoading:d,error:u}=Q("__name__",l,t),[c,x]=(0,h.useState)(""),p=(0,h.useMemo)(()=>new L({includeMatches:!0,excludedChars:[" "]}),[]),f=(0,h.useMemo)(()=>{if(c&&(null==o?void 0:o.data))return p.filter(c,o.data).sort((e,t)=>t.score-e.score)},[o,p,c]);return u?(0,n.jsxs)(r.A,{width:"100%",children:["Error: ",u.message]}):d?(0,n.jsx)(r.A,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(b.A,{})}):(0,n.jsxs)(r.A,{...s,children:[(0,n.jsx)(v.A,{value:c,onChange:e=>x(e.target.value),placeholder:"Search metric name...",slotProps:{input:{startAdornment:(0,n.jsx)(A.A,{position:"start",children:(0,n.jsx)(E.default,{})})}}}),(0,n.jsx)(W,{metricNames:(null==o?void 0:o.data)??[],filteredResults:f,datasource:t,filters:l,isMetadataEnabled:a,onExplore:i})]})}function ev(e){let{value:{datasource:t=I.hu,filters:l=[],exploredMetric:a},onChange:i,onExplore:s,...o}=e,u=localStorage.getItem(eg),[c,x]=(0,h.useState)(u?JSON.parse(u):{isMetadataEnabled:!0}),p=(0,C.A)((0,y.A)().breakpoints.down("md")),f=(0,h.useMemo)(()=>l.filter(e=>{let{label:t,labelValues:l}=e;return t&&(null==l?void 0:l[0])}),[l]),m=(0,d.useExplorerQueryParams)({data:{tab:"finder",datasource:t,filters:l,exploredMetric:void 0}});function g(e){i({datasource:t,filters:e,exploredMetric:a})}return(0,n.jsxs)(r.A,{...o,gap:1,children:[(0,n.jsxs)(r.A,{direction:p?"column":"row",gap:2,justifyContent:"space-between",children:[(0,n.jsx)(et,{datasource:t??I.hu,filters:l??[],filteredFilters:f,onDatasourceChange:function(e){i({datasource:e,filters:l,exploredMetric:a})},onFiltersChange:g}),(0,n.jsxs)(r.A,{direction:"row",gap:1,alignItems:"center",children:[a&&(0,n.jsx)(w.A,{variant:"contained","aria-label":"back to metric explorer",startIcon:(0,n.jsx)(k.default,{}),component:T.Link,to:`?${m}`,children:"Back"}),(0,n.jsx)(r.A,{direction:"row",sx:{width:p?"100%":"unset"},justifyContent:p?"end":"unset",alignItems:"center",children:(0,n.jsx)(ej,{value:c,onChange:function(e){x(e),localStorage.setItem(eg,JSON.stringify(e))}})})]})]}),a?(0,n.jsx)(em,{metricName:a,datasource:t??I.hu,filters:f,isMetadataEnabled:c.isMetadataEnabled,isPanelEnabled:c.isPanelEnabled,onFiltersChange:g,onExplore:s}):(0,n.jsx)(eb,{datasource:t??I.hu,filters:f,isMetadataEnabled:c.isMetadataEnabled,onExplore:s})]})}let eA=["PrometheusTimeSeriesQuery"];function eC(e){let{queries:t}=e,{width:l,ref:r}=(0,u.default)(),i=(0,o.useSuggestedStepMs)(l),s=t.length?t.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec})):[];return(0,n.jsx)(a.A,{ref:r,height:700,children:(0,n.jsx)(o.DataQueriesProvider,{definitions:s,options:{suggestedStepMs:i,mode:"range"},children:(0,n.jsx)(c.Panel,{panelOptions:{hideHeader:!0},definition:{kind:"Panel",spec:{queries:t,display:{name:""},plugin:{kind:"TimeSeriesChart",spec:{}}}}})})})}function ey(e){let{queries:t}=e,l=t.map(e=>({kind:e.spec.plugin.kind,spec:e.spec.plugin.spec}));return(0,n.jsx)(a.A,{height:700,children:(0,n.jsx)(o.DataQueriesProvider,{definitions:l,options:{mode:"instant"},children:(0,n.jsx)(c.Panel,{panelOptions:{hideHeader:!0},definition:{kind:"Panel",spec:{queries:t,display:{name:""},plugin:{kind:"TimeSeriesTable",spec:{}}}}})})})}function ew(){let{data:{tab:e="table",queries:t=[],datasource:l=x.hu,filters:a=[],exploredMetric:u},setData:c}=(0,d.useExplorerManagerContext)(),[p,f]=(0,h.useState)(t);return(0,n.jsxs)(r.A,{gap:2,sx:{width:"100%"},children:[(0,n.jsxs)(i.A,{value:e,onChange:(e,l)=>c({tab:l,queries:t}),variant:"scrollable",sx:{borderBottom:1,borderColor:"divider"},children:[(0,n.jsx)(s.A,{value:"table",label:"Table"}),(0,n.jsx)(s.A,{value:"graph",label:"Graph"}),(0,n.jsx)(s.A,{value:"finder",label:"Finder"})]}),(0,n.jsxs)(r.A,{gap:1,children:["table"===e&&(0,n.jsxs)(r.A,{children:[(0,n.jsx)(o.MultiQueryEditor,{queryTypes:["TimeSeriesQuery"],onChange:e=>f(e),queries:p,onQueryRun:()=>c({tab:e,queries:p}),filteredQueryPlugins:eA}),(0,n.jsx)(ey,{queries:t})]}),"graph"===e&&(0,n.jsxs)(r.A,{children:[(0,n.jsx)(o.MultiQueryEditor,{queryTypes:["TimeSeriesQuery"],onChange:e=>f(e),queries:p,onQueryRun:()=>c({tab:e,queries:p}),filteredQueryPlugins:eA}),(0,n.jsx)(eC,{queries:t})]}),"finder"===e&&(0,n.jsx)(r.A,{children:(0,n.jsx)(ev,{onChange:t=>c({tab:e,...t}),value:{datasource:l,filters:a,exploredMetric:u}})})]})]})}},3412(e,t,l){function n(e){let[t,l]=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}(l)]}l.d(t,{OM:()=>h,l3:()=>u,Vx:()=>c,eU:()=>j.eU,_H:()=>o,z:()=>y,Ul:()=>x,bZ:()=>s,ZO:()=>j.ZO,mA:()=>p,gM:()=>d,lS:()=>n,hu:()=>j.hu,LY:()=>A,$c:()=>i,kG:()=>C,do:()=>j.do});var a=l(37856);function r(e,t){let l=t||new URLSearchParams;e&&Object.entries(e).forEach(e=>{let[n,a]=e;null!=t&&t.has(n)||(Array.isArray(a)?a.forEach(e=>l.append(n,e)):l.set(n,a))});let n=l.toString();return""!==n?`?${n}`:""}function i(e,t){if(e||t)return{...e,...t}}function s(e){return async()=>{let t=`${e.datasourceUrl}/-/healthy${r(e.queryParams)}`;try{let l=await (0,a.hd)(t,{headers:e.headers,signal:e.signal});return 200===l.status}catch{return!1}}}function o(e,t){return m("/api/v1/query",e,t)}function d(e,t){return m("/api/v1/query_range",e,t)}function u(e,t){return m("/api/v1/labels",e,t)}function c(e,t){let{labelName:l,...n}=e;return 0===l.length?new Promise(e=>{e({data:[]})}):f(`/api/v1/label/${encodeURIComponent(l)}/values`,n,t)}function h(e,t){return f("/api/v1/metadata",e,t)}function x(e,t){return m("/api/v1/series",e,t)}function p(e,t){return m("/api/v1/parse_query",e,t)}function f(e,t,l){let{datasourceUrl:n,headers:i,queryParams:s,signal:o}=l,d=`${n}${e}${r(s,g(t))}`;return(0,a.x6)(d,{method:"GET",headers:i,signal:o})}function m(e,t,l){let{datasourceUrl:n,headers:i,signal:s,queryParams:o}=l,d=`${n}${e}${r(o)}`,u={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",...i},signal:s,body:g(t)};return(0,a.x6)(d,u)}function g(e){let t=new URLSearchParams;for(let l in e){let n=e[l];if(void 0!==n){if("string"==typeof n){t.append(l,n);continue}if("number"==typeof n){t.append(l,n.toString());continue}for(let e of n)t.append(l,e)}}return t}var j=l(24381),b=l(69791),v=l(94461);function A(e){let{start:t,end:l}=e;return{start:Math.ceil((0,v.getUnixTime)(t)),end:Math.ceil((0,v.getUnixTime)(l))}}function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=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(n/1e3*l,t,a)}function y(e){if(!e)return;let t=(0,b.pW)(e);return Math.floor((0,v.milliseconds)(t)/1e3)}},24381(e,t,l){l.d(t,{ZO:()=>s,do:()=>i,eU:()=>a,hu:()=>r});var n=l(47414);let a="PrometheusDatasource",r={kind:a};function i(e){return!(0,n.isVariableDatasource)(e)&&void 0===e.name}function s(e){return(0,n.isVariableDatasource)(e)||e.kind===a}}}]);