"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6987],{10:(ot,Te,i)=>{i.d(Te,{q:()=>G});var h=i(9892),T=i(66111),$e=i(72648);const Be=10,G=({colorPalette:me,min:Ee,max:Re,display:H,hoverValue:Ie,useStopsPercentage:He})=>{const[Se,be]=(0,T.useState)([]),[we,Oe]=(0,T.useState)({isShown:!1,value:0}),[Ce,Ze]=(0,T.useState)(null),We=(0,$e.l4)(),Ne=Je(We,Se);(0,T.useEffect)(()=>{be(b({colorArray:me,stops:Be,useStopsPercentage:He}))},[me,He]);const at=Ue=>{const lt=Ue.nativeEvent.offsetX,nt=Ue.currentTarget.offsetWidth,Qe=Math.floor(lt*100/nt+1),ze=Math.floor((Re-Ee)*Qe/100+Ee);Oe({isShown:!0,value:ze}),Ze(Qe)},Ae=()=>{Oe({isShown:!1,value:0})};return(0,T.useEffect)(()=>{Ze(Ie==null?null:c((Ie-Ee)/(Re-Ee)))},[Ie,Ee,Re]),T.createElement("div",{className:Ne.scaleWrapper,onMouseMove:at,onMouseLeave:Ae},T.createElement("div",{className:Ne.scaleGradient},H&&(we.isShown||Ie!==void 0)&&T.createElement("div",{className:Ne.followerContainer},T.createElement("div",{className:Ne.follower,style:{left:`${Ce}%`}}))),H&&T.createElement("div",{className:Ne.followerContainer},T.createElement("div",{className:Ne.legendValues},T.createElement("span",null,H(Ee)),T.createElement("span",null,H(Re))),Ce!=null&&(we.isShown||Ie!==void 0)&&T.createElement("span",{className:Ne.hoverValue,style:{left:`${Ce}%`}},H(Ie??we.value))))},b=({colorArray:me,stops:Ee,useStopsPercentage:Re=!0})=>{const H=me.length;if(Re&&H<=20){const be=1/H*100;let we=0;const Oe=[];for(const Ce of me)we>0?Oe.push(`${Ce} ${we}%`):Oe.push(Ce),we+=be,Oe.push(`${Ce} ${we}%`);return Oe}const Ie=me[H-1],He=Math.ceil(H/Ee),Se=new Set;for(let be=0;be<H;be+=He)Se.add(me[be]);return Se.add(Ie),[...Se]};function c(me){return me>1?100:me<0?0:me*100}const Je=(me,Ee)=>({scaleWrapper:h.css`
    width: 100%;
    font-size: 11px;
    opacity: 1;
  `,scaleGradient:h.css`
    background: linear-gradient(90deg, ${Ee.join()});
    height: 10px;
    pointer-events: none;
  `,legendValues:h.css`
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  `,hoverValue:h.css`
    position: absolute;
    margin-top: -14px;
    padding: 3px 15px;
    background: ${me.colors.background.primary};
    transform: translateX(-50%);
  `,followerContainer:h.css`
    position: relative;
    pointer-events: none;
    white-space: nowrap;
  `,follower:h.css`
    position: absolute;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    transform: translateX(-50%) translateY(-50%);
    border: 2px solid ${me.colors.text.primary};
    margin-top: 5px;
  `})},30749:(ot,Te,i)=>{i.d(Te,{Ky:()=>xe,n:()=>Ze,nM:()=>ct,nf:()=>Xe,vs:()=>Ae});var h=i(47700),T=i(82897),$e=i.n(T),Be=i(206),G=i(99098),b=i(89749),c=i(86029),Je=i(6194),me=i(7569),Ee=i(39393),Re=i(30471),H=i(35645),Ie=i(86647),He=i(20308),Se=i(44332),be=i(37462);const we=/^[+-]?inf(?:inity)?$/i,Oe=(l,r)=>r.app===Be.zj.Explore&&(l.meta?.custom?.resultType==="vector"||l.meta?.custom?.resultType==="scalar")?!0:r.targets.find(g=>g.refId===l.refId)?.format==="table",Ce=(l,r)=>r.targets.find(g=>g.refId===l.refId)?.format==="heatmap";function Ze(l,r,v){H.v.featureToggles.prometheusDataplane&&l.data.forEach(U=>{const q=r.targets.find(K=>K.refId===U.refId);q&&q.legendFormat==="__auto"&&U.fields.forEach(K=>{if(K.labels?.__name__&&K.labels?.__name__===K.name){const Me={...K,name:G.M5};K.config.displayNameFromDS=(0,Re.$w)(Me,U,l.data)}})});const[g,S]=(0,T.partition)(l.data,U=>Oe(U,r)),D=Ne(g),[$,V]=(0,T.partition)(S,U=>U.meta?.custom?.resultType==="exemplar"),{exemplarTraceIdDestinations:W}=v,z=$.map(U=>{if(W?.length)for(const q of W){const K=U.fields.find(Me=>Me.name===q.name);if(K){const Me=Ue(q);K.config.links=K.config.links?.length?[...K.config.links,...Me]:Me}}return{...U,meta:{...U.meta,dataTopic:b.w5.Annotations}}}),[J,De]=(0,T.partition)(V,U=>Ce(U,r));J.forEach(U=>{if(U.name==null){let q=U.fields.find(K=>K.name==="Value");if(q){let K=q.labels?.le;K&&(U.name=K,q.config.displayNameFromDS=K)}}});const Z=(0,T.groupBy)(J,U=>U.refId);let ne=[];for(const U in Z){const q=Z[U],K=(0,T.groupBy)(q,Me=>{const k=Me.fields.find(Ve=>Ve.name===G.M5);if(k?.labels&&We in k.labels){const{le:Ve,...ut}=k?.labels;return Object.values(ut).join()}return Object.values(k?.labels??[]).join()});(0,T.forOwn)(K,(Me,k)=>{const Ve=Me.sort(Xe);ne.push(Ge(je(Ve)))})}const Pe=De.map(U=>({...U,meta:{...U.meta,preferredVisualisationType:"graph"}})),qe=(0,T.flatten)(ne);return{...l,data:[...Pe,...D,...qe,...z]}}const We="le";function Ne(l){if(l.length===0||l.length===1&&l[0].length===0)return l;const r=(0,T.groupBy)(l,"refId"),v=Object.keys(r);return v.map(S=>{const D=at(v.length,S),$=Ye({data:[],valueName:D}),V=Ke([]),W=[];r[S].forEach(J=>{const Z=J.fields[1]?.labels??{};Object.keys(Z).sort().forEach(ne=>{if(!W.some(Pe=>Pe.name===ne)){const Pe=ne===We;W.push({name:ne,config:{filterable:!0},type:Pe?G.fS.number:G.fS.string,values:[]})}})}),r[S].forEach(J=>{const De=J.fields[0]?.values??[],Z=J.fields[1]?.values??[];De.forEach(ne=>V.values.push(ne)),Z.forEach(ne=>{$.values.push(xe(ne));const Pe=J.fields[1].labels??{};W.forEach(qe=>qe.values.push(ze(Pe,qe.name)))})});const z=[V,...W,$];return{refId:S,fields:z,meta:{...l[0].meta,preferredVisualisationType:"rawPrometheus"},length:V.values.length}})}function at(l,r=""){return l>1?`Value #${r}`:"Value"}function Ae(l,r){const v={format:r.target.format,step:r.query.step,legendFormat:r.target.legendFormat,start:r.query.start,end:r.query.end,query:r.query.expr,responseListLength:r.responseListLength,scopedVars:r.scopedVars,refId:r.target.refId,valueWithRefId:r.target.valueWithRefId,meta:{preferredVisualisationType:r.query.instant?"rawPrometheus":"graph"}},g=l.data.data;if((0,be.WS)(g)){const D=[];g.forEach(W=>{const z=W.exemplars.map(J=>({[G.Ls]:J.timestamp*1e3,[G.M5]:J.value,...J.labels,...W.seriesLabels}));D.push(...z)});const $=lt(D,v),V=new c.i($);if(V.meta={dataTopic:b.w5.Annotations},r.exemplarTraceIdDestinations?.length)for(const W of r.exemplarTraceIdDestinations){const z=V.fields.find(J=>J.name===W.name);if(z){const J=Ue(W);z.config.links=z.config.links?.length?[...z.config.links,...J]:J}}return[V]}if(!g?.result)return[];if(g.resultType==="scalar")return[{meta:v.meta,refId:v.refId,length:1,fields:[Ke([g.result]),Ye({data:[g.result]})]}];if(v.format==="table")return[Qe(g.result,v)];const S=[];return g.result.forEach(D=>S.push(nt(D,v))),v.format==="heatmap"?Ge(je(S.sort(Xe))):S}function Ue(l){const r=[];if(l.datasourceUid){const g=(0,Ie.F)().getInstanceSettings(l.datasourceUid);g&&r.push({title:l.urlDisplayLabel||`Query with ${g?.name}`,url:"",internal:{query:{query:"${__value.raw}",queryType:"traceql"},datasourceUid:l.datasourceUid,datasourceName:g?.name??"Data source not found"}})}return l.url&&r.push({title:l.urlDisplayLabel||`Go to ${l.url}`,url:l.url,targetBlank:!0}),r}function lt(l,r){const v=r.step||15,g={},S=[];for(const W of l){const z=String(Math.floor(W[G.Ls]/1e3/v)*v*1e3);g[z]||(g[z]=[]),g[z].push(W),S.push(W[G.M5])}const D=(0,h.deviation)(S),$=Object.keys(g).sort(),V=[];for(const W of $){const z=g[W];if(z.length===1)V.push(z[0]);else{const De=z.map(Z=>Z[G.M5]).sort(h.descending).reduce((Z,ne)=>{if(Z.length===0)Z.push(ne);else{const Pe=Z[Z.length-1];D&&Pe-ne>=2*D&&Z.push(ne)}return Z},[]);V.push(...De.map(Z=>z.find(ne=>ne[G.M5]===Z)))}}return V}function nt(l,r){const{name:v,labels:g}=it(l.metric,r),S=[];if((0,be.el)(l)){const D=r.step?r.step*1e3:NaN;let $=r.start*1e3;const V=[];for(const z of l.values){let J=xe(z[1]);isNaN(J)&&(J=null);const De=z[0]*1e3;for(let Z=$;Z<De;Z+=D)V.push([Z,null]);$=De+D,V.push([De,J])}const W=r.end*1e3;for(let z=$;z<=W;z+=D)V.push([z,null]);S.push(Ke(V,!0)),S.push(Ye({data:V,parseValue:!1,labels:g,displayNameFromDS:v}))}else S.push(Ke([l.value])),S.push(Ye({data:[l.value],labels:g,displayNameFromDS:v}));return{meta:r.meta,refId:r.refId,length:S[0].values.length,fields:S,name:v}}function Qe(l,r){if(!l||l.length===0)return{meta:r.meta,refId:r.refId,length:0,fields:[]};const v=r.responseListLength>1||r.valueWithRefId?`Value #${r.refId}`:"Value",g=Ke([]),S=Object.keys(l.reduce(($,V)=>({...$,...V.metric}),{})).sort().map($=>({name:$,config:{filterable:!0},type:$===We?G.fS.number:G.fS.string,values:[]})),D=Ye({data:[],valueName:v});return l.forEach($=>{(0,be.el)($)?$.values.forEach(V=>{g.values.push(V[0]*1e3),S.forEach(W=>W.values.push(ze($.metric,W.name))),D.values.push(xe(V[1]))}):(g.values.push($.value[0]*1e3),S.forEach(V=>V.values.push(ze($.metric,V.name))),D.values.push(xe($.value[1])))}),{meta:r.meta,refId:r.refId,length:g.values.length,fields:[g,...S,D]}}function ze(l,r){return l.hasOwnProperty(r)?r===We?xe(l[r]):l[r]:""}function Ke(l,r=!1){return{name:G.Ls,type:G.fS.time,config:{},values:l.map(v=>r?v[0]:v[0]*1e3)}}function Ye({data:l,valueName:r=G.M5,parseValue:v=!0,labels:g,displayNameFromDS:S}){return{name:r,type:G.fS.number,display:(0,Je.U_)(),config:{displayNameFromDS:S},labels:g,values:l.map(D=>v?xe(D[1]):D[1])}}function it(l,r){if(r?.legendFormat)return{name:(0,Se.W)((0,He.J)().replace(r.legendFormat,r?.scopedVars),l),labels:l};const{__name__:v,...g}=l,S=(0,me.aA)(g);let D=`${v??""}${S}`;return D||(D=r.query),{name:D,labels:g}}function ct(l){const r=l.__name__||"";delete l.__name__;const v=Object.entries(l).map(g=>`${g[0]}="${g[1]}"`).join(",");return`${r}{${v}}`}function Ge(l){if(l.length===0||l.length===1&&l[0].length===0)return[];const r=l[0].fields.find(g=>g.type===G.fS.time),v=l.map(g=>{let S=g.fields.find(D=>D.type===G.fS.number);return{...S,name:S.config.displayNameFromDS}});return[{...l[0],meta:{...l[0].meta,type:Ee.P.HeatmapRows},fields:[r,...v]}]}function je(l){for(let r=l.length-1;r>0;r--){const v=l[r].fields.find(S=>S.name===G.M5),g=l[r-1].fields.find(S=>S.name===G.M5);if(!v||!g)throw new Error("Prometheus heatmap transform error: data should be a time series");for(let S=0;S<v.values.length;S++){const D=g.values[S]||[0];v.values[S]-=D}}return l}function Xe(l,r){let v,g;try{v=xe(l.name??l.fields[1].name),g=xe(r.name??r.fields[1].name)}catch(S){return console.error(S),0}return v>g?1:v<g?-1:0}function xe(l){return we.test(l)?l[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:parseFloat(l)}},37462:(ot,Te,i)=>{i.d(Te,{WS:()=>$e,el:()=>T,jo:()=>G,pD:()=>Be,x3:()=>h});var h=(b=>(b.Low="Low",b.Medium="Medium",b.High="High",b.None="None",b))(h||{});function T(b){return"values"in b}function $e(b){return b==null||!Array.isArray(b)?!1:b.length?"exemplars"in b[0]:!1}var Be=(b=>(b.Auto="__auto",b.Verbose="__verbose",b.Custom="__custom",b))(Be||{}),G=(b=>(b[b.LabelNames=0]="LabelNames",b[b.LabelValues=1]="LabelValues",b[b.MetricNames=2]="MetricNames",b[b.VarQueryResult=3]="VarQueryResult",b[b.SeriesQuery=4]="SeriesQuery",b))(G||{})},77899:(ot,Te,i)=>{i.r(Te),i.d(Te,{plugin:()=>Et});var h=i(66111),T=i(36873),$e=i(3947),Be=i(99098),G=i(72293),b=i(35645),c=i(40538),Je=i(34315),me=i(91511),Ee=i(10),Re=i(90024),H=i(77564),Ie=i(9892),He=i(76095),Se=i(39393),be=i(87670),we=i(72648),Oe=i(60325),Ce=i(729),Ze=i(3200),We=i(85511),Ne=i(20888),at=i(7211),Ae=i(2703),Ue=i(30471),lt=i(52081),nt=i(31403),Qe=i(9398),ze=i(16225);const Ke=e=>e.hover.seriesIdx===2?h.createElement(ze.H,{data:e.data.exemplars,rowIndex:e.hover.dataIdx,header:"Exemplar"}):h.createElement(Ye,{...e}),Ye=({data:e,hover:n,showHistogram:t})=>{const o=n.dataIdx,a=e.heatmap?.fields[0],s=e.heatmap?.fields[1],d=e.heatmap?.fields[2],m=u=>{if(a?.display)return(0,Ae.zc)(a.display(u));if(a?.type===Be.fS.time){const E="YYYY-MM-DD HH:mm:ss";return(0,Qe.h4)().getCurrent()?.formatDate(u,E)}return`${u}`},w=a?.values,M=s?.values,B=d?.values,Y=(0,H.d8)(e.heatmap),R=s?.display?u=>(0,Ae.zc)(s.display(u)):u=>`${u}`,fe=o%e.yBucketCount;let Q,de,A;if(Y.yOrdinalDisplay){const u=e.yLayout===c.kv.le?fe-1:fe,E=e.yLayout===c.kv.le?fe:fe+1;Q=u<0?Y.yMinDisplay:`${Y.yOrdinalDisplay[u]}`,de=`${Y.yOrdinalDisplay[E]}`,(!Y.yOrdinalLabel||Number.isNaN(+Y.yOrdinalLabel[0]))&&(A=e.yLayout===c.kv.le?de:Q)}else{const u=M?.[fe];if(e.yLayout===c.kv.le)if(de=`${u}`,e.yLog){let j=(e.yLog===2?Math.log2:Math.log10)(u)-1/e.yLogSplit;Q=`${e.yLog**j}`}else Q=`${u-e.yBucketSize}`;else if(Q=`${u}`,e.yLog){let j=(e.yLog===2?Math.log2:Math.log10)(u)+1/e.yLogSplit;de=`${e.yLog**j}`}else de=`${u+e.yBucketSize}`}let ee,I;e.xLayout===c.kv.le?(I=w?.[o],ee=I-e.xBucketSize):(ee=w?.[o],I=ee+e.xBucketSize);const N=B?.[o],se=e.heatmap?.fields.filter(u=>!Boolean(u.config.custom?.hideFrom?.tooltip)),P=[],le=new Set;for(const u of se??[])if(u.getLinks){const E=u.values[o],j=u.display?u.display(E):{text:`${E}`,numeric:+E};u.getLinks({calculatedValue:j,valueRowIndex:o}).forEach(ce=>{const X=`${ce.title}/${ce.href}`;le.has(X)||(P.push(ce),le.add(X))})}let _=(0,h.useRef)(null),re=150,oe=50,C=Math.round(re*devicePixelRatio),F=Math.round(oe*devicePixelRatio);(0,h.useEffect)(()=>{if(t){let u=_.current?.getContext("2d");if(u&&w&&M&&B){let E=o;for(;w[E--]===w[o];);E++;let j=E+e.yBucketCount,ce=0,X=E;for(;X<j;){let O=B[X];ce=Math.max(ce,O),X++}let he=new Path2D,pe=new Path2D;X=E;let ve=0;for(;X<j;){let O=B[X];if(O>0){let ue=O/ce,Fe=ve/(e.yBucketCount+1);(X===o?he:pe).rect(Math.round(C*Fe),Math.round(F*(1-ue)),Math.round(C/e.yBucketCount),Math.round(F*ue))}X++,ve++}u.clearRect(0,0,C,F),u.fillStyle="#ffffff80",u.fill(pe),u.fillStyle="#ff000080",u.fill(he)}}},[o]);const[ie]=(0,h.useState)(()=>e.heatmap?.meta?.type===Se.P.HeatmapCells&&!(0,H.qJ)(e.heatmap));if(ie)return h.createElement("div",null,h.createElement(ze.H,{data:e.heatmap,rowIndex:o}));const Le=()=>{if(A)return h.createElement("div",null,"Name: ",A);switch(e.yLayout){case c.kv.unknown:return h.createElement("div",null,R(Q))}return h.createElement("div",null,"Bucket: ",R(Q)," - ",R(de))};return h.createElement(h.Fragment,null,h.createElement("div",null,h.createElement("div",null,m(ee)),e.xLayout!==c.kv.unknown&&h.createElement("div",null,m(I))),t&&h.createElement("canvas",{width:C,height:F,ref:_,style:{width:C+"px",height:F+"px"}}),h.createElement("div",null,Le(),h.createElement("div",null,(0,Ue.CZ)(d,e.heatmap),": ",e.display(N))),P.length>0&&h.createElement(lt.wc,null,P.map((u,E)=>h.createElement(nt.Qj,{key:E,icon:"external-link-alt",target:u.target,href:u.href,onClick:u.onClick,fill:"text",style:{width:"100%"}},u.title))))};var it=i(17587),ct=i(6194),Ge=i(30749),je=i(75974),Xe=i(23588),xe=i(75133),l=i(56632),r=i(13347),v=i(60892);function g(e){const{dataRef:n,theme:t,eventBus:o,onhover:a,onclick:s,onzoom:d,isToolTipOpen:m,timeZone:w,getTimeRange:M,palette:B,cellGap:Y,hideLE:R,hideGE:fe,yAxisConfig:Q,ySizeDivisor:de,sync:A,eventsScope:ee="__global_"}=e,I="x";let N="time",se=!0;n.current?.heatmap?.fields[0].type!==Be.fS.time&&(N=n.current?.heatmap?.fields[0].config?.unit??"x",se=!1);const P=devicePixelRatio;let le=n.current?.heatmap?.meta?.type;const _=t.visualization.getColorByName(e.exemplarColor);let re,oe,C=new r.U(w),F;C.addHook("init",p=>{p.root.querySelectorAll(".u-cursor-pt").forEach(x=>{Object.assign(x.style,{borderRadius:"0",border:"1px solid white",background:"transparent"})}),s&&p.over.addEventListener("mouseup",x=>{p.cursor.drag._x||p.cursor.drag._y||s(x)},!0)}),d&&C.addHook("setSelect",p=>{d({xMin:p.posToVal(p.select.left,I),xMax:p.posToVal(p.select.left+p.select.width,I)}),p.setSelect({left:0,top:0,width:0,height:0},!1)}),se&&C.addHook("setData",p=>{let{min:x,max:f}=p.scales.x,L=M().from.valueOf(),y=M().to.valueOf();(x!==L||f!==y)&&queueMicrotask(()=>{p.setScale(I,{min:L,max:y})})}),C.addHook("syncRect",(p,x)=>{F=x});const ie={point:{[N]:null},data:n.current?.heatmap},Le=new Xe.es(ie);let u;a&&C.addHook("setLegend",p=>{if(p.cursor.idxs!=null)for(let x=0;x<p.cursor.idxs.length;x++){const f=p.cursor.idxs[x];if(f!=null){const{left:L,top:y}=p.cursor;ie.rowIndex=f,ie.point[N]=p.posToVal(L,I),o.publish(Le),m.current||(u&&(clearTimeout(u),u=0),a({seriesIdx:x,dataIdx:f,pageX:F.left+L,pageY:F.top+y}));return}}m.current||u||(u=setTimeout(()=>{a(null),ie.rowIndex=void 0,ie.point[N]=null,o.publish(Le)},100))}),C.addHook("drawClear",p=>{re=re||new v.lW(0,0,p.bbox.width,p.bbox.height),re.clear(),p.series.forEach((x,f)=>{f>0&&(x._paths=null)})}),C.setMode(2),C.addScale({scaleKey:I,isTime:se,orientation:c.wN.Horizontal,direction:c.bQ.Right,range:(p,x,f)=>{if(se)return[M().from.valueOf(),M().to.valueOf()];if(n.current?.xLayout===c.kv.le)return[x-n.current?.xBucketSize,f];if(n.current?.xLayout===c.kv.ge)return[x,f+n.current?.xBucketSize];{let L=n.current?.xBucketSize/2;return[x-L,f+L]}}});let E;if(!se){E=[];for(let p=0;p<10;p++)E.push(p*n.current?.xBucketSize)}C.addAxis({scaleKey:I,placement:c.LB.Bottom,incrs:E,isTime:se,theme:t,timeZone:w});const j=n.current?.heatmap?.fields[1];if(!j)return C;const X=j.config?.custom?.scaleDistribution??{type:c.wf.Linear},he=Boolean(Q.reverse),pe=le===Se.P.HeatmapCells&&!(0,H.qJ)(n.current?.heatmap),ve=X.type!==c.wf.Linear||pe,O=(0,H.d8)(n.current?.heatmap).yOrdinalDisplay!=null,ue="y_"+(Math.random()+1).toString(36).substring(7);C.addScale({scaleKey:ue,isTime:!1,orientation:c.wN.Vertical,direction:he?c.bQ.Down:c.bQ.Up,distribution:ve?c.wf.Log:c.wf.Linear,log:X.log??2,range:pe?(p,x,f)=>{let L,y;if([L,y]=ve?je.Z.rangeLog(x,f,X.log??2,!0):[x,f],ve&&!O){let te=p.scales[ue].log,ye=te===2?Math.log2:Math.log10,{min:ae,max:_e}=Q;if(ae!=null&&ae>0){let et=ye(ae);L=te**(0,xe.mB)(et,1)}if(_e!=null&&_e>0){let et=ye(_e);y=te**(0,xe.UO)(et,1)}}return[L,y]}:(p,x,f)=>{let L=x,y=f,{min:te,max:ye}=Q;if(ve){let ae=p.scales[ue].log,_e=!1,et=!1,rt=ae===2?Math.log2:Math.log10;if(de!==1){let tt=rt(x),ft=rt(f);Number.isInteger(tt)||(L=ae**(0,xe.mB)(tt,1),_e=!0),Number.isInteger(ft)||(y=ae**(0,xe.UO)(ft,1),et=!0)}if(n.current?.yLayout===c.kv.le?_e||(L/=ae):n.current?.yLayout===c.kv.ge?et||(y*=ae):(L/=ae/2,y*=ae/2),!O){if(te!=null&&te>0){let tt=rt(te);L=ae**(0,xe.mB)(tt,1)}if(ye!=null&&ye>0){let tt=rt(ye);y=ae**(0,xe.UO)(tt,1)}}}else{let ae=n.current?.yBucketSize;ae===0&&(ae=1),ae&&(n.current?.yLayout===c.kv.le?L-=ae:n.current?.yLayout===c.kv.ge?y+=ae:(L-=ae/2,y+=ae/2)),O||(L=te??L,y=ye??y)}return[L,y]}});const Fe=j.display??(0,Ae.Cf)("short");C.addAxis({scaleKey:ue,show:Q.axisPlacement!==c.LB.Hidden,placement:Q.axisPlacement||c.LB.Left,size:Q.axisWidth||null,label:Q.axisLabel,theme:t,formatValue:(p,x)=>(0,Ae.zc)(Fe(p,x)),splits:O?p=>{const x=(0,H.d8)(n.current?.heatmap);if(!x.yOrdinalDisplay)return[0,1];let f=x.yOrdinalDisplay.map((L,y)=>y);switch(n.current?.yLayout){case c.kv.le:f.unshift(-1);break;case c.kv.ge:f.push(f.length);break}if(p.height<60)f=[f[0],f[f.length-1]];else for(;f.length>3&&(p.height-15)/f.length<10;)f=f.filter((L,y)=>y%2===0);return f}:void 0,values:O?(p,x)=>{const f=(0,H.d8)(n.current?.heatmap);return f.yOrdinalDisplay?x.map(L=>L<0?f.yMinDisplay??"":f.yOrdinalDisplay[L]??""):x}:void 0});const ge=pe?V:D;C.addSeries({facets:[{scale:I,auto:!0,sorted:1},{scale:ue,auto:!0}],pathBuilder:ge({each:(p,x,f,L,y,te,ye)=>{re.add({x:L-p.bbox.left,y:y-p.bbox.top,w:te,h:ye,sidx:x,didx:f})},gap:Y,hideLE:R,hideGE:fe,xAlign:n.current?.xLayout===c.kv.le?-1:n.current?.xLayout===c.kv.ge?1:0,yAlign:(n.current?.yLayout===c.kv.le?-1:n.current?.yLayout===c.kv.ge?1:0)*(he?-1:1),ySizeDivisor:de,disp:{fill:{values:(p,x)=>{let f=pe?3:2;return z(p.data[x][f],B,n.current?.minValue,n.current?.maxValue)},index:B}}}),theme:t,scaleKey:""}),C.addSeries({facets:[{scale:I,auto:!0,sorted:1},{scale:ue,auto:!0}],pathBuilder:$({each:(p,x,f,L,y,te,ye)=>{re.add({x:L-p.bbox.left,y:y-p.bbox.top,w:te,h:ye,sidx:x,didx:f})}},_),theme:t,scaleKey:""});const ke={drag:{x:!0,y:!1,setScale:!1},dataIdx:(p,x)=>{if(x===1){oe=null;let f=p.cursor.left*P,L=p.cursor.top*P;re.get(f,L,1,1,y=>{(0,v.Pn)(f,L,y.x,y.y,y.x+y.w,y.y+y.h)&&(oe=y)})}return oe&&x===oe.sidx?oe.didx:null},points:{fill:"rgba(255,255,255, 0.3)",bbox:(p,x)=>{let f=oe&&x===oe.sidx;return{left:f?oe.x/P:-10,top:f?oe.y/P:-10,width:f?oe.w/P:0,height:f?oe.h/P:0}}}};return A&&A()!==l.m.Off&&(ke.sync={key:ee,scales:[I,ue],filters:{pub:(p,x,f,L,y,te,ye)=>(f<0?(ie.point[N]=null,o.publish(new Xe.xH)):(ie.point[N]=x.posToVal(f,I),o.publish(Le)),!0)}},C.setSync()),C.setCursor(ke),C}const S=4;function D(e){const{disp:n,each:t,gap:o=1,hideLE:a=-1/0,hideGE:s=1/0,xAlign:d=1,yAlign:m=1,ySizeDivisor:w=1}=e,M=devicePixelRatio,B=o>=S?Math.round:R=>R,Y=Math.round(o*M);return(R,fe)=>(je.Z.orient(R,fe,(Q,de,A,ee,I,N,se,P,le,_,re,oe,C,F,ie)=>{let Le=R.data[fe];const u=Le[0],E=Le[1],j=Le[2],ce=u.length;let X=n.fill.values(R,fe),he=n.fill.index??[...new Set(X)],pe=he.map(y=>new Path2D),ve=ce-E.lastIndexOf(E[0]),O=ce/ve,ue=E[1]-E[0]||I.max-I.min,Fe=u[ve]-u[0],ge,ke;ee.distr===3?ge=Math.abs(N(u[0]*ee.log,ee,_,P)-N(u[0],ee,_,P)):ge=Math.abs(N(Fe,ee,_,P)-N(0,ee,_,P)),I.distr===3?ke=Math.abs(se(E[0]*I.log,I,re,le)-se(E[0],I,re,le))/w:ke=Math.abs(se(ue,I,re,le)-se(0,I,re,le))/w,ge=Math.max(1,B(ge-Y)),ke=Math.max(1,B(ke-Y));let p=d===-1?-ge:d===0?-ge/2:0,x=m===1?-ke:m===0?-ke/2:0,f=E.slice(0,ve).map(y=>B(se(y,I,re,le)+x)),L=Array.from({length:O},(y,te)=>B(N(u[te*ve],ee,_,P)+p));for(let y=0;y<ce;y++)if(j[y]>a&&j[y]<s){let te=L[~~(y/ve)],ye=f[y%ve],ae=pe[X[y]];F(ae,te,ye,ge,ke),t(R,1,y,te,ye,ge,ke)}return R.ctx.save(),R.ctx.rect(R.bbox.left,R.bbox.top,R.bbox.width,R.bbox.height),R.ctx.clip(),pe.forEach((y,te)=>{R.ctx.fillStyle=he[te],R.ctx.fill(y)}),R.ctx.restore(),null}),null)}function $(e,n){return(t,o)=>(je.Z.orient(t,o,(a,s,d,m,w,M,B,Y,R,fe,Q,de,A,ee,I)=>{let N=new Path2D,se=[N],P=[n??"rgba(255,0,255,0.7)"];for(let le=0;le<s.length;le++){let _=d[le];_-=.5;let re=Math.round(Math.random())*2-1;_+=re*.5*Math.random();let oe=M(s[le],m,fe,Y),C=B(_,w,Q,R),F=8,ie=8;ee(N,oe-F/2,C-ie/2,F,ie),e.each(t,o,le,oe-F/2,C-ie/2,F,ie)}t.ctx.save(),t.ctx.rect(t.bbox.left,t.bbox.top,t.bbox.width,t.bbox.height),t.ctx.clip(),se.forEach((le,_)=>{t.ctx.fillStyle=P[_],t.ctx.fill(le)}),t.ctx.restore()}),null)}function V(e){const{disp:n,each:t,gap:o=1,hideLE:a=-1/0,hideGE:s=1/0}=e,d=devicePixelRatio,m=o>=S?Math.round:M=>M,w=Math.round(o*d);return(M,B)=>(je.Z.orient(M,B,(Y,R,fe,Q,de,A,ee,I,N,se,P,le,_,re,oe)=>{let C=M.data[B];const F=C[0],ie=C[1],Le=C[2],u=C[3],E=F.length;let j=n.fill.values(M,B),ce=n.fill.index??[...new Set(j)],X=ce.map(O=>new Path2D),he=new Map,pe=new Map;for(let O=0;O<F.length;O++){let ue=F[O],Fe=ie[O],ge=Le[O];he.has(ue)||he.set(ue,m(A(ue,Q,se,I))),pe.has(Fe)||pe.set(Fe,m(ee(Fe,de,P,N))),pe.has(ge)||pe.set(ge,m(ee(ge,de,P,N)))}let ve=he.get(F.find(O=>O!==F[0]))-he.get(F[0]);for(let O=0;O<E;O++){if(u[O]<=a||u[O]>=s)continue;let ue=F[O],Fe=ie[O],ge=Le[O],ke=he.get(ue),p=pe.get(Fe),x=pe.get(ge),f=ve,L=p-x;f=Math.max(1,f-w),L=Math.max(1,L-w);let y=ke,te=p,ye=X[j[O]];re(ye,y,te,f,L),t(M,1,O,y,te,f,L)}M.ctx.save(),M.ctx.rect(M.bbox.left,M.bbox.top,M.bbox.width,M.bbox.height),M.ctx.clip(),X.forEach((O,ue)=>{M.ctx.fillStyle=ce[ue],M.ctx.fill(O)}),M.ctx.restore()}),null)}const W=(e,n,t,o=-1/0,a=1/0)=>{if(n==null){n=1/0;for(let s=0;s<e.length;s++)e[s]>o&&e[s]<a&&(n=Math.min(n,e[s]))}if(t==null){t=-1/0;for(let s=0;s<e.length;s++)e[s]>o&&e[s]<a&&(t=Math.max(t,e[s]))}return[n,t]},z=(e,n,t,o)=>{let a=o-t||1,s=n.length,d=Array(e.length);for(let m=0;m<e.length;m++)d[m]=e[m]<t?0:e[m]>o?s-1:Math.min(s-1,Math.floor(s*(e[m]-t)/a));return d};function J(e,n,t,o,a){if(!e?.length)return{};const s=n?.find(m=>m.name==="exemplar");if(a&&s?.fields.forEach((m,w)=>{s.fields[w].getLinks=a(s,m)}),t.calculate)return Z((0,H.xf)(e,t.calculation??{}),s,t,o);let d;for(const m of e)switch(m.meta?.type){case Se.P.HeatmapCells:return(0,H.qJ)(m)?Z(m,s,t,o):De(m,s,t,o);case Se.P.HeatmapRows:d=m}if(!d)if(e.length>1)e.every(w=>!Number.isNaN((0,Ge.Ky)(w.name??w.fields[1].name)))&&e.sort(Ge.nf),d=[(0,it._9)({frames:e})][0];else{let m=e[0],w=m.fields.filter(B=>B.type===Be.fS.number);w.every(B=>!Number.isNaN((0,Ge.Ky)(B.name)))?(w.sort((B,Y)=>(0,Ge.Ky)(B.name)-(0,Ge.Ky)(Y.name)),d={...m,fields:[m.fields.find(B=>B.type===Be.fS.time),...w]}):d=m}return Z((0,H.Cj)({unit:t.yAxis?.unit,decimals:t.yAxis?.decimals,...t.rowsFrame,frame:d}),s,t,o)}const De=(e,n,t,o)=>{if(e.meta?.type!==Se.P.HeatmapCells||(0,H.qJ)(e))return{warning:"Expected sparse heatmap format",heatmap:e};ne(e.fields[1],t.yAxis,o);const a=ne(e.fields[3],t.cellValues,o);let[s,d]=W(e.fields[3].values,t.color.min,t.color.max,t.filterValues?.le,t.filterValues?.ge);return{heatmap:e,minValue:s,maxValue:d,exemplars:n,display:m=>(0,Ae.zc)(a(m))}},Z=(e,n,t,o)=>{if(e.meta?.type!==Se.P.HeatmapCells)return{warning:"Expected heatmap scanlines format",heatmap:e};if(e.fields.length<2||e.length<2)return{heatmap:e};const a=(0,H.d8)(e);let s,d,m;for(const P of e.fields)switch(P.name){case"y":d=P.name;case"yMin":case"yMax":{d||(d=P.name),a.yOrdinalDisplay==null&&ne(P,t.yAxis,o);break}case"x":case"xMin":case"xMax":s=P.name;break;default:P.type===Be.fS.number&&!m&&(m=P)}if(!d)return{warning:"Missing Y field",heatmap:e};if(!d)return{warning:"Missing X field",heatmap:e};if(!m)return{warning:"Missing value field",heatmap:e};const w=ne(m,t.cellValues,o),M=e.fields[0].values,B=e.fields[1].values,Y=M.length;let R=Y-B.lastIndexOf(B[0]),fe=Y/R,Q=B[1]-B[0],de=M[R]-M[0],[A,ee]=W(m.values,t.color.min,t.color.max,t.filterValues?.le,t.filterValues?.ge),I=t.calculation?.xBuckets,N=t.calculation?.yBuckets;return{heatmap:e,exemplars:n?.length?n:void 0,xBucketSize:de,yBucketSize:Q,xBucketCount:fe,yBucketCount:R,yLog:N?.scale?.log??0,xLog:I?.scale?.log??0,xLogSplit:I?.scale?.log?+(I?.value??"1"):1,yLogSplit:N?.scale?.log?+(N?.value??"1"):1,minValue:A,maxValue:ee,xLayout:s==="xMax"?c.kv.le:s==="xMin"?c.kv.ge:c.kv.unknown,yLayout:d==="yMax"?c.kv.le:d==="yMin"?c.kv.ge:c.kv.unknown,display:P=>(0,Ae.zc)(w(P))}};function ne(e,n,t){if(n?.unit?.length||n?.decimals!=null){const{unit:o,decimals:a}=n;e.display=void 0,e.config={...e.config},o?.length&&(e.config.unit=o),a!=null&&(e.config.decimals=a)}return e.display||(e.display=(0,ct.U_)({field:e,theme:t})),e.display}var Pe=i(47700),qe=i(65356),U=i(28550),q=(e=>(e.Opacity="opacity",e.Scheme="scheme",e))(q||{}),K=(e=>(e.Exponential="exponential",e.Linear="linear",e))(K||{});const Me={calculate:!1,cellGap:1,cellValues:{},color:{scheme:"Oranges",fill:"dark-orange",reverse:!1,exponent:.5,steps:64},exemplars:{color:"rgba(255,0,255,0.7)"},filterValues:{le:1e-9},legend:{show:!0},showValue:c.Jp.Auto,tooltip:{show:!0,yHistogram:!1}},k={...Me,color:{...Me.color,mode:q.Scheme,scale:K.Exponential},yAxis:{...Me.yAxis,axisPlacement:c.LB.Left},rowsFrame:{...Me.rowsFrame,layout:c.kv.auto}},Ve=[{name:"BrBG",invert:"always"},{name:"PiYG",invert:"always"},{name:"PRGn",invert:"always"},{name:"PuOr",invert:"always"},{name:"RdBu",invert:"always"},{name:"RdGy",invert:"always"},{name:"RdYlBu",invert:"always"},{name:"RdYlGn",invert:"always"},{name:"Spectral",invert:"always"},{name:"Blues",invert:"dark"},{name:"Greens",invert:"dark"},{name:"Greys",invert:"dark"},{name:"Oranges",invert:"dark"},{name:"Purples",invert:"dark"},{name:"Reds",invert:"dark"},{name:"Turbo",invert:"light"},{name:"Cividis",invert:"light"},{name:"Viridis",invert:"light"},{name:"Magma",invert:"light"},{name:"Inferno",invert:"light"},{name:"Plasma",invert:"light"},{name:"Warm",invert:"light"},{name:"Cool",invert:"light"},{name:"Cubehelix",invert:"light",name2:"CubehelixDefault"},{name:"BuGn",invert:"dark"},{name:"BuPu",invert:"dark"},{name:"GnBu",invert:"dark"},{name:"OrRd",invert:"dark"},{name:"PuBuGn",invert:"dark"},{name:"PuBu",invert:"dark"},{name:"PuRd",invert:"dark"},{name:"RdPu",invert:"dark"},{name:"YlGnBu",invert:"dark"},{name:"YlGn",invert:"dark"},{name:"YlOrBr",invert:"dark"},{name:"YlOrRd",invert:"dark"},{name:"Rainbow",invert:"always"},{name:"Sinebow",invert:"always"}],ut=Ve.find(e=>e.name==="Spectral");function dt(e,n){const t={...k.color,...e},o=[],a=(t.steps??128)-1;if(e.mode===q.Opacity){const s=(0,U.Z)(n.visualization.getColorByName(e.fill)).toPercentageRgb(),d=t.scale===K.Exponential?Pe.scalePow().exponent(t.exponent).domain([0,1]).range([0,1]):Pe.scaleLinear().domain([0,1]).range([0,1]);for(let m=0;m<=a;m++)s.a=d(m/a),o.push((0,U.Z)(s).toString("hex8"))}else{const s=Ve.find(w=>w.name===t.scheme)??ut;let d="interpolate"+(s.name2??s.name);const m=qe[d];for(let w=0;w<=a;w++){let M=m(w/a),B=M.indexOf("rgb")===0?"#"+[...M.matchAll(/\d+/g)].map(Y=>(+Y[0]).toString(16).padStart(2,"0")).join(""):M;o.push(B)}(s.invert==="always"||s.invert==="dark"&&n.isDark||s.invert==="light"&&n.isLight)&&o.reverse(),e.reverse&&o.reverse()}return o}const ht=({data:e,id:n,timeRange:t,timeZone:o,width:a,height:s,options:d,fieldConfig:m,eventBus:w,onChangeTimeRange:M,replaceVariables:B})=>{const Y=(0,we.l4)(),R=(0,we.wW)(pt),{sync:fe}=(0,Oe.R9)();let Q=(0,h.useRef)(t);Q.current=t;const de=(0,h.useCallback)((u,E)=>(0,He.oB)(u,E,E.state?.scopedVars??{},B),[B]),A=(0,h.useMemo)(()=>{try{return J(e.series,e.annotations,d,Y,de)}catch(u){return{warning:`${u}`}}},[e.series,e.annotations,d,Y,de]),ee=(0,h.useMemo)(()=>{let u=[],E=[];const j=(0,H.d8)(A.heatmap);return A.exemplars?.length&&j.yMatchWithLabel&&(u=A.exemplars?.fields[0].values,j.yOrdinalDisplay!=null?E=(A.exemplars?.fields.find(he=>he.name===j.yMatchWithLabel).values).map(he=>j.yOrdinalLabel?.indexOf(he)):E=A.exemplars?.fields[1].values),[null,A.heatmap?.fields.map(ce=>ce.values),[u,E]]},[A.heatmap,A.exemplars]),I=(0,h.useMemo)(()=>dt(d.color,Y),[d.color,Y]),[N,se]=(0,h.useState)(void 0),[P,le]=(0,h.useState)(!1),_=(0,h.useRef)(!1),re=()=>{_.current=!1,le(!1),C(null)},oe=()=>{_.current=!_.current,le(_.current)},C=(0,h.useCallback)(u=>{se(u??void 0)},[d,e.structureRev]),F=(0,h.useRef)(A);F.current=A;const ie=(0,h.useMemo)(()=>{const u=F.current?.heatmap?.fields[1].config?.custom?.scaleDistribution;return g({dataRef:F,theme:Y,eventBus:w,onhover:C,onclick:d.tooltip.show?oe:null,onzoom:E=>{E.xMax-E.xMin>1&&M({from:E.xMin,to:E.xMax})},isToolTipOpen:_,timeZone:o,getTimeRange:()=>Q.current,sync:fe,palette:I,cellGap:d.cellGap,hideLE:d.filterValues?.le,hideGE:d.filterValues?.ge,exemplarColor:d.exemplars?.color??"rgba(255,0,255,0.7)",yAxisConfig:d.yAxis,ySizeDivisor:u?.type===c.wf.Log?+(d.calculation?.yBuckets?.value||1):1})},[d,o,e.structureRev]),Le=()=>{if(!A.heatmap||!d.legend.show)return null;let j=F.current?.heatmap?.meta?.type===Se.P.HeatmapCells&&!(0,H.qJ)(F.current?.heatmap)?3:2;const ce=A.heatmap.fields[j];let X;return N&&A.heatmap.fields&&N.seriesIdx===1&&(X=ce.values[N.dataIdx]),h.createElement(Ce.AY.Legend,{placement:"bottom",maxHeight:"20%"},h.createElement("div",{className:R.colorScaleWrapper},h.createElement(Ee.q,{hoverValue:X,colorPalette:I,min:F.current.minValue,max:F.current.maxValue,display:A.display})))};return A.warning||!A.heatmap?h.createElement(be.Z,{panelId:n,fieldConfig:m,data:e,needsNumberField:!0,message:A.warning}):h.createElement(h.Fragment,null,h.createElement(Ce.AY,{width:a,height:s,legend:Le()},(u,E)=>h.createElement(Ze.N,{config:ie,data:ee,width:u,height:E,timeRange:t})),h.createElement(We.h_,null,N&&d.tooltip.show&&h.createElement(Ne.S,{position:{x:N.pageX,y:N.pageY},offset:{x:10,y:10},allowPointerEvents:_.current},P&&h.createElement(at.o,{onClick:re}),h.createElement(Ke,{timeRange:t,data:A,hover:N,showHistogram:d.tooltip.yHistogram}))))},pt=e=>({colorScaleWrapper:Ie.css`
    margin-left: 25px;
    padding: 10px 0;
    max-width: 300px;
  `}),gt=e=>Object.keys(e.options).length===0?mt(e,"heatmap",{angular:e},e.fieldConfig):e.options,mt=(e,n,t,o)=>{if(n==="heatmap"&&t.angular){const{fieldConfig:a,options:s}=yt({...t.angular,fieldConfig:o});return e.fieldConfig=a,s}if(n==="heatmap-new"){const{bucketFrame:a,...s}=e.options;return a?{...s,rowsFrame:a}:e.options}return{}};function yt(e){const n={defaults:{},overrides:[]},t=e.dataFormat!=="tsbuckets",o={...k.calculation},a={logBase:1,...e.yAxis};t&&(e.xBucketSize?o.xBuckets={mode:c.kW.Size,value:`${e.xBucketSize}`}:e.xBucketNumber&&(o.xBuckets={mode:c.kW.Count,value:`${e.xBucketNumber}`}),e.yBucketSize?o.yBuckets={mode:c.kW.Size,value:`${e.yBucketSize}`}:e.xBucketNumber&&(o.yBuckets={mode:c.kW.Count,value:`${e.yBucketNumber}`}),a.logBase>1&&(o.yBuckets={mode:c.kW.Count,value:+a.splitFactor>0?`${a.splitFactor}`:void 0,scale:{type:c.wf.Log,log:a.logBase}}));const s=st(e.cards?.cardPadding,2),d={calculate:t,calculation:o,color:{...k.color,steps:128},cellGap:s||1,cellRadius:st(e.cards?.cardRound),yAxis:{axisPlacement:a.show===!1?c.LB.Hidden:c.LB.Left,reverse:Boolean(e.reverseYBuckets),axisWidth:st(a.width),min:a.min,max:a.max,unit:a.format,decimals:a.decimals},cellValues:{decimals:st(e.tooltipDecimals)},rowsFrame:{layout:xt(e.yBucketBound)},legend:{show:Boolean(e.legend?.show)},showValue:c.Jp.Never,tooltip:{show:Boolean(e.tooltip?.show),yHistogram:Boolean(e.tooltip?.showHistogram)},exemplars:{...k.exemplars}};e.hideZeroBuckets&&(d.filterValues={...k.filterValues});const m=e.color??{};switch(m?.mode){case"spectrum":{d.color.mode=q.Scheme;const w=m.colorScheme;let M=Ve.find(B=>B.name===w);M||(M=Ve.find(B=>w.indexOf(B.name)>=0)),d.color.scheme=M?M.name:k.color.scheme;break}case"opacity":{d.color.mode=q.Opacity,d.color.scale=m.scale;break}}return d.color.fill=m.cardColor,d.color.min=m.min,d.color.max=m.max,typeof m.min=="number"&&typeof m.max=="number"&&m.min>m.max&&(d.color.min=m.max,d.color.max=m.min,d.color.reverse=!0),{fieldConfig:n,options:d}}function xt(e){switch(e){case"upper":return c.kv.ge;case"lower":return c.kv.le;case"middle":return c.kv.unknown}return c.kv.auto}function st(e,n){if(e==null||e==="")return n;const t=+e;return isNaN(t)?n:t}class vt{getSuggestionsForData(n){const{dataSummary:t}=n;if(!n.data?.series||!t.hasData||t.timeFieldCount<1||t.numberFieldCount<2||t.numberFieldCount>10)return;const o=J(n.data.series,void 0,k,b.v.theme2);!o||o.warning||n.getListAppender({name:"",pluginId:"heatmap",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}})}}const Et=new T.c(ht).useFieldConfig({disableStandardOptions:Object.values($e.qb).filter(e=>e!==$e.qb.Links),useCustomConfig:e=>{e.addCustomEditor({id:"scaleDistribution",path:"scaleDistribution",name:"Y axis scale",category:["Heatmap"],editor:Je.Y,override:Je.Y,defaultValue:{type:c.wf.Linear},shouldApply:n=>n.type===Be.fS.number,process:G.kG,hideFromDefaults:!0}),(0,me.B)(e)}}).setPanelChangeHandler(mt).setMigrationHandler(gt).setPanelOptions((e,n)=>{const t=n.options??k;let o=!1;try{const s=J(n.data,void 0,t,b.v.theme2);o=(0,H.d8)(s.heatmap).yOrdinalDisplay!=null}catch{}let a=["Heatmap"];e.addRadio({path:"calculate",name:"Calculate from data",defaultValue:k.calculate,category:a,settings:{options:[{label:"Yes",value:!0},{label:"No",value:!1}]}}),t.calculate&&(0,Re.J)("calculation.",e,t.calculation,a),a=["Y Axis"],e.addRadio({path:"yAxis.axisPlacement",name:"Placement",defaultValue:k.yAxis.axisPlacement??c.LB.Left,category:a,settings:{options:[{label:"Left",value:c.LB.Left},{label:"Right",value:c.LB.Right},{label:"Hidden",value:c.LB.Hidden}]}}).addUnitPicker({category:a,path:"yAxis.unit",name:"Unit",defaultValue:void 0,settings:{isClearable:!0}}).addNumberInput({category:a,path:"yAxis.decimals",name:"Decimals",settings:{placeholder:"Auto"}}),o||e.addNumberInput({path:"yAxis.min",name:"Min value",settings:{placeholder:"Auto"},category:a}).addTextInput({path:"yAxis.max",name:"Max value",settings:{placeholder:"Auto"},category:a}),e.addNumberInput({path:"yAxis.axisWidth",name:"Axis width",defaultValue:k.yAxis.axisWidth,settings:{placeholder:"Auto",min:5},category:a}).addTextInput({path:"yAxis.axisLabel",name:"Axis label",defaultValue:k.yAxis.axisLabel,settings:{placeholder:"Auto"},category:a}),t.calculate||e.addRadio({path:"rowsFrame.layout",name:"Tick alignment",defaultValue:k.rowsFrame?.layout??c.kv.auto,category:a,settings:{options:[{label:"Auto",value:c.kv.auto},{label:"Top (LE)",value:c.kv.le},{label:"Middle",value:c.kv.unknown},{label:"Bottom (GE)",value:c.kv.ge}]}}),e.addBooleanSwitch({path:"yAxis.reverse",name:"Reverse",defaultValue:k.yAxis.reverse===!0,category:a}),a=["Colors"],e.addRadio({path:"color.mode",name:"Mode",defaultValue:k.color.mode,category:a,settings:{options:[{label:"Scheme",value:q.Scheme},{label:"Opacity",value:q.Opacity}]}}),e.addColorPicker({path:"color.fill",name:"Color",defaultValue:k.color.fill,category:a,showIf:s=>s.color.mode===q.Opacity}),e.addRadio({path:"color.scale",name:"Scale",defaultValue:k.color.scale,category:a,settings:{options:[{label:"Exponential",value:K.Exponential},{label:"Linear",value:K.Linear}]},showIf:s=>s.color.mode===q.Opacity}),e.addSliderInput({path:"color.exponent",name:"Exponent",defaultValue:k.color.exponent,category:a,settings:{min:.1,max:2,step:.1},showIf:s=>s.color.mode===q.Opacity&&s.color.scale===K.Exponential}),e.addSelect({path:"color.scheme",name:"Scheme",description:"",defaultValue:k.color.scheme,category:a,settings:{options:Ve.map(s=>({value:s.name,label:s.name}))},showIf:s=>s.color.mode!==q.Opacity}),e.addSliderInput({path:"color.steps",name:"Steps",defaultValue:k.color.steps,category:a,settings:{min:2,max:128,step:1}}).addBooleanSwitch({path:"color.reverse",name:"Reverse",defaultValue:k.color.reverse,category:a}).addCustomEditor({id:"__scale__",path:"__scale__",name:"",category:a,editor:()=>{const s=dt(t.color,b.v.theme2);return h.createElement("div",null,h.createElement(Ee.q,{colorPalette:s,min:1,max:100}))}}),e.addNumberInput({path:"color.min",name:"Start color scale from value",defaultValue:k.color.min,settings:{placeholder:"Auto (min)"},category:a}).addNumberInput({path:"color.max",name:"End color scale at value",defaultValue:k.color.max,settings:{placeholder:"Auto (max)"},category:a}),a=["Cell display"],t.calculate||e.addTextInput({path:"rowsFrame.value",name:"Value name",defaultValue:k.rowsFrame?.value,settings:{placeholder:"Value"},category:a}),e.addUnitPicker({category:a,path:"cellValues.unit",name:"Unit",defaultValue:void 0,settings:{isClearable:!0}}).addNumberInput({category:a,path:"cellValues.decimals",name:"Decimals",settings:{placeholder:"Auto"}}),e.addSliderInput({name:"Cell gap",path:"cellGap",defaultValue:k.cellGap,category:a,settings:{min:0,max:25}}).addNumberInput({path:"filterValues.le",name:"Hide cells with values <=",defaultValue:k.filterValues?.le,settings:{placeholder:"None"},category:a}).addNumberInput({path:"filterValues.ge",name:"Hide cells with values >=",defaultValue:k.filterValues?.ge,settings:{placeholder:"None"},category:a}),a=["Tooltip"],e.addBooleanSwitch({path:"tooltip.show",name:"Show tooltip",defaultValue:k.tooltip.show,category:a}),e.addBooleanSwitch({path:"tooltip.yHistogram",name:"Show histogram (Y axis)",defaultValue:k.tooltip.yHistogram,category:a,showIf:s=>s.tooltip.show}),a=["Legend"],e.addBooleanSwitch({path:"legend.show",name:"Show legend",defaultValue:k.legend.show,category:a}),a=["Exemplars"],e.addColorPicker({path:"exemplars.color",name:"Color",defaultValue:k.exemplars.color,category:a})}).setSuggestionsSupplier(new vt)}}]);

//# sourceMappingURL=heatmapPanel.c8491d16dd30b0a2aa02.js.map