@kong-ui-public/dashboard-renderer 9.1.0 → 9.1.2-pr.3923.4efef30d7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as v, ref as p, computed as o, openBlock as q, createBlock as C, withCtx as g, createVNode as x, unref as _ } from "vue";
|
|
2
|
-
import { _ as M } from "./index-
|
|
2
|
+
import { _ as M } from "./index-ih-Zw4pf.js";
|
|
3
3
|
import { exploreResultToCountryMetrics as E, AnalyticsGeoMap as O } from "@kong-ui-public/analytics-geo-map";
|
|
4
4
|
import { COUNTRIES as R } from "@kong-ui-public/analytics-utilities";
|
|
5
5
|
const U = /* @__PURE__ */ v({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as s, a as R, D as T, b as _, c as e, d as i, e as D, E as I, F as L, f as o, G as r, I as N, g as A, T as O, h as S, i as C, j as n, k as t, l as F } from "./index-
|
|
1
|
+
import { C as s, a as R, D as T, b as _, c as e, d as i, e as D, E as I, F as L, f as o, G as r, I as N, g as A, T as O, h as S, i as C, j as n, k as t, l as F } from "./index-ih-Zw4pf.js";
|
|
2
2
|
export {
|
|
3
3
|
s as CP_ID_TOKEN,
|
|
4
4
|
R as CsvExportModal,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
`,K='"',q=K+K,V=!1,P=null,F=!1,M=((()=>{if(typeof g=="object"){if(typeof g.delimiter!="string"||u.BAD_DELIMITERS.filter(function(D){return g.delimiter.indexOf(D)!==-1}).length||(x=g.delimiter),typeof g.quotes!="boolean"&&typeof g.quotes!="function"&&!Array.isArray(g.quotes)||(y=g.quotes),typeof g.skipEmptyLines!="boolean"&&typeof g.skipEmptyLines!="string"||(V=g.skipEmptyLines),typeof g.newline=="string"&&(N=g.newline),typeof g.quoteChar=="string"&&(K=g.quoteChar,q=K+K),typeof g.header=="boolean"&&(v=g.header),Array.isArray(g.columns)){if(g.columns.length===0)throw new Error("Option columns is empty");P=g.columns}g.escapeChar!==void 0&&(q=g.escapeChar+K),g.escapeFormulae instanceof RegExp?F=g.escapeFormulae:typeof g.escapeFormulae=="boolean"&&g.escapeFormulae&&(F=/^[=+\-@\t\r].*$/)}})(),new RegExp(C(K),"g"));if(typeof p=="string"&&(p=JSON.parse(p)),Array.isArray(p)){if(!p.length||Array.isArray(p[0]))return A(null,p,V);if(typeof p[0]=="object")return A(P||Object.keys(p[0]),p,V)}else if(typeof p=="object")return typeof p.data=="string"&&(p.data=JSON.parse(p.data)),Array.isArray(p.data)&&(p.fields||(p.fields=p.meta&&p.meta.fields||P),p.fields||(p.fields=Array.isArray(p.data[0])?p.fields:typeof p.data[0]=="object"?Object.keys(p.data[0]):[]),Array.isArray(p.data[0])||typeof p.data[0]=="object"||(p.data=[p.data])),A(p.fields||[],p.data||[],V);throw new Error("Unable to serialize unrecognized input");function A(D,I,Q){var re="",te=(typeof D=="string"&&(D=JSON.parse(D)),typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(D)&&0<D.length),he=!Array.isArray(I[0]);if(te&&v){for(var Y=0;Y<D.length;Y++)0<Y&&(re+=x),re+=w(D[Y],Y);0<I.length&&(re+=N)}for(var X=0;X<I.length;X++){var ae=(te?D:I[X]).length,G=!1,le=te?Object.keys(I[X]).length===0:I[X].length===0;if(Q&&!te&&(G=Q==="greedy"?I[X].join("").trim()==="":I[X].length===1&&I[X][0].length===0),Q==="greedy"&&te){for(var ue=[],Z=0;Z<ae;Z++){var se=he?D[Z]:Z;ue.push(I[X][se])}G=ue.join("").trim()===""}if(!G){for(var j=0;j<ae;j++){0<j&&!le&&(re+=x);var Re=te&&he?D[j]:j;re+=w(I[X][Re],j)}X<I.length-1&&(!Q||0<ae&&!le)&&(re+=N)}}return re}function w(D,I){var Q,re,te;return D==null?"":D.constructor===Date?isNaN(D.getTime())?"":D.toISOString():(te=!1,F&&typeof D=="string"&&F.test(D)&&(D="'"+D,te=!0),re=(Q=D.toString()).replace(M,q),(te=te||y===!0||typeof y=="function"&&y(D,I)||Array.isArray(y)&&y[I]||((he,Y)=>{for(var X=0;X<Y.length;X++)if(-1<he.indexOf(Y[X]))return!0;return!1})(re,u.BAD_DELIMITERS)||-1<re.indexOf(x)||-1<Q.indexOf(K)||re.charAt(0)===" "||re.charAt(re.length-1)===" ")?K+re+K:re)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
|
|
10
10
|
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=S,u.ParserHandle=O,u.NetworkStreamer=h,u.FileStreamer=f,u.StringStreamer=m,u.ReadableStreamStreamer=_,o&&(i.onmessage=function(p){p=p.data,u.WORKER_ID===void 0&&p&&(u.WORKER_ID=p.workerId),typeof p.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(p.input,p.config),finished:!0}):(i.File&&p.input instanceof File||p.input instanceof Object)&&(p=u.parse(p.input,p.config))&&i.postMessage({workerId:u.WORKER_ID,results:p,finished:!0})}),(h.prototype=Object.create(d.prototype)).constructor=h,(f.prototype=Object.create(d.prototype)).constructor=f,(m.prototype=Object.create(m.prototype)).constructor=m,(_.prototype=Object.create(d.prototype)).constructor=_,u})})(ft)),ft.exports}var aa=oa(),Ve=(r=>(r.String="string",r.Number="number",r.Boolean="boolean",r.Object="object",r.Undefined="undefined",r))(Ve||{});const la=["id"],ca=n.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(r,{emit:e}){const t=e,i=r,s=n.computed(()=>`export_${new Date().getTime()}`),o=n.computed(()=>{const d=u();return d.length?d:null}),a=()=>{const d=i.labels;if(typeof i.fields!==Ve.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return d!==null&&typeof d===Ve.Object?h=>Object.fromEntries(Object.entries(h).map(([f,m])=>[d[f]||f,m])):h=>h},l=()=>{const d=i.fields;if(typeof i.fields!==Ve.Object&&!Array.isArray(d))throw new Error("Fields needs to be an array of strings.");return Array.isArray(d)?h=>Object.fromEntries(d.filter(f=>f in h).map(f=>[f,h[f]])):h=>h},u=()=>{if(typeof i.fields===Ve.Undefined&&typeof i.labels===Ve.Undefined)return i.data;const d=a(),h=l();return i.data.map(f=>d(h(f)))},c=()=>{if(!o.value){console.warn("No data to export");return}t("export-started",o.value);let d=aa.unparse(o.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(d="SEP="+i.delimiter+`\r
|
|
11
11
|
`+d),i.encoding==="utf-8"&&(d="\uFEFF"+d),t("export-finished",i.filename),!i.testing){const h=new Blob([d],{type:"text/csv;charset="+i.encoding});na.saveAs(h,i.filename)}};return(d,h)=>(n.openBlock(),n.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[n.renderSlot(d.$slots,"default",{},()=>[n.createTextVNode("Download "+n.toDisplayString(r.filename),1)])],8,la))}}),ua=n.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(r){const e=r,t=n.computed(()=>Object.keys(e.headers));return(i,s)=>(n.openBlock(),n.createElementBlock("div",null,[n.createVNode(ca,{data:r.rows,fields:t.value,filename:r.filename,labels:r.headers},{default:n.withCtx(()=>[n.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}}),Hi={renderer:{not_configured:{title:"Chart is not fully configured",description:"Begin by choosing at least one metric"},noQueryBridge:"No query bridge provided. Unable to render dashboard.",unexpectedError:"An unexpected error has occurred.",trendRange:{"24h":"Last 24-hour summary","7d":"Last 7-day summary","30d":"Last 30-day summary"},edit:"Edit",duplicateTile:"Duplicate",exit_fullscreen:"Exit fullscreen",fullscreen:"Fullscreen",remove:"Remove",delete:"Delete",as_of_today:"As of today",noDataAvailable:{title:"No data in the current time frame",description:"Once there is traffic, it will display here"},treemapUnsupported:{title:"This query can't be shown as a treemap",description:"Treemaps need a count or total metric, such as requests or tokens, and no time dimension"}},pdfExport:{branding:"Kong Konnect",generated:"Generated {timestamp}",dashboardNote:"For a live, interactive experience, open this dashboard in Konnect",pageOf:"{page} / {total}"},csvExport:{defaultFilename:"Chart export",exportAsCsv:"Export as CSV",dataError:"Error loading data",noDataRange:"No data in selected range",noDataRetry:"Please adjust the time period and try again",timeRangeSelected:"selected",exportPreview:"Export preview",exportTimeRange:"Time range",exportAsOf:"As of {time}",exportDescription:"Exports a CSV of the data represented in the chart.",maximumRecordAmount:"The number of groups is limited to {value}",previewRows:"Previewing {rowsMax} of {rowsTotal} row{plural}",downloadButton:"Export",cancelButton:"Cancel",UtcOffset:"UTC offset",Timestamp:"Timestamp"},chartLabels:{control_plane:"Control plane",data_plane_node_version:"Data plane node version",env:"Environment",gateway_service:"Gateway service",hostname:"Hostname",plugin:"Plugin",plugin_name:"Plugin name",plugin_scope:"Plugin scope",region:"Region",request_count:"Request count",route:"Route",status_code:"Status code",team:"Team",name:"Name",latencies_response_ms:"Response latency",latencies_upstream_ms:"Upstream latency",latencies_kong_gateway_ms:"Kong latency",latencies_kong_internal_ms:"Kong internal latency",request_body_size:"Request size",response_body_size:"Response size",response_header_content_length:"Content length",ai:{cost:"Cost",costCaching:"Caching cost",promptTokens:"Prompt tokens",completionTokens:"Completion tokens",totalTokens:"Total tokens",llmLatency:"LLM latency",fetchLatency:"Fetch latency",embeddingsLatency:"Embeddings latency"},mcp:{latency:"MCP latency",response_body_size:"MCP response size"},a2a:{latency:"A2A latency",response_body_size:"A2A response size"},ai_gateway:"AI gateway",ai_gateway_agent:"AI gateway agent",ai_gateway_consumer:"AI gateway consumer",ai_gateway_consumer_group:"AI gateway consumer group",ai_gateway_data_plane_node:"AI gateway data plane node",ai_gateway_mcp_server:"AI gateway MCP server",ai_gateway_model:"AI gateway model",ai_count:"LLM request count",ai_plugin:"AI plugin",ai_provider:"Provider",ai_request_model:"Request model",ai_response_model:"Response model",error_rate:"Error rate",request_per_minute:"Requests per minute",requests_per_minute:"Requests per minute",response_latency_average:"Response latency (avg)",response_latency_p99:"Response latency (p99)",response_latency_p95:"Response latency (p95)",response_latency_p50:"Response latency (p50)",kong_latency_average:"Kong latency (avg)",kong_latency_p99:"Kong latency (p99)",kong_latency_p95:"Kong latency (p95)",kong_latency_p50:"Kong latency (p50)",kong_internal_latency_average:"Kong internal latency (avg)",kong_internal_latency_p99:"Kong internal latency (p99)",kong_internal_latency_p95:"Kong internal latency (p95)",kong_internal_latency_p50:"Kong internal latency (p50)",llm_cache_status:"Cache status",llm_embeddings_model:"Embeddings model",llm_embeddings_provider:"Embeddings provider",upstream_latency_average:"Upstream latency (avg)",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)",response_size_average:"Response size (avg)",response_size_sum:"Response size (sum)",response_source:"Response source",request_size_p99:"Request size (p99)",request_size_p95:"Request size (p95)",request_size_p50:"Request size (p50)",request_size_average:"Request size (avg)",request_size_sum:"Request size (sum)",total_tokens_per_minute:"Total tokens per minute",control_plane_group:"Control plane group",consumer:"Consumer",consumer_group:"Consumer group",country_code:"Country",country:"Country",data_plane_node:"Data plane node",api_package:"API package",api_product:"API product",api_product_version:"API product version",portal:"Portal",realm:"Realm",runtime_group:"Runtime group",application:"Application",status_code_grouped:"Status code (grouped)",upstream_status_code:"Upstream status code",upstream_status_code_grouped:"Upstream status code group",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",share_of_requests:"Share of requests",cost:"Costs",cost_per_request_average:"Request cost (avg per million)",llm_cache_embeddings_latency_average:"Embeddings latency (avg)",llm_cache_fetch_latency_average:"Fetch latency (avg)",llm_latency_average:"LLM latency (avg)",llm_latency_p50:"LLM latency (p50)",llm_latency_p95:"LLM latency (p95)",llm_latency_p99:"LLM latency (p99)",time_to_first_token_average:"Time to first token (avg)",time_to_first_token_p99:"Time to first token (p99)",time_to_first_token_p95:"Time to first token (p95)",time_to_first_token_p50:"Time to first token (p50)",time_per_token_average:"Time per token (avg)",time_per_token_p99:"Time per token (p99)",time_per_token_p95:"Time per token (p95)",time_per_token_p50:"Time per token (p50)","threshold-warning":"Warning threshold: {value}","threshold-error":"Error threshold: {value}","thatreshold-neutral":"Alert threshold: {value}",api:"API",vulnerability_count:"Vulnerability count",a2a_latency_average:"A2A latency (avg)",a2a_response_size_sum:"A2A response size (sum)",a2a_context_id:"A2A context ID",a2a_error:"A2A error",a2a_method:"A2A method",a2a_task_id:"A2A task ID",active_agents:"Active agents",mcp_error:"MCP error",mcp_method:"MCP method",mcp_latency_average:"MCP latency (avg)",mcp_latency_p99:"MCP latency (p99)",mcp_latency_p95:"MCP latency (p95)",mcp_latency_p50:"MCP latency (p50)",mcp_response_size_sum:"MCP response size (sum)",mcp_session_id:"MCP session ID",mcp_tool_name:"MCP tool name",mcp_response_body_size_sum:"MCP response size (sum)",control_plane_count:"Control plane count",service_count:"Gateway service count","record_bytes:sum":"Record size (sum)","record_count:sum":"Record count (sum)","request_count:sum":"Request count (sum)",route_count:"Route count",consumer_count:"Consumer count",plugin_count:"Plugin count",node_count:"Data plane node count",oidc_credential:"OIDC credential",principal:"Principal",virtual_cluster_id:"Virtual cluster",backend_cluster_id:"Backend cluster",listener_id:"Listener",principal_name:"Principal name",principal_type:"Principal type",request_type:"Request type",topic_name:"Topic name",partition_index:"Partition index",api_key:"API key",data_plane_group:"Data plane group",managed_cache:"Managed cache",network:"Network",provider:"Provider",provider_region:"Provider region",cache_eviction_rate:"Cache eviction rate",cache_expiration_rate:"Cache expiration rate",cache_items_average:"Cache items (avg)",cache_memory_utilization_max:"Cache memory utilization (max)",cache_status:"Cache status",cache_hit_rate:"Cache hit rate",share_of_cost:"Share of cost"},chartUnits:{ms:"ms",bytes:"Byte{plural}",count:"request{plural}","count/minute":"rpm",requests:"request{plural}","token count":"token{plural}","tokens/minute":"tpm","%":"%","ops/minute":"ops/minute"},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)"}},jumpToExplore:"Explore",jumpToRequests:"View requests",unsupported_time_range_badge:"Limited timeframe",unsupported_time_range_warning:"The selected timeframe exceeds what this datasource supports, so this tile is limited to the maximum supported timeframe.",query_aged_out_warning:"This tile was configured with {savedGranularity} granularity, which is no longer available. It now shows {currentGranularity} data, the closest available granularity.",granularities:{daily:"1 day",fiveMinutely:"5 minutes",hourly:"1 hour",minutely:"1 minute",tenMinutely:"10 minutes",tenSecondly:"10 seconds",thirtyMinutely:"30 minutes",thirtySecondly:"30 seconds",twelveHourly:"12 hours",twoHourly:"2 hours",weekly:"1 week",unknown:"Unknown"}};function At(){const r=at.createI18n("en-us",Hi);return{i18n:r,i18nT:at.i18nTComponent(r)}}const Ye=170,mt=6,Te="analytics-query-provider",Gi="analytics-dashboard-coordinator",Lt="{entity-id}",Fi="{cp-id}",$i="{timeframe}",Wi=30*1e3,Vi=3e5,Yi=36e5;function da(){const r=n.inject(Te);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var Ut={exports:{}},Xi;function ha(){return Xi||(Xi=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function o(u,c,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new s(d,h||u,f),_=t?t+c:c;return u._events[_]?u._events[_].fn?u._events[_]=[u._events[_],m]:u._events[_].push(m):(u._events[_]=m,u._eventsCount++),u}function a(u,c){--u._eventsCount===0?u._events=new i:delete u._events[c]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],d,h;if(this._eventsCount===0)return c;for(h in d=this._events)e.call(d,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},l.prototype.listeners=function(c){var d=t?t+c:c,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,m=h.length,_=new Array(m);f<m;f++)_[f]=h[f].fn;return _},l.prototype.listenerCount=function(c){var d=t?t+c:c,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,d,h,f,m,_){var O=t?t+c:c;if(!this._events[O])return!1;var C=this._events[O],S=arguments.length,k,E;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),S){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,h),!0;case 4:return C.fn.call(C.context,d,h,f),!0;case 5:return C.fn.call(C.context,d,h,f,m),!0;case 6:return C.fn.call(C.context,d,h,f,m,_),!0}for(E=1,k=new Array(S-1);E<S;E++)k[E-1]=arguments[E];C.fn.apply(C.context,k)}else{var b=C.length,T;for(E=0;E<b;E++)switch(C[E].once&&this.removeListener(c,C[E].fn,void 0,!0),S){case 1:C[E].fn.call(C[E].context);break;case 2:C[E].fn.call(C[E].context,d);break;case 3:C[E].fn.call(C[E].context,d,h);break;case 4:C[E].fn.call(C[E].context,d,h,f);break;default:if(!k)for(T=1,k=new Array(S-1);T<S;T++)k[T-1]=arguments[T];C[E].fn.apply(C[E].context,k)}}return!0},l.prototype.on=function(c,d,h){return o(this,c,d,h,!1)},l.prototype.once=function(c,d,h){return o(this,c,d,h,!0)},l.prototype.removeListener=function(c,d,h,f){var m=t?t+c:c;if(!this._events[m])return this;if(!d)return a(this,m),this;var _=this._events[m];if(_.fn)_.fn===d&&(!f||_.once)&&(!h||_.context===h)&&a(this,m);else{for(var O=0,C=[],S=_.length;O<S;O++)(_[O].fn!==d||f&&!_[O].once||h&&_[O].context!==h)&&C.push(_[O]);C.length?this._events[m]=C.length===1?C[0]:C:a(this,m)}return this},l.prototype.removeAllListeners=function(c){var d;return c?(d=t?t+c:c,this._events[d]&&a(this,d)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,r.exports=l})(Ut)),Ut.exports}var fa=ha();const ma=ta(fa);class Kt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,Kt)}}const ji=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function pa(r,e){const{milliseconds:t,fallback:i,message:s,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,u;const d=new Promise((h,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(a?.aborted){f(ji(a));return}if(a&&(u=()=>{f(ji(a))},a.addEventListener("abort",u,{once:!0})),r.then(h,f),t===Number.POSITIVE_INFINITY)return;const m=new Kt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(_){f(_)}return}typeof r.cancel=="function"&&r.cancel(),s===!1?h():s instanceof Error?f(s):(m.message=s??`Promise timed out after ${t} milliseconds`,f(m))},t)}).finally(()=>{d.clear(),u&&a&&a.removeEventListener("abort",u)});return d.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},d}function ga(r,e,t){let i=0,s=r.length;for(;s>0;){const o=Math.trunc(s/2);let a=i+o;t(r[a],e)<=0?(i=++a,s-=o+1):s=o}return i}const _a=100;class Qi{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:s}=t??{},{size:o}=this,a={priority:i,id:s,run:e};if(o===0){this.#t.length=0,this.#e=0,this.#t.push(a);return}if(this.#t.at(-1).priority>=i){this.#t.push(a);return}this.#s();const l=ga(this.#t,a,(u,c)=>c.priority-u.priority);this.#t.splice(l,0,a)}setPriority(e,t){const i=this.#t.findIndex((o,a)=>a>=this.#e&&o.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=this.#t.splice(i,1);this.enqueue(s.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,s)=>s<this.#e?!1:typeof e=="string"?i.id===e:i.run===e);t!==-1&&this.#t.splice(t,1)}dequeue(){if(this.#e===this.#t.length)return;const e=this.#t[this.#e];return this.#e++,this.#e===this.#t.length?(this.#t.length=0,this.#e=0):this.#e>_a&&this.#e>this.#t.length/2&&this.#s(),e?.run}filter(e){const t=[];for(let i=this.#e;i<this.#t.length;i++){const s=this.#t[i];s.priority===e.priority&&t.push(s.run)}return t}get size(){return this.#t.length-this.#e}#s(){this.#e!==0&&(this.#t.splice(0,this.#e),this.#e=0)}}class ya extends ma{#t;#e;#s=0;#f;#p=!1;#R=!1;#c;#C=0;#l;#u;#a;#o=[];#n=0;#i;#v;#r=0;#g;#d;#N=1n;#_=new Map;#E=new Set;timeout;constructor(e){if(super(),e={carryoverIntervalCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Qi,strict:!1,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);if(e.strict&&e.interval===0)throw new TypeError("The `strict` option requires a non-zero `interval`");if(e.strict&&e.intervalCap===Number.POSITIVE_INFINITY)throw new TypeError("The `strict` option requires a finite `intervalCap`");if(this.#t=e.carryoverIntervalCount??e.carryoverConcurrencyCount??!1,this.#e=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#f=e.intervalCap,this.#c=e.interval,this.#a=e.strict,this.#i=new e.queueClass,this.#v=e.queueClass,this.concurrency=e.concurrency,e.timeout!==void 0&&!(Number.isFinite(e.timeout)&&e.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);this.timeout=e.timeout,this.#d=e.autoStart===!1,this.#P()}#O(e){for(;this.#n<this.#o.length;){const i=this.#o[this.#n];if(i!==void 0&&e-i>=this.#c)this.#n++;else break}(this.#n>100&&this.#n>this.#o.length/2||this.#n===this.#o.length)&&(this.#o=this.#o.slice(this.#n),this.#n=0)}#A(e){this.#a?this.#o.push(e):this.#s++}#L(){this.#a?this.#o.length>this.#n&&this.#o.pop():this.#s>0&&this.#s--}#b(){return this.#o.length-this.#n}get#U(){return this.#e?!0:this.#a?this.#b()<this.#f:this.#s<this.#f}get#K(){return this.#r<this.#g}#M(){this.#r--,this.#r===0&&this.emit("pendingZero"),this.#y(),this.emit("next")}#B(){this.#u=void 0,this.#D(),this.#I()}#z(e){if(this.#a){if(this.#O(e),this.#b()>=this.#f){const i=this.#o[this.#n],s=this.#c-(e-i);return this.#S(s),!0}return!1}if(this.#l===void 0){const t=this.#C-e;if(t<0)this.#s=this.#t?this.#r:0;else return this.#S(t),!0}return!1}#S(e){this.#u===void 0&&(this.#u=setTimeout(()=>{this.#B()},e))}#w(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#x(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#y(){if(this.#i.size===0){if(this.#w(),this.emit("empty"),this.#r===0){if(this.#x(),this.#a&&this.#n>0){const t=Date.now();this.#O(t)}this.emit("idle")}return!1}let e=!1;if(!this.#d){const t=Date.now(),i=!this.#z(t);if(this.#U&&this.#K){const s=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),s(),e=!0}}return e}#I(){this.#e||this.#l!==void 0||this.#a||(this.#l=setInterval(()=>{this.#D()},this.#c),this.#C=Date.now()+this.#c)}#D(){this.#a||(this.#l!==void 0&&(this.#s===0&&this.#r===0?this.#w():this.#C=Date.now()+this.#c),this.#s=this.#t?this.#r:0),this.#T(),this.#m()}#T(){for(;this.#y(););}get concurrency(){return this.#g}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#g=e,this.#T()}setPriority(e,t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);this.#i.setPriority(e,t)}async add(e,t={}){if(t={timeout:this.timeout,...t,id:t.id??(this.#N++).toString()},t.timeout!==void 0&&!(Number.isFinite(t.timeout)&&t.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);return new Promise((i,s)=>{const o=Symbol(`task-${t.id}`);let a=()=>{};const l=async()=>{a(),this.#r++,this.#_.set(o,{id:t.id,priority:t.priority??0,startTime:Date.now(),timeout:t.timeout});let c;try{try{t.signal?.throwIfAborted()}catch(f){throw this.#q(),this.#_.delete(o),f}let d=e({signal:t.signal});if(t.timeout!==void 0&&(d=pa(Promise.resolve(d),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#r} running, ${this.#i.size} waiting)`})),t.signal){const{signal:f}=t;d=Promise.race([d,new Promise((m,_)=>{c=()=>{_(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await d;i(h),this.emit("completed",h)}catch(d){s(d),this.emit("error",d)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#M()})}};this.#i.enqueue(l,t);const u=()=>{if(this.#i instanceof Qi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,d=()=>{a(),u(),s(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",d),this.#E.delete(a)},c.aborted){d();return}c.addEventListener("abort",d,{once:!0}),this.#E.add(a)}this.emit("add"),this.#y()})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this.#d?(this.#d=!1,this.#T(),this):this}pause(){this.#d=!0}clear(){for(const e of this.#E)e();this.#i=new this.#v,this.#w(),this.#k(),this.emit("empty"),this.#r===0&&(this.#x(),this.emit("idle")),this.emit("next")}async onEmpty(){this.#i.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#i.size<e||await this.#h(["next","active"],()=>this.#i.size<e)}async onIdle(){this.#r===0&&this.#i.size===0||await this.#h("idle")}async onPendingZero(){this.#r!==0&&await this.#h("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#h("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#h("rateLimitCleared")}onError(){return new Promise((e,t)=>{const i=s=>{this.off("error",i),t(s)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(s=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);s()}};for(const a of i)this.on(a,o)})}get size(){return this.#i.size}sizeBy(e){return this.#i.filter(e).length}get pending(){return this.#r}get isPaused(){return this.#d}#P(){this.#e||(this.on("add",()=>{this.#i.size>0&&this.#m()}),this.on("next",()=>{this.#m()}))}#m(){this.#e||this.#R||(this.#R=!0,queueMicrotask(()=>{this.#R=!1,this.#k()}))}#q(){this.#e||(this.#L(),this.#m())}#k(){const e=this.#p;if(this.#e||this.#i.size===0){e&&(this.#p=!1,this.emit("rateLimitCleared"));return}let t;if(this.#a){const s=Date.now();this.#O(s),t=this.#b()}else t=this.#s;const i=t>=this.#f;i!==e&&(this.#p=i,this.emit(i?"rateLimit":"rateLimitCleared"))}get isRateLimited(){return this.#p}get isSaturated(){return this.#r===this.#g&&this.#i.size>0||this.isRateLimited&&this.#i.size>0}get runningTasks(){return[...this.#_.values()].map(e=>({...e,timeoutRemaining:e.timeout?Math.max(0,e.startTime+e.timeout-Date.now()):void 0}))}}const Ra=()=>{const r=Ne.useAnalyticsConfigStore(),e=n.inject(Te);if(!e)return;if(e.queryFnOverride){console.warn("Detected incorrect use of useRequestQueue. This composable should not be used in nested components. Please discuss with team-data or report an issue if you feel you have a use case.");return}const t=new ya({carryoverConcurrencyCount:!0,concurrency:r.maxParallelRequests,interval:r.requestInterval,intervalCap:r.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,o)=>t.add(()=>e.queryFn(s,o))};n.provide(Te,i)};function Ca(r){const e=`[${r.name}] ${r.message}`,t=[];return r.fix&&t.push(`fix: ${r.fix}`),r.sources?.length&&t.push(`sources: ${r.sources.join(", ")}`),r.docs&&t.push(`see: ${r.docs}`),t.length===0?e:[e,...t.map((i,s)=>`${s<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
|
|
12
|
-
`)}function Zi(r,...e){return typeof r=="function"?r(...e):r}function Ea({method:r="warn",formatter:e=Ca}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const Oa=Error.captureStackTrace;var ba=class zr extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=zr){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,Oa?.(this,t)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,stack:this.stack}}};function wa(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function Ta(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const s of Object.keys(r.codes)){const o=r.codes[s],a=o.docs===!1?void 0:o.docs||wa(i,s),l=(u={},c={})=>{const d=new ba({code:s,why:Zi(o.why,u),fix:Zi(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[s]=l}return t}const va=typeof window<"u",Sa=Ta({reporters:[Ea()],codes:{PINIA_R1001:{why:'Directly pass all stores to "mapStores()" without putting them in an array. This will fail in production.',fix:"Replace mapStores([useAuthStore, useCartStore]) with mapStores(useAuthStore, useCartStore).",docs:"https://pinia.vuejs.org/cookbook/options-api.html#Giving-access-to-the-whole-store"},PINIA_R1002:{why:r=>`A getter cannot have the same name as another state property. Found "${r.name}" in store "${r.id}".`,fix:"Rename either the getter or the state property.",docs:"https://pinia.vuejs.org/core-concepts/getters.html#Accessing-other-getters"},PINIA_R1003:{why:r=>`The "state" must be a plain object. Found in store "${r.id}".`,fix:"Return a plain object, e.g. avoid state: () => new MyClass().",docs:"https://pinia.vuejs.org/core-concepts/state.html#State"},PINIA_R1004:{why:"Pinia instance not found in context. This falls back to the global activePinia, which exposes you to cross-request pollution on the server.",fix:'"useStore()" is a composable and follows the same rules: call it at the top of setup() (or another composable), or pass the pinia instance explicitly when used outside of a component.',docs:"https://pinia.vuejs.org/ssr/#Using-the-store-outside-of-setup-"},PINIA_R1005:{why:r=>`The store id changed from "${r.from}" to "${r.to}", forcing a reload.`,docs:"https://pinia.vuejs.org/cookbook/hot-module-replacement.html#HMR-Hot-Module-Replacement-"},PINIA_R1006:{why:r=>`Property "${r.key}" of store "${r.id}" is not reactive (not a ref, reactive object, or shallowRef), so storeToRefs() ignores it.`,fix:"If it should be reactive state, wrap it with ref(), reactive(), or shallowRef(). If it is an intentional non-reactive property, wrap it with markRaw() so storeToRefs() skips it explicitly.",docs:"https://pinia.vuejs.org/core-concepts/plugins.html#Adding-new-external-properties"},PINIA_R1007:{why:r=>`The same callback was passed to "$subscribe()" of store "${r.id}" more than once. Subscriptions are deduplicated, so the duplicate is ignored.`,fix:"Subscribe each callback only once. If you need to resubscribe, call the returned function to remove the previous subscription first, or create a new function.",docs:"https://pinia.vuejs.org/core-concepts/state.html#Subscribing-to-the-state"}}});let Ji;process.env.NODE_ENV;const er=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Xe(r){const e=n.toRaw(r),t={};for(const i in e){const s=e[i];s?.effect?t[i]=n.computed({get:()=>r[i],set(o){r[i]=o}}):(n.isRef(s)||n.isReactive(s))&&(t[i]=n.toRef(r,i))}return t}const Ie=r=>r?.chart.type==="table",Mt=r=>r?.query?.datasource==="requests",Bt=r=>!!r&&!Ie(r)&&!Mt(r),xa=(r,e)=>{const t=r.header_description??("description"in r.chart?r.chart.description:void 0);if(t)return t.replaceAll($i,e)||void 0},Ia=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],Da=r=>Ia.includes(r);function ka({queryBridge:r,context:e,definition:t,chartData:i}){const s=n.ref(""),o=n.ref(""),a=n.ref(void 0),l=n.ref(void 0),u=Ne.useAnalyticsConfigStore(),c=Ne.useDatasourceConfigStore(),{stripUnknownFilters:d,loading:h}=Xe(c),f=n.computed(()=>Ie(t.value));n.onMounted(async()=>{s.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const m=n.computed(()=>u.analytics&&u.percentiles),_=n.computed(()=>{const y=t.value.chart.type;return["golden_signals","gauge"].includes(y)?!1:y==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),O=n.computed(()=>o.value&&t.value.query&&!f.value&&t.value.query.datasource!=="llm_usage"&&t.value.query.datasource!=="managed_cache_usage"&&!ee.isPlatformDatasource(t.value.query.datasource)&&m.value&&!h.value),C=n.computed(()=>s.value&&t.value.query&&Da(t.value.query.datasource)&&m.value&&!h.value),S=n.computed(()=>i.value?ee.msToGranularity(i.value.meta.granularity_ms):void 0),k=n.computed(()=>{const y=t.value,v=[...e.value.filters,...y.query.filters??[]],x="metrics"in y.query?y.query.metrics:void 0,N=y.query?.datasource??"api_usage";return d.value({datasource:N,filters:v,queryFields:x})}),E=n.computed(()=>{if(!C.value||!_.value)return"";const y=t.value;if(Ie(y))return g({...y.query,filters:k.value});const v=y.query.time_range||e.value.timeSpec,x=p(v,k.value);return g(x)}),b=n.computed(()=>{if(!O.value||!_.value)return"";const y=k.value,v=t.value;if(Ie(v))return"";const x=U(v.query.time_range||e.value.timeSpec,y);return T(x)}),T=y=>O.value?`${o.value}?q=${JSON.stringify(y)}`:"",U=(y,v)=>{const x=i.value?.meta?.start?new Date(i.value.meta.start):void 0,N=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:v,timeframe:{timePeriodsKey:y.type==="relative"?y.time_range:"custom",start:y.type==="absolute"?x:void 0,end:y.type==="absolute"?N:void 0}}},z=(y,v)=>({filter:v,timeframe:{timePeriodsKey:y.type==="relative"?y.time_range:"custom",start:y.type==="absolute"?y.start:void 0,end:y.type==="absolute"?y.end:void 0}}),p=(y,v)=>{const x=t.value;if(!Bt(x))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const N=[...x.query.dimensions??[]],K=[...x.query.metrics??[]];return{filters:v,metrics:K,dimensions:N,time_range:y,granularity:x.query.granularity||S.value||void 0}},g=y=>{if(!C.value)return"";const v=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${s.value}?q=${JSON.stringify(y)}&d=${v}&c=${t.value.chart.type}`};return n.watch([O,C],([y,v])=>{y&&(a.value={href:""}),v&&(l.value={href:""})}),{exploreLinkKebabMenu:E,requestsLinkKebabMenu:b,canShowKebabMenu:_,canGenerateRequestsLink:O,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:z,buildExploreLink:g,buildRequestLink:T}}const zt=r=>r.type==="relative"?ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Na=r=>r.reduce((e,t)=>{const i=ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Pt=(r,e)=>{if(!r||!e?.length)return;const t=zt(r),i=Na(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},qt=(r,e)=>{const t=Pt(r,e);return!t||!r?r:r.type==="relative"?{...r,time_range:t.key}:{...r,start:new Date(new Date(r.end).getTime()-t.durationSeconds*1e3)}};function Aa(){const r=n.inject(Te),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;return n.onUnmounted(()=>{s?.abort()}),{issueQuery:async(a,l,u)=>{if(!r)throw new Error("Query bridge is not defined");s?.abort();const c=new AbortController;s=c,await e.isReady();const{datasource:d,limit:h,...f}=a,m=d||"basic",_=ee.isPlatformDatasource(m),O=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:k})=>!_||!ee.requestFilterTypeEmptyV2.some(E=>E===k));let C=a.time_range;!C&&l.timeSpec?C={...l.timeSpec,tz:l.tz}:C&&!C.tz&&(C={...C,tz:l.tz}),C=qt(C,t.value[m]?.timeRangeOptions);const S={datasource:m,query:{...f,time_range:C,filters:O,limit:u??h}};return r.queryFn(S,c)}}}const La="24H",Ua={status_code:"response_http_status",upstream_status_code:"upstream_status"},Ka={cost:"usd",latencies_response_ms:"ms",latencies_upstream_ms:"ms",latencies_kong_gateway_ms:"ms",latencies_kong_internal_ms:"ms",request_body_size:"bytes",response_body_size:"bytes",response_header_content_length:"bytes",ai_count:"count"},Ma=r=>ee.relativeTimeRangeValuesRequestV2.includes(r),Ba=r=>{const e=r?.tz?{tz:r.tz}:{};if(r?.type==="absolute")return{type:"absolute",start:r.start,end:r.end,...e};const t=r?.time_range.toUpperCase()??"";return{type:"relative",time_range:Ma(t)?t:La,...e}},tr=r=>Ua[r]??r,za=r=>({metric:tr(r.metric),dimension:r.dimension?tr(r.dimension):void 0,unroll:r.unroll,metricUnit:Ka[r.metric],extraFields:r.extra_fields}),Ht="requests";function Pa(){const r=n.inject(Te),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;n.onUnmounted(()=>{s?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return qt(c&&{...c,tz:c.tz??u.tz},t.value[Ht]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");s?.abort();const d=new AbortController;s=d,await e.isReady();const h=i.value({datasource:Ht,filters:[...l.filters??[],...u.filters]});return ee.fetchAllRequests(c,{datasource:Ht,query:{filters:h,time_range:Ba(o(l,u))}},d,{maxRecords:l.max_records})}}}function qa({context:r,globalFilters:e=n.ref([]),isFullscreen:t=n.ref(!1),preview:i=n.ref(!1)}){const s=Ne.useAnalyticsConfigStore(),o=Ne.useDatasourceConfigStore(),{loading:a}=Xe(s),{loading:l}=Xe(o),u=n.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:s.defaultQueryTimeForOrg}),c=n.computed(()=>{const{tz:b}=r.value;return b||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=n.computed(()=>{const{editable:b}=r.value;return b===void 0||i.value?!1:b}),h=n.computed(()=>{const{showTileActions:b}=r.value;return i.value?!1:b===void 0?!0:b}),f=n.computed(()=>[...r.value.filters??[],...e.value]),m=n.computed(()=>{let{refreshInterval:b}=r.value;if(b===void 0&&(b=Wi),t.value){let T=!1;if(u.value.type==="relative")T=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const p=u.value.start.getTime(),g=u.value.end.getTime();T=Math.abs(g-p)<=864e5}const U=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<U||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?b=0:T?b=Vi:b=Yi}return b}),_=n.computed(()=>({filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:m.value,editable:d.value,showTileActions:h.value})),O=n.computed(()=>!a.value&&!l.value),C=n.computed(()=>!i.value&&!!n.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),S=n.computed(()=>!i.value),k=n.computed(()=>!i.value),E=n.computed(()=>({enabled:C.value,showExploreAction:S.value,showRequestsAction:k.value,showZoomInAction:C.value}));return{editable:d,enrichedContext:_,filters:f,queryReady:O,refreshInterval:m,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:E}}const Ha=6,ir=6,rr=4;function Ga(r,e){const{pageWidth:t,pageHeight:i,margin:s}=e,o=s+1,a=s+e.headerHeight-3,l=i-s-ir+3,u=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,s,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-s,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,s,o+rr),r.setDrawColor(220),r.line(s,a,t-s,a),r.line(s,l,t-s,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,s,u);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const d=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(d,s+c,u,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(d,s+c,u)),r.setTextColor(120),r.text(e.pageLabel,t-s,u,{align:"right"})}function Fa(r){const e=r.querySelector(".kong-ui-public-grid-layout, .grid-stack");if(!e)return[];const t=e.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item");if(!t.length)return[];const i=r.getBoundingClientRect().top,s=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),u=Math.round(a.bottom-i),c=s.get(l);s.set(l,c!==void 0?Math.max(c,u):u)}),[...s.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function $a(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const u=Math.min(t,e-l);a.push({startY:l,height:u}),l+=u}return a}const s=[];let o=0;for(const a of r){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(s.push({startY:o,height:l-o}),o=l):(s.push({startY:o,height:u-o}),o=u))}return o<e&&s.push({startY:o,height:e-o}),s}function Wa(r){const{i18n:e}=At(),t=n.ref({status:"idle"});async function i(s={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:u,orientation:c="landscape",pageSize:d="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:_="download",onBeforeCapture:O,onAfterCapture:C}=s,S=r.value;if(!S){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await O?.();const[{snapdom:k},{jsPDF:E}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const b={name:"kong-webgl-snapshot",beforeClone:()=>ee.prepareForCapture(),afterClone:()=>ee.restoreAfterCapture()},T=await k.toCanvas(S,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[b]}),U=Fa(S),z=S.getBoundingClientRect().width,p=z?T.width/z:f;t.value={status:"generating"};const g=new Date,y=new E({orientation:c,unit:"mm",format:d}),v=y.internal.pageSize.getWidth(),x=y.internal.pageSize.getHeight(),N=Ha+(l?rr:0),K=v-h*2,q=x-h*2-N-ir,V=T.width/K,P=q*V,F=$a(U,T.height,P,p),M={title:a,subtitle:l,dashboardUrl:u,generatedAt:e.t("pdfExport.generated",{timestamp:g.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:v,pageHeight:x,headerHeight:N,margin:h};for(let A=0;A<F.length;A++){A>0&&y.addPage();const{startY:w,height:D}=F[A],I=document.createElement("canvas");I.width=T.width,I.height=D,I.getContext("2d").drawImage(T,0,w,T.width,D,0,0,T.width,D),y.addImage(I.toDataURL("image/png"),"PNG",h,h+N,K,D/V),Ga(y,{...M,pageLabel:e.t("pdfExport.pageOf",{page:String(A+1),total:String(F.length)})})}if(_==="blob"){const A=y.output("blob");return t.value={status:"complete",pageCount:F.length},A}y.save(o),t.value={status:"complete",pageCount:F.length}}catch(k){t.value={status:"error",error:k}}finally{ee.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:n.readonly(t)}}const Va=r=>r.toLowerCase().endsWith("count")?"":r;function Ya(){const{i18n:r}=At(),{formatUnit:e}=ee.unitFormatter({i18n:r});return t=>{const i=t.meta?.metric_names?.[0]??"",s=t.meta?.metric_units?.[i]??"",o=`chartLabels.${i}`;return{seriesName:r.te(o)?r.t(o):i,valueFormatter:a=>e(a,s,{translateUnit:Va})}}}const ce={useContextLinks:ka,useDashboardContext:qa,useEvaluateFeatureFlag:da,useExportPdf:Wa,useI18n:At,useIssueQuery:Aa,useIssueRequestsQuery:Pa,useMetricFormatter:Ya,useRequestQueue:Ra},Xa={class:"kong-ui-public-csv-export-modal"},ja={key:0,class:"selected-range"},Qa={key:4,class:"text-muted",tag:"span"},nr=3,sr=n.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=ce.useI18n(),i=r,s=e,o=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=n.ref(1),l=n.computed(()=>f.value.rows.length),u=n.computed(()=>i.exportState.status==="success"&&!!i.exportState.chartData?.data?.length),c=n.computed(()=>{if(i.exportState.status!=="success"||!i.exportState.chartData?.meta)return"";const{start:_,end:O}=i.exportState.chartData.meta;return!_||!O?"":new Date(_).getTime()===new Date(O).getTime()?t.t("csvExport.exportAsOf",{time:ee.formatTimestamp(new Date(_),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ee.formatTimestamp(new Date(_))} - ${ee.formatTimestamp(new Date(O),{includeTZ:!0})}`}),d=n.computed(()=>i.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(nr,l.value),rowsTotal:l.value,plural:l.value===1?"":"s"})),h=()=>{s("closeModal")},f=n.computed(()=>{if(i.exportState.status!=="success"||!u.value||!i.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const _=i.exportState.chartData,O=_.data.some(T=>T.timestamp!==_.data[0].timestamp),C=_.data.map(T=>{const U=new Date(T.timestamp);return{...Object.keys(T.event).reduce((p,g)=>{if(g in _.meta.display){const y=T.event[g],v=_.meta.display[g];p[g]=y&&v?.[y]?.name||T.event[g]}else p[g]=T.event[g];return p},{}),...O?{timestamp:Ui(U,"yyyy-MM-dd HH:mm:ss"),tzOffset:Ui(U,"XXX")}:{}}});let S=[];O&&(S=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const k="display"in i.exportState.chartData.meta&&i.exportState.chartData.meta.display?i.exportState.chartData.meta.display:{},E=[...S,...Object.keys(k).map(T=>({label:t.t(`chartLabels.${T}`),key:T})),...i.exportState.chartData.meta.metric_names.map(T=>({label:t.t(`chartLabels.${T}`),key:T}))],b=E.reduce((T,U)=>(T[U.key]=U.label,T),{});return{headers:E,csvHeaders:b,rows:C}}),m=async()=>{if(i.exportState.status!=="success")return{total:0,data:[]};const{rows:_}=f.value;return{total:Number(_.length)||0,data:_.slice(0,nr)}};return n.watch(f,()=>{a.value++}),(_,O)=>{const C=n.resolveComponent("KSkeleton"),S=n.resolveComponent("KEmptyState"),k=n.resolveComponent("KTableData"),E=n.resolveComponent("KTooltip"),b=n.resolveComponent("KButton"),T=n.resolveComponent("KModal");return n.openBlock(),n.createElementBlock("div",Xa,[n.createVNode(T,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:n.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:n.withKeys(h,["esc"])},{default:n.withCtx(()=>[n.createElementVNode("div",null,[r.exportState.status==="success"&&u.value?(n.openBlock(),n.createElementBlock("div",ja,[n.createElementVNode("p",null,n.toDisplayString(r.modalDescription?r.modalDescription:n.unref(t).t("csvExport.exportDescription")),1),n.createElementVNode("p",null,n.toDisplayString(c.value),1)])):n.createCommentVNode("",!0),r.exportState.status==="loading"?(n.openBlock(),n.createBlock(C,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(n.openBlock(),n.createBlock(k,{key:2,class:"vitals-table",fetcher:m,"fetcher-cache-key":String(a.value),headers:f.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":n.withCtx(()=>[n.createVNode(S,{"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRange")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):r.exportState.status==="error"?(n.openBlock(),n.createBlock(S,{key:3,"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.dataError")),1)]),_:1})):n.createCommentVNode("",!0),r.exportState.status==="success"&&u.value?(n.openBlock(),n.createElementBlock("div",Qa,[n.createTextVNode(n.toDisplayString(d.value)+" ",1),n.createVNode(E,{class:"preview-tooltip",placement:"right",text:n.unref(t).t("csvExport.maximumRecordAmount",{value:n.unref(ee.EXPORT_RECORD_LIMIT)})},{default:n.withCtx(()=>[n.createVNode(n.unref(ie.InfoIcon),{color:`var(--kui-color-text-neutral, ${n.unref(Nt)})`,size:`var(--kui-icon-size-30, ${n.unref(ea)})`},null,8,["color","size"])]),_:1},8,["text"])])):n.createCommentVNode("",!0)])]),"footer-actions":n.withCtx(()=>[n.createVNode(b,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.cancelButton")),1)]),_:1}),n.createVNode(ua,{class:"vitals-report-export-button",filename:o,headers:f.value.csvHeaders,rows:f.value.rows},{default:n.withCtx(()=>[n.createVNode(b,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!u.value},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}});var or=(r=>(r.VALIDATING="VALIDATING",r.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",r.PENDING="PENDING",r.SUCCESS="SUCCESS",r.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",r.ERROR="ERROR",r.STALE_IF_ERROR="STALE_IF_ERROR",r))(or||{});const Za=r=>r?!!(Object.keys(r)?.length||r.data?.length||r.data?.data?.length||!r.data?.data&&typeof r.data=="object"&&Object.keys(r?.data).length):!1;function ar(r=n.ref({}),e,t,i=Za){const s=n.ref("PENDING");return n.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){s.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){s.value="VALIDATING";return}if(r.value&&e.value){s.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){s.value="PENDING";return}if(r.value&&!e.value&&o){s.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){s.value="SUCCESS";return}r.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:or}}const Ke=n.defineComponent({__name:"QueryDataProvider",props:{context:{},limitOverride:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=ce.useI18n(),{issueQuery:o}=ce.useIssueQuery(),a=n.inject(Te),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=ti(l,async()=>{const k=l();try{const E=await o(t.query,t.context,t.limitOverride);return l()!==k?void 0:(m.value=null,E)}catch(E){if(l()!==k)return;throw m.value=xe.handleQueryError(E),E}finally{l()===k&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=ar(u,c,d),m=n.ref(null),_=n.computed(()=>h.value===f.ERROR||!!m.value),O=n.computed(()=>!t.queryReady||h.value===f.PENDING),C=n.ref(),S=n.computed(()=>u.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return n.watch([()=>u.value,()=>h.value],([k,E])=>{k&&(E==="SUCCESS_HAS_DATA"||E==="SUCCESS")&&k!==C.value&&(C.value=k,i("chart-data",k))}),(k,E)=>{const b=n.resolveComponent("KSkeleton"),T=n.resolveComponent("KEmptyState");return(O.value||!n.unref(u)&&!_.value)&&!S.value?(n.openBlock(),n.createBlock(b,{key:0,class:"chart-skeleton",type:"table"})):_.value&&!O.value?(n.openBlock(),n.createBlock(T,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[m.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(ie.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(ie.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(m.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[m.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(m.value.details),1)]),key:"0"}:void 0]),1024)):S.value?n.renderSlot(k.$slots,"default",{data:S.value},void 0,void 0,2):n.createCommentVNode("",!0)}}}),Ja=n.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>e.chartOptions.type==="single_value"),i=n.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend"}:e.chartOptions);return(s,o)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:a})=>[n.createElementVNode("div",{class:n.normalizeClass(["analytics-chart",{"single-value":t.value}]),style:n.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[n.createVNode(n.unref(xe.SimpleChart),{"chart-data":a,"chart-options":i.value,"synthetics-data-key":t.value?void 0:r.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],6)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Ce=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},lr=Ce(Ja,[["__scopeId","data-v-22077b88"]]),el={class:"analytics-chart"},Gt=Ce(n.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=ce.useI18n(),o=n.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold,metricAxisMap:t.chartOptions.metric_axis_map,yAxes:t.chartOptions.y_axes&&{left:a(t.chartOptions.y_axes.left),right:a(t.chartOptions.y_axes.right)},hideTruncationWarning:t.query.limit!==void 0&&t.query.limit>0})),a=c=>c&&{title:c.title,showGrid:c.show_grid},l=()=>{i("edit-tile")},u=c=>{i("chart-data",c)};return(c,d)=>{const h=n.resolveComponent("KDropdownItem");return n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:u},{default:n.withCtx(({data:f})=>[n.createElementVNode("div",el,[n.createVNode(n.unref(xe.AnalyticsChart),n.mergeProps({"active-metric":r.activeMetric,"chart-data":f,"chart-options":o.value,"explore-link":r.exploreLink,"legend-position":"bottom","requests-link":r.requestsLink,"synthetics-data-key":r.chartOptions.synthetics_data_key,"timeseries-zoom":r.zoomConfiguration?.showZoomInAction,"tooltip-title":""},r.extraProps,{onSelectChartRange:d[0]||(d[0]=m=>i("select-chart-range",m)),onZoomTimeRange:d[1]||(d[1]=m=>i("zoom-time-range",m))}),n.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:n.withCtx(()=>[n.createVNode(h,{onClick:l},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["active-metric","chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-5e3d0a14"]]),cr=n.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Gt,{"chart-options":r.chartOptions,context:r.context,"extra-props":{showAnnotations:!1},height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),tl={class:"analytics-chart"},il={key:3,class:"analytics-chart"},rl=Ce(n.defineComponent({__name:"ScatterChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=ce.useI18n(),{issueRequestsQuery:o}=ce.useIssueRequestsQuery(),a=n.computed(()=>t.query.datasource==="requests"),l=n.computed(()=>{const b=t.query,T=b.time_range??t.context.timeSpec,U=T?zt(T):void 0;if(!U)return b;const z=ee.finestGranularityForDuration(U);let p;return b.granularity&&ee.Granularities[b.granularity]>=ee.Granularities[z]?p=b.granularity:p=z,{...b,granularity:p}}),u=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=n.ref(null),{data:d,error:h,isValidating:f}=ti(u,async()=>{const b=u(),T=t.query;try{const U=await o(T,t.context);return u()!==b?void 0:(c.value=null,xe.requestsToScatterData(U,za(T)))}catch(U){if(u()!==b)return;throw c.value=xe.handleQueryError(U),U}finally{u()===b&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:_}=ar(d,h,f),O=n.ref(),C=n.computed(()=>d.value??O.value);n.watch(d,b=>{b&&(O.value=b)});const S=n.computed(()=>m.value===_.ERROR||!!c.value),k=n.computed(()=>!S.value&&(!t.queryReady||m.value===_.PENDING)&&!C.value),E=n.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(b=>({percentile:b.percentile,label:b.label,borderDash:b.border_dash,color:b.color})),outlierPercentile:t.chartOptions.outlier_percentile,shadeOutlierRegion:t.chartOptions.shade_outlier_region,jitterMs:t.chartOptions.jitter_ms,pointRadius:t.chartOptions.point_radius,pointOpacity:t.chartOptions.point_opacity}}));return(b,T)=>{const U=n.resolveComponent("KSkeleton"),z=n.resolveComponent("KEmptyState");return a.value?k.value?(n.openBlock(),n.createBlock(U,{key:1,class:"chart-skeleton",type:"table"})):S.value?(n.openBlock(),n.createBlock(z,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[c.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(ie.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(ie.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):C.value?(n.openBlock(),n.createElementBlock("div",il,[n.createVNode(n.unref(xe.AnalyticsChart),{"chart-data":C.value,"chart-options":E.value,"legend-position":"bottom","synthetics-data-key":r.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])):n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ke,{key:0,context:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:T[0]||(T[0]=p=>i("chart-data",p)),onQueryComplete:T[1]||(T[1]=p=>i("query-complete"))},{default:n.withCtx(({data:p})=>[n.createElementVNode("div",tl,[n.createVNode(n.unref(xe.AnalyticsChart),{"chart-data":p,"chart-options":E.value,"legend-position":"bottom","synthetics-data-key":r.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}}),[["__scopeId","data-v-e823be94"]]),ur=n.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["zoom-time-range","select-chart-range"],setup(r,{emit:e}){const t=e;return(i,s)=>(n.openBlock(),n.createBlock(Gt,{"active-metric":r.activeMetric,"chart-options":r.chartOptions,context:r.context,"explore-link":r.exploreLink,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,"requests-link":r.requestsLink,"zoom-configuration":r.zoomConfiguration,onSelectChartRange:s[0]||(s[0]=o=>t("select-chart-range",o)),onZoomTimeRange:s[1]||(s[1]=o=>t("zoom-time-range",o))},null,8,["active-metric","chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link","zoom-configuration"]))}}),nl=Ce(n.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>{const s=e.query?.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:e.query?.datasource,overrideTimeRange:e.context.timeSpec,additionalFilter:e.context.filters,longCardTitles:e.chartOptions.long_card_titles,percentileLatency:e.chartOptions.percentile_latency,refreshInterval:e.context.refreshInterval,queryReady:e.queryReady,refreshCounter:e.refreshCounter}}),i=n.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(s,o)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[n.createVNode(n.unref(ii.MetricsProvider),n.normalizeProps(n.guardReactiveProps(t.value)),{default:n.withCtx(()=>[n.createVNode(n.unref(ii.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]);var rt=(r=>(r.PENDING="PENDING",r.LOADING="LOADING",r.SUCCESS="SUCCESS",r.ERROR="ERROR",r))(rt||{});const sl=r=>!!r?.length;function ol(r,e,t,i=sl){const s=n.computed(()=>i(r.value)),o=n.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":s.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:rt,hasData:s,state:o}}const al=({emitState:r,fetchLifecycleState:e,hasData:t})=>{n.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:s})=>{if(s!==rt.PENDING){if(s===rt.LOADING){r({hasData:i,state:"loading"});return}if(s===rt.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},ll=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},cl=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:s})=>{if(typeof i=="number")return i;if(s!==!0&&(s===!1||e<t))return r+e},ul=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,s=new Map,o=n.ref(0),a=n.ref(0),l=n.shallowRef(),u=n.shallowRef(),c=n.shallowRef(),d=n.ref(0),h=n.ref(!1);let f,m,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;const C=K=>K===o.value&&f===r.value&&m===e?.value,S=(K,q)=>C(K)&&q===a.value&&_===t?.value?.sortColumnKey&&O===t?.value?.sortColumnOrder,k=K=>{if(!t)return!0;const q=t.value;return!q?.sortColumnKey||!q.sortColumnOrder?K.length===0:K.length===1&&K[0].colId===q.sortColumnKey&&K[0].sort===q.sortColumnOrder},E=()=>{h.value=d.value>0},b=()=>{a.value+=1,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;for(const K of s.values())K.resolve(!1);i.clear(),s.clear(),u.value=void 0,c.value=void 0,d.value=0,E()},T=()=>{c.value=void 0,d.value+=1,E()},U=()=>{d.value=Math.max(0,d.value-1),E()},z=K=>{const q=s.get(K);if(q)return q;let V;const P={promise:new Promise(F=>{V=F}),resolve:F=>V(F)};return s.set(K,P),P},p=(K,q)=>{q.resolve(!1),s.get(K)===q&&s.delete(K)},g=async({blockIndex:K,currentBlockCompletion:q,datasourceId:V,requestGeneration:P})=>{if(K===0)return"ready";const F=s.get(K-1);if(!F)return p(K,q),"failed";const M=await F.promise;return S(V,P)?M?"ready":(p(K,q),"failed"):(p(K,q),"stale")},y=({blockIndex:K,currentBlockCompletion:q,getRowsParams:V,pageSize:P,result:F})=>{F.cursor!==void 0&&i.set(K,F.cursor),V.successCallback(F.data,cl({startRow:V.startRow,rowsLength:F.data.length,pageSize:P,total:F.total,hasMore:F.hasMore})),V.startRow===0&&(u.value=F.data),q.resolve(!0)},v=({blockIndex:K,currentBlockCompletion:q,fetchError:V,getRowsParams:P})=>{c.value=V,P.failCallback(),p(K,q)},x=()=>{const K=r.value;if(!K)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=K,m=e?.value;const q=o.value+1;return o.value=q,b(),{async getRows(V){if(!C(q)||!k(V.sortModel)){V.failCallback();return}const{blockIndex:P,pageSize:F}=ll({startRow:V.startRow,endRow:V.endRow});P===0&&s.has(0)&&b();const M=a.value,A=z(P);if(await g({blockIndex:P,currentBlockCompletion:A,datasourceId:q,requestGeneration:M})!=="ready"||!S(q,M)){V.failCallback(),p(P,A);return}T();try{const w=P>0?i.get(P-1):void 0,D=await K({mode:"infinite",pageSize:F,cursor:w,sort:t?.value});if(!S(q,M)){V.failCallback(),p(P,A);return}y({blockIndex:P,currentBlockCompletion:A,getRowsParams:V,pageSize:F,result:D})}catch(w){if(!S(q,M)){V.failCallback(),p(P,A);return}v({blockIndex:P,currentBlockCompletion:A,fetchError:w,getRowsParams:V})}finally{S(q,M)&&U()}}}},N=()=>{l.value=x()};return n.watch([r,()=>e?.value],()=>{N()},{immediate:!0}),n.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>b()),{datasource:n.readonly(l),data:n.shallowReadonly(u),error:n.readonly(c),isFetching:n.readonly(h)}},dl={title:"No Data",message:"There is no data to display."},hl={title:"An error occurred",message:"Data cannot be displayed due to an error."},fl={emptyState:dl,errorState:hl};function dr(){const r=at.createI18n("en-us",fl);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:ml}=dr(),hr=(r,e)=>{const t=Reflect.get(e,r.key);return r.valueFormatter?r.valueFormatter(t,e):String(t??"")},pt=r=>typeof r!="number"?null:Number.isFinite(r)?r:null,pl=(r,e)=>r.reduce((t,i)=>{const s=pt(Reflect.get(i,e.key));return s===null?t:{sum:t.sum+s,max:Math.max(t.max,s)}},{sum:0,max:0}),gl=(r,e)=>{const t=(e??[]).filter(s=>Number.isFinite(s.value)&&r>=s.value);if(!t.length)return;const i=Math.max(...t.map(s=>s.value));return t.filter(s=>s.value===i).some(s=>s.type==="error")?"error":"warning"},_l=(r,e,t)=>{if(r===null)return 0;const i=t==="relative"?e.sum:e.max;return i>0?Math.min(Math.max(r/i,0),1):0},yl=r=>{const e=t=>ml.formatNumber(t,{maximumFractionDigits:2});return r>0&&r<.01?`< ${e(.01)} %`:`${e(r)} %`},fr=({value:r,stats:e,header:t})=>{if(r===null||e.sum<=0)return;const i=r/e.sum*100;return t.percentageFormatter?.(i)??yl(i)},mr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Rl=({rows:r,header:e,stats:t})=>r.reduce((i,s)=>({value:mr(i.value,hr(e,s))??"",relative:e.showPercentage?mr(i.relative,fr({value:pt(Reflect.get(s,e.key)),stats:t,header:e})):void 0}),{value:""}),Cl=["data-threshold"],El={class:"table-data-grid-cell-label-track"},Ol={class:"table-data-grid-cell-label"},bl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},wl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},Tl=["data-text"],vl=["data-text"],Sl=["data-threshold"],xl=n.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=n.shallowRef(r.params),i=n.ref(null),s=n.ref(!1),o=n.computed(()=>t.value.headerDef??{key:"",label:""}),a=n.computed(()=>t.value.context?.presentation),l=n.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),u=n.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=n.computed(()=>t.value.value),d=n.computed(()=>pt(c.value)),h=n.computed(()=>a.value?.stats[o.value.key]),f=n.computed(()=>o.value.showPercentage&&h.value?fr({value:d.value,stats:h.value,header:o.value}):void 0),m=n.computed(()=>!!o.value.bar&&!!h.value&&(d.value!==null||c.value===null||c.value===void 0)),_=n.computed(()=>m.value&&h.value?_l(d.value,h.value,o.value.bar)*100:0),O=n.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),C=n.computed(()=>o.value.thresholds?.length&&d.value!==null?gl(d.value,o.value.thresholds):void 0),S=n.computed(()=>({column:o.value,refreshCell:()=>{const y=t.value.node;y&&t.value.api.refreshCells({force:!0,rowNodes:[y]})},row:t.value.data??{},rowIndex:t.value.node?.rowIndex??0,rowValue:t.value.value,selected:t.value.node?.isSelected()??!1})),k=(y,{slots:v})=>{const x=t.value.colDef?.colId,N=t.value.context?.cells?.slots;return!x||x==="cell-icon"||!N?.[x]?v.default?.():n.h("span",{class:"table-data-grid-cell-slot-content"},n.renderSlot(N,x,S.value,()=>v.default?.()??[]))},E=()=>{const y=t.value.context?.cells?.slots;return y?.["cell-icon"]?n.renderSlot(y,"cell-icon",S.value):null};let b,T,U=!1;const z=()=>{const y=i.value;s.value=!!y&&y.scrollWidth>y.clientWidth},p=()=>{U||(T!==void 0&&cancelAnimationFrame(T),T=requestAnimationFrame(()=>{T=void 0,z()}))},g=y=>{if(b?.disconnect(),y){b?.observe(y);const v=y.closest(".ag-cell");v&&b?.observe(v)}p()};return n.onMounted(()=>{b=new ResizeObserver(p),g(i.value)}),n.watch(i,g),n.onUnmounted(()=>{U=!0,b?.disconnect(),T!==void 0&&cancelAnimationFrame(T)}),e({refresh(y){return t.value=y,n.nextTick(p),!0}}),(y,v)=>{const x=n.resolveComponent("KTooltip");return n.openBlock(),n.createElementBlock("span",{class:n.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":m.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${C.value}`]:!m.value&&!!C.value}]),"data-threshold":C.value},[n.createElementVNode("span",El,[n.createElementVNode("span",Ol,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(E))),(n.openBlock(),n.createBlock(n.resolveDynamicComponent(k),null,{default:n.withCtx(()=>[n.createVNode(x,{class:"table-data-grid-cell-tooltip",disabled:!s.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:u.value},{default:n.withCtx(()=>[n.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},n.toDisplayString(u.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(n.openBlock(),n.createElementBlock("span",bl,"("+n.toDisplayString(f.value)+")",1)):n.createCommentVNode("",!0)]),O.value?(n.openBlock(),n.createElementBlock("span",wl,[n.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":O.value.value},null,8,Tl),O.value.relative?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${O.value.relative})`},null,8,vl)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":C.value},[n.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:n.normalizeStyle({width:`${_.value}%`})},null,4)],8,Sl)):n.createCommentVNode("",!0)],10,Cl)}}}),Il=({headers:r,slots:e,initialSort:t,mode:i,rows:s,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,u=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);n.watch([r,()=>s?.value],()=>{r.value.forEach(m=>{if(!u(m))return;let _;if(a==="infinite"&&(m.showPercentage||m.bar)?_="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&s?.value?.some(C=>{const S=Reflect.get(C,m.key);return S!=null&&pt(S)===null})&&(_="contains non-finite or nonnumeric values; numeric presentation skips those values"),!_)return;const O=`${m.key}:${_}`;l.has(O)||(l.add(O),console.warn(`[TableDataGrid] Column "${m.key}" ${_}.`))})},{immediate:!0});const c=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(_=>_.showPercentage||_.bar).map(_=>[_.key,pl(m,_)]))}),d=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(_=>_.bar).map(_=>[_.key,Rl({rows:m,header:_,stats:c.value[_.key]})]))}),h=n.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:d.value}})),f=m=>{const _=t?.sortColumnKey===m.key;return{colId:m.key,flex:!m.width&&!m.maxWidth?1:void 0,headerName:m.label,maxWidth:m.maxWidth,minWidth:m.minWidth,sortable:m.sortable??!1,unSortIcon:m.showSortIcon,..._?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:O=>O.data?.[m.key],valueFormatter:O=>O.data?hr(m,O.data):String(O.value??""),width:m.width,cellRenderer:xl,cellRendererParams:{headerDef:m}}};return{columnDefs:n.computed(()=>r.value.map(f)),gridContext:h}},Ft=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),s=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:s,sortColumnOrder:s?r?.sortColumnOrder:void 0,pageSize:r?.pageSize??t,...r?.fitToContent!==void 0?{fitToContent:r.fitToContent}:{}}},pr=(r,e)=>r.sortColumnKey===e.sortColumnKey&&r.sortColumnOrder===e.sortColumnOrder&&r.pageSize===e.pageSize&&r.fitToContent===e.fitToContent,Dl=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:s,onExternalConfigChange:o})=>{const a=n.computed(()=>t.value?Ft({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=n.ref(a.value??Ft({config:void 0,headers:r.value,pageSize:e.value}));n.watch(a,h=>{h&&!pr(h,l.value)&&(l.value=h,o?.(h))});const u=h=>{const f=Ft({config:{...l.value,...h},headers:r.value,pageSize:e.value});pr(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,s(f))};n.watch(r,()=>{t.value||u({})},{deep:!0});const c=n.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),d=n.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:n.readonly(l),activeSort:c,activePageSize:d,patchTableConfig:u}},kl=({cellClick:r,headers:e,rowClick:t})=>{const i=n.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),s=a=>{const l=a.event?.target;return l instanceof Element?l.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},o=a=>{const l=s(a);return!!(l&&i.value.has(l))};return{onCellClick:a=>{const l=a.colDef.colId;!a.data||!l||r({columnKey:l,row:a.data,value:a.value})},onRowClick:a=>{a.data&&!o(a)&&t(a.data,a)}}},Nl=({activeSort:r,patchTableConfig:e})=>{const t=(i,s)=>{i.applyColumnState({state:s.sortColumnKey?[{colId:s.sortColumnKey,sort:s.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const s=i.api.getColumnState().filter(l=>l.sort).sort((l,u)=>(l.sortIndex??0)-(u.sortIndex??0)),o=s[s.length-1],a=o?{sortColumnKey:o.colId,sortColumnOrder:o.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(a.sortColumnKey!==r.value.sortColumnKey||a.sortColumnOrder!==r.value.sortColumnOrder)&&e(a),s.length>1&&t(i.api,a)},applySortToGrid:t}},Al={key:0,class:"table-error-state","data-testid":"table-error-state"},Ll={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Ul=n.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(r,{emit:e}){Qe.ModuleRegistry.registerModules([Qe.AllCommunityModule,Qe.ClientSideRowModelModule,Qe.InfiniteRowModelModule]);const t=r.mode??"infinite",i=e,{i18n:s}=dr(),{t:o}=s,a=n.useSlots(),l=n.shallowRef(),u=n.useTemplateRef("rootElement"),c=n.shallowRef("body"),d=()=>{const A=document.fullscreenElement;c.value=A instanceof HTMLElement&&A.contains(u.value??null)?A:"body"};n.onMounted(()=>{d(),document.addEventListener("fullscreenchange",d)}),n.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",d)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:_}=Dl({headers:n.toRef(()=>r.headers),pageSize:n.toRef(()=>r.pageSize),tableConfig:n.toRef(()=>r.tableConfig),emitSort:A=>i("sort",A),emitTableConfigUpdate:A=>i("update:tableConfig",A),onExternalConfigChange:A=>{l.value&&C(l.value,A)}}),{onSortChanged:O,applySortToGrid:C}=Nl({activeSort:f,patchTableConfig:_}),S=n.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Qe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:b}=kl({cellClick:A=>i("cell:click",A),headers:n.toRef(()=>r.headers),rowClick:(A,w)=>i("row:click",A,w)}),T={resizable:!1,sortable:!1,suppressMovable:!0},U=n.computed(()=>[m.value,r.refreshKey]),z=t==="infinite"?ul({fetcher:n.toRef(()=>r.fetcher),resetKey:U,sort:f}):void 0,p=z?.datasource,g=n.computed(()=>z?z.data.value:r.rows),y=n.computed(()=>z?.isFetching.value??!1),v=n.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:x,gridContext:N}=Il({headers:n.toRef(()=>r.headers),mode:t,rows:v,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:q,state:V}=ol(g,n.toRef(()=>z?.error.value),y),P=n.computed(()=>V.value===K.SUCCESS&&!q.value);z&&al({emitState:A=>i("state",A),fetchLifecycleState:V,hasData:q});const F=()=>{const A=l.value;if(!A||A.isDestroyed())return;const w=f.value,D=A.getColumnState().find(I=>I.sort);D?.colId===w.sortColumnKey&&(D?.sort??void 0)===w.sortColumnOrder||C(A,w)};n.watch([l,f],F);const M=A=>{l.value=A.api,i("grid:ready",A.api)};return(A,w)=>{const D=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"rootElement",ref:u,class:n.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":S.value}]),"data-testid":"table-data-grid"},[r.error?(n.openBlock(),n.createElementBlock("div",Al,[n.renderSlot(A.$slots,"error-state",{},()=>[n.createVNode(D,{"icon-variant":"error",message:n.unref(o)("errorState.message"),title:n.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):P.value?(n.openBlock(),n.createElementBlock("div",Ll,[n.renderSlot(A.$slots,"empty-state",{},()=>[n.createVNode(D,{message:n.unref(o)("emptyState.message"),title:n.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(n.openBlock(),n.createBlock(n.unref(Pr.AgGridVue),{key:2,"cache-block-size":n.unref(t)==="infinite"?n.unref(m):void 0,class:"table-data-grid-grid","column-defs":n.unref(x),context:n.unref(N),datasource:n.unref(t)==="infinite"?n.unref(p):void 0,"default-col-def":T,"dom-layout":S.value?"autoHeight":"normal","infinite-initial-row-count":n.unref(t)==="infinite"?1:void 0,loading:y.value,"row-data":n.unref(t)==="unpaginated"?v.value:void 0,"row-model-type":n.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:n.unref(k),onCellClicked:n.unref(E),onGridReady:M,onNewColumnsLoaded:F,onRowClicked:n.unref(b),onSortChanged:n.unref(O)},null,8,["cache-block-size","column-defs","context","datasource","dom-layout","infinite-initial-row-count","loading","row-data","row-model-type","theme","onCellClicked","onRowClicked","onSortChanged"]))],2)}}}),Kl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},gr=Kl(Ul,[["__scopeId","data-v-01cd8bcd"]]),_r=3,Ml={anthropic:ie.AnthropicIcon,azure:ie.AzureIcon,bedrock:ie.AmazonBedrockIcon,cerebras:ie.CerebrasIcon,cohere:ie.CohereIcon,databricks:ie.DatabricksIcon,deepseek:ie.DeepseekIcon,gemini:ie.GeminiIcon,huggingface:ie.HuggingFaceIcon,llama2:ie.MetaLlamaIcon,mistral:ie.MistralIcon,moonshot:ie.KimiIcon,nvidia:ie.NvidiaIcon,ollama:ie.OllamaIcon,openai:ie.OpenAiIcon,vertex:ie.GoogleVertexIcon,vllm:ie.VllmIcon,xai:ie.GrokIcon},$t=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},Bl=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!($t(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Ml[t.toLowerCase()]},zl=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},Pl=r=>r.toLocaleLowerCase().endsWith("count"),ql=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,_r),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const s={record:i};return e.forEach(o=>{s[o]=i.event[o]}),t.forEach(o=>{s[o]=zl(i.event[o])}),s})},Hl=({data:r,columnOptions:e,i18n:t})=>{const{formatUnit:i}=ee.unitFormatter({i18n:t}),s=r?.data??[],o=r?.meta,a=o?.display??{},l=Object.keys(a).slice(0,_r),u=o?.metric_names??[],c=u[0],d=l.length>1,h=E=>{const b=`chartLabels.${E}`;return t.messages[b]?t.formatMessage({id:b}):E},f=(E,b)=>$t(e,E)?.label||b,m=(E,b)=>{if(Pl(E)||E==="requests")return"";const T=b===1?"":"s",U=`chartUnits.${E}`;return t.messages[U]?t.formatMessage({id:U},{plural:T}):E},_=E=>{const b=T=>i(T,"%",{translateUnit:m});return E>0&&E<.01?`< ${b(.01)}`:b(E)},O=(E,b)=>{const T=E.event[b];if(T==null)return"–";const U=typeof T=="number"?T:Number(T);if(Number.isNaN(U))return"–";const z=o?.metric_units?.[b]||"count";return z==="%"?_(U):i(U,z,{approximate:["count","count/minute","token count"].includes(z),isBytes1024:!0,translateUnit:m})},C=(E,b)=>{const T=String(E.record.event[b]),U=a[b]?.[T];return{id:T,label:U?.name||"-",deleted:!!U?.deleted}},S=l.map(E=>({key:E,label:f(E,d?h(E):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(b,T)=>C(T,E).label,sortable:!1}));u.forEach(E=>{const b=$t(e,E);S.push({key:E,label:b?.label||h(E),type:"metric",valueFormatter:(T,U)=>O(U.record,E),showPercentage:b?.value==="relative",percentageFormatter:_,bar:b?.bar==="max"?"absolute":b?.bar,thresholds:b?.thresholds,sortable:!1})});const k=s.length?o?l.some(E=>!Object.keys(a[E]||{}).length)?t.t("topNTable.errors.display"):c?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:S,errorMessage:k,getDimension:C}},Gl={class:"fallback-entity-link","data-testid":"entity-link-parent"},yr=n.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Gl,n.toDisplayString(r.entityLinkData.label),1))}}),Fl=["data-testid"],$l={key:1},Wl=Ce(n.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=n.inject(Te),{i18n:t}=ce.useI18n(),i=n.computed(()=>ql(r.data)),s=n.computed(()=>Hl({data:r.data,columnOptions:r.chartOptions.column_options,i18n:t})),o=n.computed(()=>s.value.headers.map(_=>({..._,minWidth:_.type==="dimension"?160:_.bar?260:140}))),a=n.computed(()=>s.value.headers.filter(_=>_.type==="dimension")),l=n.computed(()=>({fitToContent:r.fitToContent})),u=n.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),c=(_,O)=>Bl({columnOptions:r.chartOptions.column_options,columnKey:_,rawValue:O}),d=n.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return yr}return yr}),h=_=>{const O=r.chartOptions.entity_links;return O&&(O[_]||Object.entries(O).find(([C])=>C.toLowerCase()===_.toLowerCase())?.[1])||""},f=_=>h(_)||a.value[0]?.key===_&&r.chartOptions.entity_link||"",m=(_,O)=>{const C=f(O),S=String(_[O]);if(S.includes(":")){const[k,E]=S.split(":");return C.replace(Fi,k).replace(Lt,E)}return C.replace(Lt,S)};return(_,O)=>{const C=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{class:"top-n-data-grid","data-testid":i.value.length?"top-n-table":void 0,style:n.normalizeStyle(u.value)},[n.createVNode(n.unref(gr),{error:!!s.value.errorMessage,headers:o.value,mode:"unpaginated",rows:i.value,"table-config":l.value},n.createSlots({"error-state":n.withCtx(()=>[n.createVNode(C,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:n.withCtx(()=>[n.createVNode(n.unref(ie.WarningOutlineIcon))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(s.value.errorMessage),1)]),_:1})]),"empty-state":n.withCtx(()=>[n.createVNode(C,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:n.unref(t).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":n.withCtx(({column:S,rowValue:k})=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(c(S.key,k)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[n.renderList(a.value,S=>({name:S.key,fn:n.withCtx(({row:k})=>[f(S.key)&&k[S.key]!=="empty"?(n.openBlock(),n.createBlock(n.unref(d),{key:0,class:"top-n-entity-link","entity-link-data":s.value.getDimension(k,S.key),"external-link":m(k,S.key)},null,8,["entity-link-data","external-link"])):s.value.getDimension(k,S.key).label==="empty"?(n.openBlock(),n.createElementBlock("i",$l,"empty")):n.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,Fl)}}}),[["__scopeId","data-v-f6b76589"]]),Vl=n.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:i})=>[n.createVNode(Wl,{"chart-options":r.chartOptions,data:i,"fit-to-content":r.fitToContent,height:r.height},null,8,["chart-options","data","fit-to-content","height"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Yl=n.defineComponent({__name:"TopTalkersRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["query-complete"],setup(r,{emit:e}){const t=r,i=e,s=n.computed(()=>t.chartOptions.columns.map(c=>({dimension:c.dimension,label:c.label}))),o=c=>({...t.query,dimensions:[c.dimension],filters:[...t.query.filters??[],...c.filters??[]]}),a=n.computed(()=>new Map(s.value.map((c,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===s.value.length&&(l.clear(),i("query-complete"))};return n.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(n.openBlock(),n.createBlock(n.unref(xe.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:s.value,"size-metric":r.chartOptions.size_metric},{column:n.withCtx(({column:h})=>[n.createVNode(Ke,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>u(h)},{default:n.withCtx(({data:f})=>[n.createVNode(n.unref(xe.TopTalkersColumn),{"column-options":r.chartOptions.column_options,data:f,dimension:h.dimension,label:h.label,"size-metric":r.chartOptions.size_metric},null,8,["column-options","data","dimension","label","size-metric"])]),_:2},1032,["context","query","query-ready","refresh-counter","onQueryComplete"])]),_:1},8,["column-options","columns","size-metric"]))}}),Xl=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,s])=>{if(s===null)return;const o=r.meta.display?.[i]?.[String(s)]?.name;o&&(t[i]=o)}),t}),Rr=({canTranslate:r,columns:e,translate:t})=>e.map(i=>{const s=`chartLabels.${i}`;return{key:i,label:r(s)?t(s):i}}),jl={platform:Rr,platform_usage:Rr},Cr=async({abortController:r,context:e,cursor:t,pageSize:i,query:s,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const u=s.query,c=a({datasource:s.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:s.datasource,query:{columns:u.columns,cursor:t===void 0?u.cursor:String(t),entity:u.entity,filters:c,page_size:i}},r);return d.meta.columns?.length&&o?.(d.meta.columns),{data:Xl(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},Ql={platform:Cr,platform_usage:Cr},Zl=Ce(n.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,s=n.inject(Te),o=Ne.useDatasourceConfigStore(),{i18n:a}=ce.useI18n(),l=new AbortController,u=n.ref([]),c=n.ref(!1),d=n.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=n.computed(()=>({datasource:t.query.datasource,query:{columns:t.query.columns,cursor:t.query.cursor,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size}})),f=n.computed(()=>JSON.stringify({refreshCounter:t.refreshCounter,query:{columns:t.query.columns,datasource:t.query.datasource,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size},context:{filters:t.context.filters,timeSpec:t.context.timeSpec,tz:t.context.tz}}));n.onUnmounted(()=>{l.abort()});const m=n.computed(()=>jl[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,translate:C=>a.t(C),canTranslate:C=>a.te(C)})),_=n.computed(()=>async({cursor:C,pageSize:S})=>{try{await o.isReady();const k=Ql[h.value.datasource];if(!k)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const E=await k({abortController:l,context:t.context,cursor:C,pageSize:S,query:h.value,onResponseColumns:b=>{u.value=b},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:s?.tabularQueryFn});return c.value=!1,E}catch(k){throw c.value=!0,k}}),O=C=>{C.state==="error"&&(c.value=!0),i("loading-change",C.state==="loading")};return(C,S)=>{const k=n.resolveComponent("KSkeleton");return n.openBlock(),n.createElementBlock("div",{class:"table-data-grid-renderer",style:n.normalizeStyle(d.value)},[r.queryReady?(n.openBlock(),n.createBlock(n.unref(gr),{key:1,error:c.value,fetcher:_.value,headers:m.value,"page-size":r.query.page_size,"refresh-key":f.value,onState:O},null,8,["error","fetcher","headers","page-size","refresh-key"])):(n.openBlock(),n.createBlock(k,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c49ff2eb"]]),Jl=n.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Gt,{"chart-options":r.chartOptions,context:r.context,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),ec="#ffffff",tc="#0044f4",ic="#d60027",rc="#ad000e",nc="#850000",sc="#5c0000",oc="#ff3954",ac="#ffabab",lc="#ffe5e5",cc="#ecfcff",uc="#6f28ff",dc="#f1f0ff",hc="#e0e4ea",fc="#0044f4",mc="#0030cc",pc="#002099",gc="#001466",_c="#5f9aff",yc="#bee2ff",Rc="#eefaff",Cc="#0d0e14",Ec="#6c7489",Oc="#52596e",bc="#3a3f51",wc="#232633",Tc="#afb7c5",vc="#e0e4ea",Sc="#f9fafb",xc="rgba(13, 14, 20, 0.6)",Ic="#0044f4",Dc="#0030cc",kc="#002099",Nc="#001466",Ac="#5f9aff",Lc="#bee2ff",Uc="#eefaff",Kc="#007d60",Mc="#005944",Bc="#004737",zc="#003629",Pc="#00d6a4",qc="#b5ffee",Hc="#ecfffb",Gc="rgba(0, 0, 0, 0)",Fc="#995c00",$c="#804400",Wc="#662d00",Vc="#4d1b00",Yc="#ffc400",Xc="#fff296",jc="#fffce0",Qc="#e0e4ea",Zc="#0044f4",Jc="#d60027",eu="#ad000e",tu="#850000",iu="#5c0000",ru="#ff3954",nu="#ffabab",su="#ffe5e5",ou="#6f28ff",au="#e0e4ea",lu="rgba(255, 255, 255, 0.2)",cu="#6c7489",uu="#52596e",du="#3a3f51",hu="#232633",fu="#afb7c5",mu="#e0e4ea",pu="#f9fafb",gu="#0044f4",_u="#0030cc",yu="#002099",Ru="#001466",Cu="#5f9aff",Eu="#bee2ff",Ou="#eefaff",bu="rgba(0, 0, 0, 0)",wu="#0044f4",Tu="#0d0e14",vu="#0044f4",Su="#d60027",xu="#ad000e",Iu="#850000",Du="#5c0000",ku="#ff3954",Nu="#ffabab",Au="#ffe5e5",Lu="#00abd2",Uu="#d60067",Ku="#6f28ff",Mu="#5e00f5",Bu="#afb7c5",zu="#0044f4",Pu="#0030cc",qu="#002099",Hu="#001466",Gu="#5f9aff",Fu="#bee2ff",$u="#eefaff",Wu="#ffffff",Vu="#6c7489",Yu="#52596e",Xu="#3a3f51",ju="#232633",Qu="#afb7c5",Zu="#e0e4ea",Ju="#f9fafb",ed="#0044f4",td="#0030cc",id="#002099",rd="#001466",nd="#5f9aff",sd="#bee2ff",od="#eefaff",ad="#007d60",ld="#005944",cd="#004737",ud="#003629",dd="#00d6a4",hd="#b5ffee",fd="#ecfffb",md="#995c00",pd="#804400",gd="#662d00",_d="#4d1b00",yd="#ffc400",Rd="#fff296",Cd="#fffce0",Ed="0.2s",Od="0px",bd="2px",wd="4px",Td="6px",vd="8px",Sd="10px",xd="50%",Id="100px",Dd="0px",kd="1px",Nd="2px",Ad="4px",Ld="640px",Ud="768px",Kd="1024px",Md="1280px",Bd="1536px",zd="'JetBrains Mono', Consolas, monospace",Pd="'Inter', Roboto, Helvetica, sans-serif",Wt="'Inter', Roboto, Helvetica, sans-serif",qd="10px",Hd="12px",Gd="14px",Fd="16px",$d="18px",Wd="20px",Vd="24px",Yd="32px",Xd="40px",jd="48px",Qd="700",Zd="500",Jd="400",eh="600",th="#f50045",ih="#828a9e",rh="#306fff",nh="#00a17b",sh="#ffc400",oh="10px",ah="12px",lh="16px",ch="20px",uh="24px",dh="32px",hh="40px",fh="48px",mh="normal",ph="-0.12px",gh="-0.24px",_h="-0.32px",yh="-0.4px",Rh="-0.48px",Ch="normal",Eh="12px",Oh="16px",bh="20px",wh="24px",Th="28px",vh="32px",Sh="36px",xh="40px",Ih="48px",Dh="56px",kh="#f1f0ff",Nh="#ffe5e5",Ah="#eefaff",Lh="#52596e",Uh="#e0e4ea",Kh="#ecfcff",Mh="#ecfffb",Bh="#fffce0",zh="#fff0f7",Ph="#6f28ff",qh="#5e00f5",Hh="#d60027",Gh="#ad000e",Fh="#0044f4",$h="#0030cc",Wh="#e0e4ea",Vh="#afb7c5",Yh="#52596e",Xh="#3a3f51",jh="#00819d",Qh="#00647a",Zh="#007d60",Jh="#005944",ef="#995c00",tf="#804400",rf="#d60067",nf="#ad0053",sf="#000933",of="rgba(255, 255, 255, 0.12)",af="rgba(255, 255, 255, 0.12)",lf="#00fabe",cf="rgba(255, 255, 255, 0.24)",uf="#bee2ff",df="#ffffff",hf="#eefaff",ff="#00fabe",mf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",pf="4px 0 0 0 #00fabe inset",gf="0 0 0 1px rgba(255, 255, 255, 0.60) inset",_f="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",yf="0px 0px 0px 1px #e0e4ea inset",Rf="0px 0px 0px 1px #d60027 inset",Cf="0px 0px 0px 1px #ad000e inset",Ef="0px 0px 0px 1px #e0e4ea inset",Of="0px 0px 0px 1px #0044f4 inset",bf="0px 0px 0px 1px #001466 inset",wf="0px 0px 0px 1px #5f9aff inset",Tf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",vf="0px",Sf="2px",xf="4px",If="6px",Df="8px",kf="12px",Nf="16px",Af="20px",Lf="24px",Uf="32px",Kf="40px",Mf="48px",Bf="56px",zf="64px",Pf="80px",qf="96px",Hf="auto",Gf="#bee2ff",Ff="#8fc1ff",$f="#5f9aff",Wf="#306fff",Vf="#b5ffee",Yf="#00fabe",Xf="#00d6a4",jf="#00a17b",Qf="#007d60",Zf="#005944",Jf="#b5ffee",em="#00fabe",tm="#b5ffee",im="#00a17b",rm="#fff296",nm="#ffe04b",sm="#ffc400",om="#b37600",am="#995c00",lm="#804400",cm="#fff296",um="#ffe04b",dm="#ffc2b3",hm="#ff9877",fm="#ff723c",mm="#f75008",pm="#d13500",gm="#a31f00",_m="#ffc2b3",ym="#ff9877",Rm="#ff723c",Cm="#f75008",Em="#d13500",Om="#a31f00",bm="#ffc2b3",wm="#ff9877",Tm="#ff723c",vm="#f75008",Sm="#d13500",xm="#a31f00",Im="#ffc2b3",Dm="#ff9877",km="#ff723c",Nm="#f75008",Am="#d13500",Lm="#a31f00",Um="#ffc2b3",Km="#ff9877",Mm="#ff723c",Bm="#f75008",zm="#d13500",Pm="#ffabab",qm="#ff7272",Hm="#ff3954",Gm="#f50045",Fm="#d60027",$m="#ad000e",Wm="#ffabab",Vm="#ff7272",Ym="#ff3954",Xm="#f50045",jm="#d60027",Qm="#eefaff",Zm="#ecfffb",Jm="#fffce0",ep="#fff1ef",tp="#ffe5e5",ip="#5f9aff",rp="#00d6a4",np="#ffc400",sp="#ff723c",op="#ff3954",ap="#eefaff",lp="#ecfffb",cp="#fffce0",up="#fff1ef",dp="#ffe5e5",hp="#0044f4",fp="#007d60",mp="#995c00",pp="#d13500",gp="#d60027",Er=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Ed,KUI_BORDER_RADIUS_0:Od,KUI_BORDER_RADIUS_10:bd,KUI_BORDER_RADIUS_20:wd,KUI_BORDER_RADIUS_30:Td,KUI_BORDER_RADIUS_40:vd,KUI_BORDER_RADIUS_50:Sd,KUI_BORDER_RADIUS_CIRCLE:xd,KUI_BORDER_RADIUS_ROUND:Id,KUI_BORDER_WIDTH_0:Dd,KUI_BORDER_WIDTH_10:kd,KUI_BORDER_WIDTH_20:Nd,KUI_BORDER_WIDTH_30:Ad,KUI_BREAKPOINT_DESKTOP:Bd,KUI_BREAKPOINT_LAPTOP:Md,KUI_BREAKPOINT_MOBILE:Ld,KUI_BREAKPOINT_PHABLET:Ud,KUI_BREAKPOINT_TABLET:Kd,KUI_COLOR_BACKGROUND:ec,KUI_COLOR_BACKGROUND_ACCENT:tc,KUI_COLOR_BACKGROUND_DANGER:ic,KUI_COLOR_BACKGROUND_DANGER_STRONG:rc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:nc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:sc,KUI_COLOR_BACKGROUND_DANGER_WEAK:oc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:ac,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:lc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:cc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:uc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:dc,KUI_COLOR_BACKGROUND_DISABLED:hc,KUI_COLOR_BACKGROUND_INFO:fc,KUI_COLOR_BACKGROUND_INFO_STRONG:mc,KUI_COLOR_BACKGROUND_INFO_STRONGER:pc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:gc,KUI_COLOR_BACKGROUND_INFO_WEAK:_c,KUI_COLOR_BACKGROUND_INFO_WEAKER:yc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Rc,KUI_COLOR_BACKGROUND_INVERSE:Cc,KUI_COLOR_BACKGROUND_NEUTRAL:Ec,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Oc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:bc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:wc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Tc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:vc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Sc,KUI_COLOR_BACKGROUND_OVERLAY:xc,KUI_COLOR_BACKGROUND_PRIMARY:Ic,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Dc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:kc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Nc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Ac,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Lc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Uc,KUI_COLOR_BACKGROUND_SUCCESS:Kc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Mc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Bc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:zc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:Pc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:qc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Hc,KUI_COLOR_BACKGROUND_TRANSPARENT:Gc,KUI_COLOR_BACKGROUND_WARNING:Fc,KUI_COLOR_BACKGROUND_WARNING_STRONG:$c,KUI_COLOR_BACKGROUND_WARNING_STRONGER:Wc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:Vc,KUI_COLOR_BACKGROUND_WARNING_WEAK:Yc,KUI_COLOR_BACKGROUND_WARNING_WEAKER:Xc,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:jc,KUI_COLOR_BORDER:Qc,KUI_COLOR_BORDER_ACCENT:Zc,KUI_COLOR_BORDER_DANGER:Jc,KUI_COLOR_BORDER_DANGER_STRONG:eu,KUI_COLOR_BORDER_DANGER_STRONGER:tu,KUI_COLOR_BORDER_DANGER_STRONGEST:iu,KUI_COLOR_BORDER_DANGER_WEAK:ru,KUI_COLOR_BORDER_DANGER_WEAKER:nu,KUI_COLOR_BORDER_DANGER_WEAKEST:su,KUI_COLOR_BORDER_DECORATIVE_PURPLE:ou,KUI_COLOR_BORDER_DISABLED:au,KUI_COLOR_BORDER_INVERSE:lu,KUI_COLOR_BORDER_NEUTRAL:cu,KUI_COLOR_BORDER_NEUTRAL_STRONG:uu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:du,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:hu,KUI_COLOR_BORDER_NEUTRAL_WEAK:fu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:mu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:pu,KUI_COLOR_BORDER_PRIMARY:gu,KUI_COLOR_BORDER_PRIMARY_STRONG:_u,KUI_COLOR_BORDER_PRIMARY_STRONGER:yu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Ru,KUI_COLOR_BORDER_PRIMARY_WEAK:Cu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Eu,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Ou,KUI_COLOR_BORDER_TRANSPARENT:bu,KUI_COLOR_BRAND:wu,KUI_COLOR_TEXT:Tu,KUI_COLOR_TEXT_ACCENT:vu,KUI_COLOR_TEXT_DANGER:Su,KUI_COLOR_TEXT_DANGER_STRONG:xu,KUI_COLOR_TEXT_DANGER_STRONGER:Iu,KUI_COLOR_TEXT_DANGER_STRONGEST:Du,KUI_COLOR_TEXT_DANGER_WEAK:ku,KUI_COLOR_TEXT_DANGER_WEAKER:Nu,KUI_COLOR_TEXT_DANGER_WEAKEST:Au,KUI_COLOR_TEXT_DECORATIVE_AQUA:Lu,KUI_COLOR_TEXT_DECORATIVE_PINK:Uu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Ku,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Mu,KUI_COLOR_TEXT_DISABLED:Bu,KUI_COLOR_TEXT_INFO:zu,KUI_COLOR_TEXT_INFO_STRONG:Pu,KUI_COLOR_TEXT_INFO_STRONGER:qu,KUI_COLOR_TEXT_INFO_STRONGEST:Hu,KUI_COLOR_TEXT_INFO_WEAK:Gu,KUI_COLOR_TEXT_INFO_WEAKER:Fu,KUI_COLOR_TEXT_INFO_WEAKEST:$u,KUI_COLOR_TEXT_INVERSE:Wu,KUI_COLOR_TEXT_NEUTRAL:Vu,KUI_COLOR_TEXT_NEUTRAL_STRONG:Yu,KUI_COLOR_TEXT_NEUTRAL_STRONGER:Xu,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:ju,KUI_COLOR_TEXT_NEUTRAL_WEAK:Qu,KUI_COLOR_TEXT_NEUTRAL_WEAKER:Zu,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:Ju,KUI_COLOR_TEXT_PRIMARY:ed,KUI_COLOR_TEXT_PRIMARY_STRONG:td,KUI_COLOR_TEXT_PRIMARY_STRONGER:id,KUI_COLOR_TEXT_PRIMARY_STRONGEST:rd,KUI_COLOR_TEXT_PRIMARY_WEAK:nd,KUI_COLOR_TEXT_PRIMARY_WEAKER:sd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:od,KUI_COLOR_TEXT_SUCCESS:ad,KUI_COLOR_TEXT_SUCCESS_STRONG:ld,KUI_COLOR_TEXT_SUCCESS_STRONGER:cd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:ud,KUI_COLOR_TEXT_SUCCESS_WEAK:dd,KUI_COLOR_TEXT_SUCCESS_WEAKER:hd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:fd,KUI_COLOR_TEXT_WARNING:md,KUI_COLOR_TEXT_WARNING_STRONG:pd,KUI_COLOR_TEXT_WARNING_STRONGER:gd,KUI_COLOR_TEXT_WARNING_STRONGEST:_d,KUI_COLOR_TEXT_WARNING_WEAK:yd,KUI_COLOR_TEXT_WARNING_WEAKER:Rd,KUI_COLOR_TEXT_WARNING_WEAKEST:Cd,KUI_FONT_FAMILY_CODE:zd,KUI_FONT_FAMILY_HEADING:Pd,KUI_FONT_FAMILY_TEXT:Wt,KUI_FONT_SIZE_10:qd,KUI_FONT_SIZE_100:jd,KUI_FONT_SIZE_20:Hd,KUI_FONT_SIZE_30:Gd,KUI_FONT_SIZE_40:Fd,KUI_FONT_SIZE_50:$d,KUI_FONT_SIZE_60:Wd,KUI_FONT_SIZE_70:Vd,KUI_FONT_SIZE_80:Yd,KUI_FONT_SIZE_90:Xd,KUI_FONT_WEIGHT_BOLD:Qd,KUI_FONT_WEIGHT_MEDIUM:Zd,KUI_FONT_WEIGHT_REGULAR:Jd,KUI_FONT_WEIGHT_SEMIBOLD:eh,KUI_ICON_COLOR_DANGER:th,KUI_ICON_COLOR_NEUTRAL:ih,KUI_ICON_COLOR_PRIMARY:rh,KUI_ICON_COLOR_SUCCESS:nh,KUI_ICON_COLOR_WARNING:sh,KUI_ICON_SIZE_10:oh,KUI_ICON_SIZE_20:ah,KUI_ICON_SIZE_30:lh,KUI_ICON_SIZE_40:ch,KUI_ICON_SIZE_50:uh,KUI_ICON_SIZE_60:dh,KUI_ICON_SIZE_70:hh,KUI_ICON_SIZE_80:fh,KUI_LETTER_SPACING_0:mh,KUI_LETTER_SPACING_MINUS_10:ph,KUI_LETTER_SPACING_MINUS_20:gh,KUI_LETTER_SPACING_MINUS_30:_h,KUI_LETTER_SPACING_MINUS_40:yh,KUI_LETTER_SPACING_MINUS_50:Rh,KUI_LETTER_SPACING_NORMAL:Ch,KUI_LINE_HEIGHT_10:Eh,KUI_LINE_HEIGHT_100:Dh,KUI_LINE_HEIGHT_20:Oh,KUI_LINE_HEIGHT_30:bh,KUI_LINE_HEIGHT_40:wh,KUI_LINE_HEIGHT_50:Th,KUI_LINE_HEIGHT_60:vh,KUI_LINE_HEIGHT_70:Sh,KUI_LINE_HEIGHT_80:xh,KUI_LINE_HEIGHT_90:Ih,KUI_METHOD_COLOR_BACKGROUND_CONNECT:kh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Nh,KUI_METHOD_COLOR_BACKGROUND_GET:Ah,KUI_METHOD_COLOR_BACKGROUND_HEAD:Lh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Uh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Kh,KUI_METHOD_COLOR_BACKGROUND_POST:Mh,KUI_METHOD_COLOR_BACKGROUND_PUT:Bh,KUI_METHOD_COLOR_BACKGROUND_TRACE:zh,KUI_METHOD_COLOR_TEXT_CONNECT:Ph,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:qh,KUI_METHOD_COLOR_TEXT_DELETE:Hh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Gh,KUI_METHOD_COLOR_TEXT_GET:Fh,KUI_METHOD_COLOR_TEXT_GET_STRONG:$h,KUI_METHOD_COLOR_TEXT_HEAD:Wh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:Vh,KUI_METHOD_COLOR_TEXT_OPTIONS:Yh,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:Xh,KUI_METHOD_COLOR_TEXT_PATCH:jh,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:Qh,KUI_METHOD_COLOR_TEXT_POST:Zh,KUI_METHOD_COLOR_TEXT_POST_STRONG:Jh,KUI_METHOD_COLOR_TEXT_PUT:ef,KUI_METHOD_COLOR_TEXT_PUT_STRONG:tf,KUI_METHOD_COLOR_TEXT_TRACE:rf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:nf,KUI_NAVIGATION_COLOR_BACKGROUND:sf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:of,KUI_NAVIGATION_COLOR_BORDER:af,KUI_NAVIGATION_COLOR_BORDER_CHILD:lf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:cf,KUI_NAVIGATION_COLOR_TEXT:uf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:df,KUI_NAVIGATION_COLOR_TEXT_HOVER:hf,KUI_NAVIGATION_COLOR_TEXT_SELECTED:ff,KUI_NAVIGATION_SHADOW_BORDER:mf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:pf,KUI_NAVIGATION_SHADOW_FOCUS:gf,KUI_SHADOW:_f,KUI_SHADOW_BORDER:yf,KUI_SHADOW_BORDER_DANGER:Rf,KUI_SHADOW_BORDER_DANGER_STRONG:Cf,KUI_SHADOW_BORDER_DISABLED:Ef,KUI_SHADOW_BORDER_PRIMARY:Of,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:bf,KUI_SHADOW_BORDER_PRIMARY_WEAK:wf,KUI_SHADOW_FOCUS:Tf,KUI_SPACE_0:vf,KUI_SPACE_10:Sf,KUI_SPACE_100:Kf,KUI_SPACE_110:Mf,KUI_SPACE_120:Bf,KUI_SPACE_130:zf,KUI_SPACE_140:Pf,KUI_SPACE_150:qf,KUI_SPACE_20:xf,KUI_SPACE_30:If,KUI_SPACE_40:Df,KUI_SPACE_50:kf,KUI_SPACE_60:Nf,KUI_SPACE_70:Af,KUI_SPACE_80:Lf,KUI_SPACE_90:Uf,KUI_SPACE_AUTO:Hf,KUI_STATUS_COLOR_100:Gf,KUI_STATUS_COLOR_100S:ip,KUI_STATUS_COLOR_101:Ff,KUI_STATUS_COLOR_102:$f,KUI_STATUS_COLOR_103:Wf,KUI_STATUS_COLOR_1NA:Qm,KUI_STATUS_COLOR_200:Vf,KUI_STATUS_COLOR_200S:rp,KUI_STATUS_COLOR_201:Yf,KUI_STATUS_COLOR_202:Xf,KUI_STATUS_COLOR_203:jf,KUI_STATUS_COLOR_204:Qf,KUI_STATUS_COLOR_205:Zf,KUI_STATUS_COLOR_206:Jf,KUI_STATUS_COLOR_207:em,KUI_STATUS_COLOR_208:tm,KUI_STATUS_COLOR_226:im,KUI_STATUS_COLOR_2NA:Zm,KUI_STATUS_COLOR_300:rm,KUI_STATUS_COLOR_300S:np,KUI_STATUS_COLOR_301:nm,KUI_STATUS_COLOR_302:sm,KUI_STATUS_COLOR_303:om,KUI_STATUS_COLOR_304:am,KUI_STATUS_COLOR_305:lm,KUI_STATUS_COLOR_307:cm,KUI_STATUS_COLOR_308:um,KUI_STATUS_COLOR_3NA:Jm,KUI_STATUS_COLOR_400:dm,KUI_STATUS_COLOR_400S:sp,KUI_STATUS_COLOR_401:hm,KUI_STATUS_COLOR_402:fm,KUI_STATUS_COLOR_403:mm,KUI_STATUS_COLOR_404:pm,KUI_STATUS_COLOR_405:gm,KUI_STATUS_COLOR_406:_m,KUI_STATUS_COLOR_407:ym,KUI_STATUS_COLOR_408:Rm,KUI_STATUS_COLOR_409:Cm,KUI_STATUS_COLOR_410:Em,KUI_STATUS_COLOR_411:Om,KUI_STATUS_COLOR_412:bm,KUI_STATUS_COLOR_413:wm,KUI_STATUS_COLOR_414:Tm,KUI_STATUS_COLOR_415:vm,KUI_STATUS_COLOR_416:Sm,KUI_STATUS_COLOR_417:xm,KUI_STATUS_COLOR_418:Im,KUI_STATUS_COLOR_421:Dm,KUI_STATUS_COLOR_422:km,KUI_STATUS_COLOR_423:Nm,KUI_STATUS_COLOR_424:Am,KUI_STATUS_COLOR_425:Lm,KUI_STATUS_COLOR_426:Um,KUI_STATUS_COLOR_428:Km,KUI_STATUS_COLOR_429:Mm,KUI_STATUS_COLOR_431:Bm,KUI_STATUS_COLOR_451:zm,KUI_STATUS_COLOR_4NA:ep,KUI_STATUS_COLOR_500:Pm,KUI_STATUS_COLOR_500S:op,KUI_STATUS_COLOR_501:qm,KUI_STATUS_COLOR_502:Hm,KUI_STATUS_COLOR_503:Gm,KUI_STATUS_COLOR_504:Fm,KUI_STATUS_COLOR_505:$m,KUI_STATUS_COLOR_506:Wm,KUI_STATUS_COLOR_507:Vm,KUI_STATUS_COLOR_508:Ym,KUI_STATUS_COLOR_510:Xm,KUI_STATUS_COLOR_511:jm,KUI_STATUS_COLOR_5NA:tp,KUI_STATUS_COLOR_BACKGROUND_100:ap,KUI_STATUS_COLOR_BACKGROUND_200:lp,KUI_STATUS_COLOR_BACKGROUND_300:cp,KUI_STATUS_COLOR_BACKGROUND_400:up,KUI_STATUS_COLOR_BACKGROUND_500:dp,KUI_STATUS_COLOR_TEXT_100:hp,KUI_STATUS_COLOR_TEXT_200:fp,KUI_STATUS_COLOR_TEXT_300:mp,KUI_STATUS_COLOR_TEXT_400:pp,KUI_STATUS_COLOR_TEXT_500:gp},Symbol.toStringTag,{value:"Module"})),Or=Object.keys(Er).filter(r=>r.startsWith("KUI_COLOR")),br=r=>Er[r],_p=r=>`--${r.toLowerCase().replaceAll("_","-")}`,wr=()=>{if(typeof window>"u")return Object.fromEntries(Or.map(t=>[t,br(t)]));const r=window.getComputedStyle(document.documentElement),e=(t,i)=>r.getPropertyValue(t).trim()||i;return Object.fromEntries(Or.map(t=>[t,e(_p(t),br(t))]))},Vt=r=>{const e=n.ref(wr());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=wr()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),n.getCurrentScope()&&n.onScopeDispose(()=>t.disconnect())}return e},yp=()=>typeof window>"u"?Wt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Wt,Rp=r=>{const e=yp(),t={color:r.KUI_COLOR_TEXT,fontFamily:e},i={axisLabel:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e},axisLine:{lineStyle:{color:r.KUI_COLOR_BORDER}},splitLine:{lineStyle:{color:r.KUI_COLOR_BORDER}}};return{textStyle:t,categoryAxis:i,valueAxis:i,tooltip:{backgroundColor:r.KUI_COLOR_BACKGROUND,borderWidth:0,borderRadius:4,padding:0,confine:!0,extraCssText:"box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12), 0 5px 10px rgba(0, 0, 0, 0.24);",textStyle:{color:r.KUI_COLOR_TEXT,fontFamily:e}},visualMap:{textStyle:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}},legend:{textStyle:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}}}},Cp=r=>n.computed(()=>Rp(r.value)),Ep={class:"kong-ui-public-echarts-tooltip"},Op={class:"tooltip-title"},bp={class:"title"},wp={key:0,class:"subtitle"},Tp={class:"context"},vp={class:"metric"},Sp={class:"tooltip-rows"},xp={class:"display-value"},Ip=n.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Ep,[n.createElementVNode("div",Op,[n.createElementVNode("div",bp,n.toDisplayString(r.title),1),r.context||r.metric?(n.openBlock(),n.createElementBlock("div",wp,[n.createElementVNode("div",Tp,n.toDisplayString(r.context),1),n.createElementVNode("div",vp,n.toDisplayString(r.metric),1)])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Sp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.rows,(i,s)=>(n.openBlock(),n.createElementBlock("li",{key:`${i.label}-${s}`,class:n.normalizeClass({"extra-row":i.isExtra})},[n.createElementVNode("span",{class:"square-marker",style:n.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),n.createElementVNode("span",{class:n.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},n.toDisplayString(i.label),3),n.createElementVNode("span",xp,n.toDisplayString(i.value),1)],2))),128))])]))}}),Tr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},Dp=Tr(Ip,[["__scopeId","data-v-ca633353"]]),Yt=r=>Array.isArray(r)?r:[r],vr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,Xt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),kp=r=>Array.isArray(r)?r[r.length-1]:r,Np=r=>{const e=Yt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>Xt(i,i.seriesName??"",kp(i.value)))}},Ap=r=>{let e;return n.getCurrentScope()&&n.onScopeDispose(()=>{e&&n.render(null,e)}),t=>{const i=(r()??Np)(t);return i?(e??=document.createElement("div"),n.render(n.h(Dp,i),e),e):""}},Lp={class:"kong-ui-public-echarts"},Up=n.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){n.useCssVars(o=>({v1cecfeed:o.height})),bt.use([Gr.CanvasRenderer,lt.GridComponent,lt.TooltipComponent]);const e=Vt(),t=Cp(e),i=Ap(()=>r.tooltipContent),s=n.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(n.openBlock(),n.createElementBlock("div",Lp,[n.createVNode(n.unref(Hr),n.mergeProps({autoresize:!0,class:"chart",option:s.value,theme:n.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Sr=Tr(Up,[["__scopeId","data-v-68114d20"]]),xr=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),nt=(r,...e)=>{const t={...r};for(const i of e)if(i)for(const[s,o]of Object.entries(i)){if(o===void 0)continue;const a=t[s];t[s]=xr(a)&&xr(o)?nt(a,o):o}return t},Kp=n.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){bt.use([ri.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=Vt(),t=a=>{const[l]=Yt(a),[u,c,d]=l.value;return{title:r.tooltipTitle,context:vr(u,r.xAxisLabels),metric:r.seriesName,rows:[Xt(l,vr(c,r.yAxisLabels),d,r.valueFormatter)]}},i=a=>({type:"slider",yAxisIndex:0,startValue:0,endValue:a-1,zoomLock:!0,right:10,width:8,handleSize:0,moveHandleSize:0,showDetail:!1,brushSelect:!1,showDataShadow:!1,borderColor:"transparent",backgroundColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST,fillerColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK}),s=n.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),u=r.valueFormatter?c=>r.valueFormatter(Number(c)):void 0;return{grid:{top:10,left:10,right:l?30:20,bottom:70,outerBoundsMode:"same",outerBoundsContain:"axisLabel"},xAxis:{type:"category",data:r.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:r.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:r.min??0,max:r.max??a.reduce((c,[,,d])=>Math.max(c,d),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:r.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:u},...l?{dataZoom:[i(r.visibleRows)]}:{},series:[nt({name:r.seriesName,type:"heatmap",data:a,animation:!1,label:{show:r.showValues??!1,formatter:r.valueFormatter?({value:c})=>r.valueFormatter(Number(c[2])):void 0},itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{shadowBlur:5,shadowColor:e.value.KUI_COLOR_BACKGROUND_OVERLAY}}},r.seriesOption)]}}),o=n.computed(()=>nt(s.value,r.option));return(a,l)=>(n.openBlock(),n.createBlock(Sr,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Mp=n.defineComponent({__name:"TreeMapChart",props:{data:{},seriesName:{},showValues:{type:Boolean},valueFormatter:{type:Function},colorPalette:{},drillDown:{type:Boolean,default:!0},leafDepth:{},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){bt.use([ri.TreemapChart]);const e=Vt(),t=l=>{const[u]=Yt(l),c=u.treePathInfo??[];if(c.length===1)return;const d=c.slice(1,-1).map(({name:h})=>h);return{title:r.tooltipTitle,context:d.length?d.join(" / "):void 0,metric:r.seriesName,rows:[Xt(u,u.name,Number(u.value),r.valueFormatter)]}},i=()=>[e.value.KUI_COLOR_BACKGROUND_PRIMARY_WEAK,e.value.KUI_COLOR_BACKGROUND_SUCCESS_WEAK,e.value.KUI_COLOR_BACKGROUND_WARNING_WEAK,e.value.KUI_COLOR_BACKGROUND_DANGER_WEAK,e.value.KUI_COLOR_BACKGROUND_INFO_WEAK,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST],s=(l=[])=>l.reduce((u,c)=>Math.max(u,1+s(c.children)),0),o=n.computed(()=>({series:[nt({name:r.seriesName,type:"treemap",data:r.data??[],nodeClick:r.drillDown?"zoomToNode":!1,leafDepth:r.leafDepth??s(r.data),roam:!1,left:0,top:0,right:0,bottom:r.drillDown?40:0,visibleMin:0,breadcrumb:{show:r.drillDown,itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK,borderColor:"transparent",borderWidth:0,borderRadius:2,textStyle:{color:e.value.KUI_COLOR_TEXT}},emphasis:{itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL,textStyle:{color:e.value.KUI_COLOR_TEXT}}}},levels:[{color:r.colorPalette??i(),itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,gapWidth:2}},{colorAlpha:[.55,1],itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:1,gapWidth:1}}],label:{show:!0,color:e.value.KUI_COLOR_TEXT,align:"center",verticalAlign:"middle",overflow:"truncate",formatter:r.showValues?({name:l,value:u})=>`${l}
|
|
12
|
+
`)}function Zi(r,...e){return typeof r=="function"?r(...e):r}function Ea({method:r="warn",formatter:e=Ca}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const Oa=Error.captureStackTrace;var ba=class zr extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=zr){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,Oa?.(this,t)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,stack:this.stack}}};function wa(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function Ta(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const s of Object.keys(r.codes)){const o=r.codes[s],a=o.docs===!1?void 0:o.docs||wa(i,s),l=(u={},c={})=>{const d=new ba({code:s,why:Zi(o.why,u),fix:Zi(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[s]=l}return t}const va=typeof window<"u",Sa=Ta({reporters:[Ea()],codes:{PINIA_R1001:{why:'Directly pass all stores to "mapStores()" without putting them in an array. This will fail in production.',fix:"Replace mapStores([useAuthStore, useCartStore]) with mapStores(useAuthStore, useCartStore).",docs:"https://pinia.vuejs.org/cookbook/options-api.html#Giving-access-to-the-whole-store"},PINIA_R1002:{why:r=>`A getter cannot have the same name as another state property. Found "${r.name}" in store "${r.id}".`,fix:"Rename either the getter or the state property.",docs:"https://pinia.vuejs.org/core-concepts/getters.html#Accessing-other-getters"},PINIA_R1003:{why:r=>`The "state" must be a plain object. Found in store "${r.id}".`,fix:"Return a plain object, e.g. avoid state: () => new MyClass().",docs:"https://pinia.vuejs.org/core-concepts/state.html#State"},PINIA_R1004:{why:"Pinia instance not found in context. This falls back to the global activePinia, which exposes you to cross-request pollution on the server.",fix:'"useStore()" is a composable and follows the same rules: call it at the top of setup() (or another composable), or pass the pinia instance explicitly when used outside of a component.',docs:"https://pinia.vuejs.org/ssr/#Using-the-store-outside-of-setup-"},PINIA_R1005:{why:r=>`The store id changed from "${r.from}" to "${r.to}", forcing a reload.`,docs:"https://pinia.vuejs.org/cookbook/hot-module-replacement.html#HMR-Hot-Module-Replacement-"},PINIA_R1006:{why:r=>`Property "${r.key}" of store "${r.id}" is not reactive (not a ref, reactive object, or shallowRef), so storeToRefs() ignores it.`,fix:"If it should be reactive state, wrap it with ref(), reactive(), or shallowRef(). If it is an intentional non-reactive property, wrap it with markRaw() so storeToRefs() skips it explicitly.",docs:"https://pinia.vuejs.org/core-concepts/plugins.html#Adding-new-external-properties"},PINIA_R1007:{why:r=>`The same callback was passed to "$subscribe()" of store "${r.id}" more than once. Subscriptions are deduplicated, so the duplicate is ignored.`,fix:"Subscribe each callback only once. If you need to resubscribe, call the returned function to remove the previous subscription first, or create a new function.",docs:"https://pinia.vuejs.org/core-concepts/state.html#Subscribing-to-the-state"}}});let Ji;process.env.NODE_ENV;const er=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Xe(r){const e=n.toRaw(r),t={};for(const i in e){const s=e[i];s?.effect?t[i]=n.computed({get:()=>r[i],set(o){r[i]=o}}):(n.isRef(s)||n.isReactive(s))&&(t[i]=n.toRef(r,i))}return t}const Ie=r=>r?.chart.type==="table",Mt=r=>r?.query?.datasource==="requests",Bt=r=>!!r&&!Ie(r)&&!Mt(r),xa=(r,e)=>{const t=r.header_description??("description"in r.chart?r.chart.description:void 0);if(t)return t.replaceAll($i,e)||void 0},Ia=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],Da=r=>Ia.includes(r);function ka({queryBridge:r,context:e,definition:t,chartData:i}){const s=n.ref(""),o=n.ref(""),a=n.ref(void 0),l=n.ref(void 0),u=Ne.useAnalyticsConfigStore(),c=Ne.useDatasourceConfigStore(),{stripUnknownFilters:d,loading:h}=Xe(c),f=n.computed(()=>Ie(t.value));n.onMounted(async()=>{s.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const m=n.computed(()=>u.analytics&&u.percentiles),_=n.computed(()=>{const y=t.value.chart.type;return["golden_signals","gauge"].includes(y)?!1:y==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),O=n.computed(()=>o.value&&t.value.query&&!f.value&&t.value.query.datasource!=="llm_usage"&&t.value.query.datasource!=="managed_cache_usage"&&!ee.isPlatformDatasource(t.value.query.datasource)&&m.value&&!h.value),C=n.computed(()=>s.value&&t.value.query&&Da(t.value.query.datasource)&&m.value&&!h.value),S=n.computed(()=>i.value?ee.msToGranularity(i.value.meta.granularity_ms):void 0),k=n.computed(()=>{const y=t.value,v=[...e.value.filters,...y.query.filters??[]],x="metrics"in y.query?y.query.metrics:void 0,N=y.query?.datasource??"api_usage";return d.value({datasource:N,filters:v,queryFields:x})}),E=n.computed(()=>{if(!C.value||!_.value)return"";const y=t.value;if(Ie(y))return g({...y.query,filters:k.value});const v=y.query.time_range||e.value.timeSpec,x=p(v,k.value);return g(x)}),b=n.computed(()=>{if(!O.value||!_.value)return"";const y=k.value,v=t.value;if(Ie(v))return"";const x=U(v.query.time_range||e.value.timeSpec,y);return T(x)}),T=y=>O.value?`${o.value}?q=${JSON.stringify(y)}`:"",U=(y,v)=>{const x=i.value?.meta?.start?new Date(i.value.meta.start):void 0,N=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:v,timeframe:{timePeriodsKey:y.type==="relative"?y.time_range:"custom",start:y.type==="absolute"?x:void 0,end:y.type==="absolute"?N:void 0}}},z=(y,v)=>({filter:v,timeframe:{timePeriodsKey:y.type==="relative"?y.time_range:"custom",start:y.type==="absolute"?y.start:void 0,end:y.type==="absolute"?y.end:void 0}}),p=(y,v)=>{const x=t.value;if(!Bt(x))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const N=[...x.query.dimensions??[]],K=[...x.query.metrics??[]];return{filters:v,metrics:K,dimensions:N,time_range:y,granularity:x.query.granularity||S.value||void 0}},g=y=>{if(!C.value)return"";const v=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${s.value}?q=${JSON.stringify(y)}&d=${v}&c=${t.value.chart.type}`};return n.watch([O,C],([y,v])=>{y&&(a.value={href:""}),v&&(l.value={href:""})}),{exploreLinkKebabMenu:E,requestsLinkKebabMenu:b,canShowKebabMenu:_,canGenerateRequestsLink:O,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:z,buildExploreLink:g,buildRequestLink:T}}const zt=r=>r.type==="relative"?ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Na=r=>r.reduce((e,t)=>{const i=ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Pt=(r,e)=>{if(!r||!e?.length)return;const t=zt(r),i=Na(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},qt=(r,e)=>{const t=Pt(r,e);return!t||!r?r:r.type==="relative"?{...r,time_range:t.key}:{...r,start:new Date(new Date(r.end).getTime()-t.durationSeconds*1e3)}};function Aa(){const r=n.inject(Te),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;return n.onUnmounted(()=>{s?.abort()}),{issueQuery:async(a,l,u)=>{if(!r)throw new Error("Query bridge is not defined");s?.abort();const c=new AbortController;s=c,await e.isReady();const{datasource:d,limit:h,...f}=a,m=d||"basic",_=ee.isPlatformDatasource(m),O=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:k})=>!_||!ee.requestFilterTypeEmptyV2.some(E=>E===k));let C=a.time_range;!C&&l.timeSpec?C={...l.timeSpec,tz:l.tz}:C&&!C.tz&&(C={...C,tz:l.tz}),C=qt(C,t.value[m]?.timeRangeOptions);const S={datasource:m,query:{...f,time_range:C,filters:O,limit:u??h}};return r.queryFn(S,c)}}}const La="24H",Ua={status_code:"response_http_status",upstream_status_code:"upstream_status"},Ka={cost:"usd",latencies_response_ms:"ms",latencies_upstream_ms:"ms",latencies_kong_gateway_ms:"ms",latencies_kong_internal_ms:"ms",request_body_size:"bytes",response_body_size:"bytes",response_header_content_length:"bytes",ai_count:"count"},Ma=r=>ee.relativeTimeRangeValuesRequestV2.includes(r),Ba=r=>{const e=r?.tz?{tz:r.tz}:{};if(r?.type==="absolute")return{type:"absolute",start:r.start,end:r.end,...e};const t=r?.time_range.toUpperCase()??"";return{type:"relative",time_range:Ma(t)?t:La,...e}},tr=r=>Ua[r]??r,za=r=>({metric:tr(r.metric),dimension:r.dimension?tr(r.dimension):void 0,unroll:r.unroll,metricUnit:Ka[r.metric],extraFields:r.extra_fields}),Ht="requests";function Pa(){const r=n.inject(Te),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;n.onUnmounted(()=>{s?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return qt(c&&{...c,tz:c.tz??u.tz},t.value[Ht]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");s?.abort();const d=new AbortController;s=d,await e.isReady();const h=i.value({datasource:Ht,filters:[...l.filters??[],...u.filters]});return ee.fetchAllRequests(c,{datasource:Ht,query:{filters:h,time_range:Ba(o(l,u))}},d,{maxRecords:l.max_records})}}}function qa({context:r,globalFilters:e=n.ref([]),isFullscreen:t=n.ref(!1),preview:i=n.ref(!1)}){const s=Ne.useAnalyticsConfigStore(),o=Ne.useDatasourceConfigStore(),{loading:a}=Xe(s),{loading:l}=Xe(o),u=n.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:s.defaultQueryTimeForOrg}),c=n.computed(()=>{const{tz:b}=r.value;return b||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=n.computed(()=>{const{editable:b}=r.value;return b===void 0||i.value?!1:b}),h=n.computed(()=>{const{showTileActions:b}=r.value;return i.value?!1:b===void 0?!0:b}),f=n.computed(()=>[...r.value.filters??[],...e.value]),m=n.computed(()=>{let{refreshInterval:b}=r.value;if(b===void 0&&(b=Wi),t.value){let T=!1;if(u.value.type==="relative")T=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const p=u.value.start.getTime(),g=u.value.end.getTime();T=Math.abs(g-p)<=864e5}const U=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<U||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?b=0:T?b=Vi:b=Yi}return b}),_=n.computed(()=>({filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:m.value,editable:d.value,showTileActions:h.value})),O=n.computed(()=>!a.value&&!l.value),C=n.computed(()=>!i.value&&!!n.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),S=n.computed(()=>!i.value),k=n.computed(()=>!i.value),E=n.computed(()=>({enabled:C.value,showExploreAction:S.value,showRequestsAction:k.value,showZoomInAction:C.value}));return{editable:d,enrichedContext:_,filters:f,queryReady:O,refreshInterval:m,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:E}}const Ha=6,ir=6,rr=4;function Ga(r,e){const{pageWidth:t,pageHeight:i,margin:s}=e,o=s+1,a=s+e.headerHeight-3,l=i-s-ir+3,u=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,s,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-s,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,s,o+rr),r.setDrawColor(220),r.line(s,a,t-s,a),r.line(s,l,t-s,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,s,u);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const d=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(d,s+c,u,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(d,s+c,u)),r.setTextColor(120),r.text(e.pageLabel,t-s,u,{align:"right"})}function Fa(r){const e=r.querySelector(".kong-ui-public-grid-layout, .grid-stack");if(!e)return[];const t=e.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item");if(!t.length)return[];const i=r.getBoundingClientRect().top,s=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),u=Math.round(a.bottom-i),c=s.get(l);s.set(l,c!==void 0?Math.max(c,u):u)}),[...s.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function $a(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const u=Math.min(t,e-l);a.push({startY:l,height:u}),l+=u}return a}const s=[];let o=0;for(const a of r){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(s.push({startY:o,height:l-o}),o=l):(s.push({startY:o,height:u-o}),o=u))}return o<e&&s.push({startY:o,height:e-o}),s}function Wa(r){const{i18n:e}=At(),t=n.ref({status:"idle"});async function i(s={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:u,orientation:c="landscape",pageSize:d="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:_="download",onBeforeCapture:O,onAfterCapture:C}=s,S=r.value;if(!S){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await O?.();const[{snapdom:k},{jsPDF:E}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const b={name:"kong-webgl-snapshot",beforeClone:()=>ee.prepareForCapture(),afterClone:()=>ee.restoreAfterCapture()},T=await k.toCanvas(S,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[b]}),U=Fa(S),z=S.getBoundingClientRect().width,p=z?T.width/z:f;t.value={status:"generating"};const g=new Date,y=new E({orientation:c,unit:"mm",format:d}),v=y.internal.pageSize.getWidth(),x=y.internal.pageSize.getHeight(),N=Ha+(l?rr:0),K=v-h*2,q=x-h*2-N-ir,V=T.width/K,P=q*V,F=$a(U,T.height,P,p),M={title:a,subtitle:l,dashboardUrl:u,generatedAt:e.t("pdfExport.generated",{timestamp:g.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:v,pageHeight:x,headerHeight:N,margin:h};for(let A=0;A<F.length;A++){A>0&&y.addPage();const{startY:w,height:D}=F[A],I=document.createElement("canvas");I.width=T.width,I.height=D,I.getContext("2d").drawImage(T,0,w,T.width,D,0,0,T.width,D),y.addImage(I.toDataURL("image/png"),"PNG",h,h+N,K,D/V),Ga(y,{...M,pageLabel:e.t("pdfExport.pageOf",{page:String(A+1),total:String(F.length)})})}if(_==="blob"){const A=y.output("blob");return t.value={status:"complete",pageCount:F.length},A}y.save(o),t.value={status:"complete",pageCount:F.length}}catch(k){t.value={status:"error",error:k}}finally{ee.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:n.readonly(t)}}const Va=r=>r.toLowerCase().endsWith("count")?"":r;function Ya(){const{i18n:r}=At(),{formatUnit:e}=ee.unitFormatter({i18n:r});return t=>{const i=t.meta?.metric_names?.[0]??"",s=t.meta?.metric_units?.[i]??"",o=`chartLabels.${i}`;return{seriesName:r.te(o)?r.t(o):i,valueFormatter:a=>e(a,s,{translateUnit:Va})}}}const ce={useContextLinks:ka,useDashboardContext:qa,useEvaluateFeatureFlag:da,useExportPdf:Wa,useI18n:At,useIssueQuery:Aa,useIssueRequestsQuery:Pa,useMetricFormatter:Ya,useRequestQueue:Ra},Xa={class:"kong-ui-public-csv-export-modal"},ja={key:0,class:"selected-range"},Qa={key:4,class:"text-muted",tag:"span"},nr=3,sr=n.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=ce.useI18n(),i=r,s=e,o=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=n.ref(1),l=n.computed(()=>f.value.rows.length),u=n.computed(()=>i.exportState.status==="success"&&!!i.exportState.chartData?.data?.length),c=n.computed(()=>{if(i.exportState.status!=="success"||!i.exportState.chartData?.meta)return"";const{start:_,end:O}=i.exportState.chartData.meta;return!_||!O?"":new Date(_).getTime()===new Date(O).getTime()?t.t("csvExport.exportAsOf",{time:ee.formatTimestamp(new Date(_),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ee.formatTimestamp(new Date(_))} - ${ee.formatTimestamp(new Date(O),{includeTZ:!0})}`}),d=n.computed(()=>i.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(nr,l.value),rowsTotal:l.value,plural:l.value===1?"":"s"})),h=()=>{s("closeModal")},f=n.computed(()=>{if(i.exportState.status!=="success"||!u.value||!i.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const _=i.exportState.chartData,O=_.data.some(T=>T.timestamp!==_.data[0].timestamp),C=_.data.map(T=>{const U=new Date(T.timestamp);return{...Object.keys(T.event).reduce((p,g)=>{if(g in _.meta.display){const y=T.event[g],v=_.meta.display[g];p[g]=y&&v?.[y]?.name||T.event[g]}else p[g]=T.event[g];return p},{}),...O?{timestamp:Ui(U,"yyyy-MM-dd HH:mm:ss"),tzOffset:Ui(U,"XXX")}:{}}});let S=[];O&&(S=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const k="display"in i.exportState.chartData.meta&&i.exportState.chartData.meta.display?i.exportState.chartData.meta.display:{},E=[...S,...Object.keys(k).map(T=>({label:t.t(`chartLabels.${T}`),key:T})),...i.exportState.chartData.meta.metric_names.map(T=>({label:t.t(`chartLabels.${T}`),key:T}))],b=E.reduce((T,U)=>(T[U.key]=U.label,T),{});return{headers:E,csvHeaders:b,rows:C}}),m=async()=>{if(i.exportState.status!=="success")return{total:0,data:[]};const{rows:_}=f.value;return{total:Number(_.length)||0,data:_.slice(0,nr)}};return n.watch(f,()=>{a.value++}),(_,O)=>{const C=n.resolveComponent("KSkeleton"),S=n.resolveComponent("KEmptyState"),k=n.resolveComponent("KTableData"),E=n.resolveComponent("KTooltip"),b=n.resolveComponent("KButton"),T=n.resolveComponent("KModal");return n.openBlock(),n.createElementBlock("div",Xa,[n.createVNode(T,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:n.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:n.withKeys(h,["esc"])},{default:n.withCtx(()=>[n.createElementVNode("div",null,[r.exportState.status==="success"&&u.value?(n.openBlock(),n.createElementBlock("div",ja,[n.createElementVNode("p",null,n.toDisplayString(r.modalDescription?r.modalDescription:n.unref(t).t("csvExport.exportDescription")),1),n.createElementVNode("p",null,n.toDisplayString(c.value),1)])):n.createCommentVNode("",!0),r.exportState.status==="loading"?(n.openBlock(),n.createBlock(C,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(n.openBlock(),n.createBlock(k,{key:2,class:"vitals-table",fetcher:m,"fetcher-cache-key":String(a.value),headers:f.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":n.withCtx(()=>[n.createVNode(S,{"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRange")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):r.exportState.status==="error"?(n.openBlock(),n.createBlock(S,{key:3,"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.dataError")),1)]),_:1})):n.createCommentVNode("",!0),r.exportState.status==="success"&&u.value?(n.openBlock(),n.createElementBlock("div",Qa,[n.createTextVNode(n.toDisplayString(d.value)+" ",1),n.createVNode(E,{class:"preview-tooltip",placement:"right",text:n.unref(t).t("csvExport.maximumRecordAmount",{value:n.unref(ee.EXPORT_RECORD_LIMIT)})},{default:n.withCtx(()=>[n.createVNode(n.unref(ie.InfoIcon),{color:`var(--kui-color-text-neutral, ${n.unref(Nt)})`,size:`var(--kui-icon-size-30, ${n.unref(ea)})`},null,8,["color","size"])]),_:1},8,["text"])])):n.createCommentVNode("",!0)])]),"footer-actions":n.withCtx(()=>[n.createVNode(b,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.cancelButton")),1)]),_:1}),n.createVNode(ua,{class:"vitals-report-export-button",filename:o,headers:f.value.csvHeaders,rows:f.value.rows},{default:n.withCtx(()=>[n.createVNode(b,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!u.value},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}});var or=(r=>(r.VALIDATING="VALIDATING",r.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",r.PENDING="PENDING",r.SUCCESS="SUCCESS",r.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",r.ERROR="ERROR",r.STALE_IF_ERROR="STALE_IF_ERROR",r))(or||{});const Za=r=>r?!!(Object.keys(r)?.length||r.data?.length||r.data?.data?.length||!r.data?.data&&typeof r.data=="object"&&Object.keys(r?.data).length):!1;function ar(r=n.ref({}),e,t,i=Za){const s=n.ref("PENDING");return n.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){s.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){s.value="VALIDATING";return}if(r.value&&e.value){s.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){s.value="PENDING";return}if(r.value&&!e.value&&o){s.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){s.value="SUCCESS";return}r.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:or}}const Ke=n.defineComponent({__name:"QueryDataProvider",props:{context:{},limitOverride:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=ce.useI18n(),{issueQuery:o}=ce.useIssueQuery(),a=n.inject(Te),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=ti(l,async()=>{const k=l();try{const E=await o(t.query,t.context,t.limitOverride);return l()!==k?void 0:(m.value=null,E)}catch(E){if(l()!==k)return;throw m.value=xe.handleQueryError(E),E}finally{l()===k&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=ar(u,c,d),m=n.ref(null),_=n.computed(()=>h.value===f.ERROR||!!m.value),O=n.computed(()=>!t.queryReady||h.value===f.PENDING),C=n.ref(),S=n.computed(()=>u.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return n.watch([()=>u.value,()=>h.value],([k,E])=>{k&&(E==="SUCCESS_HAS_DATA"||E==="SUCCESS")&&k!==C.value&&(C.value=k,i("chart-data",k))}),(k,E)=>{const b=n.resolveComponent("KSkeleton"),T=n.resolveComponent("KEmptyState");return(O.value||!n.unref(u)&&!_.value)&&!S.value?(n.openBlock(),n.createBlock(b,{key:0,class:"chart-skeleton",type:"table"})):_.value&&!O.value?(n.openBlock(),n.createBlock(T,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[m.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(ie.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(ie.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(m.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[m.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(m.value.details),1)]),key:"0"}:void 0]),1024)):S.value?n.renderSlot(k.$slots,"default",{data:S.value},void 0,void 0,2):n.createCommentVNode("",!0)}}}),Ja=n.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>e.chartOptions.type==="single_value"),i=n.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend"}:e.chartOptions);return(s,o)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:a})=>[n.createElementVNode("div",{class:n.normalizeClass(["analytics-chart",{"single-value":t.value}]),style:n.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[n.createVNode(n.unref(xe.SimpleChart),{"chart-data":a,"chart-options":i.value,"synthetics-data-key":t.value?void 0:r.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],6)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Ce=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},lr=Ce(Ja,[["__scopeId","data-v-22077b88"]]),el={class:"analytics-chart"},Gt=Ce(n.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=ce.useI18n(),o=n.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold,metricAxisMap:t.chartOptions.metric_axis_map,yAxes:t.chartOptions.y_axes&&{left:a(t.chartOptions.y_axes.left),right:a(t.chartOptions.y_axes.right)},hideTruncationWarning:t.query.limit!==void 0&&t.query.limit>0})),a=c=>c&&{title:c.title,showGrid:c.show_grid},l=()=>{i("edit-tile")},u=c=>{i("chart-data",c)};return(c,d)=>{const h=n.resolveComponent("KDropdownItem");return n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:u},{default:n.withCtx(({data:f})=>[n.createElementVNode("div",el,[n.createVNode(n.unref(xe.AnalyticsChart),n.mergeProps({"active-metric":r.activeMetric,"chart-data":f,"chart-options":o.value,"explore-link":r.exploreLink,"legend-position":"bottom","requests-link":r.requestsLink,"synthetics-data-key":r.chartOptions.synthetics_data_key,"timeseries-zoom":r.zoomConfiguration?.showZoomInAction,"tooltip-title":""},r.extraProps,{onSelectChartRange:d[0]||(d[0]=m=>i("select-chart-range",m)),onZoomTimeRange:d[1]||(d[1]=m=>i("zoom-time-range",m))}),n.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:n.withCtx(()=>[n.createVNode(h,{onClick:l},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["active-metric","chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-5e3d0a14"]]),cr=n.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Gt,{"chart-options":r.chartOptions,context:r.context,"extra-props":{showAnnotations:!1},height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),tl={class:"analytics-chart"},il={key:3,class:"analytics-chart"},rl=Ce(n.defineComponent({__name:"ScatterChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=ce.useI18n(),{issueRequestsQuery:o}=ce.useIssueRequestsQuery(),a=n.computed(()=>t.query.datasource==="requests"),l=n.computed(()=>{const b=t.query,T=b.time_range??t.context.timeSpec,U=T?zt(T):void 0;if(!U)return b;const z=ee.finestGranularityForDuration(U);let p;return b.granularity&&ee.Granularities[b.granularity]>=ee.Granularities[z]?p=b.granularity:p=z,{...b,granularity:p}}),u=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=n.ref(null),{data:d,error:h,isValidating:f}=ti(u,async()=>{const b=u(),T=t.query;try{const U=await o(T,t.context);return u()!==b?void 0:(c.value=null,xe.requestsToScatterData(U,za(T)))}catch(U){if(u()!==b)return;throw c.value=xe.handleQueryError(U),U}finally{u()===b&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:_}=ar(d,h,f),O=n.ref(),C=n.computed(()=>d.value??O.value);n.watch(d,b=>{b&&(O.value=b)});const S=n.computed(()=>m.value===_.ERROR||!!c.value),k=n.computed(()=>!S.value&&(!t.queryReady||m.value===_.PENDING)&&!C.value),E=n.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(b=>({percentile:b.percentile,label:b.label,borderDash:b.border_dash,color:b.color})),outlierPercentile:t.chartOptions.outlier_percentile,shadeOutlierRegion:t.chartOptions.shade_outlier_region,jitterMs:t.chartOptions.jitter_ms,pointRadius:t.chartOptions.point_radius,pointOpacity:t.chartOptions.point_opacity}}));return(b,T)=>{const U=n.resolveComponent("KSkeleton"),z=n.resolveComponent("KEmptyState");return a.value?k.value?(n.openBlock(),n.createBlock(U,{key:1,class:"chart-skeleton",type:"table"})):S.value?(n.openBlock(),n.createBlock(z,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[c.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(ie.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(ie.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):C.value?(n.openBlock(),n.createElementBlock("div",il,[n.createVNode(n.unref(xe.AnalyticsChart),{"chart-data":C.value,"chart-options":E.value,"legend-position":"bottom","synthetics-data-key":r.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])):n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ke,{key:0,context:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:T[0]||(T[0]=p=>i("chart-data",p)),onQueryComplete:T[1]||(T[1]=p=>i("query-complete"))},{default:n.withCtx(({data:p})=>[n.createElementVNode("div",tl,[n.createVNode(n.unref(xe.AnalyticsChart),{"chart-data":p,"chart-options":E.value,"legend-position":"bottom","synthetics-data-key":r.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}}),[["__scopeId","data-v-e823be94"]]),ur=n.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["zoom-time-range","select-chart-range"],setup(r,{emit:e}){const t=e;return(i,s)=>(n.openBlock(),n.createBlock(Gt,{"active-metric":r.activeMetric,"chart-options":r.chartOptions,context:r.context,"explore-link":r.exploreLink,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,"requests-link":r.requestsLink,"zoom-configuration":r.zoomConfiguration,onSelectChartRange:s[0]||(s[0]=o=>t("select-chart-range",o)),onZoomTimeRange:s[1]||(s[1]=o=>t("zoom-time-range",o))},null,8,["active-metric","chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link","zoom-configuration"]))}}),nl=Ce(n.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>{const s=e.query?.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:e.query?.datasource,overrideTimeRange:e.context.timeSpec,additionalFilter:e.context.filters,longCardTitles:e.chartOptions.long_card_titles,percentileLatency:e.chartOptions.percentile_latency,refreshInterval:e.context.refreshInterval,queryReady:e.queryReady,refreshCounter:e.refreshCounter}}),i=n.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(s,o)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[n.createVNode(n.unref(ii.MetricsProvider),n.normalizeProps(n.guardReactiveProps(t.value)),{default:n.withCtx(()=>[n.createVNode(n.unref(ii.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]);var rt=(r=>(r.PENDING="PENDING",r.LOADING="LOADING",r.SUCCESS="SUCCESS",r.ERROR="ERROR",r))(rt||{});const sl=r=>!!r?.length;function ol(r,e,t,i=sl){const s=n.computed(()=>i(r.value)),o=n.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":s.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:rt,hasData:s,state:o}}const al=({emitState:r,fetchLifecycleState:e,hasData:t})=>{n.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:s})=>{if(s!==rt.PENDING){if(s===rt.LOADING){r({hasData:i,state:"loading"});return}if(s===rt.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},ll=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},cl=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:s})=>{if(typeof i=="number")return i;if(s!==!0&&(s===!1||e<t))return r+e},ul=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,s=new Map,o=n.ref(0),a=n.ref(0),l=n.shallowRef(),u=n.shallowRef(),c=n.shallowRef(),d=n.ref(0),h=n.ref(!1);let f,m,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;const C=K=>K===o.value&&f===r.value&&m===e?.value,S=(K,q)=>C(K)&&q===a.value&&_===t?.value?.sortColumnKey&&O===t?.value?.sortColumnOrder,k=K=>{if(!t)return!0;const q=t.value;return!q?.sortColumnKey||!q.sortColumnOrder?K.length===0:K.length===1&&K[0].colId===q.sortColumnKey&&K[0].sort===q.sortColumnOrder},E=()=>{h.value=d.value>0},b=()=>{a.value+=1,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;for(const K of s.values())K.resolve(!1);i.clear(),s.clear(),u.value=void 0,c.value=void 0,d.value=0,E()},T=()=>{c.value=void 0,d.value+=1,E()},U=()=>{d.value=Math.max(0,d.value-1),E()},z=K=>{const q=s.get(K);if(q)return q;let V;const P={promise:new Promise(F=>{V=F}),resolve:F=>V(F)};return s.set(K,P),P},p=(K,q)=>{q.resolve(!1),s.get(K)===q&&s.delete(K)},g=async({blockIndex:K,currentBlockCompletion:q,datasourceId:V,requestGeneration:P})=>{if(K===0)return"ready";const F=s.get(K-1);if(!F)return p(K,q),"failed";const M=await F.promise;return S(V,P)?M?"ready":(p(K,q),"failed"):(p(K,q),"stale")},y=({blockIndex:K,currentBlockCompletion:q,getRowsParams:V,pageSize:P,result:F})=>{F.cursor!==void 0&&i.set(K,F.cursor),V.successCallback(F.data,cl({startRow:V.startRow,rowsLength:F.data.length,pageSize:P,total:F.total,hasMore:F.hasMore})),V.startRow===0&&(u.value=F.data),q.resolve(!0)},v=({blockIndex:K,currentBlockCompletion:q,fetchError:V,getRowsParams:P})=>{c.value=V,P.failCallback(),p(K,q)},x=()=>{const K=r.value;if(!K)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=K,m=e?.value;const q=o.value+1;return o.value=q,b(),{async getRows(V){if(!C(q)||!k(V.sortModel)){V.failCallback();return}const{blockIndex:P,pageSize:F}=ll({startRow:V.startRow,endRow:V.endRow});P===0&&s.has(0)&&b();const M=a.value,A=z(P);if(await g({blockIndex:P,currentBlockCompletion:A,datasourceId:q,requestGeneration:M})!=="ready"||!S(q,M)){V.failCallback(),p(P,A);return}T();try{const w=P>0?i.get(P-1):void 0,D=await K({mode:"infinite",pageSize:F,cursor:w,sort:t?.value});if(!S(q,M)){V.failCallback(),p(P,A);return}y({blockIndex:P,currentBlockCompletion:A,getRowsParams:V,pageSize:F,result:D})}catch(w){if(!S(q,M)){V.failCallback(),p(P,A);return}v({blockIndex:P,currentBlockCompletion:A,fetchError:w,getRowsParams:V})}finally{S(q,M)&&U()}}}},N=()=>{l.value=x()};return n.watch([r,()=>e?.value],()=>{N()},{immediate:!0}),n.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>b()),{datasource:n.readonly(l),data:n.shallowReadonly(u),error:n.readonly(c),isFetching:n.readonly(h)}},dl={title:"No Data",message:"There is no data to display."},hl={title:"An error occurred",message:"Data cannot be displayed due to an error."},fl={emptyState:dl,errorState:hl};function dr(){const r=at.createI18n("en-us",fl);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:ml}=dr(),hr=(r,e)=>{const t=Reflect.get(e,r.key);return r.valueFormatter?r.valueFormatter(t,e):String(t??"")},pt=r=>typeof r!="number"?null:Number.isFinite(r)?r:null,pl=(r,e)=>r.reduce((t,i)=>{const s=pt(Reflect.get(i,e.key));return s===null?t:{sum:t.sum+s,max:Math.max(t.max,s)}},{sum:0,max:0}),gl=(r,e)=>{const t=(e??[]).filter(s=>Number.isFinite(s.value)&&r>=s.value);if(!t.length)return;const i=Math.max(...t.map(s=>s.value));return t.filter(s=>s.value===i).some(s=>s.type==="error")?"error":"warning"},_l=(r,e,t)=>{if(r===null)return 0;const i=t==="relative"?e.sum:e.max;return i>0?Math.min(Math.max(r/i,0),1):0},yl=r=>{const e=t=>ml.formatNumber(t,{maximumFractionDigits:2});return r>0&&r<.01?`< ${e(.01)} %`:`${e(r)} %`},fr=({value:r,stats:e,header:t})=>{if(r===null||e.sum<=0)return;const i=r/e.sum*100;return t.percentageFormatter?.(i)??yl(i)},mr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Rl=({rows:r,header:e,stats:t})=>r.reduce((i,s)=>({value:mr(i.value,hr(e,s))??"",relative:e.showPercentage?mr(i.relative,fr({value:pt(Reflect.get(s,e.key)),stats:t,header:e})):void 0}),{value:""}),Cl=["data-threshold"],El={class:"table-data-grid-cell-label-track"},Ol={class:"table-data-grid-cell-label"},bl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},wl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},Tl=["data-text"],vl=["data-text"],Sl=["data-threshold"],xl=n.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=n.shallowRef(r.params),i=n.ref(null),s=n.ref(!1),o=n.computed(()=>t.value.headerDef??{key:"",label:""}),a=n.computed(()=>t.value.context?.presentation),l=n.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),u=n.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=n.computed(()=>t.value.value),d=n.computed(()=>pt(c.value)),h=n.computed(()=>a.value?.stats[o.value.key]),f=n.computed(()=>o.value.showPercentage&&h.value?fr({value:d.value,stats:h.value,header:o.value}):void 0),m=n.computed(()=>!!o.value.bar&&!!h.value&&(d.value!==null||c.value===null||c.value===void 0)),_=n.computed(()=>m.value&&h.value?_l(d.value,h.value,o.value.bar)*100:0),O=n.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),C=n.computed(()=>o.value.thresholds?.length&&d.value!==null?gl(d.value,o.value.thresholds):void 0),S=n.computed(()=>({column:o.value,refreshCell:()=>{const y=t.value.node;y&&t.value.api.refreshCells({force:!0,rowNodes:[y]})},row:t.value.data??{},rowIndex:t.value.node?.rowIndex??0,rowValue:t.value.value,selected:t.value.node?.isSelected()??!1})),k=(y,{slots:v})=>{const x=t.value.colDef?.colId,N=t.value.context?.cells?.slots;return!x||x==="cell-icon"||!N?.[x]?v.default?.():n.h("span",{class:"table-data-grid-cell-slot-content"},n.renderSlot(N,x,S.value,()=>v.default?.()??[]))},E=()=>{const y=t.value.context?.cells?.slots;return y?.["cell-icon"]?n.renderSlot(y,"cell-icon",S.value):null};let b,T,U=!1;const z=()=>{const y=i.value;s.value=!!y&&y.scrollWidth>y.clientWidth},p=()=>{U||(T!==void 0&&cancelAnimationFrame(T),T=requestAnimationFrame(()=>{T=void 0,z()}))},g=y=>{if(b?.disconnect(),y){b?.observe(y);const v=y.closest(".ag-cell");v&&b?.observe(v)}p()};return n.onMounted(()=>{b=new ResizeObserver(p),g(i.value)}),n.watch(i,g),n.onUnmounted(()=>{U=!0,b?.disconnect(),T!==void 0&&cancelAnimationFrame(T)}),e({refresh(y){return t.value=y,n.nextTick(p),!0}}),(y,v)=>{const x=n.resolveComponent("KTooltip");return n.openBlock(),n.createElementBlock("span",{class:n.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":m.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${C.value}`]:!m.value&&!!C.value}]),"data-threshold":C.value},[n.createElementVNode("span",El,[n.createElementVNode("span",Ol,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(E))),(n.openBlock(),n.createBlock(n.resolveDynamicComponent(k),null,{default:n.withCtx(()=>[n.createVNode(x,{class:"table-data-grid-cell-tooltip",disabled:!s.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:u.value},{default:n.withCtx(()=>[n.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},n.toDisplayString(u.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(n.openBlock(),n.createElementBlock("span",bl,"("+n.toDisplayString(f.value)+")",1)):n.createCommentVNode("",!0)]),O.value?(n.openBlock(),n.createElementBlock("span",wl,[n.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":O.value.value},null,8,Tl),O.value.relative?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${O.value.relative})`},null,8,vl)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":C.value},[n.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:n.normalizeStyle({width:`${_.value}%`})},null,4)],8,Sl)):n.createCommentVNode("",!0)],10,Cl)}}}),Il=({headers:r,slots:e,initialSort:t,mode:i,rows:s,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,u=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);n.watch([r,()=>s?.value],()=>{r.value.forEach(m=>{if(!u(m))return;let _;if(a==="infinite"&&(m.showPercentage||m.bar)?_="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&s?.value?.some(C=>{const S=Reflect.get(C,m.key);return S!=null&&pt(S)===null})&&(_="contains non-finite or nonnumeric values; numeric presentation skips those values"),!_)return;const O=`${m.key}:${_}`;l.has(O)||(l.add(O),console.warn(`[TableDataGrid] Column "${m.key}" ${_}.`))})},{immediate:!0});const c=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(_=>_.showPercentage||_.bar).map(_=>[_.key,pl(m,_)]))}),d=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(_=>_.bar).map(_=>[_.key,Rl({rows:m,header:_,stats:c.value[_.key]})]))}),h=n.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:d.value}})),f=m=>{const _=t?.sortColumnKey===m.key;return{colId:m.key,flex:!m.width&&!m.maxWidth?1:void 0,headerName:m.label,maxWidth:m.maxWidth,minWidth:m.minWidth,sortable:m.sortable??!1,unSortIcon:m.showSortIcon,..._?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:O=>O.data?.[m.key],valueFormatter:O=>O.data?hr(m,O.data):String(O.value??""),width:m.width,cellRenderer:xl,cellRendererParams:{headerDef:m}}};return{columnDefs:n.computed(()=>r.value.map(f)),gridContext:h}},Ft=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),s=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:s,sortColumnOrder:s?r?.sortColumnOrder:void 0,pageSize:r?.pageSize??t,...r?.fitToContent!==void 0?{fitToContent:r.fitToContent}:{}}},pr=(r,e)=>r.sortColumnKey===e.sortColumnKey&&r.sortColumnOrder===e.sortColumnOrder&&r.pageSize===e.pageSize&&r.fitToContent===e.fitToContent,Dl=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:s,onExternalConfigChange:o})=>{const a=n.computed(()=>t.value?Ft({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=n.ref(a.value??Ft({config:void 0,headers:r.value,pageSize:e.value}));n.watch(a,h=>{h&&!pr(h,l.value)&&(l.value=h,o?.(h))});const u=h=>{const f=Ft({config:{...l.value,...h},headers:r.value,pageSize:e.value});pr(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,s(f))};n.watch(r,()=>{t.value||u({})},{deep:!0});const c=n.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),d=n.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:n.readonly(l),activeSort:c,activePageSize:d,patchTableConfig:u}},kl=({cellClick:r,headers:e,rowClick:t})=>{const i=n.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),s=a=>{const l=a.event?.target;return l instanceof Element?l.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},o=a=>{const l=s(a);return!!(l&&i.value.has(l))};return{onCellClick:a=>{const l=a.colDef.colId;!a.data||!l||r({columnKey:l,row:a.data,value:a.value})},onRowClick:a=>{a.data&&!o(a)&&t(a.data,a)}}},Nl=({activeSort:r,patchTableConfig:e})=>{const t=(i,s)=>{i.applyColumnState({state:s.sortColumnKey?[{colId:s.sortColumnKey,sort:s.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const s=i.api.getColumnState().filter(l=>l.sort).sort((l,u)=>(l.sortIndex??0)-(u.sortIndex??0)),o=s[s.length-1],a=o?{sortColumnKey:o.colId,sortColumnOrder:o.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(a.sortColumnKey!==r.value.sortColumnKey||a.sortColumnOrder!==r.value.sortColumnOrder)&&e(a),s.length>1&&t(i.api,a)},applySortToGrid:t}},Al={key:0,class:"table-error-state","data-testid":"table-error-state"},Ll={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Ul=n.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(r,{emit:e}){Qe.ModuleRegistry.registerModules([Qe.AllCommunityModule,Qe.ClientSideRowModelModule,Qe.InfiniteRowModelModule]);const t=r.mode??"infinite",i=e,{i18n:s}=dr(),{t:o}=s,a=n.useSlots(),l=n.shallowRef(),u=n.useTemplateRef("rootElement"),c=n.shallowRef("body"),d=()=>{const A=document.fullscreenElement;c.value=A instanceof HTMLElement&&A.contains(u.value??null)?A:"body"};n.onMounted(()=>{d(),document.addEventListener("fullscreenchange",d)}),n.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",d)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:_}=Dl({headers:n.toRef(()=>r.headers),pageSize:n.toRef(()=>r.pageSize),tableConfig:n.toRef(()=>r.tableConfig),emitSort:A=>i("sort",A),emitTableConfigUpdate:A=>i("update:tableConfig",A),onExternalConfigChange:A=>{l.value&&C(l.value,A)}}),{onSortChanged:O,applySortToGrid:C}=Nl({activeSort:f,patchTableConfig:_}),S=n.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Qe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:b}=kl({cellClick:A=>i("cell:click",A),headers:n.toRef(()=>r.headers),rowClick:(A,w)=>i("row:click",A,w)}),T={resizable:!1,sortable:!1,suppressMovable:!0},U=n.computed(()=>[m.value,r.refreshKey]),z=t==="infinite"?ul({fetcher:n.toRef(()=>r.fetcher),resetKey:U,sort:f}):void 0,p=z?.datasource,g=n.computed(()=>z?z.data.value:r.rows),y=n.computed(()=>z?.isFetching.value??!1),v=n.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:x,gridContext:N}=Il({headers:n.toRef(()=>r.headers),mode:t,rows:v,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:q,state:V}=ol(g,n.toRef(()=>z?.error.value),y),P=n.computed(()=>V.value===K.SUCCESS&&!q.value);z&&al({emitState:A=>i("state",A),fetchLifecycleState:V,hasData:q});const F=()=>{const A=l.value;if(!A||A.isDestroyed())return;const w=f.value,D=A.getColumnState().find(I=>I.sort);D?.colId===w.sortColumnKey&&(D?.sort??void 0)===w.sortColumnOrder||C(A,w)};n.watch([l,f],F);const M=A=>{l.value=A.api,i("grid:ready",A.api)};return(A,w)=>{const D=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"rootElement",ref:u,class:n.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":S.value}]),"data-testid":"table-data-grid"},[r.error?(n.openBlock(),n.createElementBlock("div",Al,[n.renderSlot(A.$slots,"error-state",{},()=>[n.createVNode(D,{"icon-variant":"error",message:n.unref(o)("errorState.message"),title:n.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):P.value?(n.openBlock(),n.createElementBlock("div",Ll,[n.renderSlot(A.$slots,"empty-state",{},()=>[n.createVNode(D,{message:n.unref(o)("emptyState.message"),title:n.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(n.openBlock(),n.createBlock(n.unref(Pr.AgGridVue),{key:2,"cache-block-size":n.unref(t)==="infinite"?n.unref(m):void 0,class:"table-data-grid-grid","column-defs":n.unref(x),context:n.unref(N),datasource:n.unref(t)==="infinite"?n.unref(p):void 0,"default-col-def":T,"dom-layout":S.value?"autoHeight":"normal","infinite-initial-row-count":n.unref(t)==="infinite"?1:void 0,loading:y.value,"row-data":n.unref(t)==="unpaginated"?v.value:void 0,"row-model-type":n.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:n.unref(k),onCellClicked:n.unref(E),onGridReady:M,onNewColumnsLoaded:F,onRowClicked:n.unref(b),onSortChanged:n.unref(O)},null,8,["cache-block-size","column-defs","context","datasource","dom-layout","infinite-initial-row-count","loading","row-data","row-model-type","theme","onCellClicked","onRowClicked","onSortChanged"]))],2)}}}),Kl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},gr=Kl(Ul,[["__scopeId","data-v-01cd8bcd"]]),_r=3,Ml={anthropic:ie.AnthropicIcon,azure:ie.AzureIcon,bedrock:ie.AmazonBedrockIcon,cerebras:ie.CerebrasIcon,cohere:ie.CohereIcon,databricks:ie.DatabricksIcon,deepseek:ie.DeepseekIcon,gemini:ie.GeminiIcon,huggingface:ie.HuggingFaceIcon,llama2:ie.MetaLlamaIcon,mistral:ie.MistralIcon,moonshot:ie.KimiIcon,nvidia:ie.NvidiaIcon,ollama:ie.OllamaIcon,openai:ie.OpenAiIcon,vertex:ie.GoogleVertexIcon,vllm:ie.VllmIcon,xai:ie.GrokIcon},$t=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},Bl=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!($t(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Ml[t.toLowerCase()]},zl=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},Pl=r=>r.toLocaleLowerCase().endsWith("count"),ql=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,_r),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const s={record:i};return e.forEach(o=>{s[o]=i.event[o]}),t.forEach(o=>{s[o]=zl(i.event[o])}),s})},Hl=({data:r,columnOptions:e,i18n:t})=>{const{formatUnit:i}=ee.unitFormatter({i18n:t}),s=r?.data??[],o=r?.meta,a=o?.display??{},l=Object.keys(a).slice(0,_r),u=o?.metric_names??[],c=u[0],d=l.length>1,h=E=>{const b=`chartLabels.${E}`;return t.messages[b]?t.formatMessage({id:b}):E},f=(E,b)=>$t(e,E)?.label||b,m=(E,b)=>{if(Pl(E)||E==="requests")return"";const T=b===1?"":"s",U=`chartUnits.${E}`;return t.messages[U]?t.formatMessage({id:U},{plural:T}):E},_=E=>{const b=T=>i(T,"%",{translateUnit:m});return E>0&&E<.01?`< ${b(.01)}`:b(E)},O=(E,b)=>{const T=E.event[b];if(T==null)return"–";const U=typeof T=="number"?T:Number(T);if(Number.isNaN(U))return"–";const z=o?.metric_units?.[b]||"count";return z==="%"?_(U):i(U,z,{approximate:["count","count/minute","token count"].includes(z),isBytes1024:!0,translateUnit:m})},C=(E,b)=>{const T=String(E.record.event[b]),U=a[b]?.[T];return{id:T,label:U?.name||"-",deleted:!!U?.deleted}},S=l.map(E=>({key:E,label:f(E,d?h(E):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(b,T)=>C(T,E).label,sortable:!1}));u.forEach(E=>{const b=$t(e,E);S.push({key:E,label:b?.label||h(E),type:"metric",valueFormatter:(T,U)=>O(U.record,E),showPercentage:b?.value==="relative",percentageFormatter:_,bar:b?.bar==="max"?"absolute":b?.bar,thresholds:b?.thresholds,sortable:!1})});const k=s.length?o?l.some(E=>!Object.keys(a[E]||{}).length)?t.t("topNTable.errors.display"):c?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:S,errorMessage:k,getDimension:C}},Gl={class:"fallback-entity-link","data-testid":"entity-link-parent"},yr=n.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Gl,n.toDisplayString(r.entityLinkData.label),1))}}),Fl=["data-testid"],$l={key:1},Wl=Ce(n.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=n.inject(Te),{i18n:t}=ce.useI18n(),i=n.computed(()=>ql(r.data)),s=n.computed(()=>Hl({data:r.data,columnOptions:r.chartOptions.column_options,i18n:t})),o=n.computed(()=>s.value.headers.map(_=>({..._,minWidth:_.type==="dimension"?160:_.bar?260:140}))),a=n.computed(()=>s.value.headers.filter(_=>_.type==="dimension")),l=n.computed(()=>({fitToContent:r.fitToContent})),u=n.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),c=(_,O)=>Bl({columnOptions:r.chartOptions.column_options,columnKey:_,rawValue:O}),d=n.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return yr}return yr}),h=_=>{const O=r.chartOptions.entity_links;return O&&(O[_]||Object.entries(O).find(([C])=>C.toLowerCase()===_.toLowerCase())?.[1])||""},f=_=>h(_)||a.value[0]?.key===_&&r.chartOptions.entity_link||"",m=(_,O)=>{const C=f(O),S=String(_[O]);if(S.includes(":")){const[k,E]=S.split(":");return C.replace(Fi,k).replace(Lt,E)}return C.replace(Lt,S)};return(_,O)=>{const C=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{class:"top-n-data-grid","data-testid":i.value.length?"top-n-table":void 0,style:n.normalizeStyle(u.value)},[n.createVNode(n.unref(gr),{error:!!s.value.errorMessage,headers:o.value,mode:"unpaginated",rows:i.value,"table-config":l.value},n.createSlots({"error-state":n.withCtx(()=>[n.createVNode(C,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:n.withCtx(()=>[n.createVNode(n.unref(ie.WarningOutlineIcon))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(s.value.errorMessage),1)]),_:1})]),"empty-state":n.withCtx(()=>[n.createVNode(C,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:n.unref(t).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":n.withCtx(({column:S,rowValue:k})=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(c(S.key,k)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[n.renderList(a.value,S=>({name:S.key,fn:n.withCtx(({row:k})=>[f(S.key)&&k[S.key]!=="empty"?(n.openBlock(),n.createBlock(n.unref(d),{key:0,class:"top-n-entity-link","entity-link-data":s.value.getDimension(k,S.key),"external-link":m(k,S.key)},null,8,["entity-link-data","external-link"])):s.value.getDimension(k,S.key).label==="empty"?(n.openBlock(),n.createElementBlock("i",$l,"empty")):n.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,Fl)}}}),[["__scopeId","data-v-f6b76589"]]),Vl=n.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:i})=>[n.createVNode(Wl,{"chart-options":r.chartOptions,data:i,"fit-to-content":r.fitToContent,height:r.height},null,8,["chart-options","data","fit-to-content","height"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Yl=n.defineComponent({__name:"TopTalkersRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["query-complete"],setup(r,{emit:e}){const t=r,i=e,s=n.computed(()=>t.chartOptions.columns.map(c=>({dimension:c.dimension,label:c.label}))),o=c=>({...t.query,dimensions:[c.dimension],filters:[...t.query.filters??[],...c.filters??[]]}),a=n.computed(()=>new Map(s.value.map((c,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===s.value.length&&(l.clear(),i("query-complete"))};return n.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(n.openBlock(),n.createBlock(n.unref(xe.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:s.value,"size-metric":r.chartOptions.size_metric},{column:n.withCtx(({column:h})=>[n.createVNode(Ke,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>u(h)},{default:n.withCtx(({data:f})=>[n.createVNode(n.unref(xe.TopTalkersColumn),{"column-options":r.chartOptions.column_options,data:f,dimension:h.dimension,label:h.label,"size-metric":r.chartOptions.size_metric},null,8,["column-options","data","dimension","label","size-metric"])]),_:2},1032,["context","query","query-ready","refresh-counter","onQueryComplete"])]),_:1},8,["column-options","columns","size-metric"]))}}),Xl=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,s])=>{if(s===null)return;const o=r.meta.display?.[i]?.[String(s)]?.name;o&&(t[i]=o)}),t}),Rr=({canTranslate:r,columns:e,translate:t})=>e.map(i=>{const s=`chartLabels.${i}`;return{key:i,label:r(s)?t(s):i}}),jl={platform:Rr,platform_usage:Rr},Cr=async({abortController:r,context:e,cursor:t,pageSize:i,query:s,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const u=s.query,c=a({datasource:s.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:s.datasource,query:{columns:u.columns,cursor:t===void 0?u.cursor:String(t),entity:u.entity,filters:c,page_size:i}},r);return d.meta.columns?.length&&o?.(d.meta.columns),{data:Xl(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},Ql={platform:Cr,platform_usage:Cr},Zl=Ce(n.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,s=n.inject(Te),o=Ne.useDatasourceConfigStore(),{i18n:a}=ce.useI18n(),l=new AbortController,u=n.ref([]),c=n.ref(!1),d=n.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=n.computed(()=>({datasource:t.query.datasource,query:{columns:t.query.columns,cursor:t.query.cursor,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size}})),f=n.computed(()=>JSON.stringify({refreshCounter:t.refreshCounter,query:{columns:t.query.columns,datasource:t.query.datasource,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size},context:{filters:t.context.filters,timeSpec:t.context.timeSpec,tz:t.context.tz}}));n.onUnmounted(()=>{l.abort()});const m=n.computed(()=>jl[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,translate:C=>a.t(C),canTranslate:C=>a.te(C)})),_=n.computed(()=>async({cursor:C,pageSize:S})=>{try{await o.isReady();const k=Ql[h.value.datasource];if(!k)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const E=await k({abortController:l,context:t.context,cursor:C,pageSize:S,query:h.value,onResponseColumns:b=>{u.value=b},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:s?.tabularQueryFn});return c.value=!1,E}catch(k){throw c.value=!0,k}}),O=C=>{C.state==="error"&&(c.value=!0),i("loading-change",C.state==="loading")};return(C,S)=>{const k=n.resolveComponent("KSkeleton");return n.openBlock(),n.createElementBlock("div",{class:"table-data-grid-renderer",style:n.normalizeStyle(d.value)},[r.queryReady?(n.openBlock(),n.createBlock(n.unref(gr),{key:1,error:c.value,fetcher:_.value,headers:m.value,"page-size":r.query.page_size,"refresh-key":f.value,onState:O},null,8,["error","fetcher","headers","page-size","refresh-key"])):(n.openBlock(),n.createBlock(k,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c49ff2eb"]]),Jl=n.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Gt,{"chart-options":r.chartOptions,context:r.context,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),ec="#ffffff",tc="#0044f4",ic="#d60027",rc="#ad000e",nc="#850000",sc="#5c0000",oc="#ff3954",ac="#ffabab",lc="#ffe5e5",cc="#ecfcff",uc="#6f28ff",dc="#f1f0ff",hc="#e0e4ea",fc="#0044f4",mc="#0030cc",pc="#002099",gc="#001466",_c="#5f9aff",yc="#bee2ff",Rc="#eefaff",Cc="#0d0e14",Ec="#6c7489",Oc="#52596e",bc="#3a3f51",wc="#232633",Tc="#afb7c5",vc="#e0e4ea",Sc="#f9fafb",xc="rgba(13, 14, 20, 0.6)",Ic="#0044f4",Dc="#0030cc",kc="#002099",Nc="#001466",Ac="#5f9aff",Lc="#bee2ff",Uc="#eefaff",Kc="#007d60",Mc="#005944",Bc="#004737",zc="#003629",Pc="#00d6a4",qc="#b5ffee",Hc="#ecfffb",Gc="rgba(0, 0, 0, 0)",Fc="#995c00",$c="#804400",Wc="#662d00",Vc="#4d1b00",Yc="#ffc400",Xc="#fff296",jc="#fffce0",Qc="#e0e4ea",Zc="#0044f4",Jc="#d60027",eu="#ad000e",tu="#850000",iu="#5c0000",ru="#ff3954",nu="#ffabab",su="#ffe5e5",ou="#6f28ff",au="#e0e4ea",lu="rgba(255, 255, 255, 0.2)",cu="#6c7489",uu="#52596e",du="#3a3f51",hu="#232633",fu="#afb7c5",mu="#e0e4ea",pu="#f9fafb",gu="#0044f4",_u="#0030cc",yu="#002099",Ru="#001466",Cu="#5f9aff",Eu="#bee2ff",Ou="#eefaff",bu="rgba(0, 0, 0, 0)",wu="#0044f4",Tu="#0d0e14",vu="#0044f4",Su="#d60027",xu="#ad000e",Iu="#850000",Du="#5c0000",ku="#ff3954",Nu="#ffabab",Au="#ffe5e5",Lu="#00abd2",Uu="#d60067",Ku="#6f28ff",Mu="#5e00f5",Bu="#afb7c5",zu="#0044f4",Pu="#0030cc",qu="#002099",Hu="#001466",Gu="#5f9aff",Fu="#bee2ff",$u="#eefaff",Wu="#ffffff",Vu="#6c7489",Yu="#52596e",Xu="#3a3f51",ju="#232633",Qu="#afb7c5",Zu="#e0e4ea",Ju="#f9fafb",ed="#0044f4",td="#0030cc",id="#002099",rd="#001466",nd="#5f9aff",sd="#bee2ff",od="#eefaff",ad="#007d60",ld="#005944",cd="#004737",ud="#003629",dd="#00d6a4",hd="#b5ffee",fd="#ecfffb",md="#995c00",pd="#804400",gd="#662d00",_d="#4d1b00",yd="#ffc400",Rd="#fff296",Cd="#fffce0",Ed="0.2s",Od="0px",bd="2px",wd="4px",Td="6px",vd="8px",Sd="10px",xd="50%",Id="100px",Dd="0px",kd="1px",Nd="2px",Ad="4px",Ld="640px",Ud="768px",Kd="1024px",Md="1280px",Bd="1536px",zd="'JetBrains Mono', Consolas, monospace",Pd="'Inter', Roboto, Helvetica, sans-serif",Wt="'Inter', Roboto, Helvetica, sans-serif",qd="10px",Hd="12px",Gd="14px",Fd="16px",$d="18px",Wd="20px",Vd="24px",Yd="32px",Xd="40px",jd="48px",Qd="700",Zd="500",Jd="400",eh="600",th="#f50045",ih="#828a9e",rh="#306fff",nh="#00a17b",sh="#ffc400",oh="10px",ah="12px",lh="16px",ch="20px",uh="24px",dh="32px",hh="40px",fh="48px",mh="normal",ph="-0.12px",gh="-0.24px",_h="-0.32px",yh="-0.4px",Rh="-0.48px",Ch="normal",Eh="12px",Oh="16px",bh="20px",wh="24px",Th="28px",vh="32px",Sh="36px",xh="40px",Ih="48px",Dh="56px",kh="#f1f0ff",Nh="#ffe5e5",Ah="#eefaff",Lh="#52596e",Uh="#e0e4ea",Kh="#ecfcff",Mh="#ecfffb",Bh="#fffce0",zh="#fff0f7",Ph="#6f28ff",qh="#5e00f5",Hh="#d60027",Gh="#ad000e",Fh="#0044f4",$h="#0030cc",Wh="#e0e4ea",Vh="#afb7c5",Yh="#52596e",Xh="#3a3f51",jh="#00819d",Qh="#00647a",Zh="#007d60",Jh="#005944",ef="#995c00",tf="#804400",rf="#d60067",nf="#ad0053",sf="#000933",of="rgba(255, 255, 255, 0.12)",af="rgba(255, 255, 255, 0.12)",lf="#00fabe",cf="rgba(255, 255, 255, 0.24)",uf="#bee2ff",df="#ffffff",hf="#eefaff",ff="#00fabe",mf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",pf="4px 0 0 0 #00fabe inset",gf="0 0 0 1px rgba(255, 255, 255, 0.60) inset",_f="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",yf="0px 0px 0px 1px #e0e4ea inset",Rf="0px 0px 0px 1px #d60027 inset",Cf="0px 0px 0px 1px #ad000e inset",Ef="0px 0px 0px 1px #e0e4ea inset",Of="0px 0px 0px 1px #0044f4 inset",bf="0px 0px 0px 1px #001466 inset",wf="0px 0px 0px 1px #5f9aff inset",Tf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",vf="0px",Sf="2px",xf="4px",If="6px",Df="8px",kf="12px",Nf="16px",Af="20px",Lf="24px",Uf="32px",Kf="40px",Mf="48px",Bf="56px",zf="64px",Pf="80px",qf="96px",Hf="auto",Gf="#bee2ff",Ff="#8fc1ff",$f="#5f9aff",Wf="#306fff",Vf="#b5ffee",Yf="#00fabe",Xf="#00d6a4",jf="#00a17b",Qf="#007d60",Zf="#005944",Jf="#b5ffee",em="#00fabe",tm="#b5ffee",im="#00a17b",rm="#fff296",nm="#ffe04b",sm="#ffc400",om="#b37600",am="#995c00",lm="#804400",cm="#fff296",um="#ffe04b",dm="#ffc2b3",hm="#ff9877",fm="#ff723c",mm="#f75008",pm="#d13500",gm="#a31f00",_m="#ffc2b3",ym="#ff9877",Rm="#ff723c",Cm="#f75008",Em="#d13500",Om="#a31f00",bm="#ffc2b3",wm="#ff9877",Tm="#ff723c",vm="#f75008",Sm="#d13500",xm="#a31f00",Im="#ffc2b3",Dm="#ff9877",km="#ff723c",Nm="#f75008",Am="#d13500",Lm="#a31f00",Um="#ffc2b3",Km="#ff9877",Mm="#ff723c",Bm="#f75008",zm="#d13500",Pm="#ffabab",qm="#ff7272",Hm="#ff3954",Gm="#f50045",Fm="#d60027",$m="#ad000e",Wm="#ffabab",Vm="#ff7272",Ym="#ff3954",Xm="#f50045",jm="#d60027",Qm="#eefaff",Zm="#ecfffb",Jm="#fffce0",ep="#fff1ef",tp="#ffe5e5",ip="#5f9aff",rp="#00d6a4",np="#ffc400",sp="#ff723c",op="#ff3954",ap="#eefaff",lp="#ecfffb",cp="#fffce0",up="#fff1ef",dp="#ffe5e5",hp="#0044f4",fp="#007d60",mp="#995c00",pp="#d13500",gp="#d60027",Er=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Ed,KUI_BORDER_RADIUS_0:Od,KUI_BORDER_RADIUS_10:bd,KUI_BORDER_RADIUS_20:wd,KUI_BORDER_RADIUS_30:Td,KUI_BORDER_RADIUS_40:vd,KUI_BORDER_RADIUS_50:Sd,KUI_BORDER_RADIUS_CIRCLE:xd,KUI_BORDER_RADIUS_ROUND:Id,KUI_BORDER_WIDTH_0:Dd,KUI_BORDER_WIDTH_10:kd,KUI_BORDER_WIDTH_20:Nd,KUI_BORDER_WIDTH_30:Ad,KUI_BREAKPOINT_DESKTOP:Bd,KUI_BREAKPOINT_LAPTOP:Md,KUI_BREAKPOINT_MOBILE:Ld,KUI_BREAKPOINT_PHABLET:Ud,KUI_BREAKPOINT_TABLET:Kd,KUI_COLOR_BACKGROUND:ec,KUI_COLOR_BACKGROUND_ACCENT:tc,KUI_COLOR_BACKGROUND_DANGER:ic,KUI_COLOR_BACKGROUND_DANGER_STRONG:rc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:nc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:sc,KUI_COLOR_BACKGROUND_DANGER_WEAK:oc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:ac,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:lc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:cc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:uc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:dc,KUI_COLOR_BACKGROUND_DISABLED:hc,KUI_COLOR_BACKGROUND_INFO:fc,KUI_COLOR_BACKGROUND_INFO_STRONG:mc,KUI_COLOR_BACKGROUND_INFO_STRONGER:pc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:gc,KUI_COLOR_BACKGROUND_INFO_WEAK:_c,KUI_COLOR_BACKGROUND_INFO_WEAKER:yc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Rc,KUI_COLOR_BACKGROUND_INVERSE:Cc,KUI_COLOR_BACKGROUND_NEUTRAL:Ec,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Oc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:bc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:wc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Tc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:vc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Sc,KUI_COLOR_BACKGROUND_OVERLAY:xc,KUI_COLOR_BACKGROUND_PRIMARY:Ic,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Dc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:kc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Nc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Ac,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Lc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Uc,KUI_COLOR_BACKGROUND_SUCCESS:Kc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Mc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Bc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:zc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:Pc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:qc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Hc,KUI_COLOR_BACKGROUND_TRANSPARENT:Gc,KUI_COLOR_BACKGROUND_WARNING:Fc,KUI_COLOR_BACKGROUND_WARNING_STRONG:$c,KUI_COLOR_BACKGROUND_WARNING_STRONGER:Wc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:Vc,KUI_COLOR_BACKGROUND_WARNING_WEAK:Yc,KUI_COLOR_BACKGROUND_WARNING_WEAKER:Xc,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:jc,KUI_COLOR_BORDER:Qc,KUI_COLOR_BORDER_ACCENT:Zc,KUI_COLOR_BORDER_DANGER:Jc,KUI_COLOR_BORDER_DANGER_STRONG:eu,KUI_COLOR_BORDER_DANGER_STRONGER:tu,KUI_COLOR_BORDER_DANGER_STRONGEST:iu,KUI_COLOR_BORDER_DANGER_WEAK:ru,KUI_COLOR_BORDER_DANGER_WEAKER:nu,KUI_COLOR_BORDER_DANGER_WEAKEST:su,KUI_COLOR_BORDER_DECORATIVE_PURPLE:ou,KUI_COLOR_BORDER_DISABLED:au,KUI_COLOR_BORDER_INVERSE:lu,KUI_COLOR_BORDER_NEUTRAL:cu,KUI_COLOR_BORDER_NEUTRAL_STRONG:uu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:du,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:hu,KUI_COLOR_BORDER_NEUTRAL_WEAK:fu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:mu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:pu,KUI_COLOR_BORDER_PRIMARY:gu,KUI_COLOR_BORDER_PRIMARY_STRONG:_u,KUI_COLOR_BORDER_PRIMARY_STRONGER:yu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Ru,KUI_COLOR_BORDER_PRIMARY_WEAK:Cu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Eu,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Ou,KUI_COLOR_BORDER_TRANSPARENT:bu,KUI_COLOR_BRAND:wu,KUI_COLOR_TEXT:Tu,KUI_COLOR_TEXT_ACCENT:vu,KUI_COLOR_TEXT_DANGER:Su,KUI_COLOR_TEXT_DANGER_STRONG:xu,KUI_COLOR_TEXT_DANGER_STRONGER:Iu,KUI_COLOR_TEXT_DANGER_STRONGEST:Du,KUI_COLOR_TEXT_DANGER_WEAK:ku,KUI_COLOR_TEXT_DANGER_WEAKER:Nu,KUI_COLOR_TEXT_DANGER_WEAKEST:Au,KUI_COLOR_TEXT_DECORATIVE_AQUA:Lu,KUI_COLOR_TEXT_DECORATIVE_PINK:Uu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Ku,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Mu,KUI_COLOR_TEXT_DISABLED:Bu,KUI_COLOR_TEXT_INFO:zu,KUI_COLOR_TEXT_INFO_STRONG:Pu,KUI_COLOR_TEXT_INFO_STRONGER:qu,KUI_COLOR_TEXT_INFO_STRONGEST:Hu,KUI_COLOR_TEXT_INFO_WEAK:Gu,KUI_COLOR_TEXT_INFO_WEAKER:Fu,KUI_COLOR_TEXT_INFO_WEAKEST:$u,KUI_COLOR_TEXT_INVERSE:Wu,KUI_COLOR_TEXT_NEUTRAL:Vu,KUI_COLOR_TEXT_NEUTRAL_STRONG:Yu,KUI_COLOR_TEXT_NEUTRAL_STRONGER:Xu,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:ju,KUI_COLOR_TEXT_NEUTRAL_WEAK:Qu,KUI_COLOR_TEXT_NEUTRAL_WEAKER:Zu,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:Ju,KUI_COLOR_TEXT_PRIMARY:ed,KUI_COLOR_TEXT_PRIMARY_STRONG:td,KUI_COLOR_TEXT_PRIMARY_STRONGER:id,KUI_COLOR_TEXT_PRIMARY_STRONGEST:rd,KUI_COLOR_TEXT_PRIMARY_WEAK:nd,KUI_COLOR_TEXT_PRIMARY_WEAKER:sd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:od,KUI_COLOR_TEXT_SUCCESS:ad,KUI_COLOR_TEXT_SUCCESS_STRONG:ld,KUI_COLOR_TEXT_SUCCESS_STRONGER:cd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:ud,KUI_COLOR_TEXT_SUCCESS_WEAK:dd,KUI_COLOR_TEXT_SUCCESS_WEAKER:hd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:fd,KUI_COLOR_TEXT_WARNING:md,KUI_COLOR_TEXT_WARNING_STRONG:pd,KUI_COLOR_TEXT_WARNING_STRONGER:gd,KUI_COLOR_TEXT_WARNING_STRONGEST:_d,KUI_COLOR_TEXT_WARNING_WEAK:yd,KUI_COLOR_TEXT_WARNING_WEAKER:Rd,KUI_COLOR_TEXT_WARNING_WEAKEST:Cd,KUI_FONT_FAMILY_CODE:zd,KUI_FONT_FAMILY_HEADING:Pd,KUI_FONT_FAMILY_TEXT:Wt,KUI_FONT_SIZE_10:qd,KUI_FONT_SIZE_100:jd,KUI_FONT_SIZE_20:Hd,KUI_FONT_SIZE_30:Gd,KUI_FONT_SIZE_40:Fd,KUI_FONT_SIZE_50:$d,KUI_FONT_SIZE_60:Wd,KUI_FONT_SIZE_70:Vd,KUI_FONT_SIZE_80:Yd,KUI_FONT_SIZE_90:Xd,KUI_FONT_WEIGHT_BOLD:Qd,KUI_FONT_WEIGHT_MEDIUM:Zd,KUI_FONT_WEIGHT_REGULAR:Jd,KUI_FONT_WEIGHT_SEMIBOLD:eh,KUI_ICON_COLOR_DANGER:th,KUI_ICON_COLOR_NEUTRAL:ih,KUI_ICON_COLOR_PRIMARY:rh,KUI_ICON_COLOR_SUCCESS:nh,KUI_ICON_COLOR_WARNING:sh,KUI_ICON_SIZE_10:oh,KUI_ICON_SIZE_20:ah,KUI_ICON_SIZE_30:lh,KUI_ICON_SIZE_40:ch,KUI_ICON_SIZE_50:uh,KUI_ICON_SIZE_60:dh,KUI_ICON_SIZE_70:hh,KUI_ICON_SIZE_80:fh,KUI_LETTER_SPACING_0:mh,KUI_LETTER_SPACING_MINUS_10:ph,KUI_LETTER_SPACING_MINUS_20:gh,KUI_LETTER_SPACING_MINUS_30:_h,KUI_LETTER_SPACING_MINUS_40:yh,KUI_LETTER_SPACING_MINUS_50:Rh,KUI_LETTER_SPACING_NORMAL:Ch,KUI_LINE_HEIGHT_10:Eh,KUI_LINE_HEIGHT_100:Dh,KUI_LINE_HEIGHT_20:Oh,KUI_LINE_HEIGHT_30:bh,KUI_LINE_HEIGHT_40:wh,KUI_LINE_HEIGHT_50:Th,KUI_LINE_HEIGHT_60:vh,KUI_LINE_HEIGHT_70:Sh,KUI_LINE_HEIGHT_80:xh,KUI_LINE_HEIGHT_90:Ih,KUI_METHOD_COLOR_BACKGROUND_CONNECT:kh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Nh,KUI_METHOD_COLOR_BACKGROUND_GET:Ah,KUI_METHOD_COLOR_BACKGROUND_HEAD:Lh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Uh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Kh,KUI_METHOD_COLOR_BACKGROUND_POST:Mh,KUI_METHOD_COLOR_BACKGROUND_PUT:Bh,KUI_METHOD_COLOR_BACKGROUND_TRACE:zh,KUI_METHOD_COLOR_TEXT_CONNECT:Ph,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:qh,KUI_METHOD_COLOR_TEXT_DELETE:Hh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Gh,KUI_METHOD_COLOR_TEXT_GET:Fh,KUI_METHOD_COLOR_TEXT_GET_STRONG:$h,KUI_METHOD_COLOR_TEXT_HEAD:Wh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:Vh,KUI_METHOD_COLOR_TEXT_OPTIONS:Yh,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:Xh,KUI_METHOD_COLOR_TEXT_PATCH:jh,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:Qh,KUI_METHOD_COLOR_TEXT_POST:Zh,KUI_METHOD_COLOR_TEXT_POST_STRONG:Jh,KUI_METHOD_COLOR_TEXT_PUT:ef,KUI_METHOD_COLOR_TEXT_PUT_STRONG:tf,KUI_METHOD_COLOR_TEXT_TRACE:rf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:nf,KUI_NAVIGATION_COLOR_BACKGROUND:sf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:of,KUI_NAVIGATION_COLOR_BORDER:af,KUI_NAVIGATION_COLOR_BORDER_CHILD:lf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:cf,KUI_NAVIGATION_COLOR_TEXT:uf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:df,KUI_NAVIGATION_COLOR_TEXT_HOVER:hf,KUI_NAVIGATION_COLOR_TEXT_SELECTED:ff,KUI_NAVIGATION_SHADOW_BORDER:mf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:pf,KUI_NAVIGATION_SHADOW_FOCUS:gf,KUI_SHADOW:_f,KUI_SHADOW_BORDER:yf,KUI_SHADOW_BORDER_DANGER:Rf,KUI_SHADOW_BORDER_DANGER_STRONG:Cf,KUI_SHADOW_BORDER_DISABLED:Ef,KUI_SHADOW_BORDER_PRIMARY:Of,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:bf,KUI_SHADOW_BORDER_PRIMARY_WEAK:wf,KUI_SHADOW_FOCUS:Tf,KUI_SPACE_0:vf,KUI_SPACE_10:Sf,KUI_SPACE_100:Kf,KUI_SPACE_110:Mf,KUI_SPACE_120:Bf,KUI_SPACE_130:zf,KUI_SPACE_140:Pf,KUI_SPACE_150:qf,KUI_SPACE_20:xf,KUI_SPACE_30:If,KUI_SPACE_40:Df,KUI_SPACE_50:kf,KUI_SPACE_60:Nf,KUI_SPACE_70:Af,KUI_SPACE_80:Lf,KUI_SPACE_90:Uf,KUI_SPACE_AUTO:Hf,KUI_STATUS_COLOR_100:Gf,KUI_STATUS_COLOR_100S:ip,KUI_STATUS_COLOR_101:Ff,KUI_STATUS_COLOR_102:$f,KUI_STATUS_COLOR_103:Wf,KUI_STATUS_COLOR_1NA:Qm,KUI_STATUS_COLOR_200:Vf,KUI_STATUS_COLOR_200S:rp,KUI_STATUS_COLOR_201:Yf,KUI_STATUS_COLOR_202:Xf,KUI_STATUS_COLOR_203:jf,KUI_STATUS_COLOR_204:Qf,KUI_STATUS_COLOR_205:Zf,KUI_STATUS_COLOR_206:Jf,KUI_STATUS_COLOR_207:em,KUI_STATUS_COLOR_208:tm,KUI_STATUS_COLOR_226:im,KUI_STATUS_COLOR_2NA:Zm,KUI_STATUS_COLOR_300:rm,KUI_STATUS_COLOR_300S:np,KUI_STATUS_COLOR_301:nm,KUI_STATUS_COLOR_302:sm,KUI_STATUS_COLOR_303:om,KUI_STATUS_COLOR_304:am,KUI_STATUS_COLOR_305:lm,KUI_STATUS_COLOR_307:cm,KUI_STATUS_COLOR_308:um,KUI_STATUS_COLOR_3NA:Jm,KUI_STATUS_COLOR_400:dm,KUI_STATUS_COLOR_400S:sp,KUI_STATUS_COLOR_401:hm,KUI_STATUS_COLOR_402:fm,KUI_STATUS_COLOR_403:mm,KUI_STATUS_COLOR_404:pm,KUI_STATUS_COLOR_405:gm,KUI_STATUS_COLOR_406:_m,KUI_STATUS_COLOR_407:ym,KUI_STATUS_COLOR_408:Rm,KUI_STATUS_COLOR_409:Cm,KUI_STATUS_COLOR_410:Em,KUI_STATUS_COLOR_411:Om,KUI_STATUS_COLOR_412:bm,KUI_STATUS_COLOR_413:wm,KUI_STATUS_COLOR_414:Tm,KUI_STATUS_COLOR_415:vm,KUI_STATUS_COLOR_416:Sm,KUI_STATUS_COLOR_417:xm,KUI_STATUS_COLOR_418:Im,KUI_STATUS_COLOR_421:Dm,KUI_STATUS_COLOR_422:km,KUI_STATUS_COLOR_423:Nm,KUI_STATUS_COLOR_424:Am,KUI_STATUS_COLOR_425:Lm,KUI_STATUS_COLOR_426:Um,KUI_STATUS_COLOR_428:Km,KUI_STATUS_COLOR_429:Mm,KUI_STATUS_COLOR_431:Bm,KUI_STATUS_COLOR_451:zm,KUI_STATUS_COLOR_4NA:ep,KUI_STATUS_COLOR_500:Pm,KUI_STATUS_COLOR_500S:op,KUI_STATUS_COLOR_501:qm,KUI_STATUS_COLOR_502:Hm,KUI_STATUS_COLOR_503:Gm,KUI_STATUS_COLOR_504:Fm,KUI_STATUS_COLOR_505:$m,KUI_STATUS_COLOR_506:Wm,KUI_STATUS_COLOR_507:Vm,KUI_STATUS_COLOR_508:Ym,KUI_STATUS_COLOR_510:Xm,KUI_STATUS_COLOR_511:jm,KUI_STATUS_COLOR_5NA:tp,KUI_STATUS_COLOR_BACKGROUND_100:ap,KUI_STATUS_COLOR_BACKGROUND_200:lp,KUI_STATUS_COLOR_BACKGROUND_300:cp,KUI_STATUS_COLOR_BACKGROUND_400:up,KUI_STATUS_COLOR_BACKGROUND_500:dp,KUI_STATUS_COLOR_TEXT_100:hp,KUI_STATUS_COLOR_TEXT_200:fp,KUI_STATUS_COLOR_TEXT_300:mp,KUI_STATUS_COLOR_TEXT_400:pp,KUI_STATUS_COLOR_TEXT_500:gp},Symbol.toStringTag,{value:"Module"})),Or=Object.keys(Er).filter(r=>r.startsWith("KUI_COLOR")),br=r=>Er[r],_p=r=>`--${r.toLowerCase().replaceAll("_","-")}`,wr=()=>{if(typeof window>"u")return Object.fromEntries(Or.map(t=>[t,br(t)]));const r=window.getComputedStyle(document.documentElement),e=(t,i)=>r.getPropertyValue(t).trim()||i;return Object.fromEntries(Or.map(t=>[t,e(_p(t),br(t))]))},Vt=r=>{const e=n.ref(wr());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=wr()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),n.getCurrentScope()&&n.onScopeDispose(()=>t.disconnect())}return e},yp=()=>typeof window>"u"?Wt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Wt,Rp=r=>{const e=yp(),t={color:r.KUI_COLOR_TEXT,fontFamily:e},i={axisLabel:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e},axisLine:{lineStyle:{color:r.KUI_COLOR_BORDER}},splitLine:{lineStyle:{color:r.KUI_COLOR_BORDER}}};return{textStyle:t,categoryAxis:i,valueAxis:i,tooltip:{backgroundColor:r.KUI_COLOR_BACKGROUND,borderWidth:0,borderRadius:4,padding:0,confine:!0,extraCssText:"box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12), 0 5px 10px rgba(0, 0, 0, 0.24);",textStyle:{color:r.KUI_COLOR_TEXT,fontFamily:e}},visualMap:{textStyle:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}},legend:{textStyle:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}}}},Cp=r=>n.computed(()=>Rp(r.value)),Ep={class:"kong-ui-public-echarts-tooltip"},Op={class:"tooltip-title"},bp={class:"title"},wp={key:0,class:"subtitle"},Tp={class:"context"},vp={class:"metric"},Sp={class:"tooltip-rows"},xp={class:"display-value"},Ip=n.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Ep,[n.createElementVNode("div",Op,[n.createElementVNode("div",bp,n.toDisplayString(r.title),1),r.context||r.metric?(n.openBlock(),n.createElementBlock("div",wp,[n.createElementVNode("div",Tp,n.toDisplayString(r.context),1),n.createElementVNode("div",vp,n.toDisplayString(r.metric),1)])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Sp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.rows,(i,s)=>(n.openBlock(),n.createElementBlock("li",{key:`${i.label}-${s}`,class:n.normalizeClass({"extra-row":i.isExtra})},[n.createElementVNode("span",{class:"square-marker",style:n.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),n.createElementVNode("span",{class:n.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},n.toDisplayString(i.label),3),n.createElementVNode("span",xp,n.toDisplayString(i.value),1)],2))),128))])]))}}),Tr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},Dp=Tr(Ip,[["__scopeId","data-v-ca633353"]]),Yt=r=>Array.isArray(r)?r:[r],vr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,Xt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),kp=r=>Array.isArray(r)?r[r.length-1]:r,Np=r=>{const e=Yt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>Xt(i,i.seriesName??"",kp(i.value)))}},Ap=r=>{let e;return n.getCurrentScope()&&n.onScopeDispose(()=>{e&&n.render(null,e)}),t=>{const i=(r()??Np)(t);return i?(e??=document.createElement("div"),n.render(n.h(Dp,i),e),e):""}},Lp={class:"kong-ui-public-echarts"},Up=n.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){n.useCssVars(o=>({v1cecfeed:o.height})),bt.use([Gr.CanvasRenderer,lt.GridComponent,lt.TooltipComponent]);const e=Vt(),t=Cp(e),i=Ap(()=>r.tooltipContent),s=n.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(n.openBlock(),n.createElementBlock("div",Lp,[n.createVNode(n.unref(Hr),n.mergeProps({autoresize:!0,class:"chart",option:s.value,theme:n.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Sr=Tr(Up,[["__scopeId","data-v-68114d20"]]),xr=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),nt=(r,...e)=>{const t={...r};for(const i of e)if(i)for(const[s,o]of Object.entries(i)){if(o===void 0)continue;const a=t[s];t[s]=xr(a)&&xr(o)?nt(a,o):o}return t},Kp=n.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){bt.use([ri.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=Vt(),t=a=>{const[l]=Yt(a),[u,c,d]=l.value;return{title:r.tooltipTitle,context:vr(u,r.xAxisLabels),metric:r.seriesName,rows:[Xt(l,vr(c,r.yAxisLabels),d,r.valueFormatter)]}},i=a=>({type:"slider",yAxisIndex:0,startValue:0,endValue:a-1,zoomLock:!0,right:10,width:8,handleSize:0,moveHandleSize:0,showDetail:!1,brushSelect:!1,showDataShadow:!1,borderColor:"transparent",backgroundColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST,fillerColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK}),s=n.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),u=r.valueFormatter?c=>r.valueFormatter(Number(c)):void 0;return{grid:{top:10,left:10,right:l?30:20,bottom:70,outerBoundsMode:"same",outerBoundsContain:"axisLabel"},xAxis:{type:"category",data:r.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:r.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:r.min??0,max:r.max??a.reduce((c,[,,d])=>Math.max(c,d),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:r.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:u},...l?{dataZoom:[i(r.visibleRows)]}:{},series:[nt({name:r.seriesName,type:"heatmap",data:a,animation:!1,label:{show:r.showValues??!1,formatter:r.valueFormatter?({value:c})=>r.valueFormatter(Number(c[2])):void 0},itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{shadowBlur:5,shadowColor:e.value.KUI_COLOR_BACKGROUND_OVERLAY}}},r.seriesOption)]}}),o=n.computed(()=>nt(s.value,r.option));return(a,l)=>(n.openBlock(),n.createBlock(Sr,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Mp=n.defineComponent({__name:"TreeMapChart",props:{data:{},seriesName:{},showValues:{type:Boolean},valueFormatter:{type:Function},colorPalette:{},drillDown:{type:Boolean,default:!0},leafDepth:{},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){bt.use([ri.TreemapChart]);const e=Vt(),t=l=>{const[u]=Yt(l),c=u.treePathInfo??[];if(c.length===1)return;const d=c.slice(1,-1).map(({name:h})=>h);return{title:r.tooltipTitle,context:d.length?d.join(" / "):void 0,metric:r.seriesName,rows:[Xt(u,u.name,Number(u.value),r.valueFormatter)]}},i=()=>[e.value.KUI_COLOR_BACKGROUND_PRIMARY_WEAK,e.value.KUI_COLOR_BACKGROUND_SUCCESS_WEAK,e.value.KUI_COLOR_BACKGROUND_WARNING_WEAK,e.value.KUI_COLOR_BACKGROUND_DANGER_WEAK,e.value.KUI_COLOR_BACKGROUND_INFO_WEAK,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST],s=(l=[])=>l.reduce((u,c)=>Math.max(u,1+s(c.children)),0),o=n.computed(()=>({series:[nt({name:r.seriesName,type:"treemap",data:r.data??[],nodeClick:r.drillDown?"zoomToNode":!1,...r.drillDown?{scaleLimit:{max:1/0},zoomToNodeRatio:.2}:{},leafDepth:r.leafDepth??s(r.data),roam:!1,left:0,top:0,right:0,bottom:r.drillDown?40:0,visibleMin:0,breadcrumb:{show:r.drillDown,itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK,borderColor:"transparent",borderWidth:0,borderRadius:2,textStyle:{color:e.value.KUI_COLOR_TEXT}},emphasis:{itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL,textStyle:{color:e.value.KUI_COLOR_TEXT}}}},levels:[{color:r.colorPalette??i(),itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,gapWidth:2}},{colorAlpha:[.55,1],itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:1,gapWidth:1}}],label:{show:!0,color:e.value.KUI_COLOR_TEXT,align:"center",verticalAlign:"middle",overflow:"truncate",formatter:r.showValues?({name:l,value:u})=>`${l}
|
|
13
13
|
${r.valueFormatter?r.valueFormatter(Number(u)):String(u)}`:void 0}},r.seriesOption)]})),a=n.computed(()=>nt(o.value,r.option));return(l,u)=>(n.openBlock(),n.createBlock(Sr,{height:r.height,option:a.value,"tooltip-content":t},null,8,["height","option"]))}}),Ir=r=>{if(r==null||typeof r=="string"&&r.trim()==="")return;const e=Number(r);return Number.isFinite(e)?e:void 0},Dr="MMM dd",Bp=(r,e)=>{const t=[],i=new Date(e);for(const s=new Date(r);s<i;s.setDate(s.getDate()+1))t.push(Tt(s,Dr));return t},zp=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},Pp=(r,e)=>r[e]?.name??e,qp=r=>{if(!r?.meta||!r.data)return;const{display:e,metric_names:t,start:i,end:s}=r.meta,o=t?.[0],a=e&&Object.keys(e).find(d=>d!=="time");if(!o||!a||!i||!s){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const l=Bp(i,s),u=[],c=[];for(const{timestamp:d,event:h}of r.data){const f=l.indexOf(Tt(new Date(d),Dr)),m=Ir(h[o]);f===-1||m===void 0||c.push([f,zp(u,String(h[a])),m])}return{data:c,xAxisLabels:l,yAxisLabels:u.map(d=>Pp(e[a],d))}},Hp={class:"wrapper","data-testid":"heatmap-chart"},Gp=10,Fp=Ce(n.defineComponent({__name:"HeatmapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=e,{i18n:i}=ce.useI18n(),s=ce.useMetricFormatter(),o=u=>{const c=qp(u);if(c?.data.length)return{data:c.data,xAxisLabels:c.xAxisLabels,yAxisLabels:c.yAxisLabels,...s(u)}},a=new WeakMap,l=u=>(a.has(u)||a.set(u,o(u)),a.get(u));return(u,c)=>{const d=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c[0]||(c[0]=h=>t("chart-data",h)),onQueryComplete:c[1]||(c[1]=h=>t("query-complete"))},{default:n.withCtx(({data:h})=>[n.createElementVNode("div",Hp,[l(h)?(n.openBlock(),n.createBlock(n.unref(Kp),n.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":Gp},l(h)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(d,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(i).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(i).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-937dae87"]]),kr=(r,e,{otherLabel:t})=>({name:e===xe.OTHER_DIMENSION_ID&&t||(r?.[e]?.name??e)}),$p=(r,e,t,i)=>({...kr(e,t,i),itemStyle:{color:Cs({dimension:r,dimensionValue:t})}}),Nr=(r,e,t)=>{const i=r.get(e)??t();return r.set(e,i),i},Wp=/_(average|p\d+|rate|max|per_minute)$/,jt=(r,e)=>!e.includes("time")&&!(r&&Wp.test(r)),Ar=(r,e)=>{r.value=Number(r.value??0)+e},Vp=(r,e,t,[i,s],o)=>{const a=new Map,l=(u,c)=>String(u[c]);for(const{event:u}of r){const c=Ir(u[e]);if(c===void 0)continue;const d=l(u,i),h=Nr(a,d,()=>({node:$p(i,t[i],d,o),children:new Map}));if(!s){Ar(h.node,c);continue}const f=l(u,s),m=Nr(h.children,f,()=>kr(t[s],f,o));Ar(m,c)}return a},Yp=(r,e={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i}=r.meta,s=i?.[0],o=t?Object.keys(t):[];if(!s||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!jt(s,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...Vp(r.data,s,t,o,e).values()].map(({node:l,children:u})=>u.size?{...l,children:[...u.values()]}:l)},Xp={class:"wrapper","data-testid":"treemap-chart"},jp=Ce(n.defineComponent({__name:"TreemapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=ce.useI18n(),o=ce.useMetricFormatter(),a=n.computed(()=>jt(t.query.metrics?.[0],t.query.dimensions??[])),l=d=>{const h=Yp(d,{otherLabel:s.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(d)}},u=new WeakMap,c=d=>(u.has(d)||u.set(d,l(d)),u.get(d));return(d,h)=>{const f=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:h[0]||(h[0]=m=>i("chart-data",m)),onQueryComplete:h[1]||(h[1]=m=>i("query-complete"))},{default:n.withCtx(({data:m})=>[n.createElementVNode("div",Xp,[a.value?c(m)?(n.openBlock(),n.createBlock(n.unref(Mp),n.mergeProps({key:1,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0},c(m)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.description")),1)]),_:1})):(n.openBlock(),n.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),Qp=["data-testid"],Zp={key:0,class:"tile-header"},Jp={class:"badge-container"},eg={class:"badge-text"},tg={class:"badge-text"},ig={key:0,class:"metric-selector-wrapper"},rg={key:1},ng=["data-testid"],sg=["data-testid"],og=["data-testid"],ag={class:"delete-option"},lg=["data-testid"],Lr=Ce(n.defineComponent({__name:"DashboardTile",props:n.mergeModels({context:{},definition:{},fitToContent:{type:Boolean,default:!1},height:{default:()=>Ye},hideActions:{type:Boolean,default:!1},isFullscreen:{type:Boolean},preview:{type:Boolean,default:!1},queryReady:{type:Boolean},showRefresh:{type:Boolean,default:!1},tileId:{},tileType:{default:"chart"}},{refreshCounter:{default:0},refreshCounterModifiers:{}}),emits:n.mergeModels(["chart-data","tile-loaded","edit-tile","duplicate-tile","remove-tile","tile-time-range-zoom","tile-bounds-change"],["update:refreshCounter"]),setup(r,{expose:e,emit:t}){n.useCssVars(L=>({v692e8c06:`${L.height}px`}));const i=parseInt(zi,10),{zoomConfiguration:s}=ce.useDashboardContext({context:n.computed(()=>r.context),preview:n.computed(()=>r.preview)}),o=n.useModel(r,"refreshCounter"),a=()=>{E.value=!0,o.value++},l=t,u=n.defineAsyncComponent(()=>Promise.resolve().then(()=>vg)),c=n.inject(Te),d=Ne.useDatasourceConfigStore(),{datasourceConfigMap:h,stripUnknownFilters:f}=Xe(d),{i18n:m}=ce.useI18n(),_=n.ref(),O=n.ref({status:"loading"}),C=n.ref(!1),S=n.ref(),k=n.ref(!1),E=n.ref(!0),b=n.computed(()=>r.definition.chart),T=n.computed(()=>"chart_title"in b.value?b.value.chart_title:void 0),U=n.computed(()=>r.definition.header_description),z=n.computed(()=>b.value.type==="slottable"),p=n.computed(()=>Ie(r.definition)||Mt(r.definition)?!1:!("allow_csv_export"in b.value)||b.value.allow_csv_export!==!1),{exploreLinkKebabMenu:g,requestsLinkKebabMenu:y,canShowKebabMenu:v,canGenerateRequestsLink:x,canGenerateExploreLink:N,requestsLinkZoomActions:K,exploreLinkZoomActions:q,buildExploreQuery:V,buildExploreLink:P,buildRequestLink:F,buildRequestsQueryZoomActions:M}=ce.useContextLinks({queryBridge:c,chartData:n.readonly(_),definition:n.toRef(()=>r.definition),context:n.readonly(n.toRef(()=>r.context))}),{issueQuery:A}=ce.useIssueQuery();n.watch(()=>r.definition,async(L,J)=>{await n.nextTick(),S.value&&(k.value=S.value.scrollWidth>S.value.clientWidth);try{JSON.stringify(L?.query)!==JSON.stringify(J?.query)&&(E.value=!0)}catch{}},{immediate:!0,deep:!0});const w=n.computed(()=>m.t("csvExport.defaultFilename")),D=n.computed(()=>!!g.value||p.value||!!r.context.editable),I=n.computed(()=>!r.hideActions&&v.value&&D.value),Q=n.computed(()=>I.value&&D.value&&!r.isFullscreen),re={heatmap:Fp,treemap:jp,timeseries_line:ur,timeseries_bar:ur,scatter:rl,horizontal_bar:cr,vertical_bar:cr,gauge:lr,donut:Jl,golden_signals:nl,top_n:Vl,top_talkers:Yl,table:Zl,slottable:void 0,single_value:lr,choropleth_map:u},te=n.computed(()=>({...he.value?.rendererEvents.supportsRequests?{"select-chart-range":He}:{},...he.value?.rendererEvents.supportsZoom?{"zoom-time-range":Be}:{},...he.value?.rendererEvents.supportsBounds?{"bounds-change":be}:{},...he.value?.rendererEvents.supportsLoadingChange?{"loading-change":pe}:{}})),he=n.computed(()=>{const L=re[r.definition.chart.type],J=Ie(r.definition),me=!!L?.emits?.includes("select-chart-range"),Ge=!!L?.emits?.includes("zoom-time-range"),ze=r.definition.chart.type==="choropleth_map",Fe=!!L?.emits?.includes("loading-change"),Jt={query:r.definition.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:o.value,zoomConfiguration:s.value},ei={chartOptions:r.definition.chart,activeMetric:Z.value,headerDescription:U.value,requestsLink:s.value.showRequestsAction?K.value:void 0,exploreLink:s.value.showExploreAction?q.value:void 0};return L&&{component:L,rendererProps:{...Jt,...J?{}:ei,...r.definition.chart.type==="top_n"?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:Fe}}}),Y=n.computed(()=>{if(Ie(r.definition))return null;const L=r.definition.query,J=L?.time_range;if(ee.isPlatformDatasource(L?.datasource)&&!L.dimensions?.includes("time"))return m.t("renderer.as_of_today");if(J?.type==="relative"){const me=ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[J.time_range]);return me?me.display:(console.warn("Did not recognize the given relative time range:",J.time_range),J.time_range)}else if(J?.type==="absolute"){const me=J.tz||"Etc/UTC";return`${ee.formatTime(J.start,{short:!0,tz:me})} - ${ee.formatTime(J.end,{short:!0,tz:me})}`}return null}),X=n.computed(()=>{const L=r.definition.query,J=L?.datasource,me=J?h.value[J]?.timeRangeOptions:void 0,ze=(L&&"time_range"in L?L.time_range:void 0)??r.context.timeSpec;return Pt(ze,me)}),ae=n.computed(()=>z.value?!1:[!!T.value,Q.value,!!Y.value,X.value,!!U.value,r.showRefresh,j.value].some(Boolean)),G=n.computed(()=>_.value?ee.msToGranularity(_.value.meta.granularity_ms):void 0),le=n.computed(()=>["timeseries_line","timeseries_bar"].includes(b.value.type)),ue=n.computed(()=>_.value?.meta.metric_names??[]),Z=n.ref();n.watch(ue,L=>{(!Z.value||!L.includes(Z.value))&&(Z.value=L[0])},{immediate:!0});const se=n.computed(()=>{const L=b.value;return L.type!=="timeseries_line"?!1:ue.value.some(J=>L.metric_axis_map?.[J]==="right")}),j=n.computed(()=>le.value&&!se.value&&(_.value?.data.length??0)>0&&ue.value.length>1&&Object.keys(_.value?.meta.display??{}).length>0),Re=L=>Object.hasOwn(Hi.chartLabels,L),$=n.computed(()=>ue.value.map(L=>({value:L,label:Re(L)?m.t(`chartLabels.${L}`):L}))),oe=n.computed(()=>{if(!Bt(r.definition)||!le.value||!r.queryReady||E.value)return!1;const L=r.definition.query.granularity;return!L||!G.value?!1:L!==G.value}),Ae=n.computed(()=>{const L=ee.msToGranularity(_.value?.meta.granularity_ms??0)??"unknown",J=Bt(r.definition)?r.definition.query.granularity??"unknown":"unknown";return m.t("query_aged_out_warning",{currentGranularity:m.t(`granularities.${L}`),savedGranularity:m.t(`granularities.${J}`)})}),Me=n.computed(()=>{const L=[...r.context.filters,...r.definition.query.filters??[]],J="metrics"in r.definition.query?r.definition.query.metrics:void 0,me=r.definition.query.datasource??"api_usage";return f.value({datasource:me,filters:L,queryFields:J})}),Ee=()=>{l("edit-tile",r.definition)},qe=()=>{l("duplicate-tile",r.definition)},fe=()=>{l("remove-tile",r.definition)},Oe=L=>{_.value=L,E.value=!1,l("chart-data",L),l("tile-loaded")},de=()=>{E.value=!1,l("tile-loaded")},pe=L=>{E.value=L,L||l("tile-loaded")},Se=()=>{C.value=!1},je=()=>{if(Mt(r.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const L=r.definition.query.datasource?.startsWith("goap");return c?.staticConfig?.increaseCsvExportLimit!==!1&&!L?A(r.definition.query,r.context,ee.EXPORT_RECORD_LIMIT):_.value?Promise.resolve(_.value):new Promise(me=>{const Ge=n.watch(_,ze=>{ze&&(me(ze),Ge())})})},Ot=async()=>{C.value=!0,O.value={status:"loading"};try{const L=await je();O.value={status:"success",chartData:L}}catch(L){O.value={status:"error",error:L}}},Be=L=>{const J={tileId:r.tileId.toString(),timeRange:L};l("tile-time-range-zoom",J)},be=L=>{const J={tileId:r.tileId.toString(),bounds:L};l("tile-bounds-change",J)},He=L=>{const J=Me.value,me=V(L,J);q.value=N.value?{href:P(me)}:void 0,K.value=x.value?{href:F(M(L,J))}:void 0};return e({getExportData:je}),(L,J)=>{const me=n.resolveComponent("KTooltip"),Ge=n.resolveComponent("KBadge"),ze=n.resolveComponent("KButton"),Fe=n.resolveComponent("KDropdownItem"),Jt=n.resolveComponent("KDropdown");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["tile-boundary",{editable:r.context.editable,headless:!ae.value}]),"data-testid":`tile-${r.tileId}`},[ae.value&&!z.value?(n.openBlock(),n.createElementBlock("div",Zp,[n.createVNode(me,{class:"title-tooltip",disabled:!k.value,"max-width":"500",text:T.value},{default:n.withCtx(()=>[n.createElementVNode("div",{ref_key:"titleRef",ref:S,class:"title"},n.toDisplayString(T.value),513)]),_:1},8,["disabled","text"]),n.createElementVNode("div",Jp,[X.value?(n.openBlock(),n.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:n.unref(m).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:n.withCtx(()=>[n.createVNode(n.unref(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(Ki)})`},null,8,["size"])]),default:n.withCtx(()=>[n.createElementVNode("span",eg,n.toDisplayString(n.unref(m).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):n.createCommentVNode("",!0),Y.value?(n.openBlock(),n.createBlock(Ge,{key:1,"data-testid":"time-range-badge",tooltip:oe.value?Ae.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("span",tg,n.toDisplayString(Y.value),1)]),_:2},[oe.value?{name:"icon",fn:n.withCtx(()=>[n.createVNode(n.unref(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(Ki)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):n.createCommentVNode("",!0)]),j.value?(n.openBlock(),n.createElementBlock("div",ig,[n.createVNode(n.unref(qr.KSegmentedControl),{modelValue:Z.value,"onUpdate:modelValue":J[0]||(J[0]=ei=>Z.value=ei),class:"metric-selector","data-testid":"metric-selector",options:$.value},null,8,["modelValue","options"])])):n.createCommentVNode("",!0),r.showRefresh?(n.openBlock(),n.createElementBlock("div",rg,[n.createVNode(ze,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${r.tileId}`,disabled:E.value,icon:"",size:"small",onClick:a},{default:n.withCtx(()=>[E.value?(n.openBlock(),n.createBlock(n.unref(ie.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${n.unref(Bi)})`,tabindex:"0"},null,8,["size"])):(n.openBlock(),n.createBlock(n.unref(ie.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${n.unref(Bi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):n.createCommentVNode("",!0),U.value?(n.openBlock(),n.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${r.tileId}`},n.toDisplayString(U.value),9,ng)):n.createCommentVNode("",!0),I.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${r.tileId}`},[I.value&&r.context.editable&&!r.isFullscreen?(n.openBlock(),n.createBlock(n.unref(ie.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${n.unref(Nt)})`,"data-testid":`edit-tile-${r.tileId}`,size:`var(--kui-icon-size-40, ${n.unref(Mi)})`,onClick:Ee},null,8,["color","data-testid","size"])):n.createCommentVNode("",!0),I.value&&D.value&&!r.isFullscreen?(n.openBlock(),n.createBlock(Jt,{key:1,class:"dropdown","data-testid":`chart-action-menu-${r.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:n.withCtx(()=>[n.unref(g)?(n.openBlock(),n.createBlock(Fe,{key:0,"data-testid":`chart-jump-to-explore-${r.tileId}`,item:{label:n.unref(m).t("jumpToExplore"),to:n.unref(g)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),!n.unref(Ie)(r.definition)&&n.unref(y)?(n.openBlock(),n.createBlock(Fe,{key:1,"data-testid":`chart-jump-to-requests-${r.tileId}`,item:{label:n.unref(m).t("jumpToRequests"),to:n.unref(y)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),p.value?(n.openBlock(),n.createBlock(Fe,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${r.tileId}`,onClick:Ot},{default:n.withCtx(()=>[n.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${r.tileId}`},n.toDisplayString(n.unref(m).t("csvExport.exportAsCsv")),9,og)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock(Fe,{key:3,"data-testid":`duplicate-tile-${r.tileId}`,onClick:qe},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(m).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock(Fe,{key:4,"data-testid":`remove-tile-${r.tileId}`,onClick:fe},{default:n.withCtx(()=>[n.createElementVNode("span",ag,n.toDisplayString(n.unref(m).t("renderer.delete")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)]),default:n.withCtx(()=>[n.createVNode(n.unref(ie.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${n.unref(Nt)})`,"data-testid":`kebab-action-menu-${r.tileId}`,size:`var(--kui-icon-size-40, ${n.unref(Mi)})`},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)],8,sg)):n.createCommentVNode("",!0),C.value?(n.openBlock(),n.createBlock(sr,{key:4,"data-testid":`csv-export-modal-${r.tileId}`,"export-state":O.value,filename:w.value,onCloseModal:Se},null,8,["data-testid","export-state","filename"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["tile-content",`type-${r.tileType}-${b.value.type}`]),"data-testid":`tile-content-${r.tileId}`},[he.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(he.value.component),n.mergeProps({key:0},he.value.rendererProps,n.toHandlers(te.value),{onChartData:Oe,onQueryComplete:de}),null,16)):n.createCommentVNode("",!0)],10,lg)],10,Qp)}}}),[["__scopeId","data-v-a062c19f"]]),cg=(r,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),u=o.layout.size.rows===1&&!!o.layout.size.fit_to_content;t=Math.max(t,a+o.layout.size.rows),l===void 0?i.set(a,u):i.set(a,l&&u)});const s=[];for(let o=0;o<t;o++)i.get(o)?s.push("auto"):s.push(`${r}px`);return s},Ur=Ce(n.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>Ye},columns:{type:Number,required:!1,default:()=>mt},tiles:{type:Array,required:!0}},setup(r){n.useCssVars(u=>({v6834ae83:e.columns,v9c95201e:a.value}));const e=r,t=n.ref(null),i=n.ref(0),s=new ResizeObserver(u=>{window.requestAnimationFrame(()=>{!Array.isArray(u)||!u.length||(i.value=u[0].contentRect.width)})});n.onMounted(()=>{t.value&&s.observe(t.value)}),n.onUnmounted(()=>{t.value&&s.unobserve(t.value)});const o=n.computed(()=>cg(e.tileHeight,e.tiles)),a=n.computed(()=>o.value.join(" ")),l=n.computed(()=>e.tiles.map((u,c)=>({key:`tile-${c}`,tile:u,style:{"grid-column-start":u.layout.position.col+1,"grid-column-end":u.layout.position.col+1+u.layout.size.cols,"grid-row-start":u.layout.position.row+1,"grid-row-end":u.layout.position.row+1+u.layout.size.rows}})));return(u,c)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"gridContainer",ref:t,class:"kong-ui-public-grid-layout"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createElementBlock("div",{key:d.key,class:n.normalizeClass(["grid-cell",{"empty-cell":!d.tile}]),style:n.normalizeStyle(d.style)},[n.renderSlot(u.$slots,"tile",{fitToContent:o.value[d.tile.layout.position.row]==="auto",style:n.normalizeStyle(d.style),tile:d.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-aa4f1c68"]]);function ug(r,e,t,i,s){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+s+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(r,a));return o.prototype=e.prototype,o}class R{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let s=t.querySelectorAll(e);return!s.length&&e[0]!=="."&&e[0]!=="#"&&(s=t.querySelectorAll("."+e),s.length||(s=t.querySelectorAll("#"+e))),Array.from(s)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let s=t.querySelector(e);return i&&!s&&(s=i.getElementById(e)),s||(s=t.querySelector("."+e)),s}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(s=>{s&&i.classList.add(s)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return R.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,s=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(s<=i)return 0;const o=e.y>t.y?e.y:t.y,a=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return a<=o?0:(s-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,o)=>{const a=t*((s.y??1e4)-(o.y??1e4));return a===0?t*((s.x??1e4)-(o.x??1e4)):a})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static createStylesheet(e,t,i){const s=document.createElement("style"),o=i?.nonce;return o&&(s.nonce=o),s.setAttribute("type","text/css"),s.setAttribute("gs-style-id",e),s.styleSheet?s.styleSheet.cssText="":s.appendChild(document.createTextNode("")),t?t.insertBefore(s,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(s)),s}static removeStylesheet(e,t){const s=(t||document).querySelector("STYLE[gs-style-id="+e+"]");s&&s.parentNode&&s.remove()}static addCSSRule(e,t,i){e.textContent+=`${t} { ${i} } `}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const s=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!s)throw new Error(`Invalid height val = ${e}`);i=s[2]||"px",t=parseFloat(s[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const s in i){if(!i.hasOwnProperty(s))return;e[s]===null||e[s]===void 0?e[s]=i[s]:typeof i[s]=="object"&&typeof e[s]=="object"&&this.defaults(e[s],i[s])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const s=e[i],o=t[i];i[0]==="_"||s===o?delete e[i]:s&&typeof s=="object"&&o!==void 0&&(R.removeInternalAndSame(s,o),Object.keys(s).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...s)=>{i||(i=!0,setTimeout(()=>{e(...s),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const s=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>o){const a=s.bottom-o,l=s.top,u=this.getScrollElement(e);if(u!==null){const c=u.scrollTop;s.top<0&&i<0?e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=a>i?i:a),t.top+=u.scrollTop-c}}}static updateScrollResize(e,t,i){const s=this.getScrollElement(t),o=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,l=e.clientY-a,u=l<i,c=l>o-i;u?s.scrollBy({behavior:"smooth",top:l-i}):c&&s.scrollBy({behavior:"smooth",top:i-(o-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=R.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(o=>o===s)&&(i[s]=R.cloneDeep(e[s]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=R.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(s=>{e.style[i]=s}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},s={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...s}}static simulateMouseEvent(e,t,i){const s=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:s.ctrlKey??!1,altKey:s.altKey??!1,shiftKey:s.shiftKey??!1,metaKey:s.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");R.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const s=e[t];e[t]=e[i],e[i]=s}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class De{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,s={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!s.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,s.skip));let a=!1;const l={nested:!0,pack:!1};let u=0;for(;i=i||this.collide(e,o,s.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...l};c=this._loading&&R.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&c?R.copyPos(t,e):!i.locked&&c&&s.pack&&(this._packNodes(),t.y=i.y+i.h,R.copyPos(e,t)),a=a||c}else c=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...l});if(!c)return a;i=void 0}return a}collide(e,t=e,i){const s=e._id,o=i?._id;return this.nodes.find(a=>a._id!==s&&a._id!==o&&R.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==s&&a._id!==o&&R.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,o={...t.rect};o.y>s.y?(o.h+=o.y-s.y,o.y=s.y):o.h+=s.y-o.y,o.x>s.x?(o.w+=o.x-s.x,o.x=s.x):o.w+=s.x-o.x;let a,l=.5;for(let u of i){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,h=Number.MAX_VALUE;s.y<c.y?d=(o.y+o.h-c.y)/c.h:s.y+s.h>c.y+c.h&&(d=(c.y+c.h-o.y)/c.h),s.x<c.x?h=(o.x+o.w-c.x)/c.w:s.x+s.w>c.x+c.w&&(h=(c.x+c.w-o.x)/c.w);const f=Math.min(h,d);f>l&&(l=f,a=u)}return t.collide=a,a}cacheRects(e,t,i,s,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-s,h:l.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=o,e.y=a),e._dirty=t._dirty=!0,!0}let s;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(s=R.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=R.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=R.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,s){const o={x:e||0,y:t||0,w:i||1,h:s||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const s=this._inColumnResize;s||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((a,l,u)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=u[l-1])),this.addNode(a,!1,c)}),s||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=R.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??De._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const s={x:0,y:0,w:1,h:1};return R.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,R.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=s.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=s.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=s.w),isNaN(e.h)&&(e.h=s.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||R.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),R.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!R.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=R.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||R.samePos(e,e._orig)||(R.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){const o=s?s.y*i+(s.x+s.w):0;let a=!1;for(let l=o;!a;++l){const u=l%i,c=Math.floor(l/i);if(u+e.w>i)continue;const d={x:u,y:c,w:e.w,h:e.h};t.find(h=>R.isIntercepted(d,h))||((e.x!==u||e.y!==c)&&(e._dirty=!0),e.x=u,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,t=!1,i){const s=this.nodes.find(a=>a._id===e._id);if(s)return s;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(s=>s._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(s=>s._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(s=>s._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const s=new De({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const o=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return o?(s.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(u=>u._id===a._id);l&&(R.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new De({column:this.column,float:this.float,nodes:this.nodes.map(s=>({...s}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=R.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const s=e.w!==t.w||e.h!==t.h,o=R.copyPos({},e,!0);if(R.copyPos(o,t),this.nodeBoundFix(o,s),R.copyPos(t,o),!t.forceCollide&&R.samePos(e,t))return!1;const a=R.copyPos({},e),l=this.collideAll(e,o,t.skip);let u=!0;if(l.length){const c=e._moving&&!t.nested;let d=c?this.directionCollideCoverage(e,t,l):l[0];if(c&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=R.areaIntercept(t.rect,d._rect),f=R.area(t.rect),m=R.area(d._rect);h/(f<m?f:m)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?u=!this._fixCollisions(e,o,d,t):(u=!1,i&&delete t.pack)}return u&&!R.samePos(e,o)&&(e._dirty=!0,R.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!R.samePos(e,a)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){const i=this._layouts?.length,s=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=s?.find(c=>c._id===a._id),u={...a,...l||{}};R.removeInternalForSave(u,!e),t&&t(a,u),o.push(u)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const s=i/this.column;e.forEach(o=>{if(!o._orig)return;const a=t.find(l=>l._id===o._id);a&&(a.y>=0&&o.y!==o._orig.y&&(a.y+=o.y-o._orig.y),o.x!==o._orig.x&&(a.x=Math.round(o.x*s)),o.w!==o._orig.w&&(a.w=Math.round(o.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const s=i==="compact"||i==="list";s&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=s?this.nodes:R.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],u=this._layouts.length-1;!l.length&&e!==u&&this._layouts[u]?.length&&(e=u,this._layouts[u].forEach(c=>{const d=a.find(h=>h._id===c._id);d&&(!s&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=!0))})),l.forEach(c=>{const d=a.findIndex(h=>h._id===c._id);if(d!==-1){const h=a[d];if(s){h.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,o),c.autoPosition||(h.x=c.x??h.x,h.y=c.y??h.y,h.w=c.w??h.w,o.push(h)),a.splice(d,1)}})}if(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=s||i==="none"?1:t/e,u=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(d=>{d.x=t===1?0:u?Math.round(d.x*l):Math.min(d.x,t-1),d.w=t===1||e===1?1:c?Math.round(d.w*l)||1:Math.min(d.w,t),o.push(d)}),a=[]}o=R.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];return e.forEach((o,a)=>{if(o._id===void 0){const l=o.id?this.nodes.find(u=>u.id===o.id):void 0;o._id=l?._id??De._idSeq++}s[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??De._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const s=this.findCacheLayout(e,t);return s===-1?this._layouts[t].push(i):this._layouts[t][s]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}De._idSeq=0;const ye={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class H{}const ve=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class ke{}function gt(r,e){r.touches.length>1||(r.cancelable&&r.preventDefault(),R.simulateMouseEvent(r.changedTouches[0],e))}function Kr(r,e){r.cancelable&&r.preventDefault(),R.simulateMouseEvent(r,e)}function _t(r){ke.touchHandled||(ke.touchHandled=!0,gt(r,"mousedown"))}function yt(r){ke.touchHandled&>(r,"mousemove")}function Rt(r){if(!ke.touchHandled)return;ke.pointerLeaveTimeout&&(window.clearTimeout(ke.pointerLeaveTimeout),delete ke.pointerLeaveTimeout);const e=!!H.dragElement;gt(r,"mouseup"),e||gt(r,"click"),ke.touchHandled=!1}function Ct(r){r.pointerType!=="mouse"&&r.target.releasePointerCapture(r.pointerId)}function Mr(r){H.dragElement&&r.pointerType!=="mouse"&&Kr(r,"mouseenter")}function Br(r){H.dragElement&&r.pointerType!=="mouse"&&(ke.pointerLeaveTimeout=window.setTimeout(()=>{delete ke.pointerLeaveTimeout,Kr(r,"mouseleave")},10))}class Et{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Et.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),ve&&(this.el.addEventListener("touchstart",_t),this.el.addEventListener("pointerdown",Ct)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),ve&&(this.el.removeEventListener("touchstart",_t),this.el.removeEventListener("pointerdown",Ct)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),ve&&(this.el.addEventListener("touchmove",yt),this.el.addEventListener("touchend",Rt)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),ve&&(this.el.removeEventListener("touchmove",yt),this.el.removeEventListener("touchend",Rt)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Et.prefix="ui-resizable-";class Qt{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class st extends Qt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||o;return{position:{left:(a.left-s.left)*this.rectScale.x,top:(a.top-s.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(s=>this.option[s]=e[s]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),H.overResizeElement===this&&delete H.overResizeElement),this}_mouseOver(e){H.overResizeElement||H.dragElement||(H.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){H.overResizeElement===this&&(delete H.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Et(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=R.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=R.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=R.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=R.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=R.initEvent(e,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=st._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=R.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return st._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let l,u;t.indexOf("e")>-1?s.width+=o:t.indexOf("w")>-1&&(s.width-=o,s.left+=o,l=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,u=!0);const c=this._constrainSize(s.width,s.height,l,u);return Math.round(s.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-c.width),s.width=c.width),Math.round(s.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-c.height),s.height=c.height),s}_constrainSize(e,t,i,s){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,u=(s?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,d=Math.min(a,Math.max(l,e)),h=Math.min(u,Math.max(c,t));return{width:d,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:s}=t.getBoundingClientRect();e={left:i,top:s,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],s=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*s+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}st._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const dg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ot extends Qt{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),ve&&(e.addEventListener("touchstart",_t),e.addEventListener("pointerdown",Ct))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),ve&&(t.removeEventListener("touchstart",_t),t.removeEventListener("pointerdown",Ct))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!H.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(dg)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete H.dragElement,delete H.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),ve&&(e.currentTarget.addEventListener("touchmove",yt),e.currentTarget.addEventListener("touchend",Rt)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),H.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=R.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),H.pauseDrag){const i=Number.isInteger(H.pauseDrag)?H.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,H.dragElement=this;const i=this.el.gridstackNode?.grid;i?H.dropElement=i.el.ddElement.ddDroppable:delete H.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=R.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const s=R.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),ve&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",yt,!0),e.currentTarget.removeEventListener("touchend",Rt,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),H.dropElement?.el===this.el.parentElement&&delete H.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=R.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),H.dropElement&&H.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete H.dragElement,delete H.dropElement,delete H.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||H.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!R.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",R.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=R.cloneNode(this.el)),e.parentElement||R.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ot.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",ot.originStyleProp.forEach(s=>t.style[s]=this.dragElementOriginStyle[s]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,s=this.dragOffset;i.left=(e.clientX+s.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+s.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let s=0,o=0;i&&(s=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-s,offsetTop:-e.clientY+a.top-o,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}ot.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class hg extends Qt{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),ve&&(this.el.addEventListener("pointerenter",Mr),this.el.addEventListener("pointerleave",Br)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),ve&&(this.el.removeEventListener("pointerenter",Mr),this.el.removeEventListener("pointerleave",Br)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!H.dragElement||!this._canDrop(H.dragElement.el))return;e.preventDefault(),e.stopPropagation(),H.dropElement&&H.dropElement!==this&&H.dropElement._mouseLeave(e,!0),H.dropElement=this;const t=R.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(H.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!H.dragElement||H.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=R.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(H.dragElement)),this.triggerEvent("dropout",i),H.dropElement===this&&(delete H.dropElement,!t)){let s,o=this.el.parentElement;for(;!s&&o;)s=o.ddElement?.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const t=R.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(H.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Zt{static init(e){return e.ddElement||(e.ddElement=new Zt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new ot(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new st(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new hg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class fg{resizable(e,t,i,s){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:s});else{const l=o.el.gridstackNode.grid;let u=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:u,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,s){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:s});else{const a=o.el.gridstackNode.grid;o.setupDraggable({...a.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,s){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:s}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(s=>s.on(t,o=>{i(o,H.dragElement?H.dragElement.el:o.target,H.dragElement?H.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",s=R.getElements(e);return s.length?s.map(a=>a.ddElement||(i?Zt.init(a):null)).filter(a=>a):[]}}const _e=new fg;class B{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=B.getGridElement(t);return i?(i.gridstack||(i.gridstack=new B(i,R.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
14
14
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||(B.getGridElements(t).forEach(s=>{s.gridstack||(s.gridstack=new B(s,R.cloneDeep(e))),i.push(s.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
15
15
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const a=i.gridstack;return t&&(a.opts={...a.opts,...t}),t.children!==void 0&&a.load(t.children),a}return(!e.classList.contains("grid-stack")||B.addRemoveCB)&&(B.addRemoveCB?i=B.addRemoveCB(e,t,!0,!0):i=R.createDiv(["grid-stack",t.class],e)),B.init(t,i)}static registerEngine(e){B.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=R.createDiv([this.opts.placeholderClass,ye.itemClass,this.opts.itemClass]);const e=R.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=R.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let s=t.columnOpts?.breakpoints;const o=t;if(o.oneColumnModeDomSort&&(delete o.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),o.oneColumnSize||o.disableOneColumnMode===!1){const h=o.oneColumnSize||768;delete o.oneColumnSize,delete o.disableOneColumnMode,t.columnOpts=t.columnOpts||{},s=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=s.find(m=>m.c===1);f?f.w=h:(f={c:1,w:h},s.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,s=void 0):a.columnMax=a.columnMax||12),s?.length>1&&s.sort((h,f)=>(f.w||0)-(h.w||0));const l={...R.cloneDeep(ye),column:R.toNumber(e.getAttribute("gs-column"))||ye.column,minRow:i||R.toNumber(e.getAttribute("gs-min-row"))||ye.minRow,maxRow:i||R.toNumber(e.getAttribute("gs-max-row"))||ye.maxRow,staticGrid:R.toBool(e.getAttribute("gs-static"))||ye.staticGrid,sizeToContent:R.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||ye.draggable.handle},removableOptions:{accept:t.itemClass||ye.removableOptions.accept,decline:ye.removableOptions.decline}};e.getAttribute("gs-animate")&&(l.animate=R.toBool(e.getAttribute("gs-animate"))),t=R.defaults(t,l),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+t.column),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const c=this.el.closest("."+ye.itemClass)?.gridstackNode;c&&(c.subGrid=this,this.parentGridNode=c,this.el.classList.add("grid-stack-nested"),c.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==ye.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=ve),this._styleSheetClass="gs-id-"+De._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const d=t.engineClass||B.engineClass||De;if(this.engine=new d({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{let f=0;this.engine.nodes.forEach(m=>{f=Math.max(f,m.y+m.h)}),h.forEach(m=>{const _=m.el;_&&(m._removeDOM?(_&&_.remove(),delete m._removeDOM):this._writePosAttr(_,m))}),this._updateStyles(!1,f)}}),this._updateStyles(!1,0),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(h=>this._prepareElement(h)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const h=t.children;delete t.children,h.length&&this.load(h)}this.setAnimation(),t.subGridDynamic&&!H.pauseDrag&&(H.pauseDrag=!0),t.draggable?.pause!==void 0&&(H.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i?.el?t=i.el:B.addRemoveCB?t=B.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const s=this._readAttr(t);return R.defaults(e,s),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=R.createDiv(["grid-stack-item",this.opts.itemClass]),i=R.createDiv(["grid-stack-item-content"],t);return R.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([s])=>{s.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,B.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):B.renderCB(i,e),t}makeSubGrid(e,t,i,s=!0){let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),o.subGrid?.el)return o.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;t=R.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let u;t.column==="auto"&&(u=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let c=o.el.querySelector(".grid-stack-item-content"),d,h;if(s&&(this._removeDD(o.el),h={...o,x:0,y:0},R.removeInternalForSave(h),delete h.subGridOpts,o.content&&(h.content=o.content,delete o.content),B.addRemoveCB?d=B.addRemoveCB(this.el,h,!0,!1):(d=R.createDiv(["grid-stack-item"]),d.appendChild(c),c=R.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const m=u?t.column:o.w,_=o.h+i.h,O=o.el.style;O.transition="none",this.update(o.el,{w:m,h:_}),setTimeout(()=>O.transition=null)}const f=o.subGrid=B.addGrid(c,t);return i?._moving&&(f._isTemp=!0),u&&(f._autoColumn=!0),s&&f.makeWidget(d,h),i&&(i._moving?window.setTimeout(()=>R.simulateMouseEvent(i._event,"mouseenter",f.el),0):f.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),f}removeAsSubGrid(e){const t=this.parentGridNode?.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,t.makeWidget(i.el,i)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>R.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=B.saveCB){const s=this.engine.save(e,i);if(s.forEach(o=>{if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a?.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,o.subGrid?.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=R.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const a=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,a!==void 0?o.alwaysShowResizeHandle=a:delete o.alwaysShowResizeHandle,R.removeInternalAndSame(o,ye),o.children=s,o}return s}load(e,t=B.addRemoveCB||!0){e=R.cloneDeep(e);const i=this.getColumn();e.forEach(c=>{c.w=c.w||1,c.h=c.h||1}),e=R.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let s=0;e.forEach(c=>{s=Math.max(s,(c.x||0)+c.w)}),s>this.engine.defaultColumn&&(this.engine.defaultColumn=s),s>i&&this.engine.cacheLayout(e,s,!0);const o=B.addRemoveCB;typeof t=="function"&&(B.addRemoveCB=t);const a=[];this.batchUpdate();const l=!this.engine.nodes.length;l&&this.setAnimation(!1),!l&&t&&[...this.engine.nodes].forEach(d=>{if(!d.id)return;R.find(e,d.id)||(B.addRemoveCB&&B.addRemoveCB(this.el,d,!1,!1),a.push(d),this.removeWidget(d.el,!0,!1))}),this.engine._loading=!0;const u=[];return this.engine.nodes=this.engine.nodes.filter(c=>R.find(e,c.id)?(u.push(c),!1):!0),e.forEach(c=>{const d=R.find(u,c.id);if(d){if(R.shouldSizeToContent(d)&&(c.h=d.h),this.engine.nodeBoundFix(c),(c.autoPosition||c.x===void 0||c.y===void 0)&&(c.w=c.w||d.w,c.h=c.h||d.h,this.engine.findEmptyPosition(c)),this.engine.nodes.push(d),R.samePos(d,c)&&this.engine.nodes.length>1&&(this.moveNode(d,{...c,forceCollide:!0}),R.copyPos(c,d)),this.update(d.el,c),c.subGridOpts?.children){const h=d.el.querySelector(".grid-stack");h&&h.gridstack&&h.gridstack.load(c.subGridOpts.children)}}else t&&this.addWidget(c)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?B.addRemoveCB=o:delete B.addRemoveCB,l&&this.opts?.animate&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const s=R.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/s)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e,t=!0){if(t&&e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const s=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+s}const i=R.parseHeight(e);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),t&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const t=this.getColumn();let i=t;const s=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(s/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&s<=e.breakpoints[o].w;)i=e.breakpoints[o++].c||t}if(i!==t){const o=e.breakpoints?.find(a=>a.c===i);return this.column(i,o?.layout||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+e),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),delete this.parentGridNode?.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let s;t?s={top:i.top+document.documentElement.scrollTop,left:i.left}:s={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-s.left,a=e.top-s.top,l=i.width/this.getColumn(),u=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,s){return this.engine.isAreaEmpty(e,t,i,s)}makeWidget(e,t){const i=B.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const s=i.gridstackNode;this._updateContainerHeight(),s.subGridOpts&&this.makeSubGrid(i,s.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(s=>this.on(s,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=s=>t(s):this._gsEventHandler[e]=s=>{s.detail&&t(s,s.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(B.getElements(e).forEach(s=>{if(s.parentElement&&s.parentElement!==this.el)return;let o=s.gridstackNode;o||(o=this.engine.nodes.find(a=>s===a.el)),o&&(t&&B.addRemoveCB&&B.addRemoveCB(this.el,o,!1,!1),delete s.gridstackNode,this._removeDD(s),this.engine.removeNode(o,t,i),t&&s.parentElement&&s.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&B.addRemoveCB&&B.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(s=>{this.prepareDragDrop(s.el),s.subGrid&&i&&s.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){const t=this.opts;return e.acceptWidgets!==void 0&&this._setupAcceptWidget(),e.animate!==void 0&&this.setAnimation(),e.cellHeight&&(this.cellHeight(e.cellHeight,!0),delete e.cellHeight),e.class&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),this.el.classList.add(e.class)),typeof e.column=="number"&&!e.columnOpts&&(this.column(e.column),delete e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0&&(t.minRow=t.maxRow=e.row),e.children?.length&&(this.load(e.children),delete e.children),this.opts={...this.opts,...e},this}update(e,t){return B.getElements(e).forEach(i=>{const s=i?.gridstackNode;if(!s)return;const o={...R.copyPos({},s),...R.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const a=["x","y","w","h"];let l;if(a.some(d=>o[d]!==void 0&&o[d]!==s[d])&&(l={},a.forEach(d=>{l[d]=o[d]!==void 0?o[d]:s[d],delete o[d]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(s.content=o.content,B.renderCB(d,o),s.subGrid?.el&&(d.appendChild(s.subGrid.el),s.subGrid.opts.styleInHead||s.subGrid._updateStyles(!0))),delete o.content}let u=!1,c=!1;for(const d in o)d[0]!=="_"&&s[d]!==o[d]&&(s[d]=o[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(R.sanitizeMinMax(s),l){const d=l.w!==void 0&&l.w!==s.w;this.moveNode(s,l),d&&s.subGrid?s.subGrid.onResize(this.hasAnimationCSS()?s.w:void 0):this.resizeToContentCheck(d,s),delete s._orig}(l||u)&&this._writeAttr(i,s),c&&this.prepareDragDrop(s.el)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const s=i.getCellHeight(!0);if(!s)return;let o=t.h?t.h*s:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector(B.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=t.h?t.h*s-l:a.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const f=t.subGrid.el.getBoundingClientRect(),m=t.subGrid.el.parentElement.getBoundingClientRect();c+=f.top-m.top}else{if(t.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${B.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||u}}if(u===c)return;o+=c-u;let d=Math.ceil(o/s);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&d>h&&(d=h,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){B.resizeToContentCB?B.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return B.getElements(e).forEach(i=>{const s=i.gridstackNode;if(!R.canBeRotated(s))return;const o={w:s.h,h:s.w,minH:s.minW,minW:s.minH,maxH:s.maxW,maxW:s.maxH};if(t){const l=t.left>0?Math.floor(t.left/this.cellWidth()):0,u=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=s.x+l-(s.h-(u+1)),o.y=s.y+u-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=s._orig;this.update(i,o),s._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=R.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,s={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(s)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const e=this.opts.styleInHead?void 0:this.el.parentNode;R.removeStylesheet(this._styleSheetClass,e),delete this._styles}return this}_updateStyles(e=!1,t){if(e&&this._removeStylesheet(),t===void 0&&(t=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,s=this.opts.cellHeightUnit,o=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const a=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=R.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,R.addCSSRule(this._styles,o,`height: ${i}${s}`);const l=this.opts.marginTop+this.opts.marginUnit,u=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,d=this.opts.marginLeft+this.opts.marginUnit,h=`${o} > .grid-stack-item-content`,f=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;R.addCSSRule(this._styles,h,`top: ${l}; right: ${c}; bottom: ${u}; left: ${d};`),R.addCSSRule(this._styles,f,`top: ${l}; right: ${c}; bottom: ${u}; left: ${d};`),R.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${l};`),R.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${u}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-ne`,`right: ${c}; top: ${l}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-e`,`right: ${c}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-se`,`right: ${c}; bottom: ${u}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${d}; top: ${l}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${d}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-sw`,`left: ${d}; bottom: ${u}`)}if(t=t||this._styles._max,t>this._styles._max){const a=l=>i*l+s;for(let l=this._styles._max+1;l<=t;l++)R.addCSSRule(this._styles,`${o}[gs-y="${l}"]`,`top: ${a(l)}`),R.addCSSRule(this._styles,`${o}[gs-h="${l+1}"]`,`height: ${a(l+1)}`);this._styles._max=t}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,s=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=R.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===s){const a=Math.floor(o.h/i);t<a&&(t=a)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+s),e&&!e.grid.engine.batchMode&&R.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(ye.itemClass,this.opts.itemClass);const s=R.shouldSizeToContent(i);return s?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),s&&this.resizeToContentCheck(!1,i),R.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return t.x!==void 0&&t.x!==null&&e.setAttribute("gs-x",String(t.x)),t.y!==void 0&&t.y!==null&&e.setAttribute("gs-y",String(t.y)),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const s in i)t[s]?e.setAttribute(i[s],String(t[s])):e.removeAttribute(i[s]);return this}_readAttr(e,t=!0){const i={};i.x=R.toNumber(e.getAttribute("gs-x")),i.y=R.toNumber(e.getAttribute("gs-y")),i.w=R.toNumber(e.getAttribute("gs-w")),i.h=R.toNumber(e.getAttribute("gs-h")),i.autoPosition=R.toBool(e.getAttribute("gs-auto-position")),i.noResize=R.toBool(e.getAttribute("gs-no-resize")),i.noMove=R.toBool(e.getAttribute("gs-no-move")),i.locked=R.toBool(e.getAttribute("gs-locked"));const s=e.getAttribute("gs-size-to-content");s&&(s==="true"||s==="false"?i.sizeToContent=R.toBool(s):i.sizeToContent=parseInt(s,10)),i.id=e.getAttribute("gs-id"),i.maxW=R.toNumber(e.getAttribute("gs-max-w")),i.minW=R.toNumber(e.getAttribute("gs-min-w")),i.maxH=R.toNumber(e.getAttribute("gs-max-h")),i.minH=R.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="gs-size-to-content"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let t=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),t=!0):t=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(t),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)R.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>R.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(s=>{R.shouldSizeToContent(s)&&this.resizeToContentCBCheck(s.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=R.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return R.getElement(e)}static getElements(e=".grid-stack-item"){return R.getElements(e)}static getGridElement(e){return B.getElement(e)}static getGridElements(e){return R.getElements(e)}_initMargin(){let e,t=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=R.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),this.opts.marginTop===void 0?this.opts.marginTop=t:(e=R.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=R.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=R.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=R.parseHeight(this.opts.marginLeft),this.opts.marginLeft=e.h,delete this.opts.margin),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return _e}static setupDragIn(e,t,i,s=document){t?.pause!==void 0&&(H.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?R.getElements(e,s):e).forEach((a,l)=>{_e.isDraggable(a)||_e.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:(B.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noMove:s.noMove=!0,this.prepareDragDrop(s.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(B.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noResize:s.noResize=!0,this.prepareDragDrop(s.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&B._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return _e.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return _e.droppable(this.el,"destroy"),this;let e,t;const i=(s,o,a)=>{a=a||o;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=a.getBoundingClientRect();a.style.left=f.x+(this.dragTransform.xScale-1)*(s.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(s.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:u,left:c}=a.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;const h={position:{top:u*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/t)),l.y=Math.max(0,Math.round(u/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){_e.off(o,"drag");return}l._willFitPos&&(R.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,s,h,l,t,e)}else this._dragOrResize(a,s,h,l,t,e)};return _e.droppable(this.el,{accept:s=>{const o=s.gridstackNode||this._readAttr(s,!1);if(o?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(s);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=s.matches(l)}if(a&&o&&this.opts.maxRow){const l={w:o.w,h:o.h,minW:o.minW,minH:o.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(s,o,a)=>{let l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(o,a),a=a||o,t=this.cellWidth(),e=this.getCellHeight(!0),!l){const d=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(d){try{l=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const u=l.w||Math.round(a.offsetWidth/t)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=l),o.gridstackNode=l={...l,w:u,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=u,l.h=c,l._temporaryRemoved=!0),B._itemRemoving(l.el,!1),_e.on(o,"drag",i),i(s,o,a),!1}).on(this.el,"dropout",(s,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(o,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(s,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const u=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const d=u&&this.opts.animate;d&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,u&&h?.grid&&h.grid!==this){const m=h.grid;m.engine.removeNodeFromLayoutCache(h),m.engine.removedNodes.push(h),m._triggerRemoveEvent()._triggerChangeEvent(),m.parentGridNode&&!m.engine.nodes.length&&m.opts.subGridDynamic&&m.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,_e.off(o,"drag"),a!==o?(a.remove(),o=a):o.remove(),this._removeDD(o),!u))return!1;const f=l.subGrid?.el?.gridstack;return R.copyPos(l,this._readAttr(this.placeholder)),R.removePositioningStyles(o),c&&(l.content||l.subGridOpts||B.addRemoveCB)?(delete l.el,o=this.addWidget(l)):(this._prepareElement(o,!0,l),this.el.appendChild(o),this.resizeToContentCheck(!1,l),f&&(f.parentGridNode=l,f.opts.styleInHead||f._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...s,type:"dropped"},h&&h.grid?h:void 0,l),d&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!_e.isDroppable(e)&&_e.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>B._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>B._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const s=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||s&&o;if((t||a)&&(i._initDD&&(this._removeDD(e),delete i._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let l,u;const c=(f,m)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,f,m,i,l,u)},d=(f,m)=>{this._dragOrResize(e,f,m,i,l,u)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const m=i.w!==i._orig.w,_=f.target;if(!(!_.gridstackNode||_.gridstackNode.grid!==this)){if(i.el=_,i._isAboutToRemove){const O=e.gridstackNode.grid;O._gsEventHandler[f.type]&&O._gsEventHandler[f.type](f,_),O.engine.nodes.push(i),O.removeWidget(e,!0,!0)}else R.removePositioningStyles(_),i._temporaryRemoved?(R.copyPos(i,i._orig),this._writePosAttr(_,i),this.engine.addNode(i)):this._writePosAttr(_,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,_);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),f.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(m,i))}};_e.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return _e.draggable(e,s?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,s,o,a){if(this.engine.cleanNodes().beginUpdate(s),this._writePosAttr(this.placeholder,s),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=s,s.grid?.el)this.dragTransform=R.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=R.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(s.el=this.placeholder,s._lastUiPosition=i.position,s._prevYPix=i.position.top,s._moving=t.type==="dragstart",delete s._lastTried,t.type==="dropover"&&s._temporaryRemoved&&(this.engine.addNode(s),s._moving=!0),this.engine.cacheRects(o,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-s.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-s.y;_e.resizable(e,"option","minWidth",o*Math.min(s.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(s.minH||1,u)).resizable(e,"option","maxWidth",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,s.x+s.w)).resizable(e,"option","maxHeight",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,s.y+s.h))}}_dragOrResize(e,t,i,s,o,a){const l={...s._orig};let u,c=this.opts.marginLeft,d=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const m=Math.round(a*.1),_=Math.round(o*.1);if(c=Math.min(c,_),d=Math.min(d,_),h=Math.min(h,m),f=Math.min(f,m),t.type==="drag"){if(s._temporaryRemoved)return;const C=i.position.top-s._prevYPix;s._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&R.updateScrollPosition(e,i.position,C);const S=i.position.left+(i.position.left>s._lastUiPosition.left?-d:c),k=i.position.top+(i.position.top>s._lastUiPosition.top?-f:h);l.x=Math.round(S/o),l.y=Math.round(k/a);const E=this._extraDragRow;if(this.engine.collide(s,l)){const b=this.getRow();let T=Math.max(0,l.y+s.h-b);this.opts.maxRow&&b+T>this.opts.maxRow&&(T=Math.max(0,this.opts.maxRow-b)),this._extraDragRow=T}else this._extraDragRow=0;if(this._extraDragRow!==E&&this._updateContainerHeight(),s.x===l.x&&s.y===l.y)return}else if(t.type==="resize"){if(l.x<0||(R.updateScrollResize(t,e,a),l.w=Math.round((i.size.width-c)/o),l.h=Math.round((i.size.height-h)/a),s.w===l.w&&s.h===l.h)||s._lastTried&&s._lastTried.w===l.w&&s._lastTried.h===l.h)return;const C=i.position.left+c,S=i.position.top+h;l.x=Math.round(C/o),l.y=Math.round(S/a),u=!0}s._event=t,s._lastTried=l;const O={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:s.w*o)-c-d,h:(i.size?i.size.height:s.h*a)-h-f};if(this.engine.moveNodeCheck(s,{...l,cellWidth:o,cellHeight:a,rect:O,resizing:u})){s._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,d,f,c),delete s._skipDown,u&&s.subGrid&&s.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const C=t.target;s._sidebarOrig||this._writePosAttr(C,s),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,C)}}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,_e.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const s=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=s,this.opts.removable===!0&&B._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return ug(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}B.renderCB=(r,e)=>{r&&e?.content&&(r.textContent=e.content)},B.resizeToContentParent=".grid-stack-item-content",B.Utils=R,B.Engine=De,B.GDRev="11.5.1";const mg=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],pg={class:"grid-stack-item-content"},gg=Ce(n.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:Ye},columns:{default:mt}},emits:["update-tiles"],setup(r,{expose:e,emit:t}){const i=r,s=t,o=n.ref(null),a=n.ref(new Map(i.tiles.map(m=>[`${m.id}`,m])));let l=null;const u=m=>`[data-id="${m}"]`,c=m=>m.map(_=>{const O=a.value.get(`${_.el?.getAttribute("data-id")}`);if(O)return{...O,layout:{position:{col:Number(_.x),row:Number(_.y)},size:{cols:Number(_.w),rows:Number(_.h)}}}}).filter(_=>_!==void 0),d=(m,_)=>{l&&(c(_).forEach(C=>{a.value.set(`${C.id}`,C)}),s("update-tiles",Array.from(a.value.values())))},h=(m,_)=>{_.forEach(O=>{a.value.delete(`${O.el?.getAttribute("data-id")}`)}),s("update-tiles",Array.from(a.value.values()))};n.onMounted(()=>{o.value&&(l=B.init({margin:5,column:i.columns,cellHeight:i.tileHeight,resizable:{handles:"se, sw"},handle:".tile-header"},o.value),l.on("change",d),l.on("added",d),l.on("removed",h))}),n.onUnmounted(()=>{l&&l.destroy(!1)});const f=m=>{if(l&&o.value){const _=o.value.querySelector(u(m));_&&l.removeWidget(_)}};return n.watch(()=>i.tiles.length,async(m,_)=>{if(m>_&&l){const O=i.tiles.slice(_);for(const C of O)a.value.set(`${C.id}`,C),await n.nextTick(),l.makeWidget(u(C.id),{autoPosition:!0,w:C.layout.size.cols,h:C.layout.size.rows})}}),n.watchEffect(()=>{i.tiles.forEach(m=>{a.value.set(`${m.id}`,m)})}),e({removeWidget:f}),(m,_)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.tiles,O=>(n.openBlock(),n.createElementBlock("div",{key:O.id,class:"grid-stack-item","data-id":`${O.id}`,"data-testid":`grid-stack-item-${O.id}`,"gs-h":O.layout.size.rows,"gs-lazy-load":!0,"gs-w":O.layout.size.cols,"gs-x":O.layout.position.col,"gs-y":O.layout.position.row},[n.createElementVNode("div",pg,[n.renderSlot(m.$slots,"tile",{fitToContent:!1,tile:O},void 0,!0)])],8,mg))),128))],512))}}),[["__scopeId","data-v-a060e0c5"]]),_g=r=>{const e={position:{col:0,row:0},size:r.layout.size};if(r.type==="slottable")return{id:crypto.randomUUID(),type:"slottable",layout:e};const t=r.meta,i={...t,chart:{...t.chart}};return"chart_title"in i.chart&&(i.chart.chart_title=i.chart.chart_title?`Copy of ${i.chart.chart_title}`:""),{id:crypto.randomUUID(),type:"chart",definition:i,layout:e}},yg={key:0,class:"fullscreen-header"},Rg={key:0,class:"tile-container slottable-tile"},Cg=Ce(n.defineComponent({__name:"DashboardRenderer",props:n.mergeModels({context:{},preview:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:n.mergeModels(["edit-tile","tile-time-range-zoom","tiles-loaded"],["update:modelValue"]),setup(r,{expose:e,emit:t}){if(n.useCssVars(w=>({v577760a8:d.value})),r.context.disableCoordination!==!0){const w=Fr();n.provide(Gi,w)}const i=t,s=n.useModel(r,"modelValue"),{i18n:o}=ce.useI18n(),a=n.ref(0),l=n.ref(null),u=n.ref(),c=n.ref(),d=n.ref("scale(1)"),h=new Set,f=n.inject(Te);f||(console.warn("Analytics dashboards require a query bridge supplied via provide / inject."),console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"),console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")),ce.useRequestQueue();const{exportPdf:m,exportState:_}=ce.useExportPdf(c),O=w=>{h.add(w.id);const D=k.value.filter(I=>!b(I)).length;h.size>=D&&i("tiles-loaded",!0)},C=n.computed(()=>{const D=`renderer.trendRange.${A.value.type==="absolute"?"custom":A.value.time_range}`;return o.te(D)?o.t(D):""}),S=(w,D)=>{const I=w.layout.position.row-D.layout.position.row;return I!==0?I:w.layout.position.col-D.layout.position.col},k=n.computed(()=>s.value.tiles.map(w=>{if(V.value&&!w.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",w),w.type==="slottable")return{layout:w.layout,type:w.type,id:w.id??crypto.randomUUID()};let D=w.definition;const I=w.type??"chart",Q=xa(D,C.value);return Q!==D.header_description&&(D={...D,header_description:Q}),{layout:w.layout,meta:D,type:I,id:w.id??crypto.randomUUID()}})),E=w=>{i("edit-tile",w)},b=w=>w.type==="slottable"?!0:w.meta?.chart.type==="slottable",T=w=>w.type==="slottable",U=w=>{if(w.type==="slottable")return w.id;const D=w.meta?.chart;return D&&T(D)?D.id:void 0},z=w=>{try{const D=_g(w);s.value.tiles.push(JSON.parse(JSON.stringify(D)))}catch(D){console.warn(D)}},p=w=>{l.value&&l.value.removeWidget(w.id),h.delete(w.id)},g=()=>{h.clear(),a.value++},y=w=>{const D=w.map(I=>I.type==="slottable"?{id:I.id,type:I.type,layout:I.layout}:{id:I.id,type:I.type,layout:I.layout,definition:I.meta});s.value.tiles=D.sort(S)},v=async()=>{if(d.value="scale(1)",await n.nextTick(),c.value){const{availWidth:w,availHeight:D}=window.screen,{width:I,height:Q}=c.value.getBoundingClientRect(),re=Math.min(D/Q,w/I);d.value=`scale(${re})`}},x=()=>{u.value&&(document.fullscreenElement?document.exitFullscreen():u.value.requestFullscreen())},N=n.ref(!1),K=()=>{N.value=document.fullscreenElement!==null,N.value&&v()},q=n.computed(()=>s.value.preset_filters??[]),{editable:V,enrichedContext:P,queryReady:F,showTileActions:M,timeSpec:A}=ce.useDashboardContext({globalFilters:q,context:n.computed(()=>r.context),isFullscreen:N,preview:n.computed(()=>r.preview)});return e({refresh:g,toggleFullscreen:x,exportPdf:m,pdfExportState:_}),(w,D)=>{const I=n.resolveComponent("KAlert");return n.openBlock(),n.createElementBlock("div",{ref_key:"dashboardContainer",ref:u,class:n.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":N.value}]),onFullscreenchange:K},[n.createElementVNode("div",{ref_key:"layoutContainer",ref:c,class:"layout"},[n.unref(f)&&N.value?(n.openBlock(),n.createElementBlock("div",yg,[n.renderSlot(w.$slots,"fullscreenHeader",{},void 0,!0)])):n.createCommentVNode("",!0),n.unref(f)?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(V)&&!N.value?gg:Ur),{key:2,ref_key:"gridLayoutRef",ref:l,columns:s.value.columns,"tile-height":s.value.tile_height,tiles:k.value,onUpdateTiles:y},{tile:n.withCtx(({tile:Q,fitToContent:re})=>[b(Q)?(n.openBlock(),n.createElementBlock("div",Rg,[n.renderSlot(w.$slots,U(Q),{},void 0,!0)])):(n.openBlock(),n.createBlock(Lr,{key:N.value?`${Q.id}-tile`:`${Q.id}-tile-fullscreen`,"refresh-counter":a.value,"onUpdate:refreshCounter":D[0]||(D[0]=te=>a.value=te),class:"tile-container",context:n.unref(P),definition:Q.meta,"fit-to-content":re,height:Q.layout.size.rows*(s.value.tile_height||n.unref(Ye))+parseInt(n.unref(zi),10),"hide-actions":!n.unref(M),"is-fullscreen":N.value,preview:r.preview,"query-ready":n.unref(F),"tile-id":Q.id,"tile-type":Q.type,onDuplicateTile:te=>z(Q),onEditTile:te=>E(Q),onRemoveTile:te=>p(Q),onTileLoaded:te=>O(Q),onTileTimeRangeZoom:D[1]||(D[1]=te=>i("tile-time-range-zoom",te))},null,8,["refresh-counter","context","definition","fit-to-content","height","hide-actions","is-fullscreen","preview","query-ready","tile-id","tile-type","onDuplicateTile","onEditTile","onRemoveTile","onTileLoaded"]))]),_:3},40,["columns","tile-height","tiles"])):(n.openBlock(),n.createBlock(I,{key:1,appearance:"danger"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(o).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-9925f70d"]]),Eg=n.defineComponent({__name:"DashboardTilePreview",props:{context:{},definition:{},globalFilters:{default:()=>[]},preview:{type:Boolean,default:!1}},emits:["chart-data","tile-time-range-zoom","tile-bounds-change"],setup(r,{expose:e,emit:t}){const i=n.useTemplateRef("root"),s=n.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=E=>{a("tile-time-range-zoom",E)},u=E=>{a("chart-data",E)},c=E=>{a("tile-bounds-change",E)},{i18n:d}=ce.useI18n(),{enrichedContext:h,queryReady:f}=ce.useDashboardContext({globalFilters:n.toRef(()=>r.globalFilters),context:n.toRef(()=>r.context),preview:n.computed(()=>r.preview)}),m=n.computed(()=>Ie(r.definition)),_=n.computed(()=>m.value?"columns"in r.definition.query&&!r.definition.query.columns?.length:!("metrics"in r.definition.query)||!r.definition.query.metrics||r.definition.query.metrics.length===0),O=n.ref(Ye);let C;n.onMounted(()=>{const E=i.value?.parentElement;E&&(O.value=E.getBoundingClientRect().height,C=new ResizeObserver(([b])=>{const{height:T}=b.contentRect;O.value=T}),C.observe(E))}),n.onUnmounted(()=>C?.disconnect());const S=n.ref(0);return e({refresh:()=>{S.value++},getExportData:()=>s.value?.getExportData()}),(E,b)=>{const T=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[_.value?(n.openBlock(),n.createBlock(T,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.title")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.description")),1)]),_:1})):(n.openBlock(),n.createBlock(Lr,{key:1,ref:"dashboard-tile","refresh-counter":S.value,"onUpdate:refreshCounter":b[0]||(b[0]=U=>S.value=U),context:{...n.unref(h),editable:!1},definition:r.definition,height:O.value,"hide-actions":"",preview:r.preview,"query-ready":n.unref(f),"show-refresh":"","tile-id":n.unref(o),onChartData:u,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),Og=r=>{if(r.type!=="chart")return r;const e=r.definition?.query;if(!e)return r;if(e.datasource==="api_usage"){console.warn("[@kong-ui-public/dashboard-renderer] A tile was filtered out for the Basic Tier",r);return}return r},bg=r=>{if(r.type!=="chart"||Ie(r.definition))return r;const e=r.definition?.query;if(!e)return r;const t={...e,datasource:e.datasource==="basic"?"api_usage":e.datasource};return{...r,definition:{...r.definition,query:t}}},wg=(r,e=mt)=>{if(!r.length)return[];let t=0,i=0,s=0;const o=[];for(const a of r){const l=a.layout?.size?.cols??1,u=a.layout?.size?.rows??1;i+l>e&&(t+=s,i=0,s=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,s=Math.max(s,u)}return o},Tg=(r,e)=>{if(e){const s=r.tiles.map(bg);return{...r,tiles:s}}const t=r.tiles.map(Og).filter(s=>s!==void 0),i=wg(t,r.columns);return{...r,tiles:i}},vg=Object.freeze(Object.defineProperty({__proto__:null,default:n.defineComponent({__name:"GeoMapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["bounds-change"],setup(r,{emit:e}){const t=r,i=n.ref(void 0),s=n.computed(()=>i.value?ni.exploreResultToCountryMetrics(i.value):{}),o=n.computed(()=>i.value?i.value?.meta.metric_names&&i.value.meta.metric_names[0]:""),a=n.computed(()=>t.query.limit!==void 0&&t.query.limit>0?t.query.limit:ee.COUNTRIES.length),l=n.computed(()=>{if(!t.query.filters?.find(({field:m,operator:_})=>m==="country_code"&&(_==="not_empty"||_==="empty"||_==="in"))){const m={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],m]}}return t.query}),u=n.computed(()=>{if(!i.value)return"";const f=i?.value?.meta.metric_units,m=i?.value?.meta?.metric_names;return f&&m&&f[m[0]]}),c=f=>{i.value=f},d=e,h=f=>{d("bounds-change",f)};return(f,m)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,"limit-override":a.value,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c},{default:n.withCtx(()=>[n.createVNode(n.unref(ni.AnalyticsGeoMap),{bounds:r.chartOptions.bounds,"country-metrics":s.value,"fit-to-country":r.chartOptions.fit_to_country,metric:o.value,"metric-unit":u.value,"with-legend":r.chartOptions.legend||!1,onBoundsChange:h},null,8,["bounds","country-metrics","fit-to-country","metric","metric-unit","with-legend"])]),_:1},8,["context","limit-override","query","query-ready","refresh-counter"]))}})},Symbol.toStringTag,{value:"Module"}));W.CP_ID_TOKEN=Fi,W.CsvExportModal=sr,W.DASHBOARD_COLS=mt,W.DEFAULT_TILE_HEIGHT=Ye,W.DEFAULT_TILE_REFRESH_INTERVAL_MS=Wi,W.DashboardRenderer=Cg,W.DashboardTilePreview=Eg,W.ENTITY_ID_TOKEN=Lt,W.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Yi,W.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Vi,W.GridLayout=Ur,W.INJECT_DASHBOARD_COORDINATOR=Gi,W.INJECT_QUERY_PROVIDER=Te,W.TIMEFRAME_TOKEN=$i,W.configureAllowedDefinition=Tg,W.getTimeRangeDurationMs=zt,W.isTimeRangeUnsupported=Pt,W.isTreemapCompatible=jt,W.limitTimeRange=qt,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -6370,6 +6370,11 @@ const { i18n: xc } = mn(), pn = (r, e) => {
|
|
|
6370
6370
|
data: r.data ?? [],
|
|
6371
6371
|
// Drill-down: click a group to zoom in, and use the breadcrumb to go back
|
|
6372
6372
|
nodeClick: r.drillDown ? "zoomToNode" : !1,
|
|
6373
|
+
// With drill-down, lift ECharts' zoom ceiling (default max 5, which applies even
|
|
6374
|
+
// with `roam: false`) so tiny nodes on dense charts become readable. A clicked
|
|
6375
|
+
// node fills about 20% of the chart area, which keeps its neighbors in view.
|
|
6376
|
+
// Otherwise keep the defaults
|
|
6377
|
+
...r.drillDown ? { scaleLimit: { max: 1 / 0 }, zoomToNodeRatio: 0.2 } : {},
|
|
6373
6378
|
// Defaults to the full depth
|
|
6374
6379
|
leafDepth: r.leafDepth ?? n(r.data),
|
|
6375
6380
|
// No mouse-wheel zoom or drag-to-pan, so scrolling over the chart scrolls the page
|
|
@@ -6695,7 +6700,7 @@ ${r.valueFormatter ? r.valueFormatter(Number(u)) : String(u)}` : void 0
|
|
|
6695
6700
|
preview: R(() => r.preview)
|
|
6696
6701
|
}), s = Hr(r, "refreshCounter"), o = () => {
|
|
6697
6702
|
O.value = !0, s.value++;
|
|
6698
|
-
}, a = t, u = zr(() => import("./GeoMapRenderer-
|
|
6703
|
+
}, a = t, u = zr(() => import("./GeoMapRenderer-BO6i16Pc.js")), l = Ke(We), c = mt(), { datasourceConfigMap: d, stripUnknownFilters: h } = ht(c), { i18n: f } = ve.useI18n(), _ = Y(), b = Y({ status: "loading" }), v = Y(!1), I = Y(), U = Y(!1), O = Y(!0), E = R(() => r.definition.chart), w = R(() => "chart_title" in E.value ? E.value.chart_title : void 0), M = R(() => r.definition.header_description), G = R(() => E.value.type === "slottable"), m = R(() => $e(r.definition) || ui(r.definition) ? !1 : !("allow_csv_export" in E.value) || E.value.allow_csv_export !== !1), {
|
|
6699
6704
|
exploreLinkKebabMenu: p,
|
|
6700
6705
|
requestsLinkKebabMenu: g,
|
|
6701
6706
|
canShowKebabMenu: x,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/dashboard-renderer",
|
|
3
|
-
"version": "9.1.0",
|
|
3
|
+
"version": "9.1.2-pr.3923.4efef30d7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/dashboard-renderer.umd.js",
|
|
6
6
|
"module": "./dist/dashboard-renderer.es.js",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@kong-ui-public/analytics-chart": "^12.0.
|
|
24
|
+
"@kong-ui-public/analytics-chart": "^12.0.3",
|
|
25
25
|
"@kong-ui-public/analytics-config-store": "^1.4.60",
|
|
26
26
|
"@kong-ui-public/analytics-geo-map": "^1.9.56",
|
|
27
27
|
"@kong-ui-public/analytics-metric-provider": "^11.6.67",
|
|
28
28
|
"@kong-ui-public/analytics-utilities": "^13.1.0",
|
|
29
|
-
"@kong-ui-public/echarts": "^0.7.
|
|
29
|
+
"@kong-ui-public/echarts": "^0.7.5-pr.3923.4efef30d7.0",
|
|
30
30
|
"@kong-ui-public/entities-shared": "^3.70.2",
|
|
31
31
|
"@kong-ui-public/i18n": "^2.5.1",
|
|
32
|
-
"@kong-ui-public/sandbox-layout": "^2.7.
|
|
32
|
+
"@kong-ui-public/sandbox-layout": "^2.7.11",
|
|
33
33
|
"@kong-ui-public/table-data-grid": "^0.7.5",
|
|
34
34
|
"@kong/design-tokens": "3.3.1",
|
|
35
35
|
"@kong/icons": "^1.62.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"errorLimit": "2MB"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@kong-ui-public/analytics-chart": "^12.0.
|
|
65
|
+
"@kong-ui-public/analytics-chart": "^12.0.3",
|
|
66
66
|
"@kong-ui-public/analytics-config-store": "^1.4.60",
|
|
67
67
|
"@kong-ui-public/analytics-geo-map": "^1.9.56",
|
|
68
68
|
"@kong-ui-public/analytics-metric-provider": "^11.6.67",
|