"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7004],{56649:(Al,Ve,s)=>{s.r(Ve),s.d(Ve,{plugin:()=>vl});var Ct=s(9306),e=s(65237);const wt=[{title:"Request Rate",expression:"rate(http_request_total[5m])",label:"Given an HTTP request counter, this query calculates the per-second average request rate over the last 5 minutes."},{title:"95th Percentile of Request Latencies",expression:"histogram_quantile(0.95, sum(rate(prometheus_http_request_duration_seconds_bucket[5m])) by (le))",label:"Calculates the 95th percentile of HTTP request rate over 5 minute windows."},{title:"Alerts Firing",expression:'sort_desc(sum(sum_over_time(ALERTS{alertstate="firing"}[24h])) by (alertname))',label:"Sums up the alerts that have been firing over the last 24 hours."},{title:"Step",label:"Defines the graph resolution using a duration format (15s, 1m, 3h, ...). Small steps create high-resolution graphs but can be slow over larger time ranges. Using a longer step lowers the resolution and smooths the graph by producing fewer datapoints. If no step is given the resolution is calculated automatically."}],Nt=a=>e.createElement("div",null,e.createElement("h2",null,"PromQL Cheat Sheet"),wt.map((t,l)=>e.createElement("div",{className:"cheat-sheet-item",key:l},e.createElement("div",{className:"cheat-sheet-item__title"},t.title),t.expression?e.createElement("button",{type:"button",className:"cheat-sheet-item__example",onClick:n=>a.onClickExample({refId:"A",expr:t.expression})},e.createElement("code",null,t.expression)):null,e.createElement("div",{className:"cheat-sheet-item__label"},t.label))));var q=s(71534),se=s(89949),Re=s(81859),oe=s(92917),w=s(66917),Ee=s(28704),Pt=s(22324),k=s(48389),m=s(60234),_=s(93048),ke=s(90931),Tt=s(60822),It=s(31311),R=s(9140),ye=s(60631),xe=s(7642),Se=s(35560);const Mt=a=>{const{pattern:t,onPatternSelect:l,hasNewQueryOption:n,hasPreviousQuery:r,selectedPatternName:o,setSelectedPatternName:i}=a,p=(0,_.wW)(Dt),g={grammar:Se.ZP,name:"promql"};return e.createElement(ye.Z,{className:p.card},e.createElement(ye.Z.Heading,null,t.name),e.createElement("div",{className:p.rawQueryContainer},e.createElement(xe.U,{"aria-label":`${t.name} raw query`,query:R.Z.renderQuery({labels:[],operations:t.operations,binaryQueries:t.binaryQueries}),lang:g,className:p.rawQuery})),e.createElement(ye.Z.Actions,null,o!==t.name?e.createElement(k.zx,{size:"sm","aria-label":"use this query button",onClick:()=>{r?i(t.name):l(t)}},"Use this query"):e.createElement(e.Fragment,null,e.createElement("div",{className:p.spacing},`If you would like to use this query, ${n?"you can either apply this query pattern or create a new query":"this query pattern will be applied to your current query"}.`),e.createElement(k.zx,{size:"sm","aria-label":"back button",fill:"outline",onClick:()=>i(null)},"Back"),e.createElement(k.zx,{size:"sm","aria-label":"apply query starter button",onClick:()=>{l(t)}},"Apply query"),n&&e.createElement(k.zx,{size:"sm","aria-label":"create new query button",onClick:()=>{l(t,!0)}},"Create new query"))))},Dt=a=>({card:m.css`
      width: 49.5%;
      display: flex;
      flex-direction: column;
    `,rawQueryContainer:m.css`
      flex-grow: 1;
    `,rawQuery:m.css`
      background-color: ${a.colors.background.primary};
      padding: ${a.spacing(1)};
      margin-top: ${a.spacing(1)};
    `,spacing:m.css`
      margin-bottom: ${a.spacing(1)};
    `});var me=s(14253),Lt=s(30693);const zt=a=>{const{isOpen:t,onClose:l,onChange:n,onAddQuery:r,query:o,queries:i,app:p}=a,[g,v]=(0,e.useState)([]),[d,y]=(0,e.useState)(null),C=(0,_.wW)(At),E=!!r,L=(0,e.useMemo)(()=>{const h=(0,me._)(o.expr),S=h.query.operations.length>0,I=h.query.metric,B=h.query.labels.length>0,j=h.query.binaryQueries?h.query.binaryQueries.length>0:!1;return S||I||B||j},[o.expr]),u=(h,S=!1)=>{const I=(0,me._)(S?"":o.expr);(0,Ee.ff)("grafana_prom_kickstart_your_query_selected",{app:p??"",editorMode:o.editorMode,selectedPattern:h.name,preSelectedOperationsCount:I.query.operations.length,preSelectedLabelsCount:I.query.labels.length,createNewQuery:E&&S}),I.query.operations=h.operations,I.query.binaryQueries=h.binaryQueries,E&&S?r({...o,refId:(0,It.Hs)(i??[o]),expr:R.Z.renderQuery(I.query)}):n({...o,expr:R.Z.renderQuery(I.query)}),y(null),l()};return e.createElement(ke.u,{"aria-label":"Kick start your query modal",isOpen:t,title:"Kick start your query",onDismiss:l},e.createElement("div",{className:C.spacing},"Kick start your query by selecting one of these queries. You can then continue to complete your query."),Object.values(Lt.Fz).map(h=>e.createElement(Tt.U,{"aria-label":`open and close ${h} query starter card`,key:h,label:`${(0,se.capitalize)(h)} query starters`,isOpen:g.includes(h),collapsible:!0,onToggle:()=>v(S=>S.includes(h)?S.filter(I=>I!==h):[...S,h])},e.createElement("div",{className:C.cardsContainer},R.Z.getQueryPatterns().filter(S=>S.type===h).map(S=>e.createElement(Mt,{key:S.name,pattern:S,hasNewQueryOption:E,hasPreviousQuery:L,onPatternSelect:u,selectedPatternName:d,setSelectedPatternName:y}))))),e.createElement(k.zx,{"aria-label":"close kick start your query modal",variant:"secondary",onClick:l},"Close"))},At=a=>({cardsContainer:m.css`
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: space-between;
    `,spacing:m.css`
      margin-bottom: ${a.spacing(1)};
    `});var Ft=s(67265),Qt=s(31379),je=s(57282),U=s(54444),$e=s(81453),F=s(57625);const Be="PrometheusQueryEditorModeDefault";function We(a,t,l){a.expr===""&&$e.Z.set(Be,t),l({...a,editorMode:t})}function Xt(a,t=U.c.Builder){if(a!=null&&a!=="")return U.c.Code;const l=$e.Z.get(Be);switch(l){case U.c.Builder:case U.c.Code:return l;default:return t}}function Ot(a,t,l){let n=a;a.editorMode||(n={...a,editorMode:Xt(a.expr,l)}),a.expr==null&&(n={...n,expr:"",legendFormat:F.pD.Auto}),a.range==null&&a.instant==null&&(n={...n,range:!0},t===q.zj.Explore&&(n.instant=!0));const r=a.instant&&a.range;return t===q.zj.UnifiedAlerting&&r&&(n={...n,instant:!1,range:!0}),n}var Vt=s(34099),H=s(49784),Rt=s(69784),Ce=s(9111),kt=s(30130),jt=s(59440),$t=s(43153),Bt=s(72106),Wt=s(13231),we=s(99066),Ut=s(56027),Ne=s.n(Ut),ie=s(10933),O=s(94795),Ht=s(34914),Gt=s.n(Ht);const Ue=" ",ee=1e3;function Zt({datasource:a,query:t,onChange:l,onGetMetrics:n,labelsFilters:r,metricLookupDisabled:o}){const i=(0,_.wW)(Kt),[p,g]=(0,e.useState)({}),v=(0,e.useCallback)((u,h)=>{const S=u.label??u.value;return S?S.toLowerCase?h.split(Ue).reduce((B,j)=>B&&S.toLowerCase().includes(j.toLowerCase()),!0):!0:!1},[]),d=(0,e.useCallback)((u,h)=>u.__isNew__?u.label:e.createElement(Gt(),{searchWords:h.inputValue.split(Ue),textToHighlight:u.label??"",highlightClassName:i.highlight}),[i.highlight]),y=(u,h)=>{const S=(0,we.Vl)(u);return Jt(S,h)},C=u=>a.metricFindQuery(y(u,r)).then(S=>(S.length>ee&&S.splice(0,S.length-ee),S.map(I=>({label:I.text,value:I.text})))),E=()=>Promise.resolve([]),L=Ne()(u=>C(u),a.getDebounceTimeInMilliseconds());return e.createElement(w.EditorFieldGroup,null,e.createElement(w.EditorField,{label:"Metric"},e.createElement(O.qb,{inputId:"prometheus-metric-select",className:i.select,value:t.metric?(0,ie.E)(t.metric):void 0,placeholder:"Select metric",allowCustomValue:!0,formatOptionLabel:d,filterOption:v,onOpenMenu:async()=>{if(o)return;g({isLoading:!0});const u=await n();u.length>ee&&u.splice(0,u.length-ee),g({metrics:u,isLoading:void 0})},loadOptions:o?E:L,isLoading:p.isLoading,defaultOptions:p.metrics,onChange:({value:u})=>{u&&l({...t,metric:u})}})))}const Kt=a=>({select:m.css`
    min-width: 125px;
  `,highlight:m.css`
    label: select__match-highlight;
    background: inherit;
    padding: inherit;
    color: ${a.colors.warning.contrastText};
    background-color: ${a.colors.warning.main};
  `}),Jt=(a,t)=>{const l=t?Yt(t):[];return`label_values({__name__=~".*${a}"${l?l.join(""):""}},__name__)`},Yt=a=>a.map(t=>`,${t.label}="${t.value}"`);function qt({item:a,defaultOp:t,onChange:l,onDelete:n,onGetLabelNames:r,onGetLabelValues:o,invalidLabel:i,invalidValue:p,getLabelValuesAutofillSuggestions:g,debounceDuration:v}){const[d,y]=(0,e.useState)({}),C=(u=a.op)=>He.find(h=>h.label===u)?.isMultiValue,E=u=>u?u.indexOf("|")>0?u.split("|"):[u]:[],L=Ne()(u=>g(u,a.label),v);return e.createElement("div",{"data-testid":"prometheus-dimensions-filter-item"},e.createElement(w.InputGroup,null,e.createElement(O.Ph,{placeholder:"Select label","aria-label":oe.wl.components.QueryBuilder.labelSelect,inputId:"prometheus-dimensions-filter-item-key",width:"auto",value:a.label?(0,ie.E)(a.label):null,allowCustomValue:!0,onOpenMenu:async()=>{y({isLoadingLabelNames:!0});const u=await r(a);y({labelNames:u,isLoadingLabelNames:void 0})},isLoading:d.isLoadingLabelNames??!1,options:d.labelNames,onChange:u=>{u.label&&l({...a,op:a.op??t,label:u.label})},invalid:i}),e.createElement(O.Ph,{"aria-label":oe.wl.components.QueryBuilder.matchOperatorSelect,className:"query-segment-operator",value:(0,ie.E)(a.op??t),options:He,width:"auto",onChange:u=>{u.value!=null&&l({...a,op:u.value,value:C(u.value)?a.value:E(a?.value)[0]})}}),e.createElement(O.qb,{placeholder:"Select value","aria-label":oe.wl.components.QueryBuilder.valueSelect,inputId:"prometheus-dimensions-filter-item-value",width:"auto",value:C()?E(a?.value).map(ie.E):E(a?.value).map(ie.E)[0],allowCustomValue:!0,onOpenMenu:async()=>{y({isLoadingLabelValues:!0});const u=await o(a);u.length>ee&&u.splice(0,u.length-ee),y({...d,labelValues:u,isLoadingLabelValues:void 0})},defaultOptions:d.labelValues,isMulti:C(),isLoading:d.isLoadingLabelValues,loadOptions:L,onChange:u=>{if(u.value)l({...a,value:u.value,op:a.op??t});else{const h=u.map(S=>S.label).join("|");l({...a,value:h,op:a.op??t})}},invalid:p}),e.createElement(w.AccessoryButton,{"aria-label":"remove",icon:"times",variant:"secondary",onClick:n})))}const He=[{label:"=",value:"=",isMultiValue:!1},{label:"!=",value:"!=",isMultiValue:!1},{label:"<",value:"<",isMultiValue:!1},{label:">",value:">",isMultiValue:!1},{label:"=~",value:"=~",isMultiValue:!0},{label:"!~",value:"!~",isMultiValue:!0}],_t="Select at least 1 label filter (label and value)";function ea({labelsFilters:a,onChange:t,onGetLabelNames:l,onGetLabelValues:n,labelFilterRequired:r,getLabelValuesAutofillSuggestions:o,debounceDuration:i}){const p="=",[g,v]=(0,e.useState)([{op:p}]);(0,e.useEffect)(()=>{a.length>0?v(a):v([{op:p}])},[a]);const d=C=>{v(C);const E=C.filter(L=>L.label!=null&&L.value!=null);(0,se.isEqual)(E,a)||t(E)},y=g.some(C=>C.label&&C.value);return e.createElement(w.EditorFieldGroup,null,e.createElement(w.EditorField,{label:"Label filters",error:_t,invalid:r&&!y},e.createElement(w.EditorList,{items:g,onChange:d,renderItem:(C,E,L)=>e.createElement(qt,{debounceDuration:i,item:C,defaultOp:p,onChange:E,onDelete:L,onGetLabelNames:l,onGetLabelValues:n,invalidLabel:r&&!C.label,invalidValue:r&&!C.value,getLabelValuesAutofillSuggestions:o})})))}var ta=s(1419),aa=s(51215),ce=s(96682),ne=s(57313),la=s(44380),G=s(1163),na=s(6335);function ra({feedbackUrl:a}){const t=(0,_.wW)(sa);return e.createElement(w.Stack,{gap:1},e.createElement("a",{href:a,className:t.link,title:"The Metric Encyclopedia is new, please let us know how we can improve it",target:"_blank",rel:"noreferrer noopener"},e.createElement(na.J,{name:"comment-alt-message"})," Give feedback"))}function sa(a){return{link:(0,m.css)({color:a.colors.text.secondary,fontSize:a.typography.bodySmall.fontSize,":hover":{color:a.colors.text.link}})}}const oa=[{value:"counter",description:"A cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero on restart."},{value:"gauge",description:"A metric that represents a single numerical value that can arbitrarily go up and down."},{value:"histogram",description:"A histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets."},{value:"summary",description:"A summary samples observations (usually things like request durations and response sizes) and can calculate configurable quantiles over a sliding time window."}],ue={browse:"Search metrics by name",metadataSearchSwitch:"Search by metadata type and description in addition to name",type:"Select...",variables:"Select...",excludeNoMetadata:"Exclude results with no metadata",setUseBackend:"Use the backend to browse metrics"},ia=10,ca=new ta.Z({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1});function ua(a,t,l){const n=ca.filter(a,t);n&&l(n)}const Ge=(0,se.debounce)(ua,300),da=a=>{const{datasource:t,isOpen:l,onClose:n,onChange:r,query:o}=a,[i,p]=(0,e.useState)([]),[g,v]=(0,e.useState)(!0),[d,y]=(0,e.useState)([]),[C,E]=(0,e.useState)(!0),[L,u]=(0,e.useState)([]),[h,S]=(0,e.useState)([]),[I,B]=(0,e.useState)(ia),[j,M]=(0,e.useState)(1),[f,b]=(0,e.useState)(""),[Q,X]=(0,e.useState)([]),[D,A]=(0,e.useState)([]),[$,K]=(0,e.useState)(!1),[V,fl]=(0,e.useState)(!1),[pe,bl]=(0,e.useState)([]),[de,bt]=(0,e.useState)(null),[El,yl]=(0,e.useState)(0),[Et,Fe]=(0,e.useState)(),[J,xl]=(0,e.useState)(!1),[yt,Sl]=(0,e.useState)(!1),be=(0,e.useCallback)(async()=>{v(!0),t.languageProvider.metricsMetadata||await t.languageProvider.loadMetricsMetadata(),t.languageProvider.metricsMetadata||(E(!1),t.languageProvider.metricsMetadata={});let c;if(o.labels.length>0){const z=R.Z.renderLabels(o.labels);c=(await t.languageProvider.getSeries(z,!0)).__name__??[]}else c=await t.languageProvider.getLabelValues("__name__")??[];let x=[],T=[],P=c.map(z=>{const W=(0,Ce.nW)(z,t.languageProvider.metricsMetadata),Y=(0,Ce.ws)(z,t.languageProvider.metricsMetadata);return x.push(`${z} ${W} ${Y}`),T.push(z),{value:z,type:W,description:Y}});y(P),u(x),S(T),p(t.getVariables().map(z=>({value:z,label:z}))),yl(P.length),Fe(P.length),v(!1)},[o,t]);(0,e.useEffect)(()=>{be()},[be]);const Cl=(0,_.l4)(),N=pa(Cl,yt),wl=oa.map(c=>({value:c.value,label:c.value,description:c.description}));function Nl(c,x){if(!c.length)return[];const T=x===0?1:x,P=Math.floor(Qe(c).length/T)+1;return[...Array(P).keys()].map(z=>z+1)}function Pl(c,x,T){const P=T===0?1:T,z=x===1?0:(x-1)*P,W=z+P;return c.slice(z,W)}function Tl(){return pe.length>0}function Qe(c,x){let T=c;return f&&(T=T.filter((P,z)=>J?!0:$?Q.includes(z):D.includes(z))),de&&!x&&(T=T.filter((P,z)=>[de,de.toLowerCase()].includes(P.value[0]))),pe.length>0&&!J&&(T=T.filter((P,z)=>{const W=pe.some(Oe=>Oe.value===P.type),Y=!P.type;return W||Y&&!V})),V&&(T=T.filter(P=>P.type!==void 0&&P.description!==void 0)),T}function Il(c){const x=Qe(c).sort(ma(!0,Tl()));return Et!==x.length&&x.length!==0&&Fe(x.length),Pl(x,j,I)}const xt=(0,e.useMemo)(()=>Ne()(async c=>{v(!0);const x=(0,we.Vl)(c),T=o.labels.map(Y=>`,${Y.label}="${Y.value}"`),P=`label_values({__name__=~".*${x}"${o.labels?T.join():""}},__name__)`,W=await t.metricFindQuery(P).then(Y=>Y.map(Oe=>({value:Oe.text})));y(W),Fe(W.length),v(!1)},t.getDebounceTimeInMilliseconds()),[t,o.labels]);function Ml(){const c={A:0,B:0,C:0,D:0,E:0,F:0,G:0,H:0,I:0,J:0,K:0,L:0,M:0,N:0,O:0,P:0,Q:0,R:0,S:0,T:0,U:0,V:0,W:0,X:0,Y:0,Z:0};return Qe(d,!0).forEach((x,T)=>{const P=x.value[0].toUpperCase();ha.includes(P)&&!c[P]&&(c[P]+=1)}),Object.keys(c).map(x=>{const T=c[x]>0;function P(){bt(de===x?null:x),M(1)}const z=de===x?N.selAlpha:"",W=T?N.active:N.gray;return e.createElement("span",{onClick:T?P:()=>{},className:`${z} ${W}`,key:x,"data-testid":"letter-"+x},x+" ")})}const Xe=1e3,Dl=c=>c<1?1:c>Xe?Xe:c??10,Ll=({row:{original:{value:c}}})=>e.createElement(k.zx,{size:"sm",variant:"secondary",fill:"solid","aria-label":"use this metric button","data-testid":te.useMetric,onClick:()=>{r({...o,metric:c}),(0,Ee.ff)("grafana_prom_metric_encycopedia_tracking",{metric:c,hasVariables:i.length>0,hasMetadata:C,totalMetricCount:d.length,fuzzySearchQuery:f,fullMetaSearch:$,selectedTypes:pe,letterSearch:de}),n()}},"Use this metric");function zl(c){const x=c,T=[{id:"",header:"Select",cell:Ll},{id:"value",header:"Name"},{id:"type",header:"Type"},{id:"description",header:"Description"}];return e.createElement(aa.e,{className:N.table,columns:T,data:x,getRowId:P=>P.value})}function St(c,x){J&&c===""?be():J?xt(c):x?Ge(L,c,X):Ge(h,c,A)}return e.createElement(ke.u,{"data-testid":te.metricModal,isOpen:l,title:"Browse metrics",onDismiss:n,"aria-label":"Metric Encyclopedia",className:N.modal},e.createElement("div",{className:N.inputWrapper},e.createElement("div",{className:(0,m.cx)(N.inputItem,N.inputItemFirst)},e.createElement(w.EditorField,{label:"Search metrics"},e.createElement(ce.I,{"data-testid":te.searchMetric,placeholder:ue.browse,value:f,onInput:c=>{const x=c.currentTarget.value??"";b(x),St(x,$),M(1)}}))),e.createElement("div",{className:N.inputItem},e.createElement(w.EditorField,{label:"Filter by type"},e.createElement(O.NU,{"data-testid":te.selectType,inputId:"my-select",options:wl,value:pe,disabled:!C||J,placeholder:ue.type,onChange:c=>{bl(c),M(1)}}))),e.createElement("div",{className:N.inputItem},e.createElement(w.EditorField,{label:"Select template variables"},e.createElement(O.Ph,{inputId:"my-select",options:i,value:"",placeholder:ue.variables,onChange:c=>{const x=c.value??"";r({...o,metric:x}),n()}})))),e.createElement("div",{className:N.selectWrapper},e.createElement(w.EditorField,{label:"Search Settings"},e.createElement(e.Fragment,null,e.createElement("div",{className:N.selectItem},e.createElement(ne.r,{"data-testid":te.searchWithMetadata,value:$,disabled:J||!C,onChange:()=>{const c=!$;K(c),St(f,c),M(1)}}),e.createElement("p",{className:N.selectItemLabel},ue.metadataSearchSwitch)),e.createElement("div",{className:N.selectItem},e.createElement(ne.r,{"data-testid":te.setUseBackend,value:J,onChange:()=>{const c=!J;xl(c),c===!1?be():f!==""&&xt(f),M(1)}}),e.createElement("p",{className:N.selectItemLabel},ue.setUseBackend))))),e.createElement("h4",{className:N.resultsHeading},"Results"),e.createElement("div",{className:N.resultsData},e.createElement("div",{className:N.resultsDataCount},"Showing ",Et," of ",El," total metrics."," ",g&&e.createElement(la.$,{className:N.loadingSpinner})),o.labels.length>0&&e.createElement("p",{className:N.resultsDataFiltered},"These metrics have been pre-filtered by labels chosen in the label filters.")),e.createElement("div",{className:N.alphabetRow},e.createElement("div",null,Ml()),e.createElement("div",{className:N.alphabetRowToggles},e.createElement("div",{className:N.selectItem},e.createElement(ne.r,{value:yt,onChange:()=>Sl(c=>!c)}),e.createElement("p",{className:N.selectItemLabel},"Disable text wrap")),e.createElement("div",{className:N.selectItem},e.createElement(ne.r,{value:V,disabled:J||!C,onChange:()=>{fl(!V),M(1)}}),e.createElement("p",{className:N.selectItemLabel},ue.excludeNoMetadata)))),e.createElement("div",{className:N.results},d&&zl(Il(d))),e.createElement("div",{className:N.pageSettingsWrapper},e.createElement("div",{className:N.pageSettings},e.createElement(G._,{label:"Select page",labelWidth:20,className:"query-keyword"},e.createElement(O.Ph,{"data-testid":te.searchPage,options:Nl(d,I).map(c=>({value:c,label:""+c})),value:j??1,placeholder:"select page",width:20,onChange:c=>{const x=c.value??1;M(x)}})),e.createElement(G._,{label:"# results per page",tooltip:"The maximum results per page is "+Xe,labelWidth:20},e.createElement(ce.I,{"data-testid":te.resultsPerPage,value:Dl(I),placeholder:"results per page",width:20,onInput:c=>{const x=+c.currentTarget.value;isNaN(x)||B(x)}}))),e.createElement(ra,{feedbackUrl:"https://forms.gle/DEMAJHoAMpe3e54CA"})))};function ma(a,t){return function(l,n){if(l.value===n.value)return 0;if(t){if(l.type===void 0)return 1;if(n.type===void 0)return-1}return a?l.value<n.value?-1:1:l.value<n.value?1:-1}}const pa=(a,t)=>({modal:m.css`
      width: 85vw;
      ${a.breakpoints.down("md")} {
        width: 100%;
      }
    `,inputWrapper:m.css`
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      gap: ${a.spacing(2)};
      margin-bottom: ${a.spacing(2)};
    `,inputItemFirst:m.css`
      flex-basis: 40%;
    `,inputItem:m.css`
      flex-grow: 1;
      flex-basis: 20%;
      ${a.breakpoints.down("md")} {
        min-width: 100%;
      }
    `,selectWrapper:m.css`
      margin-bottom: ${a.spacing(2)};
    `,selectItem:m.css`
      display: flex;
      flex-direction: row;
      align-items: center;
    `,selectItemLabel:m.css`
      margin: 0 0 0 ${a.spacing(1)};
      align-self: center;
      color: ${a.colors.text.secondary};
    `,resultsHeading:m.css`
      margin: 0 0 0 0;
    `,resultsData:m.css`
      margin: 0 0 ${a.spacing(1)} 0;
    `,resultsDataCount:m.css`
      margin: 0;
    `,resultsDataFiltered:m.css`
      margin: 0;
      color: ${a.colors.warning.main};
    `,alphabetRow:m.css`
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      column-gap: ${a.spacing(1)};
      margin-bottom: ${a.spacing(1)};
    `,alphabetRowToggles:m.css`
      display: flex;
      flex-direction: row;
      align-items: center;
      flex-wrap: wrap;
      column-gap: ${a.spacing(1)};
    `,results:m.css`
      height: 300px;
      overflow-y: scroll;
    `,pageSettingsWrapper:m.css`
      padding-top: ${a.spacing(1.5)};
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
    `,pageSettings:m.css`
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      align-items: center;
    `,selAlpha:m.css`
      cursor: pointer;
      color: #6e9fff;
    `,active:m.css`
      cursor: pointer;
    `,gray:m.css`
      color: grey;
    `,loadingSpinner:m.css`
      display: inline-block;
    `,table:m.css`
      white-space: ${t?"nowrap":"normal"};
      td {
        vertical-align: baseline;
      }
    `}),te={metricModal:"metric-modal",searchMetric:"search-metric",searchWithMetadata:"search-with-metadata",selectType:"select-type",metricCard:"metric-card",useMetric:"use-metric",searchPage:"search-page",resultsPerPage:"results-per-page",setUseBackend:"set-use-backend"},ha=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];var Pe=s(43326),Ze=s(67262),ga=s(43735);const Ke=e.memo(a=>{const{nestedQuery:t,index:l,datasource:n,onChange:r,onRemove:o,onRunQuery:i,showExplain:p}=a,g=(0,_.wW)(fa);return e.createElement("div",{className:g.card},e.createElement("div",{className:g.header},e.createElement("div",{className:g.name},"Operator"),e.createElement(O.Ph,{width:"auto",options:va,value:(0,ie.E)(t.operator),onChange:v=>{r(l,{...t,operator:v.value})}}),e.createElement("div",{className:g.name},"Vector matches"),e.createElement("div",{className:g.vectorMatchWrapper},e.createElement(O.Ph,{width:"auto",value:t.vectorMatchesType||"on",allowCustomValue:!0,options:[{value:"on",label:"on"},{value:"ignoring",label:"ignoring"}],onChange:v=>{r(l,{...t,vectorMatchesType:v.value})}}),e.createElement(Pe.H,{className:g.vectorMatchInput,minWidth:20,defaultValue:t.vectorMatches,onCommitChange:v=>{r(l,{...t,vectorMatches:v.currentTarget.value,vectorMatchesType:t.vectorMatchesType||"on"})}})),e.createElement(w.FlexItem,{grow:1}),e.createElement(Ze.h,{name:"times",size:"sm",onClick:()=>o(l)})),e.createElement("div",{className:g.body},e.createElement(w.EditorRows,null,e.createElement(Te,{showExplain:p,query:t.query,datasource:n,onRunQuery:i,onChange:v=>{r(l,{...t,query:v})}}))))}),va=ga.iQ.map(a=>({label:a.sign,value:a.sign}));Ke.displayName="NestedQuery";const fa=a=>({card:(0,m.css)({label:"card",display:"flex",flexDirection:"column",gap:a.spacing(.5)}),header:(0,m.css)({label:"header",padding:a.spacing(.5,.5,.5,1),gap:a.spacing(1),display:"flex",alignItems:"center"}),name:(0,m.css)({label:"name",whiteSpace:"nowrap"}),body:(0,m.css)({label:"body",paddingLeft:a.spacing(2)}),vectorMatchInput:(0,m.css)({label:"vectorMatchInput",marginLeft:-1}),vectorMatchWrapper:(0,m.css)({label:"vectorMatchWrapper",display:"flex"})});function ba(a){const{query:t,datasource:l,onChange:n,onRunQuery:r,showExplain:o}=a,i=t.binaryQueries??[],p=(v,d)=>{const y=[...i];y.splice(v,1,d),n({...t,binaryQueries:y})},g=v=>{const d=[...i.slice(0,v),...i.slice(v+1)];n({...t,binaryQueries:d})};return e.createElement(w.Stack,{direction:"column",gap:1},i.map((v,d)=>e.createElement(Ke,{key:d.toString(),nestedQuery:v,index:d,onChange:p,datasource:l,onRemove:g,onRunQuery:r,showExplain:o})))}var Ea=s(91182);const Te=e.memo(a=>{const{datasource:t,query:l,onChange:n,onRunQuery:r,data:o,showExplain:i}=a,[p,g]=(0,e.useState)(),[v,d]=(0,e.useState)(!1),y=b=>{n({...l,labels:b})},C=(0,_.wW)(xa),E=(0,e.useCallback)(async b=>{const Q=t.getVariables(),X=await b;return[...Q.map(D=>({label:D,value:D})),...X.map(D=>({label:D.value,value:D.value,title:D.description}))]},[t]),L=async b=>{if(!l.metric)return await t.languageProvider.fetchLabels(),t.languageProvider.getLabelKeys().map(A=>({value:A}));const Q=l.labels.filter(A=>A!==b);Q.push({label:"__name__",op:"=",value:l.metric});const X=R.Z.renderLabels(Q);let D;return t.hasLabelsMatchAPISupport()?D=await t.languageProvider.fetchSeriesLabelsMatch(X):D=await t.languageProvider.fetchSeriesLabels(X),Object.keys(D).filter(A=>!Q.find($=>$.label===A)).map(A=>({value:A}))},u=(b,Q)=>{const X={label:Q??"__name__",op:"=~",value:(0,we.Vl)(`.*${b}`)},D=l.labels.filter(V=>V.label!==X.label);D.push(X),l.metric&&D.push({label:"__name__",op:"=",value:l.metric});const A=D.map(V=>({...V,label:t.interpolateString(V.label),value:t.interpolateString(V.value)})),$=R.Z.renderLabels(A);let K;return t.hasLabelsMatchAPISupport()?K=S(X,$):K=h(X,$),K.then(V=>(V.length>ee&&V.splice(0,V.length-ee),V))},h=(b,Q)=>{if(!b.label)return Promise.resolve([]);const X=t.languageProvider.fetchSeries(Q),D=t.interpolateString(b.label);return X.then(A=>{const $=new Set;return A.forEach(K=>{const V=K[D];$.add(V)}),Array.from($).map(K=>({label:K,value:K}))})},S=(b,Q)=>b.label?t.languageProvider.fetchSeriesValuesWithMatch(b.label,Q).then(X=>X.map(D=>({value:D,label:D}))):Promise.resolve([]),I=async b=>{if(!b.label)return[];if(!l.metric)return(await t.languageProvider.getLabelValues(b.label)).map(A=>({value:A}));const Q=l.labels.filter(A=>A!==b);Q.push({label:"__name__",op:"=",value:l.metric});const X=Q.map(A=>({...A,label:t.interpolateString(A.label),value:t.interpolateString(A.value)})),D=R.Z.renderLabels(X);return t.hasLabelsMatchAPISupport()?S(b,D):h(b,D)},B=(0,e.useCallback)(()=>E(ya(t,l)),[t,l,E]),j={grammar:Se.ZP,name:"promql"},M=H.v.featureToggles.prometheusMetricEncyclopedia,f=t.getInitHints();return e.createElement(e.Fragment,null,e.createElement(w.EditorRow,null,M&&!t.lookupsDisabled?e.createElement(e.Fragment,null,e.createElement(k.zx,{className:C.button,variant:"secondary",size:"sm",onClick:()=>d(b=>!b)},"Metric encyclopedia"),l.metric&&e.createElement(Rt.V,{name:" "+l.metric,color:"#3D71D9",icon:"times",onClick:()=>{n({...l,metric:""})},title:"Click to remove metric",className:C.metricTag}),v&&e.createElement(da,{datasource:t,isOpen:v,onClose:()=>d(!1),query:l,onChange:n})):e.createElement(Zt,{query:l,onChange:n,onGetMetrics:B,datasource:t,labelsFilters:l.labels,metricLookupDisabled:t.lookupsDisabled}),e.createElement(ea,{debounceDuration:t.getDebounceTimeInMilliseconds(),getLabelValuesAutofillSuggestions:u,labelsFilters:l.labels,onChange:y,onGetLabelNames:b=>E(L(b)),onGetLabelValues:b=>E(I(b))})),f.length?e.createElement("div",{className:"query-row-break"},e.createElement("div",{className:"prom-query-field-info text-warning"},f[0].label," ",f[0].fix?e.createElement("button",{type:"button",className:"text-warning"},f[0].fix.label):null)):null,i&&e.createElement(kt.B,{stepNumber:1,title:e.createElement(xe.U,{query:`${l.metric} ${R.Z.renderLabels(l.labels)}`,lang:j})},Ea.A),e.createElement(Bt.B,null,e.createElement(jt.P,{queryModeller:R.Z,datasource:t,query:l,onChange:n,onRunQuery:r,highlightedOp:p}),e.createElement(Wt.L,{datasource:t,query:l,onChange:n,data:o,queryModeller:R.Z,buildVisualQueryFromString:me._})),i&&e.createElement($t.V,{lang:j,query:l,stepNumber:2,queryModeller:R.Z,onMouseEnter:b=>g(b),onMouseLeave:()=>g(void 0)}),l.binaryQueries&&l.binaryQueries.length>0&&e.createElement(ba,{query:l,datasource:t,onChange:n,onRunQuery:r,showExplain:i}))});async function ya(a,t){a.languageProvider.metricsMetadata||await a.languageProvider.loadMetricsMetadata(),a.languageProvider.metricsMetadata||(a.languageProvider.metricsMetadata={});let l;if(t.labels.length>0){const n=R.Z.renderLabels(t.labels);l=(await a.languageProvider.getSeries(n,!0)).__name__??[]}else l=await a.languageProvider.getLabelValues("__name__")??[];return l.map(n=>({value:n,description:(0,Ce.UQ)(n,a.languageProvider.metricsMetadata)}))}Te.displayName="PromQueryBuilder";const xa=a=>({button:m.css`
      height: auto;
    `,metricTag:m.css`
      margin: '10px 0 10px 0',
      backgroundColor: '#3D71D9',
    `});function Sa({query:a}){return a?e.createElement(w.EditorRow,null,e.createElement(w.EditorFieldGroup,null,e.createElement(xe.U,{query:a,lang:{grammar:Se.ZP,name:"promql"}}))):null}function Ca(a){const{query:t,onChange:l,onRunQuery:n,datasource:r,data:o,showExplain:i}=a,[p,g]=(0,e.useReducer)(Je.reducer,{expr:t.expr});(0,e.useEffect)(()=>{g(Na(t.expr))},[t.expr]);const v=d=>{const y=R.Z.renderQuery(d);g(wa({visQuery:d,expr:y})),l({...a.query,expr:y})};return p.visQuery?e.createElement(e.Fragment,null,e.createElement(Te,{query:p.visQuery,datasource:r,onChange:v,onRunQuery:n,data:o,showExplain:i}),e.createElement(Sa,{query:t.expr})):null}const Je=(0,Vt.oM)({name:"prom-builder-container",initialState:{expr:""},reducers:{visualQueryChange:(a,t)=>{a.expr=t.payload.expr,a.visQuery=t.payload.visQuery},exprChanged:(a,t)=>{if(!a.visQuery||a.expr!==t.payload){a.expr=t.payload;const l=(0,me._)(t.payload);a.visQuery=l.query}}}}),{visualQueryChange:wa,exprChanged:Na}=Je.actions;var Ye=s(12007),qe=s(80396),Z=s(95091),Pa=s(58639),Ta=s(89050);function Ia({datasource:a,onChange:t,query:l,...n}){const[r,o]=(0,e.useState)(null),i=(0,_.wW)(Ma),p=(0,qe.Z)(r);(0,e.useEffect)(()=>{a.exemplarsAvailable?l.instant&&!l.range?(o("Exemplars are not available for instant queries"),t(!1)):(o(null),p&&!r&&t(!0)):(o("Exemplars for this query are not available"),t(!1))},[a.exemplarsAvailable,l.instant,l.range,t,p,r]);const g=(0,m.cx)({[i.activeIcon]:!!l.exemplar},i.eyeIcon);return e.createElement(Pa.W,{width:"auto","data-testid":n["data-testid"]},e.createElement(Ta.u,{content:r??""},e.createElement("div",{className:i.iconWrapper},"Exemplars",e.createElement(Ze.h,{name:"eye",tooltip:l.exemplar?"Disable query with exemplars":"Enable query with exemplars",disabled:!!r,className:g,onClick:()=>{t(!l.exemplar)}}))))}function Ma(a){return{eyeIcon:m.css`
      margin-left: ${a.spacing(2)};
    `,activeIcon:m.css`
      color: ${a.colors.primary.main};
    `,iconWrapper:m.css`
      display: flex;
      align-items: center;
    `}}const Da=(0,e.memo)(({query:a,datasource:t,onChange:l,onRunQuery:n})=>{const r=_e(!0),o=(0,qe.Z)(a),i=(0,e.useCallback)(y=>{(!(0,se.isEqual)(a,o)||y!==a.exemplar)&&l({...a,exemplar:y})},[o,a,l]);function p(y){l({...a,interval:y})}function g(y){y.currentTarget.value!==a.interval&&p(y.currentTarget.value)}function v(y){y.key==="Enter"&&y.shiftKey&&n()}const d=et(a,l);return e.createElement("div",{"aria-label":"Prometheus extra field",className:"gf-form-inline","data-testid":Ie.extraFieldEditor},e.createElement("div",{"data-testid":Ie.queryTypeField,className:(0,m.cx)("gf-form explore-input-margin",m.css`
            flex-wrap: nowrap;
          `),"aria-label":"Query type field"},e.createElement(Z.c,{width:"auto"},"Query type"),e.createElement(Ye.S,{options:r,value:a.range&&a.instant?"both":a.instant?"instant":"range",onChange:d})),e.createElement("div",{"data-testid":Ie.stepField,className:(0,m.cx)("gf-form",m.css`
            flex-wrap: nowrap;
          `),"aria-label":"Step field"},e.createElement(Z.c,{width:6,tooltip:"Time units and built-in variables can be used here, for example: $__interval, $__rate_interval, 5s, 1m, 3h, 1d, 1y (Default if no unit is specified: s)"},"Min step"),e.createElement("input",{type:"text",className:"gf-form-input width-4",placeholder:"auto",onChange:g,onKeyDown:v,value:a.interval??""})),e.createElement(Ia,{onChange:i,datasource:t,query:a}))});Da.displayName="PromExploreExtraField";function _e(a){const t=[{value:"range",label:"Range",description:"Run query over a range of time"},{value:"instant",label:"Instant",description:'Run query against a single point in time. For this query, the "To" time is used'}];return a&&t.push({value:"both",label:"Both",description:"Run an Instant query and a Range query"}),t}function et(a,t){return l=>{t(l==="instant"?{...a,instant:!0,range:!1,exemplar:!1}:l==="range"?{...a,instant:!1,range:!0}:{...a,instant:!0,range:!0})}}const Ie={extraFieldEditor:"prom-editor-extra-field",stepField:"prom-editor-extra-field-step",queryTypeField:"prom-editor-extra-field-query-type"};var La=s(15839);const Me=[{label:"Auto",value:F.pD.Auto,description:"Only includes unique labels"},{label:"Verbose",value:F.pD.Verbose,description:"All label names and values"},{label:"Custom",value:F.pD.Custom,description:"Provide a naming template"}],tt=e.memo(({legendFormat:a,onChange:t,onRunQuery:l})=>{const n=at(a),r=(0,e.useRef)(null),o=p=>{let g=p.currentTarget.value;g.length===0&&(g=F.pD.Auto),g!==a&&(t(g),l())},i=p=>{switch(p.value){case F.pD.Auto:t(F.pD.Auto);break;case F.pD.Custom:t("{{label_name}}"),setTimeout(()=>{r.current?.focus(),r.current?.setSelectionRange(2,12,"forward")},10);break;case F.pD.Verbose:t("");break}l()};return e.createElement(w.EditorField,{label:"Legend",tooltip:"Series name override or template. Ex. {{hostname}} will be replaced with label value for hostname."},e.createElement(e.Fragment,null,n===F.pD.Custom&&e.createElement(Pe.H,{id:"legendFormat",minWidth:22,placeholder:"auto",defaultValue:a,onCommitChange:o,ref:r}),n!==F.pD.Custom&&e.createElement(O.Ph,{inputId:"legend.mode",isSearchable:!1,placeholder:"Select legend mode",options:Me,width:22,onChange:i,value:Me.find(p=>p.value===n)})))});tt.displayName="PromQueryLegendEditor";function at(a){return a===F.pD.Auto?F.pD.Auto:a==null||a===""?F.pD.Verbose:F.pD.Custom}function za(a){const t=at(a);return t!==F.pD.Custom?Me.find(l=>l.value===t)?.label:a}const lt=e.memo(({query:a,app:t,onChange:l,onRunQuery:n})=>{const r=E=>{l({...a,format:E.value}),n()},o=E=>{l({...a,interval:E.currentTarget.value}),n()},i=_e(t===q.zj.Explore||t===q.zj.PanelEditor),p=et(a,l),g=E=>{const L=E.currentTarget.checked;l({...a,exemplar:L}),n()},v=E=>{l({...a,intervalFactor:E.value}),n()},d=De.find(E=>E.value===a.format)||De[0],y=Aa(a),C=i.find(E=>E.value===y).label;return e.createElement(w.EditorRow,null,e.createElement(La.d,{title:"Options",collapsedInfo:Fa(a,d.label,C,t)},e.createElement(tt,{legendFormat:a.legendFormat,onChange:E=>l({...a,legendFormat:E}),onRunQuery:n}),e.createElement(w.EditorField,{label:"Min step",tooltip:e.createElement(e.Fragment,null,"An additional lower limit for the step parameter of the Prometheus query and for the"," ",e.createElement("code",null,"$__interval")," and ",e.createElement("code",null,"$__rate_interval")," variables.")},e.createElement(Pe.H,{type:"text","aria-label":"Set lower limit for the step parameter",placeholder:"auto",minWidth:10,onCommitChange:o,defaultValue:a.interval})),e.createElement(w.EditorField,{label:"Format"},e.createElement(O.Ph,{value:d,allowCustomValue:!0,onChange:r,options:De})),e.createElement(w.EditorField,{label:"Type"},e.createElement(Ye.S,{options:i,value:y,onChange:p})),nt(a,t)&&e.createElement(w.EditorField,{label:"Exemplars"},e.createElement(w.EditorSwitch,{value:a.exemplar||!1,onChange:g})),a.intervalFactor&&a.intervalFactor>1&&e.createElement(w.EditorField,{label:"Resolution"},e.createElement(O.Ph,{"aria-label":"Select resolution",isSearchable:!1,options:rt,onChange:v,value:rt.find(E=>E.value===a.intervalFactor)}))))});function nt(a,t){return!(t===q.zj.UnifiedAlerting||!a.range)}function Aa(a){return a.range&&a.instant?"both":a.instant?"instant":"range"}function Fa(a,t,l,n){const r=[];return r.push(`Legend: ${za(a.legendFormat)}`),r.push(`Format: ${t}`),r.push(`Step: ${a.interval??"auto"}`),r.push(`Type: ${l}`),nt(a,n)&&(a.exemplar?r.push("Exemplars: true"):r.push("Exemplars: false")),r}lt.displayName="PromQueryBuilderOptions";var Qa=s(55601);const De=[{label:"Time series",value:"time_series"},{label:"Table",value:"table"},{label:"Heatmap",value:"heatmap"}],rt=(0,se.map)([1,2,3,4,5,10],a=>({value:a,label:"1/"+a})),st=e.memo(a=>{const{onChange:t,onRunQuery:l,data:n,app:r,onAddQuery:o,datasource:{defaultEditor:i},queries:p}=a,[g,v]=(0,e.useState)(!1),[d,y]=(0,e.useState)(!1),[C,E]=(0,e.useState)(!1),{flag:L,setFlag:u}=(0,je.P5)(je.ar),h=Ot(a.query,r,i),S=h.editorMode,I=(0,e.useCallback)(M=>{if((0,Ee.ff)("user_grafana_prometheus_editor_mode_clicked",{newEditor:M,previousEditor:h.editorMode??"",newQuery:!h.expr,app:r??""}),M===U.c.Builder&&(0,me._)(h.expr||"").errors.length){v(!0);return}We(h,M,t)},[t,h,r]);(0,e.useEffect)(()=>{E(!1)},[n]);const B=M=>{(0,se.isEqual)(M,a.query)||E(!0),t(M)},j=M=>{u(M.currentTarget.checked)};return e.createElement(e.Fragment,null,e.createElement(Pt.s,{isOpen:g,title:"Query parsing",body:"There were errors while trying to parse the query. Continuing to visual builder may lose some parts of the query.",confirmText:"Continue",onConfirm:()=>{We(h,U.c.Builder,t),v(!1)},onDismiss:()=>v(!1)}),e.createElement(zt,{isOpen:d,onClose:()=>y(!1),query:h,queries:p,app:r,onChange:t,onAddQuery:o}),e.createElement(w.EditorHeader,null,e.createElement(k.zx,{"aria-label":oe.wl.components.QueryBuilder.queryPatterns,variant:"secondary",size:"sm",onClick:()=>y(M=>!M)},"Kick start your query"),e.createElement(Qt.n,{label:"Explain",value:L,onChange:j}),e.createElement(w.FlexItem,{grow:1}),r!==q.zj.Explore&&r!==q.zj.Correlations&&e.createElement(k.zx,{variant:C?"primary":"secondary",size:"sm",onClick:l,icon:n?.state===Re.Gu.Loading?"fa fa-spinner":void 0,disabled:n?.state===Re.Gu.Loading},"Run queries"),e.createElement(Ft.k,{mode:S,onChange:I})),e.createElement(w.Space,{v:.5}),e.createElement(w.EditorRows,null,S===U.c.Code&&e.createElement(Qa.j,{...a,query:h,showExplain:L,onChange:B}),S===U.c.Builder&&e.createElement(Ca,{query:h,datasource:a.datasource,onChange:B,onRunQuery:a.onRunQuery,data:n,showExplain:L}),e.createElement(lt,{query:h,app:a.app,onChange:t,onRunQuery:l})))});st.displayName="PromQueryEditorSelector";var Xa=s(12850);function Oa(a){const{datasource:t,query:l,range:n,data:r,onChange:o,onRunQuery:i}=a;return e.createElement(Xa.ZP,{datasource:t,query:l,onRunQuery:i,onChange:o,history:[],range:n,data:r,"data-testid":Va.editor})}const Va={editor:"prom-editor-cloud-alerting"};function Ra(a){const{app:t}=a;switch(t){case q.zj.CloudAlerting:return e.createElement(Oa,{...a});default:return e.createElement(st,{...a})}}const ka=(0,e.memo)(Ra);var ja=s(84923),$a=s(88347),Ba=s(38210),Wa=s(70340),Ua=s(83063),he=s(18819),ot=s(54805),it=(a=>(a.Public="AzureCloud",a.China="AzureChinaCloud",a.USGovernment="AzureUSGovernment",a.None="",a))(it||{});const Ha=[{value:"AzureCloud",label:"Azure"},{value:"AzureChinaCloud",label:"Azure China"},{value:"AzureUSGovernment",label:"Azure US Government"}];function Ga(a){switch(a.authType){case"msi":case"workloadidentity":return!0;case"clientsecret":return!!(a.azureCloud&&a.tenantId&&a.clientId&&a.clientSecret)}}const Za=Symbol("Concealed client secret");function ge(){return H.v.azure.cloud||it.Public}function Ka(a){if(a.secureJsonFields.azureClientSecret)return Za;{const t=a.secureJsonData?.azureClientSecret;return typeof t=="string"&&t.length>0?t:void 0}}function Ja(a){return!!a.jsonData.azureCredentials}function ct(){return H.v.azure.managedIdentityEnabled?{authType:"msi"}:{authType:"clientsecret",azureCloud:ge()}}function Ya(a){const t=a.jsonData.azureCredentials;if(!t)return ct();switch(t.authType){case"msi":case"workloadidentity":return t.authType==="msi"&&H.v.azure.managedIdentityEnabled||t.authType==="workloadidentity"&&H.v.azure.workloadIdentityEnabled?{authType:t.authType}:{authType:"clientsecret",azureCloud:ge()};case"clientsecret":return{authType:"clientsecret",azureCloud:t.azureCloud||ge(),tenantId:t.tenantId,clientId:t.clientId,clientSecret:Ka(a)}}}function qa(a,t){switch(t.authType){case"msi":case"workloadidentity":if(t.authType==="msi"&&!H.v.azure.managedIdentityEnabled)throw new Error("Managed Identity authentication is not enabled in Grafana config.");if(t.authType==="workloadidentity"&&!H.v.azure.workloadIdentityEnabled)throw new Error("Workload Identity authentication is not enabled in Grafana config.");return a={...a,jsonData:{...a.jsonData,azureAuthType:t.authType,azureCredentials:{authType:t.authType}}},a;case"clientsecret":return a={...a,jsonData:{...a.jsonData,azureCredentials:{authType:"clientsecret",azureCloud:t.azureCloud||ge(),tenantId:t.tenantId,clientId:t.clientId}},secureJsonData:{...a.secureJsonData,azureClientSecret:typeof t.clientSecret=="string"&&t.clientSecret.length>0?t.clientSecret:void 0},secureJsonFields:{...a.secureJsonFields,azureClientSecret:typeof t.clientSecret=="symbol"}},a}}function _a(a){return{jsonData:{...a.jsonData,azureCredentials:ct()}}}function el(a){return{jsonData:{...a.jsonData,azureAuth:void 0,azureCredentials:void 0,azureEndpointResourceId:void 0}}}var ve=s(87577),Le=s(64315);const tl=a=>{const{credentials:t,azureCloudOptions:l,onCredentialsChange:n,getSubscriptions:r,disabled:o,managedIdentityEnabled:i,workloadIdentityEnabled:p}=a,g=Ga(t),[v,d]=(0,e.useState)([]),[y,C]=(0,e.useReducer)(f=>f+1,0),E=(0,e.useMemo)(()=>{let f=[{value:"clientsecret",label:"App Registration"}];return i&&f.push({value:"msi",label:"Managed Identity"}),p&&f.push({value:"workloadidentity",label:"Workload Identity"}),f},[i,p]);(0,e.useEffect)(()=>{if(!r||!g){L([]);return}let f=!1;return r().then(b=>{f||L(b,y)}),()=>{f=!0}},[y]);const L=(f,b=!1)=>{d(f),r&&(b&&!t.defaultSubscriptionId&&f.length>0?M(f[0]):t.defaultSubscriptionId&&(f.find(X=>X.value===t.defaultSubscriptionId)||M(void 0)))},u=f=>{d([]);const b=i?"msi":p?"workloadidentity":"clientsecret",Q={...t,authType:f.value||b,defaultSubscriptionId:void 0};n(Q)},h=f=>{if(t.authType==="clientsecret"){d([]);const b={...t,azureCloud:f.value,defaultSubscriptionId:void 0};n(b)}},S=f=>{if(t.authType==="clientsecret"){d([]);const b={...t,tenantId:f.target.value,defaultSubscriptionId:void 0};n(b)}},I=f=>{if(t.authType==="clientsecret"){d([]);const b={...t,clientId:f.target.value,defaultSubscriptionId:void 0};n(b)}},B=f=>{if(t.authType==="clientsecret"){d([]);const b={...t,clientSecret:f.target.value,defaultSubscriptionId:void 0};n(b)}},j=()=>{if(t.authType==="clientsecret"){d([]);const f={...t,clientSecret:"",defaultSubscriptionId:void 0};n(f)}},M=f=>{const b={...t,defaultSubscriptionId:f?.value};n(b)};return e.createElement("div",{className:"gf-form-group"},E.length>1&&e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{className:"width-12",tooltip:"Choose the type of authentication to Azure services"},"Authentication"),e.createElement(Le.Ph,{className:"width-15",value:E.find(f=>f.value===t.authType),options:E,onChange:u,isDisabled:o}))),t.authType==="clientsecret"&&e.createElement(e.Fragment,null,l&&e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{className:"width-12",tooltip:"Choose an Azure Cloud"},"Azure Cloud"),e.createElement(Le.Ph,{className:"width-15",value:l.find(f=>f.value===t.azureCloud),options:l,onChange:h,isDisabled:o}))),e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{className:"width-12"},"Directory (tenant) ID"),e.createElement("div",{className:"width-15"},e.createElement(ve.I,{className:"width-30",placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:t.tenantId||"",onChange:S,disabled:o})))),e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{className:"width-12"},"Application (client) ID"),e.createElement("div",{className:"width-15"},e.createElement(ve.I,{className:"width-30",placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:t.clientId||"",onChange:I,disabled:o})))),typeof t.clientSecret=="symbol"?e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{htmlFor:"azure-client-secret",className:"width-12"},"Client Secret"),e.createElement(ve.I,{id:"azure-client-secret",className:"width-25",placeholder:"configured",disabled:!0})),!o&&e.createElement("div",{className:"gf-form"},e.createElement("div",{className:"max-width-30 gf-form-inline"},e.createElement(k.zx,{variant:"secondary",type:"button",onClick:j},"reset")))):e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{className:"width-12"},"Client Secret"),e.createElement("div",{className:"width-15"},e.createElement(ve.I,{className:"width-30",placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:t.clientSecret||"",onChange:B,disabled:o}))))),r&&e.createElement(e.Fragment,null,e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{className:"width-12"},"Default Subscription"),e.createElement("div",{className:"width-25"},e.createElement(Le.Ph,{value:t.defaultSubscriptionId?v.find(f=>f.value===t.defaultSubscriptionId):void 0,options:v,onChange:M,isDisabled:o})))),e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement("div",{className:"max-width-30 gf-form-inline"},e.createElement(k.zx,{variant:"secondary",size:"sm",type:"button",onClick:C,disabled:!g},"Load Subscriptions"))))))},Ql=null,al=a=>{const{dataSourceConfig:t,onChange:l}=a,[n]=(0,e.useState)(H.v.featureToggles.prometheusAzureOverrideAudience||!!t.jsonData.azureEndpointResourceId),[r,o]=(0,e.useState)(!!t.jsonData.azureEndpointResourceId),i=(0,e.useMemo)(()=>Ya(t),[t]),p=d=>{l(qa(t,d))},g=d=>{o(d.currentTarget.checked),d.currentTarget.checked||l({...t,jsonData:{...t.jsonData,azureEndpointResourceId:void 0}})},v=d=>{r&&l({...t,jsonData:{...t.jsonData,azureEndpointResourceId:d.currentTarget.value}})};return e.createElement(e.Fragment,null,e.createElement("h6",null,"Azure Authentication"),e.createElement(tl,{managedIdentityEnabled:H.v.azure.managedIdentityEnabled,workloadIdentityEnabled:H.v.azure.workloadIdentityEnabled,credentials:i,azureCloudOptions:Ha,onCredentialsChange:p,disabled:t.readOnly}),n&&e.createElement(e.Fragment,null,e.createElement("h6",null,"Azure Configuration"),e.createElement("div",{className:"gf-form-group"},e.createElement(ot.Z,null,e.createElement(G._,{labelWidth:26,label:"Override AAD audience",disabled:t.readOnly},e.createElement(ne.x,{value:r,onChange:g}))),r&&e.createElement(ot.Z,null,e.createElement(G._,{labelWidth:26,label:"Resource ID",disabled:t.readOnly},e.createElement(ce.I,{className:"width-30",value:t.jsonData.azureEndpointResourceId||"",onChange:v}))))))},Xl=null;var ll=s(62870),ze=s.n(ll),ut=s(65820),nl=s(55041),rl=s(62430),dt=s(39025),sl=s(66116),ae=s(70176),ol=s(58526);function il({value:a,onChange:t,onDelete:l,disabled:n}){const[r,o]=(0,e.useState)(Boolean(a.datasourceUid));return e.createElement("div",{className:"gf-form-group"},e.createElement(G._,{label:"Internal link",labelWidth:24,disabled:n},e.createElement(e.Fragment,null,e.createElement(ne.x,{value:r,"aria-label":oe.wl.components.DataSource.Prometheus.configPage.internalLinkSwitch,onChange:i=>o(i.currentTarget.checked)}),!n&&e.createElement(k.zx,{variant:"destructive",title:"Remove link",icon:"times",onClick:i=>{i.preventDefault(),l()},className:m.css`
                margin-left: 8px;
              `}))),r?e.createElement(G._,{label:"Data source",labelWidth:24,tooltip:"The data source the exemplar is going to navigate to.",disabled:n},e.createElement(ol.q,{tracing:!0,current:a.datasourceUid,noDefault:!0,width:40,onChange:i=>t({...a,datasourceUid:i.uid,url:void 0})})):e.createElement(G._,{label:"URL",labelWidth:24,tooltip:"The URL of the trace backend the user would go to see its trace.",disabled:n},e.createElement(ce.I,{placeholder:"https://example.com/${__value.raw}",spellCheck:!1,width:40,value:a.url,onChange:i=>t({...a,datasourceUid:void 0,url:i.currentTarget.value})})),e.createElement(G._,{label:"URL Label",labelWidth:24,tooltip:"Use to override the button label on the exemplar traceID field.",disabled:n},e.createElement(ce.I,{placeholder:"Go to example.com",spellCheck:!1,width:40,value:a.urlDisplayLabel,onChange:i=>t({...a,urlDisplayLabel:i.currentTarget.value})})),e.createElement(G._,{label:"Label name",labelWidth:24,tooltip:"The name of the field in the labels object that should be used to get the traceID.",disabled:n},e.createElement(ce.I,{placeholder:"traceID",spellCheck:!1,width:40,value:a.name,onChange:i=>t({...a,name:i.currentTarget.value})})))}function cl({options:a,onChange:t,disabled:l}){return e.createElement(e.Fragment,null,e.createElement("h3",{className:"page-heading"},"Exemplars"),a&&a.map((n,r)=>e.createElement(il,{key:r,value:n,onChange:o=>{const i=[...a];i.splice(r,1,o),t(i)},onDelete:()=>{const o=[...a];o.splice(r,1),t(o)},disabled:l})),!l&&e.createElement(k.zx,{variant:"secondary","aria-label":oe.wl.components.DataSource.Prometheus.configPage.exemplarsAddButton,className:m.css`
            margin-bottom: 10px;
          `,icon:"plus",onClick:n=>{n.preventDefault();const r=[...a||[],{name:"traceID"}];t(r)}},"Add"))}const fe={Prometheus:[{value:void 0,label:"Please select"},{value:"2.0.0",label:"< 2.14.x"},{value:"2.14.0",label:"2.14.x"},{value:"2.15.0",label:"2.15.x"},{value:"2.16.0",label:"2.16.x"},{value:"2.17.0",label:"2.17.x"},{value:"2.18.0",label:"2.18.x"},{value:"2.19.0",label:"2.19.x"},{value:"2.20.0",label:"2.20.x"},{value:"2.21.0",label:"2.21.x"},{value:"2.22.0",label:"2.22.x"},{value:"2.23.0",label:"2.23.x"},{value:"2.24.0",label:"2.24.x"},{value:"2.25.0",label:"2.25.x"},{value:"2.26.0",label:"2.26.x"},{value:"2.27.0",label:"2.27.x"},{value:"2.28.0",label:"2.28.x"},{value:"2.29.0",label:"2.29.x"},{value:"2.30.0",label:"2.30.x"},{value:"2.31.0",label:"2.31.x"},{value:"2.32.0",label:"2.32.x"},{value:"2.33.0",label:"2.33.x"},{value:"2.34.0",label:"2.34.x"},{value:"2.35.0",label:"2.35.x"},{value:"2.36.0",label:"2.36.x"},{value:"2.37.0",label:"2.37.x"},{value:"2.38.0",label:"2.38.x"},{value:"2.39.0",label:"2.39.x"},{value:"2.40.0",label:"2.40.x"},{value:"2.41.0",label:"2.41.x"},{value:"2.42.0",label:"2.42.x"},{value:"2.43.0",label:"2.43.x"},{value:"2.44.0",label:"2.44.x"},{value:"2.45.0",label:"2.45.x"},{value:"2.46.0",label:"2.46.x"},{value:"2.47.0",label:"2.47.x"},{value:"2.48.0",label:"2.48.x"},{value:"2.49.0",label:"2.49.x"},{value:"2.50.0",label:"2.50.x"},{value:"2.50.1",label:"> 2.50.x"}],Mimir:[{value:void 0,label:"Please select"},{value:"2.0.0",label:"2.0.x"},{value:"2.1.0",label:"2.1.x"},{value:"2.2.0",label:"2.2.x"},{value:"2.3.0",label:"2.3.x"},{value:"2.4.0",label:"2.4.x"},{value:"2.5.0",label:"2.5.x"},{value:"2.6.0",label:"2.6.x"},{value:"2.7.0",label:"2.7.x"},{value:"2.8.0",label:"2.8.x"},{value:"2.9.0",label:"2.9.x"},{value:"2.9.1",label:"> 2.9.x"}],Thanos:[{value:void 0,label:"Please select"},{value:"0.0.0",label:"< 0.16.x"},{value:"0.16.0",label:"0.16.x"},{value:"0.17.0",label:"0.17.x"},{value:"0.18.0",label:"0.18.x"},{value:"0.19.0",label:"0.19.x"},{value:"0.20.0",label:"0.20.x"},{value:"0.21.0",label:"0.21.x"},{value:"0.22.0",label:"0.22.x"},{value:"0.23.0",label:"0.23.x"},{value:"0.24.0",label:"0.24.x"},{value:"0.25.0",label:"0.25.x"},{value:"0.26.0",label:"0.26.x"},{value:"0.27.0",label:"0.27.x"},{value:"0.28.0",label:"0.28.x"},{value:"0.29.0",label:"0.29.x"},{value:"0.30.0",label:"0.30.x"},{value:"0.31.0",label:"0.31.x"},{value:"0.31.1",label:"> 0.31.x"}],Cortex:[{value:void 0,label:"Please select"},{value:"0.0.0",label:"< 1.0.0"},{value:"1.0.0",label:"1.0.0"},{value:"1.1.0",label:"1.1.x"},{value:"1.2.0",label:"1.2.x"},{value:"1.3.0",label:"1.3.x"},{value:"1.4.0",label:"1.4.x"},{value:"1.5.0",label:"1.5.x"},{value:"1.6.0",label:"1.6.x"},{value:"1.7.0",label:"1.7.x"},{value:"1.8.0",label:"1.8.x"},{value:"1.9.0",label:"1.9.x"},{value:"1.10.0",label:"1.10.x"},{value:"1.11.0",label:"1.11.x"},{value:"1.13.0",label:"1.13.x"},{value:"1.14.0",label:"> 1.13.x"}]},{Input:Ae,FormField:re}=rl.LegacyForms,mt=[{value:"POST",label:"POST"},{value:"GET",label:"GET"}],pt=[{value:U.c.Builder,label:"Builder"},{value:U.c.Code,label:"Code"}],ht=[{value:F.x3.Low,label:"Low"},{value:F.x3.Medium,label:"Medium"},{value:F.x3.High,label:"High"},{value:F.x3.None,label:"None"}],gt=[{value:ae.T8.Prometheus,label:ae.T8.Prometheus},{value:ae.T8.Cortex,label:ae.T8.Cortex},{value:ae.T8.Mimir,label:ae.T8.Mimir},{value:ae.T8.Thanos,label:ae.T8.Thanos}],ul=(a,t)=>{if(!t||!fe[t])return;const n=fe[t]?.filter(o=>!!o.value&&ze().lte(o.value,a)).map(o=>o.value),r=n[n.length-1];if(r){const o=ze().diff(r,a);if(["patch","prepatch","prerelease",null].includes(o))return r}},vt=a=>{console.warn("Error fetching version from buildinfo API, must manually select version!",a)},dl=(a,t,l)=>{l(a).then(n=>{(0,nl.i)().get(`/api/datasources/uid/${n.uid}/resources/version-detect`).then(r=>{const o=r.data?.version??"";if(o&&ze().valid(o)){const i=ul(o,n.jsonData.prometheusType);i&&l({...n,jsonData:{...n.jsonData,prometheusVersion:i}}).then(p=>{t(p)})}else vt()})}).catch(n=>{vt(n)})},ml=a=>{const{options:t,onOptionsChange:l}=a,n=(0,sl.qj)();return t.jsonData.httpMethod||(t.jsonData.httpMethod="POST"),e.createElement(e.Fragment,null,e.createElement("div",{className:"gf-form-group"},e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(re,{label:"Scrape interval",labelWidth:13,inputEl:e.createElement(Ae,{className:"width-6",value:t.jsonData.timeInterval,spellCheck:!1,placeholder:"15s",onChange:le("timeInterval",t,l),validationEvents:ft,disabled:t.readOnly}),tooltip:"Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s."}))),e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form"},e.createElement(re,{label:"Query timeout",labelWidth:13,inputEl:e.createElement(Ae,{className:"width-6",value:t.jsonData.queryTimeout,onChange:le("queryTimeout",t,l),spellCheck:!1,placeholder:"60s",validationEvents:ft,disabled:t.readOnly}),tooltip:"Set the Prometheus query timeout."}))),e.createElement("div",{className:"gf-form"},e.createElement(Z.c,{width:13,tooltip:"You can use either POST or GET HTTP method to query your Prometheus data source. POST is the recommended method as it allows bigger queries. Change this to GET if you have a Prometheus version older than 2.1 or if POST requests are restricted in your network."},"HTTP method"),e.createElement(O.Ph,{"aria-label":"Select HTTP method",options:mt,value:mt.find(r=>r.value===t.jsonData.httpMethod),onChange:le("httpMethod",t,l),className:"width-6",disabled:t.readOnly}))),e.createElement("h3",{className:"page-heading"},"Type and version"),!t.jsonData.prometheusType&&!t.jsonData.prometheusVersion&&t.readOnly&&e.createElement("div",{style:{marginBottom:"12px"}},"For more information on configuring prometheus type and version in data sources, see the"," ",e.createElement("a",{style:{textDecoration:"underline"},href:"https://grafana.com/docs/grafana/latest/administration/provisioning/"},"provisioning documentation"),"."),e.createElement("div",{className:"gf-form-group"},e.createElement("div",{className:"gf-form"},e.createElement("div",{className:"gf-form"},e.createElement(re,{label:"Prometheus type",labelWidth:13,inputEl:e.createElement(O.Ph,{"aria-label":"Prometheus type",options:gt,value:gt.find(r=>r.value===t.jsonData.prometheusType),onChange:le("prometheusType",{...t,jsonData:{...t.jsonData,prometheusVersion:void 0}},r=>(dl(r,l,n),l({...r,jsonData:{...r.jsonData,prometheusVersion:void 0}}))),width:20,disabled:t.readOnly}),tooltip:"Set this to the type of your prometheus database, e.g. Prometheus, Cortex, Mimir or Thanos. Changing this field will save your current settings, and attempt to detect the version."}))),e.createElement("div",{className:"gf-form"},t.jsonData.prometheusType&&e.createElement("div",{className:"gf-form"},e.createElement(re,{label:`${t.jsonData.prometheusType} version`,labelWidth:13,inputEl:e.createElement(O.Ph,{"aria-label":`${t.jsonData.prometheusType} type`,options:fe[t.jsonData.prometheusType],value:fe[t.jsonData.prometheusType]?.find(r=>r.value===t.jsonData.prometheusVersion),onChange:le("prometheusVersion",t,l),width:20,disabled:t.readOnly}),tooltip:`Use this to set the version of your ${t.jsonData.prometheusType} instance if it is not automatically configured.`})))),e.createElement("h3",{className:"page-heading"},"Misc"),e.createElement("div",{className:"gf-form-group"},e.createElement("div",{className:"gf-form"},e.createElement(G._,{labelWidth:28,label:"Disable metrics lookup",tooltip:"Checking this option will disable the metrics chooser and metric/label support in the query field's autocomplete. This helps if you have performance issues with bigger Prometheus instances.",disabled:t.readOnly},e.createElement(ne.x,{value:t.jsonData.disableMetricsLookup??!1,onChange:(0,ut.hz)(a,"disableMetricsLookup")}))),e.createElement("div",{className:"gf-form"},e.createElement(re,{label:"Default editor",labelWidth:14,inputEl:e.createElement(O.Ph,{"aria-label":"Default Editor (Code or Builder)",options:pt,value:pt.find(r=>r.value===t.jsonData.defaultEditor),onChange:le("defaultEditor",t,l),width:20,disabled:t.readOnly}),tooltip:'Set default editor option (builder/code) for all users of this datasource. If no option was selected, the default editor will be the "builder". If they switch to other option rather than the specified with this setting on the panel we always show the selected editor for that user.'})),e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form max-width-30"},e.createElement(re,{label:"Custom query parameters",labelWidth:14,tooltip:"Add custom parameters to all Prometheus or Thanos queries.",inputEl:e.createElement(Ae,{className:"width-25",value:t.jsonData.customQueryParameters,onChange:le("customQueryParameters",t,l),spellCheck:!1,placeholder:"Example: max_source_resolution=5m&timeout=10",disabled:t.readOnly})}))),he.ZP.featureToggles.prometheusResourceBrowserCache&&e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form max-width-30"},e.createElement(re,{label:"Cache level",labelWidth:14,tooltip:"Sets the browser caching level for editor queries. Higher cache settings are recommended for high cardinality data sources.",inputEl:e.createElement(O.Ph,{className:"width-25",onChange:le("cacheLevel",t,l),options:ht,value:ht.find(r=>r.value===t.jsonData.cacheLevel)})})))),e.createElement(cl,{options:t.jsonData.exemplarTraceIdDestinations,onChange:r=>(0,ut.tp)({onOptionsChange:l,options:t},"exemplarTraceIdDestinations",r),disabled:t.readOnly}))},ft={[dt.JU.onBlur]:[(0,dt.FE)(/^$|^\d+(ms|[Mwdhmsy])$/,"Value is not valid, you can use number with time unit specifier: y, M, w, d, h, m, s")]},pl=a=>a?a.hasOwnProperty("currentTarget")?a.currentTarget.value:a.value:"",le=(a,t,l)=>n=>{l({...t,jsonData:{...t.jsonData,[a]:pl(n)}})},hl=a=>{const{options:t,onOptionsChange:l}=a,n=(0,e.useRef)(a.options.access==="direct"),r={azureAuthSupported:he.vc.azureAuthEnabled,getAzureAuthEnabled:o=>Ja(o),setAzureAuthEnabled:(o,i)=>i?_a(o):el(o),azureSettingsUI:al};return e.createElement(e.Fragment,null,t.access==="direct"&&e.createElement($a.b,{title:"Error",severity:"error"},"Browser access mode in the Prometheus datasource is no longer available. Switch to server access mode."),e.createElement(Ba.E,{defaultUrl:"http://localhost:9090",dataSourceConfig:t,showAccessOptions:n.current,onChange:l,sigV4AuthToggleEnabled:he.vc.sigV4AuthEnabled,azureAuthSettings:r,renderSigV4Editor:e.createElement(ja.IW,{...a})}),he.vc.featureToggles.secureSocksDatasourceProxy&&e.createElement(Wa.i,{options:t,onOptionsChange:l}),e.createElement(Ua.O,{options:t,onOptionsChange:l}),e.createElement(ml,{options:t,onOptionsChange:l}))};var gl=s(53988);const vl=new Ct.hf(gl.vQ).setQueryEditor(ka).setConfigEditor(hl).setQueryEditorHelp(Nt)}}]);

//# sourceMappingURL=prometheusPlugin.5612d73c2fcce631047b.js.map