"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5711],{15711(W,M,t){t.d(M,{HeatmapTransformerEditor:()=>C});var a=t(74848),l=t(96540),O=t(29673),E=t(35687);const f=(d,v)=>{const c=v.options??{};(0,E.J)("",d,c)},C=d=>{(0,l.useEffect)(()=>{if(!d.options.xBuckets?.mode){const c=(0,O.q)(f);d.onChange({...c,...d.options})}});const v=(0,O.D)(d,f);return(0,a.jsx)("div",{children:(0,a.jsx)("div",{children:v.items.map(c=>c.renderElement())})})}},35687(W,M,t){t.d(M,{J:()=>i});var a=t(52358),l=t(28520),O=t(60606),E=t(74848),f=t(96540),C=t(58387),d=t(72396),v=t(68763),c=t(23820),m=t(86979),I=t(75251),D=t(41962);const u=({value:n,onChange:o,item:e})=>{const[s,_]=(0,f.useState)(!1),T=(0,f.useRef)(0),p=[{label:(0,a.t)("transformers.axis-editor.mode-options.label.size","Size"),value:l.J1.Size,description:(0,a.t)("transformers.axis-editor.mode-options.description.split-the-buckets-based-on-size","Split the buckets based on size")},{label:(0,a.t)("transformers.axis-editor.mode-options.label.count","Count"),value:l.J1.Count,description:(0,a.t)("transformers.axis-editor.mode-options.description.split-the-buckets-based-on-count","Split the buckets based on count")}],L=[{label:(0,a.t)("transformers.axis-editor.log-mode-options.label.split","Split"),value:l.J1.Size,description:(0,a.t)("transformers.axis-editor.log-mode-options.description.split-the-buckets-based-on-size","Split the buckets based on size")}],P=e.settings?.allowInterval??!1,h=({mode:r,scale:b,value:x=""})=>{let g=!0;r!==l.J1.Count&&(P?x!==""&&(0,D.Fv)(x)===void 0&&(g=!1):g=(0,I.N_)(x)),_(!g),o({mode:r,scale:b,value:x})},S=(0,d.w)().getVariables().map(r=>({value:r.name,label:r.label||r.name,origin:C.$0.Template}));return(0,E.jsxs)(v.B,{children:[(0,E.jsx)(c.z,{value:n?.mode||l.J1.Size,options:n?.scale?.type===l.L4.Log?L:p,onChange:r=>{T.current++,h({...n,value:"",mode:r})}}),(0,E.jsx)(m.y,{invalid:s,error:"Value needs to be an integer or a variable",value:n?.value??"",placeholder:(0,a.t)("transformers.axis-editor.placeholder-auto","Auto"),onChange:r=>{h({...n,value:r})},suggestions:S},T.current)]})};function i(n,o,e,s){o.addCustomEditor({id:"xBuckets",path:`${n}xBuckets`,name:(0,a.t)("transformers.calculate-heatmap.add-heatmap-calculation-options.name-x-bucket","X Bucket"),editor:u,category:s,defaultValue:{mode:l.J1.Size},settings:{allowInterval:!0}}),o.addCustomEditor({id:"yBuckets",path:`${n}yBuckets`,name:(0,a.t)("transformers.calculate-heatmap.add-heatmap-calculation-options.name-y-bucket","Y Bucket"),editor:u,category:s,defaultValue:{mode:l.J1.Size}}),o.addCustomEditor({id:"yBuckets-scale",path:`${n}yBuckets.scale`,name:(0,a.t)("transformers.calculate-heatmap.add-heatmap-calculation-options.name-y-bucket-scale","Y Bucket scale"),category:s,editor:O.W1,defaultValue:{type:l.L4.Linear}})}},41962(W,M,t){t.d(M,{Fv:()=>T,eO:()=>u,q_:()=>_});var a=t(17452),l=t(9202),O=t(75251);const{abs:E,pow:f}=Math,C=new Map;function d(p,L,P,h){let B=[],S=h.map(a.E);for(let r=L;r<P;r++){let b=E(r),x=(0,a.h)(f(p,r),b);for(let g=0;g<h.length;g++){let A=h[g]*x,R=(A>=0&&r>=0?0:b)+(r>=S[g]?0:S[g]),V=(0,a.h)(A,R);B.push(V),C.set(V,R)}}return B}const v=p=>p%1===0,c=[1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5],m=d(10,-16,0,c),D=d(10,0,16,c).filter(v),u=m.concat(D),i=1*1e3,n=60*i,o=60*n,e=24*o,s=365*e,_=[1,2,4,5,10,20,25,40,50,100,200,250,400,500,i,2*i,4*i,5*i,10*i,15*i,20*i,30*i,n,2*n,4*n,5*n,10*n,15*n,20*n,30*n,o,2*o,4*o,6*o,8*o,12*o,18*o,e,2*e,3*e,4*e,5*e,6*e,7*e,10*e,15*e,30*e,45*e,60*e,90*e,180*e,s,2*s,3*s,4*s,5*s,6*s,7*s,8*s,9*s,10*s],T=p=>{if((0,O.N_)(p)){const P=Number.parseInt(p,10);return Number.isNaN(P)?void 0:P}else{if((0,l.di)(p))return(0,l.WT)((0,l.E9)(p));{const h=p.match(/(\d+)ms$/i);if(h){const B=Number.parseInt(h[1],10);return Number.isNaN(B)?void 0:B}else return}}}},29673(W,M,t){t.d(M,{D:()=>v,q:()=>c});var a=t(2543),l=t.n(a),O=t(80676),E=t(52358),f=t(37474),C=t(12293),d=t(56510);function v(m,I){const D={data:m.input,options:m.options},u=new f.C({id:"root",title:(0,E.t)("transformers.get-transformer-option-pane.root.title.root","root")}),i=o=>{if(o?.length){const e=o[0];let s=u.categories.find(_=>_.props.id===e);return s||(s=new f.C({id:e,title:e}),u.categories.push(s)),s}return u},n={getValue:o=>(0,a.get)(m.options,o),onChange:(o,e)=>{m.onChange((0,d.Sf)(m.options,o,e))}};return(0,C.g5)("spatial-transformer",I,n,i,D),u}function c(m){const I={data:[],options:{}},D={},u=new O.pv;m(u,I);for(const i of u.getItems())i.defaultValue!=null&&(0,a.set)(D,i.path,i.defaultValue);return D}}}]);

//# sourceMappingURL=5711.baa7b131c8f4f3b51e7d.js.map