"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var s=require("./index-59f53f02.cjs.js"),l=require("vue"),v=require("moment"),n=require("./billboard-30447293.cjs.js");require("v-tooltip");require("@cldcvr/flow-aws-icon");require("@cldcvr/flow-gcp-icon");require("@cldcvr/flow-product-icon");require("@cldcvr/flow-system-icon");require("lodash-es");require("vee-validate");function h(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var _=h(l),f=h(v),m=function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("Wrapper",{attrs:{background:"tooltip","border-radius":"4px"}},[t("Container",{attrs:{padding:8,gap:8,direction:"column"}},[t("Typography",{attrs:{type:"p3",color:"light",weight:"bold"}},[e._v(" "+e._s(e.formatTitle(e.title))+" ")]),t("Container",{attrs:{padding:0,gap:4,direction:"column"}},e._l(e.points,function(o,a){return t("Container",{key:o.index+o.name+a,attrs:{align:"space-between center",padding:0}},[t("Typography",{attrs:{type:"p3",color:"dark"}},[e._v(" "+e._s(o.name)+" ")]),t("Typography",{attrs:{type:"p3",color:"dark",weight:"bold"}},[e._v(" "+e._s(o.value)+" ")])],1)}),1)],1)],1)},g=[];const y=l.defineComponent({name:"SparklineTooltip",components:{Typography:s.Typography,Container:s.Container,Wrapper:s.Wrapper},methods:{formatTitle(e){return f.default(e).format("DD-MM-YYYY | hh:mm:ss A")}}}),c={};var b=s.normalizeComponent(y,m,g,!1,x,null,null,null);function x(e){for(let r in c)this[r]=c[r]}var u=function(){return b.exports}(),S=function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("Container",{attrs:{direction:"column",gap:2,padding:0,overflow:"visible"}},[t("Container",{attrs:{gap:6,padding:0}},[t("Icon",{attrs:{name:"i-globe",type:"filled",state:"light",size:"x-small"}}),t("Typography",{attrs:{type:"p3",color:"light",weight:"bold",overflow:"ellipsis"}},[e._v(" "+e._s(e.series.name)+" ")])],1),t("Container",{attrs:{gap:8,padding:0,overflow:"visible"}},[t("Typography",{staticClass:"sparkline-value",attrs:{type:"p1",color:"dark",weight:"bold",overflow:"ellipsis"}},[e._v(" 246 ms ")]),t("div",{ref:"sparkline",staticClass:"flow-sparkline",style:e.styleObj})],1)],1)},w=[];const C={area:n.area(),areaLineRange:n.areaLineRange(),areaSpline:n.areaSpline(),areaStep:n.areaStep(),bar:n.bar(),line:n.line(),spline:n.spline(),step:n.step()},T=l.defineComponent({name:"Sparkline",components:{Typography:s.Typography,Container:s.Container,Icon:s.Icon,SparklineTooltip:u},props:{type:{type:String,default:"spline",validator(e){return["area","areaLineRange","areaSpline","areaStep","bar","line","spline","step"].includes(e)}},series:{type:Object,default:()=>{}},eventLines:{type:Array,default:()=>[]},height:{type:Number,default:20}},data(){return{chart:null,colors:["var(--color1-300)","var(--color2-300)","var(--color3-300)","var(--color4-300)","var(--color5-300)","var(--color6-300)"]}},computed:{styleObj(){return{height:`${this.height+12}px`}}},mounted(){this.init()},beforeMount(){this.tooltip=_.default.extend(u)},methods:{init(){this.chart=n.bb.generate({data:{...this.getData()},axis:{y:{show:!1,padding:{bottom:0,top:0}},x:{show:!1}},point:{show:!1},tooltip:{contents:(e,r,t,o)=>{const a={title:null,points:[]};return e.forEach(i=>{a.title=i.x,a.points.push({name:i.name,value:i.value,color:o(i),index:i.index})}),new this.tooltip({data:a}).$mount().$el.outerHTML},show:!0,linked:!0,grouped:!0},legend:{show:!1},grid:{x:{lines:this.eventLines},y:{...this.getThresholdLines()}},padding:{top:0,right:0,bottom:0,left:0},bindto:this.$refs.sparkline})},getData(){const e=[],r={},t={},o=new Set,a=[this.series.name];this.series.points.forEach(i=>{o.add(i.x),a.push(i.y)}),e.push(a);const p=["X_AXIS",...o];return e.push(p),r[this.series.name]=this.series.color?this.series.color:this.hashCode(this.series.name),this.series.type?t[this.series.name]=C[this.series.type]:t[this.series.name]=n.areaSpline(),{x:"X_AXIS",columns:e,colors:r,types:t}},hashCode(e){let r=0;for(const t in e)r+=e.charCodeAt(t);return this.colors[r%this.colors.length]},getThresholdLines(){const e=[];return this.series.thresholdLines&&this.series.thresholdLines.forEach(r=>{e.push({value:r.value,text:r.text,position:"end",class:"sparkline-threshold"})}),{lines:e}}}}),d={};var k=s.normalizeComponent(T,S,w,!1,$,null,null,null);function $(e){for(let r in d)this[r]=d[r]}var j=function(){return k.exports}();exports.default=j;
//# sourceMappingURL=Sparkline-eaaca475.cjs.js.map
