@kong-ui-public/analytics-chart 12.0.0 → 12.0.1-pr.3914.2a6681ab7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoordinatorPlugin.d.ts","sourceRoot":"","sources":["../../../../src/components/chart-plugins/CoordinatorPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AACjF,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,KAAK,CAAA;AAqB/D,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,sBAAsB,GAAG,IAAI,CAAA;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,qBAAa,iBAAkB,YAAW,MAAM;IAC9C,EAAE,SAAgB;IAClB,WAAW,EAAE,sBAAsB,GAAG,IAAI,CAAO;IACjD,UAAU,SAAK;IACf,WAAW,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAY;IACjD,eAAe,EAAE,MAAM,GAAG,IAAI,CAAO;IACrC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAO;IAE1C,cAAc,UAAQ;IACtB,aAAa,UAAQ;IACrB,cAAc,UAAQ;IACtB,cAAc,UAAQ;IACtB,mBAAmB,SAAI;gBAEX,EACV,WAAW,EACX,cAAsB,EACtB,aAAqB,EACrB,cAAsB,EACtB,cAAsB,GACvB,EAAE,4BAA4B;IAS/B,SAAS,CAAC,KAAK,EAAE,KAAK;IAsBtB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,UAAU,CAAA;KAAE;IAUzD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG;IAmBzC,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAoB9B,aAAa;IAMb,eAAe,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,SAAS;IAqB5D,eAAe,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,SAAS;IA2C5D,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"CoordinatorPlugin.d.ts","sourceRoot":"","sources":["../../../../src/components/chart-plugins/CoordinatorPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AACjF,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,KAAK,CAAA;AAqB/D,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,sBAAsB,GAAG,IAAI,CAAA;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,qBAAa,iBAAkB,YAAW,MAAM;IAC9C,EAAE,SAAgB;IAClB,WAAW,EAAE,sBAAsB,GAAG,IAAI,CAAO;IACjD,UAAU,SAAK;IACf,WAAW,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAY;IACjD,eAAe,EAAE,MAAM,GAAG,IAAI,CAAO;IACrC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAO;IAE1C,cAAc,UAAQ;IACtB,aAAa,UAAQ;IACrB,cAAc,UAAQ;IACtB,cAAc,UAAQ;IACtB,mBAAmB,SAAI;gBAEX,EACV,WAAW,EACX,cAAsB,EACtB,aAAqB,EACrB,cAAsB,EACtB,cAAsB,GACvB,EAAE,4BAA4B;IAS/B,SAAS,CAAC,KAAK,EAAE,KAAK;IAsBtB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,UAAU,CAAA;KAAE;IAUzD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG;IAmBzC,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAoB9B,aAAa;IAMb,eAAe,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,SAAS;IAqB5D,eAAe,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,WAAW,GAAG,SAAS;IA2C5D,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IA+BtD,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG;IAoBlD,wBAAwB,CAAC,KAAK,EAAE,KAAK;IAuBrC,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;IA0B9E,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS;CAY9D"}
|
package/dist/vitals-chart.es.js
CHANGED
|
@@ -19930,6 +19930,7 @@ class Eo {
|
|
|
19930
19930
|
const s = t.type, o = Math.min(this.coordinator.TIMESTAMP_DEBOUNCE_MS, this.coordinator.DIMENSION_DEBOUNCE_MS);
|
|
19931
19931
|
if (!(s === "mousemove" && i - this.lastMouseBrushEvent < o)) {
|
|
19932
19932
|
if (s === "mousemove") {
|
|
19933
|
+
if (!n.canvas) return;
|
|
19933
19934
|
const a = this._getTimestamp(n, t), [r, l] = this._getDatasetDimension(n, t) ?? [];
|
|
19934
19935
|
this.coordinator.activate({
|
|
19935
19936
|
chartUuid: this.instanceId,
|
package/dist/vitals-chart.umd.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
left: ${w.value.x}px;
|
|
5
5
|
top: ${w.value.y}px;
|
|
6
6
|
${v?"text-wrap: nowrap;":""}
|
|
7
|
-
`)}}function NM(e,t,n={}){const{window:i=$s,...s}=n;let o;const a=Ad(()=>i&&"ResizeObserver"in i),r=()=>{o&&(o.disconnect(),o=void 0)},l=u.watch(u.computed(()=>{const d=u.toValue(e);return Array.isArray(d)?d.map(h=>Ln(h)):[Ln(d)]}),d=>{if(r(),a.value&&i){o=new ResizeObserver(t);for(const h of d)h&&o.observe(h,s)}},{immediate:!0,flush:"post"}),c=()=>{r(),l()};return Cd(c),{isSupported:a,stop:c}}function BM(e,t={}){const{reset:n=!0,windowResize:i=!0,windowScroll:s=!0,immediate:o=!0,updateTiming:a="sync"}=t,r=u.shallowRef(0),l=u.shallowRef(0),c=u.shallowRef(0),d=u.shallowRef(0),h=u.shallowRef(0),f=u.shallowRef(0),m=u.shallowRef(0),p=u.shallowRef(0);function g(){const _=Ln(e);if(!_){n&&(r.value=0,l.value=0,c.value=0,d.value=0,h.value=0,f.value=0,m.value=0,p.value=0);return}const x=_.getBoundingClientRect();r.value=x.height,l.value=x.bottom,c.value=x.left,d.value=x.right,h.value=x.top,f.value=x.width,m.value=x.x,p.value=x.y}function y(){a==="sync"?g():a==="next-frame"&&requestAnimationFrame(()=>g())}return NM(e,y),u.watch(()=>Ln(e),_=>!_&&y()),RM(e,y,{attributeFilter:["style","class"]}),s&&Ni("scroll",y,{capture:!0,passive:!0}),i&&Ni("resize",y,{passive:!0}),AM(()=>{o&&y()}),{height:r,bottom:l,left:c,right:d,top:h,width:f,x:m,y:p,update:y}}function FM(e,t){const{top:n,left:i}=BM(e),s=u.computed(()=>e.value?`${parseFloat(t.left)+i.value}px`:t.left),o=u.computed(()=>e.value?`${parseFloat(t.top)+n.value}px`:t.top);return{tooltipAbsoluteLeft:s,tooltipAbsoluteTop:o}}const zM=({bucketCount:e,minStamp:t,maxStamp:n,timestamps:i})=>{const s=[...i].filter(l=>l>=t&&l<=n).sort((l,c)=>l-c),o=[];if(n-t<e-2)return[];const a=(n-t)/e;let r=0;for(let l=0;l<e;l++){const c=t+l*a,d=t+(l+1)*a;let h=0;for(;r<s.length&&s[r]>=c&&s[r]<=d;)h++,r++;o.push([Math.ceil(c),h])}return o},Pd=()=>({minCounts:{},maxCounts:{},minStamps:{},maxStamps:{},renderPoints:{}}),Bi=u.ref({}),UM=e=>(Bi.value[e]||(Bi.value[e]=Pd()),Bi.value[e]),VM=(e,t)=>{const n=Bi.value[t];if(!n)return;const i=n.minCounts[e]!==void 0||n.maxCounts[e]!==void 0||n.minStamps[e]!==void 0||n.maxStamps[e]!==void 0||n.renderPoints[e]!==void 0;n&&i&&(delete n.minCounts[e],delete n.maxCounts[e],delete n.minStamps[e],delete n.maxStamps[e],delete n.renderPoints[e],Object.keys(n.minCounts).length||Object.keys(n.maxCounts).length||Object.keys(n.minStamps).length||Object.keys(n.maxStamps).length||Object.keys(n.renderPoints).length||delete Bi.value[t])};function HM({chartKey:e,datasets:t,groupKey:n,minStamp:i=void 0,maxStamp:s=void 0,minCount:o=void 0,maxCount:a=void 0,renderPoints:r=void 0,type:l}){const d=n!==void 0&&e!==void 0?UM(n):Pd(),h=e!==void 0?e:"static-chart-key",f=u.computed(()=>t.reduce((S,{timestamps:A})=>[...S,...A],[])),m=u.computed(()=>i||f.value.reduce((S,A)=>S===0?A:Math.min(S,A),0)),p=u.computed(()=>s||f.value.reduce((S,A)=>Math.max(S,A),0));u.watchEffect(()=>{d.minStamps[h]=m.value,d.maxStamps[h]=p.value,r!==void 0&&(d.renderPoints[h]=r)});const g=u.computed(()=>Object.values(d.minStamps).reduce((S,A)=>S===0?A:Math.min(S,A),0)),y=u.computed(()=>Object.values(d.maxStamps).reduce((S,A)=>Math.max(S,A),0)),_=u.computed(()=>{const S=Object.values(d.renderPoints);return S.length===0?24:S.reduce((A,L)=>Math.max(A,L),2)}),x=u.computed(()=>{const S=y.value-g.value;return Math.ceil(S/_.value)}),T=u.computed(()=>t.length>1),v=u.computed(()=>t.map(({timestamps:S,color:A,label:L})=>({data:zM({bucketCount:_.value,minStamp:g.value,maxStamp:y.value,timestamps:S}).map(([W,$])=>({x:W,y:$})),label:L,...(l==="sparkline_bar"||T.value)&&A&&{backgroundColor:A},...l!=="sparkline_bar"&&A&&{borderColor:A},...T.value&&l!=="sparkline_bar"&&{fill:!0}}))),w=u.computed(()=>{const S=v.value[0]?.data?.length??0,A=[];for(let L=0;L<S;L++){let R=0;for(let H=0;H<v.value.length;H++)R+=v.value[H].data[L].y;A.push(R)}return A}),M=u.computed(()=>{const S=w.value.reduce((A,L)=>Math.max(A,L),0);return Math.max(S,a??0)}),D=u.computed(()=>{const S=v.value.reduce((R,{data:H})=>[...R,...H.map(({y:W})=>W)],[]),A=S.length?S[0]:0,L=S.reduce((R,H)=>Math.min(R,H),A);return o===void 0?L:Math.min(L,o)});u.watchEffect(()=>{d.maxCounts[h]=M.value,d.minCounts[h]=D.value});const P=u.computed(()=>{const S=Object.values(d.minCounts),A=S.length?S[0]:0;return S.reduce((L,R)=>Math.min(L,R),A)}),k=u.computed(()=>Object.values(d.maxCounts).reduce((S,A)=>Math.max(S,A),0));return u.onUnmounted(()=>{e!==void 0&&n!==void 0&&VM(e,n)}),{syncedMinStamp:g,syncedMaxStamp:y,syncedRenderPoints:_,syncedChartDatasets:v,syncedGroupSizeMs:x,syncedMinCount:P,syncedMaxCount:k}}const an=(e,t)=>{if(!e||!t)return;const n=t.toLowerCase();return e[t]??Object.entries(e).find(([i])=>i.toLowerCase()===n)?.[1]},Nn=e=>{if(e==null||e==="")return null;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},Pa=e=>e.reduce((t,n)=>n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)},{sum:0,max:0}),Ea=(e,t)=>t.sum>0?e/t.sum:null,Ed=(e,t,n)=>{const i=n==="relative"?t.sum:t.max;return i<=0?0:Math.min(Math.max(e/i,0),1)},Ra=(e,t)=>{const n=(t??[]).filter(o=>e>=o.value);if(!n.length)return;const i=Math.max(...n.map(o=>o.value));return n.filter(o=>o.value===i).some(o=>o.type==="error")?"error":"warning"},Rd=18,$M=85;function YM(e,t,n,i){const{i18n:s}=Gl(),{formatUnit:o}=oe({i18n:s}),a=w=>w.map(M=>{const D=Math.min(M.ratio,.5)/.5;return{...M,color:Li({metric:n.value}),tint:`${Rd+D*($M-Rd)}%`}}),r=u.computed(()=>e.value?.data??[]),l=u.computed(()=>e.value?.meta?.metric_names??[]),c=u.computed(()=>{const w=n.value;return w&&l.value.includes(w)?w:l.value[0]}),d=u.computed(()=>l.value.filter(w=>w!==c.value)),h=u.computed(()=>e.value?.meta?.display?.[t.value]??{}),f=(w,M)=>{if(zi(w)||w==="count"||w==="requests")return"";const D=M===1?"":"s";return s.te(`chartUnits.${w}`)?s.t(`chartUnits.${w}`,{plural:D}):w},m=w=>{const M=D=>o(D,"%",{translateUnit:P=>f(P,D)});return w>0&&w<.01?`< ${M(.01)}`:M(w)},p=(w,M)=>{if(w===null)return"–";const D=e.value?.meta?.metric_units?.[M]||"count";return D==="%"?m(w):o(w,D,{isBytes1024:!0,translateUnit:P=>f(P,w)})},g=w=>s.te(`chartLabels.${w}`)?s.t(`chartLabels.${w}`):w,y=w=>an(i.value,w)?.label||g(w),_=u.computed(()=>Pa(r.value.map(w=>c.value?Nn(w.event[c.value]):null))),x=w=>d.value.flatMap(M=>{const D=Nn(w[M]);if(D===null)return[];const P=Ra(D,an(i.value,M)?.thresholds);return[{key:M,label:y(M),value:p(D,M),threshold:P}]}),T=u.computed(()=>{if(!c.value)return[];const w=r.value.map(M=>{const D=M.event,P=String(D[t.value]),k=Nn(D[c.value])??0,S=Ea(k,_.value),A=S??0,L=P===Aa;return{id:P,name:L?g(Aa):h.value[P]?.name||P,deleted:!!h.value[P]?.deleted,isOther:L,isEmpty:P===TM,value:k,ratio:A,display:p(k,c.value),relative:S===null?"":m(S*100),tooltipRows:x(D)}}).sort((M,D)=>Number(M.isOther)-Number(D.isOther)||D.value-M.value);return a(w)});return{column:u.computed(()=>({dimension:t.value,label:y(t.value),total:p(_.value.sum,c.value??"count"),cells:T.value})),cells:T,sizeKey:c}}const q={useBarChartOptions:TS,useChartJSCommon:vS,useChartLegendValues:DS,useExploreResultToDatasets:lM,useExploreResultToTimeDataset:hM,useScatterDatasets:_M,useDonutChartOptions:CS,useLineChartOptions:OS,useScatterChartOptions:ES,useI18n:Gl,useReportChartDataForSynthetics:xM,useTranslatedUnits:wM,useEvaluateFeatureFlag:SM,useTooltipAbsolutePosition:FM,useSparklineSync:HM,useTopTalkersData:YM},Ws=e=>["interactive","zoom-interactive"].includes(e),Ia=(e,t,n,i)=>{const{tooltip:s}=t;if(s.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const{i18n:o}=q.useI18n(),{formatUnit:a}=oe({i18n:o}),r=e.chartTooltipSortFn||((l,c)=>c.rawValue-l.rawValue);if(s.body&&!Ws(e.interactionMode)){const l=s.labelColors,c=t.chart.config?.options?.indexAxis==="y"?"x":"y",d=s.dataPoints[0].parsed.x??0;e.tooltipContext=i?.contextFormatter?i.contextFormatter(d,n,s.dataPoints[0].raw):zn({tickValue:new Date(d),granularity:n}),e.tooltipSeries=s.dataPoints.map((f,m)=>{const p=f.parsed[c],g=f.dataset.unit??e.units,y=a(p??0,g,{translateUnit:e.translateUnit}),_=f.raw?.tooltipLabel||f.dataset.label;return{backgroundColor:l[m].backgroundColor,borderColor:l[m].borderColor,label:_,value:y,rawValue:p,isSegmentEmpty:f.dataset.isSegmentEmpty}}).sort(r);const h=s.dataPoints[0]?.raw?.extras??[];for(const f of h)e.tooltipSeries.push({label:f.label,value:f.unit?a(Number(f.value)||0,f.unit,{translateUnit:e.translateUnit}):String(f.value),rawValue:Number(f.value)||0,isExtra:!0});e.left=`${s.x}px`,e.top=`${s.y}px`,e.showTooltip=!0}},Id=(e,t)=>{const{tooltip:n}=t,{i18n:i}=q.useI18n(),{formatUnit:s}=oe({i18n:i});if(n.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const o=e.chartTooltipSortFn||((a,r)=>r.rawValue-a.rawValue);if(n.body&&!Ws(e.interactionMode)){const a=n.labelColors,r=t.chart.config?.options?.indexAxis==="y"?"x":"y",l=["gauge","donut"].includes(e.chartType);l?e.tooltipContext=e.dimensionDisplay||n.dataPoints[0].label:n.chart.data.isMultiDimension?e.tooltipContext=n.dataPoints[0].label:e.tooltipContext=e.dimensionDisplay||"",e.tooltipSeries=n.dataPoints.map((c,d)=>{const h=l?c.parsed:c.parsed[r],f=s(h??0,e.units,{translateUnit:e.translateUnit});let m;return l?m=c.dataset.labels[c.dataIndex]:m=c.dataset.label,{backgroundColor:a[d].backgroundColor,borderColor:a[d].borderColor,label:m,value:f,rawValue:h,isSegmentEmpty:c.dataset.isSegmentEmpty}}).sort(o),e.left=`${n.x}px`,e.top=`${n.y}px`,e.showTooltip=!0}},WM=e=>e&&e.datasets&&e.datasets.length,jM=e=>WM(e)&&e.datasets.some(t=>t.data.length),qM=e=>e.datasets.some(t=>t.data[0]&&Eo(t.data[0].x)),GM=e=>!!jM(e)&&e.datasets.some(t=>t.data.length==1),XM=e=>qM(e)&&e.datasets.some(t=>t.data[0]&&(t.data[0].x??0).toString().length>=13),js=(e,t,n)=>{const s=Math.min(t/1150,1),o=.15,a=1.15,r=e.x??0;return r<n?r+t*o*(1-s):r-t*a*(1-s)},Ld=(e,t,n)=>{const o=e.y??0;return o<n?o+t*.15:o-t*.5};function Nd(e,t){let n;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>{e(...i)},t)}}const La=(e,t,n)=>{const i=e.data;return e.options.plugins.legend.labels.generateLabels(e).filter(s=>!t?.[s.text]?.isThreshold).map(((s,o)=>({...s,value:t&&t[s.text],isSegmentEmpty:i.datasets[o].isSegmentEmpty}))).sort(n)},KM=2,Bd=10,Fd=12,qs=10,Gs="y",Na="y1",he=["#a86cd5","#6a86d2","#00bbf9","#00c4b0","#ffdf15"],Ba=(e,t)=>(t||he)[e%he.length],ZM="#6f7787",QM={100:{background:"#f0f5fd",text:"#10599e"},200:{background:"#e5f7f4",text:"#1b6955"},300:{background:"#fff1d5",text:"#a06027"},400:{background:"#fee3b6",text:"#944d19"},500:{background:"#fedada",text:"#852021"}},JM=e=>{const t=Math.floor(parseInt(e,10)/100)*100;return QM[t]?.background||"#fafafa"},t1=sg,Fa=(e,t,n,i)=>{let s;return n?s=t1:Array.isArray(i)?s=Ba(e,i):s=i[t],s||Ba(e)},za=e=>{switch(e){case"error":return og;case"warning":return cg;case"neutral":return pl;default:return pl}},e1={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},n1=2,i1=0,Ua=new Map,zd=(e,t)=>{const{i18n:n}=q.useI18n(),{formatBytes:i}=oe({i18n:n});return t==="bytes"?i(e):t==="count/minute"?e.toFixed(2):ss.format(e)},s1=e=>{const n=document.createElement("canvas").getContext("2d"),i=wt({});return n.font=i.string,n.measureText(e).width},o1=()=>{const e="label_height";if(!Ua.has(e)){const t=wt({});Ua.set(e,t.lineHeight)}return Ua.get(e)},a1=(e,t)=>t.datasets.reduce((n,i,s)=>e.isDatasetVisible(s)?n+i.data.reduce((o,a)=>isNaN(a)?o:o+a,0):n,0),r1=(e,t)=>t===0?" (0.0%)":` (${(e/t*100).toFixed(1)}%)`,l1=ig,c1={100:hg,101:fg,102:mg,103:pg,200:gg,201:yg,202:bg,203:_g,204:xg,205:wg,206:kg,207:Tg,208:Sg,226:vg,300:Mg,301:Dg,302:Cg,303:Og,304:Ag,305:Pg,307:Eg,308:Rg,400:Ig,401:Lg,402:Ng,403:Bg,404:Fg,405:zg,406:Ug,407:Vg,408:Hg,409:$g,410:Yg,411:Wg,412:jg,413:qg,414:Gg,415:Xg,416:Kg,417:Zg,418:Qg,421:Jg,422:ty,423:ey,424:ny,425:iy,426:sy,428:oy,429:ay,431:ry,451:ly,500:cy,501:uy,502:dy,503:hy,504:fy,505:my,506:py,507:gy,508:yy,510:by,511:_y},u1={100:xy,200:wy,300:ky,400:Ty,500:Sy},d1={"1XX":vy,"2XX":My,"3XX":Dy,"4XX":Cy,"5XX":Oy},Ud=e=>{const t=parseInt(e,10),n=Math.floor(t/100)*100;return c1[t]??u1[n]??l1},Va={...Array.from({length:500},(e,t)=>100+t).reduce((e,t)=>(e[`${t}`]=Ud(`${t}`),e),{}),____OTHER____:ng,...d1};function Vd(e,t,n){const i=zl(),s=m1(e,n.timeZone,n.locale??i.locale);return"formatToParts"in s?h1(s,t):f1(s,t)}function h1(e,t){const n=e.formatToParts(t);for(let i=n.length-1;i>=0;--i)if(n[i].type==="timeZoneName")return n[i].value}function f1(e,t){const n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}function m1(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function p1(e,t){const n=x1(t);return"formatToParts"in n?y1(n,e):b1(n,e)}const g1={year:0,month:1,day:2,hour:3,minute:4,second:5};function y1(e,t){try{const n=e.formatToParts(t),i=[];for(let s=0;s<n.length;s++){const o=g1[n[s].type];o!==void 0&&(i[o]=parseInt(n[s].value,10))}return i}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function b1(e,t){const n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Ha={},Hd=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),_1=Hd==="06/25/2014, 00:00:00"||Hd==="06/25/2014 00:00:00";function x1(e){return Ha[e]||(Ha[e]=_1?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Ha[e]}function $d(e,t,n,i,s,o,a){const r=new Date(0);return r.setUTCFullYear(e,t,n),r.setUTCHours(i,s,o,a),r}const Yd=36e5,w1=6e4,$a={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Ya(e,t,n){if(!e)return 0;let i=$a.timezoneZ.exec(e);if(i)return 0;let s,o;if(i=$a.timezoneHH.exec(e),i)return s=parseInt(i[1],10),Wd(s)?-(s*Yd):NaN;if(i=$a.timezoneHHMM.exec(e),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Wd(s,a)?(o=Math.abs(s)*Yd+a*w1,i[1]==="+"?-o:o):NaN}if(S1(e)){t=new Date(t||Date.now());const a=n?t:k1(t),r=Wa(a,e);return-(n?r:T1(t,r,e))}return NaN}function k1(e){return $d(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function Wa(e,t){const n=p1(e,t),i=$d(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let s=e.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function T1(e,t,n){let s=e.getTime()-t;const o=Wa(new Date(s),n);if(t===o)return t;s-=o-t;const a=Wa(new Date(s),n);return o===a?o:Math.max(o,a)}function Wd(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const jd={};function S1(e){if(jd[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),jd[e]=!0,!0}catch{return!1}}const v1=60*1e3,M1={X:function(e,t,n){const i=ja(n.timeZone,e);if(i===0)return"Z";switch(t){case"X":return qd(i);case"XXXX":case"XX":return Bn(i);default:return Bn(i,":")}},x:function(e,t,n){const i=ja(n.timeZone,e);switch(t){case"x":return qd(i);case"xxxx":case"xx":return Bn(i);default:return Bn(i,":")}},O:function(e,t,n){const i=ja(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+D1(i,":");default:return"GMT"+Bn(i,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return Vd("short",e,n);default:return Vd("long",e,n)}}};function ja(e,t){const n=e?Ya(e,t,!0)/v1:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Xs(e,t){const n=e<0?"-":"";let i=Math.abs(e).toString();for(;i.length<t;)i="0"+i;return n+i}function Bn(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Xs(Math.floor(i/60),2),o=Xs(Math.floor(i%60),2);return n+s+t+o}function qd(e,t){return e%60===0?(e>0?"-":"+")+Xs(Math.abs(e)/60,2):Bn(e,t)}function D1(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.floor(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+Xs(o,2)}function Gd(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const C1=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,qa=36e5,Xd=6e4,O1=2,Wt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:C1};function Kd(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?O1:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const i=A1(e),{year:s,restDateString:o}=P1(i.date,n),a=E1(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const r=a.getTime();let l=0,c;if(i.time&&(l=R1(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=Ya(i.timeZone||t.timeZone,new Date(r+l)),isNaN(c))return new Date(NaN)}else c=Gd(new Date(r+l)),c=Gd(new Date(r+l+c));return new Date(r+l+c)}else return new Date(NaN)}function A1(e){const t={};let n=Wt.dateTimePattern.exec(e),i;if(n?(t.date=n[1],i=n[3]):(n=Wt.datePattern.exec(e),n?(t.date=n[1],i=n[2]):(t.date=null,i=e)),i){const s=Wt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function P1(e,t){if(e){const n=Wt.YYY[t],i=Wt.YYYYY[t];let s=Wt.YYYY.exec(e)||i.exec(e);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(s=Wt.YY.exec(e)||n.exec(e),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:e.slice(o.length)}}}return{year:null}}function E1(e,t){if(t===null)return null;let n,i,s;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let o=Wt.MM.exec(e);if(o)return n=new Date(0),i=parseInt(o[1],10)-1,Jd(t,i)?(n.setUTCFullYear(t,i),n):new Date(NaN);if(o=Wt.DDD.exec(e),o){n=new Date(0);const a=parseInt(o[1],10);return N1(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(o=Wt.MMDD.exec(e),o){n=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Jd(t,i,a)?(n.setUTCFullYear(t,i,a),n):new Date(NaN)}if(o=Wt.Www.exec(e),o)return s=parseInt(o[1],10)-1,th(s)?Zd(t,s):new Date(NaN);if(o=Wt.WwwD.exec(e),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return th(s,a)?Zd(t,s,a):new Date(NaN)}return null}function R1(e){let t,n,i=Wt.HH.exec(e);if(i)return t=parseFloat(i[1].replace(",",".")),Ga(t)?t%24*qa:NaN;if(i=Wt.HHMM.exec(e),i)return t=parseInt(i[1],10),n=parseFloat(i[2].replace(",",".")),Ga(t,n)?t%24*qa+n*Xd:NaN;if(i=Wt.HHMMSS.exec(e),i){t=parseInt(i[1],10),n=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Ga(t,n,s)?t%24*qa+n*Xd+s*1e3:NaN}return null}function Zd(e,t,n){t=t||0,n=n||0;const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=t*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const I1=[31,28,31,30,31,30,31,31,30,31,30,31],L1=[31,29,31,30,31,30,31,31,30,31,30,31];function Qd(e){return e%400===0||e%4===0&&e%100!==0}function Jd(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const i=Qd(e);if(i&&n>L1[t]||!i&&n>I1[t])return!1}return!0}function N1(e,t){if(t<1)return!1;const n=Qd(e);return!(n&&t>366||!n&&t>365)}function th(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Ga(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const B1=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function F1(e,t,n={}){t=String(t);const i=t.match(B1);if(i){const s=Kd(n.originalDate||e,n);t=i.reduce(function(o,a){if(a[0]==="'")return o;const r=o.indexOf(a),l=o[r-1]==="'",c=o.replace(a,"'"+M1[a[0]](s,a,n)+"'");return l?c.substring(0,r-1)+c.substring(r+1):c},t)}return rs(e,t,n)}function z1(e,t,n){e=Kd(e,n);const i=Ya(t,e,!0),s=new Date(e.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function Fi(e,t,n,i){return i={...i,timeZone:t,originalDate:e},F1(z1(e,t,{timeZone:i.timeZone}),n,i)}const U1=(e,t)=>`${Fi(e,t,"yyyy")} W${Fi(e,t,"II")}`,Xa="MMM dd, h:mm:ss a",Ka="h:mm:ss a",rn="MMM dd, h:mm a",Fn="h:mm a",V1="MMM dd",Za="MMM dd, h:mm:ss a",Ue="MMM dd, h:mm a",H1={secondly:e=>e?Xa:Ka,tenSecondly:e=>e?Xa:Ka,thirtySecondly:e=>e?Xa:Ka,minutely:e=>e?rn:Fn,fiveMinutely:e=>e?rn:Fn,tenMinutely:e=>e?rn:Fn,thirtyMinutely:e=>e?rn:Fn,hourly:e=>e?rn:Fn,twoHourly:e=>e?rn:Fn,twelveHourly:()=>rn,daily:()=>V1},$1={secondly:()=>Za,tenSecondly:()=>Za,thirtySecondly:()=>Za,minutely:()=>Ue,fiveMinutely:()=>Ue,tenMinutely:()=>Ue,thirtyMinutely:()=>Ue,hourly:()=>Ue,twoHourly:()=>Ue,twelveHourly:()=>Ue,daily:()=>Ue};function eh({tickValue:e,granularity:t,timezone:n,dayBoundaryCrossed:i=!1,tickMap:s,tooltipMap:o,defaultFormat:a}){const r=n||Intl.DateTimeFormat().resolvedOptions().timeZone;if(t==="weekly")return U1(e,r);if(s&&s[t]){const l=s[t](i);return Fi(e,r,l)}if(o&&o[t]){const l=o[t]();return Fi(e,r,l)}return Fi(e,r,a)}const nh=({tickValue:e,granularity:t,dayBoundaryCrossed:n,timezone:i})=>eh({tickValue:e,granularity:t,timezone:i,dayBoundaryCrossed:n,tickMap:H1,defaultFormat:"MMM dd, h:mm:ss a"}),zn=({tickValue:e,granularity:t,timezone:n})=>eh({tickValue:e,granularity:t,timezone:n,tooltipMap:$1,defaultFormat:"MMM dd, yyyy h:mm:ss a"}),ih=e=>e?.code==="ERR_CANCELED"||e?.name==="CanceledError"||e?.name==="AbortError",Y1=e=>{const{i18n:t}=q.useI18n();return ih(e)?{type:"canceled",message:t.t("query_errors.canceled.message")}:e?.status===403?{status:e.status,type:"forbidden",message:t.t("query_errors.forbidden.message"),details:t.t("query_errors.forbidden.details")}:e?.status===408||e?.message?.includes("timeout")?{status:e.status,type:"timeout",message:t.t("query_errors.timeout.message"),details:t.t("query_errors.timeout.details")}:e?.response?.data?.message==="Range not allowed for this tier"?{status:e.status,type:"range_exceeded",message:t.t("query_errors.time_range_exceeded.message"),details:t.t("query_errors.time_range_exceeded.details")}:{status:e.status,type:"other",message:t.t("query_errors.other.message"),details:e.response?.data?.invalid_parameters?.map(n=>n.reason).join(", ")||e?.message}},zi=e=>e.toLocaleLowerCase().endsWith("count"),W1=e=>{const t=e.toLocaleLowerCase();return["sum","count","cost","tokens"].some(n=>t.endsWith(n))},j1=(e,t)=>{if(!e.length)return NaN;const i=Math.min(100,Math.max(0,t))/100*(e.length-1),s=Math.floor(i),o=Math.ceil(i);return s===o?e[s]:e[s]+(e[o]-e[s])*(i-s)},q1=(e,t)=>{const n=e.filter(i=>Number.isFinite(i)).sort((i,s)=>i-s);return new Map(t.map(i=>[i,j1(n,i)]))},sh=.7,Qa=(e,t)=>{const n=xs(e.trim());return n.valid?n.alpha(t).rgbString():e},Ja=e=>{const t=e??(typeof document>"u"?null:document.documentElement);if(typeof window>"u"||!t)return{medianLine:gl,outlier:fl,outlierBand:Qa(ml,sh)};const n=window.getComputedStyle(t),i=(s,o)=>n.getPropertyValue(s).trim()||o;return{medianLine:i("--kui-color-text",gl),outlier:i("--kui-color-background-danger",fl),outlierBand:Qa(i("--kui-color-background-danger-weakest",ml),sh)}},G1="empty",oh=e=>{if(!e||!("meta"in e)||!("data"in e))return;const{display:t,metric_names:n,metric_units:i,start:s,end:o,truncated:a,limit:r,datasource:l}=e.meta;if(!n?.length){console.error("Cannot build scatter chart data from this explore result. Missing metric names.");return}const c=n.length>1?n[0]:void 0,d=c?n[1]:n[0],h=t&&Object.keys(t)[0]||void 0,f=e.data??[],m=[];for(const p of f){const g=rh(p.timestamp,p.event[d],h?p.event[h]:void 0);if(g){if(c){const y=ah(p.event[c]);if(y===void 0)continue;g.x=y}m.push(g)}}return{points:m,metric:d,metricUnit:i?.[d],...c?{xMetric:c,xMetricUnit:i?.[c]}:{},dimension:h,display:h?t?.[h]:void 0,start:s,end:o,truncated:a,limit:r,datasource:l}},ah=e=>{if(e==null||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0},rh=(e,t,n,i)=>{const s=new Date(e).valueOf(),o=ah(t);if(!Number.isFinite(s)||o===void 0)return;const a=i?.length?{extras:i}:{};return n===void 0?{timestamp:s,value:o,...a}:{timestamp:s,value:o,group:n!==null&&n!==""?String(n):G1,...a}},X1=(e,t,n)=>{if(!n?.length)return;const i=[];for(const{field:s,label:o,unit:a}of n){const r=ln(e,s)??ln(t,s);r==null||r===""||i.push({label:o??s,value:r,...a?{unit:a}:{}})}return i.length?i:void 0},K1=(e,t)=>{if(!e||!("meta"in e))return;const{metric:n,dimension:i,unroll:s,display:o,extraFields:a,metricUnit:r}=t,l=t.timestamp??"request_start";if(!n){console.error("Cannot build scatter chart data from these request records. Missing metric.");return}const c=[];for(const d of e.results??[]){const h=ln(d,l);for(const f of Z1(d,s)){const m=ln(f,n),p=i?ln(f,i)??ln(d,i):void 0,g=rh(h,m,i?p??null:void 0,X1(f,d,a));g&&c.push(g)}}return{points:c,metric:n,metricUnit:r,dimension:i,display:o,start:e.meta?.time_range?.start,end:e.meta?.time_range?.end,truncated:e.truncated,limit:e.limit,datasource:"requests"}},Z1=(e,t)=>{if(!t)return[e];const n=ln(e,t);return Array.isArray(n)?n:[]},ln=(e,t)=>{let n=e;for(const i of t.split(".")){if(n===null||typeof n!="object")return;n=n[i]}return n},lh=e=>Object.hasOwn(ql.chartLabels,e),Q1=["hidden","single","full"],J1=["donut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar","scatter"],tD=["gauge","top_n","single_value"],tr=e=>e===null||typeof e!="object"||!("points"in e)?!1:Array.isArray(e.points);var It=(e=>(e.Hidden="hidden",e.Bottom="bottom",e))(It||{});const ch={modes:{point(e,t){return Ks(e,t,{intersect:!0})},nearest(e,t,n){return iD(e,t,n)},x(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"x"})},y(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"y"})}}};function er(e,t,n){return(ch.modes[n.mode]||ch.modes.nearest)(e,t,n)}function eD(e,t,n){return n!=="x"&&n!=="y"?e.inRange(t.x,t.y,"x",!0)||e.inRange(t.x,t.y,"y",!0):e.inRange(t.x,t.y,n,!0)}function nD(e,t,n){return n==="x"?{x:e.x,y:t.y}:n==="y"?{x:t.x,y:e.y}:t}function Ks(e,t,n){return e.filter(i=>n.intersect?i.inRange(t.x,t.y):eD(i,t,n.axis))}function iD(e,t,n){let i=Number.POSITIVE_INFINITY;return Ks(e,t,n).reduce((s,o)=>{const a=o.getCenterPoint(),r=nD(t,a,n.axis),l=Cn(t,r);return l<i?(s=[o],i=l):l===i&&s.push(o),s},[]).sort((s,o)=>s._index-o._index).slice(0,1)}function cn(e,t,n){const i=Math.cos(n),s=Math.sin(n),o=t.x,a=t.y;return{x:o+i*(e.x-o)-s*(e.y-a),y:a+s*(e.x-o)+i*(e.y-a)}}const sD=(e,t)=>t>e||e.length>t.length&&e.slice(0,t.length)===t,un=.001,Zs=(e,t,n)=>Math.min(n,Math.max(t,e)),uh=(e,t)=>e.value>=e.start-t&&e.value<=e.end+t;function oD(e,t,n){for(const i of Object.keys(e))e[i]=Zs(e[i],t,n);return e}function aD(e,t,n,i){return!e||!t||n<=0?!1:Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<=Math.pow(n+i,2)}function dh(e,{x:t,y:n,x2:i,y2:s},o,{borderWidth:a,hitTolerance:r}){const l=(a+r)/2,c=e.x>=t-l-un&&e.x<=i+l+un,d=e.y>=n-l-un&&e.y<=s+l+un;return o==="x"?c:(o==="y"||c)&&d}function hh(e,{rect:t,center:n},i,{rotation:s,borderWidth:o,hitTolerance:a}){const r=cn(e,n,Ot(-s));return dh(r,t,i,{borderWidth:o,hitTolerance:a})}function dn(e,t){const{centerX:n,centerY:i}=e.getProps(["centerX","centerY"],t);return{x:n,y:i}}function rD(e,t,n,i=!0){const s=n.split(".");let o=0;for(const a of t.split(".")){const r=s[o++];if(parseInt(a,10)<parseInt(r,10))break;if(sD(r,a)){if(i)throw new Error(`${e} v${n} is not supported. v${t} or newer is required.`);return!1}}return!0}const fh=e=>typeof e=="string"&&e.endsWith("%"),mh=e=>parseFloat(e)/100,ph=e=>Zs(mh(e),0,1),Ui=(e,t)=>({x:e,y:t,x2:e,y2:t,width:0,height:0}),lD={box:e=>Ui(e.centerX,e.centerY),doughnutLabel:e=>Ui(e.centerX,e.centerY),ellipse:e=>({centerX:e.centerX,centerY:e.centerX,radius:0,width:0,height:0}),label:e=>Ui(e.centerX,e.centerY),line:e=>Ui(e.x,e.y),point:e=>({centerX:e.centerX,centerY:e.centerY,radius:0,width:0,height:0}),polygon:e=>Ui(e.centerX,e.centerY)};function nr(e,t){return t==="start"?0:t==="end"?e:fh(t)?ph(t)*e:e/2}function Ve(e,t,n=!0){return typeof t=="number"?t:fh(t)?(n?ph(t):mh(t))*e:e}function cD(e,t){const{x:n,width:i}=e,s=t.textAlign;return s==="center"?n+i/2:s==="end"||s==="right"?n+i:n}function gh(e,t,{borderWidth:n,position:i,xAdjust:s,yAdjust:o},a){const r=st(a),l=t.width+(r?a.width:0)+n,c=t.height+(r?a.height:0)+n,d=ir(i),h=xh(e.x,l,s,d.x),f=xh(e.y,c,o,d.y);return{x:h,y:f,x2:h+l,y2:f+c,width:l,height:c,centerX:h+l/2,centerY:f+c/2}}function ir(e,t="center"){return st(e)?{x:Q(e.x,t),y:Q(e.y,t)}:(e=Q(e,t),{x:e,y:e})}const yh=(e,t)=>e&&e.autoFit&&t<1;function bh(e,t){const n=e.font,i=dt(n)?n:[n];return yh(e,t)?i.map(function(s){const o=wt(s);return o.size=Math.floor(s.size*t),o.lineHeight=s.lineHeight,wt(o)}):i.map(s=>wt(s))}function _h(e){return e&&(qt(e.xValue)||qt(e.yValue))}function xh(e,t,n=0,i){return e-nr(t,i)+n}function Un(e,t,n){const i=n.init;if(i){if(i===!0)return kh(t,n)}else return;return uD(e,t,n)}function wh(e,t,n){let i=!1;return t.forEach(s=>{Gt(e[s])?(i=!0,n[s]=e[s]):qt(n[s])&&delete n[s]}),i}function kh(e,t){const n=t.type||"line";return lD[n](e)}function uD(e,t,n){const i=mt(n.init,[{chart:e,properties:t,options:n}]);if(i===!0)return kh(t,n);if(st(i))return i}const sr=new Map,dD=e=>isNaN(e)||e<=0,hD=e=>e.reduce(function(t,n){return t+=n.string,t},"");function Qs(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function Js(e,{x:t,y:n},i){i&&(e.translate(t,n),e.rotate(Ot(i)),e.translate(-t,-n))}function ke(e,t){if(t&&t.borderWidth)return e.lineCap=t.borderCapStyle||"butt",e.setLineDash(t.borderDash),e.lineDashOffset=t.borderDashOffset,e.lineJoin=t.borderJoinStyle||"miter",e.lineWidth=t.borderWidth,e.strokeStyle=t.borderColor,!0}function Vn(e,t){e.shadowColor=t.backgroundShadowColor,e.shadowBlur=t.shadowBlur,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=t.shadowOffsetY}function to(e,t){const n=t.content;if(Qs(n))return{width:Ve(n.width,t.width),height:Ve(n.height,t.height)};const i=bh(t),s=t.textStrokeWidth,o=dt(n)?n:[n],a=o.join()+hD(i)+s+(e._measureText?"-spriting":"");return sr.has(a)||sr.set(a,gD(e,o,i,s)),sr.get(a)}function Th(e,t,n){const{x:i,y:s,width:o,height:a}=t;e.save(),Vn(e,n);const r=ke(e,n);e.fillStyle=n.backgroundColor,e.beginPath(),On(e,{x:i,y:s,w:o,h:a,radius:oD(Ie(n.borderRadius),0,Math.min(o,a)/2)}),e.closePath(),e.fill(),r&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore()}function Sh(e,t,n,i){const s=n.content;if(Qs(s)){e.save(),e.globalAlpha=_D(n.opacity,s.style.opacity),e.drawImage(s,t.x,t.y,t.width,t.height),e.restore();return}const o=dt(s)?s:[s],a=bh(n,i),r=n.color,l=dt(r)?r:[r],c=cD(t,n),d=t.y+n.textStrokeWidth/2;e.save(),e.textBaseline="middle",e.textAlign=n.textAlign,fD(e,n)&&yD(e,{x:c,y:d},o,a),bD(e,{x:c,y:d},o,{fonts:a,colors:l}),e.restore()}function fD(e,t){if(t.textStrokeWidth>0)return e.lineJoin="round",e.miterLimit=2,e.lineWidth=t.textStrokeWidth,e.strokeStyle=t.textStrokeColor,!0}function mD(e,t,n,i){const{radius:s,options:o}=t,a=o.pointStyle,r=o.rotation;let l=(r||0)*qo;if(Qs(a)){e.save(),e.translate(n,i),e.rotate(l),e.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),e.restore();return}dD(s)||pD(e,{x:n,y:i,radius:s,rotation:r,style:a,rad:l})}function pD(e,{x:t,y:n,radius:i,rotation:s,style:o,rad:a}){let r,l,c,d;switch(e.beginPath(),o){default:e.arc(t,n,i,0,yt),e.closePath();break;case"triangle":e.moveTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),e.closePath();break;case"rectRounded":d=i*.516,c=i-d,r=Math.cos(a+se)*c,l=Math.sin(a+se)*c,e.arc(t-r,n-l,d,a-it,a-bt),e.arc(t+l,n-r,d,a-bt,a),e.arc(t+r,n+l,d,a,a+bt),e.arc(t-l,n+r,d,a+bt,a+it),e.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,e.rect(t-c,n-c,2*c,2*c);break}a+=se;case"rectRot":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+l,n-r),e.lineTo(t+r,n+l),e.lineTo(t-l,n+r),e.closePath();break;case"crossRot":a+=se;case"cross":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"star":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r),a+=se,r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"line":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l);break;case"dash":e.moveTo(t,n),e.lineTo(t+Math.cos(a)*i,n+Math.sin(a)*i);break}e.fill()}function gD(e,t,n,i){e.save();const s=t.length;let o=0,a=i;for(let r=0;r<s;r++){const l=n[Math.min(r,n.length-1)];e.font=l.string;const c=t[r];o=Math.max(o,e.measureText(c).width+i),a+=l.lineHeight}return e.restore(),{width:o,height:a}}function yD(e,{x:t,y:n},i,s){e.beginPath();let o=0;i.forEach(function(a,r){const l=s[Math.min(r,s.length-1)],c=l.lineHeight;e.font=l.string,e.strokeText(a,t,n+c/2+o),o+=c}),e.stroke()}function bD(e,{x:t,y:n},i,{fonts:s,colors:o}){let a=0;i.forEach(function(r,l){const c=o[Math.min(l,o.length-1)],d=s[Math.min(l,s.length-1)],h=d.lineHeight;e.beginPath(),e.font=d.string,e.fillStyle=c,e.fillText(r,t,n+h/2+a),a+=h,e.fill()})}function _D(e,t){const n=Re(e)?e:t;return Re(n)?Zs(n,0,1):1}const vh=["left","bottom","top","right"];function xD(e,t){const{pointX:n,pointY:i,options:s}=t,o=s.callout,a=o&&o.display&&vD(t,o);if(!a||DD(t,o,a))return;if(e.save(),e.beginPath(),!ke(e,o))return e.restore();const{separatorStart:l,separatorEnd:c}=wD(t,a),{sideStart:d,sideEnd:h}=TD(t,a,l);(o.margin>0||s.borderWidth===0)&&(e.moveTo(l.x,l.y),e.lineTo(c.x,c.y)),e.moveTo(d.x,d.y),e.lineTo(h.x,h.y);const f=cn({x:n,y:i},t.getCenterPoint(),Ot(-t.rotation));e.lineTo(f.x,f.y),e.stroke(),e.restore()}function wD(e,t){const{x:n,y:i,x2:s,y2:o}=e,a=kD(e,t);let r,l;return t==="left"||t==="right"?(r={x:n+a,y:i},l={x:r.x,y:o}):(r={x:n,y:i+a},l={x:s,y:r.y}),{separatorStart:r,separatorEnd:l}}function kD(e,t){const{width:n,height:i,options:s}=e,o=s.callout.margin+s.borderWidth/2;return t==="right"?n+o:t==="bottom"?i+o:-o}function TD(e,t,n){const{y:i,width:s,height:o,options:a}=e,r=a.callout.start,l=SD(t,a.callout);let c,d;return t==="left"||t==="right"?(c={x:n.x,y:i+Ve(o,r)},d={x:c.x+l,y:c.y}):(c={x:n.x+Ve(s,r),y:n.y},d={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:d}}function SD(e,t){const n=t.side;return e==="left"||e==="top"?-n:n}function vD(e,t){const n=t.position;return vh.includes(n)?n:MD(e,t)}function MD(e,t){const{x:n,y:i,x2:s,y2:o,width:a,height:r,pointX:l,pointY:c,centerX:d,centerY:h,rotation:f}=e,m={x:d,y:h},p=t.start,g=Ve(a,p),y=Ve(r,p),_=[n,n+g,n+g,s],x=[i+y,o,i,o],T=[];for(let v=0;v<4;v++){const w=cn({x:_[v],y:x[v]},m,Ot(f));T.push({position:vh[v],distance:Cn(w,{x:l,y:c})})}return T.sort((v,w)=>v.distance-w.distance)[0].position}function DD(e,t,n){const{pointX:i,pointY:s}=e,o=t.margin;let a=i,r=s;return n==="left"?a+=o:n==="right"?a-=o:n==="top"?r+=o:n==="bottom"&&(r-=o),e.inRange(a,r)}const Mh={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function Hn(e,t,n){return t=typeof t=="number"?t:e.parse(t),xt(t)?e.getPixelForValue(t):n}function hn(e,t,n){const i=t[n];if(i||n==="scaleID")return i;const s=n.charAt(0),o=Object.values(e).filter(a=>a.axis&&a.axis===s);return o.length?o[0].id:s}function Dh(e,t){if(e){const n=e.options.reverse,i=Hn(e,t.min,n?t.end:t.start),s=Hn(e,t.max,n?t.start:t.end);return{start:i,end:s}}}function Ch(e,t){const{chartArea:n,scales:i}=e,s=i[hn(i,t,"xScaleID")],o=i[hn(i,t,"yScaleID")];let a=n.width/2,r=n.height/2;return s&&(a=Hn(s,t.xValue,s.left+s.width/2)),o&&(r=Hn(o,t.yValue,o.top+o.height/2)),{x:a,y:r}}function or(e,t){const n=e.scales,i=n[hn(n,t,"xScaleID")],s=n[hn(n,t,"yScaleID")];if(!i&&!s)return{};let{left:o,right:a}=i||e.chartArea,{top:r,bottom:l}=s||e.chartArea;const c=Ph(i,{min:t.xMin,max:t.xMax,start:o,end:a});o=c.start,a=c.end;const d=Ph(s,{min:t.yMin,max:t.yMax,start:l,end:r});return r=d.start,l=d.end,{x:o,y:r,x2:a,y2:l,width:a-o,height:l-r,centerX:o+(a-o)/2,centerY:r+(l-r)/2}}function Oh(e,t){if(!_h(t)){const n=or(e,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(n.width,n.height)/2,t.radius=i);const s=i*2,o=n.centerX+t.xAdjust,a=n.centerY+t.yAdjust;return{x:o-i,y:a-i,x2:o+i,y2:a+i,centerX:o,centerY:a,width:s,height:s,radius:i}}return OD(e,t)}function CD(e,t){const{scales:n,chartArea:i}=e,s=n[t.scaleID],o={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?AD(s,o,t):PD(n,o,t),o}function Ah(e,t){const n=or(e,t);return n.initProperties=Un(e,n,t),n.elements=[{type:"label",optionScope:"label",properties:ID(e,n,t),initProperties:n.initProperties}],n}function OD(e,t){const n=Ch(e,t),i=t.radius*2;return{x:n.x-t.radius+t.xAdjust,y:n.y-t.radius+t.yAdjust,x2:n.x+t.radius+t.xAdjust,y2:n.y+t.radius+t.yAdjust,centerX:n.x+t.xAdjust,centerY:n.y+t.yAdjust,radius:t.radius,width:i,height:i}}function Ph(e,t){const n=Dh(e,t)||t;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function AD(e,t,n){const i=Hn(e,n.value,NaN),s=Hn(e,n.endValue,i);e.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function PD(e,t,n){for(const i of Object.keys(Mh)){const s=e[hn(e,n,i)];if(s){const{min:o,max:a,start:r,end:l,startProp:c,endProp:d}=Mh[i],h=Dh(s,{min:n[o],max:n[a],start:s[r],end:s[l]});t[c]=h.start,t[d]=h.end}}}function ED({properties:e,options:t},n,i,s){const{x:o,x2:a,width:r}=e;return Eh({start:o,end:a,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:n.width})}function RD({properties:e,options:t},n,i,s){const{y:o,y2:a,height:r}=e;return Eh({start:o,end:a,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:n.height})}function Eh(e,t){const{start:n,end:i,borderWidth:s}=e,{position:o,padding:{start:a,end:r},adjust:l}=t,c=i-s-n-a-r-t.size;return n+s/2+l+nr(c,o)}function ID(e,t,n){const i=n.label;i.backgroundColor="transparent",i.callout.display=!1;const s=ir(i.position),o=At(i.padding),a=to(e.ctx,i),r=ED({properties:t,options:n},a,s,o),l=RD({properties:t,options:n},a,s,o),c=a.width+o.width,d=a.height+o.height;return{x:r,y:l,x2:r+c,y2:l+d,width:c,height:d,centerX:r+c/2,centerY:l+d/2,rotation:i.rotation}}const ar=["enter","leave"],rr=ar.concat("click");function LD(e,t,n){t.listened=wh(n,rr,t.listeners),t.moveListened=!1,ar.forEach(i=>{Gt(n[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Gt(i.click)&&(t.listened=!0),t.moveListened||ar.forEach(s=>{Gt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function ND(e,t,n){if(e.listened)switch(t.type){case"mousemove":case"mouseout":return BD(e,t,n);case"click":return FD(e,t,n)}}function BD(e,t,n){if(!e.moveListened)return;let i;t.type==="mousemove"?i=er(e.visibleElements,t,n.interaction):i=[];const s=e.hovered;e.hovered=i;const o={state:e,event:t};let a=Rh(o,"leave",s,i);return Rh(o,"enter",i,s)||a}function Rh({state:e,event:t},n,i,s){let o;for(const a of i)s.indexOf(a)<0&&(o=Ih(a.options[n]||e.listeners[n],a,t)||o);return o}function FD(e,t,n){const i=e.listeners,s=er(e.visibleElements,t,n.interaction);let o;for(const a of s)o=Ih(a.options.click||i.click,a,t)||o;return o}function Ih(e,t,n){return mt(e,[t.$context,n])===!0}const eo=["afterDraw","beforeDraw"];function zD(e,t,n){const i=t.visibleElements;t.hooked=wh(n,eo,t.hooks),t.hooked||i.forEach(s=>{t.hooked||eo.forEach(o=>{Gt(s.options[o])&&(t.hooked=!0)})})}function Lh(e,t,n){if(e.hooked){const i=t.options[n]||e.hooks[n];return mt(i,[t.$context])}}function UD(e,t,n){const i=WD(e.scales,t,n);let s=Nh(t,i,"min","suggestedMin");s=Nh(t,i,"max","suggestedMax")||s,s&&Gt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function VD(e,t){for(const n of e)$D(n,t)}function Nh(e,t,n,i){if(xt(t[n])&&!HD(e.options,n,i)){const s=e[n]!==t[n];return e[n]=t[n],s}}function HD(e,t,n){return qt(e[t])||qt(e[n])}function $D(e,t){for(const n of["scaleID","xScaleID","yScaleID"]){const i=hn(t,e,n);i&&!t[i]&&YD(e,n)&&console.warn(`No scale found with id '${i}' for annotation '${e.id}'`)}}function YD(e,t){if(t==="scaleID")return!0;const n=t.charAt(0);for(const i of["Min","Max","Value"])if(qt(e[n+i]))return!0;return!1}function WD(e,t,n){const i=t.axis,s=t.id,o=i+"ScaleID",a={min:Q(t.min,Number.NEGATIVE_INFINITY),max:Q(t.max,Number.POSITIVE_INFINITY)};for(const r of n)r.scaleID===s?Bh(r,t,["value","endValue"],a):hn(e,r,o)===s&&Bh(r,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Bh(e,t,n,i){for(const s of n){const o=e[s];if(qt(o)){const a=t.parse(o);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class $n extends Vt{inRange(t,n,i,s){const{x:o,y:a}=cn({x:t,y:n},this.getCenterPoint(s),Ot(-this.options.rotation));return dh({x:o,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options)}getCenterPoint(t){return dn(this,t)}draw(t){t.save(),Js(t,this.getCenterPoint(),this.options.rotation),Th(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return Ah(t,n)}}$n.id="boxAnnotation",$n.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},$n.defaultRoutes={borderColor:"color",backgroundColor:"color"},$n.descriptors={label:{_fallback:!0}};class no extends Vt{inRange(t,n,i,s){return hh({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return dn(this,t)}draw(t){const n=this.options;!n.display||!n.content||(ZD(t,this),t.save(),Js(t,this.getCenterPoint(),this.rotation),Sh(t,this,n,this._fitRatio),t.restore())}resolveElementProperties(t,n){const i=jD(t,n);if(!i)return{};const{controllerMeta:s,point:o,radius:a}=GD(t,n,i);let r=to(t.ctx,n);const l=XD(r,a);yh(n,l)&&(r={width:r.width*l,height:r.height*l});const{position:c,xAdjust:d,yAdjust:h}=n,f=gh(o,r,{borderWidth:0,position:c,xAdjust:d,yAdjust:h});return{initProperties:Un(t,f,n),...f,...s,rotation:n.rotation,_fitRatio:l}}}no.id="doughnutLabelAnnotation",no.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0},no.defaultRoutes={};function jD(e,t){return e.getSortedVisibleDatasetMetas().reduce(function(n,i){const s=i.controller;return s instanceof ki&&qD(e,t,i.data)&&(!n||s.innerRadius<n.controller.innerRadius)&&s.options.circumference>=90?i:n},void 0)}function qD(e,t,n){if(!t.autoHide)return!0;for(let i=0;i<n.length;i++)if(!n[i].hidden&&e.getDataVisibility(i))return!0}function GD({chartArea:e},t,n){const{left:i,top:s,right:o,bottom:a}=e,{innerRadius:r,offsetX:l,offsetY:c}=n.controller,d=(i+o)/2+l,h=(s+a)/2+c,f={left:Math.max(d-r,i),right:Math.min(d+r,o),top:Math.max(h-r,s),bottom:Math.min(h+r,a)},m={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},p=t.spacing+t.borderWidth/2,g=r-p,y=m.y>h,_=y?s+p:a-p,x=KD(_,d,h,g);return{controllerMeta:{_centerX:d,_centerY:h,_radius:g,_counterclockwise:y,...x},point:m,radius:Math.min(r,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function XD({width:e,height:t},n){const i=Math.sqrt(Math.pow(e,2)+Math.pow(t,2));return n*2/i}function KD(e,t,n,i){const s=Math.pow(n-e,2),o=Math.pow(i,2),a=t*-2,r=Math.pow(t,2)+s-o,l=Math.pow(a,2)-4*r;if(l<=0)return{_startAngle:0,_endAngle:yt};const c=(-a-Math.sqrt(l))/2,d=(-a+Math.sqrt(l))/2;return{_startAngle:bs({x:t,y:n},{x:c,y:e}).angle,_endAngle:bs({x:t,y:n},{x:d,y:e}).angle}}function ZD(e,t){const{_centerX:n,_centerY:i,_radius:s,_startAngle:o,_endAngle:a,_counterclockwise:r,options:l}=t;e.save();const c=ke(e,l);e.fillStyle=l.backgroundColor,e.beginPath(),e.arc(n,i,s,o,a,r),e.closePath(),e.fill(),c&&e.stroke(),e.restore()}class Vi extends Vt{inRange(t,n,i,s){return hh({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return dn(this,t)}draw(t){const n=this.options,i=!qt(this._visible)||this._visible;!n.display||!n.content||!i||(t.save(),Js(t,this.getCenterPoint(),this.rotation),xD(t,this),Th(t,this,n),Sh(t,QD(this),n),t.restore())}resolveElementProperties(t,n){let i;if(_h(n))i=Ch(t,n);else{const{centerX:r,centerY:l}=or(t,n);i={x:r,y:l}}const s=At(n.padding),o=to(t.ctx,n),a=gh(i,o,n,s);return{initProperties:Un(t,a,n),pointX:i.x,pointY:i.y,...a,rotation:n.rotation}}}Vi.id="labelAnnotation",Vi.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},Vi.defaultRoutes={borderColor:"color"};function QD({x:e,y:t,width:n,height:i,options:s}){const o=s.borderWidth/2,a=At(s.padding);return{x:e+a.left+o,y:t+a.top+o,width:n-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}const lr=(e,t,n)=>({x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}),cr=(e,t,n)=>lr(t,n,Math.abs((e-t.y)/(n.y-t.y))).x,Fh=(e,t,n)=>lr(t,n,Math.abs((e-t.x)/(n.x-t.x))).y,Hi=e=>e*e,JD=(e,t,{x:n,y:i,x2:s,y2:o},a)=>a==="y"?{start:Math.min(i,o),end:Math.max(i,o),value:t}:{start:Math.min(n,s),end:Math.max(n,s),value:e},zh=(e,t,n,i)=>(1-i)*(1-i)*e+2*(1-i)*i*t+i*i*n,ur=(e,t,n,i)=>({x:zh(e.x,t.x,n.x,i),y:zh(e.y,t.y,n.y,i)}),Uh=(e,t,n,i)=>2*(1-i)*(t-e)+2*i*(n-t),Vh=(e,t,n,i)=>-Math.atan2(Uh(e.x,t.x,n.x,i),Uh(e.y,t.y,n.y,i))+.5*it;class $i extends Vt{inRange(t,n,i,s){const o=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:n},{path:r,ctx:l}=this;if(r){ke(l,this.options),l.lineWidth+=this.options.hitTolerance;const{chart:d}=this.$context,h=t*d.currentDevicePixelRatio,f=n*d.currentDevicePixelRatio,m=l.isPointInStroke(r,h,f)||dr(this,a,s);return l.restore(),m}const c=Hi(o);return iC(this,a,c,s)||dr(this,a,s)}return tC(this,{mouseX:t,mouseY:n},i,{hitSize:o,useFinalPosition:s})}getCenterPoint(t){return dn(this,t)}draw(t){const{x:n,y:i,x2:s,y2:o,cp:a,options:r}=this;if(t.save(),!ke(t,r))return t.restore();Vn(t,r);const l=Math.sqrt(Math.pow(s-n,2)+Math.pow(o-i,2));if(r.curve&&a)return dC(t,this,a,l),t.restore();const{startOpts:c,endOpts:d,startAdjust:h,endAdjust:f}=jh(this),m=Math.atan2(o-i,s-n);t.translate(n,i),t.rotate(m),t.beginPath(),t.moveTo(0+h,0),t.lineTo(l-f,0),t.shadowColor=r.borderShadowColor,t.stroke(),hr(t,0,h,c),hr(t,l,-f,d),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){const i=CD(t,n),{x:s,y:o,x2:a,y2:r}=i,l=eC(i,t.chartArea),c=l?nC({x:s,y:o},{x:a,y:r},t.chartArea):{x:s,y:o,x2:a,y2:r,width:Math.abs(a-s),height:Math.abs(r-o)};if(c.centerX=(a+s)/2,c.centerY=(r+o)/2,c.initProperties=Un(t,c,n),n.curve){const h={x:c.x,y:c.y},f={x:c.x2,y:c.y2};c.cp=uC(c,n,Cn(h,f))}const d=sC(t,c,n.label);return d._visible=l,c.elements=[{type:"label",optionScope:"label",properties:d,initProperties:c.initProperties}],c}}$i.id="lineAnnotation";const Hh={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};$i.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Hh),fill:!1,length:12,start:Object.assign({},Hh),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Vi.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},$i.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},$i.defaultRoutes={borderColor:"color"};function tC(e,{mouseX:t,mouseY:n},i,{hitSize:s,useFinalPosition:o}){const a=JD(t,n,e.getProps(["x","y","x2","y2"],o),i);return uh(a,s)||dr(e,{mouseX:t,mouseY:n},o,i)}function eC({x:e,y:t,x2:n,y2:i},{top:s,right:o,bottom:a,left:r}){return!(e<r&&n<r||e>o&&n>o||t<s&&i<s||t>a&&i>a)}function $h({x:e,y:t},n,{top:i,right:s,bottom:o,left:a}){return e<a&&(t=Fh(a,{x:e,y:t},n),e=a),e>s&&(t=Fh(s,{x:e,y:t},n),e=s),t<i&&(e=cr(i,{x:e,y:t},n),t=i),t>o&&(e=cr(o,{x:e,y:t},n),t=o),{x:e,y:t}}function nC(e,t,n){const{x:i,y:s}=$h(e,t,n),{x:o,y:a}=$h(t,e,n);return{x:i,y:s,x2:o,y2:a,width:Math.abs(o-i),height:Math.abs(a-s)}}function iC(e,{mouseX:t,mouseY:n},i=un,s){const{x:o,y:a,x2:r,y2:l}=e.getProps(["x","y","x2","y2"],s),c=r-o,d=l-a,h=Hi(c)+Hi(d),f=h===0?-1:((t-o)*c+(n-a)*d)/h;let m,p;return f<0?(m=o,p=a):f>1?(m=r,p=l):(m=o+f*c,p=a+f*d),Hi(t-m)+Hi(n-p)<=i}function dr(e,{mouseX:t,mouseY:n},i,s){const o=e.label;return o.options.display&&o.inRange(t,n,s,i)}function sC(e,t,n){const i=n.borderWidth,s=At(n.padding),o=to(e.ctx,n),a=o.width+s.width+i,r=o.height+s.height+i;return aC(t,n,{width:a,height:r,padding:s},e.chartArea)}function oC(e){const{x:t,y:n,x2:i,y2:s}=e,o=Math.atan2(s-n,i-t);return o>it/2?o-it:o<it/-2?o+it:o}function aC(e,t,n,i){const{width:s,height:o,padding:a}=n,{xAdjust:r,yAdjust:l}=t,c={x:e.x,y:e.y},d={x:e.x2,y:e.y2},h=t.rotation==="auto"?oC(e):Ot(t.rotation),f=rC(s,o,h),m=lC(e,t,{labelSize:f,padding:a},i),p=e.cp?ur(c,e.cp,d,m):lr(c,d,m),g={size:f.w,min:i.left,max:i.right,padding:a.left},y={size:f.h,min:i.top,max:i.bottom,padding:a.top},_=Wh(p.x,g)+r,x=Wh(p.y,y)+l;return{x:_-s/2,y:x-o/2,x2:_+s/2,y2:x+o/2,centerX:_,centerY:x,pointX:p.x,pointY:p.y,width:s,height:o,rotation:ys(h)}}function rC(e,t,n){const i=Math.cos(n),s=Math.sin(n);return{w:Math.abs(e*i)+Math.abs(t*s),h:Math.abs(e*s)+Math.abs(t*i)}}function lC(e,t,n,i){let s;const o=cC(e,i);return t.position==="start"?s=Yh({w:e.x2-e.x,h:e.y2-e.y},n,t,o):t.position==="end"?s=1-Yh({w:e.x-e.x2,h:e.y-e.y2},n,t,o):s=nr(1,t.position),s}function Yh(e,t,n,i){const{labelSize:s,padding:o}=t,a=e.w*i.dx,r=e.h*i.dy,l=a>0&&(s.w/2+o.left-i.x)/a,c=r>0&&(s.h/2+o.top-i.y)/r;return Zs(Math.max(l,c),0,.25)}function cC(e,t){const{x:n,x2:i,y:s,y2:o}=e,a=Math.min(s,o)-t.top,r=Math.min(n,i)-t.left,l=t.bottom-Math.max(s,o),c=t.right-Math.max(n,i);return{x:Math.min(r,c),y:Math.min(a,l),dx:r<=c?1:-1,dy:a<=l?1:-1}}function Wh(e,t){const{size:n,min:i,max:s,padding:o}=t,a=n/2;return n>s-i?(s+i)/2:(i>=e-o-a&&(e=i+o+a),s<=e+o+a&&(e=s-o-a),e)}function jh(e){const t=e.options,n=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:n,endOpts:i,startAdjust:qh(e,n),endAdjust:qh(e,i)}}function qh(e,t){if(!t||!t.display)return 0;const{length:n,width:i}=t,s=e.options.borderWidth/2,o={x:n,y:i+s};return Math.abs(cr(0,o,{x:0,y:s}))}function hr(e,t,n,i){if(!i||!i.display)return;const{length:s,width:o,fill:a,backgroundColor:r,borderColor:l}=i,c=Math.abs(t-s)+n;e.beginPath(),Vn(e,i),ke(e,i),e.moveTo(c,-o),e.lineTo(t+n,0),e.lineTo(c,o),a===!0?(e.fillStyle=r||l,e.closePath(),e.fill(),e.shadowColor="transparent"):e.shadowColor=i.borderShadowColor,e.stroke()}function uC(e,t,n){const{x:i,y:s,x2:o,y2:a,centerX:r,centerY:l}=e,c=Math.atan2(a-s,o-i),d=ir(t.controlPoint,0),h={x:r+Ve(n,d.x,!1),y:l+Ve(n,d.y,!1)};return cn(h,{x:r,y:l},c)}function Gh(e,{x:t,y:n},{angle:i,adjust:s},o){!o||!o.display||(e.save(),e.translate(t,n),e.rotate(i),hr(e,0,-s,o),e.restore())}function dC(e,t,n,i){const{x:s,y:o,x2:a,y2:r,options:l}=t,{startOpts:c,endOpts:d,startAdjust:h,endAdjust:f}=jh(t),m={x:s,y:o},p={x:a,y:r},g=Vh(m,n,p,0),y=Vh(m,n,p,1)-it,_=ur(m,n,p,h/i),x=ur(m,n,p,1-f/i),T=new Path2D;e.beginPath(),T.moveTo(_.x,_.y),T.quadraticCurveTo(n.x,n.y,x.x,x.y),e.shadowColor=l.borderShadowColor,e.stroke(T),t.path=T,t.ctx=e,Gh(e,_,{angle:g,adjust:h},c),Gh(e,x,{angle:y,adjust:f},d)}class Yi extends Vt{inRange(t,n,i,s){const o=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y")return hC({x:t,y:n},this.getProps(["width","height","centerX","centerY"],s),o,a);const{x:r,y:l,x2:c,y2:d}=this.getProps(["x","y","x2","y2"],s),h=i==="y"?{start:l,end:d}:{start:r,end:c},f=cn({x:t,y:n},this.getCenterPoint(s),Ot(-o));return f[i]>=h.start-a-un&&f[i]<=h.end+a+un}getCenterPoint(t){return dn(this,t)}draw(t){const{width:n,height:i,centerX:s,centerY:o,options:a}=this;t.save(),Js(t,this.getCenterPoint(),a.rotation),Vn(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const r=ke(t,a);t.ellipse(s,o,i/2,n/2,it/2,0,2*it),t.fill(),r&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return Ah(t,n)}}Yi.id="ellipseAnnotation",Yi.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},$n.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Yi.defaultRoutes={borderColor:"color",backgroundColor:"color"},Yi.descriptors={label:{_fallback:!0}};function hC(e,t,n,i){const{width:s,height:o,centerX:a,centerY:r}=t,l=s/2,c=o/2;if(l<=0||c<=0)return!1;const d=Ot(n||0),h=Math.cos(d),f=Math.sin(d),m=Math.pow(h*(e.x-a)+f*(e.y-r),2),p=Math.pow(f*(e.x-a)-h*(e.y-r),2);return m/Math.pow(l+i,2)+p/Math.pow(c+i,2)<=1.0001}class io extends Vt{inRange(t,n,i,s){const{x:o,y:a,x2:r,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),d=(this.options.borderWidth+this.options.hitTolerance)/2;return i!=="x"&&i!=="y"?aD({x:t,y:n},this.getCenterPoint(s),c/2,d):uh(i==="y"?{start:a,end:l,value:n}:{start:o,end:r,value:t},d)}getCenterPoint(t){return dn(this,t)}draw(t){const n=this.options,i=n.borderWidth;if(n.radius<.1)return;t.save(),t.fillStyle=n.backgroundColor,Vn(t,n);const s=ke(t,n);mD(t,this,this.centerX,this.centerY),s&&!Qs(n.pointStyle)&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore(),n.borderWidth=i}resolveElementProperties(t,n){const i=Oh(t,n);return i.initProperties=Un(t,i,n),i}}io.id="pointAnnotation",io.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},io.defaultRoutes={borderColor:"color",backgroundColor:"color"};class so extends Vt{inRange(t,n,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&mC(this.elements,t,n,s);const o=cn({x:t,y:n},this.getCenterPoint(s),Ot(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),r=Math.min(...a),l=Math.max(...a);return o[i]>=r&&o[i]<=l}getCenterPoint(t){return dn(this,t)}draw(t){const{elements:n,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,Vn(t,i);const s=ke(t,i);let o=!0;for(const a of n)o?(t.moveTo(a.x,a.y),o=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,n){const i=Oh(t,n),{sides:s,rotation:o}=n,a=[],r=2*it/s;let l=o*qo;for(let c=0;c<s;c++,l+=r){const d=fC(i,n,l);d.initProperties=Un(t,i,n),a.push(d)}return i.elements=a,i}}so.id="polygonAnnotation",so.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},so.defaultRoutes={borderColor:"color",backgroundColor:"color"};function fC({centerX:e,centerY:t},{radius:n,borderWidth:i,hitTolerance:s},o){const a=(i+s)/2,r=Math.sin(o),l=Math.cos(o),c={x:e+r*n,y:t-l*n};return{type:"point",optionScope:"point",properties:{x:c.x,y:c.y,centerX:c.x,centerY:c.y,bX:e+r*(n+a),bY:t-l*(n+a)}}}function mC(e,t,n,i){let s=!1,o=e[e.length-1].getProps(["bX","bY"],i);for(const a of e){const r=a.getProps(["bX","bY"],i);r.bY>n!=o.bY>n&&t<(o.bX-r.bX)*(n-r.bY)/(o.bY-r.bY)+r.bX&&(s=!s),o=r}return s}const He={box:$n,doughnutLabel:no,ellipse:Yi,label:Vi,line:$i,point:io,polygon:so};Object.keys(He).forEach(e=>{_t.describe(`elements.${He[e].id}`,{_fallback:"plugins.annotation.common"})});const pC={update:Object.assign},gC=rr.concat(eo),Xh=(e,t)=>st(t)?pr(e,t):e,fr=e=>e==="color"||e==="font";function mr(e="line"){return He[e]?e:(console.warn(`Unknown annotation type: '${e}', defaulting to 'line'`),"line")}function yC(e,t,n,i){const s=_C(e,n.animations,i),o=t.annotations,a=kC(t.elements,o);for(let r=0;r<o.length;r++){const l=o[r],c=Kh(a,r,l.type),d=l.setContext(wC(e,c,a,l)),h=c.resolveElementProperties(e,d);h.skip=bC(h),"elements"in h&&(xC(c,h.elements,d,s),delete h.elements),qt(c.x)||Object.assign(c,h),Object.assign(c,h.initProperties),h.options=Zh(d),s.update(c,h)}}function bC(e){return isNaN(e.x)||isNaN(e.y)}function _C(e,t,n){return n==="reset"||n==="none"||n==="resize"?pC:new ra(e,t)}function xC(e,t,n,i){const s=e.elements||(e.elements=[]);s.length=t.length;for(let o=0;o<t.length;o++){const a=t[o],r=a.properties,l=Kh(s,o,a.type,a.initProperties),c=n[a.optionScope].override(a);r.options=Zh(c),i.update(l,r)}}function Kh(e,t,n,i){const s=He[mr(n)];let o=e[t];return(!o||!(o instanceof s))&&(o=e[t]=new s,Object.assign(o,i)),o}function Zh(e){const t=He[mr(e.type)],n={};n.id=e.id,n.type=e.type,n.drawTime=e.drawTime,Object.assign(n,pr(e,t.defaults),pr(e,t.defaultRoutes));for(const i of gC)n[i]=e[i];return n}function pr(e,t){const n={};for(const i of Object.keys(t)){const s=t[i],o=e[i];fr(i)&&dt(o)?n[i]=o.map(a=>Xh(a,s)):n[i]=Xh(o,s)}return n}function wC(e,t,n,i){return t.$context||(t.$context=Object.assign(Object.create(e.getContext()),{element:t,get elements(){return n.filter(s=>s&&s.options)},id:i.id,type:"annotation"}))}function kC(e,t){const n=t.length,i=e.length;if(i<n){const s=n-i;e.splice(i,0,...new Array(s))}else i>n&&e.splice(n,i-n);return e}var TC="3.1.0";const $e=new Map,Qh=e=>e.type!=="doughnutLabel",SC=rr.concat(eo);var Jh={id:"annotation",version:TC,beforeRegister(){rD("chart.js","4.0",Xt.version)},afterRegister(){Xt.register(He)},afterUnregister(){Xt.unregister(He)},beforeInit(e){$e.set(e,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(e,t,n){const i=$e.get(e),s=i.annotations=[];let o=n.annotations;st(o)?Object.keys(o).forEach(a=>{const r=o[a];st(r)&&(r.id=a,s.push(r))}):dt(o)&&s.push(...o),VD(s.filter(Qh),e.scales)},afterDataLimits(e,t){const n=$e.get(e);UD(e,t.scale,n.annotations.filter(Qh).filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(e,t,n){const i=$e.get(e);LD(e,i,n),yC(e,i,n,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),zD(e,i,n)},beforeDatasetsDraw(e,t,n){Wi(e,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(e,t,n){Wi(e,"afterDatasetsDraw",n.clip)},beforeDatasetDraw(e,t,n){Wi(e,t.index,n.clip)},beforeDraw(e,t,n){Wi(e,"beforeDraw",n.clip)},afterDraw(e,t,n){Wi(e,"afterDraw",n.clip)},beforeEvent(e,t,n){const i=$e.get(e);ND(i,t.event,n)&&(t.changed=!0)},afterDestroy(e){$e.delete(e)},getAnnotations(e){const t=$e.get(e);return t?t.elements:[]},_getAnnotationElementsAtEventForMode(e,t,n){return er(e,t,n)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:e=>!SC.includes(e)&&e!=="init",annotations:{_allKeys:!1,_fallback:(e,t)=>`elements.${He[mr(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:fr,_fallback:!0},_indexable:fr}},additionalOptionScopes:[""]};function Wi(e,t,n){const{ctx:i,chartArea:s}=e,o=$e.get(e);n&&bi(i,s);const a=vC(o.visibleElements,t).sort((r,l)=>r.element.options.z-l.element.options.z);for(const r of a)MC(i,s,o,r);n&&_i(i)}function vC(e,t){const n=[];for(const i of e)if(i.options.drawTime===t&&n.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&n.push({element:s});return n}function MC(e,t,n,i){const s=i.element;i.main?(Lh(n,s,"beforeDraw"),s.draw(e,t),Lh(n,s,"afterDraw")):s.draw(e,t)}const DC={class:"zoom-timerange-container"},CC={class:"zoom-timerange-details"},OC={class:"label","data-testid":"zoom-timerange-from"},AC={class:"label","data-testid":"zoom-timerange-to"},PC=u.defineComponent({__name:"ZoomTimerange",props:{start:{},end:{},granularity:{}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.ref(zn({tickValue:t.start,granularity:t.granularity})),s=u.ref(zn({tickValue:t.end,granularity:t.granularity})),o=(a,r)=>{Nd(()=>{i.value=zn({tickValue:a,granularity:t.granularity}),s.value=zn({tickValue:r,granularity:t.granularity})},100)()};return u.watch(()=>[t.start,t.end],([a,r])=>{o(a,r)},{immediate:!0}),(a,r)=>(u.openBlock(),u.createElementBlock("div",DC,[u.createElementVNode("div",CC,[u.createElementVNode("div",OC,u.toDisplayString(u.unref(n).t("zoom_time_range.from")),1),u.createElementVNode("div",null,u.toDisplayString(i.value),1),u.createElementVNode("div",AC,u.toDisplayString(u.unref(n).t("zoom_time_range.to")),1),u.createElementVNode("div",null,u.toDisplayString(s.value),1)])]))}}),Pt=(e,t)=>{const n=e.__vccOpts||e;for(const[i,s]of t)n[i]=s;return n},tf=Pt(PC,[["__scopeId","data-v-4fa681cf"]]),EC={class:"zoom-actions-container"},RC={class:"zoom-actions-heading"},IC={class:"zoom-action-select"},LC=["data-testid"],NC=["aria-disabled","href"],BC=["onClick"],FC=Pt(u.defineComponent({__name:"ZoomActions",props:{zoomActionItems:{},newTimeRange:{},granularity:{}},emits:["onAction"],setup(e,{emit:t}){const n=e,i=t,s=o=>{o.action&&(o.action(n.newTimeRange),i("onAction"))};return(o,a)=>(u.openBlock(),u.createElementBlock("div",EC,[u.createElementVNode("div",RC,[u.createVNode(tf,{end:e.newTimeRange.end,granularity:e.granularity,start:e.newTimeRange.start},null,8,["end","granularity","start"]),u.createVNode(u.unref(Tt.CloseIcon),{class:"zoom-actions-close-icon",color:`var(--kui-color-text-neutral, ${u.unref(yl)})`,size:`var(--kui-icon-size-30, ${u.unref(Tn)})`,onClick:a[0]||(a[0]=r=>o.$emit("onAction"))},null,8,["color","size"])]),a[2]||(a[2]=u.createElementVNode("div",{class:"zoom-actions-heading-divider"},null,-1)),u.createElementVNode("div",IC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.zoomActionItems,r=>(u.openBlock(),u.createElementBlock("div",{key:r.key,class:u.normalizeClass(["zoom-action-item",{disabled:r.disabled}]),"data-testid":`zoom-action-item-${r.key}`},[r.href?(u.openBlock(),u.createElementBlock("a",{key:0,"aria-disabled":r.disabled,class:"zoom-action-link",href:r.href,onClick:a[1]||(a[1]=l=>o.$emit("onAction"))},u.toDisplayString(r.label),9,NC)):(u.openBlock(),u.createElementBlock("div",{key:1,onClick:l=>s(r)},u.toDisplayString(r.label),9,BC))],10,LC))),128))])]))}}),[["__scopeId","data-v-79ba72f8"]]),zC={key:2},UC={class:"tooltip-title"},VC={class:"title"},HC={key:0,class:"subtitle"},$C={class:"context"},YC={class:"metric"},WC={class:"tooltip"},jC={key:0,class:"square-marker marker-placeholder"},qC={class:"display-value"},ji=Pt(u.defineComponent({__name:"ChartTooltip",props:{state:{},tooltipTitle:{default:""},absoluteLeft:{default:"0px"},absoluteTop:{default:"0px"},zoomTimeRange:{default:void 0},zoomActionItems:{default:void 0},granularity:{default:void 0}},emits:["dimensions","onAction"],setup(e,{emit:t}){const n=t,i=e,s=u.ref(null),{x:o,y:a,isDragging:r}=LM(s,{initialValue:{x:parseFloat(i.absoluteLeft),y:parseFloat(i.absoluteTop)}}),l=u.computed(()=>`${a.value}px`),c=u.computed(()=>`${o.value}px`),d=u.computed(()=>i.state.tooltipContext),h=u.computed(()=>i.state.metricDisplay),f=u.computed(()=>["interactive","zoom-interactive"].includes(i.state.interactionMode));return u.watch(()=>[i.absoluteLeft,i.absoluteTop],([m,p])=>{r.value||(o.value=parseFloat(m),a.value=parseFloat(p))}),u.watch(r,m=>{m?document.body.classList.add("no-select"):document.body.classList.remove("no-select")}),u.watch(s,m=>{if(m){const{width:p,height:g}=m.getBoundingClientRect();n("dimensions",{width:p,height:g})}}),(m,p)=>e.state.showTooltip?(u.openBlock(),u.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:u.normalizeClass(["tooltip-container",{locked:e.state.interactionMode==="interactive"}]),style:u.normalizeStyle({transform:f.value?`translate(${c.value}, ${l.value})`:`translate(${e.absoluteLeft}, ${e.absoluteTop})`,left:"0",top:"0",pointerEvents:f.value?"all":"none"})},[e.state.interactionMode==="selecting-chart-area"&&e.granularity&&e.zoomTimeRange&&e.zoomTimeRange.end&&e.zoomTimeRange.start?(u.openBlock(),u.createBlock(tf,{key:0,end:e.zoomTimeRange?.end,granularity:e.granularity,start:e.zoomTimeRange?.start},null,8,["end","granularity","start"])):e.state.interactionMode==="zoom-interactive"&&e.zoomTimeRange&&e.zoomActionItems&&e.granularity?(u.openBlock(),u.createBlock(FC,{key:1,granularity:e.granularity,"new-time-range":e.zoomTimeRange,"zoom-action-items":e.zoomActionItems,onOnAction:p[0]||(p[0]=g=>n("onAction"))},null,8,["granularity","new-time-range","zoom-action-items"])):(u.openBlock(),u.createElementBlock("div",zC,[u.createElementVNode("div",UC,[u.createElementVNode("div",VC,[u.createElementVNode("div",null,u.toDisplayString(e.tooltipTitle),1),f.value?(u.openBlock(),u.createBlock(u.unref(Tt.DragIcon),{key:0,class:"drag-icon",color:`var(--kui-color-text-neutral, ${u.unref(yl)})`,size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["color","size"])):u.createCommentVNode("",!0)]),d.value||h.value?(u.openBlock(),u.createElementBlock("div",HC,[u.createElementVNode("div",$C,u.toDisplayString(d.value),1),u.createElementVNode("div",YC,u.toDisplayString(h.value),1)])):u.createCommentVNode("",!0)]),u.createElementVNode("ul",WC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.state.tooltipSeries,({backgroundColor:g,borderColor:y,label:_,value:x,isSegmentEmpty:T,isExtra:v},w)=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:_+w},[e.state.tooltipSeries.length?(u.openBlock(),u.createElementBlock("li",{key:0,class:u.normalizeClass({"extra-row":v})},[v?(u.openBlock(),u.createElementBlock("div",jC)):(u.openBlock(),u.createElementBlock("div",{key:1,class:"square-marker",style:u.normalizeStyle({background:String(g),borderColor:String(y)})},null,4)),u.createElementVNode("span",{class:u.normalizeClass(["display-label",{empty:T}])},u.toDisplayString(_),3),u.createElementVNode("span",qC,u.toDisplayString(x),1)],2)):u.createCommentVNode("",!0)],64))),128))])]))],6)):u.createCommentVNode("",!0)}}),[["__scopeId","data-v-fb2f2a72"]]),GC={key:0,class:"legend-container","data-testid":"legend"},XC=["onClick"],KC={key:0,"aria-hidden":"true",class:"line-marker",height:"2",width:"16"},ZC=["stroke","stroke-dasharray"],QC=["title"],JC={class:"label truncate-label"},tO={key:0,class:"sub-label"},eO={key:0},nO={class:"tooltip-content"},oo=Pt(u.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.inject("showLegendValues",!1),s=u.inject("legendPosition",u.ref(It.Bottom)),o=({datasetIndex:l,index:c,isKey:d},h)=>d?`key-${h}`:`dataset-${l??0}-${c??0}`,a=(l=0,c)=>{if(t.chartInstance===null)return;const d=t.chartInstance instanceof Xt?t.chartInstance:t.chartInstance.chart,h=r(l,c);!d.getDatasetMeta(l).dataset&&c!==void 0?d.toggleDataVisibility(c):h?d.hide(l,c):d.show(l,c),d.update()},r=(l=0,c)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const d=t.chartInstance instanceof Xt?t.chartInstance:t.chartInstance.chart;return d.getDatasetMeta(l).dataset||c===void 0?d.isDatasetVisible(l):d.getDataVisibility(c)};return(l,c)=>{const d=u.resolveComponent("KTooltip");return u.unref(s)!==u.unref(It).Hidden?(u.openBlock(),u.createElementBlock("ul",GC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.items,({fillStyle:h,strokeStyle:f,text:m,datasetIndex:p,index:g,value:y,isSegmentEmpty:_,isKey:x,lineDash:T},v)=>(u.openBlock(),u.createElementBlock("li",{key:o({datasetIndex:p,index:g,isKey:x},v),class:u.normalizeClass({"legend-key":x}),onClick:w=>x?void 0:a(p,g)},[T?.length?(u.openBlock(),u.createElementBlock("svg",KC,[u.createElementVNode("line",{stroke:f,"stroke-dasharray":T.join(" "),"stroke-width":"2",x1:"0",x2:"16",y1:"1",y2:"1"},null,8,ZC)])):(u.openBlock(),u.createElementBlock("div",{key:1,class:"square-marker",style:u.normalizeStyle({background:h,"border-color":f})},null,4)),u.createVNode(d,null,u.createSlots({default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["label-container",{"strike-through":!x&&!r(p,g),"inline-value":x}]),title:y&&(u.unref(i)||x)?`${m}: ${y.formatted}`:m},[u.createElementVNode("div",JC,u.toDisplayString(m),1),y&&(u.unref(i)||x)?(u.openBlock(),u.createElementBlock("div",tO,[x?(u.openBlock(),u.createElementBlock("span",eO,"-")):u.createCommentVNode("",!0),u.createTextVNode(" "+u.toDisplayString(y.formatted),1)])):u.createCommentVNode("",!0)],10,QC)]),_:2},[_?{name:"content",fn:u.withCtx(()=>[u.createElementVNode("div",nO,u.toDisplayString(u.unref(n).t("emptyEntityInfo")),1)]),key:"0"}:void 0]),1024)],10,XC))),128))])):u.createCommentVNode("",!0)}}}),[["__scopeId","data-v-90ef4d12"]]),Lt=[];for(let e=0;e<256;++e)Lt.push((e+256).toString(16).slice(1));function iO(e,t=0){return(Lt[e[t+0]]+Lt[e[t+1]]+Lt[e[t+2]]+Lt[e[t+3]]+"-"+Lt[e[t+4]]+Lt[e[t+5]]+"-"+Lt[e[t+6]]+Lt[e[t+7]]+"-"+Lt[e[t+8]]+Lt[e[t+9]]+"-"+Lt[e[t+10]]+Lt[e[t+11]]+Lt[e[t+12]]+Lt[e[t+13]]+Lt[e[t+14]]+Lt[e[t+15]]).toLowerCase()}const sO=new Uint8Array(16);function oO(){return crypto.getRandomValues(sO)}function gr(e,t,n){return crypto.randomUUID?crypto.randomUUID():aO(e)}function aO(e,t,n){e=e||{};const i=e.random??e.rng?.()??oO();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,iO(i)}const ef=(e,t)=>{const n=e.ctx,i=e.scales.y,s=e.scales.x,o=t[t.length-1].element;n.save(),n.strokeStyle="rgba(100, 100, 100, 1)",n.lineWidth=3,e.options.indexAxis==="x"?n.strokeRect(o.x-o.width/2,o.y,o.width,i.bottom-o.y):n.strokeRect(s.left,o.y-o.height/2,o.x-s.left,o.height),n.restore()};class nf{id="highlightPlugin";_clickedElements;_previousHoverOption;_clicked=!1;_pause=!1;_suppressNextClick=!1;afterDatasetsDraw(t){this._clickedElements&&this._clickedElements.length&&!this._pause&&ef(t,this._clickedElements)}afterEvent(t,{event:n}){if(n.type==="click"&&this._suppressNextClick){this._suppressNextClick=!1;return}if(n.type!=="click"||!n.native||this._pause)return;this._clicked=!this._clicked;const i=t.options.interaction?.mode||"index",s=t.getElementsAtEventForMode(n.native,i,{intersect:!1},!0);s.length&&this._clicked?(this._clickedElements=s,ef(t,this._clickedElements),this._previousHoverOption=t.options.hover,t.options.hover={mode:null}):(delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1)}beforeDestroy(t){delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1}pause(){this._pause=!0}get isPaused(){return this._pause}resume(t=!1){this._pause=!1,t&&(this._suppressNextClick=!0)}}const rO=(e,t,n,i,s="#0275d8")=>{e&&(e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore())};class ao{id="coordinator";coordinator=null;instanceId="";stopWatcher=void 0;activeDimension=null;activeDimensionValue=null;requiresUpdate=!1;triggerOnSelf=!1;watchTimestamp=!1;watchDimension=!1;lastMouseBrushEvent=0;constructor({coordinator:t,requiresUpdate:n=!1,triggerOnSelf:i=!1,watchTimestamp:s=!1,watchDimension:o=!1}){this.instanceId=crypto.randomUUID(),this.coordinator=t,this.requiresUpdate=n,this.triggerOnSelf=i,this.watchTimestamp=s,this.watchDimension=o}afterInit(t){if(!this.coordinator)return;const n=this.requiresUpdate?()=>t.update("none"):()=>t.draw(),i=this._watchTimestamp(n),s=this._watchDimension(n);this.stopWatcher=()=>{i&&i(),s&&s()}}afterEvent(t,{event:n}){this.coordinator&&(n.type==="mousemove"||n.type==="mouseout")&&requestAnimationFrame(i=>this._onMouseBrush(n.native,t,i))}beforeDatasetDraw(t,n){if(!this.coordinator||!this.watchDimension||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;t.config.type==="doughnut"?this._highlightDimensionDonut(t):this._highlightDimensionDefault(t,n)}afterDatasetsDraw(t){if(t.ctx.globalAlpha=1,!this.coordinator||!this.watchTimestamp||!this.coordinator.activeTimestamp.value||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;const i=t.scales.x.getPixelForValue(this.coordinator.activeTimestamp.value),s=t.ctx;rO(s,i,t.scales.y.top,t.scales.y.bottom)}beforeDestroy(){this.stopWatcher&&this.stopWatcher()}_watchTimestamp(t){if(!this.coordinator)return;let n;return this.watchTimestamp&&(n=u.watch([this.coordinator.activeChart,this.coordinator.activeTimestamp],([i])=>{(i!==this.instanceId||this.triggerOnSelf)&&t()})),n}_watchDimension(t){if(!this.coordinator)return;let n;if(this.watchDimension){let i;n=u.watch([this.coordinator.activeChart,this.coordinator.activeDimension,this.coordinator.activeDimensionValue],([s,o,a])=>{clearTimeout(i),o===null&&(this.activeDimension=null),a===null&&(this.activeDimensionValue=null),i=setTimeout(()=>{this.activeDimension=o,this.activeDimensionValue=a,(s!==this.instanceId||this.triggerOnSelf)&&t()},this.coordinator?.DIMENSION_DEBOUNCE_MS??400),u.onWatcherCleanup(()=>{clearTimeout(i)})})}return n}_onMouseBrush(t,n,i){if(!this.coordinator)return;const s=t.type,o=Math.min(this.coordinator.TIMESTAMP_DEBOUNCE_MS,this.coordinator.DIMENSION_DEBOUNCE_MS);if(!(s==="mousemove"&&i-this.lastMouseBrushEvent<o)){if(s==="mousemove"){const a=this._getTimestamp(n,t),[r,l]=this._getDatasetDimension(n,t)??[];this.coordinator.activate({chartUuid:this.instanceId,timestamp:a,dimension:r,dimensionValue:l})}else s==="mouseout"&&this.coordinator.deactivate({chartUuid:this.instanceId});this.lastMouseBrushEvent=i}}_highlightDimensionDefault(t,n){if(this.activeDimension&&this.activeDimensionValue){const i=t.data.datasets.map((s,o)=>s?.dimension===this.activeDimension&&s?.dimensionValue===this.activeDimensionValue?o:-1).filter(s=>s>=0);i.length&&(t.ctx.globalAlpha=i.includes(n.index)?1:.3)}else t.ctx.globalAlpha=1}_highlightDimensionDonut(t){if(this.activeDimension&&this.activeDimensionValue){const{dimension:n,dimensionValue:i}=t.data.datasets[0];if(n===this.activeDimension){const s=i.findIndex(o=>o===this.activeDimensionValue);s>=0?t.setActiveElements([{datasetIndex:0,index:s}]):t.setActiveElements([])}else t.setActiveElements([])}else t.setActiveElements([])}_getDatasetDimension(t,n){const i=t.config.type,s=i!=="line",o=["doughnut","scatter"].includes(i)?"point":"dataset",a=t.getElementsAtEventForMode(n,o,{intersect:s},!1),[r]=a;if(!r)return;const{datasetIndex:l,index:c}=r,{dimension:d,dimensionValue:h}=t.data.datasets[l];return i==="doughnut"?[d,h[c]]:[d,h]}_getTimestamp(t,n){const[i]=t.getElementsAtEventForMode(n,"index",{intersect:!1},!1);if(i&&this.watchTimestamp){const{datasetIndex:s,index:o}=i,{x:a}=t.data.datasets[s].data[o];return a}}}const lO=["id"],cO=["id"],uO={class:"axis-tooltip-content"},dO="100%",hO="100%",fO=20,mO=20,sf=6,pO=0,gO=10,yO=10,bO=1,_O=Pt(u.defineComponent({__name:"StackedBarChart",props:{chartData:{},tooltipTitle:{default:""},legendValues:{default:void 0},metricUnit:{default:""},orientation:{default:"horizontal"},annotations:{type:Boolean,default:!0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},stacked:{type:Boolean,default:!0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""}},setup(e){const t=e,{i18n:n}=q.useI18n(),{translateUnit:i}=q.useTranslatedUnits(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=new nf,r=u.inject("analytics-dashboard-coordinator",null),l=new ao({coordinator:r,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),c=u.useTemplateRef("chartContainer"),d=u.useTemplateRef("chartParent"),h=({chart:F},nt)=>{const gt=F.data,ct=gt.labels?.indexOf(nt);return gt.datasets.reduce((at,Ct,B)=>{if(F.isDatasetVisible(B)){const U=Ct.data[ct];return isNaN(U)?at:at+U}else return at},0)},f=(F,nt,gt,ct)=>{const at=ct==="horizontal";nt===null&&(nt=n.t("entityNoName"));const Ct={type:"label",yValue:J=>at?nt:h(J,nt),xValue:J=>at?h(J,nt):nt},B={...Ct,position:at?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>at?0:-Math.abs(o1()),content:J=>zd(h(J,nt),gt)},U={...Ct,content:J=>r1(h(J,nt),a1(J.chart,F)),position:at?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:J=>at?s1(zd(h(J,nt),gt)):0,color:ZM};return{[`${nt}-value`]:B,[`${nt}-percent`]:U}},m=u.useTemplateRef("canvas"),p=u.useTemplateRef("axis"),g=gr(),y=gr(),_=u.ref([]),x=u.inject("legendPosition",It.Bottom),T=u.reactive({show:!1,top:"0px",left:"0px",text:"",offset:-50}),v=u.toRef(t,"metricUnit"),w=u.computed(()=>t.orientation==="horizontal"),M=u.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:u.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:u.toRef(t,"dimensionAxesTitle"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,interactionMode:"idle",chartType:w.value?"horizontal_bar":"vertical_bar",chartID:o,chartTooltipSortFn:t.chartTooltipSortFn}),{tooltipAbsoluteLeft:D,tooltipAbsoluteTop:P}=q.useTooltipAbsolutePosition(d,M),k=u.ref(0),S=()=>t.annotations&&t.chartData.labels?.reduce((F,nt)=>Object.assign(F,f(t.chartData,nt,v.value,t.orientation)),{}),A={id:g,afterUpdate(F){k.value+=1,_.value=La(F,t.legendValues,t.chartLegendSortFn)}},L={id:y,afterUpdate(F){F.options.plugins.annotation.annotations=t.annotations?S():{}}},H=[A,{id:"axisHover",afterEvent(F,nt){if(T.show=!1,nt.event.type==="mousemove"){const gt=nt.event,ct=F.options.indexAxis,at=F.scales,Ct=F.scales[ct].getLabelForValue(Number(F.scales[ct].getValueForPixel(gt[ct]))),U=F.scales[ct].getLabels().indexOf(Ct),J=t.chartData.isLabelEmpty?.[U];if((fe=>fe==="x"?gt.y>at.x.top:gt.x<at.y.right)(ct)){M.interactionMode!=="interactive"&&(M.showTooltip=!1);const fn=F.canvas.getContext("2d").measureText(Ct).width,Te=Math.abs(Math.round(gt.x-fn*.5)),mn=Math.round(gt.x+fn*.5),Wn=F.canvas.getBoundingClientRect(),lo=40;T.left=ct==="x"?`${(Te>0?Te:mn)-T.offset+Wn.left}px`:`${gt.x-fn*.5-T.offset+Wn.left}px`,T.top=`${gt.y-lo+Wn.top}px`,Ct.length>qs?(T.show=!0,T.text=Ct):J?(T.text=n.t("emptyEntityInfo"),T.show=!0):T.show=!1}else T.show=!1}}},a,l,...t.annotations?[L]:[]],W=u.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),$=u.ref(0),K=u.ref(0),lt=new ResizeObserver(Nd(F=>{$.value=F[0].contentRect.width,K.value=F[0].contentRect.height},100)),rt=u.computed(()=>{const F=t.chartData?.labels?.length;return m.value&&F&&!w.value?`${Math.max(F*(fO+sf),$.value)}px`:dO}),X=u.computed(()=>{const F=t.chartData?.labels?.length;return m.value&&F&&w.value?`${Math.max(F*(mO+sf),K.value)}px`:hO});q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey")),u.onMounted(()=>{t.annotations&&Xt.register(Jh),c.value&&($.value=c.value.offsetWidth,K.value=c.value.offsetHeight,lt.observe(c.value))}),u.onUnmounted(()=>{c.value&<.unobserve(c.value)});const z=u.computed(()=>{const F=q.useBarChartOptions({tooltipState:M,legendID:g,stacked:u.toRef(t,"stacked"),metricAxesTitle:u.toRef(t,"metricAxesTitle"),dimensionAxesTitle:u.toRef(t,"dimensionAxesTitle"),indexAxis:w.value?"y":"x",numLabels:W});return{...F.value,plugins:{...F.value.plugins,annotation:{annotations:S(),clip:!1}}}}),C=q.useChartJSCommon("bar",m,u.toRef(t,"chartData"),H,z);u.onBeforeUnmount(()=>{Xt.unregister(Jh)});const E={[It.Bottom]:"column"},N=u.computed(()=>{if(p.value&&C.value){const F=window.devicePixelRatio,nt=C.value,gt=nt.scales.y.width*F+bO,ct=(nt.scales.y.height+nt.scales.y.top+nt.scales.x.height)*F,at=p.value.getContext("2d");return at.scale(F,F),at.canvas.width=gt,at.canvas.height=ct,at.canvas.style.width=`${gt/F}px`,at.canvas.style.height=`${ct/F}px`,{scale:F,width:gt*F,height:ct*F,targetCtx:at}}return null}),V=F=>{const nt=F.target;if(N.value&&C.value&&!w.value){const gt=N.value.scale,ct=N.value.targetCtx,at=N.value.width,Ct=N.value.height,B=C.value,U=B.canvas;ct.fillStyle="white",nt.scrollLeft>=pO&&nt.scrollLeft<=gO?(ct.globalCompositeOperation="source-over",ct.clearRect(0,0,at,Ct),ct.drawImage(U,0,0,at,Ct,0,0,at,Ct),ct.globalCompositeOperation="destination-over",ct.fillRect(0,0,at,Ct)):(ct.globalCompositeOperation="source-over",ct.fillRect(0,(B.scales.y.height+B.scales.y.top+yO)*gt,at,B.scales.x.height*gt))}M.offsetY=nt.scrollTop,M.offsetX=nt.scrollLeft,T.offset=nt.scrollLeft},tt=({width:F,height:nt})=>{M.width=F,M.height=nt};u.watch(()=>t.orientation,()=>{if(p.value&&N.value){const F=N.value.width,nt=N.value.height;(p.value?.getContext("2d")).clearRect(0,0,F,nt)}M.showTooltip=!1,M.interactionMode="idle"}),u.watch(()=>t.annotations,F=>{C.value&&(F?C.value.options.plugins.annotation.annotations=S(t.chartData):delete C.value.options.plugins.annotation.annotations)});const Z=()=>{M.showTooltip&&(M.interactionMode!=="idle"?M.interactionMode="idle":M.interactionMode="interactive")};return(F,nt)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",E[u.unref(x)]])},[u.createElementVNode("canvas",{id:u.unref(s),ref:"axis",class:"axis"},null,8,lO),u.createElementVNode("div",{ref:"chartContainer",class:"chart-container",onClick:nt[0]||(nt[0]=gt=>Z()),onScroll:V},[u.createElementVNode("div",{class:"chart-body",style:u.normalizeStyle({width:rt.value,height:X.value})},[u.createElementVNode("canvas",{id:u.unref(o),ref:"canvas",class:"chart-canvas"},null,8,cO)],4)],544),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[T.show?(u.openBlock(),u.createElementBlock("div",{key:0,class:"axis-tooltip",style:u.normalizeStyle({top:T.top,left:T.left}),width:"auto"},[u.createElementVNode("div",uO,u.toDisplayString(T.text),1)],4)):u.createCommentVNode("",!0),u.createVNode(ji,{"absolute-left":u.unref(D),"absolute-top":u.unref(P),"chart-parent-ref":d.value,state:M,"tooltip-title":e.tooltipTitle,onDimensions:tt},null,8,["absolute-left","absolute-top","chart-parent-ref","state","tooltip-title"])])),u.createVNode(oo,{id:u.unref(g),"chart-instance":u.unref(C),items:_.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-6994dd8d"]]);const xO={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};iu._date.override({_id:"date-fns",formats:function(){return xO},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=et(e):n==="string"&&(typeof t=="string"?e=Hb(e,t,new Date,this.options):e=Wl(e,this.options)),Eo(e)?e.getTime():null},format:function(e,t){return rs(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Ao(e,t);case"second":return By(e,t);case"minute":return Ly(e,t);case"hour":return Ey(e,t);case"day":return os(e,t);case"week":return Fy(e,t);case"month":return Oo(e,t);case"quarter":return Ny(e,t);case"year":return zy(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return Ro(e,t);case"second":return qy(e,t);case"minute":return Yy(e,t);case"hour":return $y(e,t);case"day":return Tl(e,t);case"week":return Gy(e,t);case"month":return Dl(e,t);case"quarter":return jy(e,t);case"year":return Xy(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return jb(e);case"minute":return Wb(e);case"hour":return Yb(e);case"day":return Po(e);case"week":return ae(e);case"isoWeek":return ae(e,{weekStartsOn:+n});case"month":return Zy(e);case"quarter":return Ky(e);case"year":return Cl(e);default:return e}},endOf:function(e,t){switch(t){case"second":return i0(e);case"minute":return e0(e);case"hour":return Jy(e);case"day":return vl(e);case"week":return t0(e);case"month":return Ml(e);case"quarter":return n0(e);case"year":return Qy(e);default:return e}}});const of={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},wO={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...of,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},kO=u.version[0]==="2"?(e,t)=>Object.assign(e,{attrs:t}):(e,t)=>Object.assign(e,t);function Yn(e){return u.isProxy(e)?u.toRaw(e):e}function TO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e;return u.isProxy(t)?new Proxy(e,{}):e}function SO(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function af(e,t){e.labels=t}function rf(e,t,n){const i=[];e.datasets=t.map(s=>{const o=e.datasets.find(a=>a[n]===s[n]);return!o||!s.data||i.includes(o)?{...s}:(i.push(o),Object.assign(o,s),o)})}function vO(e,t){const n={labels:[],datasets:[]};return af(n,e.labels),rf(n,e.datasets,t),n}const MO=u.defineComponent({props:wO,setup(e,t){let{expose:n,slots:i}=t;const s=u.ref(null),o=u.shallowRef(null);n({chart:o});const a=()=>{if(!s.value)return;const{type:c,data:d,options:h,plugins:f,datasetIdKey:m}=e,p=vO(d,m),g=TO(p,d);o.value=new Xt(s.value,{type:c,data:g,options:{...h},plugins:f})},r=()=>{const c=u.toRaw(o.value);c&&(e.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},e.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(e.updateMode)};return u.onMounted(a),u.onUnmounted(r),u.watch([()=>e.options,()=>e.data],(c,d)=>{let[h,f]=c,[m,p]=d;const g=u.toRaw(o.value);if(!g)return;let y=!1;if(h){const _=Yn(h),x=Yn(m);_&&_!==x&&(SO(g,_),y=!0)}if(f){const _=Yn(f.labels),x=Yn(p.labels),T=Yn(f.datasets),v=Yn(p.datasets);_!==x&&(af(g.config.data,_),y=!0),T&&T!==v&&(rf(g.config.data,T,e.datasetIdKey),y=!0)}y&&u.nextTick(()=>{l(g)})},{deep:!0}),()=>u.h("canvas",{role:"img","aria-label":e.ariaLabel,"aria-describedby":e.ariaDescribedby,ref:s},[u.h("p",{},[i.default?i.default():""])])}});function ro(e,t){return Xt.register(t),u.defineComponent({props:of,setup(n,i){let{expose:s}=i;const o=u.shallowRef(null),a=u.shallowRef(null);u.watch(()=>a.value?.chart??null,l=>{o.value=l},{flush:"sync"}),s({chart:o});const r=l=>{a.value=l};return()=>u.h(MO,kO({ref:r},{type:e,...n}))}})}const lf=ro("bar",Jc),cf=ro("doughnut",ki),uf=ro("line",tu),DO=ro("scatter",nu),CO={class:"chart-container"},OO={key:0,class:"chart-center-metric"},AO={class:"chart-center-total"},PO={key:0,class:"chart-center-unit"},EO=u.defineComponent({__name:"DonutChart",props:{chartData:{},tooltipTitle:{},metricUnit:{default:""},metricName:{default:""},legendPosition:{default:It.Bottom},legendValues:{default:void 0},syntheticsDataKey:{default:""},tooltipDimensionDisplay:{default:""},tooltipMetricDisplay:{default:""},showCenterMetric:{type:Boolean,default:!0}},setup(e){const t=e,{translateUnit:n}=q.useTranslatedUnits(),{i18n:i}=q.useI18n(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=u.ref([]),r=u.useTemplateRef("chartParent"),l=u.inject(Oa,null),c=new ao({coordinator:l,requiresUpdate:!0,triggerOnSelf:!1,watchTimestamp:!1,watchDimension:!0}),d=u.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:u.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:u.toRef(t,"tooltipDimensionDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:n,offsetX:0,offsetY:0,width:0,height:0,chartID:o,chartType:"donut",interactionMode:"idle"}),{tooltipAbsoluteLeft:h,tooltipAbsoluteTop:f}=q.useTooltipAbsolutePosition(r,d),m={id:s,afterUpdate(k){a.value=k.options.plugins.legend.labels.generateLabels(k).map(S=>({...S,value:t.legendValues&&t.legendValues[S.text],hidden:!1}))}},p=u.computed(()=>[c,m]),g=u.computed(()=>[t.chartData.datasets.reduce((S,A)=>(S.dimension=A.dimension,S.dimensionValue.push(A.dimensionValue),S.labels.push(A.label),S.backgroundColor.push(A.backgroundColor),S.hoverBorderColor.push(xs(A.backgroundColor).saturate(.5).darken(.15).hexString()),S.data.push(A.data.reduce((L,R)=>L+R,0)),S),{dimension:"",dimensionValue:[],labels:[],backgroundColor:[],borderColor:"#ffffff",borderWidth:1,hoverBorderColor:[],hoverBorderWidth:1,data:[],hoverOffset:10})]),{formatUnit:y}=oe({i18n:i}),_=u.computed(()=>W1(t.metricName??"")),x=u.computed(()=>{const k=g.value[0]?.data.reduce((S,A)=>S+A,0)??0;return y(k,t.metricUnit,{approximate:!0,translateUnit:(S,A)=>n(S,A)}).trim()}),T=u.computed(()=>t.tooltipMetricDisplay||""),v=u.computed(()=>({...t.chartData,datasets:g.value}));q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const{options:w}=q.useDonutChartOptions({tooltipState:d,legendID:s}),M=u.ref(),D=k=>({[It.Bottom]:"column",[It.Hidden]:"hidden"})[k],P=({width:k,height:S})=>{d.width=k,d.height=S};return(k,S)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",D(e.legendPosition)]),"data-testid":"donut-chart-parent"},[u.createElementVNode("div",CO,[u.createVNode(u.unref(cf),{ref_key:"chartInstance",ref:M,"chart-id":u.unref(o),data:v.value,options:u.unref(w),plugins:p.value},null,8,["chart-id","data","options","plugins"]),e.showCenterMetric&&_.value?(u.openBlock(),u.createElementBlock("div",OO,[u.createElementVNode("span",AO,u.toDisplayString(x.value),1),T.value?(u.openBlock(),u.createElementBlock("span",PO,u.toDisplayString(T.value),1)):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[u.createVNode(ji,{"absolute-left":u.unref(h),"absolute-top":u.unref(f),state:d,"tooltip-title":e.tooltipTitle,unit:e.metricUnit,onDimensions:P},null,8,["absolute-left","absolute-top","state","tooltip-title","unit"])]))]),u.createVNode(oo,{id:u.unref(s),"chart-instance":M.value,items:a.value,position:e.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),RO=Pt(EO,[["__scopeId","data-v-db23aff8"]]);class IO{id="outlierBandPlugin";beforeDatasetsDraw(t,n,i){const s=i?.value;if(s===void 0||!Number.isFinite(s)||!i?.color)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,d=Math.min(Math.max(o.getPixelForValue(s),a),r);if(d<=a)return;const h=t.ctx;h.save(),h.fillStyle=i.color,h.fillRect(l,a,c-l,d-a),h.restore()}}const LO=1.5;class NO{id="referenceLinePlugin";afterDatasetsDraw(t,n,i){const s=i?.lines;if(!s?.length)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,d=t.ctx;d.save(),d.lineWidth=LO;for(const{value:h,color:f,borderDash:m}of s){if(!Number.isFinite(h))continue;const p=o.getPixelForValue(h);p<a||p>r||(d.beginPath(),d.setLineDash(m),d.strokeStyle=f,d.moveTo(l,p),d.lineTo(c,p),d.stroke())}d.restore()}}const BO={class:"chart-container"},FO=Pt(u.defineComponent({__name:"ScatterChart",props:{chartData:{default:void 0},tooltipTitle:{},metricUnit:{default:""},xMetric:{default:void 0},xMetricUnit:{default:void 0},granularity:{},timeRangeMs:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:()=>0},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""},shadeOutlierRegion:{type:Boolean,default:!1},themeColors:{default:()=>Ja()}},setup(e){const t=e,n=u.inject("legendPosition",It.Bottom),{i18n:i}=q.useI18n(),{formatUnit:s}=oe({i18n:i}),{translateUnit:o}=q.useTranslatedUnits(),a=u.useTemplateRef("chartParent"),r=new IO,l=new NO,c=crypto.randomUUID(),d=crypto.randomUUID(),h=u.inject(Oa,null),f=new ao({coordinator:h,requiresUpdate:!0,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),m=u.ref(),p=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:u.toRef(t,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:o,offsetX:0,offsetY:0,width:0,height:0,chartType:"scatter",chartID:d,chartTooltipSortFn:t.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:g,tooltipAbsoluteTop:y}=q.useTooltipAbsolutePosition(a,p);q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const _=u.computed(()=>t.chartData?.outlier),x=u.computed(()=>t.chartData?.referenceLines??[]),T=u.ref([]),v={id:c,afterUpdate(L){T.value=La(L,void 0,t.chartLegendSortFn)}},w=u.computed(()=>{const L=[];_.value&&L.push({text:_.value.label,fillStyle:_.value.color,strokeStyle:_.value.color,isKey:!0});for(const R of x.value)L.push({text:R.label,fillStyle:R.color,strokeStyle:R.color,lineDash:R.borderDash,isKey:!0,value:{raw:R.value,formatted:s(R.value,t.metricUnit,{translateUnit:o})}});return L}),M=u.computed(()=>[...T.value,...w.value]),D=u.computed(()=>t.shadeOutlierRegion?_.value?.value:void 0),P=u.computed(()=>[f,v,...D.value!==void 0?[r]:[],...x.value.length?[l]:[]]),k=u.computed(()=>`scatter-${P.value.map(L=>L.id).join("-")}`),{options:S}=q.useScatterChartOptions({tooltipState:p,legendID:c,granularity:u.toRef(t,"granularity"),timeRangeMs:u.toRef(t,"timeRangeMs"),metricAxesTitle:u.toRef(t,"metricAxesTitle"),dimensionAxesTitle:u.toRef(t,"dimensionAxesTitle"),metricUnit:u.toRef(t,"metricUnit"),xMetric:u.toRef(t,"xMetric"),xMetricUnit:u.toRef(t,"xMetricUnit"),outlierValue:D,referenceLines:x,themeColors:u.toRef(t,"themeColors")}),A=L=>({[It.Bottom]:"column",[It.Hidden]:"hidden"})[L];return(L,R)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",A(u.unref(n))]),"data-testid":"scatter-chart-parent"},[u.createElementVNode("div",BO,[(u.openBlock(),u.createBlock(u.unref(DO),{key:k.value,ref_key:"chartInstance",ref:m,"chart-id":u.unref(d),class:"chart-canvas",data:e.chartData,"data-testid":"scatter-chart",options:u.unref(S),plugins:P.value},null,8,["chart-id","data","options","plugins"]))]),u.createVNode(ji,{"absolute-left":u.unref(g),"absolute-top":u.unref(y),"data-testid":"tooltip",granularity:e.granularity,state:p,"tooltip-title":e.tooltipTitle},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title"]),u.createVNode(oo,{id:u.unref(c),"chart-instance":m.value,"data-testid":"legend",items:M.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-a001076d"]]),yr=(e,t,n,i,s="#0275d8")=>{e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore()},jt={},zO=()=>{jt.x=void 0,jt.chart=void 0,jt.strategy=void 0,jt.group=void 0},UO=10;class df{id="verticalLinePlugin";_clickedSegment;_pause=!1;_useBrushingState=!1;_brushStrategy;_brushGroup;constructor({brushGroup:t=void 0,brushStrategy:n=void 0,enableBrushing:i=!1}={}){let s=!1;n==="group"&&(s=t!==void 0),this._useBrushingState=i&&s,this._brushStrategy=n,this._brushGroup=t}afterEvent(t,n){if(!this._useBrushingState)return;const{event:i}=n;(i.type==="mousemove"||i.type==="mouseout")&&requestAnimationFrame(s=>this.onMouseBrush(i.type,t,s))}_lastMouseBrushEvent=0;onMouseBrush(t,n,i){if(t==="mousemove"&&i-this._lastMouseBrushEvent<UO)return;const s=()=>{jt.chart=n,jt.strategy=this._brushStrategy,jt.group=this._brushGroup;for(const o of Object.values(Xt.instances))o!==n&&o.update("none")};t==="mousemove"?n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&(jt.x=n.tooltip.dataPoints[0].element.x,s()):t==="mouseout"&&(jt.x=void 0,s()),this._lastMouseBrushEvent=i}afterDatasetsDraw(t){if(this.isPaused)return;const n=t.tooltip&&t.tooltip.getActiveElements()&&t.tooltip.getActiveElements().length,i=t.ctx;if(this._clickedSegment){const{x:s}=this._clickedSegment.element;yr(i,s,t.scales.y.top,t.scales.y.bottom)}else if(this._useBrushingState)this.drawByBrush(t);else if(n){const{x:s}=t.tooltip.dataPoints[0].element;yr(i,s,t.scales.y.top,t.scales.y.bottom)}}drawByBrush(t){if(jt.x===void 0)return;const n=jt.chart===t?"#0275d8":"rgba(2, 117, 216, 0.3)";this._brushStrategy==="group"&&jt.group===this._brushGroup&&yr(t.ctx,jt.x,t.scales.y.top,t.scales.y.bottom,n)}pause(){this._pause=!0}resume(){this._pause=!1}get isPaused(){return this._pause}set clickedSegment(t){this._clickedSegment=t}get clickedSegment(){return this._clickedSegment}destroyClickedSegment(){delete this._clickedSegment}beforeDestroy(t){if(this._clickedSegment&&this.destroyClickedSegment(),this._useBrushingState&&jt.chart===t){const n=jt.x!==void 0;if(zO(),n)for(const i of Object.values(Xt.instances))i!==t&&i.update("none")}}}const VO=(e,t,n)=>{const i=e.ctx;i.save(),i.strokeStyle="rgba(95, 154, 255, 1)",i.lineWidth=2,i.beginPath(),i.moveTo(t,e.chartArea.top),i.lineTo(t,e.chartArea.bottom),i.moveTo(n,e.chartArea.top),i.lineTo(n,e.chartArea.bottom),i.stroke(),i.restore()},HO=(e,t,n)=>{const i=e.ctx;i.save(),i.fillStyle="rgba(143, 193, 255, 0.3)",i.fillRect(t,e.chartArea.top,n-t,e.chartArea.bottom-e.chartArea.top),i.restore()},hf=(e,t)=>{const n=e.scales.x.getValueForPixel(t.startX),i=e.scales.x.getValueForPixel(t.endX);if(!(n===void 0||i===void 0))return{xStart:Math.min(n,i),xEnd:Math.max(n,i)}},ff=(e,t,n)=>{t.canvas.dispatchEvent(new CustomEvent(e,{detail:n}))};class $O{id="dragSelectPlugin";_isDragging=!1;_startX=0;_endX=0;_dragTimeout;_clearSelectionArea=!0;_chart=null;_dragSelectHandlers;get startX(){return this._startX}get endX(){return this._endX}beforeInit(t){this._chart=t;const n=t.canvas;let i=!1;const s=r=>{this._dragTimeout=window.setTimeout(()=>{const l=n.getBoundingClientRect();this._isDragging=!0,this._clearSelectionArea=!1,i=!0,this._startX=r.clientX-l.left,this._endX=this._startX},150)},o=r=>{const l=n.getBoundingClientRect();if(i&&this._isDragging){this._endX=r.clientX-l.left;const c=hf(t,this);c&&ff("dragSelectMove",t,c)}},a=r=>{const l=n.getBoundingClientRect();if(clearTimeout(this._dragTimeout),i&&this._isDragging){this._endX=r.clientX-l.left,i=!1,this._isDragging=!1;const c=hf(t,this);c?ff("dragSelect",t,c):this.clearSelectionArea()}};n.addEventListener("mousedown",s),n.addEventListener("mousemove",o),n.addEventListener("mouseup",a),this._dragSelectHandlers={onMouseDown:s,onMouseMove:o,onMouseUp:a}}beforeDestroy(t){const n=t.canvas;if(this._dragSelectHandlers){const{onMouseDown:i,onMouseMove:s,onMouseUp:o}=this._dragSelectHandlers;n.removeEventListener("mousedown",i),n.removeEventListener("mousemove",s),n.removeEventListener("mouseup",o)}this._isDragging=!1,this._dragTimeout&&clearTimeout(this._dragTimeout)}afterDatasetsDraw(t){(this._isDragging||!this._clearSelectionArea)&&(HO(t,this._startX,this._endX),VO(t,this._startX,this._endX))}clearSelectionArea(){this._clearSelectionArea=!0,this._chart&&this._chart.update()}}const YO=20,WO="rgba(255, 171, 171, 0.4)",jO="rgba(255, 196, 0, 0.2)",mf=(e,t,n)=>{const i=t.y-e.y;if(i===0)return t.x;const s=(n-e.y)/i;return e.x+s*(t.x-e.x)},pf=e=>"yAxisID"in e&&e.yAxisID||Gs,gf=(e,t)=>{const n=e.data.datasets.find(i=>i.rawMetric===t);return n?pf(n):Gs},qO=(e,t,n=Gs)=>{const i=[];return e.data.datasets.forEach(s=>{if(!e.getDatasetMeta(e.data.datasets.indexOf(s)).visible||pf(s)!==n)return;const a=s.data;a?.length&&t.filter(r=>r.highlightIntersections).forEach(r=>{const l=a.map(d=>({ts:d.x,aboveThreshold:d.y>=r.value}));let c=l[0].aboveThreshold?a[0].x:void 0;for(let d=1;d<l.length;d++)!l[d-1].aboveThreshold&&l[d].aboveThreshold?c=mf(a[d-1],a[d],r.value):l[d-1].aboveThreshold&&!l[d].aboveThreshold&&c!==void 0&&(i.push({start:c,end:mf(a[d-1],a[d],r.value),type:r.type}),c=void 0);c!==void 0&&i.push({start:c,end:l[l.length-1].ts,type:r.type})})}),i},GO=e=>{if(!e.length)return[];e.sort((n,i)=>n.type.localeCompare(i.type)||n.start-i.start);const t=[];for(const n of e){const i=t.findLast(({type:s})=>s===n.type);i&&n.start<=i.end?i.end=Math.max(i.end,n.end):t.push({...n})}return t};class XO{constructor(t){this.i18n=t}i18n;id="thresholdPlugin";_thresholds;_mouseMoveHandler;_syncThresholds(t){for(const n of Object.keys(t.threshold||{})){const i=t.threshold?.[n];i&&(this._thresholds={...this._thresholds,[n]:i.map(s=>({...s,hovered:!1}))})}if(this._thresholds)for(const n of Object.keys(this._thresholds))t.threshold?.[n]||delete this._thresholds[n]}get thresholds(){return this._thresholds}beforeUpdate(t,n,i){this._syncThresholds(i)}beforeInit(t,n,i){const s=t.canvas;this._syncThresholds(i);const o=a=>{if(t){const r=a.clientY,l=s.getBoundingClientRect();for(const c of Object.keys(this._thresholds||{})){const h=(t.scales[gf(t,c)]??t.scales.y).getValueForPixel(r-l.top);if(h){const f=this._thresholds?.[c];f&&f.forEach(m=>{m.hovered=Math.abs(m.value-h)<YO})}}}};s.addEventListener("mousemove",o),this._mouseMoveHandler=o}afterDatasetsDraw(t,n){const i=t.ctx;for(const s of Object.keys(this._thresholds||{})){const o=this._thresholds?.[s];if(o){const a=gf(t,s),r=t.scales[a]??t.scales.y;o.forEach(d=>{const h=r.getPixelForValue(d.value);i.save(),i.beginPath(),i.moveTo(t.chartArea.left,h),i.lineTo(t.chartArea.right,h),i.lineWidth=1,i.strokeStyle=za(d.type),i.setLineDash([5,5]),i.stroke(),i.restore();let f="";d.label?f=`${d.label}: ${d.value}`:d.type==="warning"?f=this.i18n.t("chartLabels.threshold-warning",{value:d.value}):d.type==="error"?f=this.i18n.t("chartLabels.threshold-error",{value:d.value}):f=this.i18n.t("chartLabels.thatreshold-neutral",{value:d.value}),d.hovered&&(i.save(),i.fillStyle=za(d.type),i.font=ug,i.fillText(f,t.chartArea.left,h-4),i.restore())});const l=qO(t,o,a);GO(l).forEach(d=>{const h=t.scales.x.getPixelForValue(d.start),f=t.scales.x.getPixelForValue(d.end);i.save(),i.fillStyle=d.type==="error"?WO:jO,i.fillRect(h,t.chartArea.top,f-h,t.chartArea.bottom-t.chartArea.top),i.restore(),i.save(),i.beginPath(),i.moveTo(h,t.chartArea.bottom),i.lineTo(f,t.chartArea.bottom),i.lineWidth=2,i.strokeStyle=za(d.type),i.stroke(),i.restore()})}}}beforeDestroy(t){this._mouseMoveHandler&&t.canvas.removeEventListener("mousemove",this._mouseMoveHandler)}}const KO=Pt(u.defineComponent({__name:"TimeSeriesChart",props:{chartData:{default:void 0},type:{default:"timeseries_line"},fill:{type:Boolean,default:!1},tooltipTitle:{},metricUnit:{default:""},timeRangeMs:{default:void 0},granularity:{},stacked:{type:Boolean,default:!0},legendValues:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},brush:{type:Boolean,default:!1},zoomActionItems:{default:void 0},tooltipMetricDisplay:{default:""},threshold:{default:void 0},leftYAxisGrid:{type:Boolean,default:void 0},rightYAxis:{default:void 0}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=e,i=t,{i18n:s}=q.useI18n(),o=new df,a=new nf,r=new $O,l=new XO(s),{translateUnit:c}=q.useTranslatedUnits(),d=u.ref(),h=crypto.randomUUID(),f=crypto.randomUUID(),m=u.ref([]),p=u.inject("legendPosition",It.Bottom),g=u.useTemplateRef("chartParent"),y=u.ref(void 0),_=u.ref(!1),x=u.inject(Oa,null),T=new ao({coordinator:x,triggerOnSelf:!0,watchTimestamp:!0,watchDimension:!0}),v=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:u.toRef(n,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(n,"metricUnit"),translateUnit:c,offsetX:0,offsetY:0,width:0,height:0,chartType:n.type,chartID:f,chartTooltipSortFn:n.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:w,tooltipAbsoluteTop:M}=q.useTooltipAbsolutePosition(g,v),D={id:h,afterUpdate(E){m.value=La(E,n.legendValues,n.chartLegendSortFn)}},P=u.computed(()=>[T,D,a,...n.brush?[r]:[],...n.type==="timeseries_line"?[o]:[],...n.threshold?[l]:[]]),k=u.computed(()=>`line-${P.value.map(E=>E.id).join("-")}`),S=u.computed(()=>`bar-${P.value.map(E=>E.id).join("-")}`),A=u.computed(()=>n.chartData&&GM(n.chartData)),{options:L}=q.useLineChartOptions({tooltipState:v,timeRangeMs:u.toRef(n,"timeRangeMs"),granularity:u.toRef(n,"granularity"),legendID:h,stacked:u.toRef(n,"stacked"),metricAxesTitle:u.toRef(n,"metricAxesTitle"),dimensionAxesTitle:u.toRef(n,"dimensionAxesTitle"),pointsWithoutHover:A,threshold:u.toRef(n,"threshold"),leftYAxisGrid:u.toRef(n,"leftYAxisGrid"),rightYAxis:u.toRef(n,"rightYAxis")});q.useReportChartDataForSynthetics(u.toRef(n,"chartData"),u.toRef(n,"syntheticsDataKey"));const R=E=>E?E.end.getTime()>E.start.getTime():!1,H=E=>({[It.Bottom]:"column",[It.Hidden]:"hidden"})[E],W=({width:E,height:N})=>{v.width=E,v.height=N},$=(E=!0)=>{v.interactionMode="idle",v.showTooltip=!1,r.clearSelectionArea(),a.isPaused&&a.resume(E),o.isPaused&&o.resume()},K=()=>{v.interactionMode="interactive"},lt=()=>{!d.value||!d.value.chart.tooltip?.dataPoints?.length||(v.interactionMode==="interactive"?o.clickedSegment=d.value.chart.tooltip.dataPoints[0]:o.destroyClickedSegment())},rt=()=>{if(_.value){_.value=!1;return}v.interactionMode!=="idle"?$():K(),lt()};u.watch(()=>n.type,()=>{v.interactionMode="idle",v.showTooltip=!1,o.destroyClickedSegment()});const X=E=>{E.preventDefault(),E.stopPropagation();const{xStart:N,xEnd:V}=E.detail,tt={start:new Date(N),end:new Date(V),type:"absolute"};if(!R(tt)){y.value=void 0,$(!1);return}y.value=tt,v.interactionMode="zoom-interactive",tt&&i("select-chart-range",tt)},z=E=>{v.interactionMode="selecting-chart-area",_.value=!0,o.pause(),a.pause();const{xStart:N,xEnd:V}=E.detail;y.value={start:new Date(N),end:new Date(V),type:"absolute"}},C=E=>{if(!g.value||v.interactionMode==="idle")return;const N=E.target;N&&g.value.contains(N)||_.value||$(!1)};return u.watch(()=>d.value?.chart,()=>{d.value?.chart&&(d.value.chart.canvas.removeEventListener("dragSelect",X),d.value.chart.canvas.removeEventListener("dragSelectMove",z),d.value.chart.canvas.addEventListener("dragSelect",X),d.value.chart.canvas.addEventListener("dragSelectMove",z))}),u.onMounted(()=>{document.addEventListener("click",C,!0)}),u.onUnmounted(()=>{d.value?.chart&&(d.value.chart.canvas.removeEventListener("dragSelect",X),d.value.chart.canvas.removeEventListener("dragSelectMove",z)),document.removeEventListener("click",C,!0)}),(E,N)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",H(u.unref(p))]),"data-testid":"line-chart-parent"},[u.createElementVNode("div",{class:"chart-container",onClick:N[0]||(N[0]=V=>rt())},[e.type==="timeseries_line"?(u.openBlock(),u.createBlock(u.unref(uf),{key:k.value,ref_key:"chartInstance",ref:d,"chart-id":u.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-line-chart",options:u.unref(L),plugins:P.value},null,8,["chart-id","data","options","plugins"])):e.type==="timeseries_bar"?(u.openBlock(),u.createBlock(u.unref(lf),{key:S.value,ref_key:"chartInstance",ref:d,"chart-id":u.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-bar-chart",options:u.unref(L),plugins:P.value},null,8,["chart-id","data","options","plugins"])):u.createCommentVNode("",!0)]),u.createVNode(ji,{"absolute-left":u.unref(w),"absolute-top":u.unref(M),"data-testid":"tooltip",granularity:e.granularity,state:v,"tooltip-title":e.tooltipTitle,"zoom-action-items":e.zoomActionItems,"zoom-time-range":y.value,onDimensions:W,onOnAction:N[1]||(N[1]=()=>$(!1))},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title","zoom-action-items","zoom-time-range"]),u.createVNode(oo,{id:u.unref(h),"chart-instance":d.value,"data-testid":"legend",items:m.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-344d87c4"]]),ZO={key:0,class:"chart-truncation-warning","data-testid":"truncation-warning"},QO={class:"tooltip-content"},JO={key:2,class:"analytics-chart-parent"},tA=u.defineComponent({__name:"AnalyticsChart",props:{chartData:{},chartOptions:{},activeMetric:{default:void 0},tooltipTitle:{default:""},emptyStateTitle:{default:""},emptyStateDescription:{default:""},legendPosition:{default:It.Bottom},syntheticsDataKey:{default:""},showLegendValues:{type:Boolean,default:!1},showAnnotations:{type:Boolean,default:!0},timeseriesZoom:{type:Boolean,default:!1},requestsLink:{default:void 0},exploreLink:{default:void 0}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=t,i=e,{i18n:s}=q.useI18n(),o=u.computed(()=>tr(i.chartData)?void 0:i.chartData),a=u.computed(()=>{const B=i.chartOptions.metricAxisMap,U=o.value?.meta?.metric_names??[];if(!(i.chartOptions.type!=="timeseries_line"||!B||!U.some(J=>B[J]==="right")))return B}),r=u.computed(()=>!!a.value),l=(B,U)=>a.value?B.filter(J=>(a.value?.[J]??"left")===U):B,c=u.computed(()=>{const B=o.value?.meta,U=B?.metric_names??[];return["timeseries_line","timeseries_bar"].includes(i.chartOptions.type)&&!r.value&&U.length>1&&Object.keys(B?.display??{}).length>0?U:[]}),d=u.computed(()=>c.value.length>1),h=u.computed(()=>i.activeMetric&&c.value.includes(i.activeMetric)?i.activeMetric:c.value[0]),f=u.computed(()=>{const B=o.value;return!B||!d.value||!h.value?B:{...B,meta:{...B.meta,metric_names:[h.value]}}}),m=u.computed(()=>{const B=i.chartOptions.threshold;return!d.value||!B?B:{...B,...Object.fromEntries(Object.keys(B).filter(U=>U!==h.value).map(U=>[U,[]]))}}),p=u.computed(()=>{if($.value)return tr(i.chartData)?i.chartData:oh(i.chartData)}),g=u.inject("app:konnectColorMode",u.computed(()=>"light")),y=u.useTemplateRef("chartShell"),_=u.computed(()=>(g.value,Ja(y.value))),x=u.computed(()=>{if(p.value){const{start:U,end:J,metric:$t,metricUnit:fe,truncated:fn,limit:Te,datasource:mn}=p.value;return{start:U,end:J,metricNames:[$t],metricUnits:{[$t]:fe??""},truncated:fn,limit:Te,datasource:mn}}const B=f.value?.meta;return{start:B?.start,end:B?.end,metricNames:B?.metric_names,metricUnits:B?.metric_units,truncated:B?.truncated,limit:B?.limit,datasource:B?.datasource}}),T=u.computed(()=>$.value?q.useScatterDatasets({colorPalette:i.chartOptions.chartDatasetColors,scatter:i.chartOptions.scatter,themeColors:_},p).value:o.value?H.value?q.useExploreResultToTimeDataset({fill:i.chartOptions.stacked,colorPalette:i.chartOptions.chartDatasetColors||Va,metricAxisMap:a.value},f).value:q.useExploreResultToDatasets({fill:i.chartOptions.stacked,colorPalette:i.chartOptions.chartDatasetColors||Va},o).value:{datasets:[]}),v=u.computed(()=>i.timeseriesZoom||!!i.exploreLink||!!i.requestsLink),w=u.computed(()=>{if(!i.chartData||o.value&&!o.value.meta)return 0;const{start:B,end:U}=x.value;if(B&&U)return new Date(U).getTime()-new Date(B).getTime()}),M=u.computed(()=>x.value.metricUnits?d.value&&h.value?x.value.metricUnits[h.value]??"":Object.values(x.value.metricUnits)[0]??"":""),D=u.computed(()=>x.value.metricUnits?d.value&&h.value?h.value:Object.keys(x.value.metricUnits)[0]??"":""),P=u.computed(()=>i.showLegendValues&&i.legendPosition!==It.Hidden),{legendValues:k}=q.useChartLegendValues(T,i.chartOptions.type,M),S=u.computed(()=>x.value.limit?.toString()||null),A=u.computed(()=>i.chartOptions.hideTruncationWarning?!1:x.value.truncated||!1),L=u.computed(()=>s.t("limitedResultsShown",{maxReturned:S.value})),R=u.computed(()=>["vertical_bar","horizontal_bar"].includes(i.chartOptions.type)),H=u.computed(()=>["timeseries_bar","timeseries_line"].some(B=>B===i.chartOptions.type)),W=u.computed(()=>i.chartOptions.type==="donut"),$=u.computed(()=>i.chartOptions.type==="scatter"),K=u.computed(()=>i.chartOptions.type.includes("vertical")?"vertical":"horizontal"),lt=u.computed(()=>{const{metricNames:B,metricUnits:U}=x.value;if(r.value||!B||!U)return;const J=B[0],$t=U[J]||"";if(B.length>1){if(J.includes("latency"))return s.t("metricAxisTitles.latency_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})});if(J.includes("size"))return s.t("metricAxisTitles.size_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})})}if(J)return zi($t)&&s.te(`metricAxisTitles.${J}`)?s.t(`metricAxisTitles.${J}`)||void 0:s.te(`chartLabels.${J}`)?s.t(`chartLabels.${J}`):J}),rt=u.computed(()=>{const B=i.chartOptions.yAxes?.left?.title??i.chartOptions?.metricAxesTitle;if(B)return B;const{metricNames:U,metricUnits:J}=x.value;if(!(!U||!J))return z(l(U,"left"),J)}),X=u.computed(()=>{if(!r.value)return;const{metricNames:B,metricUnits:U}=x.value,J=B&&U?z(l(B,"right"),U):void 0;return{title:i.chartOptions.yAxes?.right?.title??J,showGrid:i.chartOptions.yAxes?.right?.showGrid}}),z=(B,U)=>{const J=B[0];if(!J)return;const $t=U[J]||"";if(B.length>1){if(J.includes("latency"))return s.t("metricAxisTitles.latency_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})});if(J.includes("size"))return s.t("metricAxisTitles.size_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})})}return C(J,$t)},C=(B,U)=>{if(s.te(`metricAxisTitles.${B}`)){if(zi(U))return s.t(`metricAxisTitles.${B}`)||void 0;const J=s.te(`chartUnits.${U}`)?s.t(`chartUnits.${U}`,{plural:"s"}):U;return s.t(`metricAxisTitles.${B}`,{unit:J})||void 0}return B||void 0},E=u.computed(()=>{if(i.chartOptions?.dimensionAxesTitle)return i.chartOptions.dimensionAxesTitle;const B=o.value?.meta,U=H.value?"Time":Object.keys(B?.display||B?.metric_names||{})[0];if(U)return s.te(`chartLabels.${U}`)?s.t(`chartLabels.${U}`):U}),N=u.computed(()=>{if(Gf(x.value.datasource))return s.t("timestampAxisTitles.platform");const B=Ji(o.value?.meta?.granularity_ms);if(B)return s.te(`granularityAxisTitles.${B}`)?s.t(`granularityAxisTitles.${B}`):B}),V=u.computed(()=>{const B=p.value?.xMetric;return B?C(B,p.value?.xMetricUnit??""):N.value}),tt=u.computed(()=>i.emptyStateTitle||s.t("noDataAvailableTitle")),Z=u.computed(()=>i.emptyStateDescription||s.t("noDataAvailableDescription")),F=u.computed(()=>$.value?!!p.value?.points.length:H.value?XM(T.value):!!(o.value&&o.value.meta&&o.value.data.length)),nt=u.computed(()=>{const B=o.value;return B?B.meta.granularity_ms?Ji(B.meta.granularity_ms)||"hourly":Ji(new Date(B.data[1].timestamp).getTime()-new Date(B.data[0].timestamp).getTime())||"hourly":"hourly"}),gt=u.computed(()=>Ji(o.value?.meta?.granularity_ms)||"secondly"),ct=u.computed(()=>i.chartOptions.chartLegendSortFn?i.chartOptions.chartLegendSortFn:(B,U)=>B.text===s.t("chartLabels.____OTHER____")?1:U.text===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.text,10))&&!isNaN(parseInt(U.text,10))?B.text<U.text?-1:1:B.value&&U.value?U.value.raw-B.value.raw:0),at=u.computed(()=>i.chartOptions.chartTooltipSortFn?i.chartOptions.chartTooltipSortFn:(B,U)=>B.label===s.t("chartLabels.____OTHER____")?1:U.label===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.label,10))&&!isNaN(parseInt(U.label,10))?B.label<U.label?-1:1:B.value&&U.value?U.rawValue-B.rawValue:0),Ct=u.computed(()=>[...i.timeseriesZoom?[{label:s.t("zoom_action_items.zoom"),key:"zoom-in",action:B=>n("zoom-time-range",B)}]:[],...i.exploreLink?[{label:s.t("zoom_action_items.explore"),key:"explore",href:i.exploreLink.href}]:[],...i.requestsLink?[{label:s.t("zoom_action_items.view_requests"),key:"view-requests",href:i.requestsLink.href}]:[]]);return u.provide("showLegendValues",P),u.provide("legendPosition",u.toRef(i,"legendPosition")),(B,U)=>{const J=u.resolveComponent("KTooltip"),$t=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",{ref:"chartShell",class:u.normalizeClass(["analytics-chart-shell",{"show-values":P.value}])},[F.value&&A.value&&S.value?(u.openBlock(),u.createElementBlock("div",ZO,[u.createVNode(J,{class:"tooltip","max-width":"500",placement:"right"},{content:u.withCtx(()=>[u.createElementVNode("div",QO,u.toDisplayString(L.value),1)]),default:u.withCtx(()=>[u.createVNode(u.unref(Tt.WarningIcon),{color:`var(--kui-color-text-warning, ${u.unref(lg)})`,size:`var(--kui-icon-size-40, ${u.unref(dg)})`},null,8,["color","size"])]),_:1})])):u.createCommentVNode("",!0),F.value?(u.openBlock(),u.createElementBlock("div",JO,[H.value?(u.openBlock(),u.createBlock(KO,{key:0,brush:v.value,"chart-data":T.value,"chart-legend-sort-fn":ct.value,"chart-tooltip-sort-fn":at.value,"dimension-axes-title":N.value,fill:e.chartOptions.stacked,granularity:nt.value,"left-y-axis-grid":e.chartOptions.yAxes?.left?.showGrid,"legend-values":u.unref(k),"metric-axes-title":rt.value,"metric-unit":M.value,"right-y-axis":X.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,threshold:m.value,"time-range-ms":w.value,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle,type:e.chartOptions.type,"zoom-action-items":Ct.value,onSelectChartRange:U[0]||(U[0]=fe=>n("select-chart-range",fe)),onZoomTimeRange:U[1]||(U[1]=fe=>n("zoom-time-range",fe))},null,8,["brush","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","fill","granularity","left-y-axis-grid","legend-values","metric-axes-title","metric-unit","right-y-axis","stacked","synthetics-data-key","threshold","time-range-ms","tooltip-metric-display","tooltip-title","type","zoom-action-items"])):R.value?(u.openBlock(),u.createBlock(_O,{key:1,annotations:e.showAnnotations,"chart-data":T.value,"chart-legend-sort-fn":ct.value,"chart-tooltip-sort-fn":at.value,"data-testid":"bar-chart-container","dimension-axes-title":E.value,"legend-values":u.unref(k),"metric-axes-title":rt.value,"metric-unit":M.value,orientation:K.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle},null,8,["annotations","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","legend-values","metric-axes-title","metric-unit","orientation","stacked","synthetics-data-key","tooltip-metric-display","tooltip-title"])):W.value?(u.openBlock(),u.createBlock(RO,{key:2,"chart-data":T.value,"dataset-colors":e.chartOptions.chartDatasetColors||u.unref(Va),"legend-position":e.legendPosition,"legend-values":u.unref(k),"metric-name":D.value,"metric-unit":M.value,"show-center-metric":e.chartOptions.showCenterMetric,"synthetics-data-key":e.syntheticsDataKey,"tooltip-dimension-display":E.value,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle},null,8,["chart-data","dataset-colors","legend-position","legend-values","metric-name","metric-unit","show-center-metric","synthetics-data-key","tooltip-dimension-display","tooltip-metric-display","tooltip-title"])):$.value?(u.openBlock(),u.createBlock(FO,{key:3,"chart-data":T.value,"chart-legend-sort-fn":e.chartOptions.chartLegendSortFn,"chart-tooltip-sort-fn":at.value,"data-testid":"scatter-chart-container","dimension-axes-title":V.value,granularity:gt.value,"metric-axes-title":rt.value,"metric-unit":M.value,"shade-outlier-region":e.chartOptions.scatter?.shadeOutlierRegion,"synthetics-data-key":e.syntheticsDataKey,"theme-colors":_.value,"time-range-ms":w.value,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle,"x-metric":p.value?.xMetric,"x-metric-unit":p.value?.xMetricUnit},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","granularity","metric-axes-title","metric-unit","shade-outlier-region","synthetics-data-key","theme-colors","time-range-ms","tooltip-metric-display","tooltip-title","x-metric","x-metric-unit"])):u.createCommentVNode("",!0)])):(u.openBlock(),u.createBlock($t,{key:1,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(tt.value),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(Z.value),1)]),_:1}))],2)}}}),eA=Pt(tA,[["__scopeId","data-v-c5c250ba"]]),nA={class:"chart-parent","data-testid":"gauge-chart-parent"},iA={class:"chart-totals-flex"},sA={key:1,class:"metric-small","data-testid":"gauge-chart-total"},oA=Pt(u.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:"hidden"},numerator:{type:Number,required:!1,default:0},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:he},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.ref(gr()),s=u.computed(()=>[t.chartData.datasets.reduce((m,p)=>(m.labels.push(p.label),m.borderColor.push(p.backgroundColor),m.backgroundColor.push(p.backgroundColor),m.data.push(p.data.reduce((g,y)=>g+y,0)),m),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),o=u.computed(()=>({...t.chartData,datasets:s.value}));q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},r=u.computed(()=>Ri(s?.value[0]?.data[t.numerator],{capital:!0})),l=u.computed(()=>Ri(s?.value[0]?.data[0]+s?.value[0]?.data[1],{capital:!0})),c=u.computed(()=>`color: ${s?.value[0]?.backgroundColor[t.numerator]}`),d=u.computed(()=>["full","single"].includes(t.metricDisplay)),h=u.computed(()=>t.metricDisplay==="full");return(f,m)=>(u.openBlock(),u.createElementBlock("div",nA,[u.createElementVNode("div",iA,[d.value?(u.openBlock(),u.createElementBlock("div",{key:0,class:"metric-large","data-testid":"gauge-chart-metric",style:u.normalizeStyle(c.value)},u.toDisplayString(r.value),5)):u.createCommentVNode("",!0),h.value?(u.openBlock(),u.createElementBlock("div",sA,u.toDisplayString(u.unref(n).t("total"))+": "+u.toDisplayString(l.value),1)):u.createCommentVNode("",!0)]),u.createElementVNode("div",{class:"chart-container",style:u.normalizeStyle({height:e.height,width:e.width})},[u.createVNode(u.unref(cf),{"chart-id":i.value,data:o.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),[["__scopeId","data-v-c461b83f"]]),aA={key:1,class:"single-value-wrapper"},rA={class:"single-value-metric"},lA={class:"name-unit-alignment"},cA={class:"single-value","data-testid":"single-value-chart"},uA={key:0,class:"single-value-unit"},dA={class:"single-value-metric-name"},hA={key:0,class:"single-value-trend"},fA={key:0,class:"single-value-trend-range","data-testid":"single-value-trend-range"},br="t1",_r="t2",mA=Pt(u.defineComponent({__name:"SingleValue",props:{data:{type:Object,required:!0},decimalPoints:{type:Number,default:Dd},leftAlign:{type:Boolean,default:!1},showTrend:{type:Boolean,default:!1},increaseIsBad:{type:Boolean,default:!1},alignX:{type:String,default:"left"}},setup(e){const{i18n:t}=q.useI18n(),{formatBytes:n,formatCost:i}=oe({i18n:t}),s=e,o=u.computed(()=>`align-${s.leftAlign?"left":s.alignX}`),a=u.computed(()=>We.buildDeltaMapping(s.data,s.showTrend,{topLevelKey:br,secondLevelKey:_r})),r=u.computed(()=>a.value?.previous?.[br]?.[_r]),l=u.computed(()=>a.value?.current?.[br]?.[_r]),c=u.computed(()=>s.data.data),d=u.computed(()=>s.data.meta?.metric_names?.[0]),h=u.computed(()=>t.te(`chartLabels.${d.value}`)?t.t(`chartLabels.${d.value}`):""),f=u.computed(()=>{const S=d.value?s.data.meta?.metric_units?.[d.value]:void 0;if(S){const A=`chartUnits.${S}`;return t.te(A)?t.t(A,{plural:""}):""}}),m=u.computed(()=>!!d.value&&(d.value.includes("_per_minute")||d.value.includes("_latency_")||d.value==="error_rate")),p=u.computed(()=>s.showTrend&&r.value!==void 0?r.value:null),g=u.computed(()=>{if(s.showTrend)return l.value??null;if(c.value.length<1||!d.value)return null;const S=c.value[0].event[d.value];return typeof S!="number"||isNaN(S)?null:S}),y=u.computed(()=>s.data?.data?.length===void 0||s.data?.data?.length===0||!s.showTrend&&g.value===null||s.showTrend&&p.value===null&&g.value===null),_=u.computed(()=>{const S=g.value;if(S===null)return"-";const A=d.value?s.data.meta?.metric_units?.[d.value]:void 0;if(A==="usd")return i(S);if(A==="bytes")return n(S);if(S>=1e9){const R=(S/1e9).toFixed(1);return R.endsWith(".0")?`${Math.floor(S/1e9)}B`:`${R}B`}if(S>=1e7){const R=(S/1e6).toFixed(1);return R.endsWith(".0")?`${Math.floor(S/1e6)}M`:`${R}M`}const L=s.decimalPoints&&typeof s.decimalPoints=="number"?s.decimalPoints:Dd;return S.toLocaleString("en-US",{maximumFractionDigits:L})}),x=u.computed(()=>s.showTrend&&s.data?.data?.length<2),T=u.computed(()=>We.calculateChange(g.value??0,p.value??0)||0),v=u.computed(()=>{if(!s.showTrend)return 0;if(s.data?.data?.length<2){if(r.value===void 0)return 0;if(l.value===void 0)return s.increaseIsBad?1:-1}return We.changePolarity(T.value,!0,s.increaseIsBad)}),w=u.computed(()=>We.defineIcon(v.value,s.increaseIsBad)),M=u.computed(()=>{if(s.showTrend&&s.data?.data?.length<2){if(r.value===void 0)return t.t("singleValue.trend.not_available");if(l.value===void 0)return We.metricChange(-1,!0,t.t("singleValue.trend.not_available"))}return We.metricChange(T.value,s.data?.data?.length===2,t.t("singleValue.trend.not_available"))}),D=We.useTrendRange(u.computed(()=>s.showTrend),void 0,u.computed(()=>s.data.meta)),P=S=>S>0?"positive":S<0?"negative":"neutral",k=S=>S>0?rg:S<0?ag:bl;return u.onMounted(()=>{!s.showTrend&&s.data?.data?.length>1?console.warn("SingleValue chart should only be used with a single data point. Data length:",s.data.data.length):s.showTrend&&s.data?.data?.length>2&&console.warn("SingleValue with trend expects 2 or fewer data points. Instead got:",s.data.data.length)}),(S,A)=>{const L=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["chart-parent",o.value]),"data-testid":"single-value-parent"},[y.value?(u.openBlock(),u.createBlock(L,{key:0,class:"single-value-error","data-testid":"single-value-error","icon-variant":"error",title:u.unref(t).t("singleValue.valueError")},null,8,["title"])):(u.openBlock(),u.createElementBlock("div",aA,[u.createElementVNode("div",rA,[u.createElementVNode("div",lA,[u.createElementVNode("span",cA,u.toDisplayString(_.value),1),m.value&&f.value?(u.openBlock(),u.createElementBlock("span",uA," "+u.toDisplayString(f.value),1)):u.createCommentVNode("",!0)]),u.createElementVNode("div",dA,u.toDisplayString(h.value),1)]),e.showTrend?(u.openBlock(),u.createElementBlock("div",hA,[u.createElementVNode("div",{class:u.normalizeClass(["trend-change",P(v.value)]),"data-testid":"single-value-trend"},[x.value||v.value!==0?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(w.value),{key:0,color:k(v.value),size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["color","size"])):(u.openBlock(),u.createBlock(u.unref(Tt.EqualIcon),{key:1,color:`var(--kui-color-text-neutral-strong, ${u.unref(bl)})`,size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["color","size"])),u.createElementVNode("div",null,u.toDisplayString(M.value),1)],2),u.unref(D)?(u.openBlock(),u.createElementBlock("div",fA,u.toDisplayString(u.unref(D)),1)):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0)]))],2)}}}),[["__scopeId","data-v-640d8a8c"]]),pA={class:"simple-chart-shell"},gA={key:1,class:"analytics-chart-parent"},yA=Pt(u.defineComponent({__name:"SimpleChart",props:{chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},emptyStateTitle:{type:String,required:!1,default:""},syntheticsDataKey:{type:String,required:!1,default:""},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.computed(()=>{const c=q.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors||he},u.toRef(t,"chartData")).value;return t.chartOptions?.reverseDataset&&c?.datasets.reverse(),c}),s=u.computed(()=>t.chartData.meta?.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""),o=u.computed(()=>t.chartOptions.type==="gauge"),a=u.computed(()=>t.chartOptions.type==="single_value"),r=u.computed(()=>t.emptyStateTitle||n.t("noDataAvailableTitle")),l=u.computed(()=>{const c=t.chartData&&t.chartData.meta&&t.chartData.data.length;if(a.value){const d=t.chartData.meta?.metric_names?.[0];return c&&t.chartData.data[0].event[d]!==null}return c});return(c,d)=>{const h=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",pA,[l.value?(u.openBlock(),u.createElementBlock("div",gA,[o.value?(u.openBlock(),u.createBlock(oA,{key:0,"chart-data":i.value,"dataset-colors":e.chartOptions.chartDatasetColors,"is-simple":"","metric-display":e.chartOptions.metricDisplay,"metric-unit":s.value,numerator:e.chartOptions.numerator,"synthetics-data-key":e.syntheticsDataKey,width:e.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):u.createCommentVNode("",!0),a.value?(u.openBlock(),u.createBlock(mA,{key:1,"align-x":e.chartOptions.alignX,data:e.chartData,"decimal-points":e.chartOptions.decimalPoints,"increase-is-bad":e.chartOptions.increaseIsBad,"show-trend":e.chartOptions.showTrend},null,8,["align-x","data","decimal-points","increase-is-bad","show-trend"])):u.createCommentVNode("",!0)])):(u.openBlock(),u.createBlock(h,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(r.value),1)]),_:1}))])}}}),[["__scopeId","data-v-23ca8c84"]]),bA={class:"container"},_A={key:0,class:"no-data","data-testid":"sparkline-empty"},xA=["title"],wA=Pt(u.defineComponent({__name:"SparklineChart",props:{chartKey:{default:()=>{}},datasets:{},disableTooltip:{type:Boolean,default:!1},enableBrushing:{type:Boolean,default:!1},groupKey:{default:()=>{}},maxCount:{default:()=>{}},maxStamp:{default:()=>{}},minCount:{default:()=>{}},minStamp:{default:()=>{}},pointRenderCount:{default:24},showLabel:{type:Boolean,default:!1},tooltipTitle:{default:()=>{}},type:{default:"sparkline_bar"}},setup(e){const t=crypto.randomUUID(),{i18n:n}=q.useI18n(),{syncedGroupSizeMs:i,syncedMinStamp:s,syncedMaxStamp:o,syncedMinCount:a,syncedMaxCount:r,syncedRenderPoints:l,syncedChartDatasets:c}=q.useSparklineSync({chartKey:e.chartKey,datasets:e.datasets,groupKey:e.groupKey,minStamp:e.minStamp,maxStamp:e.maxStamp,minCount:e.minCount,maxCount:e.maxCount,renderPoints:e.pointRenderCount,type:e.type}),d=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:"",tooltipSeries:[],left:"",top:"",units:"count",translateUnit:()=>"",offsetX:0,offsetY:0,width:0,height:0,chartType:e.type==="sparkline_bar"?"timeseries_bar":"timeseries_line",chartID:t,interactionMode:"idle"}),h=({width:D,height:P})=>{d.width=D,d.height=P},f=u.computed(()=>e.disableTooltip?[]:[new df({enableBrushing:e.groupKey!==void 0&&e.chartKey!==void 0&&e.enableBrushing,brushStrategy:"group",brushGroup:e.groupKey})]),m=u.computed(()=>c.value.reduce((D,{data:P,label:k})=>({...D,[k]:P.reduce((S,{y:A})=>S+A,0)}),{})),p=u.computed(()=>c.value.map(({label:D})=>[m.value[D],`${D}: ${m.value[D]}`]).sort(([D],[P])=>P-D).map(([,D])=>D).join(", ")),g=u.computed(()=>Object.keys(m.value).map(D=>m.value[D]).reduce((D,P)=>D+P,0)),y=u.computed(()=>g.value>0),_=u.computed(()=>({labels:new Array(l.value).fill(""),datasets:c.value})),x=u.computed(()=>e.datasets.length>1),T=`SparklineTooltipPosition-${t}`,v=u.computed(()=>{const D=e.type==="sparkline_bar",P=D?s.value-1:s.value,k=D?o.value:o.value-i.value;return{maintainAspectRatio:!1,elements:{categoryPercentage:1,barPercentage:1,line:{tension:0,stepped:e.type==="sparkline_step",borderWidth:1},point:{radius:0,pointHitRadius:11,pointHoverRadius:0}},interaction:{intersect:!1,mode:"index"},layout:{padding:{left:D?0:2,right:D?0:2,top:2}},plugins:{legend:{display:!1},tooltip:{enabled:!1,position:T,external:S=>{Ia(d,S,"minutely",{contextFormatter:A=>{const L=A+i.value;let R="";return i.value>1440*60*1e3?R=rs(new Date(L),"MMM dd, yyy hh:mm a"):R=rs(new Date(L),"hh:mm a"),`${Up(A)} - ${R}`}})}}},scales:{x:{min:P,max:k,type:"timeseries",offset:!1,grid:{display:!1},display:!1,stacked:x.value},y:{min:Math.max(a.value-1,0),max:r.value,grid:{display:!1},display:!1,stacked:x.value}}}}),w=u.ref("0"),M=u.ref("0");return u.onMounted(()=>{Ht.positioners[T]=function(D,P){if(!D.length||d.interactionMode==="interactive"||P.x===null)return!1;const k=10,S=this.chart.canvas.getBoundingClientRect(),A=d.width||this.width,L=d.height||this.height,R=S.top-L>0,H=R?S.top-L-k:S.top+S.height+k,W=S.left>A/2-P.x,$=Math.max(k,window.innerWidth-k-A),K=Math.min($,W?Math.floor(S.left-A/2)+P.x:0+k);return w.value=`${H}px`,M.value=`${K}px`,{x:K,y:H,xAlign:"center",yAlign:R?"top":"bottom"}}}),u.onUnmounted(()=>{Ht.positioners[T]&&delete Ht.positioners[T]}),(D,P)=>(u.openBlock(),u.createElementBlock("div",bA,[y.value?e.type==="sparkline_bar"?(u.openBlock(),u.createBlock(u.unref(lf),{key:1,"chart-id":u.unref(t),data:_.value,"data-testid":"sparkline-bar",options:v.value,plugins:f.value},null,8,["chart-id","data","options","plugins"])):e.type==="sparkline_line"||e.type==="sparkline_step"?(u.openBlock(),u.createBlock(u.unref(uf),{key:2,"chart-id":u.unref(t),data:_.value,"data-testid":e.type==="sparkline_line"?"sparkline-line":"sparkline-step",options:v.value,plugins:f.value},null,8,["chart-id","data","data-testid","options","plugins"])):u.createCommentVNode("",!0):(u.openBlock(),u.createElementBlock("div",_A,[u.renderSlot(D.$slots,"empty",{},()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("sparkline_no_data")),1)],!0)])),e.disableTooltip?u.createCommentVNode("",!0):(u.openBlock(),u.createBlock(ji,{key:3,"absolute-left":M.value,"absolute-top":w.value,class:"tooltip","data-testid":"sparkline-tooltip",state:d,"tooltip-title":e.tooltipTitle,onDimensions:h},null,8,["absolute-left","absolute-top","state","tooltip-title"])),y.value&&e.showLabel?(u.openBlock(),u.createElementBlock("div",{key:4,class:"label",title:D.$slots.label?"":p.value},[u.renderSlot(D.$slots,"label",{total:g.value,totalByDataset:m.value},()=>[u.createTextVNode(u.toDisplayString(p.value),1)],!0)],8,xA)):u.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-ae8259b6"]]),kA=["data-value"],TA=["title"],SA={class:"top-talkers-cell-metric"},vA={class:"top-talkers-cell-value","data-testid":"top-talkers-cell-value"},MA={key:0,class:"top-talkers-cell-relative","data-testid":"top-talkers-cell-relative"},DA={class:"top-talkers-tooltip","data-testid":"top-talkers-tooltip"},CA={class:"top-talkers-tooltip-title"},OA={class:"top-talkers-tooltip-rows"},AA={class:"top-talkers-tooltip-label"},PA=["data-threshold"],EA=Pt(u.defineComponent({__name:"TopTalkersCell",props:{cell:{}},setup(e){return u.useCssVars(t=>({cecbd9f0:t.cell.color,v0d35e6b6:t.cell.tint})),(t,n)=>(u.openBlock(),u.createBlock(u.unref(Kn.KPop),{class:"top-talkers-cell-wrapper",disabled:!e.cell.tooltipRows.length,"hide-caret":"","hide-close-icon":"",placement:"right","popover-timeout":0,style:u.normalizeStyle({flexGrow:e.cell.ratio}),trigger:"hover"},{content:u.withCtx(()=>[u.createElementVNode("div",DA,[u.createElementVNode("div",CA,u.toDisplayString(e.cell.name),1),u.createElementVNode("dl",OA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.cell.tooltipRows,i=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:i.key},[u.createElementVNode("dt",AA,u.toDisplayString(i.label),1),u.createElementVNode("dd",{class:u.normalizeClass(["top-talkers-tooltip-value",i.threshold&&`top-talkers-tooltip-value--${i.threshold}`]),"data-threshold":i.threshold},u.toDisplayString(i.value),11,PA)],64))),128))])])]),default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["top-talkers-cell",{"top-talkers-cell--other":e.cell.isOther,"top-talkers-cell--empty":e.cell.isEmpty,"top-talkers-cell--deleted":e.cell.deleted}]),"data-testid":"top-talkers-cell","data-value":e.cell.id},[u.createElementVNode("span",{class:"top-talkers-cell-name","data-testid":"top-talkers-cell-name",title:e.cell.name},u.toDisplayString(e.cell.name),9,TA),u.createElementVNode("span",SA,[u.createElementVNode("span",vA,u.toDisplayString(e.cell.display),1),e.cell.relative?(u.openBlock(),u.createElementBlock("span",MA,"("+u.toDisplayString(e.cell.relative)+")",1)):u.createCommentVNode("",!0)])],10,kA)]),_:1},8,["disabled","style"]))}}),[["__scopeId","data-v-73764587"]]),RA=["data-dimension"],IA={class:"top-talkers-column-header"},LA={class:"top-talkers-column-label","data-testid":"top-talkers-column-label"},NA={key:0,class:"top-talkers-column-total","data-testid":"top-talkers-column-total"},BA={key:1,class:"top-talkers-column-empty","data-testid":"top-talkers-column-empty"},FA={key:2,class:"top-talkers-column-cells"},yf=Pt(u.defineComponent({__name:"TopTalkersColumn",props:{dimension:{},label:{},data:{},sizeMetric:{},columnOptions:{},isLoading:{type:Boolean}},setup(e){const{i18n:t}=q.useI18n(),{column:n}=q.useTopTalkersData(u.toRef(()=>e.data),u.toRef(()=>e.dimension),u.toRef(()=>e.sizeMetric),u.toRef(()=>e.columnOptions)),i=u.computed(()=>e.label||n.value.label),s=u.computed(()=>t.t("topTalkers.total",{value:n.value.total}));return(o,a)=>(u.openBlock(),u.createElementBlock("div",{class:"top-talkers-column","data-dimension":e.dimension,"data-testid":"top-talkers-column"},[u.createElementVNode("div",IA,[u.createElementVNode("span",LA,u.toDisplayString(i.value),1),!e.isLoading&&u.unref(n).cells.length?(u.openBlock(),u.createElementBlock("span",NA,u.toDisplayString(s.value),1)):u.createCommentVNode("",!0)]),e.isLoading?(u.openBlock(),u.createBlock(u.unref(Kn.KSkeleton),{key:0,"delay-milliseconds":0,"table-columns":1,type:"table"})):u.unref(n).cells.length?(u.openBlock(),u.createElementBlock("div",FA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(n).cells,r=>(u.openBlock(),u.createBlock(EA,{key:r.id,cell:r},null,8,["cell"]))),128))])):(u.openBlock(),u.createElementBlock("div",BA,u.toDisplayString(u.unref(t).t("topTalkers.defaultEmptyStateTitle")),1))],8,RA))}}),[["__scopeId","data-v-e1b08041"]]),zA={class:"top-talkers-card-title","data-testid":"top-talkers-card-title"},UA={key:2,class:"top-talkers-grid","data-testid":"top-talkers-grid"},VA=Pt(u.defineComponent({__name:"TopTalkersGrid",props:{title:{default:""},columns:{},sizeMetric:{default:void 0},columnOptions:{default:void 0},emptyStateTitle:{default:""},errorMessage:{default:""},titleTag:{default:"h2"}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.useSlots(),s=u.computed(()=>!!i.column),o=u.computed(()=>s.value||t.columns.some(a=>!!a.data?.data?.length||a.isLoading));return(a,r)=>(u.openBlock(),u.createBlock(u.unref(Kn.KCard),{class:"kong-ui-public-top-talkers","title-tag":e.titleTag},u.createSlots({default:u.withCtx(()=>[e.errorMessage?(u.openBlock(),u.createBlock(u.unref(Kn.KEmptyState),{key:0,"action-button-visible":!1,"data-testid":"top-talkers-error-state","icon-variant":"error"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("topTalkers.defaultErrorStateTitle")),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.errorMessage),1)]),_:1})):o.value?(u.openBlock(),u.createElementBlock("div",UA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.columns,(l,c)=>u.renderSlot(a.$slots,"column",{key:`${l.dimension}-${c}`,column:l},()=>[u.createVNode(yf,{"column-options":e.columnOptions,data:l.data,dimension:l.dimension,"is-loading":l.isLoading,label:l.label,"size-metric":e.sizeMetric},null,8,["column-options","data","dimension","is-loading","label","size-metric"])],!0)),128))])):(u.openBlock(),u.createBlock(u.unref(Kn.KEmptyState),{key:1,"action-button-visible":!1,"data-testid":"top-talkers-empty-state"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.emptyStateTitle||u.unref(n).t("topTalkers.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:u.withCtx(()=>[u.createElementVNode("span",zA,u.toDisplayString(e.title),1)]),key:"0"}:void 0]),1032,["title-tag"]))}}),[["__scopeId","data-v-d5bb8abd"]]),HA={ai_provider:{anthropic:Tt.AnthropicIcon,azure:Tt.AzureIcon,bedrock:Tt.AmazonBedrockIcon,cerebras:Tt.CerebrasIcon,cohere:Tt.CohereIcon,databricks:Tt.DatabricksIcon,deepseek:Tt.DeepseekIcon,gemini:Tt.GeminiIcon,huggingface:Tt.HuggingFaceIcon,llama2:Tt.MetaLlamaIcon,mistral:Tt.MistralIcon,moonshot:Tt.KimiIcon,nvidia:Tt.NvidiaIcon,ollama:Tt.OllamaIcon,openai:Tt.OpenAiIcon,vertex:Tt.GoogleVertexIcon,vllm:Tt.VllmIcon,xai:Tt.GrokIcon}},$A=(e,t)=>{if(!(!e||!t))return HA[e]?.[t.toLowerCase()]},YA=["data-threshold"],WA=Pt(u.defineComponent({__name:"TopNMetricBar",props:{ratio:{},threshold:{}},setup(e){u.useCssVars(n=>({v0394367e:u.unref(t)}));const t=he[1];return(n,i)=>(u.openBlock(),u.createElementBlock("span",{class:u.normalizeClass(["top-n-metric-cell-bar",{[`top-n-metric-cell--bar-${e.threshold}`]:!!e.threshold}]),"data-testid":"top-n-metric-cell-bar","data-threshold":e.threshold},[u.createElementVNode("span",{class:"top-n-metric-cell-bar-fill",style:u.normalizeStyle({width:`${e.ratio*100}%`})},null,4)],10,YA))}}),[["__scopeId","data-v-24eb60ef"]]),jA=["data-threshold"],qA={class:"top-n-metric-cell-value"},GA={key:0,class:"top-n-metric-cell-relative","data-testid":"top-n-metric-cell-relative"},XA=Pt(u.defineComponent({__name:"TopNMetricCell",props:{display:{},relative:{},threshold:{},hasBar:{type:Boolean}},setup(e){return(t,n)=>(u.openBlock(),u.createElementBlock("span",{class:u.normalizeClass(["top-n-metric-cell",{"top-n-metric-cell--bar":e.hasBar,[`top-n-metric-cell--text-${e.threshold}`]:!e.hasBar&&!!e.threshold}]),"data-threshold":e.threshold},[u.createElementVNode("span",qA,u.toDisplayString(e.display),1),e.relative?(u.openBlock(),u.createElementBlock("span",GA,"("+u.toDisplayString(e.relative)+")",1)):u.createCommentVNode("",!0)],10,jA))}}),[["__scopeId","data-v-17e7f860"]]),KA={class:"top-n-card-title","data-testid":"top-n-card-title"},ZA={class:"top-n-card-description","data-testid":"top-n-card-description"},QA={key:3,class:"top-n-table","data-testid":"top-n-table"},JA={"data-testid":"top-n-table-header"},tP={class:"top-n-table-header-row"},eP=["colspan"],nP={class:"table-header-label"},iP=["data-testid"],sP={class:"top-n-table-cell-label"},oP={key:0,class:"top-n-table-cell top-n-table-cell-bar"},aP=3,rP=Pt(u.defineComponent({__name:"TopNTable",props:{title:{default:""},description:{default:""},data:{},emptyStateTitle:{default:""},isLoading:{type:Boolean,default:!1},titleTag:{default:"h2"},columnOptions:{default:void 0}},setup(e){const t=e,{i18n:n}=q.useI18n(),{formatUnit:i}=oe({i18n:n}),s=u.computed(()=>t.data.data),o=u.computed(()=>!!s.value?.length),a=u.computed(()=>t.data.meta?.display?Object.keys(t.data.meta.display).slice(0,aP):[]),r=u.computed(()=>a.value[0]||""),l=u.computed(()=>a.value.length>1),c=u.computed(()=>a.value[a.value.length-1]||""),d=u.computed(()=>r.value?t.data.meta.display[r.value]:{}),h=u.computed(()=>t.data.meta?.metric_names?.length?t.data.meta.metric_names:[]),f=u.computed(()=>h.value[0]),m=u.computed(()=>f.value?X(f.value):""),p=u.computed(()=>{const C=a.value.map(E=>({key:E,columnKey:E,label:K(E,l.value?X(E):n.t("topNTable.nameLabel")),type:"dimension"}));return f.value&&C.push({key:"value",columnKey:f.value,label:K(f.value,m.value),type:"metric"}),h.value.forEach((E,N)=>{N!==0&&C.push({key:E,columnKey:E,label:K(E,X(E)),type:"metric"})}),C}),g=u.computed(()=>p.value.filter(C=>C.type==="metric")),y=u.computed(()=>p.value.filter(C=>C.type==="dimension").slice(1)),_=C=>C.type==="dimension"&&C.key===c.value,x=C=>C.type==="metric"&&!!an(t.columnOptions,C.columnKey)?.bar,T=C=>l.value&&C.type==="dimension"&&!_(C),v=C=>{const E=C.event;return String(E[r.value])},w=(C,E)=>{const N=String(C.event[E]),V=t.data.meta?.display?.[E]?.[N];return{dimension:E,id:N,name:V?.name||"-",deleted:!!V?.deleted}},M=C=>{const E=v(C),N=d.value&&d.value[E];return N?N.name:"-"},D=C=>{const E=v(C),N=d.value&&d.value[E];return N?!!N.deleted:!1},P=C=>{const E=N=>i(N,"%",{translateUnit:V=>z(V,N)});return C>0&&C<.01?`< ${E(.01)}`:E(C)},k=(C,E)=>{const N=C.event[E];if(N==null)return"–";const V=typeof N=="number"?N:Number(N);if(Number.isNaN(V))return"–";const tt=t.data.meta?.metric_units?.[E]||"count";if(tt==="%")return P(V);const Z=["count","count/minute","token count"].includes(tt);return i(V,tt,{approximate:Z,isBytes1024:!0,translateUnit:F=>z(F,V)})},S=u.computed(()=>Object.fromEntries(h.value.map(C=>[C,Pa(s.value.map(E=>Nn(E.event[C])))]))),A=(C,E)=>{const N=an(t.columnOptions,E),V=Nn(C.event[E]);if(!N||V===null)return{display:k(C,E)};const tt=S.value[E],Z=N.value==="relative"?Ea(V,tt):null;return{display:k(C,E),relative:Z===null?void 0:P(Z*100),barRatio:N.bar?Ed(V,tt,N.bar):void 0,threshold:Ra(V,N.thresholds)}},L=u.computed(()=>s.value?.length?s.value.map(C=>{const E=a.value.map(Z=>w(C,Z)),N=E[0],V=N?.id||v(C),tt={id:V,rowKey:E.map(Z=>`${Z.dimension}:${Z.id}`).join("|")||V,name:N?.name||M(C),deleted:D(C),dimensions:E,metrics:{},original:C};return h.value.forEach((Z,F)=>{tt.metrics[F===0?"value":Z]=A(C,Z)}),tt}):[]),R=u.computed(()=>{if(!o.value)return"";if(t.data.meta){if(a.value.some(C=>!Object.keys(t.data.meta.display[C]||{}).length))return n.t("topNTable.errors.display");if(!f.value)return n.t("topNTable.errors.metricNames")}else return n.t("topNTable.errors.meta");return""}),H=(C,E)=>C.metrics[E]??{display:"–"},W=(C,E)=>C.dimensions.find(N=>N.dimension===E)?.id||"",$=(C,E)=>$A(an(t.columnOptions,C)?.icon_set,E),K=(C,E)=>C&&an(t.columnOptions,C)?.label||E,lt=(C,E)=>C.dimensions.find(N=>N.dimension===E)?.name||"–",rt=(C,E)=>{const N=C.dimensions.find(V=>V.dimension===E);return{id:N?.id||"",name:N?.name||"–",deleted:N?.deleted||!1,dimension:E,dimensions:C.dimensions,isEmpty:N?.id==="empty"}},X=C=>n.te(`chartLabels.${C}`)?n.t(`chartLabels.${C}`):C,z=(C,E)=>{if(zi(C)||C==="count"||C==="requests")return"";const N=E===1?"":"s";return n.te(`chartUnits.${C}`)?n.t(`chartUnits.${C}`,{plural:N}):C};return(C,E)=>{const N=u.resolveComponent("KEmptyState"),V=u.resolveComponent("KSkeleton"),tt=u.resolveComponent("KCard");return u.openBlock(),u.createBlock(tt,{class:"kong-ui-public-top-n-table","title-tag":e.titleTag},u.createSlots({default:u.withCtx(()=>[R.value?(u.openBlock(),u.createBlock(N,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("topNTable.defaultErrorStateTitle")),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(R.value),1)]),_:1})):e.isLoading?(u.openBlock(),u.createBlock(V,{key:1,"table-columns":2,type:"table"})):o.value?(u.openBlock(),u.createElementBlock("div",QA,[u.createElementVNode("table",{class:u.normalizeClass(["top-n-table-table",{"top-n-table-table--multi-dimension":l.value}])},[u.createElementVNode("thead",JA,[u.createElementVNode("tr",tP,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(p.value,Z=>(u.openBlock(),u.createElementBlock("th",{key:Z.key,class:u.normalizeClass(["top-n-table-header-cell",{"top-n-table-header-cell-metric":Z.type==="metric","top-n-table-header-cell-dimension-compact":T(Z)}]),colspan:x(Z)?2:void 0,"data-testid":"top-n-table-header-column"},[u.createElementVNode("span",nP,u.toDisplayString(Z.label),1),E[0]||(E[0]=u.createElementVNode("div",{class:"top-n-table-header-cell-border"},null,-1))],10,eP))),128))])]),u.createElementVNode("tbody",null,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(L.value,Z=>(u.openBlock(),u.createElementBlock("tr",{key:Z.rowKey,class:"top-n-table-row"},[a.value.length?(u.openBlock(),u.createElementBlock("td",{key:0,class:u.normalizeClass(["top-n-table-cell top-n-table-cell--name",{"top-n-table-cell-dimension-compact":l.value}])},[u.createElementVNode("span",{class:"top-n-table-cell-label","data-testid":`row-${Z.id}`},[$(r.value,Z.id)?(u.openBlock(),u.createBlock(u.resolveDynamicComponent($(r.value,Z.id)),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["size"])):u.createCommentVNode("",!0),u.renderSlot(C.$slots,"name",{record:{id:Z.id,name:Z.name,deleted:Z.deleted,dimension:r.value,dimensions:Z.dimensions,isEmpty:Z.id==="empty"}},()=>[u.createTextVNode(u.toDisplayString(Z.name),1)],!0)],8,iP)],2)):u.createCommentVNode("",!0),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(y.value,F=>(u.openBlock(),u.createElementBlock("td",{key:F.key,class:u.normalizeClass(["top-n-table-cell top-n-table-cell--dimension",{"top-n-table-cell-dimension-compact":!_(F)}])},[u.createElementVNode("span",sP,[$(F.key,W(Z,F.key))?(u.openBlock(),u.createBlock(u.resolveDynamicComponent($(F.key,W(Z,F.key))),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["size"])):u.createCommentVNode("",!0),u.renderSlot(C.$slots,"name",{record:rt(Z,F.key)},()=>[u.createTextVNode(u.toDisplayString(lt(Z,F.key)),1)],!0)])],2))),128)),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(g.value,F=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:F.key},[u.createElementVNode("td",{class:u.normalizeClass(["top-n-table-cell top-n-table-cell-metric",{"top-n-table-cell-metric--has-bar":x(F)}])},[u.createVNode(XA,{"data-testid":F.key==="value"?`row-${Z.id}`:`row-${Z.id}-${F.key}`,display:H(Z,F.key).display,"has-bar":x(F),relative:H(Z,F.key).relative,threshold:H(Z,F.key).threshold},null,8,["data-testid","display","has-bar","relative","threshold"])],2),x(F)?(u.openBlock(),u.createElementBlock("td",oP,[u.createVNode(WA,{ratio:H(Z,F.key).barRatio??0,threshold:H(Z,F.key).threshold},null,8,["ratio","threshold"])])):u.createCommentVNode("",!0)],64))),128))]))),128))])],2)])):(u.openBlock(),u.createBlock(N,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.emptyStateTitle||u.unref(n).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:u.withCtx(()=>[u.createElementVNode("span",KA,u.toDisplayString(e.title),1)]),key:"0"}:void 0,e.description?{name:"actions",fn:u.withCtx(()=>[u.createElementVNode("div",ZA,u.toDisplayString(e.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-9111e441"]]);ot.AnalyticsChart=eA,ot.ChartLegendPosition=It,ot.DECIMAL_DISPLAY=KM,ot.FONT_SIZE_REGULAR=Fd,ot.FONT_SIZE_SMALL=Bd,ot.LEFT_Y_AXIS_ID=Gs,ot.MAX_LABEL_LENGTH=qs,ot.OTHER_DIMENSION_ID=Aa,ot.RIGHT_Y_AXIS_ID=Na,ot.SimpleChart=yA,ot.SparklineChart=wA,ot.TopNTable=rP,ot.TopTalkersColumn=yf,ot.TopTalkersGrid=VA,ot.chartTypes=J1,ot.exploreResultToScatterData=oh,ot.getBarRatio=Ed,ot.getColumnOptions=an,ot.getColumnStats=Pa,ot.getRelativeValue=Ea,ot.getThresholdType=Ra,ot.handleQueryError=Y1,ot.isCancellationError=ih,ot.isScatterChartData=tr,ot.lookupStatusCodeColor=Ud,ot.requestsToScatterData=K1,ot.simpleChartMetricDisplay=Q1,ot.simpleChartTypes=tD,ot.statusCodeBadgeBackgroundColor=JM,ot.toNumber=Nn,Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})}));
|
|
7
|
+
`)}}function NM(e,t,n={}){const{window:i=$s,...s}=n;let o;const a=Ad(()=>i&&"ResizeObserver"in i),r=()=>{o&&(o.disconnect(),o=void 0)},l=u.watch(u.computed(()=>{const d=u.toValue(e);return Array.isArray(d)?d.map(h=>Ln(h)):[Ln(d)]}),d=>{if(r(),a.value&&i){o=new ResizeObserver(t);for(const h of d)h&&o.observe(h,s)}},{immediate:!0,flush:"post"}),c=()=>{r(),l()};return Cd(c),{isSupported:a,stop:c}}function BM(e,t={}){const{reset:n=!0,windowResize:i=!0,windowScroll:s=!0,immediate:o=!0,updateTiming:a="sync"}=t,r=u.shallowRef(0),l=u.shallowRef(0),c=u.shallowRef(0),d=u.shallowRef(0),h=u.shallowRef(0),f=u.shallowRef(0),m=u.shallowRef(0),p=u.shallowRef(0);function g(){const _=Ln(e);if(!_){n&&(r.value=0,l.value=0,c.value=0,d.value=0,h.value=0,f.value=0,m.value=0,p.value=0);return}const x=_.getBoundingClientRect();r.value=x.height,l.value=x.bottom,c.value=x.left,d.value=x.right,h.value=x.top,f.value=x.width,m.value=x.x,p.value=x.y}function y(){a==="sync"?g():a==="next-frame"&&requestAnimationFrame(()=>g())}return NM(e,y),u.watch(()=>Ln(e),_=>!_&&y()),RM(e,y,{attributeFilter:["style","class"]}),s&&Ni("scroll",y,{capture:!0,passive:!0}),i&&Ni("resize",y,{passive:!0}),AM(()=>{o&&y()}),{height:r,bottom:l,left:c,right:d,top:h,width:f,x:m,y:p,update:y}}function FM(e,t){const{top:n,left:i}=BM(e),s=u.computed(()=>e.value?`${parseFloat(t.left)+i.value}px`:t.left),o=u.computed(()=>e.value?`${parseFloat(t.top)+n.value}px`:t.top);return{tooltipAbsoluteLeft:s,tooltipAbsoluteTop:o}}const zM=({bucketCount:e,minStamp:t,maxStamp:n,timestamps:i})=>{const s=[...i].filter(l=>l>=t&&l<=n).sort((l,c)=>l-c),o=[];if(n-t<e-2)return[];const a=(n-t)/e;let r=0;for(let l=0;l<e;l++){const c=t+l*a,d=t+(l+1)*a;let h=0;for(;r<s.length&&s[r]>=c&&s[r]<=d;)h++,r++;o.push([Math.ceil(c),h])}return o},Pd=()=>({minCounts:{},maxCounts:{},minStamps:{},maxStamps:{},renderPoints:{}}),Bi=u.ref({}),UM=e=>(Bi.value[e]||(Bi.value[e]=Pd()),Bi.value[e]),VM=(e,t)=>{const n=Bi.value[t];if(!n)return;const i=n.minCounts[e]!==void 0||n.maxCounts[e]!==void 0||n.minStamps[e]!==void 0||n.maxStamps[e]!==void 0||n.renderPoints[e]!==void 0;n&&i&&(delete n.minCounts[e],delete n.maxCounts[e],delete n.minStamps[e],delete n.maxStamps[e],delete n.renderPoints[e],Object.keys(n.minCounts).length||Object.keys(n.maxCounts).length||Object.keys(n.minStamps).length||Object.keys(n.maxStamps).length||Object.keys(n.renderPoints).length||delete Bi.value[t])};function HM({chartKey:e,datasets:t,groupKey:n,minStamp:i=void 0,maxStamp:s=void 0,minCount:o=void 0,maxCount:a=void 0,renderPoints:r=void 0,type:l}){const d=n!==void 0&&e!==void 0?UM(n):Pd(),h=e!==void 0?e:"static-chart-key",f=u.computed(()=>t.reduce((S,{timestamps:A})=>[...S,...A],[])),m=u.computed(()=>i||f.value.reduce((S,A)=>S===0?A:Math.min(S,A),0)),p=u.computed(()=>s||f.value.reduce((S,A)=>Math.max(S,A),0));u.watchEffect(()=>{d.minStamps[h]=m.value,d.maxStamps[h]=p.value,r!==void 0&&(d.renderPoints[h]=r)});const g=u.computed(()=>Object.values(d.minStamps).reduce((S,A)=>S===0?A:Math.min(S,A),0)),y=u.computed(()=>Object.values(d.maxStamps).reduce((S,A)=>Math.max(S,A),0)),_=u.computed(()=>{const S=Object.values(d.renderPoints);return S.length===0?24:S.reduce((A,L)=>Math.max(A,L),2)}),x=u.computed(()=>{const S=y.value-g.value;return Math.ceil(S/_.value)}),T=u.computed(()=>t.length>1),v=u.computed(()=>t.map(({timestamps:S,color:A,label:L})=>({data:zM({bucketCount:_.value,minStamp:g.value,maxStamp:y.value,timestamps:S}).map(([W,$])=>({x:W,y:$})),label:L,...(l==="sparkline_bar"||T.value)&&A&&{backgroundColor:A},...l!=="sparkline_bar"&&A&&{borderColor:A},...T.value&&l!=="sparkline_bar"&&{fill:!0}}))),w=u.computed(()=>{const S=v.value[0]?.data?.length??0,A=[];for(let L=0;L<S;L++){let R=0;for(let H=0;H<v.value.length;H++)R+=v.value[H].data[L].y;A.push(R)}return A}),M=u.computed(()=>{const S=w.value.reduce((A,L)=>Math.max(A,L),0);return Math.max(S,a??0)}),D=u.computed(()=>{const S=v.value.reduce((R,{data:H})=>[...R,...H.map(({y:W})=>W)],[]),A=S.length?S[0]:0,L=S.reduce((R,H)=>Math.min(R,H),A);return o===void 0?L:Math.min(L,o)});u.watchEffect(()=>{d.maxCounts[h]=M.value,d.minCounts[h]=D.value});const P=u.computed(()=>{const S=Object.values(d.minCounts),A=S.length?S[0]:0;return S.reduce((L,R)=>Math.min(L,R),A)}),k=u.computed(()=>Object.values(d.maxCounts).reduce((S,A)=>Math.max(S,A),0));return u.onUnmounted(()=>{e!==void 0&&n!==void 0&&VM(e,n)}),{syncedMinStamp:g,syncedMaxStamp:y,syncedRenderPoints:_,syncedChartDatasets:v,syncedGroupSizeMs:x,syncedMinCount:P,syncedMaxCount:k}}const an=(e,t)=>{if(!e||!t)return;const n=t.toLowerCase();return e[t]??Object.entries(e).find(([i])=>i.toLowerCase()===n)?.[1]},Nn=e=>{if(e==null||e==="")return null;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},Pa=e=>e.reduce((t,n)=>n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)},{sum:0,max:0}),Ea=(e,t)=>t.sum>0?e/t.sum:null,Ed=(e,t,n)=>{const i=n==="relative"?t.sum:t.max;return i<=0?0:Math.min(Math.max(e/i,0),1)},Ra=(e,t)=>{const n=(t??[]).filter(o=>e>=o.value);if(!n.length)return;const i=Math.max(...n.map(o=>o.value));return n.filter(o=>o.value===i).some(o=>o.type==="error")?"error":"warning"},Rd=18,$M=85;function YM(e,t,n,i){const{i18n:s}=Gl(),{formatUnit:o}=oe({i18n:s}),a=w=>w.map(M=>{const D=Math.min(M.ratio,.5)/.5;return{...M,color:Li({metric:n.value}),tint:`${Rd+D*($M-Rd)}%`}}),r=u.computed(()=>e.value?.data??[]),l=u.computed(()=>e.value?.meta?.metric_names??[]),c=u.computed(()=>{const w=n.value;return w&&l.value.includes(w)?w:l.value[0]}),d=u.computed(()=>l.value.filter(w=>w!==c.value)),h=u.computed(()=>e.value?.meta?.display?.[t.value]??{}),f=(w,M)=>{if(zi(w)||w==="count"||w==="requests")return"";const D=M===1?"":"s";return s.te(`chartUnits.${w}`)?s.t(`chartUnits.${w}`,{plural:D}):w},m=w=>{const M=D=>o(D,"%",{translateUnit:P=>f(P,D)});return w>0&&w<.01?`< ${M(.01)}`:M(w)},p=(w,M)=>{if(w===null)return"–";const D=e.value?.meta?.metric_units?.[M]||"count";return D==="%"?m(w):o(w,D,{isBytes1024:!0,translateUnit:P=>f(P,w)})},g=w=>s.te(`chartLabels.${w}`)?s.t(`chartLabels.${w}`):w,y=w=>an(i.value,w)?.label||g(w),_=u.computed(()=>Pa(r.value.map(w=>c.value?Nn(w.event[c.value]):null))),x=w=>d.value.flatMap(M=>{const D=Nn(w[M]);if(D===null)return[];const P=Ra(D,an(i.value,M)?.thresholds);return[{key:M,label:y(M),value:p(D,M),threshold:P}]}),T=u.computed(()=>{if(!c.value)return[];const w=r.value.map(M=>{const D=M.event,P=String(D[t.value]),k=Nn(D[c.value])??0,S=Ea(k,_.value),A=S??0,L=P===Aa;return{id:P,name:L?g(Aa):h.value[P]?.name||P,deleted:!!h.value[P]?.deleted,isOther:L,isEmpty:P===TM,value:k,ratio:A,display:p(k,c.value),relative:S===null?"":m(S*100),tooltipRows:x(D)}}).sort((M,D)=>Number(M.isOther)-Number(D.isOther)||D.value-M.value);return a(w)});return{column:u.computed(()=>({dimension:t.value,label:y(t.value),total:p(_.value.sum,c.value??"count"),cells:T.value})),cells:T,sizeKey:c}}const q={useBarChartOptions:TS,useChartJSCommon:vS,useChartLegendValues:DS,useExploreResultToDatasets:lM,useExploreResultToTimeDataset:hM,useScatterDatasets:_M,useDonutChartOptions:CS,useLineChartOptions:OS,useScatterChartOptions:ES,useI18n:Gl,useReportChartDataForSynthetics:xM,useTranslatedUnits:wM,useEvaluateFeatureFlag:SM,useTooltipAbsolutePosition:FM,useSparklineSync:HM,useTopTalkersData:YM},Ws=e=>["interactive","zoom-interactive"].includes(e),Ia=(e,t,n,i)=>{const{tooltip:s}=t;if(s.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const{i18n:o}=q.useI18n(),{formatUnit:a}=oe({i18n:o}),r=e.chartTooltipSortFn||((l,c)=>c.rawValue-l.rawValue);if(s.body&&!Ws(e.interactionMode)){const l=s.labelColors,c=t.chart.config?.options?.indexAxis==="y"?"x":"y",d=s.dataPoints[0].parsed.x??0;e.tooltipContext=i?.contextFormatter?i.contextFormatter(d,n,s.dataPoints[0].raw):zn({tickValue:new Date(d),granularity:n}),e.tooltipSeries=s.dataPoints.map((f,m)=>{const p=f.parsed[c],g=f.dataset.unit??e.units,y=a(p??0,g,{translateUnit:e.translateUnit}),_=f.raw?.tooltipLabel||f.dataset.label;return{backgroundColor:l[m].backgroundColor,borderColor:l[m].borderColor,label:_,value:y,rawValue:p,isSegmentEmpty:f.dataset.isSegmentEmpty}}).sort(r);const h=s.dataPoints[0]?.raw?.extras??[];for(const f of h)e.tooltipSeries.push({label:f.label,value:f.unit?a(Number(f.value)||0,f.unit,{translateUnit:e.translateUnit}):String(f.value),rawValue:Number(f.value)||0,isExtra:!0});e.left=`${s.x}px`,e.top=`${s.y}px`,e.showTooltip=!0}},Id=(e,t)=>{const{tooltip:n}=t,{i18n:i}=q.useI18n(),{formatUnit:s}=oe({i18n:i});if(n.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const o=e.chartTooltipSortFn||((a,r)=>r.rawValue-a.rawValue);if(n.body&&!Ws(e.interactionMode)){const a=n.labelColors,r=t.chart.config?.options?.indexAxis==="y"?"x":"y",l=["gauge","donut"].includes(e.chartType);l?e.tooltipContext=e.dimensionDisplay||n.dataPoints[0].label:n.chart.data.isMultiDimension?e.tooltipContext=n.dataPoints[0].label:e.tooltipContext=e.dimensionDisplay||"",e.tooltipSeries=n.dataPoints.map((c,d)=>{const h=l?c.parsed:c.parsed[r],f=s(h??0,e.units,{translateUnit:e.translateUnit});let m;return l?m=c.dataset.labels[c.dataIndex]:m=c.dataset.label,{backgroundColor:a[d].backgroundColor,borderColor:a[d].borderColor,label:m,value:f,rawValue:h,isSegmentEmpty:c.dataset.isSegmentEmpty}}).sort(o),e.left=`${n.x}px`,e.top=`${n.y}px`,e.showTooltip=!0}},WM=e=>e&&e.datasets&&e.datasets.length,jM=e=>WM(e)&&e.datasets.some(t=>t.data.length),qM=e=>e.datasets.some(t=>t.data[0]&&Eo(t.data[0].x)),GM=e=>!!jM(e)&&e.datasets.some(t=>t.data.length==1),XM=e=>qM(e)&&e.datasets.some(t=>t.data[0]&&(t.data[0].x??0).toString().length>=13),js=(e,t,n)=>{const s=Math.min(t/1150,1),o=.15,a=1.15,r=e.x??0;return r<n?r+t*o*(1-s):r-t*a*(1-s)},Ld=(e,t,n)=>{const o=e.y??0;return o<n?o+t*.15:o-t*.5};function Nd(e,t){let n;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>{e(...i)},t)}}const La=(e,t,n)=>{const i=e.data;return e.options.plugins.legend.labels.generateLabels(e).filter(s=>!t?.[s.text]?.isThreshold).map(((s,o)=>({...s,value:t&&t[s.text],isSegmentEmpty:i.datasets[o].isSegmentEmpty}))).sort(n)},KM=2,Bd=10,Fd=12,qs=10,Gs="y",Na="y1",he=["#a86cd5","#6a86d2","#00bbf9","#00c4b0","#ffdf15"],Ba=(e,t)=>(t||he)[e%he.length],ZM="#6f7787",QM={100:{background:"#f0f5fd",text:"#10599e"},200:{background:"#e5f7f4",text:"#1b6955"},300:{background:"#fff1d5",text:"#a06027"},400:{background:"#fee3b6",text:"#944d19"},500:{background:"#fedada",text:"#852021"}},JM=e=>{const t=Math.floor(parseInt(e,10)/100)*100;return QM[t]?.background||"#fafafa"},t1=sg,Fa=(e,t,n,i)=>{let s;return n?s=t1:Array.isArray(i)?s=Ba(e,i):s=i[t],s||Ba(e)},za=e=>{switch(e){case"error":return og;case"warning":return cg;case"neutral":return pl;default:return pl}},e1={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},n1=2,i1=0,Ua=new Map,zd=(e,t)=>{const{i18n:n}=q.useI18n(),{formatBytes:i}=oe({i18n:n});return t==="bytes"?i(e):t==="count/minute"?e.toFixed(2):ss.format(e)},s1=e=>{const n=document.createElement("canvas").getContext("2d"),i=wt({});return n.font=i.string,n.measureText(e).width},o1=()=>{const e="label_height";if(!Ua.has(e)){const t=wt({});Ua.set(e,t.lineHeight)}return Ua.get(e)},a1=(e,t)=>t.datasets.reduce((n,i,s)=>e.isDatasetVisible(s)?n+i.data.reduce((o,a)=>isNaN(a)?o:o+a,0):n,0),r1=(e,t)=>t===0?" (0.0%)":` (${(e/t*100).toFixed(1)}%)`,l1=ig,c1={100:hg,101:fg,102:mg,103:pg,200:gg,201:yg,202:bg,203:_g,204:xg,205:wg,206:kg,207:Tg,208:Sg,226:vg,300:Mg,301:Dg,302:Cg,303:Og,304:Ag,305:Pg,307:Eg,308:Rg,400:Ig,401:Lg,402:Ng,403:Bg,404:Fg,405:zg,406:Ug,407:Vg,408:Hg,409:$g,410:Yg,411:Wg,412:jg,413:qg,414:Gg,415:Xg,416:Kg,417:Zg,418:Qg,421:Jg,422:ty,423:ey,424:ny,425:iy,426:sy,428:oy,429:ay,431:ry,451:ly,500:cy,501:uy,502:dy,503:hy,504:fy,505:my,506:py,507:gy,508:yy,510:by,511:_y},u1={100:xy,200:wy,300:ky,400:Ty,500:Sy},d1={"1XX":vy,"2XX":My,"3XX":Dy,"4XX":Cy,"5XX":Oy},Ud=e=>{const t=parseInt(e,10),n=Math.floor(t/100)*100;return c1[t]??u1[n]??l1},Va={...Array.from({length:500},(e,t)=>100+t).reduce((e,t)=>(e[`${t}`]=Ud(`${t}`),e),{}),____OTHER____:ng,...d1};function Vd(e,t,n){const i=zl(),s=m1(e,n.timeZone,n.locale??i.locale);return"formatToParts"in s?h1(s,t):f1(s,t)}function h1(e,t){const n=e.formatToParts(t);for(let i=n.length-1;i>=0;--i)if(n[i].type==="timeZoneName")return n[i].value}function f1(e,t){const n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}function m1(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function p1(e,t){const n=x1(t);return"formatToParts"in n?y1(n,e):b1(n,e)}const g1={year:0,month:1,day:2,hour:3,minute:4,second:5};function y1(e,t){try{const n=e.formatToParts(t),i=[];for(let s=0;s<n.length;s++){const o=g1[n[s].type];o!==void 0&&(i[o]=parseInt(n[s].value,10))}return i}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function b1(e,t){const n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Ha={},Hd=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),_1=Hd==="06/25/2014, 00:00:00"||Hd==="06/25/2014 00:00:00";function x1(e){return Ha[e]||(Ha[e]=_1?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Ha[e]}function $d(e,t,n,i,s,o,a){const r=new Date(0);return r.setUTCFullYear(e,t,n),r.setUTCHours(i,s,o,a),r}const Yd=36e5,w1=6e4,$a={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Ya(e,t,n){if(!e)return 0;let i=$a.timezoneZ.exec(e);if(i)return 0;let s,o;if(i=$a.timezoneHH.exec(e),i)return s=parseInt(i[1],10),Wd(s)?-(s*Yd):NaN;if(i=$a.timezoneHHMM.exec(e),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Wd(s,a)?(o=Math.abs(s)*Yd+a*w1,i[1]==="+"?-o:o):NaN}if(S1(e)){t=new Date(t||Date.now());const a=n?t:k1(t),r=Wa(a,e);return-(n?r:T1(t,r,e))}return NaN}function k1(e){return $d(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function Wa(e,t){const n=p1(e,t),i=$d(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let s=e.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function T1(e,t,n){let s=e.getTime()-t;const o=Wa(new Date(s),n);if(t===o)return t;s-=o-t;const a=Wa(new Date(s),n);return o===a?o:Math.max(o,a)}function Wd(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const jd={};function S1(e){if(jd[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),jd[e]=!0,!0}catch{return!1}}const v1=60*1e3,M1={X:function(e,t,n){const i=ja(n.timeZone,e);if(i===0)return"Z";switch(t){case"X":return qd(i);case"XXXX":case"XX":return Bn(i);default:return Bn(i,":")}},x:function(e,t,n){const i=ja(n.timeZone,e);switch(t){case"x":return qd(i);case"xxxx":case"xx":return Bn(i);default:return Bn(i,":")}},O:function(e,t,n){const i=ja(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+D1(i,":");default:return"GMT"+Bn(i,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return Vd("short",e,n);default:return Vd("long",e,n)}}};function ja(e,t){const n=e?Ya(e,t,!0)/v1:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Xs(e,t){const n=e<0?"-":"";let i=Math.abs(e).toString();for(;i.length<t;)i="0"+i;return n+i}function Bn(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Xs(Math.floor(i/60),2),o=Xs(Math.floor(i%60),2);return n+s+t+o}function qd(e,t){return e%60===0?(e>0?"-":"+")+Xs(Math.abs(e)/60,2):Bn(e,t)}function D1(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.floor(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+Xs(o,2)}function Gd(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const C1=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,qa=36e5,Xd=6e4,O1=2,Wt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:C1};function Kd(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?O1:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const i=A1(e),{year:s,restDateString:o}=P1(i.date,n),a=E1(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const r=a.getTime();let l=0,c;if(i.time&&(l=R1(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=Ya(i.timeZone||t.timeZone,new Date(r+l)),isNaN(c))return new Date(NaN)}else c=Gd(new Date(r+l)),c=Gd(new Date(r+l+c));return new Date(r+l+c)}else return new Date(NaN)}function A1(e){const t={};let n=Wt.dateTimePattern.exec(e),i;if(n?(t.date=n[1],i=n[3]):(n=Wt.datePattern.exec(e),n?(t.date=n[1],i=n[2]):(t.date=null,i=e)),i){const s=Wt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function P1(e,t){if(e){const n=Wt.YYY[t],i=Wt.YYYYY[t];let s=Wt.YYYY.exec(e)||i.exec(e);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(s=Wt.YY.exec(e)||n.exec(e),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:e.slice(o.length)}}}return{year:null}}function E1(e,t){if(t===null)return null;let n,i,s;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let o=Wt.MM.exec(e);if(o)return n=new Date(0),i=parseInt(o[1],10)-1,Jd(t,i)?(n.setUTCFullYear(t,i),n):new Date(NaN);if(o=Wt.DDD.exec(e),o){n=new Date(0);const a=parseInt(o[1],10);return N1(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(o=Wt.MMDD.exec(e),o){n=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Jd(t,i,a)?(n.setUTCFullYear(t,i,a),n):new Date(NaN)}if(o=Wt.Www.exec(e),o)return s=parseInt(o[1],10)-1,th(s)?Zd(t,s):new Date(NaN);if(o=Wt.WwwD.exec(e),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return th(s,a)?Zd(t,s,a):new Date(NaN)}return null}function R1(e){let t,n,i=Wt.HH.exec(e);if(i)return t=parseFloat(i[1].replace(",",".")),Ga(t)?t%24*qa:NaN;if(i=Wt.HHMM.exec(e),i)return t=parseInt(i[1],10),n=parseFloat(i[2].replace(",",".")),Ga(t,n)?t%24*qa+n*Xd:NaN;if(i=Wt.HHMMSS.exec(e),i){t=parseInt(i[1],10),n=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Ga(t,n,s)?t%24*qa+n*Xd+s*1e3:NaN}return null}function Zd(e,t,n){t=t||0,n=n||0;const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=t*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const I1=[31,28,31,30,31,30,31,31,30,31,30,31],L1=[31,29,31,30,31,30,31,31,30,31,30,31];function Qd(e){return e%400===0||e%4===0&&e%100!==0}function Jd(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const i=Qd(e);if(i&&n>L1[t]||!i&&n>I1[t])return!1}return!0}function N1(e,t){if(t<1)return!1;const n=Qd(e);return!(n&&t>366||!n&&t>365)}function th(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Ga(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const B1=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function F1(e,t,n={}){t=String(t);const i=t.match(B1);if(i){const s=Kd(n.originalDate||e,n);t=i.reduce(function(o,a){if(a[0]==="'")return o;const r=o.indexOf(a),l=o[r-1]==="'",c=o.replace(a,"'"+M1[a[0]](s,a,n)+"'");return l?c.substring(0,r-1)+c.substring(r+1):c},t)}return rs(e,t,n)}function z1(e,t,n){e=Kd(e,n);const i=Ya(t,e,!0),s=new Date(e.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function Fi(e,t,n,i){return i={...i,timeZone:t,originalDate:e},F1(z1(e,t,{timeZone:i.timeZone}),n,i)}const U1=(e,t)=>`${Fi(e,t,"yyyy")} W${Fi(e,t,"II")}`,Xa="MMM dd, h:mm:ss a",Ka="h:mm:ss a",rn="MMM dd, h:mm a",Fn="h:mm a",V1="MMM dd",Za="MMM dd, h:mm:ss a",Ue="MMM dd, h:mm a",H1={secondly:e=>e?Xa:Ka,tenSecondly:e=>e?Xa:Ka,thirtySecondly:e=>e?Xa:Ka,minutely:e=>e?rn:Fn,fiveMinutely:e=>e?rn:Fn,tenMinutely:e=>e?rn:Fn,thirtyMinutely:e=>e?rn:Fn,hourly:e=>e?rn:Fn,twoHourly:e=>e?rn:Fn,twelveHourly:()=>rn,daily:()=>V1},$1={secondly:()=>Za,tenSecondly:()=>Za,thirtySecondly:()=>Za,minutely:()=>Ue,fiveMinutely:()=>Ue,tenMinutely:()=>Ue,thirtyMinutely:()=>Ue,hourly:()=>Ue,twoHourly:()=>Ue,twelveHourly:()=>Ue,daily:()=>Ue};function eh({tickValue:e,granularity:t,timezone:n,dayBoundaryCrossed:i=!1,tickMap:s,tooltipMap:o,defaultFormat:a}){const r=n||Intl.DateTimeFormat().resolvedOptions().timeZone;if(t==="weekly")return U1(e,r);if(s&&s[t]){const l=s[t](i);return Fi(e,r,l)}if(o&&o[t]){const l=o[t]();return Fi(e,r,l)}return Fi(e,r,a)}const nh=({tickValue:e,granularity:t,dayBoundaryCrossed:n,timezone:i})=>eh({tickValue:e,granularity:t,timezone:i,dayBoundaryCrossed:n,tickMap:H1,defaultFormat:"MMM dd, h:mm:ss a"}),zn=({tickValue:e,granularity:t,timezone:n})=>eh({tickValue:e,granularity:t,timezone:n,tooltipMap:$1,defaultFormat:"MMM dd, yyyy h:mm:ss a"}),ih=e=>e?.code==="ERR_CANCELED"||e?.name==="CanceledError"||e?.name==="AbortError",Y1=e=>{const{i18n:t}=q.useI18n();return ih(e)?{type:"canceled",message:t.t("query_errors.canceled.message")}:e?.status===403?{status:e.status,type:"forbidden",message:t.t("query_errors.forbidden.message"),details:t.t("query_errors.forbidden.details")}:e?.status===408||e?.message?.includes("timeout")?{status:e.status,type:"timeout",message:t.t("query_errors.timeout.message"),details:t.t("query_errors.timeout.details")}:e?.response?.data?.message==="Range not allowed for this tier"?{status:e.status,type:"range_exceeded",message:t.t("query_errors.time_range_exceeded.message"),details:t.t("query_errors.time_range_exceeded.details")}:{status:e.status,type:"other",message:t.t("query_errors.other.message"),details:e.response?.data?.invalid_parameters?.map(n=>n.reason).join(", ")||e?.message}},zi=e=>e.toLocaleLowerCase().endsWith("count"),W1=e=>{const t=e.toLocaleLowerCase();return["sum","count","cost","tokens"].some(n=>t.endsWith(n))},j1=(e,t)=>{if(!e.length)return NaN;const i=Math.min(100,Math.max(0,t))/100*(e.length-1),s=Math.floor(i),o=Math.ceil(i);return s===o?e[s]:e[s]+(e[o]-e[s])*(i-s)},q1=(e,t)=>{const n=e.filter(i=>Number.isFinite(i)).sort((i,s)=>i-s);return new Map(t.map(i=>[i,j1(n,i)]))},sh=.7,Qa=(e,t)=>{const n=xs(e.trim());return n.valid?n.alpha(t).rgbString():e},Ja=e=>{const t=e??(typeof document>"u"?null:document.documentElement);if(typeof window>"u"||!t)return{medianLine:gl,outlier:fl,outlierBand:Qa(ml,sh)};const n=window.getComputedStyle(t),i=(s,o)=>n.getPropertyValue(s).trim()||o;return{medianLine:i("--kui-color-text",gl),outlier:i("--kui-color-background-danger",fl),outlierBand:Qa(i("--kui-color-background-danger-weakest",ml),sh)}},G1="empty",oh=e=>{if(!e||!("meta"in e)||!("data"in e))return;const{display:t,metric_names:n,metric_units:i,start:s,end:o,truncated:a,limit:r,datasource:l}=e.meta;if(!n?.length){console.error("Cannot build scatter chart data from this explore result. Missing metric names.");return}const c=n.length>1?n[0]:void 0,d=c?n[1]:n[0],h=t&&Object.keys(t)[0]||void 0,f=e.data??[],m=[];for(const p of f){const g=rh(p.timestamp,p.event[d],h?p.event[h]:void 0);if(g){if(c){const y=ah(p.event[c]);if(y===void 0)continue;g.x=y}m.push(g)}}return{points:m,metric:d,metricUnit:i?.[d],...c?{xMetric:c,xMetricUnit:i?.[c]}:{},dimension:h,display:h?t?.[h]:void 0,start:s,end:o,truncated:a,limit:r,datasource:l}},ah=e=>{if(e==null||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0},rh=(e,t,n,i)=>{const s=new Date(e).valueOf(),o=ah(t);if(!Number.isFinite(s)||o===void 0)return;const a=i?.length?{extras:i}:{};return n===void 0?{timestamp:s,value:o,...a}:{timestamp:s,value:o,group:n!==null&&n!==""?String(n):G1,...a}},X1=(e,t,n)=>{if(!n?.length)return;const i=[];for(const{field:s,label:o,unit:a}of n){const r=ln(e,s)??ln(t,s);r==null||r===""||i.push({label:o??s,value:r,...a?{unit:a}:{}})}return i.length?i:void 0},K1=(e,t)=>{if(!e||!("meta"in e))return;const{metric:n,dimension:i,unroll:s,display:o,extraFields:a,metricUnit:r}=t,l=t.timestamp??"request_start";if(!n){console.error("Cannot build scatter chart data from these request records. Missing metric.");return}const c=[];for(const d of e.results??[]){const h=ln(d,l);for(const f of Z1(d,s)){const m=ln(f,n),p=i?ln(f,i)??ln(d,i):void 0,g=rh(h,m,i?p??null:void 0,X1(f,d,a));g&&c.push(g)}}return{points:c,metric:n,metricUnit:r,dimension:i,display:o,start:e.meta?.time_range?.start,end:e.meta?.time_range?.end,truncated:e.truncated,limit:e.limit,datasource:"requests"}},Z1=(e,t)=>{if(!t)return[e];const n=ln(e,t);return Array.isArray(n)?n:[]},ln=(e,t)=>{let n=e;for(const i of t.split(".")){if(n===null||typeof n!="object")return;n=n[i]}return n},lh=e=>Object.hasOwn(ql.chartLabels,e),Q1=["hidden","single","full"],J1=["donut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar","scatter"],tD=["gauge","top_n","single_value"],tr=e=>e===null||typeof e!="object"||!("points"in e)?!1:Array.isArray(e.points);var It=(e=>(e.Hidden="hidden",e.Bottom="bottom",e))(It||{});const ch={modes:{point(e,t){return Ks(e,t,{intersect:!0})},nearest(e,t,n){return iD(e,t,n)},x(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"x"})},y(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"y"})}}};function er(e,t,n){return(ch.modes[n.mode]||ch.modes.nearest)(e,t,n)}function eD(e,t,n){return n!=="x"&&n!=="y"?e.inRange(t.x,t.y,"x",!0)||e.inRange(t.x,t.y,"y",!0):e.inRange(t.x,t.y,n,!0)}function nD(e,t,n){return n==="x"?{x:e.x,y:t.y}:n==="y"?{x:t.x,y:e.y}:t}function Ks(e,t,n){return e.filter(i=>n.intersect?i.inRange(t.x,t.y):eD(i,t,n.axis))}function iD(e,t,n){let i=Number.POSITIVE_INFINITY;return Ks(e,t,n).reduce((s,o)=>{const a=o.getCenterPoint(),r=nD(t,a,n.axis),l=Cn(t,r);return l<i?(s=[o],i=l):l===i&&s.push(o),s},[]).sort((s,o)=>s._index-o._index).slice(0,1)}function cn(e,t,n){const i=Math.cos(n),s=Math.sin(n),o=t.x,a=t.y;return{x:o+i*(e.x-o)-s*(e.y-a),y:a+s*(e.x-o)+i*(e.y-a)}}const sD=(e,t)=>t>e||e.length>t.length&&e.slice(0,t.length)===t,un=.001,Zs=(e,t,n)=>Math.min(n,Math.max(t,e)),uh=(e,t)=>e.value>=e.start-t&&e.value<=e.end+t;function oD(e,t,n){for(const i of Object.keys(e))e[i]=Zs(e[i],t,n);return e}function aD(e,t,n,i){return!e||!t||n<=0?!1:Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<=Math.pow(n+i,2)}function dh(e,{x:t,y:n,x2:i,y2:s},o,{borderWidth:a,hitTolerance:r}){const l=(a+r)/2,c=e.x>=t-l-un&&e.x<=i+l+un,d=e.y>=n-l-un&&e.y<=s+l+un;return o==="x"?c:(o==="y"||c)&&d}function hh(e,{rect:t,center:n},i,{rotation:s,borderWidth:o,hitTolerance:a}){const r=cn(e,n,Ot(-s));return dh(r,t,i,{borderWidth:o,hitTolerance:a})}function dn(e,t){const{centerX:n,centerY:i}=e.getProps(["centerX","centerY"],t);return{x:n,y:i}}function rD(e,t,n,i=!0){const s=n.split(".");let o=0;for(const a of t.split(".")){const r=s[o++];if(parseInt(a,10)<parseInt(r,10))break;if(sD(r,a)){if(i)throw new Error(`${e} v${n} is not supported. v${t} or newer is required.`);return!1}}return!0}const fh=e=>typeof e=="string"&&e.endsWith("%"),mh=e=>parseFloat(e)/100,ph=e=>Zs(mh(e),0,1),Ui=(e,t)=>({x:e,y:t,x2:e,y2:t,width:0,height:0}),lD={box:e=>Ui(e.centerX,e.centerY),doughnutLabel:e=>Ui(e.centerX,e.centerY),ellipse:e=>({centerX:e.centerX,centerY:e.centerX,radius:0,width:0,height:0}),label:e=>Ui(e.centerX,e.centerY),line:e=>Ui(e.x,e.y),point:e=>({centerX:e.centerX,centerY:e.centerY,radius:0,width:0,height:0}),polygon:e=>Ui(e.centerX,e.centerY)};function nr(e,t){return t==="start"?0:t==="end"?e:fh(t)?ph(t)*e:e/2}function Ve(e,t,n=!0){return typeof t=="number"?t:fh(t)?(n?ph(t):mh(t))*e:e}function cD(e,t){const{x:n,width:i}=e,s=t.textAlign;return s==="center"?n+i/2:s==="end"||s==="right"?n+i:n}function gh(e,t,{borderWidth:n,position:i,xAdjust:s,yAdjust:o},a){const r=st(a),l=t.width+(r?a.width:0)+n,c=t.height+(r?a.height:0)+n,d=ir(i),h=xh(e.x,l,s,d.x),f=xh(e.y,c,o,d.y);return{x:h,y:f,x2:h+l,y2:f+c,width:l,height:c,centerX:h+l/2,centerY:f+c/2}}function ir(e,t="center"){return st(e)?{x:Q(e.x,t),y:Q(e.y,t)}:(e=Q(e,t),{x:e,y:e})}const yh=(e,t)=>e&&e.autoFit&&t<1;function bh(e,t){const n=e.font,i=dt(n)?n:[n];return yh(e,t)?i.map(function(s){const o=wt(s);return o.size=Math.floor(s.size*t),o.lineHeight=s.lineHeight,wt(o)}):i.map(s=>wt(s))}function _h(e){return e&&(qt(e.xValue)||qt(e.yValue))}function xh(e,t,n=0,i){return e-nr(t,i)+n}function Un(e,t,n){const i=n.init;if(i){if(i===!0)return kh(t,n)}else return;return uD(e,t,n)}function wh(e,t,n){let i=!1;return t.forEach(s=>{Gt(e[s])?(i=!0,n[s]=e[s]):qt(n[s])&&delete n[s]}),i}function kh(e,t){const n=t.type||"line";return lD[n](e)}function uD(e,t,n){const i=mt(n.init,[{chart:e,properties:t,options:n}]);if(i===!0)return kh(t,n);if(st(i))return i}const sr=new Map,dD=e=>isNaN(e)||e<=0,hD=e=>e.reduce(function(t,n){return t+=n.string,t},"");function Qs(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function Js(e,{x:t,y:n},i){i&&(e.translate(t,n),e.rotate(Ot(i)),e.translate(-t,-n))}function ke(e,t){if(t&&t.borderWidth)return e.lineCap=t.borderCapStyle||"butt",e.setLineDash(t.borderDash),e.lineDashOffset=t.borderDashOffset,e.lineJoin=t.borderJoinStyle||"miter",e.lineWidth=t.borderWidth,e.strokeStyle=t.borderColor,!0}function Vn(e,t){e.shadowColor=t.backgroundShadowColor,e.shadowBlur=t.shadowBlur,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=t.shadowOffsetY}function to(e,t){const n=t.content;if(Qs(n))return{width:Ve(n.width,t.width),height:Ve(n.height,t.height)};const i=bh(t),s=t.textStrokeWidth,o=dt(n)?n:[n],a=o.join()+hD(i)+s+(e._measureText?"-spriting":"");return sr.has(a)||sr.set(a,gD(e,o,i,s)),sr.get(a)}function Th(e,t,n){const{x:i,y:s,width:o,height:a}=t;e.save(),Vn(e,n);const r=ke(e,n);e.fillStyle=n.backgroundColor,e.beginPath(),On(e,{x:i,y:s,w:o,h:a,radius:oD(Ie(n.borderRadius),0,Math.min(o,a)/2)}),e.closePath(),e.fill(),r&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore()}function Sh(e,t,n,i){const s=n.content;if(Qs(s)){e.save(),e.globalAlpha=_D(n.opacity,s.style.opacity),e.drawImage(s,t.x,t.y,t.width,t.height),e.restore();return}const o=dt(s)?s:[s],a=bh(n,i),r=n.color,l=dt(r)?r:[r],c=cD(t,n),d=t.y+n.textStrokeWidth/2;e.save(),e.textBaseline="middle",e.textAlign=n.textAlign,fD(e,n)&&yD(e,{x:c,y:d},o,a),bD(e,{x:c,y:d},o,{fonts:a,colors:l}),e.restore()}function fD(e,t){if(t.textStrokeWidth>0)return e.lineJoin="round",e.miterLimit=2,e.lineWidth=t.textStrokeWidth,e.strokeStyle=t.textStrokeColor,!0}function mD(e,t,n,i){const{radius:s,options:o}=t,a=o.pointStyle,r=o.rotation;let l=(r||0)*qo;if(Qs(a)){e.save(),e.translate(n,i),e.rotate(l),e.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),e.restore();return}dD(s)||pD(e,{x:n,y:i,radius:s,rotation:r,style:a,rad:l})}function pD(e,{x:t,y:n,radius:i,rotation:s,style:o,rad:a}){let r,l,c,d;switch(e.beginPath(),o){default:e.arc(t,n,i,0,yt),e.closePath();break;case"triangle":e.moveTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),e.closePath();break;case"rectRounded":d=i*.516,c=i-d,r=Math.cos(a+se)*c,l=Math.sin(a+se)*c,e.arc(t-r,n-l,d,a-it,a-bt),e.arc(t+l,n-r,d,a-bt,a),e.arc(t+r,n+l,d,a,a+bt),e.arc(t-l,n+r,d,a+bt,a+it),e.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,e.rect(t-c,n-c,2*c,2*c);break}a+=se;case"rectRot":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+l,n-r),e.lineTo(t+r,n+l),e.lineTo(t-l,n+r),e.closePath();break;case"crossRot":a+=se;case"cross":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"star":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r),a+=se,r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"line":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l);break;case"dash":e.moveTo(t,n),e.lineTo(t+Math.cos(a)*i,n+Math.sin(a)*i);break}e.fill()}function gD(e,t,n,i){e.save();const s=t.length;let o=0,a=i;for(let r=0;r<s;r++){const l=n[Math.min(r,n.length-1)];e.font=l.string;const c=t[r];o=Math.max(o,e.measureText(c).width+i),a+=l.lineHeight}return e.restore(),{width:o,height:a}}function yD(e,{x:t,y:n},i,s){e.beginPath();let o=0;i.forEach(function(a,r){const l=s[Math.min(r,s.length-1)],c=l.lineHeight;e.font=l.string,e.strokeText(a,t,n+c/2+o),o+=c}),e.stroke()}function bD(e,{x:t,y:n},i,{fonts:s,colors:o}){let a=0;i.forEach(function(r,l){const c=o[Math.min(l,o.length-1)],d=s[Math.min(l,s.length-1)],h=d.lineHeight;e.beginPath(),e.font=d.string,e.fillStyle=c,e.fillText(r,t,n+h/2+a),a+=h,e.fill()})}function _D(e,t){const n=Re(e)?e:t;return Re(n)?Zs(n,0,1):1}const vh=["left","bottom","top","right"];function xD(e,t){const{pointX:n,pointY:i,options:s}=t,o=s.callout,a=o&&o.display&&vD(t,o);if(!a||DD(t,o,a))return;if(e.save(),e.beginPath(),!ke(e,o))return e.restore();const{separatorStart:l,separatorEnd:c}=wD(t,a),{sideStart:d,sideEnd:h}=TD(t,a,l);(o.margin>0||s.borderWidth===0)&&(e.moveTo(l.x,l.y),e.lineTo(c.x,c.y)),e.moveTo(d.x,d.y),e.lineTo(h.x,h.y);const f=cn({x:n,y:i},t.getCenterPoint(),Ot(-t.rotation));e.lineTo(f.x,f.y),e.stroke(),e.restore()}function wD(e,t){const{x:n,y:i,x2:s,y2:o}=e,a=kD(e,t);let r,l;return t==="left"||t==="right"?(r={x:n+a,y:i},l={x:r.x,y:o}):(r={x:n,y:i+a},l={x:s,y:r.y}),{separatorStart:r,separatorEnd:l}}function kD(e,t){const{width:n,height:i,options:s}=e,o=s.callout.margin+s.borderWidth/2;return t==="right"?n+o:t==="bottom"?i+o:-o}function TD(e,t,n){const{y:i,width:s,height:o,options:a}=e,r=a.callout.start,l=SD(t,a.callout);let c,d;return t==="left"||t==="right"?(c={x:n.x,y:i+Ve(o,r)},d={x:c.x+l,y:c.y}):(c={x:n.x+Ve(s,r),y:n.y},d={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:d}}function SD(e,t){const n=t.side;return e==="left"||e==="top"?-n:n}function vD(e,t){const n=t.position;return vh.includes(n)?n:MD(e,t)}function MD(e,t){const{x:n,y:i,x2:s,y2:o,width:a,height:r,pointX:l,pointY:c,centerX:d,centerY:h,rotation:f}=e,m={x:d,y:h},p=t.start,g=Ve(a,p),y=Ve(r,p),_=[n,n+g,n+g,s],x=[i+y,o,i,o],T=[];for(let v=0;v<4;v++){const w=cn({x:_[v],y:x[v]},m,Ot(f));T.push({position:vh[v],distance:Cn(w,{x:l,y:c})})}return T.sort((v,w)=>v.distance-w.distance)[0].position}function DD(e,t,n){const{pointX:i,pointY:s}=e,o=t.margin;let a=i,r=s;return n==="left"?a+=o:n==="right"?a-=o:n==="top"?r+=o:n==="bottom"&&(r-=o),e.inRange(a,r)}const Mh={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function Hn(e,t,n){return t=typeof t=="number"?t:e.parse(t),xt(t)?e.getPixelForValue(t):n}function hn(e,t,n){const i=t[n];if(i||n==="scaleID")return i;const s=n.charAt(0),o=Object.values(e).filter(a=>a.axis&&a.axis===s);return o.length?o[0].id:s}function Dh(e,t){if(e){const n=e.options.reverse,i=Hn(e,t.min,n?t.end:t.start),s=Hn(e,t.max,n?t.start:t.end);return{start:i,end:s}}}function Ch(e,t){const{chartArea:n,scales:i}=e,s=i[hn(i,t,"xScaleID")],o=i[hn(i,t,"yScaleID")];let a=n.width/2,r=n.height/2;return s&&(a=Hn(s,t.xValue,s.left+s.width/2)),o&&(r=Hn(o,t.yValue,o.top+o.height/2)),{x:a,y:r}}function or(e,t){const n=e.scales,i=n[hn(n,t,"xScaleID")],s=n[hn(n,t,"yScaleID")];if(!i&&!s)return{};let{left:o,right:a}=i||e.chartArea,{top:r,bottom:l}=s||e.chartArea;const c=Ph(i,{min:t.xMin,max:t.xMax,start:o,end:a});o=c.start,a=c.end;const d=Ph(s,{min:t.yMin,max:t.yMax,start:l,end:r});return r=d.start,l=d.end,{x:o,y:r,x2:a,y2:l,width:a-o,height:l-r,centerX:o+(a-o)/2,centerY:r+(l-r)/2}}function Oh(e,t){if(!_h(t)){const n=or(e,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(n.width,n.height)/2,t.radius=i);const s=i*2,o=n.centerX+t.xAdjust,a=n.centerY+t.yAdjust;return{x:o-i,y:a-i,x2:o+i,y2:a+i,centerX:o,centerY:a,width:s,height:s,radius:i}}return OD(e,t)}function CD(e,t){const{scales:n,chartArea:i}=e,s=n[t.scaleID],o={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?AD(s,o,t):PD(n,o,t),o}function Ah(e,t){const n=or(e,t);return n.initProperties=Un(e,n,t),n.elements=[{type:"label",optionScope:"label",properties:ID(e,n,t),initProperties:n.initProperties}],n}function OD(e,t){const n=Ch(e,t),i=t.radius*2;return{x:n.x-t.radius+t.xAdjust,y:n.y-t.radius+t.yAdjust,x2:n.x+t.radius+t.xAdjust,y2:n.y+t.radius+t.yAdjust,centerX:n.x+t.xAdjust,centerY:n.y+t.yAdjust,radius:t.radius,width:i,height:i}}function Ph(e,t){const n=Dh(e,t)||t;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function AD(e,t,n){const i=Hn(e,n.value,NaN),s=Hn(e,n.endValue,i);e.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function PD(e,t,n){for(const i of Object.keys(Mh)){const s=e[hn(e,n,i)];if(s){const{min:o,max:a,start:r,end:l,startProp:c,endProp:d}=Mh[i],h=Dh(s,{min:n[o],max:n[a],start:s[r],end:s[l]});t[c]=h.start,t[d]=h.end}}}function ED({properties:e,options:t},n,i,s){const{x:o,x2:a,width:r}=e;return Eh({start:o,end:a,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:n.width})}function RD({properties:e,options:t},n,i,s){const{y:o,y2:a,height:r}=e;return Eh({start:o,end:a,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:n.height})}function Eh(e,t){const{start:n,end:i,borderWidth:s}=e,{position:o,padding:{start:a,end:r},adjust:l}=t,c=i-s-n-a-r-t.size;return n+s/2+l+nr(c,o)}function ID(e,t,n){const i=n.label;i.backgroundColor="transparent",i.callout.display=!1;const s=ir(i.position),o=At(i.padding),a=to(e.ctx,i),r=ED({properties:t,options:n},a,s,o),l=RD({properties:t,options:n},a,s,o),c=a.width+o.width,d=a.height+o.height;return{x:r,y:l,x2:r+c,y2:l+d,width:c,height:d,centerX:r+c/2,centerY:l+d/2,rotation:i.rotation}}const ar=["enter","leave"],rr=ar.concat("click");function LD(e,t,n){t.listened=wh(n,rr,t.listeners),t.moveListened=!1,ar.forEach(i=>{Gt(n[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Gt(i.click)&&(t.listened=!0),t.moveListened||ar.forEach(s=>{Gt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function ND(e,t,n){if(e.listened)switch(t.type){case"mousemove":case"mouseout":return BD(e,t,n);case"click":return FD(e,t,n)}}function BD(e,t,n){if(!e.moveListened)return;let i;t.type==="mousemove"?i=er(e.visibleElements,t,n.interaction):i=[];const s=e.hovered;e.hovered=i;const o={state:e,event:t};let a=Rh(o,"leave",s,i);return Rh(o,"enter",i,s)||a}function Rh({state:e,event:t},n,i,s){let o;for(const a of i)s.indexOf(a)<0&&(o=Ih(a.options[n]||e.listeners[n],a,t)||o);return o}function FD(e,t,n){const i=e.listeners,s=er(e.visibleElements,t,n.interaction);let o;for(const a of s)o=Ih(a.options.click||i.click,a,t)||o;return o}function Ih(e,t,n){return mt(e,[t.$context,n])===!0}const eo=["afterDraw","beforeDraw"];function zD(e,t,n){const i=t.visibleElements;t.hooked=wh(n,eo,t.hooks),t.hooked||i.forEach(s=>{t.hooked||eo.forEach(o=>{Gt(s.options[o])&&(t.hooked=!0)})})}function Lh(e,t,n){if(e.hooked){const i=t.options[n]||e.hooks[n];return mt(i,[t.$context])}}function UD(e,t,n){const i=WD(e.scales,t,n);let s=Nh(t,i,"min","suggestedMin");s=Nh(t,i,"max","suggestedMax")||s,s&&Gt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function VD(e,t){for(const n of e)$D(n,t)}function Nh(e,t,n,i){if(xt(t[n])&&!HD(e.options,n,i)){const s=e[n]!==t[n];return e[n]=t[n],s}}function HD(e,t,n){return qt(e[t])||qt(e[n])}function $D(e,t){for(const n of["scaleID","xScaleID","yScaleID"]){const i=hn(t,e,n);i&&!t[i]&&YD(e,n)&&console.warn(`No scale found with id '${i}' for annotation '${e.id}'`)}}function YD(e,t){if(t==="scaleID")return!0;const n=t.charAt(0);for(const i of["Min","Max","Value"])if(qt(e[n+i]))return!0;return!1}function WD(e,t,n){const i=t.axis,s=t.id,o=i+"ScaleID",a={min:Q(t.min,Number.NEGATIVE_INFINITY),max:Q(t.max,Number.POSITIVE_INFINITY)};for(const r of n)r.scaleID===s?Bh(r,t,["value","endValue"],a):hn(e,r,o)===s&&Bh(r,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Bh(e,t,n,i){for(const s of n){const o=e[s];if(qt(o)){const a=t.parse(o);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class $n extends Vt{inRange(t,n,i,s){const{x:o,y:a}=cn({x:t,y:n},this.getCenterPoint(s),Ot(-this.options.rotation));return dh({x:o,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options)}getCenterPoint(t){return dn(this,t)}draw(t){t.save(),Js(t,this.getCenterPoint(),this.options.rotation),Th(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return Ah(t,n)}}$n.id="boxAnnotation",$n.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},$n.defaultRoutes={borderColor:"color",backgroundColor:"color"},$n.descriptors={label:{_fallback:!0}};class no extends Vt{inRange(t,n,i,s){return hh({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return dn(this,t)}draw(t){const n=this.options;!n.display||!n.content||(ZD(t,this),t.save(),Js(t,this.getCenterPoint(),this.rotation),Sh(t,this,n,this._fitRatio),t.restore())}resolveElementProperties(t,n){const i=jD(t,n);if(!i)return{};const{controllerMeta:s,point:o,radius:a}=GD(t,n,i);let r=to(t.ctx,n);const l=XD(r,a);yh(n,l)&&(r={width:r.width*l,height:r.height*l});const{position:c,xAdjust:d,yAdjust:h}=n,f=gh(o,r,{borderWidth:0,position:c,xAdjust:d,yAdjust:h});return{initProperties:Un(t,f,n),...f,...s,rotation:n.rotation,_fitRatio:l}}}no.id="doughnutLabelAnnotation",no.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0},no.defaultRoutes={};function jD(e,t){return e.getSortedVisibleDatasetMetas().reduce(function(n,i){const s=i.controller;return s instanceof ki&&qD(e,t,i.data)&&(!n||s.innerRadius<n.controller.innerRadius)&&s.options.circumference>=90?i:n},void 0)}function qD(e,t,n){if(!t.autoHide)return!0;for(let i=0;i<n.length;i++)if(!n[i].hidden&&e.getDataVisibility(i))return!0}function GD({chartArea:e},t,n){const{left:i,top:s,right:o,bottom:a}=e,{innerRadius:r,offsetX:l,offsetY:c}=n.controller,d=(i+o)/2+l,h=(s+a)/2+c,f={left:Math.max(d-r,i),right:Math.min(d+r,o),top:Math.max(h-r,s),bottom:Math.min(h+r,a)},m={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},p=t.spacing+t.borderWidth/2,g=r-p,y=m.y>h,_=y?s+p:a-p,x=KD(_,d,h,g);return{controllerMeta:{_centerX:d,_centerY:h,_radius:g,_counterclockwise:y,...x},point:m,radius:Math.min(r,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function XD({width:e,height:t},n){const i=Math.sqrt(Math.pow(e,2)+Math.pow(t,2));return n*2/i}function KD(e,t,n,i){const s=Math.pow(n-e,2),o=Math.pow(i,2),a=t*-2,r=Math.pow(t,2)+s-o,l=Math.pow(a,2)-4*r;if(l<=0)return{_startAngle:0,_endAngle:yt};const c=(-a-Math.sqrt(l))/2,d=(-a+Math.sqrt(l))/2;return{_startAngle:bs({x:t,y:n},{x:c,y:e}).angle,_endAngle:bs({x:t,y:n},{x:d,y:e}).angle}}function ZD(e,t){const{_centerX:n,_centerY:i,_radius:s,_startAngle:o,_endAngle:a,_counterclockwise:r,options:l}=t;e.save();const c=ke(e,l);e.fillStyle=l.backgroundColor,e.beginPath(),e.arc(n,i,s,o,a,r),e.closePath(),e.fill(),c&&e.stroke(),e.restore()}class Vi extends Vt{inRange(t,n,i,s){return hh({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return dn(this,t)}draw(t){const n=this.options,i=!qt(this._visible)||this._visible;!n.display||!n.content||!i||(t.save(),Js(t,this.getCenterPoint(),this.rotation),xD(t,this),Th(t,this,n),Sh(t,QD(this),n),t.restore())}resolveElementProperties(t,n){let i;if(_h(n))i=Ch(t,n);else{const{centerX:r,centerY:l}=or(t,n);i={x:r,y:l}}const s=At(n.padding),o=to(t.ctx,n),a=gh(i,o,n,s);return{initProperties:Un(t,a,n),pointX:i.x,pointY:i.y,...a,rotation:n.rotation}}}Vi.id="labelAnnotation",Vi.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},Vi.defaultRoutes={borderColor:"color"};function QD({x:e,y:t,width:n,height:i,options:s}){const o=s.borderWidth/2,a=At(s.padding);return{x:e+a.left+o,y:t+a.top+o,width:n-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}const lr=(e,t,n)=>({x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}),cr=(e,t,n)=>lr(t,n,Math.abs((e-t.y)/(n.y-t.y))).x,Fh=(e,t,n)=>lr(t,n,Math.abs((e-t.x)/(n.x-t.x))).y,Hi=e=>e*e,JD=(e,t,{x:n,y:i,x2:s,y2:o},a)=>a==="y"?{start:Math.min(i,o),end:Math.max(i,o),value:t}:{start:Math.min(n,s),end:Math.max(n,s),value:e},zh=(e,t,n,i)=>(1-i)*(1-i)*e+2*(1-i)*i*t+i*i*n,ur=(e,t,n,i)=>({x:zh(e.x,t.x,n.x,i),y:zh(e.y,t.y,n.y,i)}),Uh=(e,t,n,i)=>2*(1-i)*(t-e)+2*i*(n-t),Vh=(e,t,n,i)=>-Math.atan2(Uh(e.x,t.x,n.x,i),Uh(e.y,t.y,n.y,i))+.5*it;class $i extends Vt{inRange(t,n,i,s){const o=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:n},{path:r,ctx:l}=this;if(r){ke(l,this.options),l.lineWidth+=this.options.hitTolerance;const{chart:d}=this.$context,h=t*d.currentDevicePixelRatio,f=n*d.currentDevicePixelRatio,m=l.isPointInStroke(r,h,f)||dr(this,a,s);return l.restore(),m}const c=Hi(o);return iC(this,a,c,s)||dr(this,a,s)}return tC(this,{mouseX:t,mouseY:n},i,{hitSize:o,useFinalPosition:s})}getCenterPoint(t){return dn(this,t)}draw(t){const{x:n,y:i,x2:s,y2:o,cp:a,options:r}=this;if(t.save(),!ke(t,r))return t.restore();Vn(t,r);const l=Math.sqrt(Math.pow(s-n,2)+Math.pow(o-i,2));if(r.curve&&a)return dC(t,this,a,l),t.restore();const{startOpts:c,endOpts:d,startAdjust:h,endAdjust:f}=jh(this),m=Math.atan2(o-i,s-n);t.translate(n,i),t.rotate(m),t.beginPath(),t.moveTo(0+h,0),t.lineTo(l-f,0),t.shadowColor=r.borderShadowColor,t.stroke(),hr(t,0,h,c),hr(t,l,-f,d),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){const i=CD(t,n),{x:s,y:o,x2:a,y2:r}=i,l=eC(i,t.chartArea),c=l?nC({x:s,y:o},{x:a,y:r},t.chartArea):{x:s,y:o,x2:a,y2:r,width:Math.abs(a-s),height:Math.abs(r-o)};if(c.centerX=(a+s)/2,c.centerY=(r+o)/2,c.initProperties=Un(t,c,n),n.curve){const h={x:c.x,y:c.y},f={x:c.x2,y:c.y2};c.cp=uC(c,n,Cn(h,f))}const d=sC(t,c,n.label);return d._visible=l,c.elements=[{type:"label",optionScope:"label",properties:d,initProperties:c.initProperties}],c}}$i.id="lineAnnotation";const Hh={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};$i.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Hh),fill:!1,length:12,start:Object.assign({},Hh),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Vi.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},$i.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},$i.defaultRoutes={borderColor:"color"};function tC(e,{mouseX:t,mouseY:n},i,{hitSize:s,useFinalPosition:o}){const a=JD(t,n,e.getProps(["x","y","x2","y2"],o),i);return uh(a,s)||dr(e,{mouseX:t,mouseY:n},o,i)}function eC({x:e,y:t,x2:n,y2:i},{top:s,right:o,bottom:a,left:r}){return!(e<r&&n<r||e>o&&n>o||t<s&&i<s||t>a&&i>a)}function $h({x:e,y:t},n,{top:i,right:s,bottom:o,left:a}){return e<a&&(t=Fh(a,{x:e,y:t},n),e=a),e>s&&(t=Fh(s,{x:e,y:t},n),e=s),t<i&&(e=cr(i,{x:e,y:t},n),t=i),t>o&&(e=cr(o,{x:e,y:t},n),t=o),{x:e,y:t}}function nC(e,t,n){const{x:i,y:s}=$h(e,t,n),{x:o,y:a}=$h(t,e,n);return{x:i,y:s,x2:o,y2:a,width:Math.abs(o-i),height:Math.abs(a-s)}}function iC(e,{mouseX:t,mouseY:n},i=un,s){const{x:o,y:a,x2:r,y2:l}=e.getProps(["x","y","x2","y2"],s),c=r-o,d=l-a,h=Hi(c)+Hi(d),f=h===0?-1:((t-o)*c+(n-a)*d)/h;let m,p;return f<0?(m=o,p=a):f>1?(m=r,p=l):(m=o+f*c,p=a+f*d),Hi(t-m)+Hi(n-p)<=i}function dr(e,{mouseX:t,mouseY:n},i,s){const o=e.label;return o.options.display&&o.inRange(t,n,s,i)}function sC(e,t,n){const i=n.borderWidth,s=At(n.padding),o=to(e.ctx,n),a=o.width+s.width+i,r=o.height+s.height+i;return aC(t,n,{width:a,height:r,padding:s},e.chartArea)}function oC(e){const{x:t,y:n,x2:i,y2:s}=e,o=Math.atan2(s-n,i-t);return o>it/2?o-it:o<it/-2?o+it:o}function aC(e,t,n,i){const{width:s,height:o,padding:a}=n,{xAdjust:r,yAdjust:l}=t,c={x:e.x,y:e.y},d={x:e.x2,y:e.y2},h=t.rotation==="auto"?oC(e):Ot(t.rotation),f=rC(s,o,h),m=lC(e,t,{labelSize:f,padding:a},i),p=e.cp?ur(c,e.cp,d,m):lr(c,d,m),g={size:f.w,min:i.left,max:i.right,padding:a.left},y={size:f.h,min:i.top,max:i.bottom,padding:a.top},_=Wh(p.x,g)+r,x=Wh(p.y,y)+l;return{x:_-s/2,y:x-o/2,x2:_+s/2,y2:x+o/2,centerX:_,centerY:x,pointX:p.x,pointY:p.y,width:s,height:o,rotation:ys(h)}}function rC(e,t,n){const i=Math.cos(n),s=Math.sin(n);return{w:Math.abs(e*i)+Math.abs(t*s),h:Math.abs(e*s)+Math.abs(t*i)}}function lC(e,t,n,i){let s;const o=cC(e,i);return t.position==="start"?s=Yh({w:e.x2-e.x,h:e.y2-e.y},n,t,o):t.position==="end"?s=1-Yh({w:e.x-e.x2,h:e.y-e.y2},n,t,o):s=nr(1,t.position),s}function Yh(e,t,n,i){const{labelSize:s,padding:o}=t,a=e.w*i.dx,r=e.h*i.dy,l=a>0&&(s.w/2+o.left-i.x)/a,c=r>0&&(s.h/2+o.top-i.y)/r;return Zs(Math.max(l,c),0,.25)}function cC(e,t){const{x:n,x2:i,y:s,y2:o}=e,a=Math.min(s,o)-t.top,r=Math.min(n,i)-t.left,l=t.bottom-Math.max(s,o),c=t.right-Math.max(n,i);return{x:Math.min(r,c),y:Math.min(a,l),dx:r<=c?1:-1,dy:a<=l?1:-1}}function Wh(e,t){const{size:n,min:i,max:s,padding:o}=t,a=n/2;return n>s-i?(s+i)/2:(i>=e-o-a&&(e=i+o+a),s<=e+o+a&&(e=s-o-a),e)}function jh(e){const t=e.options,n=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:n,endOpts:i,startAdjust:qh(e,n),endAdjust:qh(e,i)}}function qh(e,t){if(!t||!t.display)return 0;const{length:n,width:i}=t,s=e.options.borderWidth/2,o={x:n,y:i+s};return Math.abs(cr(0,o,{x:0,y:s}))}function hr(e,t,n,i){if(!i||!i.display)return;const{length:s,width:o,fill:a,backgroundColor:r,borderColor:l}=i,c=Math.abs(t-s)+n;e.beginPath(),Vn(e,i),ke(e,i),e.moveTo(c,-o),e.lineTo(t+n,0),e.lineTo(c,o),a===!0?(e.fillStyle=r||l,e.closePath(),e.fill(),e.shadowColor="transparent"):e.shadowColor=i.borderShadowColor,e.stroke()}function uC(e,t,n){const{x:i,y:s,x2:o,y2:a,centerX:r,centerY:l}=e,c=Math.atan2(a-s,o-i),d=ir(t.controlPoint,0),h={x:r+Ve(n,d.x,!1),y:l+Ve(n,d.y,!1)};return cn(h,{x:r,y:l},c)}function Gh(e,{x:t,y:n},{angle:i,adjust:s},o){!o||!o.display||(e.save(),e.translate(t,n),e.rotate(i),hr(e,0,-s,o),e.restore())}function dC(e,t,n,i){const{x:s,y:o,x2:a,y2:r,options:l}=t,{startOpts:c,endOpts:d,startAdjust:h,endAdjust:f}=jh(t),m={x:s,y:o},p={x:a,y:r},g=Vh(m,n,p,0),y=Vh(m,n,p,1)-it,_=ur(m,n,p,h/i),x=ur(m,n,p,1-f/i),T=new Path2D;e.beginPath(),T.moveTo(_.x,_.y),T.quadraticCurveTo(n.x,n.y,x.x,x.y),e.shadowColor=l.borderShadowColor,e.stroke(T),t.path=T,t.ctx=e,Gh(e,_,{angle:g,adjust:h},c),Gh(e,x,{angle:y,adjust:f},d)}class Yi extends Vt{inRange(t,n,i,s){const o=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y")return hC({x:t,y:n},this.getProps(["width","height","centerX","centerY"],s),o,a);const{x:r,y:l,x2:c,y2:d}=this.getProps(["x","y","x2","y2"],s),h=i==="y"?{start:l,end:d}:{start:r,end:c},f=cn({x:t,y:n},this.getCenterPoint(s),Ot(-o));return f[i]>=h.start-a-un&&f[i]<=h.end+a+un}getCenterPoint(t){return dn(this,t)}draw(t){const{width:n,height:i,centerX:s,centerY:o,options:a}=this;t.save(),Js(t,this.getCenterPoint(),a.rotation),Vn(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const r=ke(t,a);t.ellipse(s,o,i/2,n/2,it/2,0,2*it),t.fill(),r&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return Ah(t,n)}}Yi.id="ellipseAnnotation",Yi.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},$n.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Yi.defaultRoutes={borderColor:"color",backgroundColor:"color"},Yi.descriptors={label:{_fallback:!0}};function hC(e,t,n,i){const{width:s,height:o,centerX:a,centerY:r}=t,l=s/2,c=o/2;if(l<=0||c<=0)return!1;const d=Ot(n||0),h=Math.cos(d),f=Math.sin(d),m=Math.pow(h*(e.x-a)+f*(e.y-r),2),p=Math.pow(f*(e.x-a)-h*(e.y-r),2);return m/Math.pow(l+i,2)+p/Math.pow(c+i,2)<=1.0001}class io extends Vt{inRange(t,n,i,s){const{x:o,y:a,x2:r,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),d=(this.options.borderWidth+this.options.hitTolerance)/2;return i!=="x"&&i!=="y"?aD({x:t,y:n},this.getCenterPoint(s),c/2,d):uh(i==="y"?{start:a,end:l,value:n}:{start:o,end:r,value:t},d)}getCenterPoint(t){return dn(this,t)}draw(t){const n=this.options,i=n.borderWidth;if(n.radius<.1)return;t.save(),t.fillStyle=n.backgroundColor,Vn(t,n);const s=ke(t,n);mD(t,this,this.centerX,this.centerY),s&&!Qs(n.pointStyle)&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore(),n.borderWidth=i}resolveElementProperties(t,n){const i=Oh(t,n);return i.initProperties=Un(t,i,n),i}}io.id="pointAnnotation",io.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},io.defaultRoutes={borderColor:"color",backgroundColor:"color"};class so extends Vt{inRange(t,n,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&mC(this.elements,t,n,s);const o=cn({x:t,y:n},this.getCenterPoint(s),Ot(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),r=Math.min(...a),l=Math.max(...a);return o[i]>=r&&o[i]<=l}getCenterPoint(t){return dn(this,t)}draw(t){const{elements:n,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,Vn(t,i);const s=ke(t,i);let o=!0;for(const a of n)o?(t.moveTo(a.x,a.y),o=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,n){const i=Oh(t,n),{sides:s,rotation:o}=n,a=[],r=2*it/s;let l=o*qo;for(let c=0;c<s;c++,l+=r){const d=fC(i,n,l);d.initProperties=Un(t,i,n),a.push(d)}return i.elements=a,i}}so.id="polygonAnnotation",so.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},so.defaultRoutes={borderColor:"color",backgroundColor:"color"};function fC({centerX:e,centerY:t},{radius:n,borderWidth:i,hitTolerance:s},o){const a=(i+s)/2,r=Math.sin(o),l=Math.cos(o),c={x:e+r*n,y:t-l*n};return{type:"point",optionScope:"point",properties:{x:c.x,y:c.y,centerX:c.x,centerY:c.y,bX:e+r*(n+a),bY:t-l*(n+a)}}}function mC(e,t,n,i){let s=!1,o=e[e.length-1].getProps(["bX","bY"],i);for(const a of e){const r=a.getProps(["bX","bY"],i);r.bY>n!=o.bY>n&&t<(o.bX-r.bX)*(n-r.bY)/(o.bY-r.bY)+r.bX&&(s=!s),o=r}return s}const He={box:$n,doughnutLabel:no,ellipse:Yi,label:Vi,line:$i,point:io,polygon:so};Object.keys(He).forEach(e=>{_t.describe(`elements.${He[e].id}`,{_fallback:"plugins.annotation.common"})});const pC={update:Object.assign},gC=rr.concat(eo),Xh=(e,t)=>st(t)?pr(e,t):e,fr=e=>e==="color"||e==="font";function mr(e="line"){return He[e]?e:(console.warn(`Unknown annotation type: '${e}', defaulting to 'line'`),"line")}function yC(e,t,n,i){const s=_C(e,n.animations,i),o=t.annotations,a=kC(t.elements,o);for(let r=0;r<o.length;r++){const l=o[r],c=Kh(a,r,l.type),d=l.setContext(wC(e,c,a,l)),h=c.resolveElementProperties(e,d);h.skip=bC(h),"elements"in h&&(xC(c,h.elements,d,s),delete h.elements),qt(c.x)||Object.assign(c,h),Object.assign(c,h.initProperties),h.options=Zh(d),s.update(c,h)}}function bC(e){return isNaN(e.x)||isNaN(e.y)}function _C(e,t,n){return n==="reset"||n==="none"||n==="resize"?pC:new ra(e,t)}function xC(e,t,n,i){const s=e.elements||(e.elements=[]);s.length=t.length;for(let o=0;o<t.length;o++){const a=t[o],r=a.properties,l=Kh(s,o,a.type,a.initProperties),c=n[a.optionScope].override(a);r.options=Zh(c),i.update(l,r)}}function Kh(e,t,n,i){const s=He[mr(n)];let o=e[t];return(!o||!(o instanceof s))&&(o=e[t]=new s,Object.assign(o,i)),o}function Zh(e){const t=He[mr(e.type)],n={};n.id=e.id,n.type=e.type,n.drawTime=e.drawTime,Object.assign(n,pr(e,t.defaults),pr(e,t.defaultRoutes));for(const i of gC)n[i]=e[i];return n}function pr(e,t){const n={};for(const i of Object.keys(t)){const s=t[i],o=e[i];fr(i)&&dt(o)?n[i]=o.map(a=>Xh(a,s)):n[i]=Xh(o,s)}return n}function wC(e,t,n,i){return t.$context||(t.$context=Object.assign(Object.create(e.getContext()),{element:t,get elements(){return n.filter(s=>s&&s.options)},id:i.id,type:"annotation"}))}function kC(e,t){const n=t.length,i=e.length;if(i<n){const s=n-i;e.splice(i,0,...new Array(s))}else i>n&&e.splice(n,i-n);return e}var TC="3.1.0";const $e=new Map,Qh=e=>e.type!=="doughnutLabel",SC=rr.concat(eo);var Jh={id:"annotation",version:TC,beforeRegister(){rD("chart.js","4.0",Xt.version)},afterRegister(){Xt.register(He)},afterUnregister(){Xt.unregister(He)},beforeInit(e){$e.set(e,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(e,t,n){const i=$e.get(e),s=i.annotations=[];let o=n.annotations;st(o)?Object.keys(o).forEach(a=>{const r=o[a];st(r)&&(r.id=a,s.push(r))}):dt(o)&&s.push(...o),VD(s.filter(Qh),e.scales)},afterDataLimits(e,t){const n=$e.get(e);UD(e,t.scale,n.annotations.filter(Qh).filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(e,t,n){const i=$e.get(e);LD(e,i,n),yC(e,i,n,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),zD(e,i,n)},beforeDatasetsDraw(e,t,n){Wi(e,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(e,t,n){Wi(e,"afterDatasetsDraw",n.clip)},beforeDatasetDraw(e,t,n){Wi(e,t.index,n.clip)},beforeDraw(e,t,n){Wi(e,"beforeDraw",n.clip)},afterDraw(e,t,n){Wi(e,"afterDraw",n.clip)},beforeEvent(e,t,n){const i=$e.get(e);ND(i,t.event,n)&&(t.changed=!0)},afterDestroy(e){$e.delete(e)},getAnnotations(e){const t=$e.get(e);return t?t.elements:[]},_getAnnotationElementsAtEventForMode(e,t,n){return er(e,t,n)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:e=>!SC.includes(e)&&e!=="init",annotations:{_allKeys:!1,_fallback:(e,t)=>`elements.${He[mr(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:fr,_fallback:!0},_indexable:fr}},additionalOptionScopes:[""]};function Wi(e,t,n){const{ctx:i,chartArea:s}=e,o=$e.get(e);n&&bi(i,s);const a=vC(o.visibleElements,t).sort((r,l)=>r.element.options.z-l.element.options.z);for(const r of a)MC(i,s,o,r);n&&_i(i)}function vC(e,t){const n=[];for(const i of e)if(i.options.drawTime===t&&n.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&n.push({element:s});return n}function MC(e,t,n,i){const s=i.element;i.main?(Lh(n,s,"beforeDraw"),s.draw(e,t),Lh(n,s,"afterDraw")):s.draw(e,t)}const DC={class:"zoom-timerange-container"},CC={class:"zoom-timerange-details"},OC={class:"label","data-testid":"zoom-timerange-from"},AC={class:"label","data-testid":"zoom-timerange-to"},PC=u.defineComponent({__name:"ZoomTimerange",props:{start:{},end:{},granularity:{}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.ref(zn({tickValue:t.start,granularity:t.granularity})),s=u.ref(zn({tickValue:t.end,granularity:t.granularity})),o=(a,r)=>{Nd(()=>{i.value=zn({tickValue:a,granularity:t.granularity}),s.value=zn({tickValue:r,granularity:t.granularity})},100)()};return u.watch(()=>[t.start,t.end],([a,r])=>{o(a,r)},{immediate:!0}),(a,r)=>(u.openBlock(),u.createElementBlock("div",DC,[u.createElementVNode("div",CC,[u.createElementVNode("div",OC,u.toDisplayString(u.unref(n).t("zoom_time_range.from")),1),u.createElementVNode("div",null,u.toDisplayString(i.value),1),u.createElementVNode("div",AC,u.toDisplayString(u.unref(n).t("zoom_time_range.to")),1),u.createElementVNode("div",null,u.toDisplayString(s.value),1)])]))}}),Pt=(e,t)=>{const n=e.__vccOpts||e;for(const[i,s]of t)n[i]=s;return n},tf=Pt(PC,[["__scopeId","data-v-4fa681cf"]]),EC={class:"zoom-actions-container"},RC={class:"zoom-actions-heading"},IC={class:"zoom-action-select"},LC=["data-testid"],NC=["aria-disabled","href"],BC=["onClick"],FC=Pt(u.defineComponent({__name:"ZoomActions",props:{zoomActionItems:{},newTimeRange:{},granularity:{}},emits:["onAction"],setup(e,{emit:t}){const n=e,i=t,s=o=>{o.action&&(o.action(n.newTimeRange),i("onAction"))};return(o,a)=>(u.openBlock(),u.createElementBlock("div",EC,[u.createElementVNode("div",RC,[u.createVNode(tf,{end:e.newTimeRange.end,granularity:e.granularity,start:e.newTimeRange.start},null,8,["end","granularity","start"]),u.createVNode(u.unref(Tt.CloseIcon),{class:"zoom-actions-close-icon",color:`var(--kui-color-text-neutral, ${u.unref(yl)})`,size:`var(--kui-icon-size-30, ${u.unref(Tn)})`,onClick:a[0]||(a[0]=r=>o.$emit("onAction"))},null,8,["color","size"])]),a[2]||(a[2]=u.createElementVNode("div",{class:"zoom-actions-heading-divider"},null,-1)),u.createElementVNode("div",IC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.zoomActionItems,r=>(u.openBlock(),u.createElementBlock("div",{key:r.key,class:u.normalizeClass(["zoom-action-item",{disabled:r.disabled}]),"data-testid":`zoom-action-item-${r.key}`},[r.href?(u.openBlock(),u.createElementBlock("a",{key:0,"aria-disabled":r.disabled,class:"zoom-action-link",href:r.href,onClick:a[1]||(a[1]=l=>o.$emit("onAction"))},u.toDisplayString(r.label),9,NC)):(u.openBlock(),u.createElementBlock("div",{key:1,onClick:l=>s(r)},u.toDisplayString(r.label),9,BC))],10,LC))),128))])]))}}),[["__scopeId","data-v-79ba72f8"]]),zC={key:2},UC={class:"tooltip-title"},VC={class:"title"},HC={key:0,class:"subtitle"},$C={class:"context"},YC={class:"metric"},WC={class:"tooltip"},jC={key:0,class:"square-marker marker-placeholder"},qC={class:"display-value"},ji=Pt(u.defineComponent({__name:"ChartTooltip",props:{state:{},tooltipTitle:{default:""},absoluteLeft:{default:"0px"},absoluteTop:{default:"0px"},zoomTimeRange:{default:void 0},zoomActionItems:{default:void 0},granularity:{default:void 0}},emits:["dimensions","onAction"],setup(e,{emit:t}){const n=t,i=e,s=u.ref(null),{x:o,y:a,isDragging:r}=LM(s,{initialValue:{x:parseFloat(i.absoluteLeft),y:parseFloat(i.absoluteTop)}}),l=u.computed(()=>`${a.value}px`),c=u.computed(()=>`${o.value}px`),d=u.computed(()=>i.state.tooltipContext),h=u.computed(()=>i.state.metricDisplay),f=u.computed(()=>["interactive","zoom-interactive"].includes(i.state.interactionMode));return u.watch(()=>[i.absoluteLeft,i.absoluteTop],([m,p])=>{r.value||(o.value=parseFloat(m),a.value=parseFloat(p))}),u.watch(r,m=>{m?document.body.classList.add("no-select"):document.body.classList.remove("no-select")}),u.watch(s,m=>{if(m){const{width:p,height:g}=m.getBoundingClientRect();n("dimensions",{width:p,height:g})}}),(m,p)=>e.state.showTooltip?(u.openBlock(),u.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:u.normalizeClass(["tooltip-container",{locked:e.state.interactionMode==="interactive"}]),style:u.normalizeStyle({transform:f.value?`translate(${c.value}, ${l.value})`:`translate(${e.absoluteLeft}, ${e.absoluteTop})`,left:"0",top:"0",pointerEvents:f.value?"all":"none"})},[e.state.interactionMode==="selecting-chart-area"&&e.granularity&&e.zoomTimeRange&&e.zoomTimeRange.end&&e.zoomTimeRange.start?(u.openBlock(),u.createBlock(tf,{key:0,end:e.zoomTimeRange?.end,granularity:e.granularity,start:e.zoomTimeRange?.start},null,8,["end","granularity","start"])):e.state.interactionMode==="zoom-interactive"&&e.zoomTimeRange&&e.zoomActionItems&&e.granularity?(u.openBlock(),u.createBlock(FC,{key:1,granularity:e.granularity,"new-time-range":e.zoomTimeRange,"zoom-action-items":e.zoomActionItems,onOnAction:p[0]||(p[0]=g=>n("onAction"))},null,8,["granularity","new-time-range","zoom-action-items"])):(u.openBlock(),u.createElementBlock("div",zC,[u.createElementVNode("div",UC,[u.createElementVNode("div",VC,[u.createElementVNode("div",null,u.toDisplayString(e.tooltipTitle),1),f.value?(u.openBlock(),u.createBlock(u.unref(Tt.DragIcon),{key:0,class:"drag-icon",color:`var(--kui-color-text-neutral, ${u.unref(yl)})`,size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["color","size"])):u.createCommentVNode("",!0)]),d.value||h.value?(u.openBlock(),u.createElementBlock("div",HC,[u.createElementVNode("div",$C,u.toDisplayString(d.value),1),u.createElementVNode("div",YC,u.toDisplayString(h.value),1)])):u.createCommentVNode("",!0)]),u.createElementVNode("ul",WC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.state.tooltipSeries,({backgroundColor:g,borderColor:y,label:_,value:x,isSegmentEmpty:T,isExtra:v},w)=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:_+w},[e.state.tooltipSeries.length?(u.openBlock(),u.createElementBlock("li",{key:0,class:u.normalizeClass({"extra-row":v})},[v?(u.openBlock(),u.createElementBlock("div",jC)):(u.openBlock(),u.createElementBlock("div",{key:1,class:"square-marker",style:u.normalizeStyle({background:String(g),borderColor:String(y)})},null,4)),u.createElementVNode("span",{class:u.normalizeClass(["display-label",{empty:T}])},u.toDisplayString(_),3),u.createElementVNode("span",qC,u.toDisplayString(x),1)],2)):u.createCommentVNode("",!0)],64))),128))])]))],6)):u.createCommentVNode("",!0)}}),[["__scopeId","data-v-fb2f2a72"]]),GC={key:0,class:"legend-container","data-testid":"legend"},XC=["onClick"],KC={key:0,"aria-hidden":"true",class:"line-marker",height:"2",width:"16"},ZC=["stroke","stroke-dasharray"],QC=["title"],JC={class:"label truncate-label"},tO={key:0,class:"sub-label"},eO={key:0},nO={class:"tooltip-content"},oo=Pt(u.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.inject("showLegendValues",!1),s=u.inject("legendPosition",u.ref(It.Bottom)),o=({datasetIndex:l,index:c,isKey:d},h)=>d?`key-${h}`:`dataset-${l??0}-${c??0}`,a=(l=0,c)=>{if(t.chartInstance===null)return;const d=t.chartInstance instanceof Xt?t.chartInstance:t.chartInstance.chart,h=r(l,c);!d.getDatasetMeta(l).dataset&&c!==void 0?d.toggleDataVisibility(c):h?d.hide(l,c):d.show(l,c),d.update()},r=(l=0,c)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const d=t.chartInstance instanceof Xt?t.chartInstance:t.chartInstance.chart;return d.getDatasetMeta(l).dataset||c===void 0?d.isDatasetVisible(l):d.getDataVisibility(c)};return(l,c)=>{const d=u.resolveComponent("KTooltip");return u.unref(s)!==u.unref(It).Hidden?(u.openBlock(),u.createElementBlock("ul",GC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.items,({fillStyle:h,strokeStyle:f,text:m,datasetIndex:p,index:g,value:y,isSegmentEmpty:_,isKey:x,lineDash:T},v)=>(u.openBlock(),u.createElementBlock("li",{key:o({datasetIndex:p,index:g,isKey:x},v),class:u.normalizeClass({"legend-key":x}),onClick:w=>x?void 0:a(p,g)},[T?.length?(u.openBlock(),u.createElementBlock("svg",KC,[u.createElementVNode("line",{stroke:f,"stroke-dasharray":T.join(" "),"stroke-width":"2",x1:"0",x2:"16",y1:"1",y2:"1"},null,8,ZC)])):(u.openBlock(),u.createElementBlock("div",{key:1,class:"square-marker",style:u.normalizeStyle({background:h,"border-color":f})},null,4)),u.createVNode(d,null,u.createSlots({default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["label-container",{"strike-through":!x&&!r(p,g),"inline-value":x}]),title:y&&(u.unref(i)||x)?`${m}: ${y.formatted}`:m},[u.createElementVNode("div",JC,u.toDisplayString(m),1),y&&(u.unref(i)||x)?(u.openBlock(),u.createElementBlock("div",tO,[x?(u.openBlock(),u.createElementBlock("span",eO,"-")):u.createCommentVNode("",!0),u.createTextVNode(" "+u.toDisplayString(y.formatted),1)])):u.createCommentVNode("",!0)],10,QC)]),_:2},[_?{name:"content",fn:u.withCtx(()=>[u.createElementVNode("div",nO,u.toDisplayString(u.unref(n).t("emptyEntityInfo")),1)]),key:"0"}:void 0]),1024)],10,XC))),128))])):u.createCommentVNode("",!0)}}}),[["__scopeId","data-v-90ef4d12"]]),Lt=[];for(let e=0;e<256;++e)Lt.push((e+256).toString(16).slice(1));function iO(e,t=0){return(Lt[e[t+0]]+Lt[e[t+1]]+Lt[e[t+2]]+Lt[e[t+3]]+"-"+Lt[e[t+4]]+Lt[e[t+5]]+"-"+Lt[e[t+6]]+Lt[e[t+7]]+"-"+Lt[e[t+8]]+Lt[e[t+9]]+"-"+Lt[e[t+10]]+Lt[e[t+11]]+Lt[e[t+12]]+Lt[e[t+13]]+Lt[e[t+14]]+Lt[e[t+15]]).toLowerCase()}const sO=new Uint8Array(16);function oO(){return crypto.getRandomValues(sO)}function gr(e,t,n){return crypto.randomUUID?crypto.randomUUID():aO(e)}function aO(e,t,n){e=e||{};const i=e.random??e.rng?.()??oO();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,iO(i)}const ef=(e,t)=>{const n=e.ctx,i=e.scales.y,s=e.scales.x,o=t[t.length-1].element;n.save(),n.strokeStyle="rgba(100, 100, 100, 1)",n.lineWidth=3,e.options.indexAxis==="x"?n.strokeRect(o.x-o.width/2,o.y,o.width,i.bottom-o.y):n.strokeRect(s.left,o.y-o.height/2,o.x-s.left,o.height),n.restore()};class nf{id="highlightPlugin";_clickedElements;_previousHoverOption;_clicked=!1;_pause=!1;_suppressNextClick=!1;afterDatasetsDraw(t){this._clickedElements&&this._clickedElements.length&&!this._pause&&ef(t,this._clickedElements)}afterEvent(t,{event:n}){if(n.type==="click"&&this._suppressNextClick){this._suppressNextClick=!1;return}if(n.type!=="click"||!n.native||this._pause)return;this._clicked=!this._clicked;const i=t.options.interaction?.mode||"index",s=t.getElementsAtEventForMode(n.native,i,{intersect:!1},!0);s.length&&this._clicked?(this._clickedElements=s,ef(t,this._clickedElements),this._previousHoverOption=t.options.hover,t.options.hover={mode:null}):(delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1)}beforeDestroy(t){delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1}pause(){this._pause=!0}get isPaused(){return this._pause}resume(t=!1){this._pause=!1,t&&(this._suppressNextClick=!0)}}const rO=(e,t,n,i,s="#0275d8")=>{e&&(e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore())};class ao{id="coordinator";coordinator=null;instanceId="";stopWatcher=void 0;activeDimension=null;activeDimensionValue=null;requiresUpdate=!1;triggerOnSelf=!1;watchTimestamp=!1;watchDimension=!1;lastMouseBrushEvent=0;constructor({coordinator:t,requiresUpdate:n=!1,triggerOnSelf:i=!1,watchTimestamp:s=!1,watchDimension:o=!1}){this.instanceId=crypto.randomUUID(),this.coordinator=t,this.requiresUpdate=n,this.triggerOnSelf=i,this.watchTimestamp=s,this.watchDimension=o}afterInit(t){if(!this.coordinator)return;const n=this.requiresUpdate?()=>t.update("none"):()=>t.draw(),i=this._watchTimestamp(n),s=this._watchDimension(n);this.stopWatcher=()=>{i&&i(),s&&s()}}afterEvent(t,{event:n}){this.coordinator&&(n.type==="mousemove"||n.type==="mouseout")&&requestAnimationFrame(i=>this._onMouseBrush(n.native,t,i))}beforeDatasetDraw(t,n){if(!this.coordinator||!this.watchDimension||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;t.config.type==="doughnut"?this._highlightDimensionDonut(t):this._highlightDimensionDefault(t,n)}afterDatasetsDraw(t){if(t.ctx.globalAlpha=1,!this.coordinator||!this.watchTimestamp||!this.coordinator.activeTimestamp.value||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;const i=t.scales.x.getPixelForValue(this.coordinator.activeTimestamp.value),s=t.ctx;rO(s,i,t.scales.y.top,t.scales.y.bottom)}beforeDestroy(){this.stopWatcher&&this.stopWatcher()}_watchTimestamp(t){if(!this.coordinator)return;let n;return this.watchTimestamp&&(n=u.watch([this.coordinator.activeChart,this.coordinator.activeTimestamp],([i])=>{(i!==this.instanceId||this.triggerOnSelf)&&t()})),n}_watchDimension(t){if(!this.coordinator)return;let n;if(this.watchDimension){let i;n=u.watch([this.coordinator.activeChart,this.coordinator.activeDimension,this.coordinator.activeDimensionValue],([s,o,a])=>{clearTimeout(i),o===null&&(this.activeDimension=null),a===null&&(this.activeDimensionValue=null),i=setTimeout(()=>{this.activeDimension=o,this.activeDimensionValue=a,(s!==this.instanceId||this.triggerOnSelf)&&t()},this.coordinator?.DIMENSION_DEBOUNCE_MS??400),u.onWatcherCleanup(()=>{clearTimeout(i)})})}return n}_onMouseBrush(t,n,i){if(!this.coordinator)return;const s=t.type,o=Math.min(this.coordinator.TIMESTAMP_DEBOUNCE_MS,this.coordinator.DIMENSION_DEBOUNCE_MS);if(!(s==="mousemove"&&i-this.lastMouseBrushEvent<o)){if(s==="mousemove"){if(!n.canvas)return;const a=this._getTimestamp(n,t),[r,l]=this._getDatasetDimension(n,t)??[];this.coordinator.activate({chartUuid:this.instanceId,timestamp:a,dimension:r,dimensionValue:l})}else s==="mouseout"&&this.coordinator.deactivate({chartUuid:this.instanceId});this.lastMouseBrushEvent=i}}_highlightDimensionDefault(t,n){if(this.activeDimension&&this.activeDimensionValue){const i=t.data.datasets.map((s,o)=>s?.dimension===this.activeDimension&&s?.dimensionValue===this.activeDimensionValue?o:-1).filter(s=>s>=0);i.length&&(t.ctx.globalAlpha=i.includes(n.index)?1:.3)}else t.ctx.globalAlpha=1}_highlightDimensionDonut(t){if(this.activeDimension&&this.activeDimensionValue){const{dimension:n,dimensionValue:i}=t.data.datasets[0];if(n===this.activeDimension){const s=i.findIndex(o=>o===this.activeDimensionValue);s>=0?t.setActiveElements([{datasetIndex:0,index:s}]):t.setActiveElements([])}else t.setActiveElements([])}else t.setActiveElements([])}_getDatasetDimension(t,n){const i=t.config.type,s=i!=="line",o=["doughnut","scatter"].includes(i)?"point":"dataset",a=t.getElementsAtEventForMode(n,o,{intersect:s},!1),[r]=a;if(!r)return;const{datasetIndex:l,index:c}=r,{dimension:d,dimensionValue:h}=t.data.datasets[l];return i==="doughnut"?[d,h[c]]:[d,h]}_getTimestamp(t,n){const[i]=t.getElementsAtEventForMode(n,"index",{intersect:!1},!1);if(i&&this.watchTimestamp){const{datasetIndex:s,index:o}=i,{x:a}=t.data.datasets[s].data[o];return a}}}const lO=["id"],cO=["id"],uO={class:"axis-tooltip-content"},dO="100%",hO="100%",fO=20,mO=20,sf=6,pO=0,gO=10,yO=10,bO=1,_O=Pt(u.defineComponent({__name:"StackedBarChart",props:{chartData:{},tooltipTitle:{default:""},legendValues:{default:void 0},metricUnit:{default:""},orientation:{default:"horizontal"},annotations:{type:Boolean,default:!0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},stacked:{type:Boolean,default:!0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""}},setup(e){const t=e,{i18n:n}=q.useI18n(),{translateUnit:i}=q.useTranslatedUnits(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=new nf,r=u.inject("analytics-dashboard-coordinator",null),l=new ao({coordinator:r,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),c=u.useTemplateRef("chartContainer"),d=u.useTemplateRef("chartParent"),h=({chart:F},nt)=>{const gt=F.data,ct=gt.labels?.indexOf(nt);return gt.datasets.reduce((at,Ct,B)=>{if(F.isDatasetVisible(B)){const U=Ct.data[ct];return isNaN(U)?at:at+U}else return at},0)},f=(F,nt,gt,ct)=>{const at=ct==="horizontal";nt===null&&(nt=n.t("entityNoName"));const Ct={type:"label",yValue:J=>at?nt:h(J,nt),xValue:J=>at?h(J,nt):nt},B={...Ct,position:at?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>at?0:-Math.abs(o1()),content:J=>zd(h(J,nt),gt)},U={...Ct,content:J=>r1(h(J,nt),a1(J.chart,F)),position:at?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:J=>at?s1(zd(h(J,nt),gt)):0,color:ZM};return{[`${nt}-value`]:B,[`${nt}-percent`]:U}},m=u.useTemplateRef("canvas"),p=u.useTemplateRef("axis"),g=gr(),y=gr(),_=u.ref([]),x=u.inject("legendPosition",It.Bottom),T=u.reactive({show:!1,top:"0px",left:"0px",text:"",offset:-50}),v=u.toRef(t,"metricUnit"),w=u.computed(()=>t.orientation==="horizontal"),M=u.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:u.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:u.toRef(t,"dimensionAxesTitle"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,interactionMode:"idle",chartType:w.value?"horizontal_bar":"vertical_bar",chartID:o,chartTooltipSortFn:t.chartTooltipSortFn}),{tooltipAbsoluteLeft:D,tooltipAbsoluteTop:P}=q.useTooltipAbsolutePosition(d,M),k=u.ref(0),S=()=>t.annotations&&t.chartData.labels?.reduce((F,nt)=>Object.assign(F,f(t.chartData,nt,v.value,t.orientation)),{}),A={id:g,afterUpdate(F){k.value+=1,_.value=La(F,t.legendValues,t.chartLegendSortFn)}},L={id:y,afterUpdate(F){F.options.plugins.annotation.annotations=t.annotations?S():{}}},H=[A,{id:"axisHover",afterEvent(F,nt){if(T.show=!1,nt.event.type==="mousemove"){const gt=nt.event,ct=F.options.indexAxis,at=F.scales,Ct=F.scales[ct].getLabelForValue(Number(F.scales[ct].getValueForPixel(gt[ct]))),U=F.scales[ct].getLabels().indexOf(Ct),J=t.chartData.isLabelEmpty?.[U];if((fe=>fe==="x"?gt.y>at.x.top:gt.x<at.y.right)(ct)){M.interactionMode!=="interactive"&&(M.showTooltip=!1);const fn=F.canvas.getContext("2d").measureText(Ct).width,Te=Math.abs(Math.round(gt.x-fn*.5)),mn=Math.round(gt.x+fn*.5),Wn=F.canvas.getBoundingClientRect(),lo=40;T.left=ct==="x"?`${(Te>0?Te:mn)-T.offset+Wn.left}px`:`${gt.x-fn*.5-T.offset+Wn.left}px`,T.top=`${gt.y-lo+Wn.top}px`,Ct.length>qs?(T.show=!0,T.text=Ct):J?(T.text=n.t("emptyEntityInfo"),T.show=!0):T.show=!1}else T.show=!1}}},a,l,...t.annotations?[L]:[]],W=u.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),$=u.ref(0),K=u.ref(0),lt=new ResizeObserver(Nd(F=>{$.value=F[0].contentRect.width,K.value=F[0].contentRect.height},100)),rt=u.computed(()=>{const F=t.chartData?.labels?.length;return m.value&&F&&!w.value?`${Math.max(F*(fO+sf),$.value)}px`:dO}),X=u.computed(()=>{const F=t.chartData?.labels?.length;return m.value&&F&&w.value?`${Math.max(F*(mO+sf),K.value)}px`:hO});q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey")),u.onMounted(()=>{t.annotations&&Xt.register(Jh),c.value&&($.value=c.value.offsetWidth,K.value=c.value.offsetHeight,lt.observe(c.value))}),u.onUnmounted(()=>{c.value&<.unobserve(c.value)});const z=u.computed(()=>{const F=q.useBarChartOptions({tooltipState:M,legendID:g,stacked:u.toRef(t,"stacked"),metricAxesTitle:u.toRef(t,"metricAxesTitle"),dimensionAxesTitle:u.toRef(t,"dimensionAxesTitle"),indexAxis:w.value?"y":"x",numLabels:W});return{...F.value,plugins:{...F.value.plugins,annotation:{annotations:S(),clip:!1}}}}),C=q.useChartJSCommon("bar",m,u.toRef(t,"chartData"),H,z);u.onBeforeUnmount(()=>{Xt.unregister(Jh)});const E={[It.Bottom]:"column"},N=u.computed(()=>{if(p.value&&C.value){const F=window.devicePixelRatio,nt=C.value,gt=nt.scales.y.width*F+bO,ct=(nt.scales.y.height+nt.scales.y.top+nt.scales.x.height)*F,at=p.value.getContext("2d");return at.scale(F,F),at.canvas.width=gt,at.canvas.height=ct,at.canvas.style.width=`${gt/F}px`,at.canvas.style.height=`${ct/F}px`,{scale:F,width:gt*F,height:ct*F,targetCtx:at}}return null}),V=F=>{const nt=F.target;if(N.value&&C.value&&!w.value){const gt=N.value.scale,ct=N.value.targetCtx,at=N.value.width,Ct=N.value.height,B=C.value,U=B.canvas;ct.fillStyle="white",nt.scrollLeft>=pO&&nt.scrollLeft<=gO?(ct.globalCompositeOperation="source-over",ct.clearRect(0,0,at,Ct),ct.drawImage(U,0,0,at,Ct,0,0,at,Ct),ct.globalCompositeOperation="destination-over",ct.fillRect(0,0,at,Ct)):(ct.globalCompositeOperation="source-over",ct.fillRect(0,(B.scales.y.height+B.scales.y.top+yO)*gt,at,B.scales.x.height*gt))}M.offsetY=nt.scrollTop,M.offsetX=nt.scrollLeft,T.offset=nt.scrollLeft},tt=({width:F,height:nt})=>{M.width=F,M.height=nt};u.watch(()=>t.orientation,()=>{if(p.value&&N.value){const F=N.value.width,nt=N.value.height;(p.value?.getContext("2d")).clearRect(0,0,F,nt)}M.showTooltip=!1,M.interactionMode="idle"}),u.watch(()=>t.annotations,F=>{C.value&&(F?C.value.options.plugins.annotation.annotations=S(t.chartData):delete C.value.options.plugins.annotation.annotations)});const Z=()=>{M.showTooltip&&(M.interactionMode!=="idle"?M.interactionMode="idle":M.interactionMode="interactive")};return(F,nt)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",E[u.unref(x)]])},[u.createElementVNode("canvas",{id:u.unref(s),ref:"axis",class:"axis"},null,8,lO),u.createElementVNode("div",{ref:"chartContainer",class:"chart-container",onClick:nt[0]||(nt[0]=gt=>Z()),onScroll:V},[u.createElementVNode("div",{class:"chart-body",style:u.normalizeStyle({width:rt.value,height:X.value})},[u.createElementVNode("canvas",{id:u.unref(o),ref:"canvas",class:"chart-canvas"},null,8,cO)],4)],544),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[T.show?(u.openBlock(),u.createElementBlock("div",{key:0,class:"axis-tooltip",style:u.normalizeStyle({top:T.top,left:T.left}),width:"auto"},[u.createElementVNode("div",uO,u.toDisplayString(T.text),1)],4)):u.createCommentVNode("",!0),u.createVNode(ji,{"absolute-left":u.unref(D),"absolute-top":u.unref(P),"chart-parent-ref":d.value,state:M,"tooltip-title":e.tooltipTitle,onDimensions:tt},null,8,["absolute-left","absolute-top","chart-parent-ref","state","tooltip-title"])])),u.createVNode(oo,{id:u.unref(g),"chart-instance":u.unref(C),items:_.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-6994dd8d"]]);const xO={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};iu._date.override({_id:"date-fns",formats:function(){return xO},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=et(e):n==="string"&&(typeof t=="string"?e=Hb(e,t,new Date,this.options):e=Wl(e,this.options)),Eo(e)?e.getTime():null},format:function(e,t){return rs(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Ao(e,t);case"second":return By(e,t);case"minute":return Ly(e,t);case"hour":return Ey(e,t);case"day":return os(e,t);case"week":return Fy(e,t);case"month":return Oo(e,t);case"quarter":return Ny(e,t);case"year":return zy(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return Ro(e,t);case"second":return qy(e,t);case"minute":return Yy(e,t);case"hour":return $y(e,t);case"day":return Tl(e,t);case"week":return Gy(e,t);case"month":return Dl(e,t);case"quarter":return jy(e,t);case"year":return Xy(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return jb(e);case"minute":return Wb(e);case"hour":return Yb(e);case"day":return Po(e);case"week":return ae(e);case"isoWeek":return ae(e,{weekStartsOn:+n});case"month":return Zy(e);case"quarter":return Ky(e);case"year":return Cl(e);default:return e}},endOf:function(e,t){switch(t){case"second":return i0(e);case"minute":return e0(e);case"hour":return Jy(e);case"day":return vl(e);case"week":return t0(e);case"month":return Ml(e);case"quarter":return n0(e);case"year":return Qy(e);default:return e}}});const of={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},wO={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...of,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},kO=u.version[0]==="2"?(e,t)=>Object.assign(e,{attrs:t}):(e,t)=>Object.assign(e,t);function Yn(e){return u.isProxy(e)?u.toRaw(e):e}function TO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e;return u.isProxy(t)?new Proxy(e,{}):e}function SO(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function af(e,t){e.labels=t}function rf(e,t,n){const i=[];e.datasets=t.map(s=>{const o=e.datasets.find(a=>a[n]===s[n]);return!o||!s.data||i.includes(o)?{...s}:(i.push(o),Object.assign(o,s),o)})}function vO(e,t){const n={labels:[],datasets:[]};return af(n,e.labels),rf(n,e.datasets,t),n}const MO=u.defineComponent({props:wO,setup(e,t){let{expose:n,slots:i}=t;const s=u.ref(null),o=u.shallowRef(null);n({chart:o});const a=()=>{if(!s.value)return;const{type:c,data:d,options:h,plugins:f,datasetIdKey:m}=e,p=vO(d,m),g=TO(p,d);o.value=new Xt(s.value,{type:c,data:g,options:{...h},plugins:f})},r=()=>{const c=u.toRaw(o.value);c&&(e.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},e.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(e.updateMode)};return u.onMounted(a),u.onUnmounted(r),u.watch([()=>e.options,()=>e.data],(c,d)=>{let[h,f]=c,[m,p]=d;const g=u.toRaw(o.value);if(!g)return;let y=!1;if(h){const _=Yn(h),x=Yn(m);_&&_!==x&&(SO(g,_),y=!0)}if(f){const _=Yn(f.labels),x=Yn(p.labels),T=Yn(f.datasets),v=Yn(p.datasets);_!==x&&(af(g.config.data,_),y=!0),T&&T!==v&&(rf(g.config.data,T,e.datasetIdKey),y=!0)}y&&u.nextTick(()=>{l(g)})},{deep:!0}),()=>u.h("canvas",{role:"img","aria-label":e.ariaLabel,"aria-describedby":e.ariaDescribedby,ref:s},[u.h("p",{},[i.default?i.default():""])])}});function ro(e,t){return Xt.register(t),u.defineComponent({props:of,setup(n,i){let{expose:s}=i;const o=u.shallowRef(null),a=u.shallowRef(null);u.watch(()=>a.value?.chart??null,l=>{o.value=l},{flush:"sync"}),s({chart:o});const r=l=>{a.value=l};return()=>u.h(MO,kO({ref:r},{type:e,...n}))}})}const lf=ro("bar",Jc),cf=ro("doughnut",ki),uf=ro("line",tu),DO=ro("scatter",nu),CO={class:"chart-container"},OO={key:0,class:"chart-center-metric"},AO={class:"chart-center-total"},PO={key:0,class:"chart-center-unit"},EO=u.defineComponent({__name:"DonutChart",props:{chartData:{},tooltipTitle:{},metricUnit:{default:""},metricName:{default:""},legendPosition:{default:It.Bottom},legendValues:{default:void 0},syntheticsDataKey:{default:""},tooltipDimensionDisplay:{default:""},tooltipMetricDisplay:{default:""},showCenterMetric:{type:Boolean,default:!0}},setup(e){const t=e,{translateUnit:n}=q.useTranslatedUnits(),{i18n:i}=q.useI18n(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=u.ref([]),r=u.useTemplateRef("chartParent"),l=u.inject(Oa,null),c=new ao({coordinator:l,requiresUpdate:!0,triggerOnSelf:!1,watchTimestamp:!1,watchDimension:!0}),d=u.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:u.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:u.toRef(t,"tooltipDimensionDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:n,offsetX:0,offsetY:0,width:0,height:0,chartID:o,chartType:"donut",interactionMode:"idle"}),{tooltipAbsoluteLeft:h,tooltipAbsoluteTop:f}=q.useTooltipAbsolutePosition(r,d),m={id:s,afterUpdate(k){a.value=k.options.plugins.legend.labels.generateLabels(k).map(S=>({...S,value:t.legendValues&&t.legendValues[S.text],hidden:!1}))}},p=u.computed(()=>[c,m]),g=u.computed(()=>[t.chartData.datasets.reduce((S,A)=>(S.dimension=A.dimension,S.dimensionValue.push(A.dimensionValue),S.labels.push(A.label),S.backgroundColor.push(A.backgroundColor),S.hoverBorderColor.push(xs(A.backgroundColor).saturate(.5).darken(.15).hexString()),S.data.push(A.data.reduce((L,R)=>L+R,0)),S),{dimension:"",dimensionValue:[],labels:[],backgroundColor:[],borderColor:"#ffffff",borderWidth:1,hoverBorderColor:[],hoverBorderWidth:1,data:[],hoverOffset:10})]),{formatUnit:y}=oe({i18n:i}),_=u.computed(()=>W1(t.metricName??"")),x=u.computed(()=>{const k=g.value[0]?.data.reduce((S,A)=>S+A,0)??0;return y(k,t.metricUnit,{approximate:!0,translateUnit:(S,A)=>n(S,A)}).trim()}),T=u.computed(()=>t.tooltipMetricDisplay||""),v=u.computed(()=>({...t.chartData,datasets:g.value}));q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const{options:w}=q.useDonutChartOptions({tooltipState:d,legendID:s}),M=u.ref(),D=k=>({[It.Bottom]:"column",[It.Hidden]:"hidden"})[k],P=({width:k,height:S})=>{d.width=k,d.height=S};return(k,S)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",D(e.legendPosition)]),"data-testid":"donut-chart-parent"},[u.createElementVNode("div",CO,[u.createVNode(u.unref(cf),{ref_key:"chartInstance",ref:M,"chart-id":u.unref(o),data:v.value,options:u.unref(w),plugins:p.value},null,8,["chart-id","data","options","plugins"]),e.showCenterMetric&&_.value?(u.openBlock(),u.createElementBlock("div",OO,[u.createElementVNode("span",AO,u.toDisplayString(x.value),1),T.value?(u.openBlock(),u.createElementBlock("span",PO,u.toDisplayString(T.value),1)):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[u.createVNode(ji,{"absolute-left":u.unref(h),"absolute-top":u.unref(f),state:d,"tooltip-title":e.tooltipTitle,unit:e.metricUnit,onDimensions:P},null,8,["absolute-left","absolute-top","state","tooltip-title","unit"])]))]),u.createVNode(oo,{id:u.unref(s),"chart-instance":M.value,items:a.value,position:e.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),RO=Pt(EO,[["__scopeId","data-v-db23aff8"]]);class IO{id="outlierBandPlugin";beforeDatasetsDraw(t,n,i){const s=i?.value;if(s===void 0||!Number.isFinite(s)||!i?.color)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,d=Math.min(Math.max(o.getPixelForValue(s),a),r);if(d<=a)return;const h=t.ctx;h.save(),h.fillStyle=i.color,h.fillRect(l,a,c-l,d-a),h.restore()}}const LO=1.5;class NO{id="referenceLinePlugin";afterDatasetsDraw(t,n,i){const s=i?.lines;if(!s?.length)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,d=t.ctx;d.save(),d.lineWidth=LO;for(const{value:h,color:f,borderDash:m}of s){if(!Number.isFinite(h))continue;const p=o.getPixelForValue(h);p<a||p>r||(d.beginPath(),d.setLineDash(m),d.strokeStyle=f,d.moveTo(l,p),d.lineTo(c,p),d.stroke())}d.restore()}}const BO={class:"chart-container"},FO=Pt(u.defineComponent({__name:"ScatterChart",props:{chartData:{default:void 0},tooltipTitle:{},metricUnit:{default:""},xMetric:{default:void 0},xMetricUnit:{default:void 0},granularity:{},timeRangeMs:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:()=>0},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""},shadeOutlierRegion:{type:Boolean,default:!1},themeColors:{default:()=>Ja()}},setup(e){const t=e,n=u.inject("legendPosition",It.Bottom),{i18n:i}=q.useI18n(),{formatUnit:s}=oe({i18n:i}),{translateUnit:o}=q.useTranslatedUnits(),a=u.useTemplateRef("chartParent"),r=new IO,l=new NO,c=crypto.randomUUID(),d=crypto.randomUUID(),h=u.inject(Oa,null),f=new ao({coordinator:h,requiresUpdate:!0,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),m=u.ref(),p=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:u.toRef(t,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:o,offsetX:0,offsetY:0,width:0,height:0,chartType:"scatter",chartID:d,chartTooltipSortFn:t.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:g,tooltipAbsoluteTop:y}=q.useTooltipAbsolutePosition(a,p);q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const _=u.computed(()=>t.chartData?.outlier),x=u.computed(()=>t.chartData?.referenceLines??[]),T=u.ref([]),v={id:c,afterUpdate(L){T.value=La(L,void 0,t.chartLegendSortFn)}},w=u.computed(()=>{const L=[];_.value&&L.push({text:_.value.label,fillStyle:_.value.color,strokeStyle:_.value.color,isKey:!0});for(const R of x.value)L.push({text:R.label,fillStyle:R.color,strokeStyle:R.color,lineDash:R.borderDash,isKey:!0,value:{raw:R.value,formatted:s(R.value,t.metricUnit,{translateUnit:o})}});return L}),M=u.computed(()=>[...T.value,...w.value]),D=u.computed(()=>t.shadeOutlierRegion?_.value?.value:void 0),P=u.computed(()=>[f,v,...D.value!==void 0?[r]:[],...x.value.length?[l]:[]]),k=u.computed(()=>`scatter-${P.value.map(L=>L.id).join("-")}`),{options:S}=q.useScatterChartOptions({tooltipState:p,legendID:c,granularity:u.toRef(t,"granularity"),timeRangeMs:u.toRef(t,"timeRangeMs"),metricAxesTitle:u.toRef(t,"metricAxesTitle"),dimensionAxesTitle:u.toRef(t,"dimensionAxesTitle"),metricUnit:u.toRef(t,"metricUnit"),xMetric:u.toRef(t,"xMetric"),xMetricUnit:u.toRef(t,"xMetricUnit"),outlierValue:D,referenceLines:x,themeColors:u.toRef(t,"themeColors")}),A=L=>({[It.Bottom]:"column",[It.Hidden]:"hidden"})[L];return(L,R)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",A(u.unref(n))]),"data-testid":"scatter-chart-parent"},[u.createElementVNode("div",BO,[(u.openBlock(),u.createBlock(u.unref(DO),{key:k.value,ref_key:"chartInstance",ref:m,"chart-id":u.unref(d),class:"chart-canvas",data:e.chartData,"data-testid":"scatter-chart",options:u.unref(S),plugins:P.value},null,8,["chart-id","data","options","plugins"]))]),u.createVNode(ji,{"absolute-left":u.unref(g),"absolute-top":u.unref(y),"data-testid":"tooltip",granularity:e.granularity,state:p,"tooltip-title":e.tooltipTitle},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title"]),u.createVNode(oo,{id:u.unref(c),"chart-instance":m.value,"data-testid":"legend",items:M.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-a001076d"]]),yr=(e,t,n,i,s="#0275d8")=>{e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore()},jt={},zO=()=>{jt.x=void 0,jt.chart=void 0,jt.strategy=void 0,jt.group=void 0},UO=10;class df{id="verticalLinePlugin";_clickedSegment;_pause=!1;_useBrushingState=!1;_brushStrategy;_brushGroup;constructor({brushGroup:t=void 0,brushStrategy:n=void 0,enableBrushing:i=!1}={}){let s=!1;n==="group"&&(s=t!==void 0),this._useBrushingState=i&&s,this._brushStrategy=n,this._brushGroup=t}afterEvent(t,n){if(!this._useBrushingState)return;const{event:i}=n;(i.type==="mousemove"||i.type==="mouseout")&&requestAnimationFrame(s=>this.onMouseBrush(i.type,t,s))}_lastMouseBrushEvent=0;onMouseBrush(t,n,i){if(t==="mousemove"&&i-this._lastMouseBrushEvent<UO)return;const s=()=>{jt.chart=n,jt.strategy=this._brushStrategy,jt.group=this._brushGroup;for(const o of Object.values(Xt.instances))o!==n&&o.update("none")};t==="mousemove"?n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&(jt.x=n.tooltip.dataPoints[0].element.x,s()):t==="mouseout"&&(jt.x=void 0,s()),this._lastMouseBrushEvent=i}afterDatasetsDraw(t){if(this.isPaused)return;const n=t.tooltip&&t.tooltip.getActiveElements()&&t.tooltip.getActiveElements().length,i=t.ctx;if(this._clickedSegment){const{x:s}=this._clickedSegment.element;yr(i,s,t.scales.y.top,t.scales.y.bottom)}else if(this._useBrushingState)this.drawByBrush(t);else if(n){const{x:s}=t.tooltip.dataPoints[0].element;yr(i,s,t.scales.y.top,t.scales.y.bottom)}}drawByBrush(t){if(jt.x===void 0)return;const n=jt.chart===t?"#0275d8":"rgba(2, 117, 216, 0.3)";this._brushStrategy==="group"&&jt.group===this._brushGroup&&yr(t.ctx,jt.x,t.scales.y.top,t.scales.y.bottom,n)}pause(){this._pause=!0}resume(){this._pause=!1}get isPaused(){return this._pause}set clickedSegment(t){this._clickedSegment=t}get clickedSegment(){return this._clickedSegment}destroyClickedSegment(){delete this._clickedSegment}beforeDestroy(t){if(this._clickedSegment&&this.destroyClickedSegment(),this._useBrushingState&&jt.chart===t){const n=jt.x!==void 0;if(zO(),n)for(const i of Object.values(Xt.instances))i!==t&&i.update("none")}}}const VO=(e,t,n)=>{const i=e.ctx;i.save(),i.strokeStyle="rgba(95, 154, 255, 1)",i.lineWidth=2,i.beginPath(),i.moveTo(t,e.chartArea.top),i.lineTo(t,e.chartArea.bottom),i.moveTo(n,e.chartArea.top),i.lineTo(n,e.chartArea.bottom),i.stroke(),i.restore()},HO=(e,t,n)=>{const i=e.ctx;i.save(),i.fillStyle="rgba(143, 193, 255, 0.3)",i.fillRect(t,e.chartArea.top,n-t,e.chartArea.bottom-e.chartArea.top),i.restore()},hf=(e,t)=>{const n=e.scales.x.getValueForPixel(t.startX),i=e.scales.x.getValueForPixel(t.endX);if(!(n===void 0||i===void 0))return{xStart:Math.min(n,i),xEnd:Math.max(n,i)}},ff=(e,t,n)=>{t.canvas.dispatchEvent(new CustomEvent(e,{detail:n}))};class $O{id="dragSelectPlugin";_isDragging=!1;_startX=0;_endX=0;_dragTimeout;_clearSelectionArea=!0;_chart=null;_dragSelectHandlers;get startX(){return this._startX}get endX(){return this._endX}beforeInit(t){this._chart=t;const n=t.canvas;let i=!1;const s=r=>{this._dragTimeout=window.setTimeout(()=>{const l=n.getBoundingClientRect();this._isDragging=!0,this._clearSelectionArea=!1,i=!0,this._startX=r.clientX-l.left,this._endX=this._startX},150)},o=r=>{const l=n.getBoundingClientRect();if(i&&this._isDragging){this._endX=r.clientX-l.left;const c=hf(t,this);c&&ff("dragSelectMove",t,c)}},a=r=>{const l=n.getBoundingClientRect();if(clearTimeout(this._dragTimeout),i&&this._isDragging){this._endX=r.clientX-l.left,i=!1,this._isDragging=!1;const c=hf(t,this);c?ff("dragSelect",t,c):this.clearSelectionArea()}};n.addEventListener("mousedown",s),n.addEventListener("mousemove",o),n.addEventListener("mouseup",a),this._dragSelectHandlers={onMouseDown:s,onMouseMove:o,onMouseUp:a}}beforeDestroy(t){const n=t.canvas;if(this._dragSelectHandlers){const{onMouseDown:i,onMouseMove:s,onMouseUp:o}=this._dragSelectHandlers;n.removeEventListener("mousedown",i),n.removeEventListener("mousemove",s),n.removeEventListener("mouseup",o)}this._isDragging=!1,this._dragTimeout&&clearTimeout(this._dragTimeout)}afterDatasetsDraw(t){(this._isDragging||!this._clearSelectionArea)&&(HO(t,this._startX,this._endX),VO(t,this._startX,this._endX))}clearSelectionArea(){this._clearSelectionArea=!0,this._chart&&this._chart.update()}}const YO=20,WO="rgba(255, 171, 171, 0.4)",jO="rgba(255, 196, 0, 0.2)",mf=(e,t,n)=>{const i=t.y-e.y;if(i===0)return t.x;const s=(n-e.y)/i;return e.x+s*(t.x-e.x)},pf=e=>"yAxisID"in e&&e.yAxisID||Gs,gf=(e,t)=>{const n=e.data.datasets.find(i=>i.rawMetric===t);return n?pf(n):Gs},qO=(e,t,n=Gs)=>{const i=[];return e.data.datasets.forEach(s=>{if(!e.getDatasetMeta(e.data.datasets.indexOf(s)).visible||pf(s)!==n)return;const a=s.data;a?.length&&t.filter(r=>r.highlightIntersections).forEach(r=>{const l=a.map(d=>({ts:d.x,aboveThreshold:d.y>=r.value}));let c=l[0].aboveThreshold?a[0].x:void 0;for(let d=1;d<l.length;d++)!l[d-1].aboveThreshold&&l[d].aboveThreshold?c=mf(a[d-1],a[d],r.value):l[d-1].aboveThreshold&&!l[d].aboveThreshold&&c!==void 0&&(i.push({start:c,end:mf(a[d-1],a[d],r.value),type:r.type}),c=void 0);c!==void 0&&i.push({start:c,end:l[l.length-1].ts,type:r.type})})}),i},GO=e=>{if(!e.length)return[];e.sort((n,i)=>n.type.localeCompare(i.type)||n.start-i.start);const t=[];for(const n of e){const i=t.findLast(({type:s})=>s===n.type);i&&n.start<=i.end?i.end=Math.max(i.end,n.end):t.push({...n})}return t};class XO{constructor(t){this.i18n=t}i18n;id="thresholdPlugin";_thresholds;_mouseMoveHandler;_syncThresholds(t){for(const n of Object.keys(t.threshold||{})){const i=t.threshold?.[n];i&&(this._thresholds={...this._thresholds,[n]:i.map(s=>({...s,hovered:!1}))})}if(this._thresholds)for(const n of Object.keys(this._thresholds))t.threshold?.[n]||delete this._thresholds[n]}get thresholds(){return this._thresholds}beforeUpdate(t,n,i){this._syncThresholds(i)}beforeInit(t,n,i){const s=t.canvas;this._syncThresholds(i);const o=a=>{if(t){const r=a.clientY,l=s.getBoundingClientRect();for(const c of Object.keys(this._thresholds||{})){const h=(t.scales[gf(t,c)]??t.scales.y).getValueForPixel(r-l.top);if(h){const f=this._thresholds?.[c];f&&f.forEach(m=>{m.hovered=Math.abs(m.value-h)<YO})}}}};s.addEventListener("mousemove",o),this._mouseMoveHandler=o}afterDatasetsDraw(t,n){const i=t.ctx;for(const s of Object.keys(this._thresholds||{})){const o=this._thresholds?.[s];if(o){const a=gf(t,s),r=t.scales[a]??t.scales.y;o.forEach(d=>{const h=r.getPixelForValue(d.value);i.save(),i.beginPath(),i.moveTo(t.chartArea.left,h),i.lineTo(t.chartArea.right,h),i.lineWidth=1,i.strokeStyle=za(d.type),i.setLineDash([5,5]),i.stroke(),i.restore();let f="";d.label?f=`${d.label}: ${d.value}`:d.type==="warning"?f=this.i18n.t("chartLabels.threshold-warning",{value:d.value}):d.type==="error"?f=this.i18n.t("chartLabels.threshold-error",{value:d.value}):f=this.i18n.t("chartLabels.thatreshold-neutral",{value:d.value}),d.hovered&&(i.save(),i.fillStyle=za(d.type),i.font=ug,i.fillText(f,t.chartArea.left,h-4),i.restore())});const l=qO(t,o,a);GO(l).forEach(d=>{const h=t.scales.x.getPixelForValue(d.start),f=t.scales.x.getPixelForValue(d.end);i.save(),i.fillStyle=d.type==="error"?WO:jO,i.fillRect(h,t.chartArea.top,f-h,t.chartArea.bottom-t.chartArea.top),i.restore(),i.save(),i.beginPath(),i.moveTo(h,t.chartArea.bottom),i.lineTo(f,t.chartArea.bottom),i.lineWidth=2,i.strokeStyle=za(d.type),i.stroke(),i.restore()})}}}beforeDestroy(t){this._mouseMoveHandler&&t.canvas.removeEventListener("mousemove",this._mouseMoveHandler)}}const KO=Pt(u.defineComponent({__name:"TimeSeriesChart",props:{chartData:{default:void 0},type:{default:"timeseries_line"},fill:{type:Boolean,default:!1},tooltipTitle:{},metricUnit:{default:""},timeRangeMs:{default:void 0},granularity:{},stacked:{type:Boolean,default:!0},legendValues:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},brush:{type:Boolean,default:!1},zoomActionItems:{default:void 0},tooltipMetricDisplay:{default:""},threshold:{default:void 0},leftYAxisGrid:{type:Boolean,default:void 0},rightYAxis:{default:void 0}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=e,i=t,{i18n:s}=q.useI18n(),o=new df,a=new nf,r=new $O,l=new XO(s),{translateUnit:c}=q.useTranslatedUnits(),d=u.ref(),h=crypto.randomUUID(),f=crypto.randomUUID(),m=u.ref([]),p=u.inject("legendPosition",It.Bottom),g=u.useTemplateRef("chartParent"),y=u.ref(void 0),_=u.ref(!1),x=u.inject(Oa,null),T=new ao({coordinator:x,triggerOnSelf:!0,watchTimestamp:!0,watchDimension:!0}),v=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:u.toRef(n,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(n,"metricUnit"),translateUnit:c,offsetX:0,offsetY:0,width:0,height:0,chartType:n.type,chartID:f,chartTooltipSortFn:n.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:w,tooltipAbsoluteTop:M}=q.useTooltipAbsolutePosition(g,v),D={id:h,afterUpdate(E){m.value=La(E,n.legendValues,n.chartLegendSortFn)}},P=u.computed(()=>[T,D,a,...n.brush?[r]:[],...n.type==="timeseries_line"?[o]:[],...n.threshold?[l]:[]]),k=u.computed(()=>`line-${P.value.map(E=>E.id).join("-")}`),S=u.computed(()=>`bar-${P.value.map(E=>E.id).join("-")}`),A=u.computed(()=>n.chartData&&GM(n.chartData)),{options:L}=q.useLineChartOptions({tooltipState:v,timeRangeMs:u.toRef(n,"timeRangeMs"),granularity:u.toRef(n,"granularity"),legendID:h,stacked:u.toRef(n,"stacked"),metricAxesTitle:u.toRef(n,"metricAxesTitle"),dimensionAxesTitle:u.toRef(n,"dimensionAxesTitle"),pointsWithoutHover:A,threshold:u.toRef(n,"threshold"),leftYAxisGrid:u.toRef(n,"leftYAxisGrid"),rightYAxis:u.toRef(n,"rightYAxis")});q.useReportChartDataForSynthetics(u.toRef(n,"chartData"),u.toRef(n,"syntheticsDataKey"));const R=E=>E?E.end.getTime()>E.start.getTime():!1,H=E=>({[It.Bottom]:"column",[It.Hidden]:"hidden"})[E],W=({width:E,height:N})=>{v.width=E,v.height=N},$=(E=!0)=>{v.interactionMode="idle",v.showTooltip=!1,r.clearSelectionArea(),a.isPaused&&a.resume(E),o.isPaused&&o.resume()},K=()=>{v.interactionMode="interactive"},lt=()=>{!d.value||!d.value.chart.tooltip?.dataPoints?.length||(v.interactionMode==="interactive"?o.clickedSegment=d.value.chart.tooltip.dataPoints[0]:o.destroyClickedSegment())},rt=()=>{if(_.value){_.value=!1;return}v.interactionMode!=="idle"?$():K(),lt()};u.watch(()=>n.type,()=>{v.interactionMode="idle",v.showTooltip=!1,o.destroyClickedSegment()});const X=E=>{E.preventDefault(),E.stopPropagation();const{xStart:N,xEnd:V}=E.detail,tt={start:new Date(N),end:new Date(V),type:"absolute"};if(!R(tt)){y.value=void 0,$(!1);return}y.value=tt,v.interactionMode="zoom-interactive",tt&&i("select-chart-range",tt)},z=E=>{v.interactionMode="selecting-chart-area",_.value=!0,o.pause(),a.pause();const{xStart:N,xEnd:V}=E.detail;y.value={start:new Date(N),end:new Date(V),type:"absolute"}},C=E=>{if(!g.value||v.interactionMode==="idle")return;const N=E.target;N&&g.value.contains(N)||_.value||$(!1)};return u.watch(()=>d.value?.chart,()=>{d.value?.chart&&(d.value.chart.canvas.removeEventListener("dragSelect",X),d.value.chart.canvas.removeEventListener("dragSelectMove",z),d.value.chart.canvas.addEventListener("dragSelect",X),d.value.chart.canvas.addEventListener("dragSelectMove",z))}),u.onMounted(()=>{document.addEventListener("click",C,!0)}),u.onUnmounted(()=>{d.value?.chart&&(d.value.chart.canvas.removeEventListener("dragSelect",X),d.value.chart.canvas.removeEventListener("dragSelectMove",z)),document.removeEventListener("click",C,!0)}),(E,N)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",H(u.unref(p))]),"data-testid":"line-chart-parent"},[u.createElementVNode("div",{class:"chart-container",onClick:N[0]||(N[0]=V=>rt())},[e.type==="timeseries_line"?(u.openBlock(),u.createBlock(u.unref(uf),{key:k.value,ref_key:"chartInstance",ref:d,"chart-id":u.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-line-chart",options:u.unref(L),plugins:P.value},null,8,["chart-id","data","options","plugins"])):e.type==="timeseries_bar"?(u.openBlock(),u.createBlock(u.unref(lf),{key:S.value,ref_key:"chartInstance",ref:d,"chart-id":u.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-bar-chart",options:u.unref(L),plugins:P.value},null,8,["chart-id","data","options","plugins"])):u.createCommentVNode("",!0)]),u.createVNode(ji,{"absolute-left":u.unref(w),"absolute-top":u.unref(M),"data-testid":"tooltip",granularity:e.granularity,state:v,"tooltip-title":e.tooltipTitle,"zoom-action-items":e.zoomActionItems,"zoom-time-range":y.value,onDimensions:W,onOnAction:N[1]||(N[1]=()=>$(!1))},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title","zoom-action-items","zoom-time-range"]),u.createVNode(oo,{id:u.unref(h),"chart-instance":d.value,"data-testid":"legend",items:m.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-344d87c4"]]),ZO={key:0,class:"chart-truncation-warning","data-testid":"truncation-warning"},QO={class:"tooltip-content"},JO={key:2,class:"analytics-chart-parent"},tA=u.defineComponent({__name:"AnalyticsChart",props:{chartData:{},chartOptions:{},activeMetric:{default:void 0},tooltipTitle:{default:""},emptyStateTitle:{default:""},emptyStateDescription:{default:""},legendPosition:{default:It.Bottom},syntheticsDataKey:{default:""},showLegendValues:{type:Boolean,default:!1},showAnnotations:{type:Boolean,default:!0},timeseriesZoom:{type:Boolean,default:!1},requestsLink:{default:void 0},exploreLink:{default:void 0}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=t,i=e,{i18n:s}=q.useI18n(),o=u.computed(()=>tr(i.chartData)?void 0:i.chartData),a=u.computed(()=>{const B=i.chartOptions.metricAxisMap,U=o.value?.meta?.metric_names??[];if(!(i.chartOptions.type!=="timeseries_line"||!B||!U.some(J=>B[J]==="right")))return B}),r=u.computed(()=>!!a.value),l=(B,U)=>a.value?B.filter(J=>(a.value?.[J]??"left")===U):B,c=u.computed(()=>{const B=o.value?.meta,U=B?.metric_names??[];return["timeseries_line","timeseries_bar"].includes(i.chartOptions.type)&&!r.value&&U.length>1&&Object.keys(B?.display??{}).length>0?U:[]}),d=u.computed(()=>c.value.length>1),h=u.computed(()=>i.activeMetric&&c.value.includes(i.activeMetric)?i.activeMetric:c.value[0]),f=u.computed(()=>{const B=o.value;return!B||!d.value||!h.value?B:{...B,meta:{...B.meta,metric_names:[h.value]}}}),m=u.computed(()=>{const B=i.chartOptions.threshold;return!d.value||!B?B:{...B,...Object.fromEntries(Object.keys(B).filter(U=>U!==h.value).map(U=>[U,[]]))}}),p=u.computed(()=>{if($.value)return tr(i.chartData)?i.chartData:oh(i.chartData)}),g=u.inject("app:konnectColorMode",u.computed(()=>"light")),y=u.useTemplateRef("chartShell"),_=u.computed(()=>(g.value,Ja(y.value))),x=u.computed(()=>{if(p.value){const{start:U,end:J,metric:$t,metricUnit:fe,truncated:fn,limit:Te,datasource:mn}=p.value;return{start:U,end:J,metricNames:[$t],metricUnits:{[$t]:fe??""},truncated:fn,limit:Te,datasource:mn}}const B=f.value?.meta;return{start:B?.start,end:B?.end,metricNames:B?.metric_names,metricUnits:B?.metric_units,truncated:B?.truncated,limit:B?.limit,datasource:B?.datasource}}),T=u.computed(()=>$.value?q.useScatterDatasets({colorPalette:i.chartOptions.chartDatasetColors,scatter:i.chartOptions.scatter,themeColors:_},p).value:o.value?H.value?q.useExploreResultToTimeDataset({fill:i.chartOptions.stacked,colorPalette:i.chartOptions.chartDatasetColors||Va,metricAxisMap:a.value},f).value:q.useExploreResultToDatasets({fill:i.chartOptions.stacked,colorPalette:i.chartOptions.chartDatasetColors||Va},o).value:{datasets:[]}),v=u.computed(()=>i.timeseriesZoom||!!i.exploreLink||!!i.requestsLink),w=u.computed(()=>{if(!i.chartData||o.value&&!o.value.meta)return 0;const{start:B,end:U}=x.value;if(B&&U)return new Date(U).getTime()-new Date(B).getTime()}),M=u.computed(()=>x.value.metricUnits?d.value&&h.value?x.value.metricUnits[h.value]??"":Object.values(x.value.metricUnits)[0]??"":""),D=u.computed(()=>x.value.metricUnits?d.value&&h.value?h.value:Object.keys(x.value.metricUnits)[0]??"":""),P=u.computed(()=>i.showLegendValues&&i.legendPosition!==It.Hidden),{legendValues:k}=q.useChartLegendValues(T,i.chartOptions.type,M),S=u.computed(()=>x.value.limit?.toString()||null),A=u.computed(()=>i.chartOptions.hideTruncationWarning?!1:x.value.truncated||!1),L=u.computed(()=>s.t("limitedResultsShown",{maxReturned:S.value})),R=u.computed(()=>["vertical_bar","horizontal_bar"].includes(i.chartOptions.type)),H=u.computed(()=>["timeseries_bar","timeseries_line"].some(B=>B===i.chartOptions.type)),W=u.computed(()=>i.chartOptions.type==="donut"),$=u.computed(()=>i.chartOptions.type==="scatter"),K=u.computed(()=>i.chartOptions.type.includes("vertical")?"vertical":"horizontal"),lt=u.computed(()=>{const{metricNames:B,metricUnits:U}=x.value;if(r.value||!B||!U)return;const J=B[0],$t=U[J]||"";if(B.length>1){if(J.includes("latency"))return s.t("metricAxisTitles.latency_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})});if(J.includes("size"))return s.t("metricAxisTitles.size_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})})}if(J)return zi($t)&&s.te(`metricAxisTitles.${J}`)?s.t(`metricAxisTitles.${J}`)||void 0:s.te(`chartLabels.${J}`)?s.t(`chartLabels.${J}`):J}),rt=u.computed(()=>{const B=i.chartOptions.yAxes?.left?.title??i.chartOptions?.metricAxesTitle;if(B)return B;const{metricNames:U,metricUnits:J}=x.value;if(!(!U||!J))return z(l(U,"left"),J)}),X=u.computed(()=>{if(!r.value)return;const{metricNames:B,metricUnits:U}=x.value,J=B&&U?z(l(B,"right"),U):void 0;return{title:i.chartOptions.yAxes?.right?.title??J,showGrid:i.chartOptions.yAxes?.right?.showGrid}}),z=(B,U)=>{const J=B[0];if(!J)return;const $t=U[J]||"";if(B.length>1){if(J.includes("latency"))return s.t("metricAxisTitles.latency_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})});if(J.includes("size"))return s.t("metricAxisTitles.size_in",{unit:s.t(`chartUnits.${$t}`,{plural:"s"})})}return C(J,$t)},C=(B,U)=>{if(s.te(`metricAxisTitles.${B}`)){if(zi(U))return s.t(`metricAxisTitles.${B}`)||void 0;const J=s.te(`chartUnits.${U}`)?s.t(`chartUnits.${U}`,{plural:"s"}):U;return s.t(`metricAxisTitles.${B}`,{unit:J})||void 0}return B||void 0},E=u.computed(()=>{if(i.chartOptions?.dimensionAxesTitle)return i.chartOptions.dimensionAxesTitle;const B=o.value?.meta,U=H.value?"Time":Object.keys(B?.display||B?.metric_names||{})[0];if(U)return s.te(`chartLabels.${U}`)?s.t(`chartLabels.${U}`):U}),N=u.computed(()=>{if(Gf(x.value.datasource))return s.t("timestampAxisTitles.platform");const B=Ji(o.value?.meta?.granularity_ms);if(B)return s.te(`granularityAxisTitles.${B}`)?s.t(`granularityAxisTitles.${B}`):B}),V=u.computed(()=>{const B=p.value?.xMetric;return B?C(B,p.value?.xMetricUnit??""):N.value}),tt=u.computed(()=>i.emptyStateTitle||s.t("noDataAvailableTitle")),Z=u.computed(()=>i.emptyStateDescription||s.t("noDataAvailableDescription")),F=u.computed(()=>$.value?!!p.value?.points.length:H.value?XM(T.value):!!(o.value&&o.value.meta&&o.value.data.length)),nt=u.computed(()=>{const B=o.value;return B?B.meta.granularity_ms?Ji(B.meta.granularity_ms)||"hourly":Ji(new Date(B.data[1].timestamp).getTime()-new Date(B.data[0].timestamp).getTime())||"hourly":"hourly"}),gt=u.computed(()=>Ji(o.value?.meta?.granularity_ms)||"secondly"),ct=u.computed(()=>i.chartOptions.chartLegendSortFn?i.chartOptions.chartLegendSortFn:(B,U)=>B.text===s.t("chartLabels.____OTHER____")?1:U.text===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.text,10))&&!isNaN(parseInt(U.text,10))?B.text<U.text?-1:1:B.value&&U.value?U.value.raw-B.value.raw:0),at=u.computed(()=>i.chartOptions.chartTooltipSortFn?i.chartOptions.chartTooltipSortFn:(B,U)=>B.label===s.t("chartLabels.____OTHER____")?1:U.label===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.label,10))&&!isNaN(parseInt(U.label,10))?B.label<U.label?-1:1:B.value&&U.value?U.rawValue-B.rawValue:0),Ct=u.computed(()=>[...i.timeseriesZoom?[{label:s.t("zoom_action_items.zoom"),key:"zoom-in",action:B=>n("zoom-time-range",B)}]:[],...i.exploreLink?[{label:s.t("zoom_action_items.explore"),key:"explore",href:i.exploreLink.href}]:[],...i.requestsLink?[{label:s.t("zoom_action_items.view_requests"),key:"view-requests",href:i.requestsLink.href}]:[]]);return u.provide("showLegendValues",P),u.provide("legendPosition",u.toRef(i,"legendPosition")),(B,U)=>{const J=u.resolveComponent("KTooltip"),$t=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",{ref:"chartShell",class:u.normalizeClass(["analytics-chart-shell",{"show-values":P.value}])},[F.value&&A.value&&S.value?(u.openBlock(),u.createElementBlock("div",ZO,[u.createVNode(J,{class:"tooltip","max-width":"500",placement:"right"},{content:u.withCtx(()=>[u.createElementVNode("div",QO,u.toDisplayString(L.value),1)]),default:u.withCtx(()=>[u.createVNode(u.unref(Tt.WarningIcon),{color:`var(--kui-color-text-warning, ${u.unref(lg)})`,size:`var(--kui-icon-size-40, ${u.unref(dg)})`},null,8,["color","size"])]),_:1})])):u.createCommentVNode("",!0),F.value?(u.openBlock(),u.createElementBlock("div",JO,[H.value?(u.openBlock(),u.createBlock(KO,{key:0,brush:v.value,"chart-data":T.value,"chart-legend-sort-fn":ct.value,"chart-tooltip-sort-fn":at.value,"dimension-axes-title":N.value,fill:e.chartOptions.stacked,granularity:nt.value,"left-y-axis-grid":e.chartOptions.yAxes?.left?.showGrid,"legend-values":u.unref(k),"metric-axes-title":rt.value,"metric-unit":M.value,"right-y-axis":X.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,threshold:m.value,"time-range-ms":w.value,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle,type:e.chartOptions.type,"zoom-action-items":Ct.value,onSelectChartRange:U[0]||(U[0]=fe=>n("select-chart-range",fe)),onZoomTimeRange:U[1]||(U[1]=fe=>n("zoom-time-range",fe))},null,8,["brush","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","fill","granularity","left-y-axis-grid","legend-values","metric-axes-title","metric-unit","right-y-axis","stacked","synthetics-data-key","threshold","time-range-ms","tooltip-metric-display","tooltip-title","type","zoom-action-items"])):R.value?(u.openBlock(),u.createBlock(_O,{key:1,annotations:e.showAnnotations,"chart-data":T.value,"chart-legend-sort-fn":ct.value,"chart-tooltip-sort-fn":at.value,"data-testid":"bar-chart-container","dimension-axes-title":E.value,"legend-values":u.unref(k),"metric-axes-title":rt.value,"metric-unit":M.value,orientation:K.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle},null,8,["annotations","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","legend-values","metric-axes-title","metric-unit","orientation","stacked","synthetics-data-key","tooltip-metric-display","tooltip-title"])):W.value?(u.openBlock(),u.createBlock(RO,{key:2,"chart-data":T.value,"dataset-colors":e.chartOptions.chartDatasetColors||u.unref(Va),"legend-position":e.legendPosition,"legend-values":u.unref(k),"metric-name":D.value,"metric-unit":M.value,"show-center-metric":e.chartOptions.showCenterMetric,"synthetics-data-key":e.syntheticsDataKey,"tooltip-dimension-display":E.value,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle},null,8,["chart-data","dataset-colors","legend-position","legend-values","metric-name","metric-unit","show-center-metric","synthetics-data-key","tooltip-dimension-display","tooltip-metric-display","tooltip-title"])):$.value?(u.openBlock(),u.createBlock(FO,{key:3,"chart-data":T.value,"chart-legend-sort-fn":e.chartOptions.chartLegendSortFn,"chart-tooltip-sort-fn":at.value,"data-testid":"scatter-chart-container","dimension-axes-title":V.value,granularity:gt.value,"metric-axes-title":rt.value,"metric-unit":M.value,"shade-outlier-region":e.chartOptions.scatter?.shadeOutlierRegion,"synthetics-data-key":e.syntheticsDataKey,"theme-colors":_.value,"time-range-ms":w.value,"tooltip-metric-display":lt.value,"tooltip-title":e.tooltipTitle,"x-metric":p.value?.xMetric,"x-metric-unit":p.value?.xMetricUnit},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","granularity","metric-axes-title","metric-unit","shade-outlier-region","synthetics-data-key","theme-colors","time-range-ms","tooltip-metric-display","tooltip-title","x-metric","x-metric-unit"])):u.createCommentVNode("",!0)])):(u.openBlock(),u.createBlock($t,{key:1,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(tt.value),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(Z.value),1)]),_:1}))],2)}}}),eA=Pt(tA,[["__scopeId","data-v-c5c250ba"]]),nA={class:"chart-parent","data-testid":"gauge-chart-parent"},iA={class:"chart-totals-flex"},sA={key:1,class:"metric-small","data-testid":"gauge-chart-total"},oA=Pt(u.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:"hidden"},numerator:{type:Number,required:!1,default:0},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:he},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.ref(gr()),s=u.computed(()=>[t.chartData.datasets.reduce((m,p)=>(m.labels.push(p.label),m.borderColor.push(p.backgroundColor),m.backgroundColor.push(p.backgroundColor),m.data.push(p.data.reduce((g,y)=>g+y,0)),m),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),o=u.computed(()=>({...t.chartData,datasets:s.value}));q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},r=u.computed(()=>Ri(s?.value[0]?.data[t.numerator],{capital:!0})),l=u.computed(()=>Ri(s?.value[0]?.data[0]+s?.value[0]?.data[1],{capital:!0})),c=u.computed(()=>`color: ${s?.value[0]?.backgroundColor[t.numerator]}`),d=u.computed(()=>["full","single"].includes(t.metricDisplay)),h=u.computed(()=>t.metricDisplay==="full");return(f,m)=>(u.openBlock(),u.createElementBlock("div",nA,[u.createElementVNode("div",iA,[d.value?(u.openBlock(),u.createElementBlock("div",{key:0,class:"metric-large","data-testid":"gauge-chart-metric",style:u.normalizeStyle(c.value)},u.toDisplayString(r.value),5)):u.createCommentVNode("",!0),h.value?(u.openBlock(),u.createElementBlock("div",sA,u.toDisplayString(u.unref(n).t("total"))+": "+u.toDisplayString(l.value),1)):u.createCommentVNode("",!0)]),u.createElementVNode("div",{class:"chart-container",style:u.normalizeStyle({height:e.height,width:e.width})},[u.createVNode(u.unref(cf),{"chart-id":i.value,data:o.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),[["__scopeId","data-v-c461b83f"]]),aA={key:1,class:"single-value-wrapper"},rA={class:"single-value-metric"},lA={class:"name-unit-alignment"},cA={class:"single-value","data-testid":"single-value-chart"},uA={key:0,class:"single-value-unit"},dA={class:"single-value-metric-name"},hA={key:0,class:"single-value-trend"},fA={key:0,class:"single-value-trend-range","data-testid":"single-value-trend-range"},br="t1",_r="t2",mA=Pt(u.defineComponent({__name:"SingleValue",props:{data:{type:Object,required:!0},decimalPoints:{type:Number,default:Dd},leftAlign:{type:Boolean,default:!1},showTrend:{type:Boolean,default:!1},increaseIsBad:{type:Boolean,default:!1},alignX:{type:String,default:"left"}},setup(e){const{i18n:t}=q.useI18n(),{formatBytes:n,formatCost:i}=oe({i18n:t}),s=e,o=u.computed(()=>`align-${s.leftAlign?"left":s.alignX}`),a=u.computed(()=>We.buildDeltaMapping(s.data,s.showTrend,{topLevelKey:br,secondLevelKey:_r})),r=u.computed(()=>a.value?.previous?.[br]?.[_r]),l=u.computed(()=>a.value?.current?.[br]?.[_r]),c=u.computed(()=>s.data.data),d=u.computed(()=>s.data.meta?.metric_names?.[0]),h=u.computed(()=>t.te(`chartLabels.${d.value}`)?t.t(`chartLabels.${d.value}`):""),f=u.computed(()=>{const S=d.value?s.data.meta?.metric_units?.[d.value]:void 0;if(S){const A=`chartUnits.${S}`;return t.te(A)?t.t(A,{plural:""}):""}}),m=u.computed(()=>!!d.value&&(d.value.includes("_per_minute")||d.value.includes("_latency_")||d.value==="error_rate")),p=u.computed(()=>s.showTrend&&r.value!==void 0?r.value:null),g=u.computed(()=>{if(s.showTrend)return l.value??null;if(c.value.length<1||!d.value)return null;const S=c.value[0].event[d.value];return typeof S!="number"||isNaN(S)?null:S}),y=u.computed(()=>s.data?.data?.length===void 0||s.data?.data?.length===0||!s.showTrend&&g.value===null||s.showTrend&&p.value===null&&g.value===null),_=u.computed(()=>{const S=g.value;if(S===null)return"-";const A=d.value?s.data.meta?.metric_units?.[d.value]:void 0;if(A==="usd")return i(S);if(A==="bytes")return n(S);if(S>=1e9){const R=(S/1e9).toFixed(1);return R.endsWith(".0")?`${Math.floor(S/1e9)}B`:`${R}B`}if(S>=1e7){const R=(S/1e6).toFixed(1);return R.endsWith(".0")?`${Math.floor(S/1e6)}M`:`${R}M`}const L=s.decimalPoints&&typeof s.decimalPoints=="number"?s.decimalPoints:Dd;return S.toLocaleString("en-US",{maximumFractionDigits:L})}),x=u.computed(()=>s.showTrend&&s.data?.data?.length<2),T=u.computed(()=>We.calculateChange(g.value??0,p.value??0)||0),v=u.computed(()=>{if(!s.showTrend)return 0;if(s.data?.data?.length<2){if(r.value===void 0)return 0;if(l.value===void 0)return s.increaseIsBad?1:-1}return We.changePolarity(T.value,!0,s.increaseIsBad)}),w=u.computed(()=>We.defineIcon(v.value,s.increaseIsBad)),M=u.computed(()=>{if(s.showTrend&&s.data?.data?.length<2){if(r.value===void 0)return t.t("singleValue.trend.not_available");if(l.value===void 0)return We.metricChange(-1,!0,t.t("singleValue.trend.not_available"))}return We.metricChange(T.value,s.data?.data?.length===2,t.t("singleValue.trend.not_available"))}),D=We.useTrendRange(u.computed(()=>s.showTrend),void 0,u.computed(()=>s.data.meta)),P=S=>S>0?"positive":S<0?"negative":"neutral",k=S=>S>0?rg:S<0?ag:bl;return u.onMounted(()=>{!s.showTrend&&s.data?.data?.length>1?console.warn("SingleValue chart should only be used with a single data point. Data length:",s.data.data.length):s.showTrend&&s.data?.data?.length>2&&console.warn("SingleValue with trend expects 2 or fewer data points. Instead got:",s.data.data.length)}),(S,A)=>{const L=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["chart-parent",o.value]),"data-testid":"single-value-parent"},[y.value?(u.openBlock(),u.createBlock(L,{key:0,class:"single-value-error","data-testid":"single-value-error","icon-variant":"error",title:u.unref(t).t("singleValue.valueError")},null,8,["title"])):(u.openBlock(),u.createElementBlock("div",aA,[u.createElementVNode("div",rA,[u.createElementVNode("div",lA,[u.createElementVNode("span",cA,u.toDisplayString(_.value),1),m.value&&f.value?(u.openBlock(),u.createElementBlock("span",uA," "+u.toDisplayString(f.value),1)):u.createCommentVNode("",!0)]),u.createElementVNode("div",dA,u.toDisplayString(h.value),1)]),e.showTrend?(u.openBlock(),u.createElementBlock("div",hA,[u.createElementVNode("div",{class:u.normalizeClass(["trend-change",P(v.value)]),"data-testid":"single-value-trend"},[x.value||v.value!==0?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(w.value),{key:0,color:k(v.value),size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["color","size"])):(u.openBlock(),u.createBlock(u.unref(Tt.EqualIcon),{key:1,color:`var(--kui-color-text-neutral-strong, ${u.unref(bl)})`,size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["color","size"])),u.createElementVNode("div",null,u.toDisplayString(M.value),1)],2),u.unref(D)?(u.openBlock(),u.createElementBlock("div",fA,u.toDisplayString(u.unref(D)),1)):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0)]))],2)}}}),[["__scopeId","data-v-640d8a8c"]]),pA={class:"simple-chart-shell"},gA={key:1,class:"analytics-chart-parent"},yA=Pt(u.defineComponent({__name:"SimpleChart",props:{chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},emptyStateTitle:{type:String,required:!1,default:""},syntheticsDataKey:{type:String,required:!1,default:""},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.computed(()=>{const c=q.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors||he},u.toRef(t,"chartData")).value;return t.chartOptions?.reverseDataset&&c?.datasets.reverse(),c}),s=u.computed(()=>t.chartData.meta?.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""),o=u.computed(()=>t.chartOptions.type==="gauge"),a=u.computed(()=>t.chartOptions.type==="single_value"),r=u.computed(()=>t.emptyStateTitle||n.t("noDataAvailableTitle")),l=u.computed(()=>{const c=t.chartData&&t.chartData.meta&&t.chartData.data.length;if(a.value){const d=t.chartData.meta?.metric_names?.[0];return c&&t.chartData.data[0].event[d]!==null}return c});return(c,d)=>{const h=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",pA,[l.value?(u.openBlock(),u.createElementBlock("div",gA,[o.value?(u.openBlock(),u.createBlock(oA,{key:0,"chart-data":i.value,"dataset-colors":e.chartOptions.chartDatasetColors,"is-simple":"","metric-display":e.chartOptions.metricDisplay,"metric-unit":s.value,numerator:e.chartOptions.numerator,"synthetics-data-key":e.syntheticsDataKey,width:e.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):u.createCommentVNode("",!0),a.value?(u.openBlock(),u.createBlock(mA,{key:1,"align-x":e.chartOptions.alignX,data:e.chartData,"decimal-points":e.chartOptions.decimalPoints,"increase-is-bad":e.chartOptions.increaseIsBad,"show-trend":e.chartOptions.showTrend},null,8,["align-x","data","decimal-points","increase-is-bad","show-trend"])):u.createCommentVNode("",!0)])):(u.openBlock(),u.createBlock(h,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(r.value),1)]),_:1}))])}}}),[["__scopeId","data-v-23ca8c84"]]),bA={class:"container"},_A={key:0,class:"no-data","data-testid":"sparkline-empty"},xA=["title"],wA=Pt(u.defineComponent({__name:"SparklineChart",props:{chartKey:{default:()=>{}},datasets:{},disableTooltip:{type:Boolean,default:!1},enableBrushing:{type:Boolean,default:!1},groupKey:{default:()=>{}},maxCount:{default:()=>{}},maxStamp:{default:()=>{}},minCount:{default:()=>{}},minStamp:{default:()=>{}},pointRenderCount:{default:24},showLabel:{type:Boolean,default:!1},tooltipTitle:{default:()=>{}},type:{default:"sparkline_bar"}},setup(e){const t=crypto.randomUUID(),{i18n:n}=q.useI18n(),{syncedGroupSizeMs:i,syncedMinStamp:s,syncedMaxStamp:o,syncedMinCount:a,syncedMaxCount:r,syncedRenderPoints:l,syncedChartDatasets:c}=q.useSparklineSync({chartKey:e.chartKey,datasets:e.datasets,groupKey:e.groupKey,minStamp:e.minStamp,maxStamp:e.maxStamp,minCount:e.minCount,maxCount:e.maxCount,renderPoints:e.pointRenderCount,type:e.type}),d=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:"",tooltipSeries:[],left:"",top:"",units:"count",translateUnit:()=>"",offsetX:0,offsetY:0,width:0,height:0,chartType:e.type==="sparkline_bar"?"timeseries_bar":"timeseries_line",chartID:t,interactionMode:"idle"}),h=({width:D,height:P})=>{d.width=D,d.height=P},f=u.computed(()=>e.disableTooltip?[]:[new df({enableBrushing:e.groupKey!==void 0&&e.chartKey!==void 0&&e.enableBrushing,brushStrategy:"group",brushGroup:e.groupKey})]),m=u.computed(()=>c.value.reduce((D,{data:P,label:k})=>({...D,[k]:P.reduce((S,{y:A})=>S+A,0)}),{})),p=u.computed(()=>c.value.map(({label:D})=>[m.value[D],`${D}: ${m.value[D]}`]).sort(([D],[P])=>P-D).map(([,D])=>D).join(", ")),g=u.computed(()=>Object.keys(m.value).map(D=>m.value[D]).reduce((D,P)=>D+P,0)),y=u.computed(()=>g.value>0),_=u.computed(()=>({labels:new Array(l.value).fill(""),datasets:c.value})),x=u.computed(()=>e.datasets.length>1),T=`SparklineTooltipPosition-${t}`,v=u.computed(()=>{const D=e.type==="sparkline_bar",P=D?s.value-1:s.value,k=D?o.value:o.value-i.value;return{maintainAspectRatio:!1,elements:{categoryPercentage:1,barPercentage:1,line:{tension:0,stepped:e.type==="sparkline_step",borderWidth:1},point:{radius:0,pointHitRadius:11,pointHoverRadius:0}},interaction:{intersect:!1,mode:"index"},layout:{padding:{left:D?0:2,right:D?0:2,top:2}},plugins:{legend:{display:!1},tooltip:{enabled:!1,position:T,external:S=>{Ia(d,S,"minutely",{contextFormatter:A=>{const L=A+i.value;let R="";return i.value>1440*60*1e3?R=rs(new Date(L),"MMM dd, yyy hh:mm a"):R=rs(new Date(L),"hh:mm a"),`${Up(A)} - ${R}`}})}}},scales:{x:{min:P,max:k,type:"timeseries",offset:!1,grid:{display:!1},display:!1,stacked:x.value},y:{min:Math.max(a.value-1,0),max:r.value,grid:{display:!1},display:!1,stacked:x.value}}}}),w=u.ref("0"),M=u.ref("0");return u.onMounted(()=>{Ht.positioners[T]=function(D,P){if(!D.length||d.interactionMode==="interactive"||P.x===null)return!1;const k=10,S=this.chart.canvas.getBoundingClientRect(),A=d.width||this.width,L=d.height||this.height,R=S.top-L>0,H=R?S.top-L-k:S.top+S.height+k,W=S.left>A/2-P.x,$=Math.max(k,window.innerWidth-k-A),K=Math.min($,W?Math.floor(S.left-A/2)+P.x:0+k);return w.value=`${H}px`,M.value=`${K}px`,{x:K,y:H,xAlign:"center",yAlign:R?"top":"bottom"}}}),u.onUnmounted(()=>{Ht.positioners[T]&&delete Ht.positioners[T]}),(D,P)=>(u.openBlock(),u.createElementBlock("div",bA,[y.value?e.type==="sparkline_bar"?(u.openBlock(),u.createBlock(u.unref(lf),{key:1,"chart-id":u.unref(t),data:_.value,"data-testid":"sparkline-bar",options:v.value,plugins:f.value},null,8,["chart-id","data","options","plugins"])):e.type==="sparkline_line"||e.type==="sparkline_step"?(u.openBlock(),u.createBlock(u.unref(uf),{key:2,"chart-id":u.unref(t),data:_.value,"data-testid":e.type==="sparkline_line"?"sparkline-line":"sparkline-step",options:v.value,plugins:f.value},null,8,["chart-id","data","data-testid","options","plugins"])):u.createCommentVNode("",!0):(u.openBlock(),u.createElementBlock("div",_A,[u.renderSlot(D.$slots,"empty",{},()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("sparkline_no_data")),1)],!0)])),e.disableTooltip?u.createCommentVNode("",!0):(u.openBlock(),u.createBlock(ji,{key:3,"absolute-left":M.value,"absolute-top":w.value,class:"tooltip","data-testid":"sparkline-tooltip",state:d,"tooltip-title":e.tooltipTitle,onDimensions:h},null,8,["absolute-left","absolute-top","state","tooltip-title"])),y.value&&e.showLabel?(u.openBlock(),u.createElementBlock("div",{key:4,class:"label",title:D.$slots.label?"":p.value},[u.renderSlot(D.$slots,"label",{total:g.value,totalByDataset:m.value},()=>[u.createTextVNode(u.toDisplayString(p.value),1)],!0)],8,xA)):u.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-ae8259b6"]]),kA=["data-value"],TA=["title"],SA={class:"top-talkers-cell-metric"},vA={class:"top-talkers-cell-value","data-testid":"top-talkers-cell-value"},MA={key:0,class:"top-talkers-cell-relative","data-testid":"top-talkers-cell-relative"},DA={class:"top-talkers-tooltip","data-testid":"top-talkers-tooltip"},CA={class:"top-talkers-tooltip-title"},OA={class:"top-talkers-tooltip-rows"},AA={class:"top-talkers-tooltip-label"},PA=["data-threshold"],EA=Pt(u.defineComponent({__name:"TopTalkersCell",props:{cell:{}},setup(e){return u.useCssVars(t=>({cecbd9f0:t.cell.color,v0d35e6b6:t.cell.tint})),(t,n)=>(u.openBlock(),u.createBlock(u.unref(Kn.KPop),{class:"top-talkers-cell-wrapper",disabled:!e.cell.tooltipRows.length,"hide-caret":"","hide-close-icon":"",placement:"right","popover-timeout":0,style:u.normalizeStyle({flexGrow:e.cell.ratio}),trigger:"hover"},{content:u.withCtx(()=>[u.createElementVNode("div",DA,[u.createElementVNode("div",CA,u.toDisplayString(e.cell.name),1),u.createElementVNode("dl",OA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.cell.tooltipRows,i=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:i.key},[u.createElementVNode("dt",AA,u.toDisplayString(i.label),1),u.createElementVNode("dd",{class:u.normalizeClass(["top-talkers-tooltip-value",i.threshold&&`top-talkers-tooltip-value--${i.threshold}`]),"data-threshold":i.threshold},u.toDisplayString(i.value),11,PA)],64))),128))])])]),default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["top-talkers-cell",{"top-talkers-cell--other":e.cell.isOther,"top-talkers-cell--empty":e.cell.isEmpty,"top-talkers-cell--deleted":e.cell.deleted}]),"data-testid":"top-talkers-cell","data-value":e.cell.id},[u.createElementVNode("span",{class:"top-talkers-cell-name","data-testid":"top-talkers-cell-name",title:e.cell.name},u.toDisplayString(e.cell.name),9,TA),u.createElementVNode("span",SA,[u.createElementVNode("span",vA,u.toDisplayString(e.cell.display),1),e.cell.relative?(u.openBlock(),u.createElementBlock("span",MA,"("+u.toDisplayString(e.cell.relative)+")",1)):u.createCommentVNode("",!0)])],10,kA)]),_:1},8,["disabled","style"]))}}),[["__scopeId","data-v-73764587"]]),RA=["data-dimension"],IA={class:"top-talkers-column-header"},LA={class:"top-talkers-column-label","data-testid":"top-talkers-column-label"},NA={key:0,class:"top-talkers-column-total","data-testid":"top-talkers-column-total"},BA={key:1,class:"top-talkers-column-empty","data-testid":"top-talkers-column-empty"},FA={key:2,class:"top-talkers-column-cells"},yf=Pt(u.defineComponent({__name:"TopTalkersColumn",props:{dimension:{},label:{},data:{},sizeMetric:{},columnOptions:{},isLoading:{type:Boolean}},setup(e){const{i18n:t}=q.useI18n(),{column:n}=q.useTopTalkersData(u.toRef(()=>e.data),u.toRef(()=>e.dimension),u.toRef(()=>e.sizeMetric),u.toRef(()=>e.columnOptions)),i=u.computed(()=>e.label||n.value.label),s=u.computed(()=>t.t("topTalkers.total",{value:n.value.total}));return(o,a)=>(u.openBlock(),u.createElementBlock("div",{class:"top-talkers-column","data-dimension":e.dimension,"data-testid":"top-talkers-column"},[u.createElementVNode("div",IA,[u.createElementVNode("span",LA,u.toDisplayString(i.value),1),!e.isLoading&&u.unref(n).cells.length?(u.openBlock(),u.createElementBlock("span",NA,u.toDisplayString(s.value),1)):u.createCommentVNode("",!0)]),e.isLoading?(u.openBlock(),u.createBlock(u.unref(Kn.KSkeleton),{key:0,"delay-milliseconds":0,"table-columns":1,type:"table"})):u.unref(n).cells.length?(u.openBlock(),u.createElementBlock("div",FA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(n).cells,r=>(u.openBlock(),u.createBlock(EA,{key:r.id,cell:r},null,8,["cell"]))),128))])):(u.openBlock(),u.createElementBlock("div",BA,u.toDisplayString(u.unref(t).t("topTalkers.defaultEmptyStateTitle")),1))],8,RA))}}),[["__scopeId","data-v-e1b08041"]]),zA={class:"top-talkers-card-title","data-testid":"top-talkers-card-title"},UA={key:2,class:"top-talkers-grid","data-testid":"top-talkers-grid"},VA=Pt(u.defineComponent({__name:"TopTalkersGrid",props:{title:{default:""},columns:{},sizeMetric:{default:void 0},columnOptions:{default:void 0},emptyStateTitle:{default:""},errorMessage:{default:""},titleTag:{default:"h2"}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.useSlots(),s=u.computed(()=>!!i.column),o=u.computed(()=>s.value||t.columns.some(a=>!!a.data?.data?.length||a.isLoading));return(a,r)=>(u.openBlock(),u.createBlock(u.unref(Kn.KCard),{class:"kong-ui-public-top-talkers","title-tag":e.titleTag},u.createSlots({default:u.withCtx(()=>[e.errorMessage?(u.openBlock(),u.createBlock(u.unref(Kn.KEmptyState),{key:0,"action-button-visible":!1,"data-testid":"top-talkers-error-state","icon-variant":"error"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("topTalkers.defaultErrorStateTitle")),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.errorMessage),1)]),_:1})):o.value?(u.openBlock(),u.createElementBlock("div",UA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.columns,(l,c)=>u.renderSlot(a.$slots,"column",{key:`${l.dimension}-${c}`,column:l},()=>[u.createVNode(yf,{"column-options":e.columnOptions,data:l.data,dimension:l.dimension,"is-loading":l.isLoading,label:l.label,"size-metric":e.sizeMetric},null,8,["column-options","data","dimension","is-loading","label","size-metric"])],!0)),128))])):(u.openBlock(),u.createBlock(u.unref(Kn.KEmptyState),{key:1,"action-button-visible":!1,"data-testid":"top-talkers-empty-state"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.emptyStateTitle||u.unref(n).t("topTalkers.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:u.withCtx(()=>[u.createElementVNode("span",zA,u.toDisplayString(e.title),1)]),key:"0"}:void 0]),1032,["title-tag"]))}}),[["__scopeId","data-v-d5bb8abd"]]),HA={ai_provider:{anthropic:Tt.AnthropicIcon,azure:Tt.AzureIcon,bedrock:Tt.AmazonBedrockIcon,cerebras:Tt.CerebrasIcon,cohere:Tt.CohereIcon,databricks:Tt.DatabricksIcon,deepseek:Tt.DeepseekIcon,gemini:Tt.GeminiIcon,huggingface:Tt.HuggingFaceIcon,llama2:Tt.MetaLlamaIcon,mistral:Tt.MistralIcon,moonshot:Tt.KimiIcon,nvidia:Tt.NvidiaIcon,ollama:Tt.OllamaIcon,openai:Tt.OpenAiIcon,vertex:Tt.GoogleVertexIcon,vllm:Tt.VllmIcon,xai:Tt.GrokIcon}},$A=(e,t)=>{if(!(!e||!t))return HA[e]?.[t.toLowerCase()]},YA=["data-threshold"],WA=Pt(u.defineComponent({__name:"TopNMetricBar",props:{ratio:{},threshold:{}},setup(e){u.useCssVars(n=>({v0394367e:u.unref(t)}));const t=he[1];return(n,i)=>(u.openBlock(),u.createElementBlock("span",{class:u.normalizeClass(["top-n-metric-cell-bar",{[`top-n-metric-cell--bar-${e.threshold}`]:!!e.threshold}]),"data-testid":"top-n-metric-cell-bar","data-threshold":e.threshold},[u.createElementVNode("span",{class:"top-n-metric-cell-bar-fill",style:u.normalizeStyle({width:`${e.ratio*100}%`})},null,4)],10,YA))}}),[["__scopeId","data-v-24eb60ef"]]),jA=["data-threshold"],qA={class:"top-n-metric-cell-value"},GA={key:0,class:"top-n-metric-cell-relative","data-testid":"top-n-metric-cell-relative"},XA=Pt(u.defineComponent({__name:"TopNMetricCell",props:{display:{},relative:{},threshold:{},hasBar:{type:Boolean}},setup(e){return(t,n)=>(u.openBlock(),u.createElementBlock("span",{class:u.normalizeClass(["top-n-metric-cell",{"top-n-metric-cell--bar":e.hasBar,[`top-n-metric-cell--text-${e.threshold}`]:!e.hasBar&&!!e.threshold}]),"data-threshold":e.threshold},[u.createElementVNode("span",qA,u.toDisplayString(e.display),1),e.relative?(u.openBlock(),u.createElementBlock("span",GA,"("+u.toDisplayString(e.relative)+")",1)):u.createCommentVNode("",!0)],10,jA))}}),[["__scopeId","data-v-17e7f860"]]),KA={class:"top-n-card-title","data-testid":"top-n-card-title"},ZA={class:"top-n-card-description","data-testid":"top-n-card-description"},QA={key:3,class:"top-n-table","data-testid":"top-n-table"},JA={"data-testid":"top-n-table-header"},tP={class:"top-n-table-header-row"},eP=["colspan"],nP={class:"table-header-label"},iP=["data-testid"],sP={class:"top-n-table-cell-label"},oP={key:0,class:"top-n-table-cell top-n-table-cell-bar"},aP=3,rP=Pt(u.defineComponent({__name:"TopNTable",props:{title:{default:""},description:{default:""},data:{},emptyStateTitle:{default:""},isLoading:{type:Boolean,default:!1},titleTag:{default:"h2"},columnOptions:{default:void 0}},setup(e){const t=e,{i18n:n}=q.useI18n(),{formatUnit:i}=oe({i18n:n}),s=u.computed(()=>t.data.data),o=u.computed(()=>!!s.value?.length),a=u.computed(()=>t.data.meta?.display?Object.keys(t.data.meta.display).slice(0,aP):[]),r=u.computed(()=>a.value[0]||""),l=u.computed(()=>a.value.length>1),c=u.computed(()=>a.value[a.value.length-1]||""),d=u.computed(()=>r.value?t.data.meta.display[r.value]:{}),h=u.computed(()=>t.data.meta?.metric_names?.length?t.data.meta.metric_names:[]),f=u.computed(()=>h.value[0]),m=u.computed(()=>f.value?X(f.value):""),p=u.computed(()=>{const C=a.value.map(E=>({key:E,columnKey:E,label:K(E,l.value?X(E):n.t("topNTable.nameLabel")),type:"dimension"}));return f.value&&C.push({key:"value",columnKey:f.value,label:K(f.value,m.value),type:"metric"}),h.value.forEach((E,N)=>{N!==0&&C.push({key:E,columnKey:E,label:K(E,X(E)),type:"metric"})}),C}),g=u.computed(()=>p.value.filter(C=>C.type==="metric")),y=u.computed(()=>p.value.filter(C=>C.type==="dimension").slice(1)),_=C=>C.type==="dimension"&&C.key===c.value,x=C=>C.type==="metric"&&!!an(t.columnOptions,C.columnKey)?.bar,T=C=>l.value&&C.type==="dimension"&&!_(C),v=C=>{const E=C.event;return String(E[r.value])},w=(C,E)=>{const N=String(C.event[E]),V=t.data.meta?.display?.[E]?.[N];return{dimension:E,id:N,name:V?.name||"-",deleted:!!V?.deleted}},M=C=>{const E=v(C),N=d.value&&d.value[E];return N?N.name:"-"},D=C=>{const E=v(C),N=d.value&&d.value[E];return N?!!N.deleted:!1},P=C=>{const E=N=>i(N,"%",{translateUnit:V=>z(V,N)});return C>0&&C<.01?`< ${E(.01)}`:E(C)},k=(C,E)=>{const N=C.event[E];if(N==null)return"–";const V=typeof N=="number"?N:Number(N);if(Number.isNaN(V))return"–";const tt=t.data.meta?.metric_units?.[E]||"count";if(tt==="%")return P(V);const Z=["count","count/minute","token count"].includes(tt);return i(V,tt,{approximate:Z,isBytes1024:!0,translateUnit:F=>z(F,V)})},S=u.computed(()=>Object.fromEntries(h.value.map(C=>[C,Pa(s.value.map(E=>Nn(E.event[C])))]))),A=(C,E)=>{const N=an(t.columnOptions,E),V=Nn(C.event[E]);if(!N||V===null)return{display:k(C,E)};const tt=S.value[E],Z=N.value==="relative"?Ea(V,tt):null;return{display:k(C,E),relative:Z===null?void 0:P(Z*100),barRatio:N.bar?Ed(V,tt,N.bar):void 0,threshold:Ra(V,N.thresholds)}},L=u.computed(()=>s.value?.length?s.value.map(C=>{const E=a.value.map(Z=>w(C,Z)),N=E[0],V=N?.id||v(C),tt={id:V,rowKey:E.map(Z=>`${Z.dimension}:${Z.id}`).join("|")||V,name:N?.name||M(C),deleted:D(C),dimensions:E,metrics:{},original:C};return h.value.forEach((Z,F)=>{tt.metrics[F===0?"value":Z]=A(C,Z)}),tt}):[]),R=u.computed(()=>{if(!o.value)return"";if(t.data.meta){if(a.value.some(C=>!Object.keys(t.data.meta.display[C]||{}).length))return n.t("topNTable.errors.display");if(!f.value)return n.t("topNTable.errors.metricNames")}else return n.t("topNTable.errors.meta");return""}),H=(C,E)=>C.metrics[E]??{display:"–"},W=(C,E)=>C.dimensions.find(N=>N.dimension===E)?.id||"",$=(C,E)=>$A(an(t.columnOptions,C)?.icon_set,E),K=(C,E)=>C&&an(t.columnOptions,C)?.label||E,lt=(C,E)=>C.dimensions.find(N=>N.dimension===E)?.name||"–",rt=(C,E)=>{const N=C.dimensions.find(V=>V.dimension===E);return{id:N?.id||"",name:N?.name||"–",deleted:N?.deleted||!1,dimension:E,dimensions:C.dimensions,isEmpty:N?.id==="empty"}},X=C=>n.te(`chartLabels.${C}`)?n.t(`chartLabels.${C}`):C,z=(C,E)=>{if(zi(C)||C==="count"||C==="requests")return"";const N=E===1?"":"s";return n.te(`chartUnits.${C}`)?n.t(`chartUnits.${C}`,{plural:N}):C};return(C,E)=>{const N=u.resolveComponent("KEmptyState"),V=u.resolveComponent("KSkeleton"),tt=u.resolveComponent("KCard");return u.openBlock(),u.createBlock(tt,{class:"kong-ui-public-top-n-table","title-tag":e.titleTag},u.createSlots({default:u.withCtx(()=>[R.value?(u.openBlock(),u.createBlock(N,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("topNTable.defaultErrorStateTitle")),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(R.value),1)]),_:1})):e.isLoading?(u.openBlock(),u.createBlock(V,{key:1,"table-columns":2,type:"table"})):o.value?(u.openBlock(),u.createElementBlock("div",QA,[u.createElementVNode("table",{class:u.normalizeClass(["top-n-table-table",{"top-n-table-table--multi-dimension":l.value}])},[u.createElementVNode("thead",JA,[u.createElementVNode("tr",tP,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(p.value,Z=>(u.openBlock(),u.createElementBlock("th",{key:Z.key,class:u.normalizeClass(["top-n-table-header-cell",{"top-n-table-header-cell-metric":Z.type==="metric","top-n-table-header-cell-dimension-compact":T(Z)}]),colspan:x(Z)?2:void 0,"data-testid":"top-n-table-header-column"},[u.createElementVNode("span",nP,u.toDisplayString(Z.label),1),E[0]||(E[0]=u.createElementVNode("div",{class:"top-n-table-header-cell-border"},null,-1))],10,eP))),128))])]),u.createElementVNode("tbody",null,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(L.value,Z=>(u.openBlock(),u.createElementBlock("tr",{key:Z.rowKey,class:"top-n-table-row"},[a.value.length?(u.openBlock(),u.createElementBlock("td",{key:0,class:u.normalizeClass(["top-n-table-cell top-n-table-cell--name",{"top-n-table-cell-dimension-compact":l.value}])},[u.createElementVNode("span",{class:"top-n-table-cell-label","data-testid":`row-${Z.id}`},[$(r.value,Z.id)?(u.openBlock(),u.createBlock(u.resolveDynamicComponent($(r.value,Z.id)),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["size"])):u.createCommentVNode("",!0),u.renderSlot(C.$slots,"name",{record:{id:Z.id,name:Z.name,deleted:Z.deleted,dimension:r.value,dimensions:Z.dimensions,isEmpty:Z.id==="empty"}},()=>[u.createTextVNode(u.toDisplayString(Z.name),1)],!0)],8,iP)],2)):u.createCommentVNode("",!0),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(y.value,F=>(u.openBlock(),u.createElementBlock("td",{key:F.key,class:u.normalizeClass(["top-n-table-cell top-n-table-cell--dimension",{"top-n-table-cell-dimension-compact":!_(F)}])},[u.createElementVNode("span",sP,[$(F.key,W(Z,F.key))?(u.openBlock(),u.createBlock(u.resolveDynamicComponent($(F.key,W(Z,F.key))),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${u.unref(Tn)})`},null,8,["size"])):u.createCommentVNode("",!0),u.renderSlot(C.$slots,"name",{record:rt(Z,F.key)},()=>[u.createTextVNode(u.toDisplayString(lt(Z,F.key)),1)],!0)])],2))),128)),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(g.value,F=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:F.key},[u.createElementVNode("td",{class:u.normalizeClass(["top-n-table-cell top-n-table-cell-metric",{"top-n-table-cell-metric--has-bar":x(F)}])},[u.createVNode(XA,{"data-testid":F.key==="value"?`row-${Z.id}`:`row-${Z.id}-${F.key}`,display:H(Z,F.key).display,"has-bar":x(F),relative:H(Z,F.key).relative,threshold:H(Z,F.key).threshold},null,8,["data-testid","display","has-bar","relative","threshold"])],2),x(F)?(u.openBlock(),u.createElementBlock("td",oP,[u.createVNode(WA,{ratio:H(Z,F.key).barRatio??0,threshold:H(Z,F.key).threshold},null,8,["ratio","threshold"])])):u.createCommentVNode("",!0)],64))),128))]))),128))])],2)])):(u.openBlock(),u.createBlock(N,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.emptyStateTitle||u.unref(n).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:u.withCtx(()=>[u.createElementVNode("span",KA,u.toDisplayString(e.title),1)]),key:"0"}:void 0,e.description?{name:"actions",fn:u.withCtx(()=>[u.createElementVNode("div",ZA,u.toDisplayString(e.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-9111e441"]]);ot.AnalyticsChart=eA,ot.ChartLegendPosition=It,ot.DECIMAL_DISPLAY=KM,ot.FONT_SIZE_REGULAR=Fd,ot.FONT_SIZE_SMALL=Bd,ot.LEFT_Y_AXIS_ID=Gs,ot.MAX_LABEL_LENGTH=qs,ot.OTHER_DIMENSION_ID=Aa,ot.RIGHT_Y_AXIS_ID=Na,ot.SimpleChart=yA,ot.SparklineChart=wA,ot.TopNTable=rP,ot.TopTalkersColumn=yf,ot.TopTalkersGrid=VA,ot.chartTypes=J1,ot.exploreResultToScatterData=oh,ot.getBarRatio=Ed,ot.getColumnOptions=an,ot.getColumnStats=Pa,ot.getRelativeValue=Ea,ot.getThresholdType=Ra,ot.handleQueryError=Y1,ot.isCancellationError=ih,ot.isScatterChartData=tr,ot.lookupStatusCodeColor=Ud,ot.requestsToScatterData=K1,ot.simpleChartMetricDisplay=Q1,ot.simpleChartTypes=tD,ot.statusCodeBadgeBackgroundColor=JM,ot.toNumber=Nn,Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})}));
|