import{Eg as u,Kl as t,Nl as n,Tl as y,Vl as d,fj as l}from"./chunk-25VLH6EB.js";import{j as i}from"./chunk-AFBR3FKX.js";i();var r=function(a){return a.arc="arc",a.donut="donut",a.horizontalBar="horizontalBar",a.verticalBar="verticalBar",a}(r||{}),b=Object.keys(r),s=new Map([[r.arc,"widgets.gauge.gauge-type-arc"],[r.donut,"widgets.gauge.gauge-type-donut"],[r.horizontalBar,"widgets.gauge.gauge-type-horizontal-bar"],[r.verticalBar,"widgets.gauge.gauge-type-vertical-bar"]]),f=new Map([[r.arc,"assets/widget/simple-gauge/arc-layout.svg"],[r.donut,"assets/widget/simple-gauge/donut-layout.svg"],[r.horizontalBar,"assets/widget/simple-gauge/horizontal-bar-layout.svg"],[r.verticalBar,"assets/widget/simple-gauge/vertical-bar-layout.svg"]]),C={gaugeType:r.donut,timestampFormat:"yyyy-MM-dd HH:mm:ss"},c=a=>{let o=[];return a.forEach(e=>o.push({from:{type:e?.from?.valueSource==="predefinedValue"?t.constant:t.entity,value:e?.from?.value||null,entityAlias:e?.from?.entityAlias||"",entityKey:e?.from?.attribute||"",entityKeyType:l.attribute},to:{type:e?.to?.valueSource==="predefinedValue"?t.constant:t.entity,value:e?.to?.value||null,entityAlias:e?.to?.entityAlias||"",entityKey:e?.to?.attribute||"",entityKeyType:l.attribute},color:e.color})),o},h=a=>{let o=[];if(a?.length&&u(a[0]?.valueSource))a.forEach(e=>o.push({type:e?.valueSource==="predefinedValue"?t.constant:t.entity,value:e?.value||null,entityAlias:e?.entityAlias||"",entityKey:e?.attribute||"",entityKeyType:l.attribute}));else return a;return o},w=(a,o)=>{a.barColor?(a.barColor.color||(a.barColor.color=o),u(a.barColor.gradient)?(a.barColor.gradient.minValue=a.minValue,a.barColor.gradient.maxValue=a.maxValue):a.barColor.gradient=d(a.minValue,a.maxValue)):(a.barColor=y(o),a.fixedLevelColors?.length&&(a.barColor.rangeList={advancedMode:a.useFixedLevelColor,range:null,rangeAdvanced:c(a.fixedLevelColors)}),a.levelColors?.length&&(a.barColor.gradient={advancedMode:!1,gradient:a.levelColors,gradientAdvanced:null,minValue:a.minValue,maxValue:a.maxValue}),a.useFixedLevelColor?a.barColor.type=n.range:a.levelColors.length&&(a.barColor.type=n.gradient))};export{r as a,b,s as c,f as d,C as e,c as f,h as g,w as h};
