@kong-ui-public/analytics-chart 5.4.12 → 5.4.13

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,4 +1,4 @@
1
- (function(Q,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue"),require("@kong-ui-public/i18n"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","@kong/icons"],h):(Q=typeof globalThis<"u"?globalThis:Q||self,h(Q["kong-ui-publicvitals-chart"]={},Q.Vue,Q["kong-ui-public-i18n"],Q.KongIcons))})(this,function(Q,h,yn,kr){"use strict";var BD=Object.defineProperty;var HD=(Q,h,yn)=>h in Q?BD(Q,h,{enumerable:!0,configurable:!0,writable:!0,value:yn}):Q[h]=yn;var P=(Q,h,yn)=>HD(Q,typeof h!="symbol"?h+"":h,yn);var fn,Nh;const Kh={noDataAvailableTitle:"No data in the current time frame",noDataAvailableDescription:"Once there is traffic, it will display here",limitedResultsShown:"Not all data is shown in the below report. Reports are currently limited to a maximum of {maxReturned} entities.",entityNoName:"no-name",debug:"debug",total:"Total",jumpToExplore:"Open in Explorer",more_actions:"More actions",chartUnits:{ms:"ms",bytes:"Byte{plural}",count:"request{plural}","count/minute":"rpm",requests:"request{plural}","token count":"token{plural}"},csvExport:{noDataRange:"No data in selected range",noDataRetry:"Please adjust the time period and try again",timeRangeSelected:"selected",defaultFilename:"Chart Export",exportPreview:"Export Preview",exportButton:"Export",exportAsCsv:"Export as CSV",exportTimeRange:"Time range",exportDescription:"Exports a CSV of the data represented in the chart.",previewRows:"Previewing {rowsMax} of {rowsTotal} row{plural}",downloadButton:"Export",cancelButton:"Cancel",UtcOffset:"UTC Offset",Timestamp:"Timestamp"},legend:{datapointValueDisplay:"{value} {unit}"},chartLabels:{ai_provider:"Provider",ai_request_model:"Request Model",ai_response_model:"Response Model",request_count:"Request Count",request_per_minute:"Requests per Minute",requests_per_minute:"Requests per Minute",response_latency_p99:"Response Latency (p99)",response_latency_p95:"Response Latency (p95)",response_latency_p50:"Response Latency (p50)",kong_latency_p99:"Kong Latency (p99)",kong_latency_p95:"Kong Latency (p95)",kong_latency_p50:"Kong Latency (p50)",llm_cache_status:"Cache Status",llm_embeddings_model:"Embeddings Model",llm_embeddings_provider:"Embeddings Provider",upstream_latency_p99:"Upstream Latency (p99)",upstream_latency_p95:"Upstream Latency (p95)",upstream_latency_p50:"Upstream Latency (p50)",response_size_p99:"Response Size (p99)",response_size_p95:"Response Size (p95)",response_size_p50:"Response Size (p50)",request_size_p99:"Request Size (p99)",request_size_p95:"Request Size (p95)",request_size_p50:"Request Size (p50)",control_plane:"Control Plane",api_product:"API Product",api_product_version:"API Product Version",runtime_group:"Runtime Group",gateway_service:"Gateway Service",route:"Route",application:"Application",status_code:"Status Code",status_code_grouped:"Status Code (grouped)",time:"Time",Service:"Service",ServiceVersion:"Service Version",Route:"Route",Application:"Application",RuntimeGroup:"Runtime Group",GatewayService:"Gateway Service",StatusCode:"Status Code",CodeClass:"Status Code (grouped)",Time:"Time",API_PRODUCT:"API Product",API_PRODUCT_VERSION:"API Product Version",RUNTIME_GROUP:"Runtime Group",GATEWAY_SERVICE:"Gateway Service",ROUTE:"Route",APPLICATION:"Application",STATUS_CODE:"Status Code",STATUS_CODE_GROUPED:"Status Code (grouped)",TIME:"Time",ORGANIZATION:"Organization",TotalRequests:"Request Count",RequestsPerMinute:"Requests per Minute",LatencyP99:"Response Latency (p99)",LatencyP95:"Response Latency (p95)",LatencyP50:"Response Latency (p50)",LatencyAverage:"Response Latency (avg)",UpstreamLatencyP99:"Upstream Latency (p99)",UpstreamLatencyP95:"Upstream Latency (p95)",UpstreamLatencyP50:"Upstream Latency (p50)",UpstreamLatencyAverage:"Upstream Latency (avg)",KongLatencyP99:"Kong Latency (p99)",KongLatencyP95:"Kong Latency (p95)",KongLatencyP50:"Kong Latency (p50)",KongLatencyAverage:"Kong Latency (avg)",ResponseSizeP99:"Response Size (p99)",ResponseSizeP95:"Response Size (p95)",ResponseSizeP50:"Response Size (p50)",RequestSizeP99:"Request Size (p99)",RequestSizeP95:"Request Size (p95)",RequestSizeP50:"Request Size (p50)",SuccessfulRequests:"Successful requests",SUCCESS:"Successful requests",FailedRequests:"Failed requests",FAILURE:"Failed requests","5XX":"5xx","4XX":"4xx","3XX":"3xx","2XX":"2xx","1XX":"1xx",REQUEST_COUNT:"Request Count",REQUEST_PER_MINUTE:"Requests per Minute",RESPONSE_LATENCY_P99:"Response Latency",RESPONSE_LATENCY_P95:"Response Latency",RESPONSE_LATENCY_P50:"Response Latency",RESPONSE_SIZE_P99:"Response Size (p99)",RESPONSE_SIZE_P95:"Response Size (p95)",RESPONSE_SIZE_P50:"Response Size (p50)",REQUEST_SIZE_P99:"Request Size (p99)",REQUEST_SIZE_P95:"Request Size (p95)",REQUEST_SIZE_P50:"Request Size (p50)",CONTROL_PLANE:"Control Plane",____OTHER____:"Others",ai_request_count:"Request Count",total_tokens:"Total Token Count",prompt_tokens:"Prompt Token Count",completion_tokens:"Completion Token Count",cost:"Costs",llm_cache_embeddings_latency_average:"Embeddings Latency (avg)",llm_cache_fetch_latency_average:"Fetch Latency (avg)",llm_latency_average:"LLM Latency (avg)"},metricAxisTitles:{request_count:"Request Count",requests_per_minute:"Requests per Minute",latency_in:"Latency in {unit}",size_in:"Size in {unit}",response_latency_p99:"Response Latency (p99) in {unit}",response_latency_p95:"Response Latency (p95) in {unit}",response_latency_p50:"Response Latency (p50) in {unit}",upstream_latency_p99:"Upstream Latency (p99) in {unit}",upstream_latency_p95:"Upstream Latency (p95) in {unit}",upstream_latency_p50:"Upstream Latency (p50) in {unit}",kong_latency_p99:"Kong Latency (p99) in {unit}",kong_latency_p95:"Kong Latency (p95) in {unit}",kong_latency_p50:"Kong Latency (p50) in {unit}",response_size_p99:"Response Size (p99) in {unit}",response_size_p95:"Response Size (p95) in {unit}",response_size_p50:"Response Size (p50) in {unit}",request_size_p99:"Request Size (p99) in {unit}",request_size_p95:"Request Size (p95) in {unit}",request_size_p50:"Request Size (p50) in {unit}",REQUEST_COUNT:"Request Count",REQUEST_PER_MINUTE:"Requests per Minute",RESPONSE_LATENCY_P99:"Response Latency (p99) in {unit}",RESPONSE_LATENCY_P95:"Response Latency (p95) in {unit}",RESPONSE_LATENCY_P50:"Response Latency (p50) in {unit}",RESPONSE_SIZE_P99:"Response Size (p99) in {unit}",RESPONSE_SIZE_P95:"Response Size (p95) in {unit}",RESPONSE_SIZE_P50:"Response Size (p50) in {unit}",REQUEST_SIZE_P99:"Request Size (p99) in {unit}",REQUEST_SIZE_P95:"Request Size (p95) in {unit}",REQUEST_SIZE_P50:"Request Size (p50) in {unit}",TotalRequests:"Request Count",RequestsPerMinute:"Requests per Minute",LatencyP99:"Response Latency (p99) in {unit}",LatencyP95:"Response Latency (p95) in {unit}",LatencyP50:"Response Latency (p50) in {unit}",LatencyAverage:"Response Latency (avg) in {unit}",UpstreamLatencyP99:"Upstream Latency (p99) in {unit}",UpstreamLatencyP95:"Upstream Latency (p95) in {unit}",UpstreamLatencyP50:"Upstream Latency (p50) in {unit}",UpstreamLatencyAverage:"Upstream Latency (avg) in {unit}",KongLatencyP99:"Kong Latency (p99) in {unit}",KongLatencyP95:"Kong Latency (p95) in {unit}",KongLatencyP50:"Kong Latency (p50) in {unit}",KongLatencyAverage:"Kong Latency (avg) in {unit}",ResponseSizeP99:"Response Size (p99) in {unit}",ResponseSizeP95:"Response Size (p95) in {unit}",ResponseSizeP50:"Response Size (p50) in {unit}",RequestSizeP99:"Request Size (p99) in {unit}",RequestSizeP95:"Request Size (p95) in {unit}",RequestSizeP50:"Request Size (p50) in {unit}",ai_request_count:"Request Count",total_tokens:"Total Token Count",prompt_tokens:"Prompt Token Count",completion_tokens:"Completion Token Count",cost:"Costs",llm_cache_embeddings_latency_average:"Embeddings Latency (avg)",llm_cache_fetch_latency_average:"Fetch Latency (avg)",llm_latency_average:"LLM Latency (avg)"},granularityAxisTitles:{minutely:"@timestamp per minute",hourly:"@timestamp per hour",daily:"@timestamp per day",weekly:"@timestamp per week"},topNTable:{nameLabel:"Name",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong",errors:{meta:"Error: response must contain 'meta'",display:"Error: 'display' response incorrectly formatted (must have at least one key)",metricNames:"Error: 'metricNames' response incorrectly formatted (must have at least one entry)"}}};function Zh(){const n=yn.createI18n("en-us",Kh);return{i18n:n,i18nT:yn.i18nTComponent(n)}}/*!
1
+ (function(Q,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue"),require("@kong-ui-public/i18n"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","@kong/icons"],h):(Q=typeof globalThis<"u"?globalThis:Q||self,h(Q["kong-ui-publicvitals-chart"]={},Q.Vue,Q["kong-ui-public-i18n"],Q.KongIcons))})(this,function(Q,h,yn,kr){"use strict";var zD=Object.defineProperty;var BD=(Q,h,yn)=>h in Q?zD(Q,h,{enumerable:!0,configurable:!0,writable:!0,value:yn}):Q[h]=yn;var P=(Q,h,yn)=>BD(Q,typeof h!="symbol"?h+"":h,yn);var fn,Nh;const Kh={noDataAvailableTitle:"No data in the current time frame",noDataAvailableDescription:"Once there is traffic, it will display here",limitedResultsShown:"Not all data is shown in the below report. Reports are currently limited to a maximum of {maxReturned} entities.",entityNoName:"no-name",debug:"debug",total:"Total",jumpToExplore:"Open in Explorer",more_actions:"More actions",chartUnits:{ms:"ms",bytes:"Byte{plural}",count:"request{plural}","count/minute":"rpm",requests:"request{plural}","token count":"token{plural}"},csvExport:{noDataRange:"No data in selected range",noDataRetry:"Please adjust the time period and try again",timeRangeSelected:"selected",defaultFilename:"Chart Export",exportPreview:"Export Preview",exportButton:"Export",exportAsCsv:"Export as CSV",exportTimeRange:"Time range",exportDescription:"Exports a CSV of the data represented in the chart.",previewRows:"Previewing {rowsMax} of {rowsTotal} row{plural}",downloadButton:"Export",cancelButton:"Cancel",UtcOffset:"UTC Offset",Timestamp:"Timestamp"},legend:{datapointValueDisplay:"{value} {unit}"},chartLabels:{ai_provider:"Provider",ai_request_model:"Request Model",ai_response_model:"Response Model",request_count:"Request Count",request_per_minute:"Requests per Minute",requests_per_minute:"Requests per Minute",response_latency_p99:"Response Latency (p99)",response_latency_p95:"Response Latency (p95)",response_latency_p50:"Response Latency (p50)",kong_latency_p99:"Kong Latency (p99)",kong_latency_p95:"Kong Latency (p95)",kong_latency_p50:"Kong Latency (p50)",llm_cache_status:"Cache Status",llm_embeddings_model:"Embeddings Model",llm_embeddings_provider:"Embeddings Provider",upstream_latency_p99:"Upstream Latency (p99)",upstream_latency_p95:"Upstream Latency (p95)",upstream_latency_p50:"Upstream Latency (p50)",response_size_p99:"Response Size (p99)",response_size_p95:"Response Size (p95)",response_size_p50:"Response Size (p50)",request_size_p99:"Request Size (p99)",request_size_p95:"Request Size (p95)",request_size_p50:"Request Size (p50)",control_plane:"Control Plane",api_product:"API Product",api_product_version:"API Product Version",runtime_group:"Runtime Group",gateway_service:"Gateway Service",route:"Route",application:"Application",status_code:"Status Code",status_code_grouped:"Status Code (grouped)",time:"Time",Service:"Service",ServiceVersion:"Service Version",Route:"Route",Application:"Application",RuntimeGroup:"Runtime Group",GatewayService:"Gateway Service",StatusCode:"Status Code",CodeClass:"Status Code (grouped)",Time:"Time",API_PRODUCT:"API Product",API_PRODUCT_VERSION:"API Product Version",RUNTIME_GROUP:"Runtime Group",GATEWAY_SERVICE:"Gateway Service",ROUTE:"Route",APPLICATION:"Application",STATUS_CODE:"Status Code",STATUS_CODE_GROUPED:"Status Code (grouped)",TIME:"Time",ORGANIZATION:"Organization",TotalRequests:"Request Count",RequestsPerMinute:"Requests per Minute",LatencyP99:"Response Latency (p99)",LatencyP95:"Response Latency (p95)",LatencyP50:"Response Latency (p50)",LatencyAverage:"Response Latency (avg)",UpstreamLatencyP99:"Upstream Latency (p99)",UpstreamLatencyP95:"Upstream Latency (p95)",UpstreamLatencyP50:"Upstream Latency (p50)",UpstreamLatencyAverage:"Upstream Latency (avg)",KongLatencyP99:"Kong Latency (p99)",KongLatencyP95:"Kong Latency (p95)",KongLatencyP50:"Kong Latency (p50)",KongLatencyAverage:"Kong Latency (avg)",ResponseSizeP99:"Response Size (p99)",ResponseSizeP95:"Response Size (p95)",ResponseSizeP50:"Response Size (p50)",RequestSizeP99:"Request Size (p99)",RequestSizeP95:"Request Size (p95)",RequestSizeP50:"Request Size (p50)",SuccessfulRequests:"Successful requests",SUCCESS:"Successful requests",FailedRequests:"Failed requests",FAILURE:"Failed requests","5XX":"5xx","4XX":"4xx","3XX":"3xx","2XX":"2xx","1XX":"1xx",REQUEST_COUNT:"Request Count",REQUEST_PER_MINUTE:"Requests per Minute",RESPONSE_LATENCY_P99:"Response Latency",RESPONSE_LATENCY_P95:"Response Latency",RESPONSE_LATENCY_P50:"Response Latency",RESPONSE_SIZE_P99:"Response Size (p99)",RESPONSE_SIZE_P95:"Response Size (p95)",RESPONSE_SIZE_P50:"Response Size (p50)",REQUEST_SIZE_P99:"Request Size (p99)",REQUEST_SIZE_P95:"Request Size (p95)",REQUEST_SIZE_P50:"Request Size (p50)",CONTROL_PLANE:"Control Plane",____OTHER____:"Others",ai_request_count:"Request Count",total_tokens:"Total Token Count",prompt_tokens:"Prompt Token Count",completion_tokens:"Completion Token Count",cost:"Costs",llm_cache_embeddings_latency_average:"Embeddings Latency (avg)",llm_cache_fetch_latency_average:"Fetch Latency (avg)",llm_latency_average:"LLM Latency (avg)"},metricAxisTitles:{request_count:"Request Count",requests_per_minute:"Requests per Minute",latency_in:"Latency in {unit}",size_in:"Size in {unit}",response_latency_p99:"Response Latency (p99) in {unit}",response_latency_p95:"Response Latency (p95) in {unit}",response_latency_p50:"Response Latency (p50) in {unit}",upstream_latency_p99:"Upstream Latency (p99) in {unit}",upstream_latency_p95:"Upstream Latency (p95) in {unit}",upstream_latency_p50:"Upstream Latency (p50) in {unit}",kong_latency_p99:"Kong Latency (p99) in {unit}",kong_latency_p95:"Kong Latency (p95) in {unit}",kong_latency_p50:"Kong Latency (p50) in {unit}",response_size_p99:"Response Size (p99) in {unit}",response_size_p95:"Response Size (p95) in {unit}",response_size_p50:"Response Size (p50) in {unit}",request_size_p99:"Request Size (p99) in {unit}",request_size_p95:"Request Size (p95) in {unit}",request_size_p50:"Request Size (p50) in {unit}",REQUEST_COUNT:"Request Count",REQUEST_PER_MINUTE:"Requests per Minute",RESPONSE_LATENCY_P99:"Response Latency (p99) in {unit}",RESPONSE_LATENCY_P95:"Response Latency (p95) in {unit}",RESPONSE_LATENCY_P50:"Response Latency (p50) in {unit}",RESPONSE_SIZE_P99:"Response Size (p99) in {unit}",RESPONSE_SIZE_P95:"Response Size (p95) in {unit}",RESPONSE_SIZE_P50:"Response Size (p50) in {unit}",REQUEST_SIZE_P99:"Request Size (p99) in {unit}",REQUEST_SIZE_P95:"Request Size (p95) in {unit}",REQUEST_SIZE_P50:"Request Size (p50) in {unit}",TotalRequests:"Request Count",RequestsPerMinute:"Requests per Minute",LatencyP99:"Response Latency (p99) in {unit}",LatencyP95:"Response Latency (p95) in {unit}",LatencyP50:"Response Latency (p50) in {unit}",LatencyAverage:"Response Latency (avg) in {unit}",UpstreamLatencyP99:"Upstream Latency (p99) in {unit}",UpstreamLatencyP95:"Upstream Latency (p95) in {unit}",UpstreamLatencyP50:"Upstream Latency (p50) in {unit}",UpstreamLatencyAverage:"Upstream Latency (avg) in {unit}",KongLatencyP99:"Kong Latency (p99) in {unit}",KongLatencyP95:"Kong Latency (p95) in {unit}",KongLatencyP50:"Kong Latency (p50) in {unit}",KongLatencyAverage:"Kong Latency (avg) in {unit}",ResponseSizeP99:"Response Size (p99) in {unit}",ResponseSizeP95:"Response Size (p95) in {unit}",ResponseSizeP50:"Response Size (p50) in {unit}",RequestSizeP99:"Request Size (p99) in {unit}",RequestSizeP95:"Request Size (p95) in {unit}",RequestSizeP50:"Request Size (p50) in {unit}",ai_request_count:"Request Count",total_tokens:"Total Token Count",prompt_tokens:"Prompt Token Count",completion_tokens:"Completion Token Count",cost:"Costs",llm_cache_embeddings_latency_average:"Embeddings Latency (avg)",llm_cache_fetch_latency_average:"Fetch Latency (avg)",llm_latency_average:"LLM Latency (avg)"},granularityAxisTitles:{minutely:"@timestamp per minute",hourly:"@timestamp per hour",daily:"@timestamp per day",weekly:"@timestamp per week"},topNTable:{nameLabel:"Name",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong",errors:{meta:"Error: response must contain 'meta'",display:"Error: 'display' response incorrectly formatted (must have at least one key)",metricNames:"Error: 'metricNames' response incorrectly formatted (must have at least one entry)"}}};function Zh(){const n=yn.createI18n("en-us",Kh);return{i18n:n,i18nT:yn.i18nTComponent(n)}}/*!
2
2
  * @kurkle/color v0.3.2
3
3
  * https://github.com/kurkle/color#readme
4
4
  * (c) 2023 Jukka Kurkela
@@ -20,12 +20,12 @@
20
20
  * https://www.chartjs.org/chartjs-plugin-annotation/index
21
21
  * (c) 2024 chartjs-plugin-annotation Contributors
22
22
  * Released under the MIT License
23
- */const ld={modes:{point(n,t){return Js(n,t,{intersect:!0})},nearest(n,t,e){return D1(n,t,e)},x(n,t,e){return Js(n,t,{intersect:e.intersect,axis:"x"})},y(n,t,e){return Js(n,t,{intersect:e.intersect,axis:"y"})}}};function Ua(n,t,e){return(ld.modes[e.mode]||ld.modes.nearest)(n,t,e)}function M1(n,t,e){return e!=="x"&&e!=="y"?n.inRange(t.x,t.y,"x",!0)||n.inRange(t.x,t.y,"y",!0):n.inRange(t.x,t.y,e,!0)}function S1(n,t,e){return e==="x"?{x:n.x,y:t.y}:e==="y"?{x:t.x,y:n.y}:t}function Js(n,t,e){return n.filter(i=>e.intersect?i.inRange(t.x,t.y):M1(i,t,e.axis))}function D1(n,t,e){let i=Number.POSITIVE_INFINITY;return Js(n,t,e).reduce((s,r)=>{const a=r.getCenterPoint(),o=S1(t,a,e.axis),l=Hn(t,o);return l<i?(s=[r],i=l):l===i&&s.push(r),s},[]).sort((s,r)=>s._index-r._index).slice(0,1)}function On(n,t,e){const i=Math.cos(e),s=Math.sin(e),r=t.x,a=t.y;return{x:r+i*(n.x-r)-s*(n.y-a),y:a+s*(n.x-r)+i*(n.y-a)}}const T1=(n,t)=>t>n||n.length>t.length&&n.slice(0,t.length)===t,En=.001,tr=(n,t,e)=>Math.min(e,Math.max(t,n)),cd=(n,t)=>n.value>=n.start-t&&n.value<=n.end+t;function C1(n,t,e){for(const i of Object.keys(n))n[i]=tr(n[i],t,e);return n}function P1(n,t,e,i){return!n||!t||e<=0?!1:Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)<=Math.pow(e+i,2)}function ud(n,{x:t,y:e,x2:i,y2:s},r,{borderWidth:a,hitTolerance:o}){const l=(a+o)/2,c=n.x>=t-l-En&&n.x<=i+l+En,u=n.y>=e-l-En&&n.y<=s+l+En;return r==="x"?c:(r==="y"||c)&&u}function dd(n,{rect:t,center:e},i,{rotation:s,borderWidth:r,hitTolerance:a}){const o=On(n,e,Nt(-s));return ud(o,t,i,{borderWidth:r,hitTolerance:a})}function An(n,t){const{centerX:e,centerY:i}=n.getProps(["centerX","centerY"],t);return{x:e,y:i}}function O1(n,t,e,i=!0){const s=e.split(".");let r=0;for(const a of t.split(".")){const o=s[r++];if(parseInt(a,10)<parseInt(o,10))break;if(T1(o,a)){if(i)throw new Error(`${n} v${e} is not supported. v${t} or newer is required.`);return!1}}return!0}const hd=n=>typeof n=="string"&&n.endsWith("%"),fd=n=>parseFloat(n)/100,gd=n=>tr(fd(n),0,1),Zi=(n,t)=>({x:n,y:t,x2:n,y2:t,width:0,height:0}),E1={box:n=>Zi(n.centerX,n.centerY),doughnutLabel:n=>Zi(n.centerX,n.centerY),ellipse:n=>({centerX:n.centerX,centerY:n.centerX,radius:0,width:0,height:0}),label:n=>Zi(n.centerX,n.centerY),line:n=>Zi(n.x,n.y),point:n=>({centerX:n.centerX,centerY:n.centerY,radius:0,width:0,height:0}),polygon:n=>Zi(n.centerX,n.centerY)};function Xa(n,t){return t==="start"?0:t==="end"?n:hd(t)?gd(t)*n:n/2}function cn(n,t,e=!0){return typeof t=="number"?t:hd(t)?(e?gd(t):fd(t))*n:n}function A1(n,t){const{x:e,width:i}=n,s=t.textAlign;return s==="center"?e+i/2:s==="end"||s==="right"?e+i:e}function pd(n,t,{borderWidth:e,position:i,xAdjust:s,yAdjust:r},a){const o=it(a),l=t.width+(o?a.width:0)+e,c=t.height+(o?a.height:0)+e,u=Ga(i),d=xd(n.x,l,s,u.x),f=xd(n.y,c,r,u.y);return{x:d,y:f,x2:d+l,y2:f+c,width:l,height:c,centerX:d+l/2,centerY:f+c/2}}function Ga(n,t="center"){return it(n)?{x:Z(n.x,t),y:Z(n.y,t)}:(n=Z(n,t),{x:n,y:n})}const md=(n,t)=>n&&n.autoFit&&t<1;function yd(n,t){const e=n.font,i=ct(e)?e:[e];return md(n,t)?i.map(function(s){const r=Mt(s);return r.size=Math.floor(s.size*t),r.lineHeight=s.lineHeight,Mt(r)}):i.map(s=>Mt(s))}function bd(n){return n&&(Qt(n.xValue)||Qt(n.yValue))}function xd(n,t,e=0,i){return n-Xa(t,i)+e}function ei(n,t,e){const i=e.init;if(i){if(i===!0)return wd(t,e)}else return;return R1(n,t,e)}function _d(n,t,e){let i=!1;return t.forEach(s=>{Jt(n[s])?(i=!0,e[s]=n[s]):Qt(e[s])&&delete e[s]}),i}function wd(n,t){const e=t.type||"line";return E1[e](n)}function R1(n,t,e){const i=dt(e.init,[{chart:n,properties:t,options:e}]);if(i===!0)return wd(t,e);if(it(i))return i}const Ka=new Map,L1=n=>isNaN(n)||n<=0,I1=n=>n.reduce(function(t,e){return t+=e.string,t},"");function er(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function nr(n,{x:t,y:e},i){i&&(n.translate(t,e),n.rotate(Nt(i)),n.translate(-t,-e))}function Ye(n,t){if(t&&t.borderWidth)return n.lineCap=t.borderCapStyle||"butt",n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset,n.lineJoin=t.borderJoinStyle||"miter",n.lineWidth=t.borderWidth,n.strokeStyle=t.borderColor,!0}function ni(n,t){n.shadowColor=t.backgroundShadowColor,n.shadowBlur=t.shadowBlur,n.shadowOffsetX=t.shadowOffsetX,n.shadowOffsetY=t.shadowOffsetY}function ir(n,t){const e=t.content;if(er(e))return{width:cn(e.width,t.width),height:cn(e.height,t.height)};const i=yd(t),s=t.textStrokeWidth,r=ct(e)?e:[e],a=r.join()+I1(i)+s+(n._measureText?"-spriting":"");return Ka.has(a)||Ka.set(a,B1(n,r,i,s)),Ka.get(a)}function vd(n,t,e){const{x:i,y:s,width:r,height:a}=t;n.save(),ni(n,e);const o=Ye(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),Wn(n,{x:i,y:s,w:r,h:a,radius:C1(en(e.borderRadius),0,Math.min(r,a)/2)}),n.closePath(),n.fill(),o&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function kd(n,t,e,i){const s=e.content;if(er(s)){n.save(),n.globalAlpha=Y1(e.opacity,s.style.opacity),n.drawImage(s,t.x,t.y,t.width,t.height),n.restore();return}const r=ct(s)?s:[s],a=yd(e,i),o=e.color,l=ct(o)?o:[o],c=A1(t,e),u=t.y+e.textStrokeWidth/2;n.save(),n.textBaseline="middle",n.textAlign=e.textAlign,N1(n,e)&&H1(n,{x:c,y:u},r,a),W1(n,{x:c,y:u},r,{fonts:a,colors:l}),n.restore()}function N1(n,t){if(t.textStrokeWidth>0)return n.lineJoin="round",n.miterLimit=2,n.lineWidth=t.textStrokeWidth,n.strokeStyle=t.textStrokeColor,!0}function F1(n,t,e,i){const{radius:s,options:r}=t,a=r.pointStyle,o=r.rotation;let l=(o||0)*Or;if(er(a)){n.save(),n.translate(e,i),n.rotate(l),n.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),n.restore();return}L1(s)||z1(n,{x:e,y:i,radius:s,rotation:o,style:a,rad:l})}function z1(n,{x:t,y:e,radius:i,rotation:s,style:r,rad:a}){let o,l,c,u;switch(n.beginPath(),r){default:n.arc(t,e,i,0,yt),n.closePath();break;case"triangle":n.moveTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=hs,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=hs,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),n.closePath();break;case"rectRounded":u=i*.516,c=i-u,o=Math.cos(a+fe)*c,l=Math.sin(a+fe)*c,n.arc(t-o,e-l,u,a-rt,a-xt),n.arc(t+l,e-o,u,a-xt,a),n.arc(t+o,e+l,u,a,a+xt),n.arc(t-l,e+o,u,a+xt,a+rt),n.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,n.rect(t-c,e-c,2*c,2*c);break}a+=fe;case"rectRot":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+l,e-o),n.lineTo(t+o,e+l),n.lineTo(t-l,e+o),n.closePath();break;case"crossRot":a+=fe;case"cross":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"star":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o),a+=fe,o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"line":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l);break;case"dash":n.moveTo(t,e),n.lineTo(t+Math.cos(a)*i,e+Math.sin(a)*i);break}n.fill()}function B1(n,t,e,i){n.save();const s=t.length;let r=0,a=i;for(let o=0;o<s;o++){const l=e[Math.min(o,e.length-1)];n.font=l.string;const c=t[o];r=Math.max(r,n.measureText(c).width+i),a+=l.lineHeight}return n.restore(),{width:r,height:a}}function H1(n,{x:t,y:e},i,s){n.beginPath();let r=0;i.forEach(function(a,o){const l=s[Math.min(o,s.length-1)],c=l.lineHeight;n.font=l.string,n.strokeText(a,t,e+c/2+r),r+=c}),n.stroke()}function W1(n,{x:t,y:e},i,{fonts:s,colors:r}){let a=0;i.forEach(function(o,l){const c=r[Math.min(l,r.length-1)],u=s[Math.min(l,s.length-1)],d=u.lineHeight;n.beginPath(),n.font=u.string,n.fillStyle=c,n.fillText(o,t,e+d/2+a),a+=d,n.fill()})}function Y1(n,t){const e=tn(n)?n:t;return tn(e)?tr(e,0,1):1}const Md=["left","bottom","top","right"];function V1(n,t){const{pointX:e,pointY:i,options:s}=t,r=s.callout,a=r&&r.display&&X1(t,r);if(!a||K1(t,r,a))return;if(n.save(),n.beginPath(),!Ye(n,r))return n.restore();const{separatorStart:l,separatorEnd:c}=j1(t,a),{sideStart:u,sideEnd:d}=q1(t,a,l);(r.margin>0||s.borderWidth===0)&&(n.moveTo(l.x,l.y),n.lineTo(c.x,c.y)),n.moveTo(u.x,u.y),n.lineTo(d.x,d.y);const f=On({x:e,y:i},t.getCenterPoint(),Nt(-t.rotation));n.lineTo(f.x,f.y),n.stroke(),n.restore()}function j1(n,t){const{x:e,y:i,x2:s,y2:r}=n,a=$1(n,t);let o,l;return t==="left"||t==="right"?(o={x:e+a,y:i},l={x:o.x,y:r}):(o={x:e,y:i+a},l={x:s,y:o.y}),{separatorStart:o,separatorEnd:l}}function $1(n,t){const{width:e,height:i,options:s}=n,r=s.callout.margin+s.borderWidth/2;return t==="right"?e+r:t==="bottom"?i+r:-r}function q1(n,t,e){const{y:i,width:s,height:r,options:a}=n,o=a.callout.start,l=U1(t,a.callout);let c,u;return t==="left"||t==="right"?(c={x:e.x,y:i+cn(r,o)},u={x:c.x+l,y:c.y}):(c={x:e.x+cn(s,o),y:e.y},u={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:u}}function U1(n,t){const e=t.side;return n==="left"||n==="top"?-e:e}function X1(n,t){const e=t.position;return Md.includes(e)?e:G1(n,t)}function G1(n,t){const{x:e,y:i,x2:s,y2:r,width:a,height:o,pointX:l,pointY:c,centerX:u,centerY:d,rotation:f}=n,g={x:u,y:d},p=t.start,b=cn(a,p),_=cn(o,p),w=[e,e+b,e+b,s],k=[i+_,r,i,r],M=[];for(let C=0;C<4;C++){const S=On({x:w[C],y:k[C]},g,Nt(f));M.push({position:Md[C],distance:Hn(S,{x:l,y:c})})}return M.sort((C,S)=>C.distance-S.distance)[0].position}function K1(n,t,e){const{pointX:i,pointY:s}=n,r=t.margin;let a=i,o=s;return e==="left"?a+=r:e==="right"?a-=r:e==="top"?o+=r:e==="bottom"&&(o-=r),n.inRange(a,o)}const Sd={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 ii(n,t,e){return t=typeof t=="number"?t:n.parse(t),kt(t)?n.getPixelForValue(t):e}function Rn(n,t,e){const i=t[e];if(i||e==="scaleID")return i;const s=e.charAt(0),r=Object.values(n).filter(a=>a.axis&&a.axis===s);return r.length?r[0].id:s}function Dd(n,t){if(n){const e=n.options.reverse,i=ii(n,t.min,e?t.end:t.start),s=ii(n,t.max,e?t.start:t.end);return{start:i,end:s}}}function Td(n,t){const{chartArea:e,scales:i}=n,s=i[Rn(i,t,"xScaleID")],r=i[Rn(i,t,"yScaleID")];let a=e.width/2,o=e.height/2;return s&&(a=ii(s,t.xValue,s.left+s.width/2)),r&&(o=ii(r,t.yValue,r.top+r.height/2)),{x:a,y:o}}function Za(n,t){const e=n.scales,i=e[Rn(e,t,"xScaleID")],s=e[Rn(e,t,"yScaleID")];if(!i&&!s)return{};let{left:r,right:a}=i||n.chartArea,{top:o,bottom:l}=s||n.chartArea;const c=Od(i,{min:t.xMin,max:t.xMax,start:r,end:a});r=c.start,a=c.end;const u=Od(s,{min:t.yMin,max:t.yMax,start:l,end:o});return o=u.start,l=u.end,{x:r,y:o,x2:a,y2:l,width:a-r,height:l-o,centerX:r+(a-r)/2,centerY:o+(l-o)/2}}function Cd(n,t){if(!bd(t)){const e=Za(n,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(e.width,e.height)/2,t.radius=i);const s=i*2,r=e.centerX+t.xAdjust,a=e.centerY+t.yAdjust;return{x:r-i,y:a-i,x2:r+i,y2:a+i,centerX:r,centerY:a,width:s,height:s,radius:i}}return Q1(n,t)}function Z1(n,t){const{scales:e,chartArea:i}=n,s=e[t.scaleID],r={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?J1(s,r,t):tv(e,r,t),r}function Pd(n,t){const e=Za(n,t);return e.initProperties=ei(n,e,t),e.elements=[{type:"label",optionScope:"label",properties:iv(n,e,t),initProperties:e.initProperties}],e}function Q1(n,t){const e=Td(n,t),i=t.radius*2;return{x:e.x-t.radius+t.xAdjust,y:e.y-t.radius+t.yAdjust,x2:e.x+t.radius+t.xAdjust,y2:e.y+t.radius+t.yAdjust,centerX:e.x+t.xAdjust,centerY:e.y+t.yAdjust,radius:t.radius,width:i,height:i}}function Od(n,t){const e=Dd(n,t)||t;return{start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function J1(n,t,e){const i=ii(n,e.value,NaN),s=ii(n,e.endValue,i);n.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function tv(n,t,e){for(const i of Object.keys(Sd)){const s=n[Rn(n,e,i)];if(s){const{min:r,max:a,start:o,end:l,startProp:c,endProp:u}=Sd[i],d=Dd(s,{min:e[r],max:e[a],start:s[o],end:s[l]});t[c]=d.start,t[u]=d.end}}}function ev({properties:n,options:t},e,i,s){const{x:r,x2:a,width:o}=n;return Ed({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:e.width})}function nv({properties:n,options:t},e,i,s){const{y:r,y2:a,height:o}=n;return Ed({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:e.height})}function Ed(n,t){const{start:e,end:i,borderWidth:s}=n,{position:r,padding:{start:a,end:o},adjust:l}=t,c=i-s-e-a-o-t.size;return e+s/2+l+Xa(c,r)}function iv(n,t,e){const i=e.label;i.backgroundColor="transparent",i.callout.display=!1;const s=Ga(i.position),r=Ft(i.padding),a=ir(n.ctx,i),o=ev({properties:t,options:e},a,s,r),l=nv({properties:t,options:e},a,s,r),c=a.width+r.width,u=a.height+r.height;return{x:o,y:l,x2:o+c,y2:l+u,width:c,height:u,centerX:o+c/2,centerY:l+u/2,rotation:i.rotation}}const Qa=["enter","leave"],Ja=Qa.concat("click");function sv(n,t,e){t.listened=_d(e,Ja,t.listeners),t.moveListened=!1,Qa.forEach(i=>{Jt(e[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Jt(i.click)&&(t.listened=!0),t.moveListened||Qa.forEach(s=>{Jt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function rv(n,t,e){if(n.listened)switch(t.type){case"mousemove":case"mouseout":return av(n,t,e);case"click":return ov(n,t,e)}}function av(n,t,e){if(!n.moveListened)return;let i;t.type==="mousemove"?i=Ua(n.visibleElements,t,e.interaction):i=[];const s=n.hovered;n.hovered=i;const r={state:n,event:t};let a=Ad(r,"leave",s,i);return Ad(r,"enter",i,s)||a}function Ad({state:n,event:t},e,i,s){let r;for(const a of i)s.indexOf(a)<0&&(r=Rd(a.options[e]||n.listeners[e],a,t)||r);return r}function ov(n,t,e){const i=n.listeners,s=Ua(n.visibleElements,t,e.interaction);let r;for(const a of s)r=Rd(a.options.click||i.click,a,t)||r;return r}function Rd(n,t,e){return dt(n,[t.$context,e])===!0}const sr=["afterDraw","beforeDraw"];function lv(n,t,e){const i=t.visibleElements;t.hooked=_d(e,sr,t.hooks),t.hooked||i.forEach(s=>{t.hooked||sr.forEach(r=>{Jt(s.options[r])&&(t.hooked=!0)})})}function Ld(n,t,e){if(n.hooked){const i=t.options[e]||n.hooks[e];return dt(i,[t.$context])}}function cv(n,t,e){const i=gv(n.scales,t,e);let s=Id(t,i,"min","suggestedMin");s=Id(t,i,"max","suggestedMax")||s,s&&Jt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function uv(n,t){for(const e of n)hv(e,t)}function Id(n,t,e,i){if(kt(t[e])&&!dv(n.options,e,i)){const s=n[e]!==t[e];return n[e]=t[e],s}}function dv(n,t,e){return Qt(n[t])||Qt(n[e])}function hv(n,t){for(const e of["scaleID","xScaleID","yScaleID"]){const i=Rn(t,n,e);i&&!t[i]&&fv(n,e)&&console.warn(`No scale found with id '${i}' for annotation '${n.id}'`)}}function fv(n,t){if(t==="scaleID")return!0;const e=t.charAt(0);for(const i of["Min","Max","Value"])if(Qt(n[e+i]))return!0;return!1}function gv(n,t,e){const i=t.axis,s=t.id,r=i+"ScaleID",a={min:Z(t.min,Number.NEGATIVE_INFINITY),max:Z(t.max,Number.POSITIVE_INFINITY)};for(const o of e)o.scaleID===s?Nd(o,t,["value","endValue"],a):Rn(n,o,r)===s&&Nd(o,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Nd(n,t,e,i){for(const s of e){const r=n[s];if(Qt(r)){const a=t.parse(r);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class si extends Wt{inRange(t,e,i,s){const{x:r,y:a}=On({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation));return ud({x:r,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options)}getCenterPoint(t){return An(this,t)}draw(t){t.save(),nr(t,this.getCenterPoint(),this.options.rotation),vd(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return Pd(t,e)}}si.id="boxAnnotation",si.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},si.defaultRoutes={borderColor:"color",backgroundColor:"color"},si.descriptors={label:{_fallback:!0}};class rr extends Wt{inRange(t,e,i,s){return dd({x:t,y:e},{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 An(this,t)}draw(t){const e=this.options;!e.display||!e.content||(_v(t,this),t.save(),nr(t,this.getCenterPoint(),this.rotation),kd(t,this,e,this._fitRatio),t.restore())}resolveElementProperties(t,e){const i=pv(t,e);if(!i)return{};const{controllerMeta:s,point:r,radius:a}=yv(t,e,i);let o=ir(t.ctx,e);const l=bv(o,a);md(e,l)&&(o={width:o.width*l,height:o.height*l});const{position:c,xAdjust:u,yAdjust:d}=e,f=pd(r,o,{borderWidth:0,position:c,xAdjust:u,yAdjust:d});return{initProperties:ei(t,f,e),...f,...s,rotation:e.rotation,_fitRatio:l}}}rr.id="doughnutLabelAnnotation",rr.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},rr.defaultRoutes={};function pv(n,t){return n.getSortedVisibleDatasetMetas().reduce(function(e,i){const s=i.controller;return s instanceof ze&&mv(n,t,i.data)&&(!e||s.innerRadius<e.controller.innerRadius)&&s.options.circumference>=90?i:e},void 0)}function mv(n,t,e){if(!t.autoHide)return!0;for(let i=0;i<e.length;i++)if(!e[i].hidden&&n.getDataVisibility(i))return!0}function yv({chartArea:n},t,e){const{left:i,top:s,right:r,bottom:a}=n,{innerRadius:o,offsetX:l,offsetY:c}=e.controller,u=(i+r)/2+l,d=(s+a)/2+c,f={left:Math.max(u-o,i),right:Math.min(u+o,r),top:Math.max(d-o,s),bottom:Math.min(d+o,a)},g={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},p=t.spacing+t.borderWidth/2,b=o-p,_=g.y>d,w=_?s+p:a-p,k=xv(w,u,d,b);return{controllerMeta:{_centerX:u,_centerY:d,_radius:b,_counterclockwise:_,...k},point:g,radius:Math.min(o,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function bv({width:n,height:t},e){const i=Math.sqrt(Math.pow(n,2)+Math.pow(t,2));return e*2/i}function xv(n,t,e,i){const s=Math.pow(e-n,2),r=Math.pow(i,2),a=t*-2,o=Math.pow(t,2)+s-r,l=Math.pow(a,2)-4*o;if(l<=0)return{_startAngle:0,_endAngle:yt};const c=(-a-Math.sqrt(l))/2,u=(-a+Math.sqrt(l))/2;return{_startAngle:gs({x:t,y:e},{x:c,y:n}).angle,_endAngle:gs({x:t,y:e},{x:u,y:n}).angle}}function _v(n,t){const{_centerX:e,_centerY:i,_radius:s,_startAngle:r,_endAngle:a,_counterclockwise:o,options:l}=t;n.save();const c=Ye(n,l);n.fillStyle=l.backgroundColor,n.beginPath(),n.arc(e,i,s,r,a,o),n.closePath(),n.fill(),c&&n.stroke(),n.restore()}class Qi extends Wt{inRange(t,e,i,s){return dd({x:t,y:e},{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 An(this,t)}draw(t){const e=this.options,i=!Qt(this._visible)||this._visible;!e.display||!e.content||!i||(t.save(),nr(t,this.getCenterPoint(),this.rotation),V1(t,this),vd(t,this,e),kd(t,wv(this),e),t.restore())}resolveElementProperties(t,e){let i;if(bd(e))i=Td(t,e);else{const{centerX:o,centerY:l}=Za(t,e);i={x:o,y:l}}const s=Ft(e.padding),r=ir(t.ctx,e),a=pd(i,r,e,s);return{initProperties:ei(t,a,e),pointX:i.x,pointY:i.y,...a,rotation:e.rotation}}}Qi.id="labelAnnotation",Qi.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},Qi.defaultRoutes={borderColor:"color"};function wv({x:n,y:t,width:e,height:i,options:s}){const r=s.borderWidth/2,a=Ft(s.padding);return{x:n+a.left+r,y:t+a.top+r,width:e-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}const to=(n,t,e)=>({x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}),eo=(n,t,e)=>to(t,e,Math.abs((n-t.y)/(e.y-t.y))).x,Fd=(n,t,e)=>to(t,e,Math.abs((n-t.x)/(e.x-t.x))).y,Ji=n=>n*n,vv=(n,t,{x:e,y:i,x2:s,y2:r},a)=>a==="y"?{start:Math.min(i,r),end:Math.max(i,r),value:t}:{start:Math.min(e,s),end:Math.max(e,s),value:n},zd=(n,t,e,i)=>(1-i)*(1-i)*n+2*(1-i)*i*t+i*i*e,no=(n,t,e,i)=>({x:zd(n.x,t.x,e.x,i),y:zd(n.y,t.y,e.y,i)}),Bd=(n,t,e,i)=>2*(1-i)*(t-n)+2*i*(e-t),Hd=(n,t,e,i)=>-Math.atan2(Bd(n.x,t.x,e.x,i),Bd(n.y,t.y,e.y,i))+.5*rt;class ts extends Wt{inRange(t,e,i,s){const r=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:e},{path:o,ctx:l}=this;if(o){Ye(l,this.options),l.lineWidth+=this.options.hitTolerance;const{chart:u}=this.$context,d=t*u.currentDevicePixelRatio,f=e*u.currentDevicePixelRatio,g=l.isPointInStroke(o,d,f)||io(this,a,s);return l.restore(),g}const c=Ji(r);return Dv(this,a,c,s)||io(this,a,s)}return kv(this,{mouseX:t,mouseY:e},i,{hitSize:r,useFinalPosition:s})}getCenterPoint(t){return An(this,t)}draw(t){const{x:e,y:i,x2:s,y2:r,cp:a,options:o}=this;if(t.save(),!Ye(t,o))return t.restore();ni(t,o);const l=Math.sqrt(Math.pow(s-e,2)+Math.pow(r-i,2));if(o.curve&&a)return Lv(t,this,a,l),t.restore();const{startOpts:c,endOpts:u,startAdjust:d,endAdjust:f}=$d(this),g=Math.atan2(r-i,s-e);t.translate(e,i),t.rotate(g),t.beginPath(),t.moveTo(0+d,0),t.lineTo(l-f,0),t.shadowColor=o.borderShadowColor,t.stroke(),so(t,0,d,c),so(t,l,-f,u),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){const i=Z1(t,e),{x:s,y:r,x2:a,y2:o}=i,l=Mv(i,t.chartArea),c=l?Sv({x:s,y:r},{x:a,y:o},t.chartArea):{x:s,y:r,x2:a,y2:o,width:Math.abs(a-s),height:Math.abs(o-r)};if(c.centerX=(a+s)/2,c.centerY=(o+r)/2,c.initProperties=ei(t,c,e),e.curve){const d={x:c.x,y:c.y},f={x:c.x2,y:c.y2};c.cp=Rv(c,e,Hn(d,f))}const u=Tv(t,c,e.label);return u._visible=l,c.elements=[{type:"label",optionScope:"label",properties:u,initProperties:c.initProperties}],c}}ts.id="lineAnnotation";const Wd={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};ts.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Wd),fill:!1,length:12,start:Object.assign({},Wd),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({},Qi.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},ts.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},ts.defaultRoutes={borderColor:"color"};function kv(n,{mouseX:t,mouseY:e},i,{hitSize:s,useFinalPosition:r}){const a=vv(t,e,n.getProps(["x","y","x2","y2"],r),i);return cd(a,s)||io(n,{mouseX:t,mouseY:e},r,i)}function Mv({x:n,y:t,x2:e,y2:i},{top:s,right:r,bottom:a,left:o}){return!(n<o&&e<o||n>r&&e>r||t<s&&i<s||t>a&&i>a)}function Yd({x:n,y:t},e,{top:i,right:s,bottom:r,left:a}){return n<a&&(t=Fd(a,{x:n,y:t},e),n=a),n>s&&(t=Fd(s,{x:n,y:t},e),n=s),t<i&&(n=eo(i,{x:n,y:t},e),t=i),t>r&&(n=eo(r,{x:n,y:t},e),t=r),{x:n,y:t}}function Sv(n,t,e){const{x:i,y:s}=Yd(n,t,e),{x:r,y:a}=Yd(t,n,e);return{x:i,y:s,x2:r,y2:a,width:Math.abs(r-i),height:Math.abs(a-s)}}function Dv(n,{mouseX:t,mouseY:e},i=En,s){const{x:r,y:a,x2:o,y2:l}=n.getProps(["x","y","x2","y2"],s),c=o-r,u=l-a,d=Ji(c)+Ji(u),f=d===0?-1:((t-r)*c+(e-a)*u)/d;let g,p;return f<0?(g=r,p=a):f>1?(g=o,p=l):(g=r+f*c,p=a+f*u),Ji(t-g)+Ji(e-p)<=i}function io(n,{mouseX:t,mouseY:e},i,s){const r=n.label;return r.options.display&&r.inRange(t,e,s,i)}function Tv(n,t,e){const i=e.borderWidth,s=Ft(e.padding),r=ir(n.ctx,e),a=r.width+s.width+i,o=r.height+s.height+i;return Pv(t,e,{width:a,height:o,padding:s},n.chartArea)}function Cv(n){const{x:t,y:e,x2:i,y2:s}=n,r=Math.atan2(s-e,i-t);return r>rt/2?r-rt:r<rt/-2?r+rt:r}function Pv(n,t,e,i){const{width:s,height:r,padding:a}=e,{xAdjust:o,yAdjust:l}=t,c={x:n.x,y:n.y},u={x:n.x2,y:n.y2},d=t.rotation==="auto"?Cv(n):Nt(t.rotation),f=Ov(s,r,d),g=Ev(n,t,{labelSize:f,padding:a},i),p=n.cp?no(c,n.cp,u,g):to(c,u,g),b={size:f.w,min:i.left,max:i.right,padding:a.left},_={size:f.h,min:i.top,max:i.bottom,padding:a.top},w=jd(p.x,b)+o,k=jd(p.y,_)+l;return{x:w-s/2,y:k-r/2,x2:w+s/2,y2:k+r/2,centerX:w,centerY:k,pointX:p.x,pointY:p.y,width:s,height:r,rotation:fs(d)}}function Ov(n,t,e){const i=Math.cos(e),s=Math.sin(e);return{w:Math.abs(n*i)+Math.abs(t*s),h:Math.abs(n*s)+Math.abs(t*i)}}function Ev(n,t,e,i){let s;const r=Av(n,i);return t.position==="start"?s=Vd({w:n.x2-n.x,h:n.y2-n.y},e,t,r):t.position==="end"?s=1-Vd({w:n.x-n.x2,h:n.y-n.y2},e,t,r):s=Xa(1,t.position),s}function Vd(n,t,e,i){const{labelSize:s,padding:r}=t,a=n.w*i.dx,o=n.h*i.dy,l=a>0&&(s.w/2+r.left-i.x)/a,c=o>0&&(s.h/2+r.top-i.y)/o;return tr(Math.max(l,c),0,.25)}function Av(n,t){const{x:e,x2:i,y:s,y2:r}=n,a=Math.min(s,r)-t.top,o=Math.min(e,i)-t.left,l=t.bottom-Math.max(s,r),c=t.right-Math.max(e,i);return{x:Math.min(o,c),y:Math.min(a,l),dx:o<=c?1:-1,dy:a<=l?1:-1}}function jd(n,t){const{size:e,min:i,max:s,padding:r}=t,a=e/2;return e>s-i?(s+i)/2:(i>=n-r-a&&(n=i+r+a),s<=n+r+a&&(n=s-r-a),n)}function $d(n){const t=n.options,e=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:e,endOpts:i,startAdjust:qd(n,e),endAdjust:qd(n,i)}}function qd(n,t){if(!t||!t.display)return 0;const{length:e,width:i}=t,s=n.options.borderWidth/2,r={x:e,y:i+s};return Math.abs(eo(0,r,{x:0,y:s}))}function so(n,t,e,i){if(!i||!i.display)return;const{length:s,width:r,fill:a,backgroundColor:o,borderColor:l}=i,c=Math.abs(t-s)+e;n.beginPath(),ni(n,i),Ye(n,i),n.moveTo(c,-r),n.lineTo(t+e,0),n.lineTo(c,r),a===!0?(n.fillStyle=o||l,n.closePath(),n.fill(),n.shadowColor="transparent"):n.shadowColor=i.borderShadowColor,n.stroke()}function Rv(n,t,e){const{x:i,y:s,x2:r,y2:a,centerX:o,centerY:l}=n,c=Math.atan2(a-s,r-i),u=Ga(t.controlPoint,0),d={x:o+cn(e,u.x,!1),y:l+cn(e,u.y,!1)};return On(d,{x:o,y:l},c)}function Ud(n,{x:t,y:e},{angle:i,adjust:s},r){!r||!r.display||(n.save(),n.translate(t,e),n.rotate(i),so(n,0,-s,r),n.restore())}function Lv(n,t,e,i){const{x:s,y:r,x2:a,y2:o,options:l}=t,{startOpts:c,endOpts:u,startAdjust:d,endAdjust:f}=$d(t),g={x:s,y:r},p={x:a,y:o},b=Hd(g,e,p,0),_=Hd(g,e,p,1)-rt,w=no(g,e,p,d/i),k=no(g,e,p,1-f/i),M=new Path2D;n.beginPath(),M.moveTo(w.x,w.y),M.quadraticCurveTo(e.x,e.y,k.x,k.y),n.shadowColor=l.borderShadowColor,n.stroke(M),t.path=M,t.ctx=n,Ud(n,w,{angle:b,adjust:d},c),Ud(n,k,{angle:_,adjust:f},u)}class es extends Wt{inRange(t,e,i,s){const r=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y")return Iv({x:t,y:e},this.getProps(["width","height","centerX","centerY"],s),r,a);const{x:o,y:l,x2:c,y2:u}=this.getProps(["x","y","x2","y2"],s),d=i==="y"?{start:l,end:u}:{start:o,end:c},f=On({x:t,y:e},this.getCenterPoint(s),Nt(-r));return f[i]>=d.start-a-En&&f[i]<=d.end+a+En}getCenterPoint(t){return An(this,t)}draw(t){const{width:e,height:i,centerX:s,centerY:r,options:a}=this;t.save(),nr(t,this.getCenterPoint(),a.rotation),ni(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const o=Ye(t,a);t.ellipse(s,r,i/2,e/2,rt/2,0,2*rt),t.fill(),o&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return Pd(t,e)}}es.id="ellipseAnnotation",es.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},si.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},es.defaultRoutes={borderColor:"color",backgroundColor:"color"},es.descriptors={label:{_fallback:!0}};function Iv(n,t,e,i){const{width:s,height:r,centerX:a,centerY:o}=t,l=s/2,c=r/2;if(l<=0||c<=0)return!1;const u=Nt(e||0),d=Math.cos(u),f=Math.sin(u),g=Math.pow(d*(n.x-a)+f*(n.y-o),2),p=Math.pow(f*(n.x-a)-d*(n.y-o),2);return g/Math.pow(l+i,2)+p/Math.pow(c+i,2)<=1.0001}class ar extends Wt{inRange(t,e,i,s){const{x:r,y:a,x2:o,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),u=(this.options.borderWidth+this.options.hitTolerance)/2;return i!=="x"&&i!=="y"?P1({x:t,y:e},this.getCenterPoint(s),c/2,u):cd(i==="y"?{start:a,end:l,value:e}:{start:r,end:o,value:t},u)}getCenterPoint(t){return An(this,t)}draw(t){const e=this.options,i=e.borderWidth;if(e.radius<.1)return;t.save(),t.fillStyle=e.backgroundColor,ni(t,e);const s=Ye(t,e);F1(t,this,this.centerX,this.centerY),s&&!er(e.pointStyle)&&(t.shadowColor=e.borderShadowColor,t.stroke()),t.restore(),e.borderWidth=i}resolveElementProperties(t,e){const i=Cd(t,e);return i.initProperties=ei(t,i,e),i}}ar.id="pointAnnotation",ar.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},ar.defaultRoutes={borderColor:"color",backgroundColor:"color"};class or extends Wt{inRange(t,e,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&Fv(this.elements,t,e,s);const r=On({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),o=Math.min(...a),l=Math.max(...a);return r[i]>=o&&r[i]<=l}getCenterPoint(t){return An(this,t)}draw(t){const{elements:e,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,ni(t,i);const s=Ye(t,i);let r=!0;for(const a of e)r?(t.moveTo(a.x,a.y),r=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,e){const i=Cd(t,e),{sides:s,rotation:r}=e,a=[],o=2*rt/s;let l=r*Or;for(let c=0;c<s;c++,l+=o){const u=Nv(i,e,l);u.initProperties=ei(t,i,e),a.push(u)}return i.elements=a,i}}or.id="polygonAnnotation",or.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},or.defaultRoutes={borderColor:"color",backgroundColor:"color"};function Nv({centerX:n,centerY:t},{radius:e,borderWidth:i,hitTolerance:s},r){const a=(i+s)/2,o=Math.sin(r),l=Math.cos(r),c={x:n+o*e,y:t-l*e};return{type:"point",optionScope:"point",properties:{x:c.x,y:c.y,centerX:c.x,centerY:c.y,bX:n+o*(e+a),bY:t-l*(e+a)}}}function Fv(n,t,e,i){let s=!1,r=n[n.length-1].getProps(["bX","bY"],i);for(const a of n){const o=a.getProps(["bX","bY"],i);o.bY>e!=r.bY>e&&t<(r.bX-o.bX)*(e-o.bY)/(r.bY-o.bY)+o.bX&&(s=!s),r=o}return s}const un={box:si,doughnutLabel:rr,ellipse:es,label:Qi,line:ts,point:ar,polygon:or};Object.keys(un).forEach(n=>{_t.describe(`elements.${un[n].id}`,{_fallback:"plugins.annotation.common"})});const zv={update:Object.assign},Bv=Ja.concat(sr),Xd=(n,t)=>it(t)?oo(n,t):n,ro=n=>n==="color"||n==="font";function ao(n="line"){return un[n]?n:(console.warn(`Unknown annotation type: '${n}', defaulting to 'line'`),"line")}function Hv(n,t,e,i){const s=Yv(n,e.animations,i),r=t.annotations,a=$v(t.elements,r);for(let o=0;o<r.length;o++){const l=r[o],c=Gd(a,o,l.type),u=l.setContext(jv(n,c,a,l)),d=c.resolveElementProperties(n,u);d.skip=Wv(d),"elements"in d&&(Vv(c,d.elements,u,s),delete d.elements),Qt(c.x)||Object.assign(c,d),Object.assign(c,d.initProperties),d.options=Kd(u),s.update(c,d)}}function Wv(n){return isNaN(n.x)||isNaN(n.y)}function Yv(n,t,e){return e==="reset"||e==="none"||e==="resize"?zv:new jr(n,t)}function Vv(n,t,e,i){const s=n.elements||(n.elements=[]);s.length=t.length;for(let r=0;r<t.length;r++){const a=t[r],o=a.properties,l=Gd(s,r,a.type,a.initProperties),c=e[a.optionScope].override(a);o.options=Kd(c),i.update(l,o)}}function Gd(n,t,e,i){const s=un[ao(e)];let r=n[t];return(!r||!(r instanceof s))&&(r=n[t]=new s,Object.assign(r,i)),r}function Kd(n){const t=un[ao(n.type)],e={};e.id=n.id,e.type=n.type,e.drawTime=n.drawTime,Object.assign(e,oo(n,t.defaults),oo(n,t.defaultRoutes));for(const i of Bv)e[i]=n[i];return e}function oo(n,t){const e={};for(const i of Object.keys(t)){const s=t[i],r=n[i];ro(i)&&ct(r)?e[i]=r.map(a=>Xd(a,s)):e[i]=Xd(r,s)}return e}function jv(n,t,e,i){return t.$context||(t.$context=Object.assign(Object.create(n.getContext()),{element:t,get elements(){return e.filter(s=>s&&s.options)},id:i.id,type:"annotation"}))}function $v(n,t){const e=t.length,i=n.length;if(i<e){const s=e-i;n.splice(i,0,...new Array(s))}else i>e&&n.splice(e,i-e);return n}var qv="3.1.0";const dn=new Map,Zd=n=>n.type!=="doughnutLabel",Uv=Ja.concat(sr);var Qd={id:"annotation",version:qv,beforeRegister(){O1("chart.js","4.0",ge.version)},afterRegister(){ge.register(un)},afterUnregister(){ge.unregister(un)},beforeInit(n){dn.set(n,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(n,t,e){const i=dn.get(n),s=i.annotations=[];let r=e.annotations;it(r)?Object.keys(r).forEach(a=>{const o=r[a];it(o)&&(o.id=a,s.push(o))}):ct(r)&&s.push(...r),uv(s.filter(Zd),n.scales)},afterDataLimits(n,t){const e=dn.get(n);cv(n,t.scale,e.annotations.filter(Zd).filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(n,t,e){const i=dn.get(n);sv(n,i,e),Hv(n,i,e,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),lv(n,i,e)},beforeDatasetsDraw(n,t,e){ns(n,"beforeDatasetsDraw",e.clip)},afterDatasetsDraw(n,t,e){ns(n,"afterDatasetsDraw",e.clip)},beforeDatasetDraw(n,t,e){ns(n,t.index,e.clip)},beforeDraw(n,t,e){ns(n,"beforeDraw",e.clip)},afterDraw(n,t,e){ns(n,"afterDraw",e.clip)},beforeEvent(n,t,e){const i=dn.get(n);rv(i,t.event,e)&&(t.changed=!0)},afterDestroy(n){dn.delete(n)},getAnnotations(n){const t=dn.get(n);return t?t.elements:[]},_getAnnotationElementsAtEventForMode(n,t,e){return Ua(n,t,e)},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:n=>!Uv.includes(n)&&n!=="init",annotations:{_allKeys:!1,_fallback:(n,t)=>`elements.${un[ao(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:ro,_fallback:!0},_indexable:ro}},additionalOptionScopes:[""]};function ns(n,t,e){const{ctx:i,chartArea:s}=n,r=dn.get(n);e&&xi(i,s);const a=Xv(r.visibleElements,t).sort((o,l)=>o.element.options.z-l.element.options.z);for(const o of a)Gv(i,s,r,o);e&&_i(i)}function Xv(n,t){const e=[];for(const i of n)if(i.options.drawTime===t&&e.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&e.push({element:s});return e}function Gv(n,t,e,i){const s=i.element;i.main?(Ld(e,s,"beforeDraw"),s.draw(n,t),Ld(e,s,"afterDraw")):s.draw(n,t)}const Jd="#6c7489",Kv="#995c00",th="20px",Zv="20px",eh="24px",Qv="40px",Jv="48px",tk={class:"tooltip-title"},ek={class:"title font-bold"},nk={key:1,class:"subtitle"},ik={class:"tooltip"},sk={key:0},rk={class:"display-label"},ak={class:"display-value"},ok=h.defineComponent({__name:"ChartTooltip",props:{showTooltip:{type:Boolean,required:!0,default:!1},left:{type:String,required:!1,default:null},top:{type:String,required:!1,default:null},tooltipTitle:{type:String,required:!1,default:""},context:{type:[String,Number],required:!1,default:""},series:{type:Array,required:!0,default:()=>[]},locked:{type:Boolean,required:!1,default:!1}},emits:["dimensions","top","left"],setup(n,{emit:t}){const e=t,i=n,s=h.ref(null),r=h.ref(!1),a=h.ref({x:0,y:0}),o=h.ref({x:0,y:0}),l=h.ref({left:i.left,top:i.top});h.watch(s,g=>{if(g){const{width:p,height:b}=g.getBoundingClientRect();e("dimensions",{width:p,height:b})}}),h.watch(()=>i.locked,g=>{g?(l.value.left=i.left,l.value.top=i.top):g===!1&&(e("top",l.value.top),e("left",l.value.left))});function c(g){if(s.value){r.value=!0;const p=window.getComputedStyle(s.value),b=p.transform||p.webkitTransform||p.mozTransform,_=new DOMMatrix(b),w=_.m41,k=_.m42;a.value={x:w,y:k},o.value={x:g.clientX,y:g.clientY},window.addEventListener("mousemove",d),window.addEventListener("mouseup",f)}}let u=null;function d(g){g.preventDefault(),g.stopPropagation(),r.value&&(u!==null&&window.cancelAnimationFrame(u),u=window.requestAnimationFrame(()=>{const p=g.clientX-o.value.x,b=g.clientY-o.value.y;l.value.left=`${a.value.x+p}px`,l.value.top=`${a.value.y+b}px`}))}function f(){r.value=!1,u!==null&&window.cancelAnimationFrame(u),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",f)}return(g,p)=>n.showTooltip?(h.openBlock(),h.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:h.normalizeClass(["tooltip-container",{locked:n.locked}]),style:h.normalizeStyle({transform:n.locked?`translate(${l.value.left}, ${l.value.top})`:`translate(${n.left}, ${n.top})`,left:"0",top:"0",pointerEvents:n.locked?"all":"none"}),onMousedown:c},[h.createElementVNode("div",tk,[h.createElementVNode("span",ek,h.toDisplayString(n.tooltipTitle),1),n.locked?(h.openBlock(),h.createBlock(h.unref(kr.DragIcon),{key:0,class:"drag-icon",color:h.unref(Jd)},null,8,["color"])):h.createCommentVNode("",!0),n.context?(h.openBlock(),h.createElementBlock("span",nk,h.toDisplayString(n.context),1)):h.createCommentVNode("",!0)]),h.createElementVNode("ul",ik,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.series,({backgroundColor:b,borderColor:_,label:w,value:k})=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:w},[n.series.length?(h.openBlock(),h.createElementBlock("li",sk,[h.createElementVNode("div",{class:"square-marker",style:h.normalizeStyle({background:b,"border-color":_})},null,4),h.createElementVNode("span",rk,h.toDisplayString(w),1),h.createElementVNode("span",ak,h.toDisplayString(k),1)])):h.createCommentVNode("",!0)],64))),128))])],38)):h.createCommentVNode("",!0)}}),Ve=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},lo=Ve(ok,[["__scopeId","data-v-06b92295"]]),lk=["onClick"],ck=["title"],uk={key:0,class:"sub-label"},co=Ve(h.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(n){h.useCssVars(M=>({12487160:o.value}));const t=n,e=h.ref(),i=h.ref([]),s=h.inject("showLegendValues",!0),r=h.inject("legendPosition",h.ref(Ot.Right)),a=h.ref([]),o=h.ref(eh),l=()=>{const M=e.value;if(!M||!i.value||M.children.length===0)return 0;const C=M.children[0].getBoundingClientRect().top;for(const S of i.value)if(S.getBoundingClientRect().top>C)return!0;return!1},c=h.computed(()=>t.items.length>2||r.value===Ot.Right),u=()=>{e.value&&r.value===Ot.Bottom&&(l()?o.value=Jv:o.value=eh)},d=()=>{if(e.value&&r.value===Ot.Bottom){let M=0;i.value.forEach(S=>{const O=Array.from(S.children).reduce((T,y)=>T+y.offsetWidth,0);O>M&&(M=O)});const C=parseInt(Qv,10);e.value.style.gridTemplateColumns=`repeat(auto-fit, ${M+C}px)`}u()},f=()=>{if(t.items.length!==a.value.length)return a.value=t.items,!0;for(let M=0;M<t.items.length;M++)if(t.items[M].text!==a.value[M].text)return a.value=t.items,!0;return!1};h.watch(()=>t.items,()=>{f()&&d()},{immediate:!0,flush:"post"});const g=h.ref(0),p=h.ref(0),b=new ResizeObserver(vu(M=>{const C=M[0],S=C.contentRect.width,O=C.contentRect.height;S!==g.value&&O===p.value&&d(),g.value=S,p.value=O},100));h.watch(()=>r.value,()=>{d()}),h.onMounted(()=>{a.value=t.items,e.value&&b.observe(e.value),window.requestAnimationFrame(()=>{d()})}),h.onBeforeUnmount(()=>{e.value&&b.unobserve(e.value)});const _=(M=0,C)=>{if(t.chartInstance===null)return;const S=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart;w(M,C)?S.hide(M,C):S.show(M,C),S.update()},w=(M=0,C)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const S=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart,O=S.getDatasetMeta(M);return O.dataset||C===void 0?S.isDatasetVisible(M):!(O.data.length&&O.data[C].hidden)},k=M=>({[Ot.Right]:"vertical",[Ot.Bottom]:"horizontal",[Ot.Hidden]:"hidden"})[M];return(M,C)=>h.unref(r)!==h.unref(Ot).Hidden?(h.openBlock(),h.createElementBlock("ul",{key:0,ref_key:"legendContainerRef",ref:e,class:h.normalizeClass(["legend-container",k(h.unref(r))]),"data-testid":"legend"},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.items,({fillStyle:S,strokeStyle:O,text:T,datasetIndex:y,index:x,value:D})=>(h.openBlock(),h.createElementBlock("li",{key:T,ref_for:!0,ref_key:"legendItemsRef",ref:i,onClick:R=>_(y,x)},[h.createElementVNode("div",{class:"square-marker",style:h.normalizeStyle({background:S,"border-color":O})},null,4),h.createElementVNode("div",{class:h.normalizeClass(["label-container",{"strike-through":!w(y,x)}])},[h.createElementVNode("div",{class:h.normalizeClass(["label",{"truncate-label":c.value}]),title:T},h.toDisplayString(T),11,ck),D&&h.unref(s)?(h.openBlock(),h.createElementBlock("div",uk,h.toDisplayString(D.formatted),1)):h.createCommentVNode("",!0)],2)],8,lk))),128))],2)):h.createCommentVNode("",!0)}}),[["__scopeId","data-v-8e9f2f19"]]);for(var Vt=[],uo=0;uo<256;++uo)Vt.push((uo+256).toString(16).slice(1));function dk(n,t=0){return(Vt[n[t+0]]+Vt[n[t+1]]+Vt[n[t+2]]+Vt[n[t+3]]+"-"+Vt[n[t+4]]+Vt[n[t+5]]+"-"+Vt[n[t+6]]+Vt[n[t+7]]+"-"+Vt[n[t+8]]+Vt[n[t+9]]+"-"+Vt[n[t+10]]+Vt[n[t+11]]+Vt[n[t+12]]+Vt[n[t+13]]+Vt[n[t+14]]+Vt[n[t+15]]).toLowerCase()}var lr,hk=new Uint8Array(16);function fk(){if(!lr&&(lr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!lr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return lr(hk)}var gk=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const nh={randomUUID:gk};function hn(n,t,e){if(nh.randomUUID&&!t&&!n)return nh.randomUUID();n=n||{};var i=n.random||(n.rng||fk)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,dk(i)}const ih=(n,t)=>{const e=n.ctx,i=n.scales.y,s=n.scales.x,r=t[t.length-1].element;e.save(),e.strokeStyle="rgba(100, 100, 100, 1)",e.lineWidth=3,n.options.indexAxis==="x"?e.strokeRect(r.x-r.width/2,r.y,r.width,i.bottom-r.y):e.strokeRect(s.left,r.y-r.height/2,r.x-s.left,r.height),e.restore()},sh={id:"highlightPlugin",clicked:!1,afterDatasetsDraw:function(n){this.clickedElements&&this.clickedElements.length&&ih(n,this.clickedElements)},afterEvent:function(n,{event:t}){var s;if(t.type!=="click"||!t.native)return;this.clicked=!this.clicked;const e=((s=n.options.interaction)==null?void 0:s.mode)||"index",i=n.getElementsAtEventForMode(t.native,e,{intersect:!1},!0);i.length&&this.clicked?(this.clickedElements=i,ih(n,this.clickedElements),this.previousHoverOption=n.options.hover,n.options.hover={mode:null}):(delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1)},beforeDestroy(n){delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1}},rh=6,pk="100%",mk="100%",yk=20,bk=20,ah=6,xk=0,_k=10,wk=10,vk=1,kk=Ve(h.defineComponent({__name:"StackedBarChart",props:{chartData:{type:Object,required:!1,default:()=>({labels:[],datasets:[]})},tooltipTitle:{type:String,required:!1,default:""},legendValues:{type:Object,required:!1,default:null},metricUnit:{type:String,required:!1,default:""},orientation:{type:String,required:!1,default:"horizontal",validator:n=>["horizontal","vertical"].includes(n)},annotations:{type:Boolean,required:!1,default:!0},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},stacked:{type:Boolean,required:!1,default:!0},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue}},setup(n){const t=n,{i18n:e}=ut.useI18n(),{translateUnit:i}=ut.useTranslatedUnits(),s=h.ref(null),r=({chart:E},I)=>{var K;const W=E.data,q=(K=W.labels)==null?void 0:K.indexOf(I);return W.datasets.reduce((V,Y,et)=>{if(E.isDatasetVisible(et)){const X=Y.data[q];return isNaN(X)?V:V+X}else return V},0)},a=(E,I,W,q)=>{const K=q==="horizontal";I===null&&(I=e.t("entityNoName"));const V={type:"label",yValue:X=>K?I:r(X,I),xValue:X=>K?r(X,I):I},Y={...V,position:K?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>K?0:-Math.abs(Jx()),content:X=>Ra(r(X,I),W)},et={...V,content:X=>Au(r(X,I),Eu(X.chart,E)),position:K?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:X=>K?Ou(Ra(r(X,I),W)):0,color:Cu};return{[`${I}-value`]:Y,[`${I}-percent`]:et}},o=h.ref(null),l=h.ref(),c=h.ref(hn()),u=hn(),d=hn(),f=h.ref([]),g=h.ref(h.inject("legendPosition",Ot.Right)),p=h.ref({show:!1,top:"0px",left:"0px",text:"",offset:-50}),b=h.toRef(t,"metricUnit"),_=h.computed(()=>h.toRef(t,"orientation").value==="horizontal"),w=h.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:b,translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,locked:!1,chartType:_.value?"horizontal_bar":"vertical_bar",chartTooltipSortFn:t.chartTooltipSortFn}),k=h.ref(0),M=()=>{var E;return t.annotations&&((E=t.chartData.labels)==null?void 0:E.reduce((I,W)=>Object.assign(I,a(t.chartData,W,b.value,t.orientation)),{}))},C={id:c.value,afterUpdate(E){k.value+=1,f.value=E.options.plugins.legend.labels.generateLabels(E).map(I=>({...I,value:t.legendValues&&t.legendValues[I.text]})).sort(t.chartLegendSortFn)}},S={id:u,afterUpdate(E){E.options.plugins.annotation.annotations=t.annotations?M():{}}},y=[C,{id:"axisHover",afterEvent(E,I){if(p.value.show=!1,I.event.type==="mousemove"){const W=I.event,q=E.options.indexAxis,K=E.scales,V=E.scales[q].getLabelForValue(Number(E.scales[q].getValueForPixel(W[q])));if((et=>et==="x"?W.y>K.x.top:W.x<K.y.right)(q))if(w.locked||(w.showTooltip=!1),V.length>Us){const X=E.canvas.getContext("2d").measureText(V).width,wt=Math.abs(Math.round(W.x-X*.5)),lt=Math.round(W.x+X*.5);p.value.left=q==="x"?`${(wt>0?wt:lt)-p.value.offset}px`:`${W.x-X*.5-p.value.offset}px`,p.value.top=`${W.y-50}px`,p.value.show=!0,p.value.text=V}else p.value.show=!1;else p.value.show=!1}}},{id:d,afterUpdate(E){E.options.layout.padding.right=_.value?N.value:0}},sh,...t.annotations?[S]:[]],x=h.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),D=h.ref(0),R=h.ref(0),L=new ResizeObserver(vu(E=>{D.value=E[0].contentRect.width,R.value=E[0].contentRect.height},100)),B=h.computed(()=>{var I,W;const E=(W=(I=t.chartData)==null?void 0:I.labels)==null?void 0:W.length;return o.value&&E&&!_.value?`${Math.max(E*(yk+ah),D.value)}px`:pk}),j=h.computed(()=>{var I,W;const E=(W=(I=t.chartData)==null?void 0:I.labels)==null?void 0:W.length;return o.value&&E&&_.value?`${Math.max(E*(bk+ah),R.value)}px`:mk});ut.useReportChartDataForSynthetics(h.toRef(t,"chartData"),h.toRef(t,"syntheticsDataKey")),h.onMounted(()=>{t.annotations&&ge.register(Qd),s.value&&(D.value=s.value.offsetWidth,R.value=s.value.offsetHeight,L.observe(s.value))}),h.onUnmounted(()=>{s.value&&L.unobserve(s.value)});const G=h.computed(()=>{const E=ut.useBarChartOptions({tooltipState:w,legendID:c.value,stacked:h.toRef(t,"stacked"),metricAxesTitle:h.toRef(t,"metricAxesTitle"),dimensionAxesTitle:h.toRef(t,"dimensionAxesTitle"),indexAxis:_.value?"y":"x",numLabels:x});return{...E.value,plugins:{...E.value.plugins,annotation:{annotations:M(),clip:!1}},layout:{autoPadding:!1,padding:{right:0,top:6*rh}}}}),$=ut.useChartJSCommon("bar",o,h.toRef(t,"chartData"),y,G),N=h.computed(()=>{k.value;const E=t.chartData.labels,I=t.chartData.datasets,W=E.map((V,Y)=>I.reduce((et,X)=>isNaN(Number(X.data[Y]))?et:et+Number(X.data[Y]),0)),q=$.value?Eu($.value,t.chartData):t_(t.chartData);return W.map(V=>Ou(Ra(V,b.value)+Au(V,q))).reduce((V,Y)=>Math.max(V,Y),0)+rh});h.onBeforeUnmount(()=>{ge.unregister(Qd)});const st={[Ot.Right]:"legend-row",[Ot.Bottom]:"column"},z=h.computed(()=>{if(l.value&&$.value){const E=window.devicePixelRatio,I=$.value,W=I.scales.y.width*E+vk,q=(I.scales.y.height+I.scales.y.top+I.scales.x.height)*E,K=l.value.getContext("2d");return K.scale(E,E),K.canvas.width=W,K.canvas.height=q,K.canvas.style.width=`${W/E}px`,K.canvas.style.height=`${q/E}px`,{scale:E,width:W*E,height:q*E,targetCtx:K}}return null}),St=E=>{const I=E.target;if(z.value&&$.value&&!_.value){const W=z.value.scale,q=z.value.targetCtx,K=z.value.width,V=z.value.height,Y=$.value,et=Y.canvas;q.fillStyle="white",I.scrollLeft>=xk&&I.scrollLeft<=_k?(q.globalCompositeOperation="source-over",q.clearRect(0,0,K,V),q.drawImage(et,0,0,K,V,0,0,K,V),q.globalCompositeOperation="destination-over",q.fillRect(0,0,K,V)):(q.globalCompositeOperation="source-over",q.fillRect(0,(Y.scales.y.height+Y.scales.y.top+wk)*W,K,Y.scales.x.height*W))}w.offsetY=I.scrollTop,w.offsetX=I.scrollLeft,p.value.offset=I.scrollLeft},bt=({width:E,height:I})=>{w.width=E,w.height=I};h.watch(()=>t.orientation,()=>{var E;if(l.value&&z.value){const I=z.value.width,W=z.value.height;((E=l.value)==null?void 0:E.getContext("2d")).clearRect(0,0,I,W)}w.showTooltip=!1,w.locked=!1}),h.watch(()=>t.annotations,E=>{$.value&&(E?$.value.options.plugins.annotation.annotations=M(t.chartData):delete $.value.options.plugins.annotation.annotations)});const H=()=>{w.showTooltip&&(w.locked=!w.locked)};return(E,I)=>(h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["chart-parent",st[g.value]])},[h.createElementVNode("canvas",{ref_key:"axis",ref:l,class:"axis"},null,512),h.createElementVNode("div",{ref_key:"chartContainerRef",ref:s,class:"chart-container","on:scroll":St,onClick:I[0]||(I[0]=W=>H())},[h.createElementVNode("div",{class:"chart-body",style:h.normalizeStyle({width:B.value,height:j.value})},[h.createElementVNode("canvas",{ref_key:"canvas",ref:o,class:"chart-canvas"},null,512)],4)],544),p.value.show?(h.openBlock(),h.createElementBlock("div",{key:0,class:"axis-tooltip",style:h.normalizeStyle({top:p.value.top,left:p.value.left})},h.toDisplayString(p.value.text),5)):h.createCommentVNode("",!0),h.createVNode(lo,{context:w.tooltipContext,left:w.left,locked:w.locked,series:w.tooltipSeries,"show-tooltip":w.showTooltip,"tooltip-title":n.tooltipTitle,top:w.top,onDimensions:bt},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top"]),h.createVNode(co,{id:c.value,"chart-instance":h.unref($),items:f.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-251c3e18"]]);/*!
23
+ */const ld={modes:{point(n,t){return Js(n,t,{intersect:!0})},nearest(n,t,e){return D1(n,t,e)},x(n,t,e){return Js(n,t,{intersect:e.intersect,axis:"x"})},y(n,t,e){return Js(n,t,{intersect:e.intersect,axis:"y"})}}};function Ua(n,t,e){return(ld.modes[e.mode]||ld.modes.nearest)(n,t,e)}function M1(n,t,e){return e!=="x"&&e!=="y"?n.inRange(t.x,t.y,"x",!0)||n.inRange(t.x,t.y,"y",!0):n.inRange(t.x,t.y,e,!0)}function S1(n,t,e){return e==="x"?{x:n.x,y:t.y}:e==="y"?{x:t.x,y:n.y}:t}function Js(n,t,e){return n.filter(i=>e.intersect?i.inRange(t.x,t.y):M1(i,t,e.axis))}function D1(n,t,e){let i=Number.POSITIVE_INFINITY;return Js(n,t,e).reduce((s,r)=>{const a=r.getCenterPoint(),o=S1(t,a,e.axis),l=Hn(t,o);return l<i?(s=[r],i=l):l===i&&s.push(r),s},[]).sort((s,r)=>s._index-r._index).slice(0,1)}function On(n,t,e){const i=Math.cos(e),s=Math.sin(e),r=t.x,a=t.y;return{x:r+i*(n.x-r)-s*(n.y-a),y:a+s*(n.x-r)+i*(n.y-a)}}const T1=(n,t)=>t>n||n.length>t.length&&n.slice(0,t.length)===t,En=.001,tr=(n,t,e)=>Math.min(e,Math.max(t,n)),cd=(n,t)=>n.value>=n.start-t&&n.value<=n.end+t;function C1(n,t,e){for(const i of Object.keys(n))n[i]=tr(n[i],t,e);return n}function P1(n,t,e,i){return!n||!t||e<=0?!1:Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)<=Math.pow(e+i,2)}function ud(n,{x:t,y:e,x2:i,y2:s},r,{borderWidth:a,hitTolerance:o}){const l=(a+o)/2,c=n.x>=t-l-En&&n.x<=i+l+En,u=n.y>=e-l-En&&n.y<=s+l+En;return r==="x"?c:(r==="y"||c)&&u}function dd(n,{rect:t,center:e},i,{rotation:s,borderWidth:r,hitTolerance:a}){const o=On(n,e,Nt(-s));return ud(o,t,i,{borderWidth:r,hitTolerance:a})}function An(n,t){const{centerX:e,centerY:i}=n.getProps(["centerX","centerY"],t);return{x:e,y:i}}function O1(n,t,e,i=!0){const s=e.split(".");let r=0;for(const a of t.split(".")){const o=s[r++];if(parseInt(a,10)<parseInt(o,10))break;if(T1(o,a)){if(i)throw new Error(`${n} v${e} is not supported. v${t} or newer is required.`);return!1}}return!0}const hd=n=>typeof n=="string"&&n.endsWith("%"),fd=n=>parseFloat(n)/100,gd=n=>tr(fd(n),0,1),Zi=(n,t)=>({x:n,y:t,x2:n,y2:t,width:0,height:0}),E1={box:n=>Zi(n.centerX,n.centerY),doughnutLabel:n=>Zi(n.centerX,n.centerY),ellipse:n=>({centerX:n.centerX,centerY:n.centerX,radius:0,width:0,height:0}),label:n=>Zi(n.centerX,n.centerY),line:n=>Zi(n.x,n.y),point:n=>({centerX:n.centerX,centerY:n.centerY,radius:0,width:0,height:0}),polygon:n=>Zi(n.centerX,n.centerY)};function Xa(n,t){return t==="start"?0:t==="end"?n:hd(t)?gd(t)*n:n/2}function cn(n,t,e=!0){return typeof t=="number"?t:hd(t)?(e?gd(t):fd(t))*n:n}function A1(n,t){const{x:e,width:i}=n,s=t.textAlign;return s==="center"?e+i/2:s==="end"||s==="right"?e+i:e}function pd(n,t,{borderWidth:e,position:i,xAdjust:s,yAdjust:r},a){const o=it(a),l=t.width+(o?a.width:0)+e,c=t.height+(o?a.height:0)+e,u=Ga(i),d=xd(n.x,l,s,u.x),f=xd(n.y,c,r,u.y);return{x:d,y:f,x2:d+l,y2:f+c,width:l,height:c,centerX:d+l/2,centerY:f+c/2}}function Ga(n,t="center"){return it(n)?{x:Z(n.x,t),y:Z(n.y,t)}:(n=Z(n,t),{x:n,y:n})}const md=(n,t)=>n&&n.autoFit&&t<1;function yd(n,t){const e=n.font,i=ct(e)?e:[e];return md(n,t)?i.map(function(s){const r=Mt(s);return r.size=Math.floor(s.size*t),r.lineHeight=s.lineHeight,Mt(r)}):i.map(s=>Mt(s))}function bd(n){return n&&(Qt(n.xValue)||Qt(n.yValue))}function xd(n,t,e=0,i){return n-Xa(t,i)+e}function ei(n,t,e){const i=e.init;if(i){if(i===!0)return wd(t,e)}else return;return R1(n,t,e)}function _d(n,t,e){let i=!1;return t.forEach(s=>{Jt(n[s])?(i=!0,e[s]=n[s]):Qt(e[s])&&delete e[s]}),i}function wd(n,t){const e=t.type||"line";return E1[e](n)}function R1(n,t,e){const i=dt(e.init,[{chart:n,properties:t,options:e}]);if(i===!0)return wd(t,e);if(it(i))return i}const Ka=new Map,L1=n=>isNaN(n)||n<=0,I1=n=>n.reduce(function(t,e){return t+=e.string,t},"");function er(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function nr(n,{x:t,y:e},i){i&&(n.translate(t,e),n.rotate(Nt(i)),n.translate(-t,-e))}function Ye(n,t){if(t&&t.borderWidth)return n.lineCap=t.borderCapStyle||"butt",n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset,n.lineJoin=t.borderJoinStyle||"miter",n.lineWidth=t.borderWidth,n.strokeStyle=t.borderColor,!0}function ni(n,t){n.shadowColor=t.backgroundShadowColor,n.shadowBlur=t.shadowBlur,n.shadowOffsetX=t.shadowOffsetX,n.shadowOffsetY=t.shadowOffsetY}function ir(n,t){const e=t.content;if(er(e))return{width:cn(e.width,t.width),height:cn(e.height,t.height)};const i=yd(t),s=t.textStrokeWidth,r=ct(e)?e:[e],a=r.join()+I1(i)+s+(n._measureText?"-spriting":"");return Ka.has(a)||Ka.set(a,B1(n,r,i,s)),Ka.get(a)}function vd(n,t,e){const{x:i,y:s,width:r,height:a}=t;n.save(),ni(n,e);const o=Ye(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),Wn(n,{x:i,y:s,w:r,h:a,radius:C1(en(e.borderRadius),0,Math.min(r,a)/2)}),n.closePath(),n.fill(),o&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function kd(n,t,e,i){const s=e.content;if(er(s)){n.save(),n.globalAlpha=Y1(e.opacity,s.style.opacity),n.drawImage(s,t.x,t.y,t.width,t.height),n.restore();return}const r=ct(s)?s:[s],a=yd(e,i),o=e.color,l=ct(o)?o:[o],c=A1(t,e),u=t.y+e.textStrokeWidth/2;n.save(),n.textBaseline="middle",n.textAlign=e.textAlign,N1(n,e)&&H1(n,{x:c,y:u},r,a),W1(n,{x:c,y:u},r,{fonts:a,colors:l}),n.restore()}function N1(n,t){if(t.textStrokeWidth>0)return n.lineJoin="round",n.miterLimit=2,n.lineWidth=t.textStrokeWidth,n.strokeStyle=t.textStrokeColor,!0}function F1(n,t,e,i){const{radius:s,options:r}=t,a=r.pointStyle,o=r.rotation;let l=(o||0)*Or;if(er(a)){n.save(),n.translate(e,i),n.rotate(l),n.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),n.restore();return}L1(s)||z1(n,{x:e,y:i,radius:s,rotation:o,style:a,rad:l})}function z1(n,{x:t,y:e,radius:i,rotation:s,style:r,rad:a}){let o,l,c,u;switch(n.beginPath(),r){default:n.arc(t,e,i,0,yt),n.closePath();break;case"triangle":n.moveTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=hs,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=hs,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),n.closePath();break;case"rectRounded":u=i*.516,c=i-u,o=Math.cos(a+fe)*c,l=Math.sin(a+fe)*c,n.arc(t-o,e-l,u,a-rt,a-xt),n.arc(t+l,e-o,u,a-xt,a),n.arc(t+o,e+l,u,a,a+xt),n.arc(t-l,e+o,u,a+xt,a+rt),n.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,n.rect(t-c,e-c,2*c,2*c);break}a+=fe;case"rectRot":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+l,e-o),n.lineTo(t+o,e+l),n.lineTo(t-l,e+o),n.closePath();break;case"crossRot":a+=fe;case"cross":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"star":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o),a+=fe,o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"line":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l);break;case"dash":n.moveTo(t,e),n.lineTo(t+Math.cos(a)*i,e+Math.sin(a)*i);break}n.fill()}function B1(n,t,e,i){n.save();const s=t.length;let r=0,a=i;for(let o=0;o<s;o++){const l=e[Math.min(o,e.length-1)];n.font=l.string;const c=t[o];r=Math.max(r,n.measureText(c).width+i),a+=l.lineHeight}return n.restore(),{width:r,height:a}}function H1(n,{x:t,y:e},i,s){n.beginPath();let r=0;i.forEach(function(a,o){const l=s[Math.min(o,s.length-1)],c=l.lineHeight;n.font=l.string,n.strokeText(a,t,e+c/2+r),r+=c}),n.stroke()}function W1(n,{x:t,y:e},i,{fonts:s,colors:r}){let a=0;i.forEach(function(o,l){const c=r[Math.min(l,r.length-1)],u=s[Math.min(l,s.length-1)],d=u.lineHeight;n.beginPath(),n.font=u.string,n.fillStyle=c,n.fillText(o,t,e+d/2+a),a+=d,n.fill()})}function Y1(n,t){const e=tn(n)?n:t;return tn(e)?tr(e,0,1):1}const Md=["left","bottom","top","right"];function V1(n,t){const{pointX:e,pointY:i,options:s}=t,r=s.callout,a=r&&r.display&&X1(t,r);if(!a||K1(t,r,a))return;if(n.save(),n.beginPath(),!Ye(n,r))return n.restore();const{separatorStart:l,separatorEnd:c}=j1(t,a),{sideStart:u,sideEnd:d}=q1(t,a,l);(r.margin>0||s.borderWidth===0)&&(n.moveTo(l.x,l.y),n.lineTo(c.x,c.y)),n.moveTo(u.x,u.y),n.lineTo(d.x,d.y);const f=On({x:e,y:i},t.getCenterPoint(),Nt(-t.rotation));n.lineTo(f.x,f.y),n.stroke(),n.restore()}function j1(n,t){const{x:e,y:i,x2:s,y2:r}=n,a=$1(n,t);let o,l;return t==="left"||t==="right"?(o={x:e+a,y:i},l={x:o.x,y:r}):(o={x:e,y:i+a},l={x:s,y:o.y}),{separatorStart:o,separatorEnd:l}}function $1(n,t){const{width:e,height:i,options:s}=n,r=s.callout.margin+s.borderWidth/2;return t==="right"?e+r:t==="bottom"?i+r:-r}function q1(n,t,e){const{y:i,width:s,height:r,options:a}=n,o=a.callout.start,l=U1(t,a.callout);let c,u;return t==="left"||t==="right"?(c={x:e.x,y:i+cn(r,o)},u={x:c.x+l,y:c.y}):(c={x:e.x+cn(s,o),y:e.y},u={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:u}}function U1(n,t){const e=t.side;return n==="left"||n==="top"?-e:e}function X1(n,t){const e=t.position;return Md.includes(e)?e:G1(n,t)}function G1(n,t){const{x:e,y:i,x2:s,y2:r,width:a,height:o,pointX:l,pointY:c,centerX:u,centerY:d,rotation:f}=n,g={x:u,y:d},p=t.start,b=cn(a,p),_=cn(o,p),w=[e,e+b,e+b,s],k=[i+_,r,i,r],M=[];for(let C=0;C<4;C++){const S=On({x:w[C],y:k[C]},g,Nt(f));M.push({position:Md[C],distance:Hn(S,{x:l,y:c})})}return M.sort((C,S)=>C.distance-S.distance)[0].position}function K1(n,t,e){const{pointX:i,pointY:s}=n,r=t.margin;let a=i,o=s;return e==="left"?a+=r:e==="right"?a-=r:e==="top"?o+=r:e==="bottom"&&(o-=r),n.inRange(a,o)}const Sd={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 ii(n,t,e){return t=typeof t=="number"?t:n.parse(t),kt(t)?n.getPixelForValue(t):e}function Rn(n,t,e){const i=t[e];if(i||e==="scaleID")return i;const s=e.charAt(0),r=Object.values(n).filter(a=>a.axis&&a.axis===s);return r.length?r[0].id:s}function Dd(n,t){if(n){const e=n.options.reverse,i=ii(n,t.min,e?t.end:t.start),s=ii(n,t.max,e?t.start:t.end);return{start:i,end:s}}}function Td(n,t){const{chartArea:e,scales:i}=n,s=i[Rn(i,t,"xScaleID")],r=i[Rn(i,t,"yScaleID")];let a=e.width/2,o=e.height/2;return s&&(a=ii(s,t.xValue,s.left+s.width/2)),r&&(o=ii(r,t.yValue,r.top+r.height/2)),{x:a,y:o}}function Za(n,t){const e=n.scales,i=e[Rn(e,t,"xScaleID")],s=e[Rn(e,t,"yScaleID")];if(!i&&!s)return{};let{left:r,right:a}=i||n.chartArea,{top:o,bottom:l}=s||n.chartArea;const c=Od(i,{min:t.xMin,max:t.xMax,start:r,end:a});r=c.start,a=c.end;const u=Od(s,{min:t.yMin,max:t.yMax,start:l,end:o});return o=u.start,l=u.end,{x:r,y:o,x2:a,y2:l,width:a-r,height:l-o,centerX:r+(a-r)/2,centerY:o+(l-o)/2}}function Cd(n,t){if(!bd(t)){const e=Za(n,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(e.width,e.height)/2,t.radius=i);const s=i*2,r=e.centerX+t.xAdjust,a=e.centerY+t.yAdjust;return{x:r-i,y:a-i,x2:r+i,y2:a+i,centerX:r,centerY:a,width:s,height:s,radius:i}}return Q1(n,t)}function Z1(n,t){const{scales:e,chartArea:i}=n,s=e[t.scaleID],r={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?J1(s,r,t):tv(e,r,t),r}function Pd(n,t){const e=Za(n,t);return e.initProperties=ei(n,e,t),e.elements=[{type:"label",optionScope:"label",properties:iv(n,e,t),initProperties:e.initProperties}],e}function Q1(n,t){const e=Td(n,t),i=t.radius*2;return{x:e.x-t.radius+t.xAdjust,y:e.y-t.radius+t.yAdjust,x2:e.x+t.radius+t.xAdjust,y2:e.y+t.radius+t.yAdjust,centerX:e.x+t.xAdjust,centerY:e.y+t.yAdjust,radius:t.radius,width:i,height:i}}function Od(n,t){const e=Dd(n,t)||t;return{start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function J1(n,t,e){const i=ii(n,e.value,NaN),s=ii(n,e.endValue,i);n.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function tv(n,t,e){for(const i of Object.keys(Sd)){const s=n[Rn(n,e,i)];if(s){const{min:r,max:a,start:o,end:l,startProp:c,endProp:u}=Sd[i],d=Dd(s,{min:e[r],max:e[a],start:s[o],end:s[l]});t[c]=d.start,t[u]=d.end}}}function ev({properties:n,options:t},e,i,s){const{x:r,x2:a,width:o}=n;return Ed({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:e.width})}function nv({properties:n,options:t},e,i,s){const{y:r,y2:a,height:o}=n;return Ed({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:e.height})}function Ed(n,t){const{start:e,end:i,borderWidth:s}=n,{position:r,padding:{start:a,end:o},adjust:l}=t,c=i-s-e-a-o-t.size;return e+s/2+l+Xa(c,r)}function iv(n,t,e){const i=e.label;i.backgroundColor="transparent",i.callout.display=!1;const s=Ga(i.position),r=Ft(i.padding),a=ir(n.ctx,i),o=ev({properties:t,options:e},a,s,r),l=nv({properties:t,options:e},a,s,r),c=a.width+r.width,u=a.height+r.height;return{x:o,y:l,x2:o+c,y2:l+u,width:c,height:u,centerX:o+c/2,centerY:l+u/2,rotation:i.rotation}}const Qa=["enter","leave"],Ja=Qa.concat("click");function sv(n,t,e){t.listened=_d(e,Ja,t.listeners),t.moveListened=!1,Qa.forEach(i=>{Jt(e[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Jt(i.click)&&(t.listened=!0),t.moveListened||Qa.forEach(s=>{Jt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function rv(n,t,e){if(n.listened)switch(t.type){case"mousemove":case"mouseout":return av(n,t,e);case"click":return ov(n,t,e)}}function av(n,t,e){if(!n.moveListened)return;let i;t.type==="mousemove"?i=Ua(n.visibleElements,t,e.interaction):i=[];const s=n.hovered;n.hovered=i;const r={state:n,event:t};let a=Ad(r,"leave",s,i);return Ad(r,"enter",i,s)||a}function Ad({state:n,event:t},e,i,s){let r;for(const a of i)s.indexOf(a)<0&&(r=Rd(a.options[e]||n.listeners[e],a,t)||r);return r}function ov(n,t,e){const i=n.listeners,s=Ua(n.visibleElements,t,e.interaction);let r;for(const a of s)r=Rd(a.options.click||i.click,a,t)||r;return r}function Rd(n,t,e){return dt(n,[t.$context,e])===!0}const sr=["afterDraw","beforeDraw"];function lv(n,t,e){const i=t.visibleElements;t.hooked=_d(e,sr,t.hooks),t.hooked||i.forEach(s=>{t.hooked||sr.forEach(r=>{Jt(s.options[r])&&(t.hooked=!0)})})}function Ld(n,t,e){if(n.hooked){const i=t.options[e]||n.hooks[e];return dt(i,[t.$context])}}function cv(n,t,e){const i=gv(n.scales,t,e);let s=Id(t,i,"min","suggestedMin");s=Id(t,i,"max","suggestedMax")||s,s&&Jt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function uv(n,t){for(const e of n)hv(e,t)}function Id(n,t,e,i){if(kt(t[e])&&!dv(n.options,e,i)){const s=n[e]!==t[e];return n[e]=t[e],s}}function dv(n,t,e){return Qt(n[t])||Qt(n[e])}function hv(n,t){for(const e of["scaleID","xScaleID","yScaleID"]){const i=Rn(t,n,e);i&&!t[i]&&fv(n,e)&&console.warn(`No scale found with id '${i}' for annotation '${n.id}'`)}}function fv(n,t){if(t==="scaleID")return!0;const e=t.charAt(0);for(const i of["Min","Max","Value"])if(Qt(n[e+i]))return!0;return!1}function gv(n,t,e){const i=t.axis,s=t.id,r=i+"ScaleID",a={min:Z(t.min,Number.NEGATIVE_INFINITY),max:Z(t.max,Number.POSITIVE_INFINITY)};for(const o of e)o.scaleID===s?Nd(o,t,["value","endValue"],a):Rn(n,o,r)===s&&Nd(o,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Nd(n,t,e,i){for(const s of e){const r=n[s];if(Qt(r)){const a=t.parse(r);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class si extends Wt{inRange(t,e,i,s){const{x:r,y:a}=On({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation));return ud({x:r,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options)}getCenterPoint(t){return An(this,t)}draw(t){t.save(),nr(t,this.getCenterPoint(),this.options.rotation),vd(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return Pd(t,e)}}si.id="boxAnnotation",si.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},si.defaultRoutes={borderColor:"color",backgroundColor:"color"},si.descriptors={label:{_fallback:!0}};class rr extends Wt{inRange(t,e,i,s){return dd({x:t,y:e},{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 An(this,t)}draw(t){const e=this.options;!e.display||!e.content||(_v(t,this),t.save(),nr(t,this.getCenterPoint(),this.rotation),kd(t,this,e,this._fitRatio),t.restore())}resolveElementProperties(t,e){const i=pv(t,e);if(!i)return{};const{controllerMeta:s,point:r,radius:a}=yv(t,e,i);let o=ir(t.ctx,e);const l=bv(o,a);md(e,l)&&(o={width:o.width*l,height:o.height*l});const{position:c,xAdjust:u,yAdjust:d}=e,f=pd(r,o,{borderWidth:0,position:c,xAdjust:u,yAdjust:d});return{initProperties:ei(t,f,e),...f,...s,rotation:e.rotation,_fitRatio:l}}}rr.id="doughnutLabelAnnotation",rr.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},rr.defaultRoutes={};function pv(n,t){return n.getSortedVisibleDatasetMetas().reduce(function(e,i){const s=i.controller;return s instanceof ze&&mv(n,t,i.data)&&(!e||s.innerRadius<e.controller.innerRadius)&&s.options.circumference>=90?i:e},void 0)}function mv(n,t,e){if(!t.autoHide)return!0;for(let i=0;i<e.length;i++)if(!e[i].hidden&&n.getDataVisibility(i))return!0}function yv({chartArea:n},t,e){const{left:i,top:s,right:r,bottom:a}=n,{innerRadius:o,offsetX:l,offsetY:c}=e.controller,u=(i+r)/2+l,d=(s+a)/2+c,f={left:Math.max(u-o,i),right:Math.min(u+o,r),top:Math.max(d-o,s),bottom:Math.min(d+o,a)},g={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},p=t.spacing+t.borderWidth/2,b=o-p,_=g.y>d,w=_?s+p:a-p,k=xv(w,u,d,b);return{controllerMeta:{_centerX:u,_centerY:d,_radius:b,_counterclockwise:_,...k},point:g,radius:Math.min(o,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function bv({width:n,height:t},e){const i=Math.sqrt(Math.pow(n,2)+Math.pow(t,2));return e*2/i}function xv(n,t,e,i){const s=Math.pow(e-n,2),r=Math.pow(i,2),a=t*-2,o=Math.pow(t,2)+s-r,l=Math.pow(a,2)-4*o;if(l<=0)return{_startAngle:0,_endAngle:yt};const c=(-a-Math.sqrt(l))/2,u=(-a+Math.sqrt(l))/2;return{_startAngle:gs({x:t,y:e},{x:c,y:n}).angle,_endAngle:gs({x:t,y:e},{x:u,y:n}).angle}}function _v(n,t){const{_centerX:e,_centerY:i,_radius:s,_startAngle:r,_endAngle:a,_counterclockwise:o,options:l}=t;n.save();const c=Ye(n,l);n.fillStyle=l.backgroundColor,n.beginPath(),n.arc(e,i,s,r,a,o),n.closePath(),n.fill(),c&&n.stroke(),n.restore()}class Qi extends Wt{inRange(t,e,i,s){return dd({x:t,y:e},{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 An(this,t)}draw(t){const e=this.options,i=!Qt(this._visible)||this._visible;!e.display||!e.content||!i||(t.save(),nr(t,this.getCenterPoint(),this.rotation),V1(t,this),vd(t,this,e),kd(t,wv(this),e),t.restore())}resolveElementProperties(t,e){let i;if(bd(e))i=Td(t,e);else{const{centerX:o,centerY:l}=Za(t,e);i={x:o,y:l}}const s=Ft(e.padding),r=ir(t.ctx,e),a=pd(i,r,e,s);return{initProperties:ei(t,a,e),pointX:i.x,pointY:i.y,...a,rotation:e.rotation}}}Qi.id="labelAnnotation",Qi.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},Qi.defaultRoutes={borderColor:"color"};function wv({x:n,y:t,width:e,height:i,options:s}){const r=s.borderWidth/2,a=Ft(s.padding);return{x:n+a.left+r,y:t+a.top+r,width:e-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}const to=(n,t,e)=>({x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}),eo=(n,t,e)=>to(t,e,Math.abs((n-t.y)/(e.y-t.y))).x,Fd=(n,t,e)=>to(t,e,Math.abs((n-t.x)/(e.x-t.x))).y,Ji=n=>n*n,vv=(n,t,{x:e,y:i,x2:s,y2:r},a)=>a==="y"?{start:Math.min(i,r),end:Math.max(i,r),value:t}:{start:Math.min(e,s),end:Math.max(e,s),value:n},zd=(n,t,e,i)=>(1-i)*(1-i)*n+2*(1-i)*i*t+i*i*e,no=(n,t,e,i)=>({x:zd(n.x,t.x,e.x,i),y:zd(n.y,t.y,e.y,i)}),Bd=(n,t,e,i)=>2*(1-i)*(t-n)+2*i*(e-t),Hd=(n,t,e,i)=>-Math.atan2(Bd(n.x,t.x,e.x,i),Bd(n.y,t.y,e.y,i))+.5*rt;class ts extends Wt{inRange(t,e,i,s){const r=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:e},{path:o,ctx:l}=this;if(o){Ye(l,this.options),l.lineWidth+=this.options.hitTolerance;const{chart:u}=this.$context,d=t*u.currentDevicePixelRatio,f=e*u.currentDevicePixelRatio,g=l.isPointInStroke(o,d,f)||io(this,a,s);return l.restore(),g}const c=Ji(r);return Dv(this,a,c,s)||io(this,a,s)}return kv(this,{mouseX:t,mouseY:e},i,{hitSize:r,useFinalPosition:s})}getCenterPoint(t){return An(this,t)}draw(t){const{x:e,y:i,x2:s,y2:r,cp:a,options:o}=this;if(t.save(),!Ye(t,o))return t.restore();ni(t,o);const l=Math.sqrt(Math.pow(s-e,2)+Math.pow(r-i,2));if(o.curve&&a)return Lv(t,this,a,l),t.restore();const{startOpts:c,endOpts:u,startAdjust:d,endAdjust:f}=$d(this),g=Math.atan2(r-i,s-e);t.translate(e,i),t.rotate(g),t.beginPath(),t.moveTo(0+d,0),t.lineTo(l-f,0),t.shadowColor=o.borderShadowColor,t.stroke(),so(t,0,d,c),so(t,l,-f,u),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){const i=Z1(t,e),{x:s,y:r,x2:a,y2:o}=i,l=Mv(i,t.chartArea),c=l?Sv({x:s,y:r},{x:a,y:o},t.chartArea):{x:s,y:r,x2:a,y2:o,width:Math.abs(a-s),height:Math.abs(o-r)};if(c.centerX=(a+s)/2,c.centerY=(o+r)/2,c.initProperties=ei(t,c,e),e.curve){const d={x:c.x,y:c.y},f={x:c.x2,y:c.y2};c.cp=Rv(c,e,Hn(d,f))}const u=Tv(t,c,e.label);return u._visible=l,c.elements=[{type:"label",optionScope:"label",properties:u,initProperties:c.initProperties}],c}}ts.id="lineAnnotation";const Wd={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};ts.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Wd),fill:!1,length:12,start:Object.assign({},Wd),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({},Qi.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},ts.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},ts.defaultRoutes={borderColor:"color"};function kv(n,{mouseX:t,mouseY:e},i,{hitSize:s,useFinalPosition:r}){const a=vv(t,e,n.getProps(["x","y","x2","y2"],r),i);return cd(a,s)||io(n,{mouseX:t,mouseY:e},r,i)}function Mv({x:n,y:t,x2:e,y2:i},{top:s,right:r,bottom:a,left:o}){return!(n<o&&e<o||n>r&&e>r||t<s&&i<s||t>a&&i>a)}function Yd({x:n,y:t},e,{top:i,right:s,bottom:r,left:a}){return n<a&&(t=Fd(a,{x:n,y:t},e),n=a),n>s&&(t=Fd(s,{x:n,y:t},e),n=s),t<i&&(n=eo(i,{x:n,y:t},e),t=i),t>r&&(n=eo(r,{x:n,y:t},e),t=r),{x:n,y:t}}function Sv(n,t,e){const{x:i,y:s}=Yd(n,t,e),{x:r,y:a}=Yd(t,n,e);return{x:i,y:s,x2:r,y2:a,width:Math.abs(r-i),height:Math.abs(a-s)}}function Dv(n,{mouseX:t,mouseY:e},i=En,s){const{x:r,y:a,x2:o,y2:l}=n.getProps(["x","y","x2","y2"],s),c=o-r,u=l-a,d=Ji(c)+Ji(u),f=d===0?-1:((t-r)*c+(e-a)*u)/d;let g,p;return f<0?(g=r,p=a):f>1?(g=o,p=l):(g=r+f*c,p=a+f*u),Ji(t-g)+Ji(e-p)<=i}function io(n,{mouseX:t,mouseY:e},i,s){const r=n.label;return r.options.display&&r.inRange(t,e,s,i)}function Tv(n,t,e){const i=e.borderWidth,s=Ft(e.padding),r=ir(n.ctx,e),a=r.width+s.width+i,o=r.height+s.height+i;return Pv(t,e,{width:a,height:o,padding:s},n.chartArea)}function Cv(n){const{x:t,y:e,x2:i,y2:s}=n,r=Math.atan2(s-e,i-t);return r>rt/2?r-rt:r<rt/-2?r+rt:r}function Pv(n,t,e,i){const{width:s,height:r,padding:a}=e,{xAdjust:o,yAdjust:l}=t,c={x:n.x,y:n.y},u={x:n.x2,y:n.y2},d=t.rotation==="auto"?Cv(n):Nt(t.rotation),f=Ov(s,r,d),g=Ev(n,t,{labelSize:f,padding:a},i),p=n.cp?no(c,n.cp,u,g):to(c,u,g),b={size:f.w,min:i.left,max:i.right,padding:a.left},_={size:f.h,min:i.top,max:i.bottom,padding:a.top},w=jd(p.x,b)+o,k=jd(p.y,_)+l;return{x:w-s/2,y:k-r/2,x2:w+s/2,y2:k+r/2,centerX:w,centerY:k,pointX:p.x,pointY:p.y,width:s,height:r,rotation:fs(d)}}function Ov(n,t,e){const i=Math.cos(e),s=Math.sin(e);return{w:Math.abs(n*i)+Math.abs(t*s),h:Math.abs(n*s)+Math.abs(t*i)}}function Ev(n,t,e,i){let s;const r=Av(n,i);return t.position==="start"?s=Vd({w:n.x2-n.x,h:n.y2-n.y},e,t,r):t.position==="end"?s=1-Vd({w:n.x-n.x2,h:n.y-n.y2},e,t,r):s=Xa(1,t.position),s}function Vd(n,t,e,i){const{labelSize:s,padding:r}=t,a=n.w*i.dx,o=n.h*i.dy,l=a>0&&(s.w/2+r.left-i.x)/a,c=o>0&&(s.h/2+r.top-i.y)/o;return tr(Math.max(l,c),0,.25)}function Av(n,t){const{x:e,x2:i,y:s,y2:r}=n,a=Math.min(s,r)-t.top,o=Math.min(e,i)-t.left,l=t.bottom-Math.max(s,r),c=t.right-Math.max(e,i);return{x:Math.min(o,c),y:Math.min(a,l),dx:o<=c?1:-1,dy:a<=l?1:-1}}function jd(n,t){const{size:e,min:i,max:s,padding:r}=t,a=e/2;return e>s-i?(s+i)/2:(i>=n-r-a&&(n=i+r+a),s<=n+r+a&&(n=s-r-a),n)}function $d(n){const t=n.options,e=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:e,endOpts:i,startAdjust:qd(n,e),endAdjust:qd(n,i)}}function qd(n,t){if(!t||!t.display)return 0;const{length:e,width:i}=t,s=n.options.borderWidth/2,r={x:e,y:i+s};return Math.abs(eo(0,r,{x:0,y:s}))}function so(n,t,e,i){if(!i||!i.display)return;const{length:s,width:r,fill:a,backgroundColor:o,borderColor:l}=i,c=Math.abs(t-s)+e;n.beginPath(),ni(n,i),Ye(n,i),n.moveTo(c,-r),n.lineTo(t+e,0),n.lineTo(c,r),a===!0?(n.fillStyle=o||l,n.closePath(),n.fill(),n.shadowColor="transparent"):n.shadowColor=i.borderShadowColor,n.stroke()}function Rv(n,t,e){const{x:i,y:s,x2:r,y2:a,centerX:o,centerY:l}=n,c=Math.atan2(a-s,r-i),u=Ga(t.controlPoint,0),d={x:o+cn(e,u.x,!1),y:l+cn(e,u.y,!1)};return On(d,{x:o,y:l},c)}function Ud(n,{x:t,y:e},{angle:i,adjust:s},r){!r||!r.display||(n.save(),n.translate(t,e),n.rotate(i),so(n,0,-s,r),n.restore())}function Lv(n,t,e,i){const{x:s,y:r,x2:a,y2:o,options:l}=t,{startOpts:c,endOpts:u,startAdjust:d,endAdjust:f}=$d(t),g={x:s,y:r},p={x:a,y:o},b=Hd(g,e,p,0),_=Hd(g,e,p,1)-rt,w=no(g,e,p,d/i),k=no(g,e,p,1-f/i),M=new Path2D;n.beginPath(),M.moveTo(w.x,w.y),M.quadraticCurveTo(e.x,e.y,k.x,k.y),n.shadowColor=l.borderShadowColor,n.stroke(M),t.path=M,t.ctx=n,Ud(n,w,{angle:b,adjust:d},c),Ud(n,k,{angle:_,adjust:f},u)}class es extends Wt{inRange(t,e,i,s){const r=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y")return Iv({x:t,y:e},this.getProps(["width","height","centerX","centerY"],s),r,a);const{x:o,y:l,x2:c,y2:u}=this.getProps(["x","y","x2","y2"],s),d=i==="y"?{start:l,end:u}:{start:o,end:c},f=On({x:t,y:e},this.getCenterPoint(s),Nt(-r));return f[i]>=d.start-a-En&&f[i]<=d.end+a+En}getCenterPoint(t){return An(this,t)}draw(t){const{width:e,height:i,centerX:s,centerY:r,options:a}=this;t.save(),nr(t,this.getCenterPoint(),a.rotation),ni(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const o=Ye(t,a);t.ellipse(s,r,i/2,e/2,rt/2,0,2*rt),t.fill(),o&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return Pd(t,e)}}es.id="ellipseAnnotation",es.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},si.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},es.defaultRoutes={borderColor:"color",backgroundColor:"color"},es.descriptors={label:{_fallback:!0}};function Iv(n,t,e,i){const{width:s,height:r,centerX:a,centerY:o}=t,l=s/2,c=r/2;if(l<=0||c<=0)return!1;const u=Nt(e||0),d=Math.cos(u),f=Math.sin(u),g=Math.pow(d*(n.x-a)+f*(n.y-o),2),p=Math.pow(f*(n.x-a)-d*(n.y-o),2);return g/Math.pow(l+i,2)+p/Math.pow(c+i,2)<=1.0001}class ar extends Wt{inRange(t,e,i,s){const{x:r,y:a,x2:o,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),u=(this.options.borderWidth+this.options.hitTolerance)/2;return i!=="x"&&i!=="y"?P1({x:t,y:e},this.getCenterPoint(s),c/2,u):cd(i==="y"?{start:a,end:l,value:e}:{start:r,end:o,value:t},u)}getCenterPoint(t){return An(this,t)}draw(t){const e=this.options,i=e.borderWidth;if(e.radius<.1)return;t.save(),t.fillStyle=e.backgroundColor,ni(t,e);const s=Ye(t,e);F1(t,this,this.centerX,this.centerY),s&&!er(e.pointStyle)&&(t.shadowColor=e.borderShadowColor,t.stroke()),t.restore(),e.borderWidth=i}resolveElementProperties(t,e){const i=Cd(t,e);return i.initProperties=ei(t,i,e),i}}ar.id="pointAnnotation",ar.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},ar.defaultRoutes={borderColor:"color",backgroundColor:"color"};class or extends Wt{inRange(t,e,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&Fv(this.elements,t,e,s);const r=On({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),o=Math.min(...a),l=Math.max(...a);return r[i]>=o&&r[i]<=l}getCenterPoint(t){return An(this,t)}draw(t){const{elements:e,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,ni(t,i);const s=Ye(t,i);let r=!0;for(const a of e)r?(t.moveTo(a.x,a.y),r=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,e){const i=Cd(t,e),{sides:s,rotation:r}=e,a=[],o=2*rt/s;let l=r*Or;for(let c=0;c<s;c++,l+=o){const u=Nv(i,e,l);u.initProperties=ei(t,i,e),a.push(u)}return i.elements=a,i}}or.id="polygonAnnotation",or.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},or.defaultRoutes={borderColor:"color",backgroundColor:"color"};function Nv({centerX:n,centerY:t},{radius:e,borderWidth:i,hitTolerance:s},r){const a=(i+s)/2,o=Math.sin(r),l=Math.cos(r),c={x:n+o*e,y:t-l*e};return{type:"point",optionScope:"point",properties:{x:c.x,y:c.y,centerX:c.x,centerY:c.y,bX:n+o*(e+a),bY:t-l*(e+a)}}}function Fv(n,t,e,i){let s=!1,r=n[n.length-1].getProps(["bX","bY"],i);for(const a of n){const o=a.getProps(["bX","bY"],i);o.bY>e!=r.bY>e&&t<(r.bX-o.bX)*(e-o.bY)/(r.bY-o.bY)+o.bX&&(s=!s),r=o}return s}const un={box:si,doughnutLabel:rr,ellipse:es,label:Qi,line:ts,point:ar,polygon:or};Object.keys(un).forEach(n=>{_t.describe(`elements.${un[n].id}`,{_fallback:"plugins.annotation.common"})});const zv={update:Object.assign},Bv=Ja.concat(sr),Xd=(n,t)=>it(t)?oo(n,t):n,ro=n=>n==="color"||n==="font";function ao(n="line"){return un[n]?n:(console.warn(`Unknown annotation type: '${n}', defaulting to 'line'`),"line")}function Hv(n,t,e,i){const s=Yv(n,e.animations,i),r=t.annotations,a=$v(t.elements,r);for(let o=0;o<r.length;o++){const l=r[o],c=Gd(a,o,l.type),u=l.setContext(jv(n,c,a,l)),d=c.resolveElementProperties(n,u);d.skip=Wv(d),"elements"in d&&(Vv(c,d.elements,u,s),delete d.elements),Qt(c.x)||Object.assign(c,d),Object.assign(c,d.initProperties),d.options=Kd(u),s.update(c,d)}}function Wv(n){return isNaN(n.x)||isNaN(n.y)}function Yv(n,t,e){return e==="reset"||e==="none"||e==="resize"?zv:new jr(n,t)}function Vv(n,t,e,i){const s=n.elements||(n.elements=[]);s.length=t.length;for(let r=0;r<t.length;r++){const a=t[r],o=a.properties,l=Gd(s,r,a.type,a.initProperties),c=e[a.optionScope].override(a);o.options=Kd(c),i.update(l,o)}}function Gd(n,t,e,i){const s=un[ao(e)];let r=n[t];return(!r||!(r instanceof s))&&(r=n[t]=new s,Object.assign(r,i)),r}function Kd(n){const t=un[ao(n.type)],e={};e.id=n.id,e.type=n.type,e.drawTime=n.drawTime,Object.assign(e,oo(n,t.defaults),oo(n,t.defaultRoutes));for(const i of Bv)e[i]=n[i];return e}function oo(n,t){const e={};for(const i of Object.keys(t)){const s=t[i],r=n[i];ro(i)&&ct(r)?e[i]=r.map(a=>Xd(a,s)):e[i]=Xd(r,s)}return e}function jv(n,t,e,i){return t.$context||(t.$context=Object.assign(Object.create(n.getContext()),{element:t,get elements(){return e.filter(s=>s&&s.options)},id:i.id,type:"annotation"}))}function $v(n,t){const e=t.length,i=n.length;if(i<e){const s=e-i;n.splice(i,0,...new Array(s))}else i>e&&n.splice(e,i-e);return n}var qv="3.1.0";const dn=new Map,Zd=n=>n.type!=="doughnutLabel",Uv=Ja.concat(sr);var Qd={id:"annotation",version:qv,beforeRegister(){O1("chart.js","4.0",ge.version)},afterRegister(){ge.register(un)},afterUnregister(){ge.unregister(un)},beforeInit(n){dn.set(n,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(n,t,e){const i=dn.get(n),s=i.annotations=[];let r=e.annotations;it(r)?Object.keys(r).forEach(a=>{const o=r[a];it(o)&&(o.id=a,s.push(o))}):ct(r)&&s.push(...r),uv(s.filter(Zd),n.scales)},afterDataLimits(n,t){const e=dn.get(n);cv(n,t.scale,e.annotations.filter(Zd).filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(n,t,e){const i=dn.get(n);sv(n,i,e),Hv(n,i,e,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),lv(n,i,e)},beforeDatasetsDraw(n,t,e){ns(n,"beforeDatasetsDraw",e.clip)},afterDatasetsDraw(n,t,e){ns(n,"afterDatasetsDraw",e.clip)},beforeDatasetDraw(n,t,e){ns(n,t.index,e.clip)},beforeDraw(n,t,e){ns(n,"beforeDraw",e.clip)},afterDraw(n,t,e){ns(n,"afterDraw",e.clip)},beforeEvent(n,t,e){const i=dn.get(n);rv(i,t.event,e)&&(t.changed=!0)},afterDestroy(n){dn.delete(n)},getAnnotations(n){const t=dn.get(n);return t?t.elements:[]},_getAnnotationElementsAtEventForMode(n,t,e){return Ua(n,t,e)},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:n=>!Uv.includes(n)&&n!=="init",annotations:{_allKeys:!1,_fallback:(n,t)=>`elements.${un[ao(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:ro,_fallback:!0},_indexable:ro}},additionalOptionScopes:[""]};function ns(n,t,e){const{ctx:i,chartArea:s}=n,r=dn.get(n);e&&xi(i,s);const a=Xv(r.visibleElements,t).sort((o,l)=>o.element.options.z-l.element.options.z);for(const o of a)Gv(i,s,r,o);e&&_i(i)}function Xv(n,t){const e=[];for(const i of n)if(i.options.drawTime===t&&e.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&e.push({element:s});return e}function Gv(n,t,e,i){const s=i.element;i.main?(Ld(e,s,"beforeDraw"),s.draw(n,t),Ld(e,s,"afterDraw")):s.draw(n,t)}const Jd="#6c7489",Kv="#995c00",th="20px",eh="24px",Zv="40px",Qv="48px",Jv={class:"tooltip-title"},tk={class:"title font-bold"},ek={key:1,class:"subtitle"},nk={class:"tooltip"},ik={key:0},sk={class:"display-label"},rk={class:"display-value"},ak=h.defineComponent({__name:"ChartTooltip",props:{showTooltip:{type:Boolean,required:!0,default:!1},left:{type:String,required:!1,default:null},top:{type:String,required:!1,default:null},tooltipTitle:{type:String,required:!1,default:""},context:{type:[String,Number],required:!1,default:""},series:{type:Array,required:!0,default:()=>[]},locked:{type:Boolean,required:!1,default:!1}},emits:["dimensions","top","left"],setup(n,{emit:t}){const e=t,i=n,s=h.ref(null),r=h.ref(!1),a=h.ref({x:0,y:0}),o=h.ref({x:0,y:0}),l=h.ref({left:i.left,top:i.top});h.watch(s,g=>{if(g){const{width:p,height:b}=g.getBoundingClientRect();e("dimensions",{width:p,height:b})}}),h.watch(()=>i.locked,g=>{g?(l.value.left=i.left,l.value.top=i.top):g===!1&&(e("top",l.value.top),e("left",l.value.left))});function c(g){if(s.value){r.value=!0;const p=window.getComputedStyle(s.value),b=p.transform||p.webkitTransform||p.mozTransform,_=new DOMMatrix(b),w=_.m41,k=_.m42;a.value={x:w,y:k},o.value={x:g.clientX,y:g.clientY},window.addEventListener("mousemove",d),window.addEventListener("mouseup",f)}}let u=null;function d(g){g.preventDefault(),g.stopPropagation(),r.value&&(u!==null&&window.cancelAnimationFrame(u),u=window.requestAnimationFrame(()=>{const p=g.clientX-o.value.x,b=g.clientY-o.value.y;l.value.left=`${a.value.x+p}px`,l.value.top=`${a.value.y+b}px`}))}function f(){r.value=!1,u!==null&&window.cancelAnimationFrame(u),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",f)}return(g,p)=>n.showTooltip?(h.openBlock(),h.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:h.normalizeClass(["tooltip-container",{locked:n.locked}]),style:h.normalizeStyle({transform:n.locked?`translate(${l.value.left}, ${l.value.top})`:`translate(${n.left}, ${n.top})`,left:"0",top:"0",pointerEvents:n.locked?"all":"none"}),onMousedown:c},[h.createElementVNode("div",Jv,[h.createElementVNode("span",tk,h.toDisplayString(n.tooltipTitle),1),n.locked?(h.openBlock(),h.createBlock(h.unref(kr.DragIcon),{key:0,class:"drag-icon",color:h.unref(Jd)},null,8,["color"])):h.createCommentVNode("",!0),n.context?(h.openBlock(),h.createElementBlock("span",ek,h.toDisplayString(n.context),1)):h.createCommentVNode("",!0)]),h.createElementVNode("ul",nk,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.series,({backgroundColor:b,borderColor:_,label:w,value:k})=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:w},[n.series.length?(h.openBlock(),h.createElementBlock("li",ik,[h.createElementVNode("div",{class:"square-marker",style:h.normalizeStyle({background:b,"border-color":_})},null,4),h.createElementVNode("span",sk,h.toDisplayString(w),1),h.createElementVNode("span",rk,h.toDisplayString(k),1)])):h.createCommentVNode("",!0)],64))),128))])],38)):h.createCommentVNode("",!0)}}),Ve=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},lo=Ve(ak,[["__scopeId","data-v-06b92295"]]),ok=["onClick"],lk=["title"],ck={key:0,class:"sub-label"},co=Ve(h.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(n){h.useCssVars(M=>({12487160:o.value}));const t=n,e=h.ref(),i=h.ref([]),s=h.inject("showLegendValues",!0),r=h.inject("legendPosition",h.ref(Ot.Right)),a=h.ref([]),o=h.ref(eh),l=()=>{const M=e.value;if(!M||!i.value||M.children.length===0)return 0;const C=M.children[0].getBoundingClientRect().top;for(const S of i.value)if(S.getBoundingClientRect().top>C)return!0;return!1},c=h.computed(()=>t.items.length>2||r.value===Ot.Right),u=()=>{e.value&&r.value===Ot.Bottom&&(l()?o.value=Qv:o.value=eh)},d=()=>{if(e.value&&r.value===Ot.Bottom){let M=0;i.value.forEach(S=>{const O=Array.from(S.children).reduce((T,y)=>T+y.offsetWidth,0);O>M&&(M=O)});const C=parseInt(Zv,10);e.value.style.gridTemplateColumns=`repeat(auto-fit, ${M+C}px)`}u()},f=()=>{if(t.items.length!==a.value.length)return a.value=t.items,!0;for(let M=0;M<t.items.length;M++)if(t.items[M].text!==a.value[M].text)return a.value=t.items,!0;return!1};h.watch(()=>t.items,()=>{f()&&d()},{immediate:!0,flush:"post"});const g=h.ref(0),p=h.ref(0),b=new ResizeObserver(vu(M=>{const C=M[0],S=C.contentRect.width,O=C.contentRect.height;S!==g.value&&O===p.value&&d(),g.value=S,p.value=O},100));h.watch(()=>r.value,()=>{d()}),h.onMounted(()=>{a.value=t.items,e.value&&b.observe(e.value),window.requestAnimationFrame(()=>{d()})}),h.onBeforeUnmount(()=>{e.value&&b.unobserve(e.value)});const _=(M=0,C)=>{if(t.chartInstance===null)return;const S=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart;w(M,C)?S.hide(M,C):S.show(M,C),S.update()},w=(M=0,C)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const S=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart,O=S.getDatasetMeta(M);return O.dataset||C===void 0?S.isDatasetVisible(M):!(O.data.length&&O.data[C].hidden)},k=M=>({[Ot.Right]:"vertical",[Ot.Bottom]:"horizontal",[Ot.Hidden]:"hidden"})[M];return(M,C)=>h.unref(r)!==h.unref(Ot).Hidden?(h.openBlock(),h.createElementBlock("ul",{key:0,ref_key:"legendContainerRef",ref:e,class:h.normalizeClass(["legend-container",k(h.unref(r))]),"data-testid":"legend"},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(n.items,({fillStyle:S,strokeStyle:O,text:T,datasetIndex:y,index:x,value:D})=>(h.openBlock(),h.createElementBlock("li",{key:T,ref_for:!0,ref_key:"legendItemsRef",ref:i,onClick:R=>_(y,x)},[h.createElementVNode("div",{class:"square-marker",style:h.normalizeStyle({background:S,"border-color":O})},null,4),h.createElementVNode("div",{class:h.normalizeClass(["label-container",{"strike-through":!w(y,x)}])},[h.createElementVNode("div",{class:h.normalizeClass(["label",{"truncate-label":c.value}]),title:T},h.toDisplayString(T),11,lk),D&&h.unref(s)?(h.openBlock(),h.createElementBlock("div",ck,h.toDisplayString(D.formatted),1)):h.createCommentVNode("",!0)],2)],8,ok))),128))],2)):h.createCommentVNode("",!0)}}),[["__scopeId","data-v-8e9f2f19"]]);for(var Vt=[],uo=0;uo<256;++uo)Vt.push((uo+256).toString(16).slice(1));function uk(n,t=0){return(Vt[n[t+0]]+Vt[n[t+1]]+Vt[n[t+2]]+Vt[n[t+3]]+"-"+Vt[n[t+4]]+Vt[n[t+5]]+"-"+Vt[n[t+6]]+Vt[n[t+7]]+"-"+Vt[n[t+8]]+Vt[n[t+9]]+"-"+Vt[n[t+10]]+Vt[n[t+11]]+Vt[n[t+12]]+Vt[n[t+13]]+Vt[n[t+14]]+Vt[n[t+15]]).toLowerCase()}var lr,dk=new Uint8Array(16);function hk(){if(!lr&&(lr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!lr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return lr(dk)}var fk=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const nh={randomUUID:fk};function hn(n,t,e){if(nh.randomUUID&&!t&&!n)return nh.randomUUID();n=n||{};var i=n.random||(n.rng||hk)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,uk(i)}const ih=(n,t)=>{const e=n.ctx,i=n.scales.y,s=n.scales.x,r=t[t.length-1].element;e.save(),e.strokeStyle="rgba(100, 100, 100, 1)",e.lineWidth=3,n.options.indexAxis==="x"?e.strokeRect(r.x-r.width/2,r.y,r.width,i.bottom-r.y):e.strokeRect(s.left,r.y-r.height/2,r.x-s.left,r.height),e.restore()},sh={id:"highlightPlugin",clicked:!1,afterDatasetsDraw:function(n){this.clickedElements&&this.clickedElements.length&&ih(n,this.clickedElements)},afterEvent:function(n,{event:t}){var s;if(t.type!=="click"||!t.native)return;this.clicked=!this.clicked;const e=((s=n.options.interaction)==null?void 0:s.mode)||"index",i=n.getElementsAtEventForMode(t.native,e,{intersect:!1},!0);i.length&&this.clicked?(this.clickedElements=i,ih(n,this.clickedElements),this.previousHoverOption=n.options.hover,n.options.hover={mode:null}):(delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1)},beforeDestroy(n){delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1}},rh=6,gk="100%",pk="100%",mk=20,yk=20,ah=6,bk=0,xk=10,_k=10,wk=1,vk=Ve(h.defineComponent({__name:"StackedBarChart",props:{chartData:{type:Object,required:!1,default:()=>({labels:[],datasets:[]})},tooltipTitle:{type:String,required:!1,default:""},legendValues:{type:Object,required:!1,default:null},metricUnit:{type:String,required:!1,default:""},orientation:{type:String,required:!1,default:"horizontal",validator:n=>["horizontal","vertical"].includes(n)},annotations:{type:Boolean,required:!1,default:!0},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},stacked:{type:Boolean,required:!1,default:!0},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue}},setup(n){const t=n,{i18n:e}=ut.useI18n(),{translateUnit:i}=ut.useTranslatedUnits(),s=h.ref(null),r=({chart:E},I)=>{var K;const W=E.data,q=(K=W.labels)==null?void 0:K.indexOf(I);return W.datasets.reduce((V,Y,et)=>{if(E.isDatasetVisible(et)){const X=Y.data[q];return isNaN(X)?V:V+X}else return V},0)},a=(E,I,W,q)=>{const K=q==="horizontal";I===null&&(I=e.t("entityNoName"));const V={type:"label",yValue:X=>K?I:r(X,I),xValue:X=>K?r(X,I):I},Y={...V,position:K?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>K?0:-Math.abs(Jx()),content:X=>Ra(r(X,I),W)},et={...V,content:X=>Au(r(X,I),Eu(X.chart,E)),position:K?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:X=>K?Ou(Ra(r(X,I),W)):0,color:Cu};return{[`${I}-value`]:Y,[`${I}-percent`]:et}},o=h.ref(null),l=h.ref(),c=h.ref(hn()),u=hn(),d=hn(),f=h.ref([]),g=h.ref(h.inject("legendPosition",Ot.Right)),p=h.ref({show:!1,top:"0px",left:"0px",text:"",offset:-50}),b=h.toRef(t,"metricUnit"),_=h.computed(()=>h.toRef(t,"orientation").value==="horizontal"),w=h.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:b,translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,locked:!1,chartType:_.value?"horizontal_bar":"vertical_bar",chartTooltipSortFn:t.chartTooltipSortFn}),k=h.ref(0),M=()=>{var E;return t.annotations&&((E=t.chartData.labels)==null?void 0:E.reduce((I,W)=>Object.assign(I,a(t.chartData,W,b.value,t.orientation)),{}))},C={id:c.value,afterUpdate(E){k.value+=1,f.value=E.options.plugins.legend.labels.generateLabels(E).map(I=>({...I,value:t.legendValues&&t.legendValues[I.text]})).sort(t.chartLegendSortFn)}},S={id:u,afterUpdate(E){E.options.plugins.annotation.annotations=t.annotations?M():{}}},y=[C,{id:"axisHover",afterEvent(E,I){if(p.value.show=!1,I.event.type==="mousemove"){const W=I.event,q=E.options.indexAxis,K=E.scales,V=E.scales[q].getLabelForValue(Number(E.scales[q].getValueForPixel(W[q])));if((et=>et==="x"?W.y>K.x.top:W.x<K.y.right)(q))if(w.locked||(w.showTooltip=!1),V.length>Us){const X=E.canvas.getContext("2d").measureText(V).width,wt=Math.abs(Math.round(W.x-X*.5)),lt=Math.round(W.x+X*.5);p.value.left=q==="x"?`${(wt>0?wt:lt)-p.value.offset}px`:`${W.x-X*.5-p.value.offset}px`,p.value.top=`${W.y-50}px`,p.value.show=!0,p.value.text=V}else p.value.show=!1;else p.value.show=!1}}},{id:d,afterUpdate(E){E.options.layout.padding.right=_.value?N.value:0}},sh,...t.annotations?[S]:[]],x=h.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),D=h.ref(0),R=h.ref(0),L=new ResizeObserver(vu(E=>{D.value=E[0].contentRect.width,R.value=E[0].contentRect.height},100)),B=h.computed(()=>{var I,W;const E=(W=(I=t.chartData)==null?void 0:I.labels)==null?void 0:W.length;return o.value&&E&&!_.value?`${Math.max(E*(mk+ah),D.value)}px`:gk}),j=h.computed(()=>{var I,W;const E=(W=(I=t.chartData)==null?void 0:I.labels)==null?void 0:W.length;return o.value&&E&&_.value?`${Math.max(E*(yk+ah),R.value)}px`:pk});ut.useReportChartDataForSynthetics(h.toRef(t,"chartData"),h.toRef(t,"syntheticsDataKey")),h.onMounted(()=>{t.annotations&&ge.register(Qd),s.value&&(D.value=s.value.offsetWidth,R.value=s.value.offsetHeight,L.observe(s.value))}),h.onUnmounted(()=>{s.value&&L.unobserve(s.value)});const G=h.computed(()=>{const E=ut.useBarChartOptions({tooltipState:w,legendID:c.value,stacked:h.toRef(t,"stacked"),metricAxesTitle:h.toRef(t,"metricAxesTitle"),dimensionAxesTitle:h.toRef(t,"dimensionAxesTitle"),indexAxis:_.value?"y":"x",numLabels:x});return{...E.value,plugins:{...E.value.plugins,annotation:{annotations:M(),clip:!1}},layout:{autoPadding:!1,padding:{right:0,top:6*rh}}}}),$=ut.useChartJSCommon("bar",o,h.toRef(t,"chartData"),y,G),N=h.computed(()=>{k.value;const E=t.chartData.labels,I=t.chartData.datasets,W=E.map((V,Y)=>I.reduce((et,X)=>isNaN(Number(X.data[Y]))?et:et+Number(X.data[Y]),0)),q=$.value?Eu($.value,t.chartData):t_(t.chartData);return W.map(V=>Ou(Ra(V,b.value)+Au(V,q))).reduce((V,Y)=>Math.max(V,Y),0)+rh});h.onBeforeUnmount(()=>{ge.unregister(Qd)});const st={[Ot.Right]:"legend-row",[Ot.Bottom]:"column"},z=h.computed(()=>{if(l.value&&$.value){const E=window.devicePixelRatio,I=$.value,W=I.scales.y.width*E+wk,q=(I.scales.y.height+I.scales.y.top+I.scales.x.height)*E,K=l.value.getContext("2d");return K.scale(E,E),K.canvas.width=W,K.canvas.height=q,K.canvas.style.width=`${W/E}px`,K.canvas.style.height=`${q/E}px`,{scale:E,width:W*E,height:q*E,targetCtx:K}}return null}),St=E=>{const I=E.target;if(z.value&&$.value&&!_.value){const W=z.value.scale,q=z.value.targetCtx,K=z.value.width,V=z.value.height,Y=$.value,et=Y.canvas;q.fillStyle="white",I.scrollLeft>=bk&&I.scrollLeft<=xk?(q.globalCompositeOperation="source-over",q.clearRect(0,0,K,V),q.drawImage(et,0,0,K,V,0,0,K,V),q.globalCompositeOperation="destination-over",q.fillRect(0,0,K,V)):(q.globalCompositeOperation="source-over",q.fillRect(0,(Y.scales.y.height+Y.scales.y.top+_k)*W,K,Y.scales.x.height*W))}w.offsetY=I.scrollTop,w.offsetX=I.scrollLeft,p.value.offset=I.scrollLeft},bt=({width:E,height:I})=>{w.width=E,w.height=I};h.watch(()=>t.orientation,()=>{var E;if(l.value&&z.value){const I=z.value.width,W=z.value.height;((E=l.value)==null?void 0:E.getContext("2d")).clearRect(0,0,I,W)}w.showTooltip=!1,w.locked=!1}),h.watch(()=>t.annotations,E=>{$.value&&(E?$.value.options.plugins.annotation.annotations=M(t.chartData):delete $.value.options.plugins.annotation.annotations)});const H=()=>{w.showTooltip&&(w.locked=!w.locked)};return(E,I)=>(h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["chart-parent",st[g.value]])},[h.createElementVNode("canvas",{ref_key:"axis",ref:l,class:"axis"},null,512),h.createElementVNode("div",{ref_key:"chartContainerRef",ref:s,class:"chart-container","on:scroll":St,onClick:I[0]||(I[0]=W=>H())},[h.createElementVNode("div",{class:"chart-body",style:h.normalizeStyle({width:B.value,height:j.value})},[h.createElementVNode("canvas",{ref_key:"canvas",ref:o,class:"chart-canvas"},null,512)],4)],544),p.value.show?(h.openBlock(),h.createElementBlock("div",{key:0,class:"axis-tooltip",style:h.normalizeStyle({top:p.value.top,left:p.value.left})},h.toDisplayString(p.value.text),5)):h.createCommentVNode("",!0),h.createVNode(lo,{context:w.tooltipContext,left:w.left,locked:w.locked,series:w.tooltipSeries,"show-tooltip":w.showTooltip,"tooltip-title":n.tooltipTitle,top:w.top,onDimensions:bt},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top"]),h.createVNode(co,{id:c.value,"chart-instance":h.unref($),items:f.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-251c3e18"]]);/*!
24
24
  * chartjs-adapter-date-fns v3.0.0
25
25
  * https://www.chartjs.org
26
26
  * (c) 2022 chartjs-adapter-date-fns Contributors
27
27
  * Released under the MIT license
28
- */const Mk={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"};Il._date.override({_id:"date-fns",formats:function(){return Mk},parse:function(n,t){if(n===null||typeof n>"u")return null;const e=typeof n;return e==="number"||n instanceof Date?n=tt(n):e==="string"&&(typeof t=="string"?n=yx(n,t,new Date,this.options):n=_u(n,this.options)),wa(n)?n.getTime():null},format:function(n,t){return gu(n,t,this.options)},add:function(n,t,e){switch(e){case"millisecond":return xa(n,t);case"second":return hb(n,t);case"minute":return ub(n,t);case"hour":return ob(n,t);case"day":return Ys(n,t);case"week":return fb(n,t);case"month":return ba(n,t);case"quarter":return db(n,t);case"year":return gb(n,t);default:return n}},diff:function(n,t,e){switch(e){case"millisecond":return va(n,t);case"second":return vb(n,t);case"minute":return xb(n,t);case"hour":return bb(n,t);case"day":return Qc(n,t);case"week":return kb(n,t);case"month":return nu(n,t);case"quarter":return wb(n,t);case"year":return Mb(n,t);default:return 0}},startOf:function(n,t,e){switch(t){case"second":return wx(n);case"minute":return _x(n);case"hour":return xx(n);case"day":return _a(n);case"week":return Ce(n);case"isoWeek":return Ce(n,{weekStartsOn:+e});case"month":return Db(n);case"quarter":return Sb(n);case"year":return iu(n);default:return n}},endOf:function(n,t){switch(t){case"second":return Ab(n);case"minute":return Ob(n);case"hour":return Cb(n);case"day":return tu(n);case"week":return Pb(n);case"month":return eu(n);case"quarter":return Eb(n);case"year":return Tb(n);default:return n}}});const oh={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Sk={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...oh,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},Dk=h.version[0]==="2"?(n,t)=>Object.assign(n,{attrs:t}):(n,t)=>Object.assign(n,t);function ri(n){return h.isProxy(n)?h.toRaw(n):n}function Tk(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n;return h.isProxy(t)?new Proxy(n,{}):n}function Ck(n,t){const e=n.options;e&&t&&Object.assign(e,t)}function lh(n,t){n.labels=t}function ch(n,t,e){const i=[];n.datasets=t.map(s=>{const r=n.datasets.find(a=>a[e]===s[e]);return!r||!s.data||i.includes(r)?{...s}:(i.push(r),Object.assign(r,s),r)})}function Pk(n,t){const e={labels:[],datasets:[]};return lh(e,n.labels),ch(e,n.datasets,t),e}const Ok=h.defineComponent({props:Sk,setup(n,t){let{expose:e,slots:i}=t;const s=h.ref(null),r=h.shallowRef(null);e({chart:r});const a=()=>{if(!s.value)return;const{type:c,data:u,options:d,plugins:f,datasetIdKey:g}=n,p=Pk(u,g),b=Tk(p,u);r.value=new ge(s.value,{type:c,data:b,options:{...d},plugins:f})},o=()=>{const c=h.toRaw(r.value);c&&(n.destroyDelay>0?setTimeout(()=>{c.destroy(),r.value=null},n.destroyDelay):(c.destroy(),r.value=null))},l=c=>{c.update(n.updateMode)};return h.onMounted(a),h.onUnmounted(o),h.watch([()=>n.options,()=>n.data],(c,u)=>{let[d,f]=c,[g,p]=u;const b=h.toRaw(r.value);if(!b)return;let _=!1;if(d){const w=ri(d),k=ri(g);w&&w!==k&&(Ck(b,w),_=!0)}if(f){const w=ri(f.labels),k=ri(p.labels),M=ri(f.datasets),C=ri(p.datasets);w!==k&&(lh(b.config.data,w),_=!0),M&&M!==C&&(ch(b.config.data,M,n.datasetIdKey),_=!0)}_&&h.nextTick(()=>{l(b)})},{deep:!0}),()=>h.h("canvas",{role:"img",ariaLabel:n.ariaLabel,ariaDescribedby:n.ariaDescribedby,ref:s},[h.h("p",{},[i.default?i.default():""])])}});function ho(n,t){return ge.register(t),h.defineComponent({props:oh,setup(e,i){let{expose:s}=i;const r=h.shallowRef(null),a=o=>{r.value=o==null?void 0:o.chart};return s({chart:r}),()=>h.h(Ok,Dk({ref:a},{type:n,...e}))}})}const Ek=ho("bar",ki),uh=ho("doughnut",ze),Ak=ho("line",Mi),Rk={class:"chart-container"},Lk=h.defineComponent({__name:"DoughnutChart",props:{chartData:{type:Object,required:!1,default:null},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Ot.Right},legendValues:{type:Object,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:He}},setup(n){const t=n,{translateUnit:e}=ut.useTranslatedUnits(),i=h.ref(hn()),s=h.ref(hn()),r=h.ref([]),a=h.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:h.toRef(t,"metricUnit"),translateUnit:e,offsetX:0,offsetY:0,width:0,height:0,chartType:"doughnut"}),o={id:i.value,afterUpdate(b){r.value=b.options.plugins.legend.labels.generateLabels(b).map(_=>({..._,value:t.legendValues&&t.legendValues[_.text],hidden:!1}))}},l=h.computed(()=>[o]),c=h.computed(()=>[t.chartData.datasets.reduce((_,w)=>(_.labels.push(w.label),_.backgroundColor.push(w.backgroundColor),_.borderColor.push(Tu(w.backgroundColor,50)),_.data.push(w.data.reduce((k,M)=>k+M,0)),_),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),u=h.computed(()=>({...t.chartData,datasets:c.value}));ut.useReportChartDataForSynthetics(h.toRef(t,"chartData"),h.toRef(t,"syntheticsDataKey"));const{options:d}=ut.useDoughnutChartOptions({tooltipState:a,legendID:i.value}),f=h.ref(),g=b=>({[Ot.Right]:"legend-row",[Ot.Bottom]:"column",[Ot.Hidden]:"hidden"})[b],p=({width:b,height:_})=>{a.width=b,a.height=_};return(b,_)=>(h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["chart-parent",g(n.legendPosition)]),"data-testid":"doughnut-chart-parent"},[h.createElementVNode("div",Rk,[h.createVNode(h.unref(uh),{ref_key:"chartInstance",ref:f,"chart-id":s.value,data:u.value,options:h.unref(d),plugins:l.value},null,8,["chart-id","data","options","plugins"]),h.createVNode(lo,{left:a.left,series:a.tooltipSeries,"show-tooltip":a.showTooltip,"tooltip-title":n.tooltipTitle,top:a.top,unit:n.metricUnit,onDimensions:p},null,8,["left","series","show-tooltip","tooltip-title","top","unit"])]),h.createVNode(co,{id:i.value,"chart-instance":f.value,items:r.value,position:n.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),Ik=Ve(Lk,[["__scopeId","data-v-5cc0c740"]]),dh=(n,t,e,i)=>{n.save(),n.beginPath(),n.moveTo(t,e),n.lineTo(t,i),n.lineWidth=1,n.strokeStyle="#0275d8",n.stroke(),n.restore()},is={id:"linePlugin",afterDatasetsDraw:function(n){if(!this.pause&&n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&!this.clickedSegment){const{x:t}=n.tooltip.dataPoints[0].element,e=n.ctx;dh(e,t,n.scales.y.top,n.scales.y.bottom)}if(!this.pause&&this.clickedSegment){const{x:t}=this.clickedSegment.element,e=n.ctx;dh(e,t,n.scales.y.top,n.scales.y.bottom)}},beforeDestroy(){delete this.clickedSegment}},Nk=(n,t,e)=>{const i=n.ctx;i.save(),i.fillStyle="rgba(200, 200, 200, 0.5)",i.fillRect(t,n.chartArea.top,e-t,n.chartArea.bottom-n.chartArea.top),i.restore()},hh=(n,t,e)=>{const i=t.scales.x.getValueForPixel(e.startX),s=t.scales.x.getValueForPixel(e.endX);t.canvas.dispatchEvent(new CustomEvent(n,{detail:{xStart:i,xEnd:s}}))},Fk={id:"dragSelectPlugin",isDragging:!1,startX:0,endX:0,beforeInit:function(n){const t=n.canvas,e=t.getBoundingClientRect();let i=!1;const s=o=>{this.dragTimeout=window.setTimeout(()=>{this.isDragging=!0,i=!0,this.startX=o.clientX-e.left},150)},r=o=>{i&&this.isDragging&&(this.endX=o.clientX-e.left,hh("dragSelectMove",n,this),n.update())},a=o=>{clearTimeout(this.dragTimeout),i&&this.isDragging&&(this.endX=o.clientX-e.left,hh("dragSelect",n,this),n.update(),this.isDragging=!1,i=!1)};t.addEventListener("mousedown",s),t.addEventListener("mousemove",r),t.addEventListener("mouseup",a),this.dragSelectHandlers={onMouseDown:s,onMouseMove:r,onMouseUp:a}},beforeDestroy(n){const t=n.canvas;if(this.dragSelectHandlers){const{onMouseDown:e,onMouseMove:i,onMouseUp:s}=this.dragSelectHandlers;t.removeEventListener("mousedown",e),t.removeEventListener("mousemove",i),t.removeEventListener("mouseup",s)}this.isDragging=!1},afterDatasetsDraw:function(n){this.isDragging&&Nk(n,this.startX,this.endX)}},zk=Ve(h.defineComponent({__name:"TimeSeriesChart",props:{chartData:{type:Object,required:!1,default:null},type:{type:String,required:!1,default:"timeseries_line"},fill:{type:Boolean,required:!1,default:!1},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},timeRangeMs:{type:Number,required:!1,default:void 0},granularity:{type:String,required:!0},stacked:{type:Boolean,required:!1,default:!0},legendValues:{type:Object,required:!1,default:null},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue},zoom:{type:Boolean,required:!1,default:!1}},emits:["zoom-time-range"],setup(n,{emit:t}){const e=n,i=t,{translateUnit:s}=ut.useTranslatedUnits(),r=h.ref(),a=h.ref(hn()),o=h.ref(hn()),l=h.ref([]),c=h.ref(),u=h.ref(h.inject("legendPosition",Ot.Right)),d=h.ref(!1),f=h.reactive({showTooltip:!1,tooltipContext:0,tooltipSeries:[],left:"",top:"",units:h.toRef(e,"metricUnit"),translateUnit:s,offsetX:0,offsetY:0,width:0,height:0,chartType:e.type,locked:!1,chartTooltipSortFn:e.chartTooltipSortFn}),g={id:a.value,afterUpdate(y){l.value=y.options.plugins.legend.labels.generateLabels(y).map(x=>({...x,value:e.legendValues&&e.legendValues[x.text]})).sort(e.chartLegendSortFn)}},p=h.computed(()=>[g,sh,...e.zoom?[Fk]:[],...e.type==="timeseries_line"?[is]:[]]),b=h.computed(()=>`line-${p.value.map(y=>y.id).join("-")}`),_=h.computed(()=>`bar-${p.value.map(y=>y.id).join("-")}`),{options:w}=ut.useLinechartOptions({tooltipState:f,timeRangeMs:h.toRef(e,"timeRangeMs"),granularity:h.toRef(e,"granularity"),legendID:a.value,stacked:h.toRef(e,"stacked"),metricAxesTitle:h.toRef(e,"metricAxesTitle"),dimensionAxesTitle:h.toRef(e,"dimensionAxesTitle")});ut.useReportChartDataForSynthetics(h.toRef(e,"chartData"),h.toRef(e,"syntheticsDataKey"));const k=y=>$a(y,{short:["daily","weekly"].includes(e.granularity)}),M=y=>({[Ot.Right]:"legend-row",[Ot.Bottom]:"column",[Ot.Hidden]:"hidden"})[y],C=({width:y,height:x})=>{f.width=y,f.height=x},S=()=>{var y,x,D;f.locked=!f.locked,r.value&&((x=(y=r.value.chart.tooltip)==null?void 0:y.dataPoints)!=null&&x.length)&&(is.clickedSegment=f.locked?(D=r.value.chart.tooltip)==null?void 0:D.dataPoints[0]:void 0)};h.watch(()=>e.type,()=>{f.locked=!1,f.showTooltip=!1,delete is.clickedSegment});const O=y=>{const{xStart:x,xEnd:D}=y.detail;x&&D&&i("zoom-time-range",{start:new Date(x),end:new Date(D),type:"absolute"}),d.value=!1,S(),is.pause=!1},T=()=>{d.value=!0,is.pause=!0};return h.watch(()=>{var y;return(y=r.value)==null?void 0:y.chart},()=>{var y;(y=r.value)!=null&&y.chart&&(r.value.chart.canvas.removeEventListener("dragSelect",O),r.value.chart.canvas.removeEventListener("dragSelectMove",T),r.value.chart.canvas.addEventListener("dragSelect",O),r.value.chart.canvas.addEventListener("dragSelectMove",T))}),h.onUnmounted(()=>{var y;(y=r.value)!=null&&y.chart&&(r.value.chart.canvas.removeEventListener("dragSelect",O),r.value.chart.canvas.removeEventListener("dragSelectMove",T))}),(y,x)=>(h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["chart-parent",M(u.value)]),"data-testid":"line-chart-parent"},[h.createElementVNode("div",{class:"chart-container",onClick:x[0]||(x[0]=D=>S())},[n.type==="timeseries_line"?(h.openBlock(),h.createBlock(h.unref(Ak),{key:b.value,ref_key:"chartInstance",ref:r,"chart-id":o.value,class:"chart-canvas",data:n.chartData,"data-testid":"time-series-line-chart",options:h.unref(w),plugins:p.value},null,8,["chart-id","data","options","plugins"])):n.type==="timeseries_bar"?(h.openBlock(),h.createBlock(h.unref(Ek),{key:_.value,ref_key:"chartInstance",ref:r,"chart-id":o.value,class:"chart-canvas",data:n.chartData,"data-testid":"time-series-bar-chart",options:h.unref(w),plugins:p.value},null,8,["chart-id","data","options","plugins"])):h.createCommentVNode("",!0)]),d.value?h.createCommentVNode("",!0):(h.openBlock(),h.createBlock(lo,{key:0,ref_key:"tooltipElement",ref:c,context:k(f.tooltipContext),"data-testid":"tooltip",left:f.left,locked:f.locked,series:f.tooltipSeries,"show-tooltip":f.showTooltip,"tooltip-title":n.tooltipTitle,top:f.top,unit:n.metricUnit,onDimensions:C,onLeft:x[1]||(x[1]=D=>f.left=D),onTop:x[2]||(x[2]=D=>f.top=D)},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top","unit"])),h.createVNode(co,{id:a.value,"chart-instance":r.value,"data-testid":"legend",items:l.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-d4af26af"]]);var Ln=(n=>(n.String="string",n.Number="number",n.Boolean="boolean",n.Object="object",n.Undefined="undefined",n))(Ln||{});const Bk=["doughnut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar"],Hk=["gauge","top_n"];var cr={exports:{}};cr.exports,function(n,t){var e=200,i="Expected a function",s="__lodash_hash_undefined__",r=1,a=2,o=1/0,l=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object Boolean]",f="[object Date]",g="[object Error]",p="[object Function]",b="[object GeneratorFunction]",_="[object Map]",w="[object Number]",k="[object Object]",M="[object Promise]",C="[object RegExp]",S="[object Set]",O="[object String]",T="[object Symbol]",y="[object WeakMap]",x="[object ArrayBuffer]",D="[object DataView]",R="[object Float32Array]",L="[object Float64Array]",B="[object Int8Array]",j="[object Int16Array]",G="[object Int32Array]",$="[object Uint8Array]",N="[object Uint8ClampedArray]",st="[object Uint16Array]",z="[object Uint32Array]",St=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bt=/^\w*$/,H=/^\./,E=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,I=/[\\^$.*+?()[\]{}|]/g,W=/\\(\\)?/g,q=/^\[object .+?Constructor\]$/,K=/^(?:0|[1-9]\d*)$/,V={};V[R]=V[L]=V[B]=V[j]=V[G]=V[$]=V[N]=V[st]=V[z]=!0,V[c]=V[u]=V[x]=V[d]=V[D]=V[f]=V[g]=V[p]=V[_]=V[w]=V[k]=V[C]=V[S]=V[O]=V[y]=!1;var Y=typeof ne=="object"&&ne&&ne.Object===Object&&ne,et=typeof self=="object"&&self&&self.Object===Object&&self,X=Y||et||Function("return this")(),wt=t&&!t.nodeType&&t,lt=wt&&!0&&n&&!n.nodeType&&n,Yt=lt&&lt.exports===wt,Dt=Yt&&Y.process,mt=function(){try{return Dt&&Dt.binding("util")}catch{}}(),ie=mt&&mt.isTypedArray;function se(m,v){for(var A=-1,F=m?m.length:0;++A<F;)if(v(m[A],A,m))return!0;return!1}function me(m){return function(v){return v==null?void 0:v[m]}}function ve(m,v){for(var A=-1,F=Array(m);++A<m;)F[A]=v(A);return F}function re(m){return function(v){return m(v)}}function vt(m,v){return m==null?void 0:m[v]}function Tt(m){var v=!1;if(m!=null&&typeof m.toString!="function")try{v=!!(m+"")}catch{}return v}function je(m){var v=-1,A=Array(m.size);return m.forEach(function(F,nt){A[++v]=[nt,F]}),A}function pt(m,v){return function(A){return m(v(A))}}function gn(m){var v=-1,A=Array(m.size);return m.forEach(function(F){A[++v]=F}),A}var ke=Array.prototype,$e=Function.prototype,de=Object.prototype,ye=X["__core-js_shared__"],Me=function(){var m=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return m?"Symbol(src)_1."+m:""}(),Kt=$e.toString,ae=de.hasOwnProperty,zt=de.toString,dr=RegExp("^"+Kt.call(ae).replace(I,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oi=X.Symbol,Fh=X.Uint8Array,ES=de.propertyIsEnumerable,AS=ke.splice,RS=pt(Object.keys,Object),vo=li(X,"DataView"),ss=li(X,"Map"),ko=li(X,"Promise"),Mo=li(X,"Set"),So=li(X,"WeakMap"),rs=li(Object,"create"),LS=Nn(vo),IS=Nn(ss),NS=Nn(ko),FS=Nn(Mo),zS=Nn(So),hr=oi?oi.prototype:void 0,Do=hr?hr.valueOf:void 0,zh=hr?hr.toString:void 0;function In(m){var v=-1,A=m?m.length:0;for(this.clear();++v<A;){var F=m[v];this.set(F[0],F[1])}}function BS(){this.__data__=rs?rs(null):{}}function HS(m){return this.has(m)&&delete this.__data__[m]}function WS(m){var v=this.__data__;if(rs){var A=v[m];return A===s?void 0:A}return ae.call(v,m)?v[m]:void 0}function YS(m){var v=this.__data__;return rs?v[m]!==void 0:ae.call(v,m)}function VS(m,v){var A=this.__data__;return A[m]=rs&&v===void 0?s:v,this}In.prototype.clear=BS,In.prototype.delete=HS,In.prototype.get=WS,In.prototype.has=YS,In.prototype.set=VS;function qe(m){var v=-1,A=m?m.length:0;for(this.clear();++v<A;){var F=m[v];this.set(F[0],F[1])}}function jS(){this.__data__=[]}function $S(m){var v=this.__data__,A=gr(v,m);if(A<0)return!1;var F=v.length-1;return A==F?v.pop():AS.call(v,A,1),!0}function qS(m){var v=this.__data__,A=gr(v,m);return A<0?void 0:v[A][1]}function US(m){return gr(this.__data__,m)>-1}function XS(m,v){var A=this.__data__,F=gr(A,m);return F<0?A.push([m,v]):A[F][1]=v,this}qe.prototype.clear=jS,qe.prototype.delete=$S,qe.prototype.get=qS,qe.prototype.has=US,qe.prototype.set=XS;function Ue(m){var v=-1,A=m?m.length:0;for(this.clear();++v<A;){var F=m[v];this.set(F[0],F[1])}}function GS(){this.__data__={hash:new In,map:new(ss||qe),string:new In}}function KS(m){return pr(this,m).delete(m)}function ZS(m){return pr(this,m).get(m)}function QS(m){return pr(this,m).has(m)}function JS(m,v){return pr(this,m).set(m,v),this}Ue.prototype.clear=GS,Ue.prototype.delete=KS,Ue.prototype.get=ZS,Ue.prototype.has=QS,Ue.prototype.set=JS;function fr(m){var v=-1,A=m?m.length:0;for(this.__data__=new Ue;++v<A;)this.add(m[v])}function tD(m){return this.__data__.set(m,s),this}function eD(m){return this.__data__.has(m)}fr.prototype.add=fr.prototype.push=tD,fr.prototype.has=eD;function Xe(m){this.__data__=new qe(m)}function nD(){this.__data__=new qe}function iD(m){return this.__data__.delete(m)}function sD(m){return this.__data__.get(m)}function rD(m){return this.__data__.has(m)}function aD(m,v){var A=this.__data__;if(A instanceof qe){var F=A.__data__;if(!ss||F.length<e-1)return F.push([m,v]),this;A=this.__data__=new Ue(F)}return A.set(m,v),this}Xe.prototype.clear=nD,Xe.prototype.delete=iD,Xe.prototype.get=sD,Xe.prototype.has=rD,Xe.prototype.set=aD;function oD(m,v){var A=Fn(m)||qh(m)?ve(m.length,String):[],F=A.length,nt=!!F;for(var U in m)ae.call(m,U)&&!(nt&&(U=="length"||Yh(U,F)))&&A.push(U);return A}function gr(m,v){for(var A=m.length;A--;)if($h(m[A][0],v))return A;return-1}var lD=vD();function cD(m,v){return m&&lD(m,v,_r)}function Bh(m,v){v=mr(v,m)?[v]:Hh(v);for(var A=0,F=v.length;m!=null&&A<F;)m=m[yr(v[A++])];return A&&A==F?m:void 0}function uD(m){return zt.call(m)}function dD(m,v){return m!=null&&v in Object(m)}function To(m,v,A,F,nt){return m===v?!0:m==null||v==null||!br(m)&&!xr(v)?m!==m&&v!==v:hD(m,v,To,A,F,nt)}function hD(m,v,A,F,nt,U){var at=Fn(m),Bt=Fn(v),Rt=u,qt=u;at||(Rt=pn(m),Rt=Rt==c?k:Rt),Bt||(qt=pn(v),qt=qt==c?k:qt);var oe=Rt==k&&!Tt(m),le=qt==k&&!Tt(v),Zt=Rt==qt;if(Zt&&!oe)return U||(U=new Xe),at||AD(m)?Wh(m,v,A,F,nt,U):kD(m,v,Rt,A,F,nt,U);if(!(nt&a)){var be=oe&&ae.call(m,"__wrapped__"),xe=le&&ae.call(v,"__wrapped__");if(be||xe){var mn=be?m.value():m,Ge=xe?v.value():v;return U||(U=new Xe),A(mn,Ge,F,nt,U)}}return Zt?(U||(U=new Xe),MD(m,v,A,F,nt,U)):!1}function fD(m,v,A,F){var nt=A.length,U=nt;if(m==null)return!U;for(m=Object(m);nt--;){var at=A[nt];if(at[2]?at[1]!==m[at[0]]:!(at[0]in m))return!1}for(;++nt<U;){at=A[nt];var Bt=at[0],Rt=m[Bt],qt=at[1];if(at[2]){if(Rt===void 0&&!(Bt in m))return!1}else{var oe=new Xe,le;if(!(le===void 0?To(qt,Rt,F,r|a,oe):le))return!1}}return!0}function gD(m){if(!br(m)||CD(m))return!1;var v=Xh(m)||Tt(m)?dr:q;return v.test(Nn(m))}function pD(m){return xr(m)&&Po(m.length)&&!!V[zt.call(m)]}function mD(m){return typeof m=="function"?m:m==null?FD:typeof m=="object"?Fn(m)?xD(m[0],m[1]):bD(m):zD(m)}function yD(m){if(!PD(m))return RS(m);var v=[];for(var A in Object(m))ae.call(m,A)&&A!="constructor"&&v.push(A);return v}function bD(m){var v=SD(m);return v.length==1&&v[0][2]?jh(v[0][0],v[0][1]):function(A){return A===m||fD(A,m,v)}}function xD(m,v){return mr(m)&&Vh(v)?jh(yr(m),v):function(A){var F=LD(A,m);return F===void 0&&F===v?ID(A,m):To(v,F,void 0,r|a)}}function _D(m){return function(v){return Bh(v,m)}}function wD(m){if(typeof m=="string")return m;if(Oo(m))return zh?zh.call(m):"";var v=m+"";return v=="0"&&1/m==-o?"-0":v}function Hh(m){return Fn(m)?m:OD(m)}function vD(m){return function(v,A,F){for(var nt=-1,U=Object(v),at=F(v),Bt=at.length;Bt--;){var Rt=at[++nt];if(A(U[Rt],Rt,U)===!1)break}return v}}function Wh(m,v,A,F,nt,U){var at=nt&a,Bt=m.length,Rt=v.length;if(Bt!=Rt&&!(at&&Rt>Bt))return!1;var qt=U.get(m);if(qt&&U.get(v))return qt==v;var oe=-1,le=!0,Zt=nt&r?new fr:void 0;for(U.set(m,v),U.set(v,m);++oe<Bt;){var be=m[oe],xe=v[oe];if(F)var mn=at?F(xe,be,oe,v,m,U):F(be,xe,oe,m,v,U);if(mn!==void 0){if(mn)continue;le=!1;break}if(Zt){if(!se(v,function(Ge,zn){if(!Zt.has(zn)&&(be===Ge||A(be,Ge,F,nt,U)))return Zt.add(zn)})){le=!1;break}}else if(!(be===xe||A(be,xe,F,nt,U))){le=!1;break}}return U.delete(m),U.delete(v),le}function kD(m,v,A,F,nt,U,at){switch(A){case D:if(m.byteLength!=v.byteLength||m.byteOffset!=v.byteOffset)return!1;m=m.buffer,v=v.buffer;case x:return!(m.byteLength!=v.byteLength||!F(new Fh(m),new Fh(v)));case d:case f:case w:return $h(+m,+v);case g:return m.name==v.name&&m.message==v.message;case C:case O:return m==v+"";case _:var Bt=je;case S:var Rt=U&a;if(Bt||(Bt=gn),m.size!=v.size&&!Rt)return!1;var qt=at.get(m);if(qt)return qt==v;U|=r,at.set(m,v);var oe=Wh(Bt(m),Bt(v),F,nt,U,at);return at.delete(m),oe;case T:if(Do)return Do.call(m)==Do.call(v)}return!1}function MD(m,v,A,F,nt,U){var at=nt&a,Bt=_r(m),Rt=Bt.length,qt=_r(v),oe=qt.length;if(Rt!=oe&&!at)return!1;for(var le=Rt;le--;){var Zt=Bt[le];if(!(at?Zt in v:ae.call(v,Zt)))return!1}var be=U.get(m);if(be&&U.get(v))return be==v;var xe=!0;U.set(m,v),U.set(v,m);for(var mn=at;++le<Rt;){Zt=Bt[le];var Ge=m[Zt],zn=v[Zt];if(F)var Gh=at?F(zn,Ge,Zt,v,m,U):F(Ge,zn,Zt,m,v,U);if(!(Gh===void 0?Ge===zn||A(Ge,zn,F,nt,U):Gh)){xe=!1;break}mn||(mn=Zt=="constructor")}if(xe&&!mn){var wr=m.constructor,vr=v.constructor;wr!=vr&&"constructor"in m&&"constructor"in v&&!(typeof wr=="function"&&wr instanceof wr&&typeof vr=="function"&&vr instanceof vr)&&(xe=!1)}return U.delete(m),U.delete(v),xe}function pr(m,v){var A=m.__data__;return TD(v)?A[typeof v=="string"?"string":"hash"]:A.map}function SD(m){for(var v=_r(m),A=v.length;A--;){var F=v[A],nt=m[F];v[A]=[F,nt,Vh(nt)]}return v}function li(m,v){var A=vt(m,v);return gD(A)?A:void 0}var pn=uD;(vo&&pn(new vo(new ArrayBuffer(1)))!=D||ss&&pn(new ss)!=_||ko&&pn(ko.resolve())!=M||Mo&&pn(new Mo)!=S||So&&pn(new So)!=y)&&(pn=function(m){var v=zt.call(m),A=v==k?m.constructor:void 0,F=A?Nn(A):void 0;if(F)switch(F){case LS:return D;case IS:return _;case NS:return M;case FS:return S;case zS:return y}return v});function DD(m,v,A){v=mr(v,m)?[v]:Hh(v);for(var F,nt=-1,at=v.length;++nt<at;){var U=yr(v[nt]);if(!(F=m!=null&&A(m,U)))break;m=m[U]}if(F)return F;var at=m?m.length:0;return!!at&&Po(at)&&Yh(U,at)&&(Fn(m)||qh(m))}function Yh(m,v){return v=v??l,!!v&&(typeof m=="number"||K.test(m))&&m>-1&&m%1==0&&m<v}function mr(m,v){if(Fn(m))return!1;var A=typeof m;return A=="number"||A=="symbol"||A=="boolean"||m==null||Oo(m)?!0:bt.test(m)||!St.test(m)||v!=null&&m in Object(v)}function TD(m){var v=typeof m;return v=="string"||v=="number"||v=="symbol"||v=="boolean"?m!=="__proto__":m===null}function CD(m){return!!Me&&Me in m}function PD(m){var v=m&&m.constructor,A=typeof v=="function"&&v.prototype||de;return m===A}function Vh(m){return m===m&&!br(m)}function jh(m,v){return function(A){return A==null?!1:A[m]===v&&(v!==void 0||m in Object(A))}}var OD=Co(function(m){m=RD(m);var v=[];return H.test(m)&&v.push(""),m.replace(E,function(A,F,nt,U){v.push(nt?U.replace(W,"$1"):F||A)}),v});function yr(m){if(typeof m=="string"||Oo(m))return m;var v=m+"";return v=="0"&&1/m==-o?"-0":v}function Nn(m){if(m!=null){try{return Kt.call(m)}catch{}try{return m+""}catch{}}return""}function Co(m,v){if(typeof m!="function"||v&&typeof v!="function")throw new TypeError(i);var A=function(){var F=arguments,nt=v?v.apply(this,F):F[0],U=A.cache;if(U.has(nt))return U.get(nt);var at=m.apply(this,F);return A.cache=U.set(nt,at),at};return A.cache=new(Co.Cache||Ue),A}Co.Cache=Ue;function $h(m,v){return m===v||m!==m&&v!==v}function qh(m){return ED(m)&&ae.call(m,"callee")&&(!ES.call(m,"callee")||zt.call(m)==c)}var Fn=Array.isArray;function Uh(m){return m!=null&&Po(m.length)&&!Xh(m)}function ED(m){return xr(m)&&Uh(m)}function Xh(m){var v=br(m)?zt.call(m):"";return v==p||v==b}function Po(m){return typeof m=="number"&&m>-1&&m%1==0&&m<=l}function br(m){var v=typeof m;return!!m&&(v=="object"||v=="function")}function xr(m){return!!m&&typeof m=="object"}function Oo(m){return typeof m=="symbol"||xr(m)&&zt.call(m)==T}var AD=ie?re(ie):pD;function RD(m){return m==null?"":wD(m)}function LD(m,v,A){var F=m==null?void 0:Bh(m,v);return F===void 0?A:F}function ID(m,v){return m!=null&&DD(m,v,dD)}function _r(m){return Uh(m)?oD(m):yD(m)}function ND(m,v){var A={};return v=mD(v),cD(m,function(F,nt,U){A[v(F,nt,U)]=F}),A}function FD(m){return m}function zD(m){return mr(m)?me(yr(m)):_D(m)}n.exports=ND}(cr,cr.exports);var Wk=cr.exports;const Yk=Na(Wk);var Vk=1/0,jk=9007199254740991,$k="[object Arguments]",qk="[object Function]",Uk="[object GeneratorFunction]",Xk="[object Symbol]",Gk=typeof ne=="object"&&ne&&ne.Object===Object&&ne,Kk=typeof self=="object"&&self&&self.Object===Object&&self,Zk=Gk||Kk||Function("return this")();function Qk(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}function Jk(n,t){for(var e=-1,i=n?n.length:0,s=Array(i);++e<i;)s[e]=t(n[e],e,n);return s}function tM(n,t){for(var e=-1,i=t.length,s=n.length;++e<i;)n[s+e]=t[e];return n}var fo=Object.prototype,eM=fo.hasOwnProperty,go=fo.toString,fh=Zk.Symbol,nM=fo.propertyIsEnumerable,gh=fh?fh.isConcatSpreadable:void 0,ph=Math.max;function iM(n,t,e,i,s){var r=-1,a=n.length;for(e||(e=oM),s||(s=[]);++r<a;){var o=n[r];e(o)?tM(s,o):s[s.length]=o}return s}function sM(n,t){return n=Object(n),rM(n,t,function(e,i){return i in n})}function rM(n,t,e){for(var i=-1,s=t.length,r={};++i<s;){var a=t[i],o=n[a];e(o,a)&&(r[a]=o)}return r}function aM(n,t){return t=ph(t===void 0?n.length-1:t,0),function(){for(var e=arguments,i=-1,s=ph(e.length-t,0),r=Array(s);++i<s;)r[i]=e[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=e[i];return a[t]=r,Qk(n,this,a)}}function oM(n){return uM(n)||cM(n)||!!(gh&&n&&n[gh])}function lM(n){if(typeof n=="string"||mM(n))return n;var t=n+"";return t=="0"&&1/n==-Vk?"-0":t}function cM(n){return hM(n)&&eM.call(n,"callee")&&(!nM.call(n,"callee")||go.call(n)==$k)}var uM=Array.isArray;function dM(n){return n!=null&&gM(n.length)&&!fM(n)}function hM(n){return mh(n)&&dM(n)}function fM(n){var t=pM(n)?go.call(n):"";return t==qk||t==Uk}function gM(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=jk}function pM(n){var t=typeof n;return!!n&&(t=="object"||t=="function")}function mh(n){return!!n&&typeof n=="object"}function mM(n){return typeof n=="symbol"||mh(n)&&go.call(n)==Xk}var yM=aM(function(n,t){return n==null?{}:sM(n,Jk(iM(t),lM))}),bM=yM;const xM=Na(bM);var yh={exports:{}};(function(n,t){(function(e,i){i()})(ne,function(){function e(c,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,u,d){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){l(f.response,u,d)},f.onerror=function(){console.error("could not download file")},f.send()}function s(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ne=="object"&&ne.global===ne?ne:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(c,u,d){var f=a.URL||a.webkitURL,g=document.createElement("a");u=u||c.name||"download",g.download=u,g.rel="noopener",typeof c=="string"?(g.href=c,g.origin===location.origin?r(g):s(g.href)?i(c,u,d):r(g,g.target="_blank")):(g.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(g.href)},4e4),setTimeout(function(){r(g)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(e(c,d),u);else if(s(c))i(c,u,d);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){r(f)})}}:function(c,u,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return i(c,u,d);var g=c.type==="application/octet-stream",p=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||g&&p||o)&&typeof FileReader<"u"){var _=new FileReader;_.onloadend=function(){var M=_.result;M=b?M:M.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=M:location=M,f=null},_.readAsDataURL(c)}else{var w=a.URL||a.webkitURL,k=w.createObjectURL(c);f?f.location=k:location.href=k,f=null,setTimeout(function(){w.revokeObjectURL(k)},4e4)}});a.saveAs=l.saveAs=l,n.exports=l})})(yh);var _M=yh.exports,bh={exports:{}};/* @license
28
+ */const kk={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"};Il._date.override({_id:"date-fns",formats:function(){return kk},parse:function(n,t){if(n===null||typeof n>"u")return null;const e=typeof n;return e==="number"||n instanceof Date?n=tt(n):e==="string"&&(typeof t=="string"?n=yx(n,t,new Date,this.options):n=_u(n,this.options)),wa(n)?n.getTime():null},format:function(n,t){return gu(n,t,this.options)},add:function(n,t,e){switch(e){case"millisecond":return xa(n,t);case"second":return hb(n,t);case"minute":return ub(n,t);case"hour":return ob(n,t);case"day":return Ys(n,t);case"week":return fb(n,t);case"month":return ba(n,t);case"quarter":return db(n,t);case"year":return gb(n,t);default:return n}},diff:function(n,t,e){switch(e){case"millisecond":return va(n,t);case"second":return vb(n,t);case"minute":return xb(n,t);case"hour":return bb(n,t);case"day":return Qc(n,t);case"week":return kb(n,t);case"month":return nu(n,t);case"quarter":return wb(n,t);case"year":return Mb(n,t);default:return 0}},startOf:function(n,t,e){switch(t){case"second":return wx(n);case"minute":return _x(n);case"hour":return xx(n);case"day":return _a(n);case"week":return Ce(n);case"isoWeek":return Ce(n,{weekStartsOn:+e});case"month":return Db(n);case"quarter":return Sb(n);case"year":return iu(n);default:return n}},endOf:function(n,t){switch(t){case"second":return Ab(n);case"minute":return Ob(n);case"hour":return Cb(n);case"day":return tu(n);case"week":return Pb(n);case"month":return eu(n);case"quarter":return Eb(n);case"year":return Tb(n);default:return n}}});const oh={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Mk={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...oh,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},Sk=h.version[0]==="2"?(n,t)=>Object.assign(n,{attrs:t}):(n,t)=>Object.assign(n,t);function ri(n){return h.isProxy(n)?h.toRaw(n):n}function Dk(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n;return h.isProxy(t)?new Proxy(n,{}):n}function Tk(n,t){const e=n.options;e&&t&&Object.assign(e,t)}function lh(n,t){n.labels=t}function ch(n,t,e){const i=[];n.datasets=t.map(s=>{const r=n.datasets.find(a=>a[e]===s[e]);return!r||!s.data||i.includes(r)?{...s}:(i.push(r),Object.assign(r,s),r)})}function Ck(n,t){const e={labels:[],datasets:[]};return lh(e,n.labels),ch(e,n.datasets,t),e}const Pk=h.defineComponent({props:Mk,setup(n,t){let{expose:e,slots:i}=t;const s=h.ref(null),r=h.shallowRef(null);e({chart:r});const a=()=>{if(!s.value)return;const{type:c,data:u,options:d,plugins:f,datasetIdKey:g}=n,p=Ck(u,g),b=Dk(p,u);r.value=new ge(s.value,{type:c,data:b,options:{...d},plugins:f})},o=()=>{const c=h.toRaw(r.value);c&&(n.destroyDelay>0?setTimeout(()=>{c.destroy(),r.value=null},n.destroyDelay):(c.destroy(),r.value=null))},l=c=>{c.update(n.updateMode)};return h.onMounted(a),h.onUnmounted(o),h.watch([()=>n.options,()=>n.data],(c,u)=>{let[d,f]=c,[g,p]=u;const b=h.toRaw(r.value);if(!b)return;let _=!1;if(d){const w=ri(d),k=ri(g);w&&w!==k&&(Tk(b,w),_=!0)}if(f){const w=ri(f.labels),k=ri(p.labels),M=ri(f.datasets),C=ri(p.datasets);w!==k&&(lh(b.config.data,w),_=!0),M&&M!==C&&(ch(b.config.data,M,n.datasetIdKey),_=!0)}_&&h.nextTick(()=>{l(b)})},{deep:!0}),()=>h.h("canvas",{role:"img",ariaLabel:n.ariaLabel,ariaDescribedby:n.ariaDescribedby,ref:s},[h.h("p",{},[i.default?i.default():""])])}});function ho(n,t){return ge.register(t),h.defineComponent({props:oh,setup(e,i){let{expose:s}=i;const r=h.shallowRef(null),a=o=>{r.value=o==null?void 0:o.chart};return s({chart:r}),()=>h.h(Pk,Sk({ref:a},{type:n,...e}))}})}const Ok=ho("bar",ki),uh=ho("doughnut",ze),Ek=ho("line",Mi),Ak={class:"chart-container"},Rk=h.defineComponent({__name:"DoughnutChart",props:{chartData:{type:Object,required:!1,default:null},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Ot.Right},legendValues:{type:Object,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:He}},setup(n){const t=n,{translateUnit:e}=ut.useTranslatedUnits(),i=h.ref(hn()),s=h.ref(hn()),r=h.ref([]),a=h.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:h.toRef(t,"metricUnit"),translateUnit:e,offsetX:0,offsetY:0,width:0,height:0,chartType:"doughnut"}),o={id:i.value,afterUpdate(b){r.value=b.options.plugins.legend.labels.generateLabels(b).map(_=>({..._,value:t.legendValues&&t.legendValues[_.text],hidden:!1}))}},l=h.computed(()=>[o]),c=h.computed(()=>[t.chartData.datasets.reduce((_,w)=>(_.labels.push(w.label),_.backgroundColor.push(w.backgroundColor),_.borderColor.push(Tu(w.backgroundColor,50)),_.data.push(w.data.reduce((k,M)=>k+M,0)),_),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),u=h.computed(()=>({...t.chartData,datasets:c.value}));ut.useReportChartDataForSynthetics(h.toRef(t,"chartData"),h.toRef(t,"syntheticsDataKey"));const{options:d}=ut.useDoughnutChartOptions({tooltipState:a,legendID:i.value}),f=h.ref(),g=b=>({[Ot.Right]:"legend-row",[Ot.Bottom]:"column",[Ot.Hidden]:"hidden"})[b],p=({width:b,height:_})=>{a.width=b,a.height=_};return(b,_)=>(h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["chart-parent",g(n.legendPosition)]),"data-testid":"doughnut-chart-parent"},[h.createElementVNode("div",Ak,[h.createVNode(h.unref(uh),{ref_key:"chartInstance",ref:f,"chart-id":s.value,data:u.value,options:h.unref(d),plugins:l.value},null,8,["chart-id","data","options","plugins"]),h.createVNode(lo,{left:a.left,series:a.tooltipSeries,"show-tooltip":a.showTooltip,"tooltip-title":n.tooltipTitle,top:a.top,unit:n.metricUnit,onDimensions:p},null,8,["left","series","show-tooltip","tooltip-title","top","unit"])]),h.createVNode(co,{id:i.value,"chart-instance":f.value,items:r.value,position:n.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),Lk=Ve(Rk,[["__scopeId","data-v-5cc0c740"]]),dh=(n,t,e,i)=>{n.save(),n.beginPath(),n.moveTo(t,e),n.lineTo(t,i),n.lineWidth=1,n.strokeStyle="#0275d8",n.stroke(),n.restore()},is={id:"linePlugin",afterDatasetsDraw:function(n){if(!this.pause&&n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&!this.clickedSegment){const{x:t}=n.tooltip.dataPoints[0].element,e=n.ctx;dh(e,t,n.scales.y.top,n.scales.y.bottom)}if(!this.pause&&this.clickedSegment){const{x:t}=this.clickedSegment.element,e=n.ctx;dh(e,t,n.scales.y.top,n.scales.y.bottom)}},beforeDestroy(){delete this.clickedSegment}},Ik=(n,t,e)=>{const i=n.ctx;i.save(),i.fillStyle="rgba(200, 200, 200, 0.5)",i.fillRect(t,n.chartArea.top,e-t,n.chartArea.bottom-n.chartArea.top),i.restore()},hh=(n,t,e)=>{const i=t.scales.x.getValueForPixel(e.startX),s=t.scales.x.getValueForPixel(e.endX);t.canvas.dispatchEvent(new CustomEvent(n,{detail:{xStart:i,xEnd:s}}))},Nk={id:"dragSelectPlugin",isDragging:!1,startX:0,endX:0,beforeInit:function(n){const t=n.canvas,e=t.getBoundingClientRect();let i=!1;const s=o=>{this.dragTimeout=window.setTimeout(()=>{this.isDragging=!0,i=!0,this.startX=o.clientX-e.left},150)},r=o=>{i&&this.isDragging&&(this.endX=o.clientX-e.left,hh("dragSelectMove",n,this),n.update())},a=o=>{clearTimeout(this.dragTimeout),i&&this.isDragging&&(this.endX=o.clientX-e.left,hh("dragSelect",n,this),n.update(),this.isDragging=!1,i=!1)};t.addEventListener("mousedown",s),t.addEventListener("mousemove",r),t.addEventListener("mouseup",a),this.dragSelectHandlers={onMouseDown:s,onMouseMove:r,onMouseUp:a}},beforeDestroy(n){const t=n.canvas;if(this.dragSelectHandlers){const{onMouseDown:e,onMouseMove:i,onMouseUp:s}=this.dragSelectHandlers;t.removeEventListener("mousedown",e),t.removeEventListener("mousemove",i),t.removeEventListener("mouseup",s)}this.isDragging=!1},afterDatasetsDraw:function(n){this.isDragging&&Ik(n,this.startX,this.endX)}},Fk=Ve(h.defineComponent({__name:"TimeSeriesChart",props:{chartData:{type:Object,required:!1,default:null},type:{type:String,required:!1,default:"timeseries_line"},fill:{type:Boolean,required:!1,default:!1},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},timeRangeMs:{type:Number,required:!1,default:void 0},granularity:{type:String,required:!0},stacked:{type:Boolean,required:!1,default:!0},legendValues:{type:Object,required:!1,default:null},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue},zoom:{type:Boolean,required:!1,default:!1}},emits:["zoom-time-range"],setup(n,{emit:t}){const e=n,i=t,{translateUnit:s}=ut.useTranslatedUnits(),r=h.ref(),a=h.ref(hn()),o=h.ref(hn()),l=h.ref([]),c=h.ref(),u=h.ref(h.inject("legendPosition",Ot.Right)),d=h.ref(!1),f=h.reactive({showTooltip:!1,tooltipContext:0,tooltipSeries:[],left:"",top:"",units:h.toRef(e,"metricUnit"),translateUnit:s,offsetX:0,offsetY:0,width:0,height:0,chartType:e.type,locked:!1,chartTooltipSortFn:e.chartTooltipSortFn}),g={id:a.value,afterUpdate(y){l.value=y.options.plugins.legend.labels.generateLabels(y).map(x=>({...x,value:e.legendValues&&e.legendValues[x.text]})).sort(e.chartLegendSortFn)}},p=h.computed(()=>[g,sh,...e.zoom?[Nk]:[],...e.type==="timeseries_line"?[is]:[]]),b=h.computed(()=>`line-${p.value.map(y=>y.id).join("-")}`),_=h.computed(()=>`bar-${p.value.map(y=>y.id).join("-")}`),{options:w}=ut.useLinechartOptions({tooltipState:f,timeRangeMs:h.toRef(e,"timeRangeMs"),granularity:h.toRef(e,"granularity"),legendID:a.value,stacked:h.toRef(e,"stacked"),metricAxesTitle:h.toRef(e,"metricAxesTitle"),dimensionAxesTitle:h.toRef(e,"dimensionAxesTitle")});ut.useReportChartDataForSynthetics(h.toRef(e,"chartData"),h.toRef(e,"syntheticsDataKey"));const k=y=>$a(y,{short:["daily","weekly"].includes(e.granularity)}),M=y=>({[Ot.Right]:"legend-row",[Ot.Bottom]:"column",[Ot.Hidden]:"hidden"})[y],C=({width:y,height:x})=>{f.width=y,f.height=x},S=()=>{var y,x,D;f.locked=!f.locked,r.value&&((x=(y=r.value.chart.tooltip)==null?void 0:y.dataPoints)!=null&&x.length)&&(is.clickedSegment=f.locked?(D=r.value.chart.tooltip)==null?void 0:D.dataPoints[0]:void 0)};h.watch(()=>e.type,()=>{f.locked=!1,f.showTooltip=!1,delete is.clickedSegment});const O=y=>{const{xStart:x,xEnd:D}=y.detail;x&&D&&i("zoom-time-range",{start:new Date(x),end:new Date(D),type:"absolute"}),d.value=!1,S(),is.pause=!1},T=()=>{d.value=!0,is.pause=!0};return h.watch(()=>{var y;return(y=r.value)==null?void 0:y.chart},()=>{var y;(y=r.value)!=null&&y.chart&&(r.value.chart.canvas.removeEventListener("dragSelect",O),r.value.chart.canvas.removeEventListener("dragSelectMove",T),r.value.chart.canvas.addEventListener("dragSelect",O),r.value.chart.canvas.addEventListener("dragSelectMove",T))}),h.onUnmounted(()=>{var y;(y=r.value)!=null&&y.chart&&(r.value.chart.canvas.removeEventListener("dragSelect",O),r.value.chart.canvas.removeEventListener("dragSelectMove",T))}),(y,x)=>(h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["chart-parent",M(u.value)]),"data-testid":"line-chart-parent"},[h.createElementVNode("div",{class:"chart-container",onClick:x[0]||(x[0]=D=>S())},[n.type==="timeseries_line"?(h.openBlock(),h.createBlock(h.unref(Ek),{key:b.value,ref_key:"chartInstance",ref:r,"chart-id":o.value,class:"chart-canvas",data:n.chartData,"data-testid":"time-series-line-chart",options:h.unref(w),plugins:p.value},null,8,["chart-id","data","options","plugins"])):n.type==="timeseries_bar"?(h.openBlock(),h.createBlock(h.unref(Ok),{key:_.value,ref_key:"chartInstance",ref:r,"chart-id":o.value,class:"chart-canvas",data:n.chartData,"data-testid":"time-series-bar-chart",options:h.unref(w),plugins:p.value},null,8,["chart-id","data","options","plugins"])):h.createCommentVNode("",!0)]),d.value?h.createCommentVNode("",!0):(h.openBlock(),h.createBlock(lo,{key:0,ref_key:"tooltipElement",ref:c,context:k(f.tooltipContext),"data-testid":"tooltip",left:f.left,locked:f.locked,series:f.tooltipSeries,"show-tooltip":f.showTooltip,"tooltip-title":n.tooltipTitle,top:f.top,unit:n.metricUnit,onDimensions:C,onLeft:x[1]||(x[1]=D=>f.left=D),onTop:x[2]||(x[2]=D=>f.top=D)},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top","unit"])),h.createVNode(co,{id:a.value,"chart-instance":r.value,"data-testid":"legend",items:l.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-d4af26af"]]);var Ln=(n=>(n.String="string",n.Number="number",n.Boolean="boolean",n.Object="object",n.Undefined="undefined",n))(Ln||{});const zk=["doughnut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar"],Bk=["gauge","top_n"];var cr={exports:{}};cr.exports,function(n,t){var e=200,i="Expected a function",s="__lodash_hash_undefined__",r=1,a=2,o=1/0,l=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object Boolean]",f="[object Date]",g="[object Error]",p="[object Function]",b="[object GeneratorFunction]",_="[object Map]",w="[object Number]",k="[object Object]",M="[object Promise]",C="[object RegExp]",S="[object Set]",O="[object String]",T="[object Symbol]",y="[object WeakMap]",x="[object ArrayBuffer]",D="[object DataView]",R="[object Float32Array]",L="[object Float64Array]",B="[object Int8Array]",j="[object Int16Array]",G="[object Int32Array]",$="[object Uint8Array]",N="[object Uint8ClampedArray]",st="[object Uint16Array]",z="[object Uint32Array]",St=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bt=/^\w*$/,H=/^\./,E=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,I=/[\\^$.*+?()[\]{}|]/g,W=/\\(\\)?/g,q=/^\[object .+?Constructor\]$/,K=/^(?:0|[1-9]\d*)$/,V={};V[R]=V[L]=V[B]=V[j]=V[G]=V[$]=V[N]=V[st]=V[z]=!0,V[c]=V[u]=V[x]=V[d]=V[D]=V[f]=V[g]=V[p]=V[_]=V[w]=V[k]=V[C]=V[S]=V[O]=V[y]=!1;var Y=typeof ne=="object"&&ne&&ne.Object===Object&&ne,et=typeof self=="object"&&self&&self.Object===Object&&self,X=Y||et||Function("return this")(),wt=t&&!t.nodeType&&t,lt=wt&&!0&&n&&!n.nodeType&&n,Yt=lt&&lt.exports===wt,Dt=Yt&&Y.process,mt=function(){try{return Dt&&Dt.binding("util")}catch{}}(),ie=mt&&mt.isTypedArray;function se(m,v){for(var A=-1,F=m?m.length:0;++A<F;)if(v(m[A],A,m))return!0;return!1}function me(m){return function(v){return v==null?void 0:v[m]}}function ve(m,v){for(var A=-1,F=Array(m);++A<m;)F[A]=v(A);return F}function re(m){return function(v){return m(v)}}function vt(m,v){return m==null?void 0:m[v]}function Tt(m){var v=!1;if(m!=null&&typeof m.toString!="function")try{v=!!(m+"")}catch{}return v}function je(m){var v=-1,A=Array(m.size);return m.forEach(function(F,nt){A[++v]=[nt,F]}),A}function pt(m,v){return function(A){return m(v(A))}}function gn(m){var v=-1,A=Array(m.size);return m.forEach(function(F){A[++v]=F}),A}var ke=Array.prototype,$e=Function.prototype,de=Object.prototype,ye=X["__core-js_shared__"],Me=function(){var m=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return m?"Symbol(src)_1."+m:""}(),Kt=$e.toString,ae=de.hasOwnProperty,zt=de.toString,dr=RegExp("^"+Kt.call(ae).replace(I,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oi=X.Symbol,Fh=X.Uint8Array,OS=de.propertyIsEnumerable,ES=ke.splice,AS=pt(Object.keys,Object),vo=li(X,"DataView"),ss=li(X,"Map"),ko=li(X,"Promise"),Mo=li(X,"Set"),So=li(X,"WeakMap"),rs=li(Object,"create"),RS=Nn(vo),LS=Nn(ss),IS=Nn(ko),NS=Nn(Mo),FS=Nn(So),hr=oi?oi.prototype:void 0,Do=hr?hr.valueOf:void 0,zh=hr?hr.toString:void 0;function In(m){var v=-1,A=m?m.length:0;for(this.clear();++v<A;){var F=m[v];this.set(F[0],F[1])}}function zS(){this.__data__=rs?rs(null):{}}function BS(m){return this.has(m)&&delete this.__data__[m]}function HS(m){var v=this.__data__;if(rs){var A=v[m];return A===s?void 0:A}return ae.call(v,m)?v[m]:void 0}function WS(m){var v=this.__data__;return rs?v[m]!==void 0:ae.call(v,m)}function YS(m,v){var A=this.__data__;return A[m]=rs&&v===void 0?s:v,this}In.prototype.clear=zS,In.prototype.delete=BS,In.prototype.get=HS,In.prototype.has=WS,In.prototype.set=YS;function qe(m){var v=-1,A=m?m.length:0;for(this.clear();++v<A;){var F=m[v];this.set(F[0],F[1])}}function VS(){this.__data__=[]}function jS(m){var v=this.__data__,A=gr(v,m);if(A<0)return!1;var F=v.length-1;return A==F?v.pop():ES.call(v,A,1),!0}function $S(m){var v=this.__data__,A=gr(v,m);return A<0?void 0:v[A][1]}function qS(m){return gr(this.__data__,m)>-1}function US(m,v){var A=this.__data__,F=gr(A,m);return F<0?A.push([m,v]):A[F][1]=v,this}qe.prototype.clear=VS,qe.prototype.delete=jS,qe.prototype.get=$S,qe.prototype.has=qS,qe.prototype.set=US;function Ue(m){var v=-1,A=m?m.length:0;for(this.clear();++v<A;){var F=m[v];this.set(F[0],F[1])}}function XS(){this.__data__={hash:new In,map:new(ss||qe),string:new In}}function GS(m){return pr(this,m).delete(m)}function KS(m){return pr(this,m).get(m)}function ZS(m){return pr(this,m).has(m)}function QS(m,v){return pr(this,m).set(m,v),this}Ue.prototype.clear=XS,Ue.prototype.delete=GS,Ue.prototype.get=KS,Ue.prototype.has=ZS,Ue.prototype.set=QS;function fr(m){var v=-1,A=m?m.length:0;for(this.__data__=new Ue;++v<A;)this.add(m[v])}function JS(m){return this.__data__.set(m,s),this}function tD(m){return this.__data__.has(m)}fr.prototype.add=fr.prototype.push=JS,fr.prototype.has=tD;function Xe(m){this.__data__=new qe(m)}function eD(){this.__data__=new qe}function nD(m){return this.__data__.delete(m)}function iD(m){return this.__data__.get(m)}function sD(m){return this.__data__.has(m)}function rD(m,v){var A=this.__data__;if(A instanceof qe){var F=A.__data__;if(!ss||F.length<e-1)return F.push([m,v]),this;A=this.__data__=new Ue(F)}return A.set(m,v),this}Xe.prototype.clear=eD,Xe.prototype.delete=nD,Xe.prototype.get=iD,Xe.prototype.has=sD,Xe.prototype.set=rD;function aD(m,v){var A=Fn(m)||qh(m)?ve(m.length,String):[],F=A.length,nt=!!F;for(var U in m)ae.call(m,U)&&!(nt&&(U=="length"||Yh(U,F)))&&A.push(U);return A}function gr(m,v){for(var A=m.length;A--;)if($h(m[A][0],v))return A;return-1}var oD=wD();function lD(m,v){return m&&oD(m,v,_r)}function Bh(m,v){v=mr(v,m)?[v]:Hh(v);for(var A=0,F=v.length;m!=null&&A<F;)m=m[yr(v[A++])];return A&&A==F?m:void 0}function cD(m){return zt.call(m)}function uD(m,v){return m!=null&&v in Object(m)}function To(m,v,A,F,nt){return m===v?!0:m==null||v==null||!br(m)&&!xr(v)?m!==m&&v!==v:dD(m,v,To,A,F,nt)}function dD(m,v,A,F,nt,U){var at=Fn(m),Bt=Fn(v),Rt=u,qt=u;at||(Rt=pn(m),Rt=Rt==c?k:Rt),Bt||(qt=pn(v),qt=qt==c?k:qt);var oe=Rt==k&&!Tt(m),le=qt==k&&!Tt(v),Zt=Rt==qt;if(Zt&&!oe)return U||(U=new Xe),at||ED(m)?Wh(m,v,A,F,nt,U):vD(m,v,Rt,A,F,nt,U);if(!(nt&a)){var be=oe&&ae.call(m,"__wrapped__"),xe=le&&ae.call(v,"__wrapped__");if(be||xe){var mn=be?m.value():m,Ge=xe?v.value():v;return U||(U=new Xe),A(mn,Ge,F,nt,U)}}return Zt?(U||(U=new Xe),kD(m,v,A,F,nt,U)):!1}function hD(m,v,A,F){var nt=A.length,U=nt;if(m==null)return!U;for(m=Object(m);nt--;){var at=A[nt];if(at[2]?at[1]!==m[at[0]]:!(at[0]in m))return!1}for(;++nt<U;){at=A[nt];var Bt=at[0],Rt=m[Bt],qt=at[1];if(at[2]){if(Rt===void 0&&!(Bt in m))return!1}else{var oe=new Xe,le;if(!(le===void 0?To(qt,Rt,F,r|a,oe):le))return!1}}return!0}function fD(m){if(!br(m)||TD(m))return!1;var v=Xh(m)||Tt(m)?dr:q;return v.test(Nn(m))}function gD(m){return xr(m)&&Po(m.length)&&!!V[zt.call(m)]}function pD(m){return typeof m=="function"?m:m==null?ND:typeof m=="object"?Fn(m)?bD(m[0],m[1]):yD(m):FD(m)}function mD(m){if(!CD(m))return AS(m);var v=[];for(var A in Object(m))ae.call(m,A)&&A!="constructor"&&v.push(A);return v}function yD(m){var v=MD(m);return v.length==1&&v[0][2]?jh(v[0][0],v[0][1]):function(A){return A===m||hD(A,m,v)}}function bD(m,v){return mr(m)&&Vh(v)?jh(yr(m),v):function(A){var F=RD(A,m);return F===void 0&&F===v?LD(A,m):To(v,F,void 0,r|a)}}function xD(m){return function(v){return Bh(v,m)}}function _D(m){if(typeof m=="string")return m;if(Oo(m))return zh?zh.call(m):"";var v=m+"";return v=="0"&&1/m==-o?"-0":v}function Hh(m){return Fn(m)?m:PD(m)}function wD(m){return function(v,A,F){for(var nt=-1,U=Object(v),at=F(v),Bt=at.length;Bt--;){var Rt=at[++nt];if(A(U[Rt],Rt,U)===!1)break}return v}}function Wh(m,v,A,F,nt,U){var at=nt&a,Bt=m.length,Rt=v.length;if(Bt!=Rt&&!(at&&Rt>Bt))return!1;var qt=U.get(m);if(qt&&U.get(v))return qt==v;var oe=-1,le=!0,Zt=nt&r?new fr:void 0;for(U.set(m,v),U.set(v,m);++oe<Bt;){var be=m[oe],xe=v[oe];if(F)var mn=at?F(xe,be,oe,v,m,U):F(be,xe,oe,m,v,U);if(mn!==void 0){if(mn)continue;le=!1;break}if(Zt){if(!se(v,function(Ge,zn){if(!Zt.has(zn)&&(be===Ge||A(be,Ge,F,nt,U)))return Zt.add(zn)})){le=!1;break}}else if(!(be===xe||A(be,xe,F,nt,U))){le=!1;break}}return U.delete(m),U.delete(v),le}function vD(m,v,A,F,nt,U,at){switch(A){case D:if(m.byteLength!=v.byteLength||m.byteOffset!=v.byteOffset)return!1;m=m.buffer,v=v.buffer;case x:return!(m.byteLength!=v.byteLength||!F(new Fh(m),new Fh(v)));case d:case f:case w:return $h(+m,+v);case g:return m.name==v.name&&m.message==v.message;case C:case O:return m==v+"";case _:var Bt=je;case S:var Rt=U&a;if(Bt||(Bt=gn),m.size!=v.size&&!Rt)return!1;var qt=at.get(m);if(qt)return qt==v;U|=r,at.set(m,v);var oe=Wh(Bt(m),Bt(v),F,nt,U,at);return at.delete(m),oe;case T:if(Do)return Do.call(m)==Do.call(v)}return!1}function kD(m,v,A,F,nt,U){var at=nt&a,Bt=_r(m),Rt=Bt.length,qt=_r(v),oe=qt.length;if(Rt!=oe&&!at)return!1;for(var le=Rt;le--;){var Zt=Bt[le];if(!(at?Zt in v:ae.call(v,Zt)))return!1}var be=U.get(m);if(be&&U.get(v))return be==v;var xe=!0;U.set(m,v),U.set(v,m);for(var mn=at;++le<Rt;){Zt=Bt[le];var Ge=m[Zt],zn=v[Zt];if(F)var Gh=at?F(zn,Ge,Zt,v,m,U):F(Ge,zn,Zt,m,v,U);if(!(Gh===void 0?Ge===zn||A(Ge,zn,F,nt,U):Gh)){xe=!1;break}mn||(mn=Zt=="constructor")}if(xe&&!mn){var wr=m.constructor,vr=v.constructor;wr!=vr&&"constructor"in m&&"constructor"in v&&!(typeof wr=="function"&&wr instanceof wr&&typeof vr=="function"&&vr instanceof vr)&&(xe=!1)}return U.delete(m),U.delete(v),xe}function pr(m,v){var A=m.__data__;return DD(v)?A[typeof v=="string"?"string":"hash"]:A.map}function MD(m){for(var v=_r(m),A=v.length;A--;){var F=v[A],nt=m[F];v[A]=[F,nt,Vh(nt)]}return v}function li(m,v){var A=vt(m,v);return fD(A)?A:void 0}var pn=cD;(vo&&pn(new vo(new ArrayBuffer(1)))!=D||ss&&pn(new ss)!=_||ko&&pn(ko.resolve())!=M||Mo&&pn(new Mo)!=S||So&&pn(new So)!=y)&&(pn=function(m){var v=zt.call(m),A=v==k?m.constructor:void 0,F=A?Nn(A):void 0;if(F)switch(F){case RS:return D;case LS:return _;case IS:return M;case NS:return S;case FS:return y}return v});function SD(m,v,A){v=mr(v,m)?[v]:Hh(v);for(var F,nt=-1,at=v.length;++nt<at;){var U=yr(v[nt]);if(!(F=m!=null&&A(m,U)))break;m=m[U]}if(F)return F;var at=m?m.length:0;return!!at&&Po(at)&&Yh(U,at)&&(Fn(m)||qh(m))}function Yh(m,v){return v=v??l,!!v&&(typeof m=="number"||K.test(m))&&m>-1&&m%1==0&&m<v}function mr(m,v){if(Fn(m))return!1;var A=typeof m;return A=="number"||A=="symbol"||A=="boolean"||m==null||Oo(m)?!0:bt.test(m)||!St.test(m)||v!=null&&m in Object(v)}function DD(m){var v=typeof m;return v=="string"||v=="number"||v=="symbol"||v=="boolean"?m!=="__proto__":m===null}function TD(m){return!!Me&&Me in m}function CD(m){var v=m&&m.constructor,A=typeof v=="function"&&v.prototype||de;return m===A}function Vh(m){return m===m&&!br(m)}function jh(m,v){return function(A){return A==null?!1:A[m]===v&&(v!==void 0||m in Object(A))}}var PD=Co(function(m){m=AD(m);var v=[];return H.test(m)&&v.push(""),m.replace(E,function(A,F,nt,U){v.push(nt?U.replace(W,"$1"):F||A)}),v});function yr(m){if(typeof m=="string"||Oo(m))return m;var v=m+"";return v=="0"&&1/m==-o?"-0":v}function Nn(m){if(m!=null){try{return Kt.call(m)}catch{}try{return m+""}catch{}}return""}function Co(m,v){if(typeof m!="function"||v&&typeof v!="function")throw new TypeError(i);var A=function(){var F=arguments,nt=v?v.apply(this,F):F[0],U=A.cache;if(U.has(nt))return U.get(nt);var at=m.apply(this,F);return A.cache=U.set(nt,at),at};return A.cache=new(Co.Cache||Ue),A}Co.Cache=Ue;function $h(m,v){return m===v||m!==m&&v!==v}function qh(m){return OD(m)&&ae.call(m,"callee")&&(!OS.call(m,"callee")||zt.call(m)==c)}var Fn=Array.isArray;function Uh(m){return m!=null&&Po(m.length)&&!Xh(m)}function OD(m){return xr(m)&&Uh(m)}function Xh(m){var v=br(m)?zt.call(m):"";return v==p||v==b}function Po(m){return typeof m=="number"&&m>-1&&m%1==0&&m<=l}function br(m){var v=typeof m;return!!m&&(v=="object"||v=="function")}function xr(m){return!!m&&typeof m=="object"}function Oo(m){return typeof m=="symbol"||xr(m)&&zt.call(m)==T}var ED=ie?re(ie):gD;function AD(m){return m==null?"":_D(m)}function RD(m,v,A){var F=m==null?void 0:Bh(m,v);return F===void 0?A:F}function LD(m,v){return m!=null&&SD(m,v,uD)}function _r(m){return Uh(m)?aD(m):mD(m)}function ID(m,v){var A={};return v=pD(v),lD(m,function(F,nt,U){A[v(F,nt,U)]=F}),A}function ND(m){return m}function FD(m){return mr(m)?me(yr(m)):xD(m)}n.exports=ID}(cr,cr.exports);var Hk=cr.exports;const Wk=Na(Hk);var Yk=1/0,Vk=9007199254740991,jk="[object Arguments]",$k="[object Function]",qk="[object GeneratorFunction]",Uk="[object Symbol]",Xk=typeof ne=="object"&&ne&&ne.Object===Object&&ne,Gk=typeof self=="object"&&self&&self.Object===Object&&self,Kk=Xk||Gk||Function("return this")();function Zk(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}function Qk(n,t){for(var e=-1,i=n?n.length:0,s=Array(i);++e<i;)s[e]=t(n[e],e,n);return s}function Jk(n,t){for(var e=-1,i=t.length,s=n.length;++e<i;)n[s+e]=t[e];return n}var fo=Object.prototype,tM=fo.hasOwnProperty,go=fo.toString,fh=Kk.Symbol,eM=fo.propertyIsEnumerable,gh=fh?fh.isConcatSpreadable:void 0,ph=Math.max;function nM(n,t,e,i,s){var r=-1,a=n.length;for(e||(e=aM),s||(s=[]);++r<a;){var o=n[r];e(o)?Jk(s,o):s[s.length]=o}return s}function iM(n,t){return n=Object(n),sM(n,t,function(e,i){return i in n})}function sM(n,t,e){for(var i=-1,s=t.length,r={};++i<s;){var a=t[i],o=n[a];e(o,a)&&(r[a]=o)}return r}function rM(n,t){return t=ph(t===void 0?n.length-1:t,0),function(){for(var e=arguments,i=-1,s=ph(e.length-t,0),r=Array(s);++i<s;)r[i]=e[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=e[i];return a[t]=r,Zk(n,this,a)}}function aM(n){return cM(n)||lM(n)||!!(gh&&n&&n[gh])}function oM(n){if(typeof n=="string"||pM(n))return n;var t=n+"";return t=="0"&&1/n==-Yk?"-0":t}function lM(n){return dM(n)&&tM.call(n,"callee")&&(!eM.call(n,"callee")||go.call(n)==jk)}var cM=Array.isArray;function uM(n){return n!=null&&fM(n.length)&&!hM(n)}function dM(n){return mh(n)&&uM(n)}function hM(n){var t=gM(n)?go.call(n):"";return t==$k||t==qk}function fM(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Vk}function gM(n){var t=typeof n;return!!n&&(t=="object"||t=="function")}function mh(n){return!!n&&typeof n=="object"}function pM(n){return typeof n=="symbol"||mh(n)&&go.call(n)==Uk}var mM=rM(function(n,t){return n==null?{}:iM(n,Qk(nM(t),oM))}),yM=mM;const bM=Na(yM);var yh={exports:{}};(function(n,t){(function(e,i){i()})(ne,function(){function e(c,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,u,d){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){l(f.response,u,d)},f.onerror=function(){console.error("could not download file")},f.send()}function s(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ne=="object"&&ne.global===ne?ne:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(c,u,d){var f=a.URL||a.webkitURL,g=document.createElement("a");u=u||c.name||"download",g.download=u,g.rel="noopener",typeof c=="string"?(g.href=c,g.origin===location.origin?r(g):s(g.href)?i(c,u,d):r(g,g.target="_blank")):(g.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(g.href)},4e4),setTimeout(function(){r(g)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(e(c,d),u);else if(s(c))i(c,u,d);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){r(f)})}}:function(c,u,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return i(c,u,d);var g=c.type==="application/octet-stream",p=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||g&&p||o)&&typeof FileReader<"u"){var _=new FileReader;_.onloadend=function(){var M=_.result;M=b?M:M.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=M:location=M,f=null},_.readAsDataURL(c)}else{var w=a.URL||a.webkitURL,k=w.createObjectURL(c);f?f.location=k:location.href=k,f=null,setTimeout(function(){w.revokeObjectURL(k)},4e4)}});a.saveAs=l.saveAs=l,n.exports=l})})(yh);var xM=yh.exports,bh={exports:{}};/* @license
29
29
  Papa Parse
30
30
  v5.4.1
31
31
  https://github.com/mholt/PapaParse
@@ -39,5 +39,5 @@ License: MIT
39
39
  `:"\r"}(Y,wt)),R=!1,y.delimiter)T(y.delimiter)&&(y.delimiter=y.delimiter(Y),H.meta.delimiter=y.delimiter);else{var lt=function(Dt,mt,ie,se,me){var ve,re,vt,Tt;me=me||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var je=0;je<me.length;je++){var pt=me[je],gn=0,ke=0,$e=0;vt=void 0;for(var de=new w({comments:se,delimiter:pt,newline:mt,preview:10}).parse(Dt),ye=0;ye<de.data.length;ye++)if(ie&&I(de.data[ye]))$e++;else{var Me=de.data[ye].length;ke+=Me,vt!==void 0?0<Me&&(gn+=Math.abs(Me-vt),vt=Me):vt=Me}0<de.data.length&&(ke/=de.data.length-$e),(re===void 0||gn<=re)&&(Tt===void 0||Tt<ke)&&1.99<ke&&(re=gn,ve=pt,Tt=ke)}return{successful:!!(y.delimiter=ve),bestDelimiter:ve}}(Y,y.newline,y.skipEmptyLines,y.comments,y.delimitersToGuess);lt.successful?y.delimiter=lt.bestDelimiter:(R=!0,y.delimiter=l.DefaultDelimiter),H.meta.delimiter=y.delimiter}var Yt=S(y);return y.preview&&y.header&&Yt.preview++,x=Y,D=new w(Yt),H=D.parse(x,et,X),W(),z?{meta:{paused:!0}}:H||{meta:{paused:!1}}},this.paused=function(){return z},this.pause=function(){z=!0,D.abort(),x=T(y.chunk)?"":x.substring(D.getCharIndex())},this.resume=function(){$.streamer._halted?(z=!1,$.streamer.parseChunk(x,!0)):setTimeout($.resume,3)},this.aborted=function(){return St},this.abort=function(){St=!0,D.abort(),H.meta.aborted=!0,T(y.complete)&&y.complete(H),x=""}}function _(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(y){var x,D=(y=y||{}).delimiter,R=y.newline,L=y.comments,B=y.step,j=y.preview,G=y.fastMode,$=x=y.quoteChar===void 0||y.quoteChar===null?'"':y.quoteChar;if(y.escapeChar!==void 0&&($=y.escapeChar),(typeof D!="string"||-1<l.BAD_DELIMITERS.indexOf(D))&&(D=","),L===D)throw new Error("Comment character same as delimiter");L===!0?L="#":(typeof L!="string"||-1<l.BAD_DELIMITERS.indexOf(L))&&(L=!1),R!==`
40
40
  `&&R!=="\r"&&R!==`\r
41
41
  `&&(R=`
42
- `);var N=0,st=!1;this.parse=function(z,St,bt){if(typeof z!="string")throw new Error("Input must be a string");var H=z.length,E=D.length,I=R.length,W=L.length,q=T(B),K=[],V=[],Y=[],et=N=0;if(!z)return Kt();if(y.header&&!St){var X=z.split(R)[0].split(D),wt=[],lt={},Yt=!1;for(var Dt in X){var mt=X[Dt];T(y.transformHeader)&&(mt=y.transformHeader(mt,Dt));var ie=mt,se=lt[mt]||0;for(0<se&&(Yt=!0,ie=mt+"_"+se),lt[mt]=se+1;wt.includes(ie);)ie=ie+"_"+se;wt.push(ie)}if(Yt){var me=z.split(R);me[0]=wt.join(D),z=me.join(R)}}if(G||G!==!1&&z.indexOf(x)===-1){for(var ve=z.split(R),re=0;re<ve.length;re++){if(Y=ve[re],N+=Y.length,re!==ve.length-1)N+=R.length;else if(bt)return Kt();if(!L||Y.substring(0,W)!==L){if(q){if(K=[],$e(Y.split(D)),ae(),st)return Kt()}else $e(Y.split(D));if(j&&j<=re)return K=K.slice(0,j),Kt(!0)}}return Kt()}for(var vt=z.indexOf(D,N),Tt=z.indexOf(R,N),je=new RegExp(_($)+_(x),"g"),pt=z.indexOf(x,N);;)if(z[N]!==x)if(L&&Y.length===0&&z.substring(N,N+W)===L){if(Tt===-1)return Kt();N=Tt+I,Tt=z.indexOf(R,N),vt=z.indexOf(D,N)}else if(vt!==-1&&(vt<Tt||Tt===-1))Y.push(z.substring(N,vt)),N=vt+E,vt=z.indexOf(D,N);else{if(Tt===-1)break;if(Y.push(z.substring(N,Tt)),Me(Tt+I),q&&(ae(),st))return Kt();if(j&&K.length>=j)return Kt(!0)}else for(pt=N,N++;;){if((pt=z.indexOf(x,pt+1))===-1)return bt||V.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:K.length,index:N}),ye();if(pt===H-1)return ye(z.substring(N,pt).replace(je,x));if(x!==$||z[pt+1]!==$){if(x===$||pt===0||z[pt-1]!==$){vt!==-1&&vt<pt+1&&(vt=z.indexOf(D,pt+1)),Tt!==-1&&Tt<pt+1&&(Tt=z.indexOf(R,pt+1));var gn=de(Tt===-1?vt:Math.min(vt,Tt));if(z.substr(pt+1+gn,E)===D){Y.push(z.substring(N,pt).replace(je,x)),z[N=pt+1+gn+E]!==x&&(pt=z.indexOf(x,N)),vt=z.indexOf(D,N),Tt=z.indexOf(R,N);break}var ke=de(Tt);if(z.substring(pt+1+ke,pt+1+ke+I)===R){if(Y.push(z.substring(N,pt).replace(je,x)),Me(pt+1+ke+I),vt=z.indexOf(D,N),pt=z.indexOf(x,N),q&&(ae(),st))return Kt();if(j&&K.length>=j)return Kt(!0);break}V.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:K.length,index:N}),pt++}}else pt++}return ye();function $e(zt){K.push(zt),et=N}function de(zt){var dr=0;if(zt!==-1){var oi=z.substring(pt+1,zt);oi&&oi.trim()===""&&(dr=oi.length)}return dr}function ye(zt){return bt||(zt===void 0&&(zt=z.substring(N)),Y.push(zt),N=H,$e(Y),q&&ae()),Kt()}function Me(zt){N=zt,$e(Y),Y=[],Tt=z.indexOf(R,N)}function Kt(zt){return{data:K,errors:V,meta:{delimiter:D,linebreak:R,aborted:st,truncated:!!zt,cursor:et+(St||0)}}}function ae(){B(Kt()),K=[],V=[]}},this.abort=function(){st=!0},this.getCharIndex=function(){return N}}function k(y){var x=y.data,D=a[x.workerId],R=!1;if(x.error)D.userError(x.error,x.file);else if(x.results&&x.results.data){var L={abort:function(){R=!0,M(x.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:C,resume:C};if(T(D.userStep)){for(var B=0;B<x.results.data.length&&(D.userStep({data:x.results.data[B],errors:x.results.errors,meta:x.results.meta},L),!R);B++);delete x.results}else T(D.userChunk)&&(D.userChunk(x.results,L,x.file),delete x.results)}x.finished&&!R&&M(x.workerId,x.results)}function M(y,x){var D=a[y];T(D.userComplete)&&D.userComplete(x),D.terminate(),delete a[y]}function C(){throw new Error("Not implemented.")}function S(y){if(typeof y!="object"||y===null)return y;var x=Array.isArray(y)?[]:{};for(var D in y)x[D]=S(y[D]);return x}function O(y,x){return function(){y.apply(x,arguments)}}function T(y){return typeof y=="function"}return r&&(i.onmessage=function(y){var x=y.data;if(l.WORKER_ID===void 0&&x&&(l.WORKER_ID=x.workerId),typeof x.input=="string")i.postMessage({workerId:l.WORKER_ID,results:l.parse(x.input,x.config),finished:!0});else if(i.File&&x.input instanceof File||x.input instanceof Object){var D=l.parse(x.input,x.config);D&&i.postMessage({workerId:l.WORKER_ID,results:D,finished:!0})}}),(d.prototype=Object.create(u.prototype)).constructor=d,(f.prototype=Object.create(u.prototype)).constructor=f,(g.prototype=Object.create(g.prototype)).constructor=g,(p.prototype=Object.create(u.prototype)).constructor=p,l})})(bh);var wM=bh.exports;const vM=["id"],kM=h.defineComponent({__name:"VueJsonCsv",props:{data:{type:Array,required:!0},fields:{type:Array,required:!1,default:null},labels:{type:Object,required:!1,default:null},filename:{type:String,default:"report-data.csv"},delimiter:{type:String,default:",",required:!1},separatorExcel:{type:Boolean,default:!1},encoding:{type:String,default:"utf-8"},testing:{type:Boolean,required:!1,default:!1}},emits:["export-started","export-finished"],setup(n,{emit:t}){const e=t,i=n,s=h.computed(()=>`export_${new Date().getTime()}`),r=h.computed(()=>{const u=l();return u.length?u:null}),a=()=>{const u=i.labels;if(typeof i.fields!==Ln.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return typeof u===Ln.Object?d=>Yk(d,(f,g)=>u[g]||g):d=>d},o=()=>{const u=i.fields;if(typeof i.fields!==Ln.Object&&!Array.isArray(u))throw new Error("Fields needs to be an array of strings.");return Array.isArray(u)?d=>xM(d,u):d=>d},l=()=>{if(typeof i.fields===Ln.Undefined&&typeof i.labels===Ln.Undefined)return i.data;const u=a(),d=o();return i.data.map(f=>u(d(f)))},c=()=>{if(!(r!=null&&r.value)){console.warn("No data to export");return}e("export-started",r.value);let u=wM.unparse(r.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
43
- `+u),i.encoding==="utf-8"&&(u="\uFEFF"+u),e("export-finished",i.filename),!i.testing){const d=new Blob([u],{type:"text/csv;charset="+i.encoding});_M.saveAs(d,i.filename)}};return(u,d)=>(h.openBlock(),h.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[h.renderSlot(u.$slots,"default",{},()=>[h.createTextVNode("Download "+h.toDisplayString(n.filename),1)])],8,vM))}}),MM=h.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(n){const t=n,e=h.computed(()=>Object.keys(t.headers));return(i,s)=>(h.openBlock(),h.createElementBlock("div",null,[h.createVNode(kM,{data:i.rows,fields:e.value,filename:i.filename,labels:i.headers},{default:h.withCtx(()=>[h.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}});function xh(n,t,e){const i=pu(),s=TM(n,e.timeZone,e.locale??i.locale);return"formatToParts"in s?SM(s,t):DM(s,t)}function SM(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function DM(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function TM(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function CM(n,t){const e=RM(t);return"formatToParts"in e?OM(e,n):EM(e,n)}const PM={year:0,month:1,day:2,hour:3,minute:4,second:5};function OM(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=PM[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function EM(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);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 po={},_h=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")),AM=_h==="06/25/2014, 00:00:00"||_h==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function RM(n){return po[n]||(po[n]=AM?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),po[n]}function wh(n,t,e,i,s,r,a){const o=new Date(0);return o.setUTCFullYear(n,t,e),o.setUTCHours(i,s,r,a),o}const vh=36e5,LM=6e4,mo={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function kh(n,t,e){if(!n)return 0;let i=mo.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=mo.timezoneHH.exec(n),i)return s=parseInt(i[1],10),Mh(s)?-(s*vh):NaN;if(i=mo.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Mh(s,a)?(r=Math.abs(s)*vh+a*LM,i[1]==="+"?-r:r):NaN}if(FM(n)){t=new Date(t||Date.now());const a=e?t:IM(t),o=yo(a,n);return-(e?o:NM(t,o,n))}return NaN}function IM(n){return wh(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function yo(n,t){const e=CM(n,t),i=wh(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function NM(n,t,e){let s=n.getTime()-t;const r=yo(new Date(s),e);if(t===r)return t;s-=r-t;const a=yo(new Date(s),e);return r===a?r:Math.max(r,a)}function Mh(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const Sh={};function FM(n){if(Sh[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),Sh[n]=!0,!0}catch{return!1}}const zM=60*1e3,BM={X:function(n,t,e){const i=bo(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return Dh(i);case"XXXX":case"XX":return ai(i);case"XXXXX":case"XXX":default:return ai(i,":")}},x:function(n,t,e){const i=bo(e.timeZone,n);switch(t){case"x":return Dh(i);case"xxxx":case"xx":return ai(i);case"xxxxx":case"xxx":default:return ai(i,":")}},O:function(n,t,e){const i=bo(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+HM(i,":");case"OOOO":default:return"GMT"+ai(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return xh("short",n,e);case"zzzz":default:return xh("long",n,e)}}};function bo(n,t){const e=n?kh(n,t,!0)/zM:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function ur(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function ai(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ur(Math.floor(i/60),2),r=ur(Math.floor(i%60),2);return e+s+t+r}function Dh(n,t){return n%60===0?(n>0?"-":"+")+ur(Math.abs(n)/60,2):ai(n,t)}function HM(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ur(r,2)}function Th(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const WM=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,xo=36e5,Ch=6e4,YM=2,Gt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,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:WM};function VM(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?YM:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=jM(n),{year:s,restDateString:r}=$M(i.date,e),a=qM(r,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const o=a.getTime();let l=0,c;if(i.time&&(l=UM(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=kh(i.timeZone||t.timeZone,new Date(o+l)),isNaN(c))return new Date(NaN)}else c=Th(new Date(o+l)),c=Th(new Date(o+l+c));return new Date(o+l+c)}else return new Date(NaN)}function jM(n){const t={};let e=Gt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Gt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Gt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function $M(n,t){if(n){const e=Gt.YYY[t],i=Gt.YYYYY[t];let s=Gt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Gt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function qM(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Gt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,Eh(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Gt.DDD.exec(n),r){e=new Date(0);const a=parseInt(r[1],10);return KM(t,a)?(e.setUTCFullYear(t,0,a),e):new Date(NaN)}if(r=Gt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const a=parseInt(r[2],10);return Eh(t,i,a)?(e.setUTCFullYear(t,i,a),e):new Date(NaN)}if(r=Gt.Www.exec(n),r)return s=parseInt(r[1],10)-1,Ah(s)?Ph(t,s):new Date(NaN);if(r=Gt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const a=parseInt(r[2],10)-1;return Ah(s,a)?Ph(t,s,a):new Date(NaN)}return null}function UM(n){let t,e,i=Gt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),_o(t)?t%24*xo:NaN;if(i=Gt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),_o(t,e)?t%24*xo+e*Ch:NaN;if(i=Gt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return _o(t,e,s)?t%24*xo+e*Ch+s*1e3:NaN}return null}function Ph(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const XM=[31,28,31,30,31,30,31,31,30,31,30,31],GM=[31,29,31,30,31,30,31,31,30,31,30,31];function Oh(n){return n%400===0||n%4===0&&n%100!==0}function Eh(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=Oh(n);if(i&&e>GM[t]||!i&&e>XM[t])return!1}return!0}function KM(n,t){if(t<1)return!1;const e=Oh(n);return!(e&&t>366||!e&&t>365)}function Ah(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function _o(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const ZM=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Rh(n,t,e={}){t=String(t);const i=t.match(ZM);if(i){const s=VM(e.originalDate||n,e);t=i.reduce(function(r,a){if(a[0]==="'")return r;const o=r.indexOf(a),l=r[o-1]==="'",c=r.replace(a,"'"+BM[a[0]](s,a,e)+"'");return l?c.substring(0,o-1)+c.substring(o+1):c},t)}return gu(n,t,e)}const QM={class:"kong-ui-public-csv-export-modal"},JM={key:0,class:"selected-range"},tS={key:1,class:"text-muted",tag:"span"},Lh=3,wo=h.defineComponent({__name:"CsvExportModal",props:{filename:{},modalDescription:{default:void 0},chartData:{}},emits:["toggleModal"],setup(n,{emit:t}){const{i18n:e}=ut.useI18n(),i=n,s=t,r=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=h.ref(!0),o=h.computed(()=>{var b,_;return!!((_=(b=i.chartData)==null?void 0:b.data)!=null&&_.length)}),l=h.ref(1),c=h.computed(()=>g.value.rows.length),u=ut.useChartSelectedRange(h.toRef(i,"chartData")),d=h.computed(()=>e.t("csvExport.previewRows",{rowsMax:Math.min(Lh,c.value),rowsTotal:c.value,plural:c.value===1?"":"s"})),f=()=>{s("toggleModal",!1)},g=h.computed(()=>{var S,O,T;if(!o.value||!((S=i.chartData)!=null&&S.meta.metric_names))return{headers:[],rows:[],csvHeaders:{}};const b=i.chartData.data.some(y=>y.timestamp!==i.chartData.data[0].timestamp),_=i.chartData.data.map(y=>{const x=new Date(y.timestamp);return{...Object.keys(y.event).reduce((R,L)=>{if(L in i.chartData.meta.display){const B=y.event[L],j=i.chartData.meta.display[L];R[L]=B&&j&&j[B].name||y.event[L]}else R[L]=y.event[L];return R},{}),...b?{timestamp:Rh(x,"yyyy-MM-dd HH:mm:ss"),tzOffset:Rh(x,"XXX")}:{}}});let w=[];b&&(w=[{label:e.t("csvExport.Timestamp"),key:"timestamp"},{label:e.t("csvExport.UtcOffset"),key:"tzOffset"}]);const k="display"in i.chartData.meta&&((O=i.chartData.meta)!=null&&O.display)?(T=i.chartData.meta)==null?void 0:T.display:{},M=[...w,...Object.keys(k).map(y=>({label:e.t(`chartLabels.${y}`),key:y})),...i.chartData.meta.metric_names.map(y=>({label:e.t(`chartLabels.${y}`),key:y}))],C=M.reduce((y,x)=>(y[x.key]=x.label,y),{});return{headers:M,csvHeaders:C,rows:_}}),p=async()=>{const{rows:b}=g.value;return a.value=!1,{total:Number(b.length)||0,data:b.slice(0,Lh)}};return h.watch(g,()=>{l.value++}),(b,_)=>{const w=h.resolveComponent("KEmptyState"),k=h.resolveComponent("KTableData"),M=h.resolveComponent("KButton"),C=h.resolveComponent("KModal");return h.openBlock(),h.createElementBlock("div",QM,[h.createVNode(C,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:h.unref(e).t("csvExport.exportPreview"),visible:"",onCancel:f,onKeyup:h.withKeys(f,["esc"])},{default:h.withCtx(()=>{var S;return[h.createElementVNode("div",null,[o.value?(h.openBlock(),h.createElementBlock("div",JM,[h.createElementVNode("p",null,h.toDisplayString(b.modalDescription?b.modalDescription:h.unref(e).t("csvExport.exportDescription")),1),h.createElementVNode("p",null,h.toDisplayString(h.unref(e).t("csvExport.exportTimeRange"))+": "+h.toDisplayString(h.unref(u)),1)])):h.createCommentVNode("",!0),h.createVNode(k,{class:"vitals-table",fetcher:p,"fetcher-cache-key":String(l.value),headers:((S=g.value)==null?void 0:S.headers)||[],"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":h.withCtx(()=>[h.createVNode(w,{"action-button-visible":!1},{title:h.withCtx(()=>[h.createElementVNode("h5",null,h.toDisplayString(h.unref(e).t("csvExport.noDataRange")),1)]),default:h.withCtx(()=>[h.createElementVNode("p",null,h.toDisplayString(h.unref(e).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"]),!a.value&&o.value?(h.openBlock(),h.createElementBlock("div",tS,h.toDisplayString(d.value),1)):h.createCommentVNode("",!0)])]}),"footer-actions":h.withCtx(()=>[h.createVNode(M,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(e).t("csvExport.cancelButton")),1)]),_:1}),h.createVNode(MM,{class:"vitals-report-export-button",filename:r,headers:g.value.csvHeaders,rows:g.value.rows},{default:h.withCtx(()=>[h.createVNode(M,{appearance:"primary","data-testid":"csv-download-button",disabled:a.value||!o.value},{default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(e).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}}),Ih=h.defineComponent({__name:"CsvExportButton",props:{data:{type:Object,required:!0},text:{type:String,required:!1,default:void 0},buttonAppearance:{type:String,required:!1,default:()=>"tertiary"},filenamePrefix:{type:String,required:!1,default:void 0}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.computed(()=>t.filenamePrefix||e.t("csvExport.defaultFilename")),s=h.ref(!1),r=o=>{s.value=o},a=()=>{r(!0)};return(o,l)=>{const c=h.resolveComponent("KButton");return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createVNode(c,{appearance:n.buttonAppearance,class:"chart-export-button-display","data-testid":"csv-export-button",onClick:h.withModifiers(a,["prevent"])},{default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(n.text||h.unref(e).t("csvExport.exportButton")),1)]),_:1},8,["appearance"]),s.value?(h.openBlock(),h.createBlock(wo,{key:0,"chart-data":n.data,filename:i.value,onToggleModal:r},null,8,["chart-data","filename"])):h.createCommentVNode("",!0)],64)}}}),eS={class:"chart-header"},nS=["title"],iS={class:"chart-header-icons-wrapper"},sS={key:1,class:"chart-export-button"},rS=["aria-label"],aS=["href"],oS={class:"chart-export-trigger","data-testid":"csv-export-button"},lS={key:1,class:"analytics-chart-parent"},cS=h.defineComponent({__name:"AnalyticsChart",props:{allowCsvExport:{type:Boolean,required:!1,default:!1},goToExplore:{type:String,required:!1,default:""},chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},tooltipTitle:{type:String,required:!1,default:""},emptyStateTitle:{type:String,required:!1,default:""},emptyStateDescription:{type:String,required:!1,default:""},chartTitle:{type:String,required:!1,default:""},filenamePrefix:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Ot.Right},syntheticsDataKey:{type:String,required:!1,default:""},showLegendValues:{type:Boolean,required:!1,default:!0},showAnnotations:{type:Boolean,required:!1,default:!0},timeseriesZoom:{type:Boolean,required:!1,default:!1},showMenu:{type:Boolean,required:!1,default:!1}},emits:["zoom-time-range"],setup(n,{emit:t}){h.useCssVars(E=>({"5a64f2e6":z.value,"29164a3c":St.value}));const e=n,i=t,{i18n:s}=ut.useI18n(),{evaluateFeatureFlag:r}=ut.useEvaluateFeatureFlag(),a=r("ma-3043-analytics-chart-kebab-menu",!1),o=h.toRef(e,"chartData"),l=h.ref(!1),c=h.computed(()=>O.value?ut.useExploreResultToTimeDataset({fill:e.chartOptions.stacked,colorPalette:e.chartOptions.chartDatasetColors||Xs},h.toRef(e,"chartData")).value:ut.useExploreResultToDatasets({fill:e.chartOptions.stacked,colorPalette:e.chartOptions.chartDatasetColors||Xs},h.toRef(e,"chartData")).value),u=h.ref(!1),d=E=>{u.value=E},f=h.computed(()=>e.filenamePrefix||s.t("csvExport.defaultFilename")),g=()=>{d(!0)},p=h.computed(()=>{var E;return(E=e.chartData)!=null&&E.meta?"start_ms"in e.chartData.meta?e.chartData.meta.end_ms-e.chartData.meta.start_ms:void 0:0}),b=h.computed(()=>{var E;return(E=e.chartData.meta)!=null&&E.metric_units?Object.values(e.chartData.meta.metric_units)[0]:""}),_=h.computed(()=>e.showLegendValues&&e.legendPosition!==Ot.Bottom),{legendValues:w}=ut.useChartLegendValues(c,e.chartOptions.type,b),k=h.computed(()=>{var E,I,W;return((W=(I=(E=e.chartData)==null?void 0:E.meta)==null?void 0:I.limit)==null?void 0:W.toString())||null}),M=h.computed(()=>{var E,I;return((I=(E=e.chartData)==null?void 0:E.meta)==null?void 0:I.truncated)||!1}),C=s.t("limitedResultsShown",{maxReturned:k.value}),S=h.computed(()=>["vertical_bar","horizontal_bar"].includes(e.chartOptions.type)),O=h.computed(()=>["timeseries_bar","timeseries_line"].some(E=>E===e.chartOptions.type)),T=h.computed(()=>e.chartOptions.type==="doughnut"),y=h.computed(()=>e.chartOptions.type.includes("vertical")?"vertical":"horizontal"),x=h.computed(()=>{var W,q,K;if(!((W=e.chartData)!=null&&W.meta.metric_names)||!((q=e.chartData)!=null&&q.meta.metric_units))return;const E=e.chartData.meta.metric_names[0],I=e.chartData.meta.metric_units[E];if(e.chartData.meta.metric_names.length>1){if(E.includes("latency"))return s.t("metricAxisTitles.latency_in",{unit:s.t(`chartUnits.${I}`,{plural:"s"})});if(E.includes("size"))return s.t("metricAxisTitles.size_in",{unit:s.t(`chartUnits.${I}`,{plural:"s"})})}return((K=e.chartOptions)==null?void 0:K.metricAxesTitle)||s.te(`metricAxisTitles.${E}`)&&s.te(`chartUnits.${I}`)&&s.t(`metricAxisTitles.${E}`,{unit:s.t(`chartUnits.${I}`,{plural:"s"})})||void 0}),D=h.computed(()=>{const E=O.value?"Time":Object.keys(e.chartData.meta.display||e.chartData.meta.metric_names)[0];return e.chartOptions.dimensionAxesTitle||s.te(`chartLabels.${E}`)&&s.t(`chartLabels.${E}`)||void 0}),R=h.computed(()=>{const E=qa(Number(e.chartData.meta.granularity_ms));return s.t(`granularityAxisTitles.${E}`)}),L=h.computed(()=>e.emptyStateTitle||s.t("noDataAvailableTitle")),B=h.computed(()=>e.emptyStateDescription||s.t("noDataAvailableDescription")),j=h.computed(()=>O.value?Yx(c.value):e.chartData&&e.chartData.meta&&e.chartData.data.length),G=h.computed(()=>e.allowCsvExport&&j.value||!!e.goToExplore||e.showMenu),$=h.computed(()=>e.chartData.meta.granularity_ms?qa(e.chartData.meta.granularity_ms)||"hourly":qa(new Date(e.chartData.data[1].timestamp).getTime()-new Date(e.chartData.data[0].timestamp).getTime())||"hourly"),N=h.computed(()=>e.chartOptions.chartLegendSortFn?e.chartOptions.chartLegendSortFn:(E,I)=>E.text===s.t("chartLabels.____OTHER____")?1:I.text===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(E.text,10))&&!isNaN(parseInt(I.text,10))?E.text<I.text?-1:1:E.value&&I.value?I.value.raw-E.value.raw:0),st=h.computed(()=>e.chartOptions.chartTooltipSortFn?e.chartOptions.chartTooltipSortFn:(E,I)=>E.label===s.t("chartLabels.____OTHER____")?1:I.label===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(E.label,10))&&!isNaN(parseInt(I.label,10))?E.label<I.label?-1:1:E.value&&I.value?I.rawValue-E.rawValue:0),z=h.computed(()=>e.chartTitle||!a||M.value&&k.value?"relative":"absolute"),St=h.computed(()=>z.value==="relative"?"100%":Zv),bt=()=>{l.value=!0},H=()=>{l.value=!1};return h.provide("showLegendValues",_),h.provide("legendPosition",h.toRef(e,"legendPosition")),(E,I)=>{const W=h.resolveComponent("KTooltip"),q=h.resolveComponent("KDropdownItem"),K=h.resolveComponent("KDropdown"),V=h.resolveComponent("KEmptyState");return h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["analytics-chart-shell",{"is-hovering":l.value}]),onMouseenter:bt,onMouseleave:H},[h.createElementVNode("div",eS,[n.chartTitle?(h.openBlock(),h.createElementBlock("div",{key:0,class:"chart-title",title:n.chartTitle},h.toDisplayString(n.chartTitle),9,nS)):h.createCommentVNode("",!0),h.createElementVNode("div",iS,[j.value&&M.value&&k.value?(h.openBlock(),h.createBlock(W,{key:0,class:"tooltip","max-width":"500",placement:"right"},{content:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(C)),1)]),default:h.withCtx(()=>[h.createVNode(h.unref(kr.WarningIcon),{color:`var(--kui-color-text-warning, ${h.unref(Kv)})`,decorative:"",size:h.unref(th)},null,8,["color","size"])]),_:1})):h.createCommentVNode("",!0)]),n.allowCsvExport&&j.value&&!h.unref(a)?(h.openBlock(),h.createElementBlock("div",sS,[h.createVNode(Ih,{data:o.value,"filename-prefix":n.filenamePrefix},null,8,["data","filename-prefix"])])):h.createCommentVNode("",!0),h.unref(a)&&G.value?(h.openBlock(),h.createBlock(K,{key:2,class:"dropdown","data-testid":"chart-action-menu"},{items:h.withCtx(()=>[n.goToExplore?(h.openBlock(),h.createBlock(q,{key:0,"data-testid":"chart-jump-to-explore"},{default:h.withCtx(()=>[h.createElementVNode("a",{href:n.goToExplore},h.toDisplayString(h.unref(s).t("jumpToExplore")),9,aS)]),_:1})):h.createCommentVNode("",!0),n.allowCsvExport&&j.value?(h.openBlock(),h.createBlock(q,{key:1,class:"chart-export-button","data-testid":"chart-csv-export",onClick:I[0]||(I[0]=Y=>g())},{default:h.withCtx(()=>[h.createElementVNode("span",oS,h.toDisplayString(h.unref(s).t("csvExport.exportAsCsv")),1)]),_:1})):h.createCommentVNode("",!0),h.renderSlot(E.$slots,"menu-items",{},void 0,!0)]),default:h.withCtx(()=>[h.createElementVNode("button",{appearance:"none","aria-label":h.unref(s).t("more_actions"),class:"kebab-action-menu","data-testid":"kebab-action-menu"},[h.createVNode(h.unref(kr.MoreIcon),{color:h.unref(Jd),size:h.unref(th)},null,8,["color","size"])],8,rS)]),_:3})):h.createCommentVNode("",!0),u.value?(h.openBlock(),h.createBlock(wo,{key:3,"chart-data":o.value,filename:f.value,onToggleModal:d},null,8,["chart-data","filename"])):h.createCommentVNode("",!0)]),j.value?(h.openBlock(),h.createElementBlock("div",lS,[O.value?(h.openBlock(),h.createBlock(zk,{key:0,"chart-data":c.value,"chart-legend-sort-fn":N.value,"chart-tooltip-sort-fn":st.value,"dimension-axes-title":R.value,fill:n.chartOptions.stacked,granularity:$.value,"legend-values":h.unref(w),"metric-axes-title":x.value,"metric-unit":b.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"time-range-ms":p.value,"tooltip-title":n.tooltipTitle,type:n.chartOptions.type,zoom:n.timeseriesZoom,onZoomTimeRange:I[1]||(I[1]=Y=>i("zoom-time-range",Y))},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","fill","granularity","legend-values","metric-axes-title","metric-unit","stacked","synthetics-data-key","time-range-ms","tooltip-title","type","zoom"])):S.value?(h.openBlock(),h.createBlock(kk,{key:1,annotations:n.showAnnotations,"chart-data":c.value,"chart-legend-sort-fn":N.value,"chart-tooltip-sort-fn":st.value,"data-testid":"bar-chart-container","dimension-axes-title":D.value,"legend-values":h.unref(w),"metric-axes-title":x.value,"metric-unit":b.value,orientation:y.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.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-title"])):T.value?(h.openBlock(),h.createBlock(Ik,{key:2,"chart-data":c.value,"dataset-colors":n.chartOptions.chartDatasetColors||h.unref(Xs),"legend-position":n.legendPosition,"legend-values":h.unref(w),"metric-unit":b.value,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.tooltipTitle},null,8,["chart-data","dataset-colors","legend-position","legend-values","metric-unit","synthetics-data-key","tooltip-title"])):h.createCommentVNode("",!0)])):(h.openBlock(),h.createBlock(V,{key:0,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(L.value),1)]),default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(B.value),1)]),_:1}))],34)}}}),uS=Ve(cS,[["__scopeId","data-v-31d2bf01"]]),dS={class:"chart-parent","data-testid":"doughnut-chart-parent"},hS={class:"chart-totals-flex"},fS={key:1,class:"metric-small","data-testid":"doughnut-chart-total"},gS=h.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:ti.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:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.ref(hn()),s=h.computed(()=>[t.chartData.datasets.reduce((p,b)=>(p.labels.push(b.label),p.borderColor.push(b.backgroundColor),p.backgroundColor.push(b.backgroundColor),p.data.push(b.data.reduce((_,w)=>_+w,0)),p),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),r=h.computed(()=>({...t.chartData,datasets:s.value}));ut.useReportChartDataForSynthetics(h.toRef(t,"chartData"),h.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},o=h.ref(),l=h.computed(()=>{var g;return $i((g=s==null?void 0:s.value[0])==null?void 0:g.data[t.numerator],{capital:!0})}),c=h.computed(()=>{var g,p;return $i(((g=s==null?void 0:s.value[0])==null?void 0:g.data[0])+((p=s==null?void 0:s.value[0])==null?void 0:p.data[1]),{capital:!0})}),u=h.computed(()=>{var g;return`color: ${(g=s==null?void 0:s.value[0])==null?void 0:g.backgroundColor[t.numerator]}`}),d=h.computed(()=>[ti.Full,ti.SingleMetric].includes(t.metricDisplay)),f=h.computed(()=>t.metricDisplay===ti.Full);return(g,p)=>(h.openBlock(),h.createElementBlock("div",dS,[h.createElementVNode("div",hS,[d.value?(h.openBlock(),h.createElementBlock("div",{key:0,class:"metric-large","data-testid":"doughnut-chart-metric",style:h.normalizeStyle(u.value)},h.toDisplayString(l.value),5)):h.createCommentVNode("",!0),f.value?(h.openBlock(),h.createElementBlock("div",fS,h.toDisplayString(h.unref(e).t("total"))+": "+h.toDisplayString(c.value),1)):h.createCommentVNode("",!0)]),h.createElementVNode("div",{class:"chart-container",style:h.normalizeStyle({height:n.height,width:n.width})},[h.createVNode(h.unref(uh),{ref_key:"chartInstance",ref:o,"chart-id":i.value,data:r.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),pS=Ve(gS,[["__scopeId","data-v-b873244e"]]),mS={class:"simple-chart-shell"},yS={key:1,class:"analytics-chart-parent"},bS=Ve(h.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:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.computed(()=>{var c;const l=ut.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors||He},h.toRef(t,"chartData")).value;return(c=t.chartOptions)!=null&&c.reverseDataset&&(l==null||l.datasets.reverse()),l}),s=h.computed(()=>{var l;return(l=t.chartData.meta)!=null&&l.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""}),r=h.computed(()=>t.chartOptions.type==="gauge"),a=h.computed(()=>t.emptyStateTitle||e.t("noDataAvailableTitle")),o=h.computed(()=>t.chartData&&t.chartData.meta&&t.chartData.data.length);return(l,c)=>{const u=h.resolveComponent("KEmptyState");return h.openBlock(),h.createElementBlock("div",mS,[o.value?(h.openBlock(),h.createElementBlock("div",yS,[r.value?(h.openBlock(),h.createBlock(pS,{key:0,"chart-data":i.value,"dataset-colors":n.chartOptions.chartDatasetColors,"is-simple":"","metric-display":n.chartOptions.metricDisplay,"metric-unit":s.value,numerator:n.chartOptions.numerator,"synthetics-data-key":n.syntheticsDataKey,width:n.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):h.createCommentVNode("",!0)])):(h.openBlock(),h.createBlock(u,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(a.value),1)]),_:1}))])}}}),[["__scopeId","data-v-9d13f2fd"]]),xS={class:"top-n-card-title","data-testid":"top-n-card-title"},_S={class:"top-n-card-description","data-testid":"top-n-card-description"},wS={key:3,class:"top-n-table","data-testid":"top-n-table"},vS={class:"table-headings"},kS={class:"table-row"},MS={class:"column-1"},SS={class:"column-2"},DS={class:"table-body","data-testid":"top-n-data"},TS=["data-testid"],CS={class:"column-1"},PS={class:"column-2"},OS=Ve(h.defineComponent({__name:"TopNTable",props:{title:{type:String,required:!0},description:{type:String,default:""},data:{type:Object,required:!0},emptyStateTitle:{type:String,default:""},isLoading:{type:Boolean,default:!1},titleTag:{type:String,default:"h2"}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.computed(()=>t.data.data),s=h.computed(()=>{var p;return!!((p=i.value)!=null&&p.length)}),r=h.computed(()=>{var p,b;return(p=t.data.meta)!=null&&p.display&&((b=Object.keys(t.data.meta.display))==null?void 0:b[0])||""}),a=h.computed(()=>r.value?t.data.meta.display[r.value]:{}),o=h.computed(()=>{var p,b;return(b=(p=t.data.meta)==null?void 0:p.metric_names)!=null&&b.length?t.data.meta.metric_names[0]:""}),l=h.computed(()=>o.value?e.t(`chartLabels.${o.value}`)||o.value:""),c=h.computed(()=>{if(!s.value)return"";if(t.data.meta){if(a.value&&!Object.keys(a.value).length)return e.t("topNTable.errors.display");if(!o.value)return e.t("topNTable.errors.metricNames")}else return e.t("topNTable.errors.meta");return""}),u=p=>{const b=p.event;return String(b[r.value])},d=p=>{const b=u(p),_=a.value&&a.value[b];return _?_.name:"-"},f=p=>{const b=u(p),_=a.value&&a.value[b];return _?!!_.deleted:!1},g=p=>{if(!o.value)return"–";const _=p.event[o.value];return _?$i(_,{capital:!0,round:!0}):"–"};return(p,b)=>{const _=h.resolveComponent("KEmptyState"),w=h.resolveComponent("KSkeleton"),k=h.resolveComponent("KCard");return h.openBlock(),h.createBlock(k,{class:"kong-ui-public-top-n-table","title-tag":n.titleTag},h.createSlots({default:h.withCtx(()=>[c.value?(h.openBlock(),h.createBlock(_,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(e).t("topNTable.defaultErrorStateTitle")),1)]),default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(c.value),1)]),_:1})):n.isLoading?(h.openBlock(),h.createBlock(w,{key:1,"table-columns":2,type:"table"})):s.value?(h.openBlock(),h.createElementBlock("div",wS,[h.createElementVNode("div",vS,[h.createElementVNode("div",kS,[h.createElementVNode("div",MS,h.toDisplayString(h.unref(e).t("topNTable.nameLabel")),1),h.createElementVNode("div",SS,h.toDisplayString(l.value),1)])]),h.createElementVNode("div",DS,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(i.value,(M,C)=>(h.openBlock(),h.createElementBlock("div",{key:`entry-${C}`,class:"table-row","data-testid":`row-${u(M)}`},[h.createElementVNode("div",CS,[h.renderSlot(p.$slots,"name",{record:{id:u(M),name:d(M),deleted:f(M),dimension:r.value}},()=>[h.createTextVNode(h.toDisplayString(d(M)),1)],!0)]),h.createElementVNode("div",PS,"   "+h.toDisplayString(g(M)),1)],8,TS))),128))])])):(h.openBlock(),h.createBlock(_,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(n.emptyStateTitle||h.unref(e).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[n.title?{name:"title",fn:h.withCtx(()=>[h.createElementVNode("span",xS,h.toDisplayString(n.title),1)]),key:"0"}:void 0,n.description?{name:"actions",fn:h.withCtx(()=>[h.createElementVNode("div",_S,h.toDisplayString(n.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-61747ee5"]]);Q.AnalyticsChart=uS,Q.ChartLegendPosition=Ot,Q.ChartMetricDisplay=ti,Q.CsvExportButton=Ih,Q.CsvExportModal=wo,Q.DECIMAL_DISPLAY=ku,Q.FONT_SIZE_REGULAR=Su,Q.FONT_SIZE_SMALL=Mu,Q.MAX_LABEL_LENGTH=Us,Q.OTHERS_COLOR=Xx,Q.SimpleChart=bS,Q.TopNTable=OS,Q.ValidType=Ln,Q.accessibleGrey=Cu,Q.apiRequestStatusCodeColors=Pu,Q.chartTypes=Bk,Q.codesInSpec=Ru,Q.darkenColor=Tu,Q.datavisPalette=He,Q.defaultStatusCodeColors=Xs,Q.errorRateColors=qx,Q.latencyColors=Ux,Q.lightGrey=La,Q.lookupColor=Gx,Q.lookupDatavisColor=Gn,Q.lookupStatusCodeCategoryColor=n_,Q.lookupStatusCodeColor=Ia,Q.numberFormatter=qs,Q.simpleChartTypes=Hk,Q.statusCodeBadgeBackgroundColor=jx,Q.trafficColors=$x,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
42
+ `);var N=0,st=!1;this.parse=function(z,St,bt){if(typeof z!="string")throw new Error("Input must be a string");var H=z.length,E=D.length,I=R.length,W=L.length,q=T(B),K=[],V=[],Y=[],et=N=0;if(!z)return Kt();if(y.header&&!St){var X=z.split(R)[0].split(D),wt=[],lt={},Yt=!1;for(var Dt in X){var mt=X[Dt];T(y.transformHeader)&&(mt=y.transformHeader(mt,Dt));var ie=mt,se=lt[mt]||0;for(0<se&&(Yt=!0,ie=mt+"_"+se),lt[mt]=se+1;wt.includes(ie);)ie=ie+"_"+se;wt.push(ie)}if(Yt){var me=z.split(R);me[0]=wt.join(D),z=me.join(R)}}if(G||G!==!1&&z.indexOf(x)===-1){for(var ve=z.split(R),re=0;re<ve.length;re++){if(Y=ve[re],N+=Y.length,re!==ve.length-1)N+=R.length;else if(bt)return Kt();if(!L||Y.substring(0,W)!==L){if(q){if(K=[],$e(Y.split(D)),ae(),st)return Kt()}else $e(Y.split(D));if(j&&j<=re)return K=K.slice(0,j),Kt(!0)}}return Kt()}for(var vt=z.indexOf(D,N),Tt=z.indexOf(R,N),je=new RegExp(_($)+_(x),"g"),pt=z.indexOf(x,N);;)if(z[N]!==x)if(L&&Y.length===0&&z.substring(N,N+W)===L){if(Tt===-1)return Kt();N=Tt+I,Tt=z.indexOf(R,N),vt=z.indexOf(D,N)}else if(vt!==-1&&(vt<Tt||Tt===-1))Y.push(z.substring(N,vt)),N=vt+E,vt=z.indexOf(D,N);else{if(Tt===-1)break;if(Y.push(z.substring(N,Tt)),Me(Tt+I),q&&(ae(),st))return Kt();if(j&&K.length>=j)return Kt(!0)}else for(pt=N,N++;;){if((pt=z.indexOf(x,pt+1))===-1)return bt||V.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:K.length,index:N}),ye();if(pt===H-1)return ye(z.substring(N,pt).replace(je,x));if(x!==$||z[pt+1]!==$){if(x===$||pt===0||z[pt-1]!==$){vt!==-1&&vt<pt+1&&(vt=z.indexOf(D,pt+1)),Tt!==-1&&Tt<pt+1&&(Tt=z.indexOf(R,pt+1));var gn=de(Tt===-1?vt:Math.min(vt,Tt));if(z.substr(pt+1+gn,E)===D){Y.push(z.substring(N,pt).replace(je,x)),z[N=pt+1+gn+E]!==x&&(pt=z.indexOf(x,N)),vt=z.indexOf(D,N),Tt=z.indexOf(R,N);break}var ke=de(Tt);if(z.substring(pt+1+ke,pt+1+ke+I)===R){if(Y.push(z.substring(N,pt).replace(je,x)),Me(pt+1+ke+I),vt=z.indexOf(D,N),pt=z.indexOf(x,N),q&&(ae(),st))return Kt();if(j&&K.length>=j)return Kt(!0);break}V.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:K.length,index:N}),pt++}}else pt++}return ye();function $e(zt){K.push(zt),et=N}function de(zt){var dr=0;if(zt!==-1){var oi=z.substring(pt+1,zt);oi&&oi.trim()===""&&(dr=oi.length)}return dr}function ye(zt){return bt||(zt===void 0&&(zt=z.substring(N)),Y.push(zt),N=H,$e(Y),q&&ae()),Kt()}function Me(zt){N=zt,$e(Y),Y=[],Tt=z.indexOf(R,N)}function Kt(zt){return{data:K,errors:V,meta:{delimiter:D,linebreak:R,aborted:st,truncated:!!zt,cursor:et+(St||0)}}}function ae(){B(Kt()),K=[],V=[]}},this.abort=function(){st=!0},this.getCharIndex=function(){return N}}function k(y){var x=y.data,D=a[x.workerId],R=!1;if(x.error)D.userError(x.error,x.file);else if(x.results&&x.results.data){var L={abort:function(){R=!0,M(x.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:C,resume:C};if(T(D.userStep)){for(var B=0;B<x.results.data.length&&(D.userStep({data:x.results.data[B],errors:x.results.errors,meta:x.results.meta},L),!R);B++);delete x.results}else T(D.userChunk)&&(D.userChunk(x.results,L,x.file),delete x.results)}x.finished&&!R&&M(x.workerId,x.results)}function M(y,x){var D=a[y];T(D.userComplete)&&D.userComplete(x),D.terminate(),delete a[y]}function C(){throw new Error("Not implemented.")}function S(y){if(typeof y!="object"||y===null)return y;var x=Array.isArray(y)?[]:{};for(var D in y)x[D]=S(y[D]);return x}function O(y,x){return function(){y.apply(x,arguments)}}function T(y){return typeof y=="function"}return r&&(i.onmessage=function(y){var x=y.data;if(l.WORKER_ID===void 0&&x&&(l.WORKER_ID=x.workerId),typeof x.input=="string")i.postMessage({workerId:l.WORKER_ID,results:l.parse(x.input,x.config),finished:!0});else if(i.File&&x.input instanceof File||x.input instanceof Object){var D=l.parse(x.input,x.config);D&&i.postMessage({workerId:l.WORKER_ID,results:D,finished:!0})}}),(d.prototype=Object.create(u.prototype)).constructor=d,(f.prototype=Object.create(u.prototype)).constructor=f,(g.prototype=Object.create(g.prototype)).constructor=g,(p.prototype=Object.create(u.prototype)).constructor=p,l})})(bh);var _M=bh.exports;const wM=["id"],vM=h.defineComponent({__name:"VueJsonCsv",props:{data:{type:Array,required:!0},fields:{type:Array,required:!1,default:null},labels:{type:Object,required:!1,default:null},filename:{type:String,default:"report-data.csv"},delimiter:{type:String,default:",",required:!1},separatorExcel:{type:Boolean,default:!1},encoding:{type:String,default:"utf-8"},testing:{type:Boolean,required:!1,default:!1}},emits:["export-started","export-finished"],setup(n,{emit:t}){const e=t,i=n,s=h.computed(()=>`export_${new Date().getTime()}`),r=h.computed(()=>{const u=l();return u.length?u:null}),a=()=>{const u=i.labels;if(typeof i.fields!==Ln.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return typeof u===Ln.Object?d=>Wk(d,(f,g)=>u[g]||g):d=>d},o=()=>{const u=i.fields;if(typeof i.fields!==Ln.Object&&!Array.isArray(u))throw new Error("Fields needs to be an array of strings.");return Array.isArray(u)?d=>bM(d,u):d=>d},l=()=>{if(typeof i.fields===Ln.Undefined&&typeof i.labels===Ln.Undefined)return i.data;const u=a(),d=o();return i.data.map(f=>u(d(f)))},c=()=>{if(!(r!=null&&r.value)){console.warn("No data to export");return}e("export-started",r.value);let u=_M.unparse(r.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
43
+ `+u),i.encoding==="utf-8"&&(u="\uFEFF"+u),e("export-finished",i.filename),!i.testing){const d=new Blob([u],{type:"text/csv;charset="+i.encoding});xM.saveAs(d,i.filename)}};return(u,d)=>(h.openBlock(),h.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[h.renderSlot(u.$slots,"default",{},()=>[h.createTextVNode("Download "+h.toDisplayString(n.filename),1)])],8,wM))}}),kM=h.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(n){const t=n,e=h.computed(()=>Object.keys(t.headers));return(i,s)=>(h.openBlock(),h.createElementBlock("div",null,[h.createVNode(vM,{data:i.rows,fields:e.value,filename:i.filename,labels:i.headers},{default:h.withCtx(()=>[h.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}});function xh(n,t,e){const i=pu(),s=DM(n,e.timeZone,e.locale??i.locale);return"formatToParts"in s?MM(s,t):SM(s,t)}function MM(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function SM(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function DM(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function TM(n,t){const e=AM(t);return"formatToParts"in e?PM(e,n):OM(e,n)}const CM={year:0,month:1,day:2,hour:3,minute:4,second:5};function PM(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=CM[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function OM(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);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 po={},_h=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")),EM=_h==="06/25/2014, 00:00:00"||_h==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function AM(n){return po[n]||(po[n]=EM?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),po[n]}function wh(n,t,e,i,s,r,a){const o=new Date(0);return o.setUTCFullYear(n,t,e),o.setUTCHours(i,s,r,a),o}const vh=36e5,RM=6e4,mo={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function kh(n,t,e){if(!n)return 0;let i=mo.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=mo.timezoneHH.exec(n),i)return s=parseInt(i[1],10),Mh(s)?-(s*vh):NaN;if(i=mo.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Mh(s,a)?(r=Math.abs(s)*vh+a*RM,i[1]==="+"?-r:r):NaN}if(NM(n)){t=new Date(t||Date.now());const a=e?t:LM(t),o=yo(a,n);return-(e?o:IM(t,o,n))}return NaN}function LM(n){return wh(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function yo(n,t){const e=TM(n,t),i=wh(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function IM(n,t,e){let s=n.getTime()-t;const r=yo(new Date(s),e);if(t===r)return t;s-=r-t;const a=yo(new Date(s),e);return r===a?r:Math.max(r,a)}function Mh(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const Sh={};function NM(n){if(Sh[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),Sh[n]=!0,!0}catch{return!1}}const FM=60*1e3,zM={X:function(n,t,e){const i=bo(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return Dh(i);case"XXXX":case"XX":return ai(i);case"XXXXX":case"XXX":default:return ai(i,":")}},x:function(n,t,e){const i=bo(e.timeZone,n);switch(t){case"x":return Dh(i);case"xxxx":case"xx":return ai(i);case"xxxxx":case"xxx":default:return ai(i,":")}},O:function(n,t,e){const i=bo(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+BM(i,":");case"OOOO":default:return"GMT"+ai(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return xh("short",n,e);case"zzzz":default:return xh("long",n,e)}}};function bo(n,t){const e=n?kh(n,t,!0)/FM:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function ur(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function ai(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ur(Math.floor(i/60),2),r=ur(Math.floor(i%60),2);return e+s+t+r}function Dh(n,t){return n%60===0?(n>0?"-":"+")+ur(Math.abs(n)/60,2):ai(n,t)}function BM(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ur(r,2)}function Th(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const HM=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,xo=36e5,Ch=6e4,WM=2,Gt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,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:HM};function YM(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?WM:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=VM(n),{year:s,restDateString:r}=jM(i.date,e),a=$M(r,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const o=a.getTime();let l=0,c;if(i.time&&(l=qM(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=kh(i.timeZone||t.timeZone,new Date(o+l)),isNaN(c))return new Date(NaN)}else c=Th(new Date(o+l)),c=Th(new Date(o+l+c));return new Date(o+l+c)}else return new Date(NaN)}function VM(n){const t={};let e=Gt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Gt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Gt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function jM(n,t){if(n){const e=Gt.YYY[t],i=Gt.YYYYY[t];let s=Gt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Gt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function $M(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Gt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,Eh(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Gt.DDD.exec(n),r){e=new Date(0);const a=parseInt(r[1],10);return GM(t,a)?(e.setUTCFullYear(t,0,a),e):new Date(NaN)}if(r=Gt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const a=parseInt(r[2],10);return Eh(t,i,a)?(e.setUTCFullYear(t,i,a),e):new Date(NaN)}if(r=Gt.Www.exec(n),r)return s=parseInt(r[1],10)-1,Ah(s)?Ph(t,s):new Date(NaN);if(r=Gt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const a=parseInt(r[2],10)-1;return Ah(s,a)?Ph(t,s,a):new Date(NaN)}return null}function qM(n){let t,e,i=Gt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),_o(t)?t%24*xo:NaN;if(i=Gt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),_o(t,e)?t%24*xo+e*Ch:NaN;if(i=Gt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return _o(t,e,s)?t%24*xo+e*Ch+s*1e3:NaN}return null}function Ph(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const UM=[31,28,31,30,31,30,31,31,30,31,30,31],XM=[31,29,31,30,31,30,31,31,30,31,30,31];function Oh(n){return n%400===0||n%4===0&&n%100!==0}function Eh(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=Oh(n);if(i&&e>XM[t]||!i&&e>UM[t])return!1}return!0}function GM(n,t){if(t<1)return!1;const e=Oh(n);return!(e&&t>366||!e&&t>365)}function Ah(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function _o(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const KM=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Rh(n,t,e={}){t=String(t);const i=t.match(KM);if(i){const s=YM(e.originalDate||n,e);t=i.reduce(function(r,a){if(a[0]==="'")return r;const o=r.indexOf(a),l=r[o-1]==="'",c=r.replace(a,"'"+zM[a[0]](s,a,e)+"'");return l?c.substring(0,o-1)+c.substring(o+1):c},t)}return gu(n,t,e)}const ZM={class:"kong-ui-public-csv-export-modal"},QM={key:0,class:"selected-range"},JM={key:1,class:"text-muted",tag:"span"},Lh=3,wo=h.defineComponent({__name:"CsvExportModal",props:{filename:{},modalDescription:{default:void 0},chartData:{}},emits:["toggleModal"],setup(n,{emit:t}){const{i18n:e}=ut.useI18n(),i=n,s=t,r=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=h.ref(!0),o=h.computed(()=>{var b,_;return!!((_=(b=i.chartData)==null?void 0:b.data)!=null&&_.length)}),l=h.ref(1),c=h.computed(()=>g.value.rows.length),u=ut.useChartSelectedRange(h.toRef(i,"chartData")),d=h.computed(()=>e.t("csvExport.previewRows",{rowsMax:Math.min(Lh,c.value),rowsTotal:c.value,plural:c.value===1?"":"s"})),f=()=>{s("toggleModal",!1)},g=h.computed(()=>{var S,O,T;if(!o.value||!((S=i.chartData)!=null&&S.meta.metric_names))return{headers:[],rows:[],csvHeaders:{}};const b=i.chartData.data.some(y=>y.timestamp!==i.chartData.data[0].timestamp),_=i.chartData.data.map(y=>{const x=new Date(y.timestamp);return{...Object.keys(y.event).reduce((R,L)=>{if(L in i.chartData.meta.display){const B=y.event[L],j=i.chartData.meta.display[L];R[L]=B&&j&&j[B].name||y.event[L]}else R[L]=y.event[L];return R},{}),...b?{timestamp:Rh(x,"yyyy-MM-dd HH:mm:ss"),tzOffset:Rh(x,"XXX")}:{}}});let w=[];b&&(w=[{label:e.t("csvExport.Timestamp"),key:"timestamp"},{label:e.t("csvExport.UtcOffset"),key:"tzOffset"}]);const k="display"in i.chartData.meta&&((O=i.chartData.meta)!=null&&O.display)?(T=i.chartData.meta)==null?void 0:T.display:{},M=[...w,...Object.keys(k).map(y=>({label:e.t(`chartLabels.${y}`),key:y})),...i.chartData.meta.metric_names.map(y=>({label:e.t(`chartLabels.${y}`),key:y}))],C=M.reduce((y,x)=>(y[x.key]=x.label,y),{});return{headers:M,csvHeaders:C,rows:_}}),p=async()=>{const{rows:b}=g.value;return a.value=!1,{total:Number(b.length)||0,data:b.slice(0,Lh)}};return h.watch(g,()=>{l.value++}),(b,_)=>{const w=h.resolveComponent("KEmptyState"),k=h.resolveComponent("KTableData"),M=h.resolveComponent("KButton"),C=h.resolveComponent("KModal");return h.openBlock(),h.createElementBlock("div",ZM,[h.createVNode(C,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:h.unref(e).t("csvExport.exportPreview"),visible:"",onCancel:f,onKeyup:h.withKeys(f,["esc"])},{default:h.withCtx(()=>{var S;return[h.createElementVNode("div",null,[o.value?(h.openBlock(),h.createElementBlock("div",QM,[h.createElementVNode("p",null,h.toDisplayString(b.modalDescription?b.modalDescription:h.unref(e).t("csvExport.exportDescription")),1),h.createElementVNode("p",null,h.toDisplayString(h.unref(e).t("csvExport.exportTimeRange"))+": "+h.toDisplayString(h.unref(u)),1)])):h.createCommentVNode("",!0),h.createVNode(k,{class:"vitals-table",fetcher:p,"fetcher-cache-key":String(l.value),headers:((S=g.value)==null?void 0:S.headers)||[],"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":h.withCtx(()=>[h.createVNode(w,{"action-button-visible":!1},{title:h.withCtx(()=>[h.createElementVNode("h5",null,h.toDisplayString(h.unref(e).t("csvExport.noDataRange")),1)]),default:h.withCtx(()=>[h.createElementVNode("p",null,h.toDisplayString(h.unref(e).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"]),!a.value&&o.value?(h.openBlock(),h.createElementBlock("div",JM,h.toDisplayString(d.value),1)):h.createCommentVNode("",!0)])]}),"footer-actions":h.withCtx(()=>[h.createVNode(M,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(e).t("csvExport.cancelButton")),1)]),_:1}),h.createVNode(kM,{class:"vitals-report-export-button",filename:r,headers:g.value.csvHeaders,rows:g.value.rows},{default:h.withCtx(()=>[h.createVNode(M,{appearance:"primary","data-testid":"csv-download-button",disabled:a.value||!o.value},{default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(e).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}}),Ih=h.defineComponent({__name:"CsvExportButton",props:{data:{type:Object,required:!0},text:{type:String,required:!1,default:void 0},buttonAppearance:{type:String,required:!1,default:()=>"tertiary"},filenamePrefix:{type:String,required:!1,default:void 0}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.computed(()=>t.filenamePrefix||e.t("csvExport.defaultFilename")),s=h.ref(!1),r=o=>{s.value=o},a=()=>{r(!0)};return(o,l)=>{const c=h.resolveComponent("KButton");return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createVNode(c,{appearance:n.buttonAppearance,class:"chart-export-button-display","data-testid":"csv-export-button",onClick:h.withModifiers(a,["prevent"])},{default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(n.text||h.unref(e).t("csvExport.exportButton")),1)]),_:1},8,["appearance"]),s.value?(h.openBlock(),h.createBlock(wo,{key:0,"chart-data":n.data,filename:i.value,onToggleModal:r},null,8,["chart-data","filename"])):h.createCommentVNode("",!0)],64)}}}),tS={class:"chart-header"},eS=["title"],nS={class:"chart-header-icons-wrapper"},iS={key:1,class:"chart-export-button"},sS=["aria-label"],rS=["href"],aS={class:"chart-export-trigger","data-testid":"csv-export-button"},oS={key:1,class:"analytics-chart-parent"},lS=h.defineComponent({__name:"AnalyticsChart",props:{allowCsvExport:{type:Boolean,required:!1,default:!1},goToExplore:{type:String,required:!1,default:""},chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},tooltipTitle:{type:String,required:!1,default:""},emptyStateTitle:{type:String,required:!1,default:""},emptyStateDescription:{type:String,required:!1,default:""},chartTitle:{type:String,required:!1,default:""},filenamePrefix:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Ot.Right},syntheticsDataKey:{type:String,required:!1,default:""},showLegendValues:{type:Boolean,required:!1,default:!0},showAnnotations:{type:Boolean,required:!1,default:!0},timeseriesZoom:{type:Boolean,required:!1,default:!1},showMenu:{type:Boolean,required:!1,default:!1}},emits:["zoom-time-range"],setup(n,{emit:t}){h.useCssVars(E=>({"0c213fc6":z.value,"885d576e":St.value}));const e=n,i=t,{i18n:s}=ut.useI18n(),{evaluateFeatureFlag:r}=ut.useEvaluateFeatureFlag(),a=r("ma-3043-analytics-chart-kebab-menu",!1),o=h.toRef(e,"chartData"),l=h.ref(!1),c=h.computed(()=>O.value?ut.useExploreResultToTimeDataset({fill:e.chartOptions.stacked,colorPalette:e.chartOptions.chartDatasetColors||Xs},h.toRef(e,"chartData")).value:ut.useExploreResultToDatasets({fill:e.chartOptions.stacked,colorPalette:e.chartOptions.chartDatasetColors||Xs},h.toRef(e,"chartData")).value),u=h.ref(!1),d=E=>{u.value=E},f=h.computed(()=>e.filenamePrefix||s.t("csvExport.defaultFilename")),g=()=>{d(!0)},p=h.computed(()=>{var E;return(E=e.chartData)!=null&&E.meta?"start_ms"in e.chartData.meta?e.chartData.meta.end_ms-e.chartData.meta.start_ms:void 0:0}),b=h.computed(()=>{var E;return(E=e.chartData.meta)!=null&&E.metric_units?Object.values(e.chartData.meta.metric_units)[0]:""}),_=h.computed(()=>e.showLegendValues&&e.legendPosition!==Ot.Bottom),{legendValues:w}=ut.useChartLegendValues(c,e.chartOptions.type,b),k=h.computed(()=>{var E,I,W;return((W=(I=(E=e.chartData)==null?void 0:E.meta)==null?void 0:I.limit)==null?void 0:W.toString())||null}),M=h.computed(()=>{var E,I;return((I=(E=e.chartData)==null?void 0:E.meta)==null?void 0:I.truncated)||!1}),C=s.t("limitedResultsShown",{maxReturned:k.value}),S=h.computed(()=>["vertical_bar","horizontal_bar"].includes(e.chartOptions.type)),O=h.computed(()=>["timeseries_bar","timeseries_line"].some(E=>E===e.chartOptions.type)),T=h.computed(()=>e.chartOptions.type==="doughnut"),y=h.computed(()=>e.chartOptions.type.includes("vertical")?"vertical":"horizontal"),x=h.computed(()=>{var W,q,K;if(!((W=e.chartData)!=null&&W.meta.metric_names)||!((q=e.chartData)!=null&&q.meta.metric_units))return;const E=e.chartData.meta.metric_names[0],I=e.chartData.meta.metric_units[E];if(e.chartData.meta.metric_names.length>1){if(E.includes("latency"))return s.t("metricAxisTitles.latency_in",{unit:s.t(`chartUnits.${I}`,{plural:"s"})});if(E.includes("size"))return s.t("metricAxisTitles.size_in",{unit:s.t(`chartUnits.${I}`,{plural:"s"})})}return((K=e.chartOptions)==null?void 0:K.metricAxesTitle)||s.te(`metricAxisTitles.${E}`)&&s.te(`chartUnits.${I}`)&&s.t(`metricAxisTitles.${E}`,{unit:s.t(`chartUnits.${I}`,{plural:"s"})})||void 0}),D=h.computed(()=>{const E=O.value?"Time":Object.keys(e.chartData.meta.display||e.chartData.meta.metric_names)[0];return e.chartOptions.dimensionAxesTitle||s.te(`chartLabels.${E}`)&&s.t(`chartLabels.${E}`)||void 0}),R=h.computed(()=>{const E=qa(Number(e.chartData.meta.granularity_ms));return s.t(`granularityAxisTitles.${E}`)}),L=h.computed(()=>e.emptyStateTitle||s.t("noDataAvailableTitle")),B=h.computed(()=>e.emptyStateDescription||s.t("noDataAvailableDescription")),j=h.computed(()=>O.value?Yx(c.value):e.chartData&&e.chartData.meta&&e.chartData.data.length),G=h.computed(()=>e.allowCsvExport&&j.value||!!e.goToExplore||e.showMenu),$=h.computed(()=>e.chartData.meta.granularity_ms?qa(e.chartData.meta.granularity_ms)||"hourly":qa(new Date(e.chartData.data[1].timestamp).getTime()-new Date(e.chartData.data[0].timestamp).getTime())||"hourly"),N=h.computed(()=>e.chartOptions.chartLegendSortFn?e.chartOptions.chartLegendSortFn:(E,I)=>E.text===s.t("chartLabels.____OTHER____")?1:I.text===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(E.text,10))&&!isNaN(parseInt(I.text,10))?E.text<I.text?-1:1:E.value&&I.value?I.value.raw-E.value.raw:0),st=h.computed(()=>e.chartOptions.chartTooltipSortFn?e.chartOptions.chartTooltipSortFn:(E,I)=>E.label===s.t("chartLabels.____OTHER____")?1:I.label===s.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(E.label,10))&&!isNaN(parseInt(I.label,10))?E.label<I.label?-1:1:E.value&&I.value?I.rawValue-E.rawValue:0),z=h.computed(()=>e.chartTitle||!a||M.value&&k.value?"relative":"absolute"),St=h.computed(()=>z.value==="relative"?"100%":"2ch"),bt=()=>{l.value=!0},H=()=>{l.value=!1};return h.provide("showLegendValues",_),h.provide("legendPosition",h.toRef(e,"legendPosition")),(E,I)=>{const W=h.resolveComponent("KTooltip"),q=h.resolveComponent("KDropdownItem"),K=h.resolveComponent("KDropdown"),V=h.resolveComponent("KEmptyState");return h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["analytics-chart-shell",{"is-hovering":l.value}]),onMouseenter:bt,onMouseleave:H},[h.createElementVNode("div",tS,[n.chartTitle?(h.openBlock(),h.createElementBlock("div",{key:0,class:"chart-title",title:n.chartTitle},h.toDisplayString(n.chartTitle),9,eS)):h.createCommentVNode("",!0),h.createElementVNode("div",nS,[j.value&&M.value&&k.value?(h.openBlock(),h.createBlock(W,{key:0,class:"tooltip","max-width":"500",placement:"right"},{content:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(C)),1)]),default:h.withCtx(()=>[h.createVNode(h.unref(kr.WarningIcon),{color:`var(--kui-color-text-warning, ${h.unref(Kv)})`,decorative:"",size:h.unref(th)},null,8,["color","size"])]),_:1})):h.createCommentVNode("",!0)]),n.allowCsvExport&&j.value&&!h.unref(a)?(h.openBlock(),h.createElementBlock("div",iS,[h.createVNode(Ih,{data:o.value,"filename-prefix":n.filenamePrefix},null,8,["data","filename-prefix"])])):h.createCommentVNode("",!0),h.unref(a)&&G.value?(h.openBlock(),h.createBlock(K,{key:2,class:"dropdown","data-testid":"chart-action-menu"},{items:h.withCtx(()=>[n.goToExplore?(h.openBlock(),h.createBlock(q,{key:0,"data-testid":"chart-jump-to-explore"},{default:h.withCtx(()=>[h.createElementVNode("a",{href:n.goToExplore},h.toDisplayString(h.unref(s).t("jumpToExplore")),9,rS)]),_:1})):h.createCommentVNode("",!0),n.allowCsvExport&&j.value?(h.openBlock(),h.createBlock(q,{key:1,class:"chart-export-button","data-testid":"chart-csv-export",onClick:I[0]||(I[0]=Y=>g())},{default:h.withCtx(()=>[h.createElementVNode("span",aS,h.toDisplayString(h.unref(s).t("csvExport.exportAsCsv")),1)]),_:1})):h.createCommentVNode("",!0),h.renderSlot(E.$slots,"menu-items",{},void 0,!0)]),default:h.withCtx(()=>[h.createElementVNode("button",{appearance:"none","aria-label":h.unref(s).t("more_actions"),class:"kebab-action-menu","data-testid":"kebab-action-menu"},[h.createVNode(h.unref(kr.MoreIcon),{color:h.unref(Jd),size:h.unref(th)},null,8,["color","size"])],8,sS)]),_:3})):h.createCommentVNode("",!0),u.value?(h.openBlock(),h.createBlock(wo,{key:3,"chart-data":o.value,filename:f.value,onToggleModal:d},null,8,["chart-data","filename"])):h.createCommentVNode("",!0)]),j.value?(h.openBlock(),h.createElementBlock("div",oS,[O.value?(h.openBlock(),h.createBlock(Fk,{key:0,"chart-data":c.value,"chart-legend-sort-fn":N.value,"chart-tooltip-sort-fn":st.value,"dimension-axes-title":R.value,fill:n.chartOptions.stacked,granularity:$.value,"legend-values":h.unref(w),"metric-axes-title":x.value,"metric-unit":b.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"time-range-ms":p.value,"tooltip-title":n.tooltipTitle,type:n.chartOptions.type,zoom:n.timeseriesZoom,onZoomTimeRange:I[1]||(I[1]=Y=>i("zoom-time-range",Y))},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","fill","granularity","legend-values","metric-axes-title","metric-unit","stacked","synthetics-data-key","time-range-ms","tooltip-title","type","zoom"])):S.value?(h.openBlock(),h.createBlock(vk,{key:1,annotations:n.showAnnotations,"chart-data":c.value,"chart-legend-sort-fn":N.value,"chart-tooltip-sort-fn":st.value,"data-testid":"bar-chart-container","dimension-axes-title":D.value,"legend-values":h.unref(w),"metric-axes-title":x.value,"metric-unit":b.value,orientation:y.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.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-title"])):T.value?(h.openBlock(),h.createBlock(Lk,{key:2,"chart-data":c.value,"dataset-colors":n.chartOptions.chartDatasetColors||h.unref(Xs),"legend-position":n.legendPosition,"legend-values":h.unref(w),"metric-unit":b.value,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.tooltipTitle},null,8,["chart-data","dataset-colors","legend-position","legend-values","metric-unit","synthetics-data-key","tooltip-title"])):h.createCommentVNode("",!0)])):(h.openBlock(),h.createBlock(V,{key:0,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(L.value),1)]),default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(B.value),1)]),_:1}))],34)}}}),cS=Ve(lS,[["__scopeId","data-v-cf603b8d"]]),uS={class:"chart-parent","data-testid":"doughnut-chart-parent"},dS={class:"chart-totals-flex"},hS={key:1,class:"metric-small","data-testid":"doughnut-chart-total"},fS=h.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:ti.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:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.ref(hn()),s=h.computed(()=>[t.chartData.datasets.reduce((p,b)=>(p.labels.push(b.label),p.borderColor.push(b.backgroundColor),p.backgroundColor.push(b.backgroundColor),p.data.push(b.data.reduce((_,w)=>_+w,0)),p),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),r=h.computed(()=>({...t.chartData,datasets:s.value}));ut.useReportChartDataForSynthetics(h.toRef(t,"chartData"),h.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},o=h.ref(),l=h.computed(()=>{var g;return $i((g=s==null?void 0:s.value[0])==null?void 0:g.data[t.numerator],{capital:!0})}),c=h.computed(()=>{var g,p;return $i(((g=s==null?void 0:s.value[0])==null?void 0:g.data[0])+((p=s==null?void 0:s.value[0])==null?void 0:p.data[1]),{capital:!0})}),u=h.computed(()=>{var g;return`color: ${(g=s==null?void 0:s.value[0])==null?void 0:g.backgroundColor[t.numerator]}`}),d=h.computed(()=>[ti.Full,ti.SingleMetric].includes(t.metricDisplay)),f=h.computed(()=>t.metricDisplay===ti.Full);return(g,p)=>(h.openBlock(),h.createElementBlock("div",uS,[h.createElementVNode("div",dS,[d.value?(h.openBlock(),h.createElementBlock("div",{key:0,class:"metric-large","data-testid":"doughnut-chart-metric",style:h.normalizeStyle(u.value)},h.toDisplayString(l.value),5)):h.createCommentVNode("",!0),f.value?(h.openBlock(),h.createElementBlock("div",hS,h.toDisplayString(h.unref(e).t("total"))+": "+h.toDisplayString(c.value),1)):h.createCommentVNode("",!0)]),h.createElementVNode("div",{class:"chart-container",style:h.normalizeStyle({height:n.height,width:n.width})},[h.createVNode(h.unref(uh),{ref_key:"chartInstance",ref:o,"chart-id":i.value,data:r.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),gS=Ve(fS,[["__scopeId","data-v-b873244e"]]),pS={class:"simple-chart-shell"},mS={key:1,class:"analytics-chart-parent"},yS=Ve(h.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:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.computed(()=>{var c;const l=ut.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors||He},h.toRef(t,"chartData")).value;return(c=t.chartOptions)!=null&&c.reverseDataset&&(l==null||l.datasets.reverse()),l}),s=h.computed(()=>{var l;return(l=t.chartData.meta)!=null&&l.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""}),r=h.computed(()=>t.chartOptions.type==="gauge"),a=h.computed(()=>t.emptyStateTitle||e.t("noDataAvailableTitle")),o=h.computed(()=>t.chartData&&t.chartData.meta&&t.chartData.data.length);return(l,c)=>{const u=h.resolveComponent("KEmptyState");return h.openBlock(),h.createElementBlock("div",pS,[o.value?(h.openBlock(),h.createElementBlock("div",mS,[r.value?(h.openBlock(),h.createBlock(gS,{key:0,"chart-data":i.value,"dataset-colors":n.chartOptions.chartDatasetColors,"is-simple":"","metric-display":n.chartOptions.metricDisplay,"metric-unit":s.value,numerator:n.chartOptions.numerator,"synthetics-data-key":n.syntheticsDataKey,width:n.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):h.createCommentVNode("",!0)])):(h.openBlock(),h.createBlock(u,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(a.value),1)]),_:1}))])}}}),[["__scopeId","data-v-9d13f2fd"]]),bS={class:"top-n-card-title","data-testid":"top-n-card-title"},xS={class:"top-n-card-description","data-testid":"top-n-card-description"},_S={key:3,class:"top-n-table","data-testid":"top-n-table"},wS={class:"table-headings"},vS={class:"table-row"},kS={class:"column-1"},MS={class:"column-2"},SS={class:"table-body","data-testid":"top-n-data"},DS=["data-testid"],TS={class:"column-1"},CS={class:"column-2"},PS=Ve(h.defineComponent({__name:"TopNTable",props:{title:{type:String,required:!0},description:{type:String,default:""},data:{type:Object,required:!0},emptyStateTitle:{type:String,default:""},isLoading:{type:Boolean,default:!1},titleTag:{type:String,default:"h2"}},setup(n){const t=n,{i18n:e}=ut.useI18n(),i=h.computed(()=>t.data.data),s=h.computed(()=>{var p;return!!((p=i.value)!=null&&p.length)}),r=h.computed(()=>{var p,b;return(p=t.data.meta)!=null&&p.display&&((b=Object.keys(t.data.meta.display))==null?void 0:b[0])||""}),a=h.computed(()=>r.value?t.data.meta.display[r.value]:{}),o=h.computed(()=>{var p,b;return(b=(p=t.data.meta)==null?void 0:p.metric_names)!=null&&b.length?t.data.meta.metric_names[0]:""}),l=h.computed(()=>o.value?e.t(`chartLabels.${o.value}`)||o.value:""),c=h.computed(()=>{if(!s.value)return"";if(t.data.meta){if(a.value&&!Object.keys(a.value).length)return e.t("topNTable.errors.display");if(!o.value)return e.t("topNTable.errors.metricNames")}else return e.t("topNTable.errors.meta");return""}),u=p=>{const b=p.event;return String(b[r.value])},d=p=>{const b=u(p),_=a.value&&a.value[b];return _?_.name:"-"},f=p=>{const b=u(p),_=a.value&&a.value[b];return _?!!_.deleted:!1},g=p=>{if(!o.value)return"–";const _=p.event[o.value];return _?$i(_,{capital:!0,round:!0}):"–"};return(p,b)=>{const _=h.resolveComponent("KEmptyState"),w=h.resolveComponent("KSkeleton"),k=h.resolveComponent("KCard");return h.openBlock(),h.createBlock(k,{class:"kong-ui-public-top-n-table","title-tag":n.titleTag},h.createSlots({default:h.withCtx(()=>[c.value?(h.openBlock(),h.createBlock(_,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(h.unref(e).t("topNTable.defaultErrorStateTitle")),1)]),default:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(c.value),1)]),_:1})):n.isLoading?(h.openBlock(),h.createBlock(w,{key:1,"table-columns":2,type:"table"})):s.value?(h.openBlock(),h.createElementBlock("div",_S,[h.createElementVNode("div",wS,[h.createElementVNode("div",vS,[h.createElementVNode("div",kS,h.toDisplayString(h.unref(e).t("topNTable.nameLabel")),1),h.createElementVNode("div",MS,h.toDisplayString(l.value),1)])]),h.createElementVNode("div",SS,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(i.value,(M,C)=>(h.openBlock(),h.createElementBlock("div",{key:`entry-${C}`,class:"table-row","data-testid":`row-${u(M)}`},[h.createElementVNode("div",TS,[h.renderSlot(p.$slots,"name",{record:{id:u(M),name:d(M),deleted:f(M),dimension:r.value}},()=>[h.createTextVNode(h.toDisplayString(d(M)),1)],!0)]),h.createElementVNode("div",CS,"   "+h.toDisplayString(g(M)),1)],8,DS))),128))])])):(h.openBlock(),h.createBlock(_,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:h.withCtx(()=>[h.createTextVNode(h.toDisplayString(n.emptyStateTitle||h.unref(e).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[n.title?{name:"title",fn:h.withCtx(()=>[h.createElementVNode("span",bS,h.toDisplayString(n.title),1)]),key:"0"}:void 0,n.description?{name:"actions",fn:h.withCtx(()=>[h.createElementVNode("div",xS,h.toDisplayString(n.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-61747ee5"]]);Q.AnalyticsChart=cS,Q.ChartLegendPosition=Ot,Q.ChartMetricDisplay=ti,Q.CsvExportButton=Ih,Q.CsvExportModal=wo,Q.DECIMAL_DISPLAY=ku,Q.FONT_SIZE_REGULAR=Su,Q.FONT_SIZE_SMALL=Mu,Q.MAX_LABEL_LENGTH=Us,Q.OTHERS_COLOR=Xx,Q.SimpleChart=yS,Q.TopNTable=PS,Q.ValidType=Ln,Q.accessibleGrey=Cu,Q.apiRequestStatusCodeColors=Pu,Q.chartTypes=zk,Q.codesInSpec=Ru,Q.darkenColor=Tu,Q.datavisPalette=He,Q.defaultStatusCodeColors=Xs,Q.errorRateColors=qx,Q.latencyColors=Ux,Q.lightGrey=La,Q.lookupColor=Gx,Q.lookupDatavisColor=Gn,Q.lookupStatusCodeCategoryColor=n_,Q.lookupStatusCodeColor=Ia,Q.numberFormatter=qs,Q.simpleChartTypes=Bk,Q.statusCodeBadgeBackgroundColor=jx,Q.trafficColors=$x,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});