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

//# sourceMappingURL=heatmapPanel.9df7f2a632da2f60f604.js.map