@kong-ui-public/dashboard-renderer 9.2.0 → 9.2.1-pr.3923.2760ff225.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-BJCCs2Cy.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-BJCCs2Cy.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"||d.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"&&(S=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,Z){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&&S){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(Z&&!te&&(G=Z==="greedy"?I[X].join("").trim()==="":I[X].length===1&&I[X][0].length===0),Z==="greedy"&&te){for(var ue=[],J=0;J<ae;J++){var se=he?D[J]:J;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&&(!Z||0<ae&&!le)&&(re+=N)}}return re}function w(D,I){var Z,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=(Z=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,d.BAD_DELIMITERS)||-1<re.indexOf(x)||-1<Z.indexOf(K)||re.charAt(0)===" "||re.charAt(re.length-1)===" ")?K+re+K:re)}},d.RECORD_SEP="",d.UNIT_SEP="",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
|
|
10
10
|
`,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!n&&!!i.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=T,d.ParserHandle=O,d.NetworkStreamer=h,d.FileStreamer=f,d.StringStreamer=m,d.ReadableStreamStreamer=_,o&&(i.onmessage=function(p){p=p.data,d.WORKER_ID===void 0&&p&&(d.WORKER_ID=p.workerId),typeof p.input=="string"?i.postMessage({workerId:d.WORKER_ID,results:d.parse(p.input,p.config),finished:!0}):(i.File&&p.input instanceof File||p.input instanceof Object)&&(p=d.parse(p.input,p.config))&&i.postMessage({workerId:d.WORKER_ID,results:p,finished:!0})}),(h.prototype=Object.create(u.prototype)).constructor=h,(f.prototype=Object.create(u.prototype)).constructor=f,(m.prototype=Object.create(m.prototype)).constructor=m,(_.prototype=Object.create(u.prototype)).constructor=_,d})})(ft)),ft.exports}var la=aa(),Ve=(r=>(r.String="string",r.Number="number",r.Boolean="boolean",r.Object="object",r.Undefined="undefined",r))(Ve||{});const ca=["id"],ua=s.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,n=s.computed(()=>`export_${new Date().getTime()}`),o=s.computed(()=>{const u=d();return u.length?u:null}),a=()=>{const u=i.labels;if(typeof i.fields!==Ve.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return u!==null&&typeof u===Ve.Object?h=>Object.fromEntries(Object.entries(h).map(([f,m])=>[u[f]||f,m])):h=>h},l=()=>{const u=i.fields;if(typeof i.fields!==Ve.Object&&!Array.isArray(u))throw new Error("Fields needs to be an array of strings.");return Array.isArray(u)?h=>Object.fromEntries(u.filter(f=>f in h).map(f=>[f,h[f]])):h=>h},d=()=>{if(typeof i.fields===Ve.Undefined&&typeof i.labels===Ve.Undefined)return i.data;const u=a(),h=l();return i.data.map(f=>u(h(f)))},c=()=>{if(!o.value){console.warn("No data to export");return}t("export-started",o.value);let u=la.unparse(o.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
|
|
11
11
|
`+u),i.encoding==="utf-8"&&(u="\uFEFF"+u),t("export-finished",i.filename),!i.testing){const h=new Blob([u],{type:"text/csv;charset="+i.encoding});sa.saveAs(h,i.filename)}};return(u,h)=>(s.openBlock(),s.createElementBlock("div",{id:n.value,"data-testid":"export-csv",onClick:c},[s.renderSlot(u.$slots,"default",{},()=>[s.createTextVNode("Download "+s.toDisplayString(r.filename),1)])],8,ca))}}),da=s.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(r){const e=r,t=s.computed(()=>Object.keys(e.headers));return(i,n)=>(s.openBlock(),s.createElementBlock("div",null,[s.createVNode(ua,{data:r.rows,fields:t.value,filename:r.filename,labels:r.headers},{default:s.withCtx(()=>[s.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 Lt(){const r=at.createI18n("en-us",Hi);return{i18n:r,i18nT:at.i18nTComponent(r)}}const Ye=170,mt=6,ve="analytics-query-provider",Gi="analytics-dashboard-coordinator",Ut="{entity-id}",Fi="{cp-id}",$i="{timeframe}",Wi=30*1e3,Vi=3e5,Yi=36e5;function ha(){const r=s.inject(ve);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var Kt={exports:{}},Xi;function fa(){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 n(d,c,u){this.fn=d,this.context=c,this.once=u||!1}function o(d,c,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var m=new n(u,h||d,f),_=t?t+c:c;return d._events[_]?d._events[_].fn?d._events[_]=[d._events[_],m]:d._events[_].push(m):(d._events[_]=m,d._eventsCount++),d}function a(d,c){--d._eventsCount===0?d._events=new i:delete d._events[c]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},l.prototype.listeners=function(c){var u=t?t+c:c,h=this._events[u];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 u=t?t+c:c,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,u,h,f,m,_){var O=t?t+c:c;if(!this._events[O])return!1;var C=this._events[O],T=arguments.length,k,E;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),T){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,u),!0;case 3:return C.fn.call(C.context,u,h),!0;case 4:return C.fn.call(C.context,u,h,f),!0;case 5:return C.fn.call(C.context,u,h,f,m),!0;case 6:return C.fn.call(C.context,u,h,f,m,_),!0}for(E=1,k=new Array(T-1);E<T;E++)k[E-1]=arguments[E];C.fn.apply(C.context,k)}else{var b=C.length,v;for(E=0;E<b;E++)switch(C[E].once&&this.removeListener(c,C[E].fn,void 0,!0),T){case 1:C[E].fn.call(C[E].context);break;case 2:C[E].fn.call(C[E].context,u);break;case 3:C[E].fn.call(C[E].context,u,h);break;case 4:C[E].fn.call(C[E].context,u,h,f);break;default:if(!k)for(v=1,k=new Array(T-1);v<T;v++)k[v-1]=arguments[v];C[E].fn.apply(C[E].context,k)}}return!0},l.prototype.on=function(c,u,h){return o(this,c,u,h,!1)},l.prototype.once=function(c,u,h){return o(this,c,u,h,!0)},l.prototype.removeListener=function(c,u,h,f){var m=t?t+c:c;if(!this._events[m])return this;if(!u)return a(this,m),this;var _=this._events[m];if(_.fn)_.fn===u&&(!f||_.once)&&(!h||_.context===h)&&a(this,m);else{for(var O=0,C=[],T=_.length;O<T;O++)(_[O].fn!==u||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 u;return c?(u=t?t+c:c,this._events[u]&&a(this,u)):(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})(Kt)),Kt.exports}var ma=fa();const pa=ia(ma);class Mt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,Mt)}}const ji=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function ga(r,e){const{milliseconds:t,fallback:i,message:n,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,d;const u=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&&(d=()=>{f(ji(a))},a.addEventListener("abort",d,{once:!0})),r.then(h,f),t===Number.POSITIVE_INFINITY)return;const m=new Mt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(_){f(_)}return}typeof r.cancel=="function"&&r.cancel(),n===!1?h():n instanceof Error?f(n):(m.message=n??`Promise timed out after ${t} milliseconds`,f(m))},t)}).finally(()=>{u.clear(),d&&a&&a.removeEventListener("abort",d)});return u.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},u}function _a(r,e,t){let i=0,n=r.length;for(;n>0;){const o=Math.trunc(n/2);let a=i+o;t(r[a],e)<=0?(i=++a,n-=o+1):n=o}return i}const ya=100;class Qi{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:n}=t??{},{size:o}=this,a={priority:i,id:n,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=_a(this.#t,a,(d,c)=>c.priority-d.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[n]=this.#t.splice(i,1);this.enqueue(n.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,n)=>n<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>ya&&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 n=this.#t[i];n.priority===e.priority&&t.push(n.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 Ra extends pa{#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],n=this.#c-(e-i);return this.#S(n),!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 n=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),n(),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,n)=>{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 u=e({signal:t.signal});if(t.timeout!==void 0&&(u=ga(Promise.resolve(u),{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;u=Promise.race([u,new Promise((m,_)=>{c=()=>{_(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await u;i(h),this.emit("completed",h)}catch(u){n(u),this.emit("error",u)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#M()})}};this.#i.enqueue(l,t);const d=()=>{if(this.#i instanceof Qi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,u=()=>{a(),d(),n(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",u),this.#E.delete(a)},c.aborted){u();return}c.addEventListener("abort",u,{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=n=>{this.off("error",i),t(n)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(n=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);n()}};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 n=Date.now();this.#O(n),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 Ca=()=>{const r=Ne.useAnalyticsConfigStore(),e=s.inject(ve);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 Ra({carryoverConcurrencyCount:!0,concurrency:r.maxParallelRequests,interval:r.requestInterval,intervalCap:r.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(n,o)=>t.add(()=>e.queryFn(n,o))};s.provide(ve,i)};function Ea(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,n)=>`${n<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
|
|
12
|
-
`)}function Zi(r,...e){return typeof r=="function"?r(...e):r}function Oa({method:r="warn",formatter:e=Ea}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const ba=Error.captureStackTrace;var wa=class Br extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=Br){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,ba?.(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 Ta(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function va(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const n of Object.keys(r.codes)){const o=r.codes[n],a=o.docs===!1?void 0:o.docs||Ta(i,n),l=(d={},c={})=>{const u=new wa({code:n,why:Zi(o.why,d),fix:Zi(o.fix,d),docs:a,cause:d.cause,sources:d.sources},l);for(const h of e)h(u,c);return u};t[n]=l}return t}const Sa=typeof window<"u",xa=va({reporters:[Oa()],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=s.toRaw(r),t={};for(const i in e){const n=e[i];n?.effect?t[i]=s.computed({get:()=>r[i],set(o){r[i]=o}}):(s.isRef(n)||s.isReactive(n))&&(t[i]=s.toRef(r,i))}return t}const Ie=r=>r?.chart.type==="table",Bt=r=>r?.query?.datasource==="requests",zt=r=>!!r&&!Ie(r)&&!Bt(r),Ia=(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},Da=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],ka=r=>Da.includes(r);function Na({queryBridge:r,context:e,definition:t,chartData:i}){const n=s.ref(""),o=s.ref(""),a=s.ref(void 0),l=s.ref(void 0),d=Ne.useAnalyticsConfigStore(),c=Ne.useDatasourceConfigStore(),{stripUnknownFilters:u,loading:h}=Xe(c),f=s.computed(()=>Ie(t.value));s.onMounted(async()=>{n.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const m=s.computed(()=>d.analytics&&d.percentiles),_=s.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=s.computed(()=>o.value&&t.value.query&&!f.value&&t.value.query.datasource!=="llm_usage"&&t.value.query.datasource!=="managed_cache_usage"&&!Q.isPlatformDatasource(t.value.query.datasource)&&m.value&&!h.value),C=s.computed(()=>n.value&&t.value.query&&ka(t.value.query.datasource)&&m.value&&!h.value),T=s.computed(()=>i.value?Q.msToGranularity(i.value.meta.granularity_ms):void 0),k=s.computed(()=>{const y=t.value,S=[...e.value.filters,...y.query.filters??[]],x="metrics"in y.query?y.query.metrics:void 0,N=y.query?.datasource??"api_usage";return u.value({datasource:N,filters:S,queryFields:x})}),E=s.computed(()=>{if(!C.value||!_.value)return"";const y=t.value;if(Ie(y))return g({...y.query,filters:k.value});const S=y.query.time_range||e.value.timeSpec,x=p(S,k.value);return g(x)}),b=s.computed(()=>{if(!O.value||!_.value)return"";const y=k.value,S=t.value;if(Ie(S))return"";const x=U(S.query.time_range||e.value.timeSpec,y);return v(x)}),v=y=>O.value?`${o.value}?q=${JSON.stringify(y)}`:"",U=(y,S)=>{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:S,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,S)=>({filter:S,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,S)=>{const x=t.value;if(!zt(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:S,metrics:K,dimensions:N,time_range:y,granularity:x.query.granularity||T.value||void 0}},g=y=>{if(!C.value)return"";const S=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${n.value}?q=${JSON.stringify(y)}&d=${S}&c=${t.value.chart.type}`};return s.watch([O,C],([y,S])=>{y&&(a.value={href:""}),S&&(l.value={href:""})}),{exploreLinkKebabMenu:E,requestsLinkKebabMenu:b,canShowKebabMenu:_,canGenerateRequestsLink:O,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:z,buildExploreLink:g,buildRequestLink:v}}const Pt=r=>r.type==="relative"?Q.TimePeriods.get(Q.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Aa=r=>r.reduce((e,t)=>{const i=Q.TimePeriods.get(Q.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),qt=(r,e)=>{if(!r||!e?.length)return;const t=Pt(r),i=Aa(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},Ht=(r,e)=>{const t=qt(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 La(){const r=s.inject(ve),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;return s.onUnmounted(()=>{n?.abort()}),{issueQuery:async(a,l,d)=>{if(!r)throw new Error("Query bridge is not defined");n?.abort();const c=new AbortController;n=c,await e.isReady();const{datasource:u,limit:h,...f}=a,m=u||"basic",_=Q.isPlatformDatasource(m),O=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:k})=>!_||!Q.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=Ht(C,t.value[m]?.timeRangeOptions);const T={datasource:m,query:{...f,time_range:C,filters:O,limit:d??h}};return r.queryFn(T,c)}}}const Ua="24H",Ka={status_code:"response_http_status",upstream_status_code:"upstream_status"},Ma={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"},Ba=r=>Q.relativeTimeRangeValuesRequestV2.includes(r),za=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:Ba(t)?t:Ua,...e}},tr=r=>Ka[r]??r,Pa=r=>({metric:tr(r.metric),dimension:r.dimension?tr(r.dimension):void 0,unroll:r.unroll,metricUnit:Ma[r.metric],extraFields:r.extra_fields}),Gt="requests";function qa(){const r=s.inject(ve),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;s.onUnmounted(()=>{n?.abort()});const o=(l,d)=>{const c=l.time_range??d.timeSpec;return Ht(c&&{...c,tz:c.tz??d.tz},t.value[Gt]?.timeRangeOptions)};return{issueRequestsQuery:async(l,d)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");n?.abort();const u=new AbortController;n=u,await e.isReady();const h=i.value({datasource:Gt,filters:[...l.filters??[],...d.filters]});return Q.fetchAllRequests(c,{datasource:Gt,query:{filters:h,time_range:za(o(l,d))}},u,{maxRecords:l.max_records})}}}function Ha({context:r,globalFilters:e=s.ref([]),isFullscreen:t=s.ref(!1),preview:i=s.ref(!1)}){const n=Ne.useAnalyticsConfigStore(),o=Ne.useDatasourceConfigStore(),{loading:a}=Xe(n),{loading:l}=Xe(o),d=s.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:n.defaultQueryTimeForOrg}),c=s.computed(()=>{const{tz:b}=r.value;return b||new Intl.DateTimeFormat().resolvedOptions().timeZone}),u=s.computed(()=>{const{editable:b}=r.value;return b===void 0||i.value?!1:b}),h=s.computed(()=>{const{showTileActions:b}=r.value;return i.value?!1:b===void 0?!0:b}),f=s.computed(()=>[...r.value.filters??[],...e.value]),m=s.computed(()=>{let{refreshInterval:b}=r.value;if(b===void 0&&(b=Wi),t.value){let v=!1;if(d.value.type==="relative")v=["15m","1h","6h","12h","24h"].includes(d.value.time_range);else{const p=d.value.start.getTime(),g=d.value.end.getTime();v=Math.abs(g-p)<=864e5}const U=new Date().getTime();d.value.type==="absolute"&&d.value.end.getTime()<U||d.value.type==="relative"&&["previous_week","previous_month"].includes(d.value.time_range)?b=0:v?b=Vi:b=Yi}return b}),_=s.computed(()=>({filters:f.value,timeSpec:d.value,tz:c.value,refreshInterval:m.value,editable:u.value,showTileActions:h.value})),O=s.computed(()=>!a.value&&!l.value),C=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),T=s.computed(()=>!i.value),k=s.computed(()=>!i.value),E=s.computed(()=>({enabled:C.value,showExploreAction:T.value,showRequestsAction:k.value,showZoomInAction:C.value}));return{editable:u,enrichedContext:_,filters:f,queryReady:O,refreshInterval:m,showTileActions:h,timeSpec:d,tz:c,zoomConfiguration:E}}const Ga=6,ir=6,rr=4;function Fa(r,e){const{pageWidth:t,pageHeight:i,margin:n}=e,o=n+1,a=n+e.headerHeight-3,l=i-n-ir+3,d=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,n,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-n,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,n,o+rr),r.setDrawColor(220),r.line(n,a,t-n,a),r.line(n,l,t-n,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,n,d);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const u=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(u,n+c,d,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(u,n+c,d)),r.setTextColor(120),r.text(e.pageLabel,t-n,d,{align:"right"})}function $a(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,n=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),d=Math.round(a.bottom-i),c=n.get(l);n.set(l,c!==void 0?Math.max(c,d):d)}),[...n.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function Wa(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const d=Math.min(t,e-l);a.push({startY:l,height:d}),l+=d}return a}const n=[];let o=0;for(const a of r){const l=a.top*i,d=a.bottom*i;d-o>t&&(l>o?(n.push({startY:o,height:l-o}),o=l):(n.push({startY:o,height:d-o}),o=d))}return o<e&&n.push({startY:o,height:e-o}),n}function Va(r){const{i18n:e}=Lt(),t=s.ref({status:"idle"});async function i(n={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:d,orientation:c="landscape",pageSize:u="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:_="download",onBeforeCapture:O,onAfterCapture:C}=n,T=r.value;if(!T){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:()=>Q.prepareForCapture(),afterClone:()=>Q.restoreAfterCapture()},v=await k.toCanvas(T,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[b]}),U=$a(T),z=T.getBoundingClientRect().width,p=z?v.width/z:f;t.value={status:"generating"};const g=new Date,y=new E({orientation:c,unit:"mm",format:u}),S=y.internal.pageSize.getWidth(),x=y.internal.pageSize.getHeight(),N=Ga+(l?rr:0),K=S-h*2,q=x-h*2-N-ir,V=v.width/K,P=q*V,F=Wa(U,v.height,P,p),M={title:a,subtitle:l,dashboardUrl:d,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:S,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=v.width,I.height=D,I.getContext("2d").drawImage(v,0,w,v.width,D,0,0,v.width,D),y.addImage(I.toDataURL("image/png"),"PNG",h,h+N,K,D/V),Fa(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{Q.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const Ya=r=>r.toLowerCase().endsWith("count")?"":r;function Xa(){const{i18n:r}=Lt(),{formatUnit:e}=Q.unitFormatter({i18n:r});return t=>{const i=t.meta?.metric_names?.[0]??"",n=t.meta?.metric_units?.[i]??"",o=`chartLabels.${i}`;return{seriesName:r.te(o)?r.t(o):i,valueFormatter:a=>e(a,n,{translateUnit:Ya})}}}const ce={useContextLinks:Na,useDashboardContext:Ha,useEvaluateFeatureFlag:ha,useExportPdf:Va,useI18n:Lt,useIssueQuery:La,useIssueRequestsQuery:qa,useMetricFormatter:Xa,useRequestQueue:Ca},ja={class:"kong-ui-public-csv-export-modal"},Qa={key:0,class:"selected-range"},Za={key:4,class:"text-muted",tag:"span"},nr=3,sr=s.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=ce.useI18n(),i=r,n=e,o=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=s.ref(1),l=s.computed(()=>f.value.rows.length),d=s.computed(()=>i.exportState.status==="success"&&!!i.exportState.chartData?.data?.length),c=s.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:Q.formatTimestamp(new Date(_),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${Q.formatTimestamp(new Date(_))} - ${Q.formatTimestamp(new Date(O),{includeTZ:!0})}`}),u=s.computed(()=>i.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(nr,l.value),rowsTotal:l.value,plural:l.value===1?"":"s"})),h=()=>{n("closeModal")},f=s.computed(()=>{if(i.exportState.status!=="success"||!d.value||!i.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const _=i.exportState.chartData,O=_.data.some(v=>v.timestamp!==_.data[0].timestamp),C=_.data.map(v=>{const U=new Date(v.timestamp);return{...Object.keys(v.event).reduce((p,g)=>{if(g in _.meta.display){const y=v.event[g],S=_.meta.display[g];p[g]=y&&S?.[y]?.name||v.event[g]}else p[g]=v.event[g];return p},{}),...O?{timestamp:Nt(U,"yyyy-MM-dd HH:mm:ss"),tzOffset:Nt(U,"XXX")}:{}}});let T=[];O&&(T=[{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=[...T,...Object.keys(k).map(v=>({label:t.t(`chartLabels.${v}`),key:v})),...i.exportState.chartData.meta.metric_names.map(v=>({label:t.t(`chartLabels.${v}`),key:v}))],b=E.reduce((v,U)=>(v[U.key]=U.label,v),{});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 s.watch(f,()=>{a.value++}),(_,O)=>{const C=s.resolveComponent("KSkeleton"),T=s.resolveComponent("KEmptyState"),k=s.resolveComponent("KTableData"),E=s.resolveComponent("KTooltip"),b=s.resolveComponent("KButton"),v=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",ja,[s.createVNode(v,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:s.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:s.withKeys(h,["esc"])},{default:s.withCtx(()=>[s.createElementVNode("div",null,[r.exportState.status==="success"&&d.value?(s.openBlock(),s.createElementBlock("div",Qa,[s.createElementVNode("p",null,s.toDisplayString(r.modalDescription?r.modalDescription:s.unref(t).t("csvExport.exportDescription")),1),s.createElementVNode("p",null,s.toDisplayString(c.value),1)])):s.createCommentVNode("",!0),r.exportState.status==="loading"?(s.openBlock(),s.createBlock(C,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(s.openBlock(),s.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":s.withCtx(()=>[s.createVNode(T,{"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRange")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):r.exportState.status==="error"?(s.openBlock(),s.createBlock(T,{key:3,"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.dataError")),1)]),_:1})):s.createCommentVNode("",!0),r.exportState.status==="success"&&d.value?(s.openBlock(),s.createElementBlock("div",Za,[s.createTextVNode(s.toDisplayString(u.value)+" ",1),s.createVNode(E,{class:"preview-tooltip",placement:"right",text:s.unref(t).t("csvExport.maximumRecordAmount",{value:s.unref(Q.EXPORT_RECORD_LIMIT)})},{default:s.withCtx(()=>[s.createVNode(s.unref(ie.InfoIcon),{color:`var(--kui-color-text-neutral, ${s.unref(At)})`,size:`var(--kui-icon-size-30, ${s.unref(ta)})`},null,8,["color","size"])]),_:1},8,["text"])])):s.createCommentVNode("",!0)])]),"footer-actions":s.withCtx(()=>[s.createVNode(b,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.cancelButton")),1)]),_:1}),s.createVNode(da,{class:"vitals-report-export-button",filename:o,headers:f.value.csvHeaders,rows:f.value.rows},{default:s.withCtx(()=>[s.createVNode(b,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!d.value},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.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 Ja=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=s.ref({}),e,t,i=Ja){const n=s.ref("PENDING");return s.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){n.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){n.value="VALIDATING";return}if(r.value&&e.value){n.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){n.value="PENDING";return}if(r.value&&!e.value&&o){n.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){n.value="SUCCESS";return}r.value===void 0&&e&&(n.value="ERROR")}),{state:n,swrvState:or}}const Ke=s.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:n}=ce.useI18n(),{issueQuery:o}=ce.useIssueQuery(),a=s.inject(ve),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:d,error:c,isValidating:u}=ii(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=we.handleQueryError(E),E}finally{l()===k&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=ar(d,c,u),m=s.ref(null),_=s.computed(()=>h.value===f.ERROR||!!m.value),O=s.computed(()=>!t.queryReady||h.value===f.PENDING),C=s.ref(),T=s.computed(()=>d.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return s.watch([()=>d.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=s.resolveComponent("KSkeleton"),v=s.resolveComponent("KEmptyState");return(O.value||!s.unref(d)&&!_.value)&&!T.value?(s.openBlock(),s.createBlock(b,{key:0,class:"chart-skeleton",type:"table"})):_.value&&!O.value?(s.openBlock(),s.createBlock(v,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[m.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(ie.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(ie.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(m.value?.message||s.unref(n).t("renderer.unexpectedError")),1)]),_:2},[m.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(m.value.details),1)]),key:"0"}:void 0]),1024)):T.value?s.renderSlot(k.$slots,"default",{data:T.value},void 0,void 0,2):s.createCommentVNode("",!0)}}}),el=s.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=s.computed(()=>e.chartOptions.type==="single_value"),i=s.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend"}:e.chartOptions);return(n,o)=>(s.openBlock(),s.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:s.withCtx(({data:a})=>[s.createElementVNode("div",{class:s.normalizeClass(["analytics-chart",{"single-value":t.value}]),style:s.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[s.createVNode(s.unref(we.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,n]of e)t[i]=n;return t},lr=Ce(el,[["__scopeId","data-v-22077b88"]]),tl={class:"analytics-chart"},Ft=Ce(s.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:n}=ce.useI18n(),o=s.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")},d=c=>{i("chart-data",c)};return(c,u)=>{const h=s.resolveComponent("KDropdownItem");return s.openBlock(),s.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:d},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",tl,[s.createVNode(s.unref(we.AnalyticsChart),s.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:u[0]||(u[0]=m=>i("select-chart-range",m)),onZoomTimeRange:u[1]||(u[1]=m=>i("zoom-time-range",m))}),s.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:s.withCtx(()=>[s.createVNode(h,{onClick:l},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).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=s.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(s.openBlock(),s.createBlock(Ft,{"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"]))}}),il={class:"analytics-chart"},rl={key:3,class:"analytics-chart"},nl=Ce(s.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:n}=ce.useI18n(),{issueRequestsQuery:o}=ce.useIssueRequestsQuery(),a=s.computed(()=>t.query.datasource==="requests"),l=s.computed(()=>{const b=t.query,v=b.time_range??t.context.timeSpec,U=v?Pt(v):void 0;if(!U)return b;const z=Q.finestGranularityForDuration(U);let p;return b.granularity&&Q.Granularities[b.granularity]>=Q.Granularities[z]?p=b.granularity:p=z,{...b,granularity:p}}),d=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=s.ref(null),{data:u,error:h,isValidating:f}=ii(d,async()=>{const b=d(),v=t.query;try{const U=await o(v,t.context);return d()!==b?void 0:(c.value=null,we.requestsToScatterData(U,Pa(v)))}catch(U){if(d()!==b)return;throw c.value=we.handleQueryError(U),U}finally{d()===b&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:_}=ar(u,h,f),O=s.ref(),C=s.computed(()=>u.value??O.value);s.watch(u,b=>{b&&(O.value=b)});const T=s.computed(()=>m.value===_.ERROR||!!c.value),k=s.computed(()=>!T.value&&(!t.queryReady||m.value===_.PENDING)&&!C.value),E=s.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,v)=>{const U=s.resolveComponent("KSkeleton"),z=s.resolveComponent("KEmptyState");return a.value?k.value?(s.openBlock(),s.createBlock(U,{key:1,class:"chart-skeleton",type:"table"})):T.value?(s.openBlock(),s.createBlock(z,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[c.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(ie.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(ie.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value?.message||s.unref(n).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):C.value?(s.openBlock(),s.createElementBlock("div",rl,[s.createVNode(s.unref(we.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"])])):s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(Ke,{key:0,context:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:v[0]||(v[0]=p=>i("chart-data",p)),onQueryComplete:v[1]||(v[1]=p=>i("query-complete"))},{default:s.withCtx(({data:p})=>[s.createElementVNode("div",il,[s.createVNode(s.unref(we.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=s.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,n)=>(s.openBlock(),s.createBlock(Ft,{"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:n[0]||(n[0]=o=>t("select-chart-range",o)),onZoomTimeRange:n[1]||(n[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"]))}}),sl=Ce(s.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=s.computed(()=>{const n=e.query?.datasource;if(n&&n!=="api_usage"&&n!=="basic")throw new Error(`Invalid datasource value: ${n}`);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=s.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(n,o)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[s.createVNode(s.unref(ri.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(ri.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 ol=r=>!!r?.length;function al(r,e,t,i=ol){const n=s.computed(()=>i(r.value)),o=s.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":n.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:rt,hasData:n,state:o}}const ll=({emitState:r,fetchLifecycleState:e,hasData:t})=>{s.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:n})=>{if(n!==rt.PENDING){if(n===rt.LOADING){r({hasData:i,state:"loading"});return}if(n===rt.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},cl=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},ul=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:n})=>{if(typeof i=="number")return i;if(n!==!0&&(n===!1||e<t))return r+e},dl=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,n=new Map,o=s.ref(0),a=s.ref(0),l=s.shallowRef(),d=s.shallowRef(),c=s.shallowRef(),u=s.ref(0),h=s.ref(!1);let f,m,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;const C=K=>K===o.value&&f===r.value&&m===e?.value,T=(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=u.value>0},b=()=>{a.value+=1,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;for(const K of n.values())K.resolve(!1);i.clear(),n.clear(),d.value=void 0,c.value=void 0,u.value=0,E()},v=()=>{c.value=void 0,u.value+=1,E()},U=()=>{u.value=Math.max(0,u.value-1),E()},z=K=>{const q=n.get(K);if(q)return q;let V;const P={promise:new Promise(F=>{V=F}),resolve:F=>V(F)};return n.set(K,P),P},p=(K,q)=>{q.resolve(!1),n.get(K)===q&&n.delete(K)},g=async({blockIndex:K,currentBlockCompletion:q,datasourceId:V,requestGeneration:P})=>{if(K===0)return"ready";const F=n.get(K-1);if(!F)return p(K,q),"failed";const M=await F.promise;return T(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,ul({startRow:V.startRow,rowsLength:F.data.length,pageSize:P,total:F.total,hasMore:F.hasMore})),V.startRow===0&&(d.value=F.data),q.resolve(!0)},S=({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}=cl({startRow:V.startRow,endRow:V.endRow});P===0&&n.has(0)&&b();const M=a.value,A=z(P);if(await g({blockIndex:P,currentBlockCompletion:A,datasourceId:q,requestGeneration:M})!=="ready"||!T(q,M)){V.failCallback(),p(P,A);return}v();try{const w=P>0?i.get(P-1):void 0,D=await K({mode:"infinite",pageSize:F,cursor:w,sort:t?.value});if(!T(q,M)){V.failCallback(),p(P,A);return}y({blockIndex:P,currentBlockCompletion:A,getRowsParams:V,pageSize:F,result:D})}catch(w){if(!T(q,M)){V.failCallback(),p(P,A);return}S({blockIndex:P,currentBlockCompletion:A,fetchError:w,getRowsParams:V})}finally{T(q,M)&&U()}}}},N=()=>{l.value=x()};return s.watch([r,()=>e?.value],()=>{N()},{immediate:!0}),s.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>b()),{datasource:s.readonly(l),data:s.shallowReadonly(d),error:s.readonly(c),isFetching:s.readonly(h)}},hl={title:"No Data",message:"There is no data to display."},fl={title:"An error occurred",message:"Data cannot be displayed due to an error."},ml={emptyState:hl,errorState:fl};function dr(){const r=at.createI18n("en-us",ml);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:pl}=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,gl=(r,e)=>r.reduce((t,i)=>{const n=pt(Reflect.get(i,e.key));return n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)}},{sum:0,max:0}),_l=(r,e)=>{const t=(e??[]).filter(n=>Number.isFinite(n.value)&&r>=n.value);if(!t.length)return;const i=Math.max(...t.map(n=>n.value));return t.filter(n=>n.value===i).some(n=>n.type==="error")?"error":"warning"},yl=(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},Rl=r=>{const e=t=>pl.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)??Rl(i)},mr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Cl=({rows:r,header:e,stats:t})=>r.reduce((i,n)=>({value:mr(i.value,hr(e,n))??"",relative:e.showPercentage?mr(i.relative,fr({value:pt(Reflect.get(n,e.key)),stats:t,header:e})):void 0}),{value:""}),El=["data-threshold"],Ol={class:"table-data-grid-cell-label-track"},bl={class:"table-data-grid-cell-label"},wl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},Tl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},vl=["data-text"],Sl=["data-text"],xl=["data-threshold"],Il=s.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=s.shallowRef(r.params),i=s.ref(null),n=s.ref(!1),o=s.computed(()=>t.value.headerDef??{key:"",label:""}),a=s.computed(()=>t.value.context?.presentation),l=s.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),d=s.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=s.computed(()=>t.value.value),u=s.computed(()=>pt(c.value)),h=s.computed(()=>a.value?.stats[o.value.key]),f=s.computed(()=>o.value.showPercentage&&h.value?fr({value:u.value,stats:h.value,header:o.value}):void 0),m=s.computed(()=>!!o.value.bar&&!!h.value&&(u.value!==null||c.value===null||c.value===void 0)),_=s.computed(()=>m.value&&h.value?yl(u.value,h.value,o.value.bar)*100:0),O=s.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),C=s.computed(()=>o.value.thresholds?.length&&u.value!==null?_l(u.value,o.value.thresholds):void 0),T=s.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:S})=>{const x=t.value.colDef?.colId,N=t.value.context?.cells?.slots;return!x||x==="cell-icon"||!N?.[x]?S.default?.():s.h("span",{class:"table-data-grid-cell-slot-content"},s.renderSlot(N,x,T.value,()=>S.default?.()??[]))},E=()=>{const y=t.value.context?.cells?.slots;return y?.["cell-icon"]?s.renderSlot(y,"cell-icon",T.value):null};let b,v,U=!1;const z=()=>{const y=i.value;n.value=!!y&&y.scrollWidth>y.clientWidth},p=()=>{U||(v!==void 0&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=void 0,z()}))},g=y=>{if(b?.disconnect(),y){b?.observe(y);const S=y.closest(".ag-cell");S&&b?.observe(S)}p()};return s.onMounted(()=>{b=new ResizeObserver(p),g(i.value)}),s.watch(i,g),s.onUnmounted(()=>{U=!0,b?.disconnect(),v!==void 0&&cancelAnimationFrame(v)}),e({refresh(y){return t.value=y,s.nextTick(p),!0}}),(y,S)=>{const x=s.resolveComponent("KTooltip");return s.openBlock(),s.createElementBlock("span",{class:s.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},[s.createElementVNode("span",Ol,[s.createElementVNode("span",bl,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(E))),(s.openBlock(),s.createBlock(s.resolveDynamicComponent(k),null,{default:s.withCtx(()=>[s.createVNode(x,{class:"table-data-grid-cell-tooltip",disabled:!n.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:d.value},{default:s.withCtx(()=>[s.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},s.toDisplayString(d.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(s.openBlock(),s.createElementBlock("span",wl,"("+s.toDisplayString(f.value)+")",1)):s.createCommentVNode("",!0)]),O.value?(s.openBlock(),s.createElementBlock("span",Tl,[s.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":O.value.value},null,8,vl),O.value.relative?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${O.value.relative})`},null,8,Sl)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]),m.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":C.value},[s.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:s.normalizeStyle({width:`${_.value}%`})},null,4)],8,xl)):s.createCommentVNode("",!0)],10,El)}}}),Dl=({headers:r,slots:e,initialSort:t,mode:i,rows:n,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,d=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);s.watch([r,()=>n?.value],()=>{r.value.forEach(m=>{if(!d(m))return;let _;if(a==="infinite"&&(m.showPercentage||m.bar)?_="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&n?.value?.some(C=>{const T=Reflect.get(C,m.key);return T!=null&&pt(T)===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=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(_=>_.showPercentage||_.bar).map(_=>[_.key,gl(m,_)]))}),u=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(_=>_.bar).map(_=>[_.key,Cl({rows:m,header:_,stats:c.value[_.key]})]))}),h=s.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:u.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:Il,cellRendererParams:{headerDef:m}}};return{columnDefs:s.computed(()=>r.value.map(f)),gridContext:h}},$t=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),n=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:n,sortColumnOrder:n?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,kl=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:n,onExternalConfigChange:o})=>{const a=s.computed(()=>t.value?$t({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=s.ref(a.value??$t({config:void 0,headers:r.value,pageSize:e.value}));s.watch(a,h=>{h&&!pr(h,l.value)&&(l.value=h,o?.(h))});const d=h=>{const f=$t({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,n(f))};s.watch(r,()=>{t.value||d({})},{deep:!0});const c=s.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),u=s.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:s.readonly(l),activeSort:c,activePageSize:u,patchTableConfig:d}},Nl=({cellClick:r,headers:e,rowClick:t})=>{const i=s.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),n=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=n(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)}}},Al=({activeSort:r,patchTableConfig:e})=>{const t=(i,n)=>{i.applyColumnState({state:n.sortColumnKey?[{colId:n.sortColumnKey,sort:n.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const n=i.api.getColumnState().filter(l=>l.sort).sort((l,d)=>(l.sortIndex??0)-(d.sortIndex??0)),o=n[n.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),n.length>1&&t(i.api,a)},applySortToGrid:t}},Ll={key:0,class:"table-error-state","data-testid":"table-error-state"},Ul={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Kl=s.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:n}=dr(),{t:o}=n,a=s.useSlots(),l=s.shallowRef(),d=s.useTemplateRef("rootElement"),c=s.shallowRef("body"),u=()=>{const A=document.fullscreenElement;c.value=A instanceof HTMLElement&&A.contains(d.value??null)?A:"body"};s.onMounted(()=>{u(),document.addEventListener("fullscreenchange",u)}),s.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",u)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:_}=kl({headers:s.toRef(()=>r.headers),pageSize:s.toRef(()=>r.pageSize),tableConfig:s.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}=Al({activeSort:f,patchTableConfig:_}),T=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Qe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:b}=Nl({cellClick:A=>i("cell:click",A),headers:s.toRef(()=>r.headers),rowClick:(A,w)=>i("row:click",A,w)}),v={resizable:!1,sortable:!1,suppressMovable:!0},U=s.computed(()=>[m.value,r.refreshKey]),z=t==="infinite"?dl({fetcher:s.toRef(()=>r.fetcher),resetKey:U,sort:f}):void 0,p=z?.datasource,g=s.computed(()=>z?z.data.value:r.rows),y=s.computed(()=>z?.isFetching.value??!1),S=s.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:x,gridContext:N}=Dl({headers:s.toRef(()=>r.headers),mode:t,rows:S,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:q,state:V}=al(g,s.toRef(()=>z?.error.value),y),P=s.computed(()=>V.value===K.SUCCESS&&!q.value);z&&ll({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)};s.watch([l,f],F);const M=A=>{l.value=A.api,i("grid:ready",A.api)};return(A,w)=>{const D=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"rootElement",ref:d,class:s.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":T.value}]),"data-testid":"table-data-grid"},[r.error?(s.openBlock(),s.createElementBlock("div",Ll,[s.renderSlot(A.$slots,"error-state",{},()=>[s.createVNode(D,{"icon-variant":"error",message:s.unref(o)("errorState.message"),title:s.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):P.value?(s.openBlock(),s.createElementBlock("div",Ul,[s.renderSlot(A.$slots,"empty-state",{},()=>[s.createVNode(D,{message:s.unref(o)("emptyState.message"),title:s.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(s.openBlock(),s.createBlock(s.unref(zr.AgGridVue),{key:2,"cache-block-size":s.unref(t)==="infinite"?s.unref(m):void 0,class:"table-data-grid-grid","column-defs":s.unref(x),context:s.unref(N),datasource:s.unref(t)==="infinite"?s.unref(p):void 0,"default-col-def":v,"dom-layout":T.value?"autoHeight":"normal","infinite-initial-row-count":s.unref(t)==="infinite"?1:void 0,loading:y.value,"row-data":s.unref(t)==="unpaginated"?S.value:void 0,"row-model-type":s.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:s.unref(k),onCellClicked:s.unref(E),onGridReady:M,onNewColumnsLoaded:F,onRowClicked:s.unref(b),onSortChanged:s.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)}}}),Ml=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},gr=Ml(Kl,[["__scopeId","data-v-01cd8bcd"]]),_r=3,Bl={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},Wt=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},zl=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!(Wt(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Bl[t.toLowerCase()]},Pl=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},ql=r=>r.toLocaleLowerCase().endsWith("count"),Hl=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,_r),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const n={record:i};return e.forEach(o=>{n[o]=i.event[o]}),t.forEach(o=>{n[o]=Pl(i.event[o])}),n})},Gl=({data:r,columnOptions:e,i18n:t})=>{const{formatUnit:i}=Q.unitFormatter({i18n:t}),n=r?.data??[],o=r?.meta,a=o?.display??{},l=Object.keys(a).slice(0,_r),d=o?.metric_names??[],c=d[0],u=l.length>1,h=E=>{const b=`chartLabels.${E}`;return t.messages[b]?t.formatMessage({id:b}):E},f=(E,b)=>Wt(e,E)?.label||b,m=(E,b)=>{if(ql(E)||E==="requests")return"";const v=b===1?"":"s",U=`chartUnits.${E}`;return t.messages[U]?t.formatMessage({id:U},{plural:v}):E},_=E=>{const b=v=>i(v,"%",{translateUnit:m});return E>0&&E<.01?`< ${b(.01)}`:b(E)},O=(E,b)=>{const v=E.event[b];if(v==null)return"–";const U=typeof v=="number"?v:Number(v);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 v=String(E.record.event[b]),U=a[b]?.[v];return{id:v,label:U?.name||"-",deleted:!!U?.deleted}},T=l.map(E=>({key:E,label:f(E,u?h(E):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(b,v)=>C(v,E).label,sortable:!1}));d.forEach(E=>{const b=Wt(e,E);T.push({key:E,label:b?.label||h(E),type:"metric",valueFormatter:(v,U)=>O(U.record,E),showPercentage:b?.value==="relative",percentageFormatter:_,bar:b?.bar==="max"?"absolute":b?.bar,thresholds:b?.thresholds,sortable:!1})});const k=n.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:T,errorMessage:k,getDimension:C}},Fl={class:"fallback-entity-link","data-testid":"entity-link-parent"},yr=s.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Fl,s.toDisplayString(r.entityLinkData.label),1))}}),$l=["data-testid"],Wl={key:1},Vl=Ce(s.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=s.inject(ve),{i18n:t}=ce.useI18n(),i=s.computed(()=>Hl(r.data)),n=s.computed(()=>Gl({data:r.data,columnOptions:r.chartOptions.column_options,i18n:t})),o=s.computed(()=>n.value.headers.map(_=>({..._,minWidth:_.type==="dimension"?160:_.bar?260:140}))),a=s.computed(()=>n.value.headers.filter(_=>_.type==="dimension")),l=s.computed(()=>({fitToContent:r.fitToContent})),d=s.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),c=(_,O)=>zl({columnOptions:r.chartOptions.column_options,columnKey:_,rawValue:O}),u=s.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),T=String(_[O]);if(T.includes(":")){const[k,E]=T.split(":");return C.replace(Fi,k).replace(Ut,E)}return C.replace(Ut,T)};return(_,O)=>{const C=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{class:"top-n-data-grid","data-testid":i.value.length?"top-n-table":void 0,style:s.normalizeStyle(d.value)},[s.createVNode(s.unref(gr),{error:!!n.value.errorMessage,headers:o.value,mode:"unpaginated",rows:i.value,"table-config":l.value},s.createSlots({"error-state":s.withCtx(()=>[s.createVNode(C,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(ie.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(n.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(C,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:s.unref(t).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":s.withCtx(({column:T,rowValue:k})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(c(T.key,k)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[s.renderList(a.value,T=>({name:T.key,fn:s.withCtx(({row:k})=>[f(T.key)&&k[T.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(u),{key:0,class:"top-n-entity-link","entity-link-data":n.value.getDimension(k,T.key),"external-link":m(k,T.key)},null,8,["entity-link-data","external-link"])):n.value.getDimension(k,T.key).label==="empty"?(s.openBlock(),s.createElementBlock("i",Wl,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,$l)}}}),[["__scopeId","data-v-f6b76589"]]),Yl=s.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)=>(s.openBlock(),s.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:s.withCtx(({data:i})=>[s.createVNode(Vl,{"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"]))}}),Xl=s.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,n=s.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=s.computed(()=>new Map(n.value.map((c,u)=>[c,o(t.chartOptions.columns[u])]))),l=new Set,d=c=>{l.add(c),l.size===n.value.length&&(l.clear(),i("query-complete"))};return s.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,u)=>(s.openBlock(),s.createBlock(s.unref(we.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:n.value,"size-metric":r.chartOptions.size_metric},{column:s.withCtx(({column:h})=>[s.createVNode(Ke,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>d(h)},{default:s.withCtx(({data:f})=>[s.createVNode(s.unref(we.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"]))}}),jl=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,n])=>{if(n===null)return;const o=r.meta.display?.[i]?.[String(n)]?.name;o&&(t[i]=o)}),t}),Rr=({canTranslate:r,columns:e,translate:t})=>e.map(i=>{const n=`chartLabels.${i}`;return{key:i,label:r(n)?t(n):i}}),Ql={platform:Rr,platform_usage:Rr},Cr=async({abortController:r,context:e,cursor:t,pageSize:i,query:n,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const d=n.query,c=a({datasource:n.datasource,filters:[...d.filters??[],...e.filters],queryFields:d.entity===void 0?void 0:[d.entity]}),u=await l({datasource:n.datasource,query:{columns:d.columns,cursor:t===void 0?d.cursor:String(t),entity:d.entity,filters:c,page_size:i}},r);return u.meta.columns?.length&&o?.(u.meta.columns),{data:jl(u),cursor:u.meta.cursor,hasMore:!!u.meta.cursor}},Zl={platform:Cr,platform_usage:Cr},Jl=Ce(s.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,n=s.inject(ve),o=Ne.useDatasourceConfigStore(),{i18n:a}=ce.useI18n(),l=new AbortController,d=s.ref([]),c=s.ref(!1),u=s.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=s.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=s.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}}));s.onUnmounted(()=>{l.abort()});const m=s.computed(()=>Ql[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:d.value,translate:C=>a.t(C),canTranslate:C=>a.te(C)})),_=s.computed(()=>async({cursor:C,pageSize:T})=>{try{await o.isReady();const k=Zl[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:T,query:h.value,onResponseColumns:b=>{d.value=b},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:n?.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,T)=>{const k=s.resolveComponent("KSkeleton");return s.openBlock(),s.createElementBlock("div",{class:"table-data-grid-renderer",style:s.normalizeStyle(u.value)},[r.queryReady?(s.openBlock(),s.createBlock(s.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"])):(s.openBlock(),s.createBlock(k,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c49ff2eb"]]),ec=s.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(s.openBlock(),s.createBlock(Ft,{"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"]))}}),tc="#ffffff",ic="#0044f4",rc="#d60027",nc="#ad000e",sc="#850000",oc="#5c0000",ac="#ff3954",lc="#ffabab",cc="#ffe5e5",uc="#ecfcff",dc="#6f28ff",hc="#f1f0ff",fc="#e0e4ea",mc="#0044f4",pc="#0030cc",gc="#002099",_c="#001466",yc="#5f9aff",Rc="#bee2ff",Cc="#eefaff",Ec="#0d0e14",Oc="#6c7489",bc="#52596e",wc="#3a3f51",Tc="#232633",vc="#afb7c5",Sc="#e0e4ea",xc="#f9fafb",Ic="rgba(13, 14, 20, 0.6)",Dc="#0044f4",kc="#0030cc",Nc="#002099",Ac="#001466",Lc="#5f9aff",Uc="#bee2ff",Kc="#eefaff",Mc="#007d60",Bc="#005944",zc="#004737",Pc="#003629",qc="#00d6a4",Hc="#b5ffee",Gc="#ecfffb",Fc="rgba(0, 0, 0, 0)",$c="#995c00",Wc="#804400",Vc="#662d00",Yc="#4d1b00",Xc="#ffc400",jc="#fff296",Qc="#fffce0",Zc="#e0e4ea",Jc="#0044f4",eu="#d60027",tu="#ad000e",iu="#850000",ru="#5c0000",nu="#ff3954",su="#ffabab",ou="#ffe5e5",au="#6f28ff",lu="#e0e4ea",cu="rgba(255, 255, 255, 0.2)",uu="#6c7489",du="#52596e",hu="#3a3f51",fu="#232633",mu="#afb7c5",pu="#e0e4ea",gu="#f9fafb",_u="#0044f4",yu="#0030cc",Ru="#002099",Cu="#001466",Eu="#5f9aff",Ou="#bee2ff",bu="#eefaff",wu="rgba(0, 0, 0, 0)",Tu="#0044f4",vu="#0d0e14",Su="#0044f4",xu="#d60027",Iu="#ad000e",Du="#850000",ku="#5c0000",Nu="#ff3954",Au="#ffabab",Lu="#ffe5e5",Uu="#00abd2",Ku="#d60067",Mu="#6f28ff",Bu="#5e00f5",zu="#afb7c5",Pu="#0044f4",qu="#0030cc",Hu="#002099",Gu="#001466",Fu="#5f9aff",$u="#bee2ff",Wu="#eefaff",Vu="#ffffff",Yu="#6c7489",Xu="#52596e",ju="#3a3f51",Qu="#232633",Zu="#afb7c5",Ju="#e0e4ea",ed="#f9fafb",td="#0044f4",id="#0030cc",rd="#002099",nd="#001466",sd="#5f9aff",od="#bee2ff",ad="#eefaff",ld="#007d60",cd="#005944",ud="#004737",dd="#003629",hd="#00d6a4",fd="#b5ffee",md="#ecfffb",pd="#995c00",gd="#804400",_d="#662d00",yd="#4d1b00",Rd="#ffc400",Cd="#fff296",Ed="#fffce0",Od="0.2s",bd="0px",wd="2px",Td="4px",vd="6px",Sd="8px",xd="10px",Id="50%",Dd="100px",kd="0px",Nd="1px",Ad="2px",Ld="4px",Ud="640px",Kd="768px",Md="1024px",Bd="1280px",zd="1536px",Pd="'JetBrains Mono', Consolas, monospace",qd="'Inter', Roboto, Helvetica, sans-serif",Vt="'Inter', Roboto, Helvetica, sans-serif",Hd="10px",Gd="12px",Fd="14px",$d="16px",Wd="18px",Vd="20px",Yd="24px",Xd="32px",jd="40px",Qd="48px",Zd="700",Jd="500",eh="400",th="600",ih="#f50045",rh="#828a9e",nh="#306fff",sh="#00a17b",oh="#ffc400",ah="10px",lh="12px",ch="16px",uh="20px",dh="24px",hh="32px",fh="40px",mh="48px",ph="normal",gh="-0.12px",_h="-0.24px",yh="-0.32px",Rh="-0.4px",Ch="-0.48px",Eh="normal",Oh="12px",bh="16px",wh="20px",Th="24px",vh="28px",Sh="32px",xh="36px",Ih="40px",Dh="48px",kh="56px",Nh="#f1f0ff",Ah="#ffe5e5",Lh="#eefaff",Uh="#52596e",Kh="#e0e4ea",Mh="#ecfcff",Bh="#ecfffb",zh="#fffce0",Ph="#fff0f7",qh="#6f28ff",Hh="#5e00f5",Gh="#d60027",Fh="#ad000e",$h="#0044f4",Wh="#0030cc",Vh="#e0e4ea",Yh="#afb7c5",Xh="#52596e",jh="#3a3f51",Qh="#00819d",Zh="#00647a",Jh="#007d60",ef="#005944",tf="#995c00",rf="#804400",nf="#d60067",sf="#ad0053",of="#000933",af="rgba(255, 255, 255, 0.12)",lf="rgba(255, 255, 255, 0.12)",cf="#00fabe",uf="rgba(255, 255, 255, 0.24)",df="#bee2ff",hf="#ffffff",ff="#eefaff",mf="#00fabe",pf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",gf="4px 0 0 0 #00fabe inset",_f="0 0 0 1px rgba(255, 255, 255, 0.60) inset",yf="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",Rf="0px 0px 0px 1px #e0e4ea inset",Cf="0px 0px 0px 1px #d60027 inset",Ef="0px 0px 0px 1px #ad000e inset",Of="0px 0px 0px 1px #e0e4ea inset",bf="0px 0px 0px 1px #0044f4 inset",wf="0px 0px 0px 1px #001466 inset",Tf="0px 0px 0px 1px #5f9aff inset",vf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Sf="0px",xf="2px",If="4px",Df="6px",kf="8px",Nf="12px",Af="16px",Lf="20px",Uf="24px",Kf="32px",Mf="40px",Bf="48px",zf="56px",Pf="64px",qf="80px",Hf="96px",Gf="auto",Ff="#bee2ff",$f="#8fc1ff",Wf="#5f9aff",Vf="#306fff",Yf="#b5ffee",Xf="#00fabe",jf="#00d6a4",Qf="#00a17b",Zf="#007d60",Jf="#005944",em="#b5ffee",tm="#00fabe",im="#b5ffee",rm="#00a17b",nm="#fff296",sm="#ffe04b",om="#ffc400",am="#b37600",lm="#995c00",cm="#804400",um="#fff296",dm="#ffe04b",hm="#ffc2b3",fm="#ff9877",mm="#ff723c",pm="#f75008",gm="#d13500",_m="#a31f00",ym="#ffc2b3",Rm="#ff9877",Cm="#ff723c",Em="#f75008",Om="#d13500",bm="#a31f00",wm="#ffc2b3",Tm="#ff9877",vm="#ff723c",Sm="#f75008",xm="#d13500",Im="#a31f00",Dm="#ffc2b3",km="#ff9877",Nm="#ff723c",Am="#f75008",Lm="#d13500",Um="#a31f00",Km="#ffc2b3",Mm="#ff9877",Bm="#ff723c",zm="#f75008",Pm="#d13500",qm="#ffabab",Hm="#ff7272",Gm="#ff3954",Fm="#f50045",$m="#d60027",Wm="#ad000e",Vm="#ffabab",Ym="#ff7272",Xm="#ff3954",jm="#f50045",Qm="#d60027",Zm="#eefaff",Jm="#ecfffb",ep="#fffce0",tp="#fff1ef",ip="#ffe5e5",rp="#5f9aff",np="#00d6a4",sp="#ffc400",op="#ff723c",ap="#ff3954",lp="#eefaff",cp="#ecfffb",up="#fffce0",dp="#fff1ef",hp="#ffe5e5",fp="#0044f4",mp="#007d60",pp="#995c00",gp="#d13500",_p="#d60027",Er=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Od,KUI_BORDER_RADIUS_0:bd,KUI_BORDER_RADIUS_10:wd,KUI_BORDER_RADIUS_20:Td,KUI_BORDER_RADIUS_30:vd,KUI_BORDER_RADIUS_40:Sd,KUI_BORDER_RADIUS_50:xd,KUI_BORDER_RADIUS_CIRCLE:Id,KUI_BORDER_RADIUS_ROUND:Dd,KUI_BORDER_WIDTH_0:kd,KUI_BORDER_WIDTH_10:Nd,KUI_BORDER_WIDTH_20:Ad,KUI_BORDER_WIDTH_30:Ld,KUI_BREAKPOINT_DESKTOP:zd,KUI_BREAKPOINT_LAPTOP:Bd,KUI_BREAKPOINT_MOBILE:Ud,KUI_BREAKPOINT_PHABLET:Kd,KUI_BREAKPOINT_TABLET:Md,KUI_COLOR_BACKGROUND:tc,KUI_COLOR_BACKGROUND_ACCENT:ic,KUI_COLOR_BACKGROUND_DANGER:rc,KUI_COLOR_BACKGROUND_DANGER_STRONG:nc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:sc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:oc,KUI_COLOR_BACKGROUND_DANGER_WEAK:ac,KUI_COLOR_BACKGROUND_DANGER_WEAKER:lc,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:cc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:uc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:dc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:hc,KUI_COLOR_BACKGROUND_DISABLED:fc,KUI_COLOR_BACKGROUND_INFO:mc,KUI_COLOR_BACKGROUND_INFO_STRONG:pc,KUI_COLOR_BACKGROUND_INFO_STRONGER:gc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:_c,KUI_COLOR_BACKGROUND_INFO_WEAK:yc,KUI_COLOR_BACKGROUND_INFO_WEAKER:Rc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Cc,KUI_COLOR_BACKGROUND_INVERSE:Ec,KUI_COLOR_BACKGROUND_NEUTRAL:Oc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:bc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:wc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:Tc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:vc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:Sc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:xc,KUI_COLOR_BACKGROUND_OVERLAY:Ic,KUI_COLOR_BACKGROUND_PRIMARY:Dc,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:kc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:Nc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Ac,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Lc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Uc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Kc,KUI_COLOR_BACKGROUND_SUCCESS:Mc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Bc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:zc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:Pc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:qc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:Hc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Gc,KUI_COLOR_BACKGROUND_TRANSPARENT:Fc,KUI_COLOR_BACKGROUND_WARNING:$c,KUI_COLOR_BACKGROUND_WARNING_STRONG:Wc,KUI_COLOR_BACKGROUND_WARNING_STRONGER:Vc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:Yc,KUI_COLOR_BACKGROUND_WARNING_WEAK:Xc,KUI_COLOR_BACKGROUND_WARNING_WEAKER:jc,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:Qc,KUI_COLOR_BORDER:Zc,KUI_COLOR_BORDER_ACCENT:Jc,KUI_COLOR_BORDER_DANGER:eu,KUI_COLOR_BORDER_DANGER_STRONG:tu,KUI_COLOR_BORDER_DANGER_STRONGER:iu,KUI_COLOR_BORDER_DANGER_STRONGEST:ru,KUI_COLOR_BORDER_DANGER_WEAK:nu,KUI_COLOR_BORDER_DANGER_WEAKER:su,KUI_COLOR_BORDER_DANGER_WEAKEST:ou,KUI_COLOR_BORDER_DECORATIVE_PURPLE:au,KUI_COLOR_BORDER_DISABLED:lu,KUI_COLOR_BORDER_INVERSE:cu,KUI_COLOR_BORDER_NEUTRAL:uu,KUI_COLOR_BORDER_NEUTRAL_STRONG:du,KUI_COLOR_BORDER_NEUTRAL_STRONGER:hu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:fu,KUI_COLOR_BORDER_NEUTRAL_WEAK:mu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:pu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:gu,KUI_COLOR_BORDER_PRIMARY:_u,KUI_COLOR_BORDER_PRIMARY_STRONG:yu,KUI_COLOR_BORDER_PRIMARY_STRONGER:Ru,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Cu,KUI_COLOR_BORDER_PRIMARY_WEAK:Eu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Ou,KUI_COLOR_BORDER_PRIMARY_WEAKEST:bu,KUI_COLOR_BORDER_TRANSPARENT:wu,KUI_COLOR_BRAND:Tu,KUI_COLOR_TEXT:vu,KUI_COLOR_TEXT_ACCENT:Su,KUI_COLOR_TEXT_DANGER:xu,KUI_COLOR_TEXT_DANGER_STRONG:Iu,KUI_COLOR_TEXT_DANGER_STRONGER:Du,KUI_COLOR_TEXT_DANGER_STRONGEST:ku,KUI_COLOR_TEXT_DANGER_WEAK:Nu,KUI_COLOR_TEXT_DANGER_WEAKER:Au,KUI_COLOR_TEXT_DANGER_WEAKEST:Lu,KUI_COLOR_TEXT_DECORATIVE_AQUA:Uu,KUI_COLOR_TEXT_DECORATIVE_PINK:Ku,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Mu,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Bu,KUI_COLOR_TEXT_DISABLED:zu,KUI_COLOR_TEXT_INFO:Pu,KUI_COLOR_TEXT_INFO_STRONG:qu,KUI_COLOR_TEXT_INFO_STRONGER:Hu,KUI_COLOR_TEXT_INFO_STRONGEST:Gu,KUI_COLOR_TEXT_INFO_WEAK:Fu,KUI_COLOR_TEXT_INFO_WEAKER:$u,KUI_COLOR_TEXT_INFO_WEAKEST:Wu,KUI_COLOR_TEXT_INVERSE:Vu,KUI_COLOR_TEXT_NEUTRAL:Yu,KUI_COLOR_TEXT_NEUTRAL_STRONG:Xu,KUI_COLOR_TEXT_NEUTRAL_STRONGER:ju,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:Qu,KUI_COLOR_TEXT_NEUTRAL_WEAK:Zu,KUI_COLOR_TEXT_NEUTRAL_WEAKER:Ju,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:ed,KUI_COLOR_TEXT_PRIMARY:td,KUI_COLOR_TEXT_PRIMARY_STRONG:id,KUI_COLOR_TEXT_PRIMARY_STRONGER:rd,KUI_COLOR_TEXT_PRIMARY_STRONGEST:nd,KUI_COLOR_TEXT_PRIMARY_WEAK:sd,KUI_COLOR_TEXT_PRIMARY_WEAKER:od,KUI_COLOR_TEXT_PRIMARY_WEAKEST:ad,KUI_COLOR_TEXT_SUCCESS:ld,KUI_COLOR_TEXT_SUCCESS_STRONG:cd,KUI_COLOR_TEXT_SUCCESS_STRONGER:ud,KUI_COLOR_TEXT_SUCCESS_STRONGEST:dd,KUI_COLOR_TEXT_SUCCESS_WEAK:hd,KUI_COLOR_TEXT_SUCCESS_WEAKER:fd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:md,KUI_COLOR_TEXT_WARNING:pd,KUI_COLOR_TEXT_WARNING_STRONG:gd,KUI_COLOR_TEXT_WARNING_STRONGER:_d,KUI_COLOR_TEXT_WARNING_STRONGEST:yd,KUI_COLOR_TEXT_WARNING_WEAK:Rd,KUI_COLOR_TEXT_WARNING_WEAKER:Cd,KUI_COLOR_TEXT_WARNING_WEAKEST:Ed,KUI_FONT_FAMILY_CODE:Pd,KUI_FONT_FAMILY_HEADING:qd,KUI_FONT_FAMILY_TEXT:Vt,KUI_FONT_SIZE_10:Hd,KUI_FONT_SIZE_100:Qd,KUI_FONT_SIZE_20:Gd,KUI_FONT_SIZE_30:Fd,KUI_FONT_SIZE_40:$d,KUI_FONT_SIZE_50:Wd,KUI_FONT_SIZE_60:Vd,KUI_FONT_SIZE_70:Yd,KUI_FONT_SIZE_80:Xd,KUI_FONT_SIZE_90:jd,KUI_FONT_WEIGHT_BOLD:Zd,KUI_FONT_WEIGHT_MEDIUM:Jd,KUI_FONT_WEIGHT_REGULAR:eh,KUI_FONT_WEIGHT_SEMIBOLD:th,KUI_ICON_COLOR_DANGER:ih,KUI_ICON_COLOR_NEUTRAL:rh,KUI_ICON_COLOR_PRIMARY:nh,KUI_ICON_COLOR_SUCCESS:sh,KUI_ICON_COLOR_WARNING:oh,KUI_ICON_SIZE_10:ah,KUI_ICON_SIZE_20:lh,KUI_ICON_SIZE_30:ch,KUI_ICON_SIZE_40:uh,KUI_ICON_SIZE_50:dh,KUI_ICON_SIZE_60:hh,KUI_ICON_SIZE_70:fh,KUI_ICON_SIZE_80:mh,KUI_LETTER_SPACING_0:ph,KUI_LETTER_SPACING_MINUS_10:gh,KUI_LETTER_SPACING_MINUS_20:_h,KUI_LETTER_SPACING_MINUS_30:yh,KUI_LETTER_SPACING_MINUS_40:Rh,KUI_LETTER_SPACING_MINUS_50:Ch,KUI_LETTER_SPACING_NORMAL:Eh,KUI_LINE_HEIGHT_10:Oh,KUI_LINE_HEIGHT_100:kh,KUI_LINE_HEIGHT_20:bh,KUI_LINE_HEIGHT_30:wh,KUI_LINE_HEIGHT_40:Th,KUI_LINE_HEIGHT_50:vh,KUI_LINE_HEIGHT_60:Sh,KUI_LINE_HEIGHT_70:xh,KUI_LINE_HEIGHT_80:Ih,KUI_LINE_HEIGHT_90:Dh,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Nh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Ah,KUI_METHOD_COLOR_BACKGROUND_GET:Lh,KUI_METHOD_COLOR_BACKGROUND_HEAD:Uh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Kh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Mh,KUI_METHOD_COLOR_BACKGROUND_POST:Bh,KUI_METHOD_COLOR_BACKGROUND_PUT:zh,KUI_METHOD_COLOR_BACKGROUND_TRACE:Ph,KUI_METHOD_COLOR_TEXT_CONNECT:qh,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:Hh,KUI_METHOD_COLOR_TEXT_DELETE:Gh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Fh,KUI_METHOD_COLOR_TEXT_GET:$h,KUI_METHOD_COLOR_TEXT_GET_STRONG:Wh,KUI_METHOD_COLOR_TEXT_HEAD:Vh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:Yh,KUI_METHOD_COLOR_TEXT_OPTIONS:Xh,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:jh,KUI_METHOD_COLOR_TEXT_PATCH:Qh,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:Zh,KUI_METHOD_COLOR_TEXT_POST:Jh,KUI_METHOD_COLOR_TEXT_POST_STRONG:ef,KUI_METHOD_COLOR_TEXT_PUT:tf,KUI_METHOD_COLOR_TEXT_PUT_STRONG:rf,KUI_METHOD_COLOR_TEXT_TRACE:nf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:sf,KUI_NAVIGATION_COLOR_BACKGROUND:of,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:af,KUI_NAVIGATION_COLOR_BORDER:lf,KUI_NAVIGATION_COLOR_BORDER_CHILD:cf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:uf,KUI_NAVIGATION_COLOR_TEXT:df,KUI_NAVIGATION_COLOR_TEXT_FOCUS:hf,KUI_NAVIGATION_COLOR_TEXT_HOVER:ff,KUI_NAVIGATION_COLOR_TEXT_SELECTED:mf,KUI_NAVIGATION_SHADOW_BORDER:pf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:gf,KUI_NAVIGATION_SHADOW_FOCUS:_f,KUI_SHADOW:yf,KUI_SHADOW_BORDER:Rf,KUI_SHADOW_BORDER_DANGER:Cf,KUI_SHADOW_BORDER_DANGER_STRONG:Ef,KUI_SHADOW_BORDER_DISABLED:Of,KUI_SHADOW_BORDER_PRIMARY:bf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:wf,KUI_SHADOW_BORDER_PRIMARY_WEAK:Tf,KUI_SHADOW_FOCUS:vf,KUI_SPACE_0:Sf,KUI_SPACE_10:xf,KUI_SPACE_100:Mf,KUI_SPACE_110:Bf,KUI_SPACE_120:zf,KUI_SPACE_130:Pf,KUI_SPACE_140:qf,KUI_SPACE_150:Hf,KUI_SPACE_20:If,KUI_SPACE_30:Df,KUI_SPACE_40:kf,KUI_SPACE_50:Nf,KUI_SPACE_60:Af,KUI_SPACE_70:Lf,KUI_SPACE_80:Uf,KUI_SPACE_90:Kf,KUI_SPACE_AUTO:Gf,KUI_STATUS_COLOR_100:Ff,KUI_STATUS_COLOR_100S:rp,KUI_STATUS_COLOR_101:$f,KUI_STATUS_COLOR_102:Wf,KUI_STATUS_COLOR_103:Vf,KUI_STATUS_COLOR_1NA:Zm,KUI_STATUS_COLOR_200:Yf,KUI_STATUS_COLOR_200S:np,KUI_STATUS_COLOR_201:Xf,KUI_STATUS_COLOR_202:jf,KUI_STATUS_COLOR_203:Qf,KUI_STATUS_COLOR_204:Zf,KUI_STATUS_COLOR_205:Jf,KUI_STATUS_COLOR_206:em,KUI_STATUS_COLOR_207:tm,KUI_STATUS_COLOR_208:im,KUI_STATUS_COLOR_226:rm,KUI_STATUS_COLOR_2NA:Jm,KUI_STATUS_COLOR_300:nm,KUI_STATUS_COLOR_300S:sp,KUI_STATUS_COLOR_301:sm,KUI_STATUS_COLOR_302:om,KUI_STATUS_COLOR_303:am,KUI_STATUS_COLOR_304:lm,KUI_STATUS_COLOR_305:cm,KUI_STATUS_COLOR_307:um,KUI_STATUS_COLOR_308:dm,KUI_STATUS_COLOR_3NA:ep,KUI_STATUS_COLOR_400:hm,KUI_STATUS_COLOR_400S:op,KUI_STATUS_COLOR_401:fm,KUI_STATUS_COLOR_402:mm,KUI_STATUS_COLOR_403:pm,KUI_STATUS_COLOR_404:gm,KUI_STATUS_COLOR_405:_m,KUI_STATUS_COLOR_406:ym,KUI_STATUS_COLOR_407:Rm,KUI_STATUS_COLOR_408:Cm,KUI_STATUS_COLOR_409:Em,KUI_STATUS_COLOR_410:Om,KUI_STATUS_COLOR_411:bm,KUI_STATUS_COLOR_412:wm,KUI_STATUS_COLOR_413:Tm,KUI_STATUS_COLOR_414:vm,KUI_STATUS_COLOR_415:Sm,KUI_STATUS_COLOR_416:xm,KUI_STATUS_COLOR_417:Im,KUI_STATUS_COLOR_418:Dm,KUI_STATUS_COLOR_421:km,KUI_STATUS_COLOR_422:Nm,KUI_STATUS_COLOR_423:Am,KUI_STATUS_COLOR_424:Lm,KUI_STATUS_COLOR_425:Um,KUI_STATUS_COLOR_426:Km,KUI_STATUS_COLOR_428:Mm,KUI_STATUS_COLOR_429:Bm,KUI_STATUS_COLOR_431:zm,KUI_STATUS_COLOR_451:Pm,KUI_STATUS_COLOR_4NA:tp,KUI_STATUS_COLOR_500:qm,KUI_STATUS_COLOR_500S:ap,KUI_STATUS_COLOR_501:Hm,KUI_STATUS_COLOR_502:Gm,KUI_STATUS_COLOR_503:Fm,KUI_STATUS_COLOR_504:$m,KUI_STATUS_COLOR_505:Wm,KUI_STATUS_COLOR_506:Vm,KUI_STATUS_COLOR_507:Ym,KUI_STATUS_COLOR_508:Xm,KUI_STATUS_COLOR_510:jm,KUI_STATUS_COLOR_511:Qm,KUI_STATUS_COLOR_5NA:ip,KUI_STATUS_COLOR_BACKGROUND_100:lp,KUI_STATUS_COLOR_BACKGROUND_200:cp,KUI_STATUS_COLOR_BACKGROUND_300:up,KUI_STATUS_COLOR_BACKGROUND_400:dp,KUI_STATUS_COLOR_BACKGROUND_500:hp,KUI_STATUS_COLOR_TEXT_100:fp,KUI_STATUS_COLOR_TEXT_200:mp,KUI_STATUS_COLOR_TEXT_300:pp,KUI_STATUS_COLOR_TEXT_400:gp,KUI_STATUS_COLOR_TEXT_500:_p},Symbol.toStringTag,{value:"Module"})),Or=Object.keys(Er).filter(r=>r.startsWith("KUI_COLOR")),br=r=>Er[r],yp=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(yp(t),br(t))]))},Yt=r=>{const e=s.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"]}),s.getCurrentScope()&&s.onScopeDispose(()=>t.disconnect())}return e},Rp=()=>typeof window>"u"?Vt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Vt,Cp=r=>{const e=Rp(),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}}}},Ep=r=>s.computed(()=>Cp(r.value)),Op={class:"kong-ui-public-echarts-tooltip"},bp={class:"tooltip-title"},wp={class:"title"},Tp={key:0,class:"subtitle"},vp={class:"context"},Sp={class:"metric"},xp={class:"tooltip-rows"},Ip={class:"display-value"},Dp=s.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Op,[s.createElementVNode("div",bp,[s.createElementVNode("div",wp,s.toDisplayString(r.title),1),r.context||r.metric?(s.openBlock(),s.createElementBlock("div",Tp,[s.createElementVNode("div",vp,s.toDisplayString(r.context),1),s.createElementVNode("div",Sp,s.toDisplayString(r.metric),1)])):s.createCommentVNode("",!0)]),s.createElementVNode("ul",xp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.rows,(i,n)=>(s.openBlock(),s.createElementBlock("li",{key:`${i.label}-${n}`,class:s.normalizeClass({"extra-row":i.isExtra})},[s.createElementVNode("span",{class:"square-marker",style:s.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),s.createElementVNode("span",{class:s.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},s.toDisplayString(i.label),3),s.createElementVNode("span",Ip,s.toDisplayString(i.value),1)],2))),128))])]))}}),Tr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},kp=Tr(Dp,[["__scopeId","data-v-ca633353"]]),Xt=r=>Array.isArray(r)?r:[r],vr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,jt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Np=r=>Array.isArray(r)?r[r.length-1]:r,Ap=r=>{const e=Xt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>jt(i,i.seriesName??"",Np(i.value)))}},Lp=r=>{let e;return s.getCurrentScope()&&s.onScopeDispose(()=>{e&&s.render(null,e)}),t=>{const i=(r()??Ap)(t);return i?(e??=document.createElement("div"),s.render(s.h(kp,i),e),e):""}},Up={class:"kong-ui-public-echarts"},Kp=s.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){s.useCssVars(o=>({v1cecfeed:o.height})),bt.use([Hr.CanvasRenderer,lt.GridComponent,lt.TooltipComponent]);const e=Yt(),t=Ep(e),i=Lp(()=>r.tooltipContent),n=s.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(s.openBlock(),s.createElementBlock("div",Up,[s.createVNode(s.unref(qr),s.mergeProps({autoresize:!0,class:"chart",option:n.value,theme:s.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Sr=Tr(Kp,[["__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[n,o]of Object.entries(i)){if(o===void 0)continue;const a=t[n];t[n]=xr(a)&&xr(o)?nt(a,o):o}return t},Mp=s.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([ni.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=Yt(),t=a=>{const[l]=Xt(a),[d,c,u]=l.value;return{title:r.tooltipTitle,context:vr(d,r.xAxisLabels),metric:r.seriesName,rows:[jt(l,vr(c,r.yAxisLabels),u,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}),n=s.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),d=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,[,,u])=>Math.max(c,u),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:d},...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=s.computed(()=>nt(n.value,r.option));return(a,l)=>(s.openBlock(),s.createBlock(Sr,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Bp=s.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([ni.TreemapChart]);const e=Yt(),t=l=>{const[d]=Xt(l),c=d.treePathInfo??[];if(c.length===1)return;const u=c.slice(1,-1).map(({name:h})=>h);return{title:r.tooltipTitle,context:u.length?u.join(" / "):void 0,metric:r.seriesName,rows:[jt(d,d.name,Number(d.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],n=(l=[])=>l.reduce((d,c)=>Math.max(d,1+n(c.children)),0),o=s.computed(()=>({series:[nt({name:r.seriesName,type:"treemap",data:r.data??[],nodeClick:r.drillDown?"zoomToNode":!1,leafDepth:r.leafDepth??n(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:d})=>`${l}
|
|
12
|
+
`)}function Zi(r,...e){return typeof r=="function"?r(...e):r}function Oa({method:r="warn",formatter:e=Ea}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const ba=Error.captureStackTrace;var wa=class Br extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=Br){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,ba?.(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 Ta(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function va(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const n of Object.keys(r.codes)){const o=r.codes[n],a=o.docs===!1?void 0:o.docs||Ta(i,n),l=(d={},c={})=>{const u=new wa({code:n,why:Zi(o.why,d),fix:Zi(o.fix,d),docs:a,cause:d.cause,sources:d.sources},l);for(const h of e)h(u,c);return u};t[n]=l}return t}const Sa=typeof window<"u",xa=va({reporters:[Oa()],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=s.toRaw(r),t={};for(const i in e){const n=e[i];n?.effect?t[i]=s.computed({get:()=>r[i],set(o){r[i]=o}}):(s.isRef(n)||s.isReactive(n))&&(t[i]=s.toRef(r,i))}return t}const Ie=r=>r?.chart.type==="table",Bt=r=>r?.query?.datasource==="requests",zt=r=>!!r&&!Ie(r)&&!Bt(r),Ia=(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},Da=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],ka=r=>Da.includes(r);function Na({queryBridge:r,context:e,definition:t,chartData:i}){const n=s.ref(""),o=s.ref(""),a=s.ref(void 0),l=s.ref(void 0),d=Ne.useAnalyticsConfigStore(),c=Ne.useDatasourceConfigStore(),{stripUnknownFilters:u,loading:h}=Xe(c),f=s.computed(()=>Ie(t.value));s.onMounted(async()=>{n.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const m=s.computed(()=>d.analytics&&d.percentiles),_=s.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=s.computed(()=>o.value&&t.value.query&&!f.value&&t.value.query.datasource!=="llm_usage"&&t.value.query.datasource!=="managed_cache_usage"&&!Q.isPlatformDatasource(t.value.query.datasource)&&m.value&&!h.value),C=s.computed(()=>n.value&&t.value.query&&ka(t.value.query.datasource)&&m.value&&!h.value),T=s.computed(()=>i.value?Q.msToGranularity(i.value.meta.granularity_ms):void 0),k=s.computed(()=>{const y=t.value,S=[...e.value.filters,...y.query.filters??[]],x="metrics"in y.query?y.query.metrics:void 0,N=y.query?.datasource??"api_usage";return u.value({datasource:N,filters:S,queryFields:x})}),E=s.computed(()=>{if(!C.value||!_.value)return"";const y=t.value;if(Ie(y))return g({...y.query,filters:k.value});const S=y.query.time_range||e.value.timeSpec,x=p(S,k.value);return g(x)}),b=s.computed(()=>{if(!O.value||!_.value)return"";const y=k.value,S=t.value;if(Ie(S))return"";const x=U(S.query.time_range||e.value.timeSpec,y);return v(x)}),v=y=>O.value?`${o.value}?q=${JSON.stringify(y)}`:"",U=(y,S)=>{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:S,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,S)=>({filter:S,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,S)=>{const x=t.value;if(!zt(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:S,metrics:K,dimensions:N,time_range:y,granularity:x.query.granularity||T.value||void 0}},g=y=>{if(!C.value)return"";const S=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${n.value}?q=${JSON.stringify(y)}&d=${S}&c=${t.value.chart.type}`};return s.watch([O,C],([y,S])=>{y&&(a.value={href:""}),S&&(l.value={href:""})}),{exploreLinkKebabMenu:E,requestsLinkKebabMenu:b,canShowKebabMenu:_,canGenerateRequestsLink:O,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:z,buildExploreLink:g,buildRequestLink:v}}const Pt=r=>r.type==="relative"?Q.TimePeriods.get(Q.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Aa=r=>r.reduce((e,t)=>{const i=Q.TimePeriods.get(Q.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),qt=(r,e)=>{if(!r||!e?.length)return;const t=Pt(r),i=Aa(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},Ht=(r,e)=>{const t=qt(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 La(){const r=s.inject(ve),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;return s.onUnmounted(()=>{n?.abort()}),{issueQuery:async(a,l,d)=>{if(!r)throw new Error("Query bridge is not defined");n?.abort();const c=new AbortController;n=c,await e.isReady();const{datasource:u,limit:h,...f}=a,m=u||"basic",_=Q.isPlatformDatasource(m),O=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:k})=>!_||!Q.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=Ht(C,t.value[m]?.timeRangeOptions);const T={datasource:m,query:{...f,time_range:C,filters:O,limit:d??h}};return r.queryFn(T,c)}}}const Ua="24H",Ka={status_code:"response_http_status",upstream_status_code:"upstream_status"},Ma={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"},Ba=r=>Q.relativeTimeRangeValuesRequestV2.includes(r),za=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:Ba(t)?t:Ua,...e}},tr=r=>Ka[r]??r,Pa=r=>({metric:tr(r.metric),dimension:r.dimension?tr(r.dimension):void 0,unroll:r.unroll,metricUnit:Ma[r.metric],extraFields:r.extra_fields}),Gt="requests";function qa(){const r=s.inject(ve),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;s.onUnmounted(()=>{n?.abort()});const o=(l,d)=>{const c=l.time_range??d.timeSpec;return Ht(c&&{...c,tz:c.tz??d.tz},t.value[Gt]?.timeRangeOptions)};return{issueRequestsQuery:async(l,d)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");n?.abort();const u=new AbortController;n=u,await e.isReady();const h=i.value({datasource:Gt,filters:[...l.filters??[],...d.filters]});return Q.fetchAllRequests(c,{datasource:Gt,query:{filters:h,time_range:za(o(l,d))}},u,{maxRecords:l.max_records})}}}function Ha({context:r,globalFilters:e=s.ref([]),isFullscreen:t=s.ref(!1),preview:i=s.ref(!1)}){const n=Ne.useAnalyticsConfigStore(),o=Ne.useDatasourceConfigStore(),{loading:a}=Xe(n),{loading:l}=Xe(o),d=s.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:n.defaultQueryTimeForOrg}),c=s.computed(()=>{const{tz:b}=r.value;return b||new Intl.DateTimeFormat().resolvedOptions().timeZone}),u=s.computed(()=>{const{editable:b}=r.value;return b===void 0||i.value?!1:b}),h=s.computed(()=>{const{showTileActions:b}=r.value;return i.value?!1:b===void 0?!0:b}),f=s.computed(()=>[...r.value.filters??[],...e.value]),m=s.computed(()=>{let{refreshInterval:b}=r.value;if(b===void 0&&(b=Wi),t.value){let v=!1;if(d.value.type==="relative")v=["15m","1h","6h","12h","24h"].includes(d.value.time_range);else{const p=d.value.start.getTime(),g=d.value.end.getTime();v=Math.abs(g-p)<=864e5}const U=new Date().getTime();d.value.type==="absolute"&&d.value.end.getTime()<U||d.value.type==="relative"&&["previous_week","previous_month"].includes(d.value.time_range)?b=0:v?b=Vi:b=Yi}return b}),_=s.computed(()=>({filters:f.value,timeSpec:d.value,tz:c.value,refreshInterval:m.value,editable:u.value,showTileActions:h.value})),O=s.computed(()=>!a.value&&!l.value),C=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),T=s.computed(()=>!i.value),k=s.computed(()=>!i.value),E=s.computed(()=>({enabled:C.value,showExploreAction:T.value,showRequestsAction:k.value,showZoomInAction:C.value}));return{editable:u,enrichedContext:_,filters:f,queryReady:O,refreshInterval:m,showTileActions:h,timeSpec:d,tz:c,zoomConfiguration:E}}const Ga=6,ir=6,rr=4;function Fa(r,e){const{pageWidth:t,pageHeight:i,margin:n}=e,o=n+1,a=n+e.headerHeight-3,l=i-n-ir+3,d=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,n,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-n,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,n,o+rr),r.setDrawColor(220),r.line(n,a,t-n,a),r.line(n,l,t-n,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,n,d);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const u=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(u,n+c,d,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(u,n+c,d)),r.setTextColor(120),r.text(e.pageLabel,t-n,d,{align:"right"})}function $a(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,n=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),d=Math.round(a.bottom-i),c=n.get(l);n.set(l,c!==void 0?Math.max(c,d):d)}),[...n.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function Wa(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const d=Math.min(t,e-l);a.push({startY:l,height:d}),l+=d}return a}const n=[];let o=0;for(const a of r){const l=a.top*i,d=a.bottom*i;d-o>t&&(l>o?(n.push({startY:o,height:l-o}),o=l):(n.push({startY:o,height:d-o}),o=d))}return o<e&&n.push({startY:o,height:e-o}),n}function Va(r){const{i18n:e}=Lt(),t=s.ref({status:"idle"});async function i(n={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:d,orientation:c="landscape",pageSize:u="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:_="download",onBeforeCapture:O,onAfterCapture:C}=n,T=r.value;if(!T){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:()=>Q.prepareForCapture(),afterClone:()=>Q.restoreAfterCapture()},v=await k.toCanvas(T,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[b]}),U=$a(T),z=T.getBoundingClientRect().width,p=z?v.width/z:f;t.value={status:"generating"};const g=new Date,y=new E({orientation:c,unit:"mm",format:u}),S=y.internal.pageSize.getWidth(),x=y.internal.pageSize.getHeight(),N=Ga+(l?rr:0),K=S-h*2,q=x-h*2-N-ir,V=v.width/K,P=q*V,F=Wa(U,v.height,P,p),M={title:a,subtitle:l,dashboardUrl:d,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:S,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=v.width,I.height=D,I.getContext("2d").drawImage(v,0,w,v.width,D,0,0,v.width,D),y.addImage(I.toDataURL("image/png"),"PNG",h,h+N,K,D/V),Fa(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{Q.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const Ya=r=>r.toLowerCase().endsWith("count")?"":r;function Xa(){const{i18n:r}=Lt(),{formatUnit:e}=Q.unitFormatter({i18n:r});return t=>{const i=t.meta?.metric_names?.[0]??"",n=t.meta?.metric_units?.[i]??"",o=`chartLabels.${i}`;return{seriesName:r.te(o)?r.t(o):i,valueFormatter:a=>e(a,n,{translateUnit:Ya})}}}const ce={useContextLinks:Na,useDashboardContext:Ha,useEvaluateFeatureFlag:ha,useExportPdf:Va,useI18n:Lt,useIssueQuery:La,useIssueRequestsQuery:qa,useMetricFormatter:Xa,useRequestQueue:Ca},ja={class:"kong-ui-public-csv-export-modal"},Qa={key:0,class:"selected-range"},Za={key:4,class:"text-muted",tag:"span"},nr=3,sr=s.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=ce.useI18n(),i=r,n=e,o=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=s.ref(1),l=s.computed(()=>f.value.rows.length),d=s.computed(()=>i.exportState.status==="success"&&!!i.exportState.chartData?.data?.length),c=s.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:Q.formatTimestamp(new Date(_),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${Q.formatTimestamp(new Date(_))} - ${Q.formatTimestamp(new Date(O),{includeTZ:!0})}`}),u=s.computed(()=>i.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(nr,l.value),rowsTotal:l.value,plural:l.value===1?"":"s"})),h=()=>{n("closeModal")},f=s.computed(()=>{if(i.exportState.status!=="success"||!d.value||!i.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const _=i.exportState.chartData,O=_.data.some(v=>v.timestamp!==_.data[0].timestamp),C=_.data.map(v=>{const U=new Date(v.timestamp);return{...Object.keys(v.event).reduce((p,g)=>{if(g in _.meta.display){const y=v.event[g],S=_.meta.display[g];p[g]=y&&S?.[y]?.name||v.event[g]}else p[g]=v.event[g];return p},{}),...O?{timestamp:Nt(U,"yyyy-MM-dd HH:mm:ss"),tzOffset:Nt(U,"XXX")}:{}}});let T=[];O&&(T=[{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=[...T,...Object.keys(k).map(v=>({label:t.t(`chartLabels.${v}`),key:v})),...i.exportState.chartData.meta.metric_names.map(v=>({label:t.t(`chartLabels.${v}`),key:v}))],b=E.reduce((v,U)=>(v[U.key]=U.label,v),{});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 s.watch(f,()=>{a.value++}),(_,O)=>{const C=s.resolveComponent("KSkeleton"),T=s.resolveComponent("KEmptyState"),k=s.resolveComponent("KTableData"),E=s.resolveComponent("KTooltip"),b=s.resolveComponent("KButton"),v=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",ja,[s.createVNode(v,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:s.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:s.withKeys(h,["esc"])},{default:s.withCtx(()=>[s.createElementVNode("div",null,[r.exportState.status==="success"&&d.value?(s.openBlock(),s.createElementBlock("div",Qa,[s.createElementVNode("p",null,s.toDisplayString(r.modalDescription?r.modalDescription:s.unref(t).t("csvExport.exportDescription")),1),s.createElementVNode("p",null,s.toDisplayString(c.value),1)])):s.createCommentVNode("",!0),r.exportState.status==="loading"?(s.openBlock(),s.createBlock(C,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(s.openBlock(),s.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":s.withCtx(()=>[s.createVNode(T,{"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRange")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):r.exportState.status==="error"?(s.openBlock(),s.createBlock(T,{key:3,"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.dataError")),1)]),_:1})):s.createCommentVNode("",!0),r.exportState.status==="success"&&d.value?(s.openBlock(),s.createElementBlock("div",Za,[s.createTextVNode(s.toDisplayString(u.value)+" ",1),s.createVNode(E,{class:"preview-tooltip",placement:"right",text:s.unref(t).t("csvExport.maximumRecordAmount",{value:s.unref(Q.EXPORT_RECORD_LIMIT)})},{default:s.withCtx(()=>[s.createVNode(s.unref(ie.InfoIcon),{color:`var(--kui-color-text-neutral, ${s.unref(At)})`,size:`var(--kui-icon-size-30, ${s.unref(ta)})`},null,8,["color","size"])]),_:1},8,["text"])])):s.createCommentVNode("",!0)])]),"footer-actions":s.withCtx(()=>[s.createVNode(b,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.cancelButton")),1)]),_:1}),s.createVNode(da,{class:"vitals-report-export-button",filename:o,headers:f.value.csvHeaders,rows:f.value.rows},{default:s.withCtx(()=>[s.createVNode(b,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!d.value},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.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 Ja=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=s.ref({}),e,t,i=Ja){const n=s.ref("PENDING");return s.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){n.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){n.value="VALIDATING";return}if(r.value&&e.value){n.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){n.value="PENDING";return}if(r.value&&!e.value&&o){n.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){n.value="SUCCESS";return}r.value===void 0&&e&&(n.value="ERROR")}),{state:n,swrvState:or}}const Ke=s.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:n}=ce.useI18n(),{issueQuery:o}=ce.useIssueQuery(),a=s.inject(ve),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:d,error:c,isValidating:u}=ii(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=we.handleQueryError(E),E}finally{l()===k&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=ar(d,c,u),m=s.ref(null),_=s.computed(()=>h.value===f.ERROR||!!m.value),O=s.computed(()=>!t.queryReady||h.value===f.PENDING),C=s.ref(),T=s.computed(()=>d.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return s.watch([()=>d.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=s.resolveComponent("KSkeleton"),v=s.resolveComponent("KEmptyState");return(O.value||!s.unref(d)&&!_.value)&&!T.value?(s.openBlock(),s.createBlock(b,{key:0,class:"chart-skeleton",type:"table"})):_.value&&!O.value?(s.openBlock(),s.createBlock(v,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[m.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(ie.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(ie.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(m.value?.message||s.unref(n).t("renderer.unexpectedError")),1)]),_:2},[m.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(m.value.details),1)]),key:"0"}:void 0]),1024)):T.value?s.renderSlot(k.$slots,"default",{data:T.value},void 0,void 0,2):s.createCommentVNode("",!0)}}}),el=s.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=s.computed(()=>e.chartOptions.type==="single_value"),i=s.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend"}:e.chartOptions);return(n,o)=>(s.openBlock(),s.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:s.withCtx(({data:a})=>[s.createElementVNode("div",{class:s.normalizeClass(["analytics-chart",{"single-value":t.value}]),style:s.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[s.createVNode(s.unref(we.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,n]of e)t[i]=n;return t},lr=Ce(el,[["__scopeId","data-v-22077b88"]]),tl={class:"analytics-chart"},Ft=Ce(s.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:n}=ce.useI18n(),o=s.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")},d=c=>{i("chart-data",c)};return(c,u)=>{const h=s.resolveComponent("KDropdownItem");return s.openBlock(),s.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:d},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",tl,[s.createVNode(s.unref(we.AnalyticsChart),s.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:u[0]||(u[0]=m=>i("select-chart-range",m)),onZoomTimeRange:u[1]||(u[1]=m=>i("zoom-time-range",m))}),s.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:s.withCtx(()=>[s.createVNode(h,{onClick:l},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).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=s.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(s.openBlock(),s.createBlock(Ft,{"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"]))}}),il={class:"analytics-chart"},rl={key:3,class:"analytics-chart"},nl=Ce(s.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:n}=ce.useI18n(),{issueRequestsQuery:o}=ce.useIssueRequestsQuery(),a=s.computed(()=>t.query.datasource==="requests"),l=s.computed(()=>{const b=t.query,v=b.time_range??t.context.timeSpec,U=v?Pt(v):void 0;if(!U)return b;const z=Q.finestGranularityForDuration(U);let p;return b.granularity&&Q.Granularities[b.granularity]>=Q.Granularities[z]?p=b.granularity:p=z,{...b,granularity:p}}),d=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=s.ref(null),{data:u,error:h,isValidating:f}=ii(d,async()=>{const b=d(),v=t.query;try{const U=await o(v,t.context);return d()!==b?void 0:(c.value=null,we.requestsToScatterData(U,Pa(v)))}catch(U){if(d()!==b)return;throw c.value=we.handleQueryError(U),U}finally{d()===b&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:_}=ar(u,h,f),O=s.ref(),C=s.computed(()=>u.value??O.value);s.watch(u,b=>{b&&(O.value=b)});const T=s.computed(()=>m.value===_.ERROR||!!c.value),k=s.computed(()=>!T.value&&(!t.queryReady||m.value===_.PENDING)&&!C.value),E=s.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,v)=>{const U=s.resolveComponent("KSkeleton"),z=s.resolveComponent("KEmptyState");return a.value?k.value?(s.openBlock(),s.createBlock(U,{key:1,class:"chart-skeleton",type:"table"})):T.value?(s.openBlock(),s.createBlock(z,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[c.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(ie.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(ie.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value?.message||s.unref(n).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):C.value?(s.openBlock(),s.createElementBlock("div",rl,[s.createVNode(s.unref(we.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"])])):s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(Ke,{key:0,context:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:v[0]||(v[0]=p=>i("chart-data",p)),onQueryComplete:v[1]||(v[1]=p=>i("query-complete"))},{default:s.withCtx(({data:p})=>[s.createElementVNode("div",il,[s.createVNode(s.unref(we.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=s.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,n)=>(s.openBlock(),s.createBlock(Ft,{"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:n[0]||(n[0]=o=>t("select-chart-range",o)),onZoomTimeRange:n[1]||(n[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"]))}}),sl=Ce(s.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=s.computed(()=>{const n=e.query?.datasource;if(n&&n!=="api_usage"&&n!=="basic")throw new Error(`Invalid datasource value: ${n}`);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=s.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(n,o)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[s.createVNode(s.unref(ri.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(ri.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 ol=r=>!!r?.length;function al(r,e,t,i=ol){const n=s.computed(()=>i(r.value)),o=s.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":n.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:rt,hasData:n,state:o}}const ll=({emitState:r,fetchLifecycleState:e,hasData:t})=>{s.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:n})=>{if(n!==rt.PENDING){if(n===rt.LOADING){r({hasData:i,state:"loading"});return}if(n===rt.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},cl=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},ul=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:n})=>{if(typeof i=="number")return i;if(n!==!0&&(n===!1||e<t))return r+e},dl=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,n=new Map,o=s.ref(0),a=s.ref(0),l=s.shallowRef(),d=s.shallowRef(),c=s.shallowRef(),u=s.ref(0),h=s.ref(!1);let f,m,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;const C=K=>K===o.value&&f===r.value&&m===e?.value,T=(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=u.value>0},b=()=>{a.value+=1,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;for(const K of n.values())K.resolve(!1);i.clear(),n.clear(),d.value=void 0,c.value=void 0,u.value=0,E()},v=()=>{c.value=void 0,u.value+=1,E()},U=()=>{u.value=Math.max(0,u.value-1),E()},z=K=>{const q=n.get(K);if(q)return q;let V;const P={promise:new Promise(F=>{V=F}),resolve:F=>V(F)};return n.set(K,P),P},p=(K,q)=>{q.resolve(!1),n.get(K)===q&&n.delete(K)},g=async({blockIndex:K,currentBlockCompletion:q,datasourceId:V,requestGeneration:P})=>{if(K===0)return"ready";const F=n.get(K-1);if(!F)return p(K,q),"failed";const M=await F.promise;return T(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,ul({startRow:V.startRow,rowsLength:F.data.length,pageSize:P,total:F.total,hasMore:F.hasMore})),V.startRow===0&&(d.value=F.data),q.resolve(!0)},S=({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}=cl({startRow:V.startRow,endRow:V.endRow});P===0&&n.has(0)&&b();const M=a.value,A=z(P);if(await g({blockIndex:P,currentBlockCompletion:A,datasourceId:q,requestGeneration:M})!=="ready"||!T(q,M)){V.failCallback(),p(P,A);return}v();try{const w=P>0?i.get(P-1):void 0,D=await K({mode:"infinite",pageSize:F,cursor:w,sort:t?.value});if(!T(q,M)){V.failCallback(),p(P,A);return}y({blockIndex:P,currentBlockCompletion:A,getRowsParams:V,pageSize:F,result:D})}catch(w){if(!T(q,M)){V.failCallback(),p(P,A);return}S({blockIndex:P,currentBlockCompletion:A,fetchError:w,getRowsParams:V})}finally{T(q,M)&&U()}}}},N=()=>{l.value=x()};return s.watch([r,()=>e?.value],()=>{N()},{immediate:!0}),s.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>b()),{datasource:s.readonly(l),data:s.shallowReadonly(d),error:s.readonly(c),isFetching:s.readonly(h)}},hl={title:"No Data",message:"There is no data to display."},fl={title:"An error occurred",message:"Data cannot be displayed due to an error."},ml={emptyState:hl,errorState:fl};function dr(){const r=at.createI18n("en-us",ml);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:pl}=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,gl=(r,e)=>r.reduce((t,i)=>{const n=pt(Reflect.get(i,e.key));return n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)}},{sum:0,max:0}),_l=(r,e)=>{const t=(e??[]).filter(n=>Number.isFinite(n.value)&&r>=n.value);if(!t.length)return;const i=Math.max(...t.map(n=>n.value));return t.filter(n=>n.value===i).some(n=>n.type==="error")?"error":"warning"},yl=(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},Rl=r=>{const e=t=>pl.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)??Rl(i)},mr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Cl=({rows:r,header:e,stats:t})=>r.reduce((i,n)=>({value:mr(i.value,hr(e,n))??"",relative:e.showPercentage?mr(i.relative,fr({value:pt(Reflect.get(n,e.key)),stats:t,header:e})):void 0}),{value:""}),El=["data-threshold"],Ol={class:"table-data-grid-cell-label-track"},bl={class:"table-data-grid-cell-label"},wl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},Tl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},vl=["data-text"],Sl=["data-text"],xl=["data-threshold"],Il=s.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=s.shallowRef(r.params),i=s.ref(null),n=s.ref(!1),o=s.computed(()=>t.value.headerDef??{key:"",label:""}),a=s.computed(()=>t.value.context?.presentation),l=s.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),d=s.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=s.computed(()=>t.value.value),u=s.computed(()=>pt(c.value)),h=s.computed(()=>a.value?.stats[o.value.key]),f=s.computed(()=>o.value.showPercentage&&h.value?fr({value:u.value,stats:h.value,header:o.value}):void 0),m=s.computed(()=>!!o.value.bar&&!!h.value&&(u.value!==null||c.value===null||c.value===void 0)),_=s.computed(()=>m.value&&h.value?yl(u.value,h.value,o.value.bar)*100:0),O=s.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),C=s.computed(()=>o.value.thresholds?.length&&u.value!==null?_l(u.value,o.value.thresholds):void 0),T=s.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:S})=>{const x=t.value.colDef?.colId,N=t.value.context?.cells?.slots;return!x||x==="cell-icon"||!N?.[x]?S.default?.():s.h("span",{class:"table-data-grid-cell-slot-content"},s.renderSlot(N,x,T.value,()=>S.default?.()??[]))},E=()=>{const y=t.value.context?.cells?.slots;return y?.["cell-icon"]?s.renderSlot(y,"cell-icon",T.value):null};let b,v,U=!1;const z=()=>{const y=i.value;n.value=!!y&&y.scrollWidth>y.clientWidth},p=()=>{U||(v!==void 0&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=void 0,z()}))},g=y=>{if(b?.disconnect(),y){b?.observe(y);const S=y.closest(".ag-cell");S&&b?.observe(S)}p()};return s.onMounted(()=>{b=new ResizeObserver(p),g(i.value)}),s.watch(i,g),s.onUnmounted(()=>{U=!0,b?.disconnect(),v!==void 0&&cancelAnimationFrame(v)}),e({refresh(y){return t.value=y,s.nextTick(p),!0}}),(y,S)=>{const x=s.resolveComponent("KTooltip");return s.openBlock(),s.createElementBlock("span",{class:s.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},[s.createElementVNode("span",Ol,[s.createElementVNode("span",bl,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(E))),(s.openBlock(),s.createBlock(s.resolveDynamicComponent(k),null,{default:s.withCtx(()=>[s.createVNode(x,{class:"table-data-grid-cell-tooltip",disabled:!n.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:d.value},{default:s.withCtx(()=>[s.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},s.toDisplayString(d.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(s.openBlock(),s.createElementBlock("span",wl,"("+s.toDisplayString(f.value)+")",1)):s.createCommentVNode("",!0)]),O.value?(s.openBlock(),s.createElementBlock("span",Tl,[s.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":O.value.value},null,8,vl),O.value.relative?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${O.value.relative})`},null,8,Sl)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]),m.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":C.value},[s.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:s.normalizeStyle({width:`${_.value}%`})},null,4)],8,xl)):s.createCommentVNode("",!0)],10,El)}}}),Dl=({headers:r,slots:e,initialSort:t,mode:i,rows:n,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,d=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);s.watch([r,()=>n?.value],()=>{r.value.forEach(m=>{if(!d(m))return;let _;if(a==="infinite"&&(m.showPercentage||m.bar)?_="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&n?.value?.some(C=>{const T=Reflect.get(C,m.key);return T!=null&&pt(T)===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=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(_=>_.showPercentage||_.bar).map(_=>[_.key,gl(m,_)]))}),u=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(_=>_.bar).map(_=>[_.key,Cl({rows:m,header:_,stats:c.value[_.key]})]))}),h=s.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:u.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:Il,cellRendererParams:{headerDef:m}}};return{columnDefs:s.computed(()=>r.value.map(f)),gridContext:h}},$t=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),n=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:n,sortColumnOrder:n?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,kl=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:n,onExternalConfigChange:o})=>{const a=s.computed(()=>t.value?$t({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=s.ref(a.value??$t({config:void 0,headers:r.value,pageSize:e.value}));s.watch(a,h=>{h&&!pr(h,l.value)&&(l.value=h,o?.(h))});const d=h=>{const f=$t({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,n(f))};s.watch(r,()=>{t.value||d({})},{deep:!0});const c=s.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),u=s.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:s.readonly(l),activeSort:c,activePageSize:u,patchTableConfig:d}},Nl=({cellClick:r,headers:e,rowClick:t})=>{const i=s.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),n=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=n(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)}}},Al=({activeSort:r,patchTableConfig:e})=>{const t=(i,n)=>{i.applyColumnState({state:n.sortColumnKey?[{colId:n.sortColumnKey,sort:n.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const n=i.api.getColumnState().filter(l=>l.sort).sort((l,d)=>(l.sortIndex??0)-(d.sortIndex??0)),o=n[n.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),n.length>1&&t(i.api,a)},applySortToGrid:t}},Ll={key:0,class:"table-error-state","data-testid":"table-error-state"},Ul={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Kl=s.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:n}=dr(),{t:o}=n,a=s.useSlots(),l=s.shallowRef(),d=s.useTemplateRef("rootElement"),c=s.shallowRef("body"),u=()=>{const A=document.fullscreenElement;c.value=A instanceof HTMLElement&&A.contains(d.value??null)?A:"body"};s.onMounted(()=>{u(),document.addEventListener("fullscreenchange",u)}),s.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",u)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:_}=kl({headers:s.toRef(()=>r.headers),pageSize:s.toRef(()=>r.pageSize),tableConfig:s.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}=Al({activeSort:f,patchTableConfig:_}),T=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Qe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:b}=Nl({cellClick:A=>i("cell:click",A),headers:s.toRef(()=>r.headers),rowClick:(A,w)=>i("row:click",A,w)}),v={resizable:!1,sortable:!1,suppressMovable:!0},U=s.computed(()=>[m.value,r.refreshKey]),z=t==="infinite"?dl({fetcher:s.toRef(()=>r.fetcher),resetKey:U,sort:f}):void 0,p=z?.datasource,g=s.computed(()=>z?z.data.value:r.rows),y=s.computed(()=>z?.isFetching.value??!1),S=s.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:x,gridContext:N}=Dl({headers:s.toRef(()=>r.headers),mode:t,rows:S,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:q,state:V}=al(g,s.toRef(()=>z?.error.value),y),P=s.computed(()=>V.value===K.SUCCESS&&!q.value);z&&ll({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)};s.watch([l,f],F);const M=A=>{l.value=A.api,i("grid:ready",A.api)};return(A,w)=>{const D=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"rootElement",ref:d,class:s.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":T.value}]),"data-testid":"table-data-grid"},[r.error?(s.openBlock(),s.createElementBlock("div",Ll,[s.renderSlot(A.$slots,"error-state",{},()=>[s.createVNode(D,{"icon-variant":"error",message:s.unref(o)("errorState.message"),title:s.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):P.value?(s.openBlock(),s.createElementBlock("div",Ul,[s.renderSlot(A.$slots,"empty-state",{},()=>[s.createVNode(D,{message:s.unref(o)("emptyState.message"),title:s.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(s.openBlock(),s.createBlock(s.unref(zr.AgGridVue),{key:2,"cache-block-size":s.unref(t)==="infinite"?s.unref(m):void 0,class:"table-data-grid-grid","column-defs":s.unref(x),context:s.unref(N),datasource:s.unref(t)==="infinite"?s.unref(p):void 0,"default-col-def":v,"dom-layout":T.value?"autoHeight":"normal","infinite-initial-row-count":s.unref(t)==="infinite"?1:void 0,loading:y.value,"row-data":s.unref(t)==="unpaginated"?S.value:void 0,"row-model-type":s.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:s.unref(k),onCellClicked:s.unref(E),onGridReady:M,onNewColumnsLoaded:F,onRowClicked:s.unref(b),onSortChanged:s.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)}}}),Ml=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},gr=Ml(Kl,[["__scopeId","data-v-01cd8bcd"]]),_r=3,Bl={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},Wt=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},zl=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!(Wt(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Bl[t.toLowerCase()]},Pl=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},ql=r=>r.toLocaleLowerCase().endsWith("count"),Hl=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,_r),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const n={record:i};return e.forEach(o=>{n[o]=i.event[o]}),t.forEach(o=>{n[o]=Pl(i.event[o])}),n})},Gl=({data:r,columnOptions:e,i18n:t})=>{const{formatUnit:i}=Q.unitFormatter({i18n:t}),n=r?.data??[],o=r?.meta,a=o?.display??{},l=Object.keys(a).slice(0,_r),d=o?.metric_names??[],c=d[0],u=l.length>1,h=E=>{const b=`chartLabels.${E}`;return t.messages[b]?t.formatMessage({id:b}):E},f=(E,b)=>Wt(e,E)?.label||b,m=(E,b)=>{if(ql(E)||E==="requests")return"";const v=b===1?"":"s",U=`chartUnits.${E}`;return t.messages[U]?t.formatMessage({id:U},{plural:v}):E},_=E=>{const b=v=>i(v,"%",{translateUnit:m});return E>0&&E<.01?`< ${b(.01)}`:b(E)},O=(E,b)=>{const v=E.event[b];if(v==null)return"–";const U=typeof v=="number"?v:Number(v);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 v=String(E.record.event[b]),U=a[b]?.[v];return{id:v,label:U?.name||"-",deleted:!!U?.deleted}},T=l.map(E=>({key:E,label:f(E,u?h(E):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(b,v)=>C(v,E).label,sortable:!1}));d.forEach(E=>{const b=Wt(e,E);T.push({key:E,label:b?.label||h(E),type:"metric",valueFormatter:(v,U)=>O(U.record,E),showPercentage:b?.value==="relative",percentageFormatter:_,bar:b?.bar==="max"?"absolute":b?.bar,thresholds:b?.thresholds,sortable:!1})});const k=n.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:T,errorMessage:k,getDimension:C}},Fl={class:"fallback-entity-link","data-testid":"entity-link-parent"},yr=s.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Fl,s.toDisplayString(r.entityLinkData.label),1))}}),$l=["data-testid"],Wl={key:1},Vl=Ce(s.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=s.inject(ve),{i18n:t}=ce.useI18n(),i=s.computed(()=>Hl(r.data)),n=s.computed(()=>Gl({data:r.data,columnOptions:r.chartOptions.column_options,i18n:t})),o=s.computed(()=>n.value.headers.map(_=>({..._,minWidth:_.type==="dimension"?160:_.bar?260:140}))),a=s.computed(()=>n.value.headers.filter(_=>_.type==="dimension")),l=s.computed(()=>({fitToContent:r.fitToContent})),d=s.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),c=(_,O)=>zl({columnOptions:r.chartOptions.column_options,columnKey:_,rawValue:O}),u=s.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),T=String(_[O]);if(T.includes(":")){const[k,E]=T.split(":");return C.replace(Fi,k).replace(Ut,E)}return C.replace(Ut,T)};return(_,O)=>{const C=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{class:"top-n-data-grid","data-testid":i.value.length?"top-n-table":void 0,style:s.normalizeStyle(d.value)},[s.createVNode(s.unref(gr),{error:!!n.value.errorMessage,headers:o.value,mode:"unpaginated",rows:i.value,"table-config":l.value},s.createSlots({"error-state":s.withCtx(()=>[s.createVNode(C,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(ie.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(n.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(C,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:s.unref(t).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":s.withCtx(({column:T,rowValue:k})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(c(T.key,k)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[s.renderList(a.value,T=>({name:T.key,fn:s.withCtx(({row:k})=>[f(T.key)&&k[T.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(u),{key:0,class:"top-n-entity-link","entity-link-data":n.value.getDimension(k,T.key),"external-link":m(k,T.key)},null,8,["entity-link-data","external-link"])):n.value.getDimension(k,T.key).label==="empty"?(s.openBlock(),s.createElementBlock("i",Wl,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,$l)}}}),[["__scopeId","data-v-f6b76589"]]),Yl=s.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)=>(s.openBlock(),s.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:s.withCtx(({data:i})=>[s.createVNode(Vl,{"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"]))}}),Xl=s.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,n=s.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=s.computed(()=>new Map(n.value.map((c,u)=>[c,o(t.chartOptions.columns[u])]))),l=new Set,d=c=>{l.add(c),l.size===n.value.length&&(l.clear(),i("query-complete"))};return s.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,u)=>(s.openBlock(),s.createBlock(s.unref(we.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:n.value,"size-metric":r.chartOptions.size_metric},{column:s.withCtx(({column:h})=>[s.createVNode(Ke,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>d(h)},{default:s.withCtx(({data:f})=>[s.createVNode(s.unref(we.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"]))}}),jl=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,n])=>{if(n===null)return;const o=r.meta.display?.[i]?.[String(n)]?.name;o&&(t[i]=o)}),t}),Rr=({canTranslate:r,columns:e,translate:t})=>e.map(i=>{const n=`chartLabels.${i}`;return{key:i,label:r(n)?t(n):i}}),Ql={platform:Rr,platform_usage:Rr},Cr=async({abortController:r,context:e,cursor:t,pageSize:i,query:n,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const d=n.query,c=a({datasource:n.datasource,filters:[...d.filters??[],...e.filters],queryFields:d.entity===void 0?void 0:[d.entity]}),u=await l({datasource:n.datasource,query:{columns:d.columns,cursor:t===void 0?d.cursor:String(t),entity:d.entity,filters:c,page_size:i}},r);return u.meta.columns?.length&&o?.(u.meta.columns),{data:jl(u),cursor:u.meta.cursor,hasMore:!!u.meta.cursor}},Zl={platform:Cr,platform_usage:Cr},Jl=Ce(s.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,n=s.inject(ve),o=Ne.useDatasourceConfigStore(),{i18n:a}=ce.useI18n(),l=new AbortController,d=s.ref([]),c=s.ref(!1),u=s.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=s.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=s.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}}));s.onUnmounted(()=>{l.abort()});const m=s.computed(()=>Ql[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:d.value,translate:C=>a.t(C),canTranslate:C=>a.te(C)})),_=s.computed(()=>async({cursor:C,pageSize:T})=>{try{await o.isReady();const k=Zl[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:T,query:h.value,onResponseColumns:b=>{d.value=b},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:n?.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,T)=>{const k=s.resolveComponent("KSkeleton");return s.openBlock(),s.createElementBlock("div",{class:"table-data-grid-renderer",style:s.normalizeStyle(u.value)},[r.queryReady?(s.openBlock(),s.createBlock(s.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"])):(s.openBlock(),s.createBlock(k,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c49ff2eb"]]),ec=s.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(s.openBlock(),s.createBlock(Ft,{"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"]))}}),tc="#ffffff",ic="#0044f4",rc="#d60027",nc="#ad000e",sc="#850000",oc="#5c0000",ac="#ff3954",lc="#ffabab",cc="#ffe5e5",uc="#ecfcff",dc="#6f28ff",hc="#f1f0ff",fc="#e0e4ea",mc="#0044f4",pc="#0030cc",gc="#002099",_c="#001466",yc="#5f9aff",Rc="#bee2ff",Cc="#eefaff",Ec="#0d0e14",Oc="#6c7489",bc="#52596e",wc="#3a3f51",Tc="#232633",vc="#afb7c5",Sc="#e0e4ea",xc="#f9fafb",Ic="rgba(13, 14, 20, 0.6)",Dc="#0044f4",kc="#0030cc",Nc="#002099",Ac="#001466",Lc="#5f9aff",Uc="#bee2ff",Kc="#eefaff",Mc="#007d60",Bc="#005944",zc="#004737",Pc="#003629",qc="#00d6a4",Hc="#b5ffee",Gc="#ecfffb",Fc="rgba(0, 0, 0, 0)",$c="#995c00",Wc="#804400",Vc="#662d00",Yc="#4d1b00",Xc="#ffc400",jc="#fff296",Qc="#fffce0",Zc="#e0e4ea",Jc="#0044f4",eu="#d60027",tu="#ad000e",iu="#850000",ru="#5c0000",nu="#ff3954",su="#ffabab",ou="#ffe5e5",au="#6f28ff",lu="#e0e4ea",cu="rgba(255, 255, 255, 0.2)",uu="#6c7489",du="#52596e",hu="#3a3f51",fu="#232633",mu="#afb7c5",pu="#e0e4ea",gu="#f9fafb",_u="#0044f4",yu="#0030cc",Ru="#002099",Cu="#001466",Eu="#5f9aff",Ou="#bee2ff",bu="#eefaff",wu="rgba(0, 0, 0, 0)",Tu="#0044f4",vu="#0d0e14",Su="#0044f4",xu="#d60027",Iu="#ad000e",Du="#850000",ku="#5c0000",Nu="#ff3954",Au="#ffabab",Lu="#ffe5e5",Uu="#00abd2",Ku="#d60067",Mu="#6f28ff",Bu="#5e00f5",zu="#afb7c5",Pu="#0044f4",qu="#0030cc",Hu="#002099",Gu="#001466",Fu="#5f9aff",$u="#bee2ff",Wu="#eefaff",Vu="#ffffff",Yu="#6c7489",Xu="#52596e",ju="#3a3f51",Qu="#232633",Zu="#afb7c5",Ju="#e0e4ea",ed="#f9fafb",td="#0044f4",id="#0030cc",rd="#002099",nd="#001466",sd="#5f9aff",od="#bee2ff",ad="#eefaff",ld="#007d60",cd="#005944",ud="#004737",dd="#003629",hd="#00d6a4",fd="#b5ffee",md="#ecfffb",pd="#995c00",gd="#804400",_d="#662d00",yd="#4d1b00",Rd="#ffc400",Cd="#fff296",Ed="#fffce0",Od="0.2s",bd="0px",wd="2px",Td="4px",vd="6px",Sd="8px",xd="10px",Id="50%",Dd="100px",kd="0px",Nd="1px",Ad="2px",Ld="4px",Ud="640px",Kd="768px",Md="1024px",Bd="1280px",zd="1536px",Pd="'JetBrains Mono', Consolas, monospace",qd="'Inter', Roboto, Helvetica, sans-serif",Vt="'Inter', Roboto, Helvetica, sans-serif",Hd="10px",Gd="12px",Fd="14px",$d="16px",Wd="18px",Vd="20px",Yd="24px",Xd="32px",jd="40px",Qd="48px",Zd="700",Jd="500",eh="400",th="600",ih="#f50045",rh="#828a9e",nh="#306fff",sh="#00a17b",oh="#ffc400",ah="10px",lh="12px",ch="16px",uh="20px",dh="24px",hh="32px",fh="40px",mh="48px",ph="normal",gh="-0.12px",_h="-0.24px",yh="-0.32px",Rh="-0.4px",Ch="-0.48px",Eh="normal",Oh="12px",bh="16px",wh="20px",Th="24px",vh="28px",Sh="32px",xh="36px",Ih="40px",Dh="48px",kh="56px",Nh="#f1f0ff",Ah="#ffe5e5",Lh="#eefaff",Uh="#52596e",Kh="#e0e4ea",Mh="#ecfcff",Bh="#ecfffb",zh="#fffce0",Ph="#fff0f7",qh="#6f28ff",Hh="#5e00f5",Gh="#d60027",Fh="#ad000e",$h="#0044f4",Wh="#0030cc",Vh="#e0e4ea",Yh="#afb7c5",Xh="#52596e",jh="#3a3f51",Qh="#00819d",Zh="#00647a",Jh="#007d60",ef="#005944",tf="#995c00",rf="#804400",nf="#d60067",sf="#ad0053",of="#000933",af="rgba(255, 255, 255, 0.12)",lf="rgba(255, 255, 255, 0.12)",cf="#00fabe",uf="rgba(255, 255, 255, 0.24)",df="#bee2ff",hf="#ffffff",ff="#eefaff",mf="#00fabe",pf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",gf="4px 0 0 0 #00fabe inset",_f="0 0 0 1px rgba(255, 255, 255, 0.60) inset",yf="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",Rf="0px 0px 0px 1px #e0e4ea inset",Cf="0px 0px 0px 1px #d60027 inset",Ef="0px 0px 0px 1px #ad000e inset",Of="0px 0px 0px 1px #e0e4ea inset",bf="0px 0px 0px 1px #0044f4 inset",wf="0px 0px 0px 1px #001466 inset",Tf="0px 0px 0px 1px #5f9aff inset",vf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Sf="0px",xf="2px",If="4px",Df="6px",kf="8px",Nf="12px",Af="16px",Lf="20px",Uf="24px",Kf="32px",Mf="40px",Bf="48px",zf="56px",Pf="64px",qf="80px",Hf="96px",Gf="auto",Ff="#bee2ff",$f="#8fc1ff",Wf="#5f9aff",Vf="#306fff",Yf="#b5ffee",Xf="#00fabe",jf="#00d6a4",Qf="#00a17b",Zf="#007d60",Jf="#005944",em="#b5ffee",tm="#00fabe",im="#b5ffee",rm="#00a17b",nm="#fff296",sm="#ffe04b",om="#ffc400",am="#b37600",lm="#995c00",cm="#804400",um="#fff296",dm="#ffe04b",hm="#ffc2b3",fm="#ff9877",mm="#ff723c",pm="#f75008",gm="#d13500",_m="#a31f00",ym="#ffc2b3",Rm="#ff9877",Cm="#ff723c",Em="#f75008",Om="#d13500",bm="#a31f00",wm="#ffc2b3",Tm="#ff9877",vm="#ff723c",Sm="#f75008",xm="#d13500",Im="#a31f00",Dm="#ffc2b3",km="#ff9877",Nm="#ff723c",Am="#f75008",Lm="#d13500",Um="#a31f00",Km="#ffc2b3",Mm="#ff9877",Bm="#ff723c",zm="#f75008",Pm="#d13500",qm="#ffabab",Hm="#ff7272",Gm="#ff3954",Fm="#f50045",$m="#d60027",Wm="#ad000e",Vm="#ffabab",Ym="#ff7272",Xm="#ff3954",jm="#f50045",Qm="#d60027",Zm="#eefaff",Jm="#ecfffb",ep="#fffce0",tp="#fff1ef",ip="#ffe5e5",rp="#5f9aff",np="#00d6a4",sp="#ffc400",op="#ff723c",ap="#ff3954",lp="#eefaff",cp="#ecfffb",up="#fffce0",dp="#fff1ef",hp="#ffe5e5",fp="#0044f4",mp="#007d60",pp="#995c00",gp="#d13500",_p="#d60027",Er=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Od,KUI_BORDER_RADIUS_0:bd,KUI_BORDER_RADIUS_10:wd,KUI_BORDER_RADIUS_20:Td,KUI_BORDER_RADIUS_30:vd,KUI_BORDER_RADIUS_40:Sd,KUI_BORDER_RADIUS_50:xd,KUI_BORDER_RADIUS_CIRCLE:Id,KUI_BORDER_RADIUS_ROUND:Dd,KUI_BORDER_WIDTH_0:kd,KUI_BORDER_WIDTH_10:Nd,KUI_BORDER_WIDTH_20:Ad,KUI_BORDER_WIDTH_30:Ld,KUI_BREAKPOINT_DESKTOP:zd,KUI_BREAKPOINT_LAPTOP:Bd,KUI_BREAKPOINT_MOBILE:Ud,KUI_BREAKPOINT_PHABLET:Kd,KUI_BREAKPOINT_TABLET:Md,KUI_COLOR_BACKGROUND:tc,KUI_COLOR_BACKGROUND_ACCENT:ic,KUI_COLOR_BACKGROUND_DANGER:rc,KUI_COLOR_BACKGROUND_DANGER_STRONG:nc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:sc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:oc,KUI_COLOR_BACKGROUND_DANGER_WEAK:ac,KUI_COLOR_BACKGROUND_DANGER_WEAKER:lc,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:cc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:uc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:dc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:hc,KUI_COLOR_BACKGROUND_DISABLED:fc,KUI_COLOR_BACKGROUND_INFO:mc,KUI_COLOR_BACKGROUND_INFO_STRONG:pc,KUI_COLOR_BACKGROUND_INFO_STRONGER:gc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:_c,KUI_COLOR_BACKGROUND_INFO_WEAK:yc,KUI_COLOR_BACKGROUND_INFO_WEAKER:Rc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Cc,KUI_COLOR_BACKGROUND_INVERSE:Ec,KUI_COLOR_BACKGROUND_NEUTRAL:Oc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:bc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:wc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:Tc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:vc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:Sc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:xc,KUI_COLOR_BACKGROUND_OVERLAY:Ic,KUI_COLOR_BACKGROUND_PRIMARY:Dc,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:kc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:Nc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Ac,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Lc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Uc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Kc,KUI_COLOR_BACKGROUND_SUCCESS:Mc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Bc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:zc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:Pc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:qc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:Hc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Gc,KUI_COLOR_BACKGROUND_TRANSPARENT:Fc,KUI_COLOR_BACKGROUND_WARNING:$c,KUI_COLOR_BACKGROUND_WARNING_STRONG:Wc,KUI_COLOR_BACKGROUND_WARNING_STRONGER:Vc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:Yc,KUI_COLOR_BACKGROUND_WARNING_WEAK:Xc,KUI_COLOR_BACKGROUND_WARNING_WEAKER:jc,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:Qc,KUI_COLOR_BORDER:Zc,KUI_COLOR_BORDER_ACCENT:Jc,KUI_COLOR_BORDER_DANGER:eu,KUI_COLOR_BORDER_DANGER_STRONG:tu,KUI_COLOR_BORDER_DANGER_STRONGER:iu,KUI_COLOR_BORDER_DANGER_STRONGEST:ru,KUI_COLOR_BORDER_DANGER_WEAK:nu,KUI_COLOR_BORDER_DANGER_WEAKER:su,KUI_COLOR_BORDER_DANGER_WEAKEST:ou,KUI_COLOR_BORDER_DECORATIVE_PURPLE:au,KUI_COLOR_BORDER_DISABLED:lu,KUI_COLOR_BORDER_INVERSE:cu,KUI_COLOR_BORDER_NEUTRAL:uu,KUI_COLOR_BORDER_NEUTRAL_STRONG:du,KUI_COLOR_BORDER_NEUTRAL_STRONGER:hu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:fu,KUI_COLOR_BORDER_NEUTRAL_WEAK:mu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:pu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:gu,KUI_COLOR_BORDER_PRIMARY:_u,KUI_COLOR_BORDER_PRIMARY_STRONG:yu,KUI_COLOR_BORDER_PRIMARY_STRONGER:Ru,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Cu,KUI_COLOR_BORDER_PRIMARY_WEAK:Eu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Ou,KUI_COLOR_BORDER_PRIMARY_WEAKEST:bu,KUI_COLOR_BORDER_TRANSPARENT:wu,KUI_COLOR_BRAND:Tu,KUI_COLOR_TEXT:vu,KUI_COLOR_TEXT_ACCENT:Su,KUI_COLOR_TEXT_DANGER:xu,KUI_COLOR_TEXT_DANGER_STRONG:Iu,KUI_COLOR_TEXT_DANGER_STRONGER:Du,KUI_COLOR_TEXT_DANGER_STRONGEST:ku,KUI_COLOR_TEXT_DANGER_WEAK:Nu,KUI_COLOR_TEXT_DANGER_WEAKER:Au,KUI_COLOR_TEXT_DANGER_WEAKEST:Lu,KUI_COLOR_TEXT_DECORATIVE_AQUA:Uu,KUI_COLOR_TEXT_DECORATIVE_PINK:Ku,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Mu,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Bu,KUI_COLOR_TEXT_DISABLED:zu,KUI_COLOR_TEXT_INFO:Pu,KUI_COLOR_TEXT_INFO_STRONG:qu,KUI_COLOR_TEXT_INFO_STRONGER:Hu,KUI_COLOR_TEXT_INFO_STRONGEST:Gu,KUI_COLOR_TEXT_INFO_WEAK:Fu,KUI_COLOR_TEXT_INFO_WEAKER:$u,KUI_COLOR_TEXT_INFO_WEAKEST:Wu,KUI_COLOR_TEXT_INVERSE:Vu,KUI_COLOR_TEXT_NEUTRAL:Yu,KUI_COLOR_TEXT_NEUTRAL_STRONG:Xu,KUI_COLOR_TEXT_NEUTRAL_STRONGER:ju,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:Qu,KUI_COLOR_TEXT_NEUTRAL_WEAK:Zu,KUI_COLOR_TEXT_NEUTRAL_WEAKER:Ju,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:ed,KUI_COLOR_TEXT_PRIMARY:td,KUI_COLOR_TEXT_PRIMARY_STRONG:id,KUI_COLOR_TEXT_PRIMARY_STRONGER:rd,KUI_COLOR_TEXT_PRIMARY_STRONGEST:nd,KUI_COLOR_TEXT_PRIMARY_WEAK:sd,KUI_COLOR_TEXT_PRIMARY_WEAKER:od,KUI_COLOR_TEXT_PRIMARY_WEAKEST:ad,KUI_COLOR_TEXT_SUCCESS:ld,KUI_COLOR_TEXT_SUCCESS_STRONG:cd,KUI_COLOR_TEXT_SUCCESS_STRONGER:ud,KUI_COLOR_TEXT_SUCCESS_STRONGEST:dd,KUI_COLOR_TEXT_SUCCESS_WEAK:hd,KUI_COLOR_TEXT_SUCCESS_WEAKER:fd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:md,KUI_COLOR_TEXT_WARNING:pd,KUI_COLOR_TEXT_WARNING_STRONG:gd,KUI_COLOR_TEXT_WARNING_STRONGER:_d,KUI_COLOR_TEXT_WARNING_STRONGEST:yd,KUI_COLOR_TEXT_WARNING_WEAK:Rd,KUI_COLOR_TEXT_WARNING_WEAKER:Cd,KUI_COLOR_TEXT_WARNING_WEAKEST:Ed,KUI_FONT_FAMILY_CODE:Pd,KUI_FONT_FAMILY_HEADING:qd,KUI_FONT_FAMILY_TEXT:Vt,KUI_FONT_SIZE_10:Hd,KUI_FONT_SIZE_100:Qd,KUI_FONT_SIZE_20:Gd,KUI_FONT_SIZE_30:Fd,KUI_FONT_SIZE_40:$d,KUI_FONT_SIZE_50:Wd,KUI_FONT_SIZE_60:Vd,KUI_FONT_SIZE_70:Yd,KUI_FONT_SIZE_80:Xd,KUI_FONT_SIZE_90:jd,KUI_FONT_WEIGHT_BOLD:Zd,KUI_FONT_WEIGHT_MEDIUM:Jd,KUI_FONT_WEIGHT_REGULAR:eh,KUI_FONT_WEIGHT_SEMIBOLD:th,KUI_ICON_COLOR_DANGER:ih,KUI_ICON_COLOR_NEUTRAL:rh,KUI_ICON_COLOR_PRIMARY:nh,KUI_ICON_COLOR_SUCCESS:sh,KUI_ICON_COLOR_WARNING:oh,KUI_ICON_SIZE_10:ah,KUI_ICON_SIZE_20:lh,KUI_ICON_SIZE_30:ch,KUI_ICON_SIZE_40:uh,KUI_ICON_SIZE_50:dh,KUI_ICON_SIZE_60:hh,KUI_ICON_SIZE_70:fh,KUI_ICON_SIZE_80:mh,KUI_LETTER_SPACING_0:ph,KUI_LETTER_SPACING_MINUS_10:gh,KUI_LETTER_SPACING_MINUS_20:_h,KUI_LETTER_SPACING_MINUS_30:yh,KUI_LETTER_SPACING_MINUS_40:Rh,KUI_LETTER_SPACING_MINUS_50:Ch,KUI_LETTER_SPACING_NORMAL:Eh,KUI_LINE_HEIGHT_10:Oh,KUI_LINE_HEIGHT_100:kh,KUI_LINE_HEIGHT_20:bh,KUI_LINE_HEIGHT_30:wh,KUI_LINE_HEIGHT_40:Th,KUI_LINE_HEIGHT_50:vh,KUI_LINE_HEIGHT_60:Sh,KUI_LINE_HEIGHT_70:xh,KUI_LINE_HEIGHT_80:Ih,KUI_LINE_HEIGHT_90:Dh,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Nh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Ah,KUI_METHOD_COLOR_BACKGROUND_GET:Lh,KUI_METHOD_COLOR_BACKGROUND_HEAD:Uh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Kh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Mh,KUI_METHOD_COLOR_BACKGROUND_POST:Bh,KUI_METHOD_COLOR_BACKGROUND_PUT:zh,KUI_METHOD_COLOR_BACKGROUND_TRACE:Ph,KUI_METHOD_COLOR_TEXT_CONNECT:qh,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:Hh,KUI_METHOD_COLOR_TEXT_DELETE:Gh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Fh,KUI_METHOD_COLOR_TEXT_GET:$h,KUI_METHOD_COLOR_TEXT_GET_STRONG:Wh,KUI_METHOD_COLOR_TEXT_HEAD:Vh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:Yh,KUI_METHOD_COLOR_TEXT_OPTIONS:Xh,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:jh,KUI_METHOD_COLOR_TEXT_PATCH:Qh,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:Zh,KUI_METHOD_COLOR_TEXT_POST:Jh,KUI_METHOD_COLOR_TEXT_POST_STRONG:ef,KUI_METHOD_COLOR_TEXT_PUT:tf,KUI_METHOD_COLOR_TEXT_PUT_STRONG:rf,KUI_METHOD_COLOR_TEXT_TRACE:nf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:sf,KUI_NAVIGATION_COLOR_BACKGROUND:of,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:af,KUI_NAVIGATION_COLOR_BORDER:lf,KUI_NAVIGATION_COLOR_BORDER_CHILD:cf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:uf,KUI_NAVIGATION_COLOR_TEXT:df,KUI_NAVIGATION_COLOR_TEXT_FOCUS:hf,KUI_NAVIGATION_COLOR_TEXT_HOVER:ff,KUI_NAVIGATION_COLOR_TEXT_SELECTED:mf,KUI_NAVIGATION_SHADOW_BORDER:pf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:gf,KUI_NAVIGATION_SHADOW_FOCUS:_f,KUI_SHADOW:yf,KUI_SHADOW_BORDER:Rf,KUI_SHADOW_BORDER_DANGER:Cf,KUI_SHADOW_BORDER_DANGER_STRONG:Ef,KUI_SHADOW_BORDER_DISABLED:Of,KUI_SHADOW_BORDER_PRIMARY:bf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:wf,KUI_SHADOW_BORDER_PRIMARY_WEAK:Tf,KUI_SHADOW_FOCUS:vf,KUI_SPACE_0:Sf,KUI_SPACE_10:xf,KUI_SPACE_100:Mf,KUI_SPACE_110:Bf,KUI_SPACE_120:zf,KUI_SPACE_130:Pf,KUI_SPACE_140:qf,KUI_SPACE_150:Hf,KUI_SPACE_20:If,KUI_SPACE_30:Df,KUI_SPACE_40:kf,KUI_SPACE_50:Nf,KUI_SPACE_60:Af,KUI_SPACE_70:Lf,KUI_SPACE_80:Uf,KUI_SPACE_90:Kf,KUI_SPACE_AUTO:Gf,KUI_STATUS_COLOR_100:Ff,KUI_STATUS_COLOR_100S:rp,KUI_STATUS_COLOR_101:$f,KUI_STATUS_COLOR_102:Wf,KUI_STATUS_COLOR_103:Vf,KUI_STATUS_COLOR_1NA:Zm,KUI_STATUS_COLOR_200:Yf,KUI_STATUS_COLOR_200S:np,KUI_STATUS_COLOR_201:Xf,KUI_STATUS_COLOR_202:jf,KUI_STATUS_COLOR_203:Qf,KUI_STATUS_COLOR_204:Zf,KUI_STATUS_COLOR_205:Jf,KUI_STATUS_COLOR_206:em,KUI_STATUS_COLOR_207:tm,KUI_STATUS_COLOR_208:im,KUI_STATUS_COLOR_226:rm,KUI_STATUS_COLOR_2NA:Jm,KUI_STATUS_COLOR_300:nm,KUI_STATUS_COLOR_300S:sp,KUI_STATUS_COLOR_301:sm,KUI_STATUS_COLOR_302:om,KUI_STATUS_COLOR_303:am,KUI_STATUS_COLOR_304:lm,KUI_STATUS_COLOR_305:cm,KUI_STATUS_COLOR_307:um,KUI_STATUS_COLOR_308:dm,KUI_STATUS_COLOR_3NA:ep,KUI_STATUS_COLOR_400:hm,KUI_STATUS_COLOR_400S:op,KUI_STATUS_COLOR_401:fm,KUI_STATUS_COLOR_402:mm,KUI_STATUS_COLOR_403:pm,KUI_STATUS_COLOR_404:gm,KUI_STATUS_COLOR_405:_m,KUI_STATUS_COLOR_406:ym,KUI_STATUS_COLOR_407:Rm,KUI_STATUS_COLOR_408:Cm,KUI_STATUS_COLOR_409:Em,KUI_STATUS_COLOR_410:Om,KUI_STATUS_COLOR_411:bm,KUI_STATUS_COLOR_412:wm,KUI_STATUS_COLOR_413:Tm,KUI_STATUS_COLOR_414:vm,KUI_STATUS_COLOR_415:Sm,KUI_STATUS_COLOR_416:xm,KUI_STATUS_COLOR_417:Im,KUI_STATUS_COLOR_418:Dm,KUI_STATUS_COLOR_421:km,KUI_STATUS_COLOR_422:Nm,KUI_STATUS_COLOR_423:Am,KUI_STATUS_COLOR_424:Lm,KUI_STATUS_COLOR_425:Um,KUI_STATUS_COLOR_426:Km,KUI_STATUS_COLOR_428:Mm,KUI_STATUS_COLOR_429:Bm,KUI_STATUS_COLOR_431:zm,KUI_STATUS_COLOR_451:Pm,KUI_STATUS_COLOR_4NA:tp,KUI_STATUS_COLOR_500:qm,KUI_STATUS_COLOR_500S:ap,KUI_STATUS_COLOR_501:Hm,KUI_STATUS_COLOR_502:Gm,KUI_STATUS_COLOR_503:Fm,KUI_STATUS_COLOR_504:$m,KUI_STATUS_COLOR_505:Wm,KUI_STATUS_COLOR_506:Vm,KUI_STATUS_COLOR_507:Ym,KUI_STATUS_COLOR_508:Xm,KUI_STATUS_COLOR_510:jm,KUI_STATUS_COLOR_511:Qm,KUI_STATUS_COLOR_5NA:ip,KUI_STATUS_COLOR_BACKGROUND_100:lp,KUI_STATUS_COLOR_BACKGROUND_200:cp,KUI_STATUS_COLOR_BACKGROUND_300:up,KUI_STATUS_COLOR_BACKGROUND_400:dp,KUI_STATUS_COLOR_BACKGROUND_500:hp,KUI_STATUS_COLOR_TEXT_100:fp,KUI_STATUS_COLOR_TEXT_200:mp,KUI_STATUS_COLOR_TEXT_300:pp,KUI_STATUS_COLOR_TEXT_400:gp,KUI_STATUS_COLOR_TEXT_500:_p},Symbol.toStringTag,{value:"Module"})),Or=Object.keys(Er).filter(r=>r.startsWith("KUI_COLOR")),br=r=>Er[r],yp=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(yp(t),br(t))]))},Yt=r=>{const e=s.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"]}),s.getCurrentScope()&&s.onScopeDispose(()=>t.disconnect())}return e},Rp=()=>typeof window>"u"?Vt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Vt,Cp=r=>{const e=Rp(),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}}}},Ep=r=>s.computed(()=>Cp(r.value)),Op={class:"kong-ui-public-echarts-tooltip"},bp={class:"tooltip-title"},wp={class:"title"},Tp={key:0,class:"subtitle"},vp={class:"context"},Sp={class:"metric"},xp={class:"tooltip-rows"},Ip={class:"display-value"},Dp=s.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Op,[s.createElementVNode("div",bp,[s.createElementVNode("div",wp,s.toDisplayString(r.title),1),r.context||r.metric?(s.openBlock(),s.createElementBlock("div",Tp,[s.createElementVNode("div",vp,s.toDisplayString(r.context),1),s.createElementVNode("div",Sp,s.toDisplayString(r.metric),1)])):s.createCommentVNode("",!0)]),s.createElementVNode("ul",xp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.rows,(i,n)=>(s.openBlock(),s.createElementBlock("li",{key:`${i.label}-${n}`,class:s.normalizeClass({"extra-row":i.isExtra})},[s.createElementVNode("span",{class:"square-marker",style:s.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),s.createElementVNode("span",{class:s.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},s.toDisplayString(i.label),3),s.createElementVNode("span",Ip,s.toDisplayString(i.value),1)],2))),128))])]))}}),Tr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},kp=Tr(Dp,[["__scopeId","data-v-ca633353"]]),Xt=r=>Array.isArray(r)?r:[r],vr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,jt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Np=r=>Array.isArray(r)?r[r.length-1]:r,Ap=r=>{const e=Xt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>jt(i,i.seriesName??"",Np(i.value)))}},Lp=r=>{let e;return s.getCurrentScope()&&s.onScopeDispose(()=>{e&&s.render(null,e)}),t=>{const i=(r()??Ap)(t);return i?(e??=document.createElement("div"),s.render(s.h(kp,i),e),e):""}},Up={class:"kong-ui-public-echarts"},Kp=s.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){s.useCssVars(o=>({v1cecfeed:o.height})),bt.use([Hr.CanvasRenderer,lt.GridComponent,lt.TooltipComponent]);const e=Yt(),t=Ep(e),i=Lp(()=>r.tooltipContent),n=s.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(s.openBlock(),s.createElementBlock("div",Up,[s.createVNode(s.unref(qr),s.mergeProps({autoresize:!0,class:"chart",option:n.value,theme:s.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Sr=Tr(Kp,[["__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[n,o]of Object.entries(i)){if(o===void 0)continue;const a=t[n];t[n]=xr(a)&&xr(o)?nt(a,o):o}return t},Mp=s.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([ni.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=Yt(),t=a=>{const[l]=Xt(a),[d,c,u]=l.value;return{title:r.tooltipTitle,context:vr(d,r.xAxisLabels),metric:r.seriesName,rows:[jt(l,vr(c,r.yAxisLabels),u,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}),n=s.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),d=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,[,,u])=>Math.max(c,u),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:d},...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=s.computed(()=>nt(n.value,r.option));return(a,l)=>(s.openBlock(),s.createBlock(Sr,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Bp=s.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([ni.TreemapChart]);const e=Yt(),t=l=>{const[d]=Xt(l),c=d.treePathInfo??[];if(c.length===1)return;const u=c.slice(1,-1).map(({name:h})=>h);return{title:r.tooltipTitle,context:u.length?u.join(" / "):void 0,metric:r.seriesName,rows:[jt(d,d.name,Number(d.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],n=(l=[])=>l.reduce((d,c)=>Math.max(d,1+n(c.children)),0),o=s.computed(()=>({series:[nt({name:r.seriesName,type:"treemap",data:r.data??[],nodeClick:r.drillDown?"zoomToNode":!1,...r.drillDown?{scaleLimit:{min:1,max:1/0},zoomToNodeRatio:.2}:{},leafDepth:r.leafDepth??n(r.data),roam:r.drillDown,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:d})=>`${l}
|
|
13
13
|
${r.valueFormatter?r.valueFormatter(Number(d)):String(d)}`:void 0}},r.seriesOption)]})),a=s.computed(()=>nt(o.value,r.option));return(l,d)=>(s.openBlock(),s.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},zp=(r,e,t)=>{if(!t.length)return r;const i=t.reduce((o,a)=>Math.min(o,a));if(i<=r)return i;const n=Math.ceil((i-r)/e);return i-n*e},Pp=(r,e,t)=>{const i=[];for(let n=r;n<e;n+=t)i.push(n);return i},qp=(r,e,t)=>{const i=o=>ea(o,t,"yyyy-MM-dd"),n=r.length>0&&i(r[0])!==i(r[r.length-1]);return r.map(o=>we.formatChartTicksByGranularity({tickValue:new Date(o),granularity:e,dayBoundaryCrossed:n,timezone:t}))},Hp=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},Gp=(r,e)=>r[e]?.name??e,Fp=(r,{tz:e}={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i,start:n,end:o,granularity_ms:a}=r.meta,l=i?.[0],d=t&&Object.keys(t).find(T=>T!=="time");if(!l||!d||!n||!o){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const c=a||Q.Granularities.daily,u=Q.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=r.data,m=zp(new Date(n).getTime(),c,f.map(({timestamp:T})=>new Date(T).getTime())),_=Pp(m,new Date(o).getTime(),c),O=[],C=[];for(const{timestamp:T,event:k}of f){const E=Math.floor((new Date(T).getTime()-m)/c),b=Ir(k[l]);E<0||E>=_.length||b===void 0||C.push([E,Hp(O,String(k[d])),b])}return{data:C,xAxisLabels:qp(_,u,h),yAxisLabels:O.map(T=>Gp(t[d],T))}},$p={class:"wrapper","data-testid":"heatmap-chart"},Wp=10,Vp=Ce(s.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=r,i=e,{i18n:n}=ce.useI18n(),o=ce.useMetricFormatter(),a=c=>{const u=Fp(c,{tz:t.context.tz});if(u?.data.length)return{data:u.data,xAxisLabels:u.xAxisLabels,yAxisLabels:u.yAxisLabels,...o(c)}},l=new WeakMap,d=c=>(l.has(c)||l.set(c,a(c)),l.get(c));return(c,u)=>{const h=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:u[0]||(u[0]=f=>i("chart-data",f)),onQueryComplete:u[1]||(u[1]=f=>i("query-complete"))},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",$p,[d(f)?(s.openBlock(),s.createBlock(s.unref(Mp),s.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":Wp},d(f)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(h,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-3315f2cd"]]),Dr=(r,e,{otherLabel:t})=>({name:e===we.OTHER_DIMENSION_ID&&t||(r?.[e]?.name??e)}),Yp=(r,e,t,i)=>({...Dr(e,t,i),itemStyle:{color:Rs({dimension:r,dimensionValue:t})}}),kr=(r,e,t)=>{const i=r.get(e)??t();return r.set(e,i),i},Qt=(r,e)=>!e.includes("time")&&(!r||Q.isMetricSupported("treemap",r)),Nr=(r,e)=>{r.value=Number(r.value??0)+e},Xp=(r,e,t,[i,n],o)=>{const a=new Map,l=(d,c)=>String(d[c]);for(const{event:d}of r){const c=Ir(d[e]);if(c===void 0)continue;const u=l(d,i),h=kr(a,u,()=>({node:Yp(i,t[i],u,o),children:new Map}));if(!n){Nr(h.node,c);continue}const f=l(d,n),m=kr(h.children,f,()=>Dr(t[n],f,o));Nr(m,c)}return a},jp=(r,e={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i}=r.meta,n=i?.[0],o=t?Object.keys(t):[];if(!n||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!Qt(n,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...Xp(r.data,n,t,o,e).values()].map(({node:l,children:d})=>d.size?{...l,children:[...d.values()]}:l)},Qp={class:"wrapper","data-testid":"treemap-chart"},Zp=Ce(s.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:n}=ce.useI18n(),o=ce.useMetricFormatter(),a=s.computed(()=>Qt(t.query.metrics?.[0],t.query.dimensions??[])),l=u=>{const h=jp(u,{otherLabel:n.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(u)}},d=new WeakMap,c=u=>(d.has(u)||d.set(u,l(u)),d.get(u));return(u,h)=>{const f=s.resolveComponent("KEmptyState");return s.openBlock(),s.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:s.withCtx(({data:m})=>[s.createElementVNode("div",Qp,[a.value?c(m)?(s.openBlock(),s.createBlock(s.unref(Bp),s.mergeProps({key:1,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0},c(m)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.noDataAvailable.description")),1)]),_:1})):(s.openBlock(),s.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.treemapUnsupported.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),Jp=["data-testid"],eg={key:0,class:"tile-header"},tg={class:"badge-container"},ig={class:"badge-text"},rg={class:"badge-text"},ng={key:0,class:"metric-selector-wrapper"},sg={key:1},og=["data-testid"],ag=["data-testid"],lg=["data-testid"],cg={class:"delete-option"},ug=["data-testid"],Ar=Ce(s.defineComponent({__name:"DashboardTile",props:s.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:s.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}){s.useCssVars(L=>({v692e8c06:`${L.height}px`}));const i=parseInt(zi,10),{zoomConfiguration:n}=ce.useDashboardContext({context:s.computed(()=>r.context),preview:s.computed(()=>r.preview)}),o=s.useModel(r,"refreshCounter"),a=()=>{E.value=!0,o.value++},l=t,d=s.defineAsyncComponent(()=>Promise.resolve().then(()=>xg)),c=s.inject(ve),u=Ne.useDatasourceConfigStore(),{datasourceConfigMap:h,stripUnknownFilters:f}=Xe(u),{i18n:m}=ce.useI18n(),_=s.ref(),O=s.ref({status:"loading"}),C=s.ref(!1),T=s.ref(),k=s.ref(!1),E=s.ref(!0),b=s.computed(()=>r.definition.chart),v=s.computed(()=>"chart_title"in b.value?b.value.chart_title:void 0),U=s.computed(()=>r.definition.header_description),z=s.computed(()=>b.value.type==="slottable"),p=s.computed(()=>Ie(r.definition)||Bt(r.definition)?!1:!("allow_csv_export"in b.value)||b.value.allow_csv_export!==!1),{exploreLinkKebabMenu:g,requestsLinkKebabMenu:y,canShowKebabMenu:S,canGenerateRequestsLink:x,canGenerateExploreLink:N,requestsLinkZoomActions:K,exploreLinkZoomActions:q,buildExploreQuery:V,buildExploreLink:P,buildRequestLink:F,buildRequestsQueryZoomActions:M}=ce.useContextLinks({queryBridge:c,chartData:s.readonly(_),definition:s.toRef(()=>r.definition),context:s.readonly(s.toRef(()=>r.context))}),{issueQuery:A}=ce.useIssueQuery();s.watch(()=>r.definition,async(L,ee)=>{await s.nextTick(),T.value&&(k.value=T.value.scrollWidth>T.value.clientWidth);try{JSON.stringify(L?.query)!==JSON.stringify(ee?.query)&&(E.value=!0)}catch{}},{immediate:!0,deep:!0});const w=s.computed(()=>m.t("csvExport.defaultFilename")),D=s.computed(()=>!!g.value||p.value||!!r.context.editable),I=s.computed(()=>!r.hideActions&&S.value&&D.value),Z=s.computed(()=>I.value&&D.value&&!r.isFullscreen),re={heatmap:Vp,treemap:Zp,timeseries_line:ur,timeseries_bar:ur,scatter:nl,horizontal_bar:cr,vertical_bar:cr,gauge:lr,donut:ec,golden_signals:sl,top_n:Yl,top_talkers:Xl,table:Jl,slottable:void 0,single_value:lr,choropleth_map:d},te=s.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=s.computed(()=>{const L=re[r.definition.chart.type],ee=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"),ei={query:r.definition.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:o.value,zoomConfiguration:n.value},ti={chartOptions:r.definition.chart,activeMetric:J.value,headerDescription:U.value,requestsLink:n.value.showRequestsAction?K.value:void 0,exploreLink:n.value.showExploreAction?q.value:void 0};return L&&{component:L,rendererProps:{...ei,...ee?{}:ti,...r.definition.chart.type==="top_n"?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:Fe}}}),Y=s.computed(()=>{if(Ie(r.definition))return null;const L=r.definition.query,ee=L?.time_range;if(Q.isPlatformDatasource(L?.datasource)&&!L.dimensions?.includes("time"))return m.t("renderer.as_of_today");if(ee?.type==="relative"){const me=Q.TimePeriods.get(Q.TIMEFRAME_LOOKUP[ee.time_range]);return me?me.display:(console.warn("Did not recognize the given relative time range:",ee.time_range),ee.time_range)}else if(ee?.type==="absolute"){const me=ee.tz||"Etc/UTC";return`${Q.formatTime(ee.start,{short:!0,tz:me})} - ${Q.formatTime(ee.end,{short:!0,tz:me})}`}return null}),X=s.computed(()=>{const L=r.definition.query,ee=L?.datasource,me=ee?h.value[ee]?.timeRangeOptions:void 0,ze=(L&&"time_range"in L?L.time_range:void 0)??r.context.timeSpec;return qt(ze,me)}),ae=s.computed(()=>z.value?!1:[!!v.value,Z.value,!!Y.value,X.value,!!U.value,r.showRefresh,j.value].some(Boolean)),G=s.computed(()=>_.value?Q.msToGranularity(_.value.meta.granularity_ms):void 0),le=s.computed(()=>["timeseries_line","timeseries_bar"].includes(b.value.type)),ue=s.computed(()=>_.value?.meta.metric_names??[]),J=s.ref();s.watch(ue,L=>{(!J.value||!L.includes(J.value))&&(J.value=L[0])},{immediate:!0});const se=s.computed(()=>{const L=b.value;return L.type!=="timeseries_line"?!1:ue.value.some(ee=>L.metric_axis_map?.[ee]==="right")}),j=s.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),$=s.computed(()=>ue.value.map(L=>({value:L,label:Re(L)?m.t(`chartLabels.${L}`):L}))),oe=s.computed(()=>{if(!zt(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=s.computed(()=>{const L=Q.msToGranularity(_.value?.meta.granularity_ms??0)??"unknown",ee=zt(r.definition)?r.definition.query.granularity??"unknown":"unknown";return m.t("query_aged_out_warning",{currentGranularity:m.t(`granularities.${L}`),savedGranularity:m.t(`granularities.${ee}`)})}),Me=s.computed(()=>{const L=[...r.context.filters,...r.definition.query.filters??[]],ee="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:ee})}),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")},xe=()=>{C.value=!1},je=()=>{if(Bt(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,Q.EXPORT_RECORD_LIMIT):_.value?Promise.resolve(_.value):new Promise(me=>{const Ge=s.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 ee={tileId:r.tileId.toString(),timeRange:L};l("tile-time-range-zoom",ee)},be=L=>{const ee={tileId:r.tileId.toString(),bounds:L};l("tile-bounds-change",ee)},He=L=>{const ee=Me.value,me=V(L,ee);q.value=N.value?{href:P(me)}:void 0,K.value=x.value?{href:F(M(L,ee))}:void 0};return e({getExportData:je}),(L,ee)=>{const me=s.resolveComponent("KTooltip"),Ge=s.resolveComponent("KBadge"),ze=s.resolveComponent("KButton"),Fe=s.resolveComponent("KDropdownItem"),ei=s.resolveComponent("KDropdown");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["tile-boundary",{editable:r.context.editable,headless:!ae.value}]),"data-testid":`tile-${r.tileId}`},[ae.value&&!z.value?(s.openBlock(),s.createElementBlock("div",eg,[s.createVNode(me,{class:"title-tooltip",disabled:!k.value,"max-width":"500",text:v.value},{default:s.withCtx(()=>[s.createElementVNode("div",{ref_key:"titleRef",ref:T,class:"title"},s.toDisplayString(v.value),513)]),_:1},8,["disabled","text"]),s.createElementVNode("div",tg,[X.value?(s.openBlock(),s.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:s.unref(m).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:s.withCtx(()=>[s.createVNode(s.unref(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Ki)})`},null,8,["size"])]),default:s.withCtx(()=>[s.createElementVNode("span",ig,s.toDisplayString(s.unref(m).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):s.createCommentVNode("",!0),Y.value?(s.openBlock(),s.createBlock(Ge,{key:1,"data-testid":"time-range-badge",tooltip:oe.value?Ae.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},s.createSlots({default:s.withCtx(()=>[s.createElementVNode("span",rg,s.toDisplayString(Y.value),1)]),_:2},[oe.value?{name:"icon",fn:s.withCtx(()=>[s.createVNode(s.unref(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Ki)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):s.createCommentVNode("",!0)]),j.value?(s.openBlock(),s.createElementBlock("div",ng,[s.createVNode(s.unref(Pr.KSegmentedControl),{modelValue:J.value,"onUpdate:modelValue":ee[0]||(ee[0]=ti=>J.value=ti),class:"metric-selector","data-testid":"metric-selector",options:$.value},null,8,["modelValue","options"])])):s.createCommentVNode("",!0),r.showRefresh?(s.openBlock(),s.createElementBlock("div",sg,[s.createVNode(ze,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${r.tileId}`,disabled:E.value,icon:"",size:"small",onClick:a},{default:s.withCtx(()=>[E.value?(s.openBlock(),s.createBlock(s.unref(ie.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Bi)})`,tabindex:"0"},null,8,["size"])):(s.openBlock(),s.createBlock(s.unref(ie.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Bi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):s.createCommentVNode("",!0),U.value?(s.openBlock(),s.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${r.tileId}`},s.toDisplayString(U.value),9,og)):s.createCommentVNode("",!0),I.value?(s.openBlock(),s.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${r.tileId}`},[I.value&&r.context.editable&&!r.isFullscreen?(s.openBlock(),s.createBlock(s.unref(ie.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${s.unref(At)})`,"data-testid":`edit-tile-${r.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(Mi)})`,onClick:Ee},null,8,["color","data-testid","size"])):s.createCommentVNode("",!0),I.value&&D.value&&!r.isFullscreen?(s.openBlock(),s.createBlock(ei,{key:1,class:"dropdown","data-testid":`chart-action-menu-${r.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:s.withCtx(()=>[s.unref(g)?(s.openBlock(),s.createBlock(Fe,{key:0,"data-testid":`chart-jump-to-explore-${r.tileId}`,item:{label:s.unref(m).t("jumpToExplore"),to:s.unref(g)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),!s.unref(Ie)(r.definition)&&s.unref(y)?(s.openBlock(),s.createBlock(Fe,{key:1,"data-testid":`chart-jump-to-requests-${r.tileId}`,item:{label:s.unref(m).t("jumpToRequests"),to:s.unref(y)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),p.value?(s.openBlock(),s.createBlock(Fe,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${r.tileId}`,onClick:Ot},{default:s.withCtx(()=>[s.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${r.tileId}`},s.toDisplayString(s.unref(m).t("csvExport.exportAsCsv")),9,lg)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),r.context.editable?(s.openBlock(),s.createBlock(Fe,{key:3,"data-testid":`duplicate-tile-${r.tileId}`,onClick:qe},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(m).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),r.context.editable?(s.openBlock(),s.createBlock(Fe,{key:4,"data-testid":`remove-tile-${r.tileId}`,onClick:fe},{default:s.withCtx(()=>[s.createElementVNode("span",cg,s.toDisplayString(s.unref(m).t("renderer.delete")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(ie.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${s.unref(At)})`,"data-testid":`kebab-action-menu-${r.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(Mi)})`},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)],8,ag)):s.createCommentVNode("",!0),C.value?(s.openBlock(),s.createBlock(sr,{key:4,"data-testid":`csv-export-modal-${r.tileId}`,"export-state":O.value,filename:w.value,onCloseModal:xe},null,8,["data-testid","export-state","filename"])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["tile-content",`type-${r.tileType}-${b.value.type}`]),"data-testid":`tile-content-${r.tileId}`},[he.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(he.value.component),s.mergeProps({key:0},he.value.rendererProps,s.toHandlers(te.value),{onChartData:Oe,onQueryComplete:de}),null,16)):s.createCommentVNode("",!0)],10,ug)],10,Jp)}}}),[["__scopeId","data-v-a062c19f"]]),dg=(r,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),d=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,d):i.set(a,l&&d)});const n=[];for(let o=0;o<t;o++)i.get(o)?n.push("auto"):n.push(`${r}px`);return n},Lr=Ce(s.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){s.useCssVars(d=>({v6834ae83:e.columns,v9c95201e:a.value}));const e=r,t=s.ref(null),i=s.ref(0),n=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{!Array.isArray(d)||!d.length||(i.value=d[0].contentRect.width)})});s.onMounted(()=>{t.value&&n.observe(t.value)}),s.onUnmounted(()=>{t.value&&n.unobserve(t.value)});const o=s.computed(()=>dg(e.tileHeight,e.tiles)),a=s.computed(()=>o.value.join(" ")),l=s.computed(()=>e.tiles.map((d,c)=>({key:`tile-${c}`,tile:d,style:{"grid-column-start":d.layout.position.col+1,"grid-column-end":d.layout.position.col+1+d.layout.size.cols,"grid-row-start":d.layout.position.row+1,"grid-row-end":d.layout.position.row+1+d.layout.size.rows}})));return(d,c)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"gridContainer",ref:t,class:"kong-ui-public-grid-layout"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(l.value,u=>(s.openBlock(),s.createElementBlock("div",{key:u.key,class:s.normalizeClass(["grid-cell",{"empty-cell":!u.tile}]),style:s.normalizeStyle(u.style)},[s.renderSlot(d.$slots,"tile",{fitToContent:o.value[u.tile.layout.position.row]==="auto",style:s.normalizeStyle(u.style),tile:u.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-aa4f1c68"]]);function hg(r,e,t,i,n){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+n+" 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 n=t.querySelectorAll(e);return!n.length&&e[0]!=="."&&e[0]!=="#"&&(n=t.querySelectorAll("."+e),n.length||(n=t.querySelectorAll("#"+e))),Array.from(n)}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 n=t.querySelector(e);return i&&!n&&(n=i.getElementById(e)),n||(n=t.querySelector("."+e)),n}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(n=>{n&&i.classList.add(n)}),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,n=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(n<=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:(n-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((n,o)=>{const a=t*((n.y??1e4)-(o.y??1e4));return a===0?t*((n.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 n=document.createElement("style"),o=i?.nonce;return o&&(n.nonce=o),n.setAttribute("type","text/css"),n.setAttribute("gs-style-id",e),n.styleSheet?n.styleSheet.cssText="":n.appendChild(document.createTextNode("")),t?t.insertBefore(n,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(n)),n}static removeStylesheet(e,t){const n=(t||document).querySelector("STYLE[gs-style-id="+e+"]");n&&n.parentNode&&n.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 n=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!n)throw new Error(`Invalid height val = ${e}`);i=n[2]||"px",t=parseFloat(n[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const n in i){if(!i.hasOwnProperty(n))return;e[n]===null||e[n]===void 0?e[n]=i[n]:typeof i[n]=="object"&&typeof e[n]=="object"&&this.defaults(e[n],i[n])}}),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 n=e[i],o=t[i];i[0]==="_"||n===o?delete e[i]:n&&typeof n=="object"&&o!==void 0&&(R.removeInternalAndSame(n,o),Object.keys(n).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(...n)=>{i||(i=!0,setTimeout(()=>{e(...n),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 n=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(n.top<0||n.bottom>o){const a=n.bottom-o,l=n.top,d=this.getScrollElement(e);if(d!==null){const c=d.scrollTop;n.top<0&&i<0?e.offsetHeight>o?d.scrollTop+=i:d.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?d.scrollTop+=i:d.scrollTop+=a>i?i:a),t.top+=d.scrollTop-c}}}static updateScrollResize(e,t,i){const n=this.getScrollElement(t),o=n.clientHeight,a=n===this.getScrollElement()?0:n.getBoundingClientRect().top,l=e.clientY-a,d=l<i,c=l>o-i;d?n.scrollBy({behavior:"smooth",top:l-i}):c&&n.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 n in i)i.hasOwnProperty(n)&&typeof i[n]=="object"&&n.substring(0,2)!=="__"&&!t.find(o=>o===n)&&(i[n]=R.cloneDeep(e[n]));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(n=>{e.style[i]=n}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},n={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,...n}}static simulateMouseEvent(e,t,i){const n=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:n.ctrlKey??!1,altKey:n.altKey??!1,shiftKey:n.shiftKey??!1,metaKey:n.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 n=e[t];e[t]=e[i],e[i]=n}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,n={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!n.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,n.skip));let a=!1;const l={nested:!0,pack:!1};let d=0;for(;i=i||this.collide(e,o,n.skip);){if(d++>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 u={...t,y:i.y+i.h,...l};c=this._loading&&R.samePos(e,u)?!0:this.moveNode(e,u),(i.locked||this._loading)&&c?R.copyPos(t,e):!i.locked&&c&&n.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 n=e._id,o=i?._id;return this.nodes.find(a=>a._id!==n&&a._id!==o&&R.isIntercepted(a,t))}collideAll(e,t=e,i){const n=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==n&&a._id!==o&&R.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const n=e._rect,o={...t.rect};o.y>n.y?(o.h+=o.y-n.y,o.y=n.y):o.h+=n.y-o.y,o.x>n.x?(o.w+=o.x-n.x,o.x=n.x):o.w+=n.x-o.x;let a,l=.5;for(let d of i){if(d.locked||!d._rect)break;const c=d._rect;let u=Number.MAX_VALUE,h=Number.MAX_VALUE;n.y<c.y?u=(o.y+o.h-c.y)/c.h:n.y+n.h>c.y+c.h&&(u=(c.y+c.h-o.y)/c.h),n.x<c.x?h=(o.x+o.w-c.x)/c.w:n.x+n.w>c.x+c.w&&(h=(c.x+c.w-o.x)/c.w);const f=Math.min(h,u);f>l&&(l=f,a=d)}return t.collide=a,a}cacheRects(e,t,i,n,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-n,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 n;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(n=R.isTouching(e,t)))return i();if(n!==!1){if(e.w===t.w&&e.x===t.x&&(n||(n=R.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(n!==!1){if(e.h===t.h&&e.y===t.y&&(n||(n=R.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,n){const o={x:e||0,y:t||0,w:i||1,h:n||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 n=this._inColumnResize;n||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((a,l,d)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=d[l-1])),this.addNode(a,!1,c)}),n||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 n={x:0,y:0,w:1,h:1};return R.defaults(e,n),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=n.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=n.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=n.w),isNaN(e.h)&&(e.h=n.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,n){const o=n?n.y*i+(n.x+n.w):0;let a=!1;for(let l=o;!a;++l){const d=l%i,c=Math.floor(l/i);if(d+e.w>i)continue;const u={x:d,y:c,w:e.w,h:e.h};t.find(h=>R.isIntercepted(u,h))||((e.x!==d||e.y!==c)&&(e._dirty=!0),e.x=d,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,t=!1,i){const n=this.nodes.find(a=>a._id===e._id);if(n)return n;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(n=>n._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(n=>n._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(n=>n._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 n=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=n.moveNode(i,t)&&n.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?(n.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(d=>d._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(n=>({...n}))}),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 n=e.w!==t.w||e.h!==t.h,o=R.copyPos({},e,!0);if(R.copyPos(o,t),this.nodeBoundFix(o,n),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 d=!0;if(l.length){const c=e._moving&&!t.nested;let u=c?this.directionCollideCoverage(e,t,l):l[0];if(c&&u&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=R.areaIntercept(t.rect,u._rect),f=R.area(t.rect),m=R.area(u._rect);h/(f<m?f:m)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?d=!this._fixCollisions(e,o,u,t):(d=!1,i&&delete t.pack)}return d&&!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,n=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=n?.find(c=>c._id===a._id),d={...a,...l||{}};R.removeInternalForSave(d,!e),t&&t(a,d),o.push(d)}),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 n=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*n)),o.w!==o._orig.w&&(a.w=Math.round(o.w*n)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const n=i==="compact"||i==="list";n&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=n?this.nodes:R.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],d=this._layouts.length-1;!l.length&&e!==d&&this._layouts[d]?.length&&(e=d,this._layouts[d].forEach(c=>{const u=a.find(h=>h._id===c._id);u&&(!n&&!c.autoPosition&&(u.x=c.x??u.x,u.y=c.y??u.y),u.w=c.w??u.w,(c.x==null||c.y===void 0)&&(u.autoPosition=!0))})),l.forEach(c=>{const u=a.findIndex(h=>h._id===c._id);if(u!==-1){const h=a[u];if(n){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(u,1)}})}if(n)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=n||i==="none"?1:t/e,d=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(u=>{u.x=t===1?0:d?Math.round(u.x*l):Math.min(u.x,t-1),u.w=t===1||e===1?1:c?Math.round(u.w*l)||1:Math.min(u.w,t),o.push(u)}),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,!n),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const n=[];return e.forEach((o,a)=>{if(o._id===void 0){const l=o.id?this.nodes.find(d=>d.id===o.id):void 0;o._id=l?._id??De._idSeq++}n[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=n,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 n=this.findCacheLayout(e,t);return n===-1?this._layouts[t].push(i):this._layouts[t][n]=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 Se=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 Ur(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 Kr(r){H.dragElement&&r.pointerType!=="mouse"&&Ur(r,"mouseenter")}function Mr(r){H.dragElement&&r.pointerType!=="mouse"&&(ke.pointerLeaveTimeout=window.setTimeout(()=>{delete ke.pointerLeaveTimeout,Ur(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),Se&&(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),Se&&(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),Se&&(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),Se&&(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 Zt{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 Zt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const n=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-n.left)*this.rectScale.x,top:(a.top-n.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(n=>this.option[n]=e[n]),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,n={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,d;t.indexOf("e")>-1?n.width+=o:t.indexOf("w")>-1&&(n.width-=o,n.left+=o,l=!0),t.indexOf("s")>-1?n.height+=a:t.indexOf("n")>-1&&(n.height-=a,n.top+=a,d=!0);const c=this._constrainSize(n.width,n.height,l,d);return Math.round(n.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(n.left+=n.width-c.width),n.width=c.width),Math.round(n.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(n.top+=n.height-c.height),n.height=c.height),n}_constrainSize(e,t,i,n){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,d=(n?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,u=Math.min(a,Math.max(l,e)),h=Math.min(d,Math.max(c,t));return{width:u,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:n}=t.getBoundingClientRect();e={left:i,top:n,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],n=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*n+"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 fg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ot extends Zt{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),n=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:n?.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),Se&&(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),Se&&(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(fg)||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),Se&&(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 n=R.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(n,this.ui()),this.triggerEvent("dragstart",n),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Se&&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(n=>t.style[n]=this.dragElementOriginStyle[n]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,n=this.dragOffset;i.left=(e.clientX+n.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+n.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 n=0,o=0;i&&(n=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-n,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 mg extends Zt{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),Se&&(this.el.addEventListener("pointerenter",Kr),this.el.addEventListener("pointerleave",Mr)))}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),Se&&(this.el.removeEventListener("pointerenter",Kr),this.el.removeEventListener("pointerleave",Mr)))}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 n,o=this.el.parentElement;for(;!n&&o;)n=o.ddElement?.ddDroppable,o=o.parentElement;n&&n._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 Jt{static init(e){return e.ddElement||(e.ddElement=new Jt(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 mg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class pg{resizable(e,t,i,n){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]:n});else{const l=o.el.gridstackNode.grid;let d=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";d==="all"&&(d="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:d,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,n){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]:n});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,n){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]:n}):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(n=>n.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",n=R.getElements(e);return n.length?n.map(a=>a.ddElement||(i?Jt.init(a):null)).filter(a=>a):[]}}const _e=new pg;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(n=>{n.gridstack||(n.gridstack=new B(n,R.cloneDeep(e))),i.push(n.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 n=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||{},n=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=n.find(m=>m.c===1);f?f.w=h:(f={c:1,w:h},n.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,n=void 0):a.columnMax=a.columnMax||12),n?.length>1&&n.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=Se),this._styleSheetClass="gs-id-"+De._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const u=t.engineClass||B.engineClass||De;if(this.engine=new u({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 n=this._readAttr(t);return R.defaults(e,n),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(([n])=>{n.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,n=!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 d;t.column==="auto"&&(d=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let c=o.el.querySelector(".grid-stack-item-content"),u,h;if(n&&(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?u=B.addRemoveCB(this.el,h,!0,!1):(u=R.createDiv(["grid-stack-item"]),u.appendChild(c),c=R.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const m=d?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),d&&(f._autoColumn=!0),n&&f.makeWidget(u,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 n=this.engine.save(e,i);if(n.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=n,o}return n}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 n=0;e.forEach(c=>{n=Math.max(n,(c.x||0)+c.w)}),n>this.engine.defaultColumn&&(this.engine.defaultColumn=n),n>i&&this.engine.cacheLayout(e,n,!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(u=>{if(!u.id)return;R.find(e,u.id)||(B.addRemoveCB&&B.addRemoveCB(this.el,u,!1,!1),a.push(u),this.removeWidget(u.el,!0,!1))}),this.engine._loading=!0;const d=[];return this.engine.nodes=this.engine.nodes.filter(c=>R.find(e,c.id)?(d.push(c),!1):!0),e.forEach(c=>{const u=R.find(d,c.id);if(u){if(R.shouldSizeToContent(u)&&(c.h=u.h),this.engine.nodeBoundFix(c),(c.autoPosition||c.x===void 0||c.y===void 0)&&(c.w=c.w||u.w,c.h=c.h||u.h,this.engine.findEmptyPosition(c)),this.engine.nodes.push(u),R.samePos(u,c)&&this.engine.nodes.length>1&&(this.moveNode(u,{...c,forceCollide:!0}),R.copyPos(c,u)),this.update(u.el,c),c.subGridOpts?.children){const h=u.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 n=R.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/n)}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 n=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+n}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 n=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(n/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&n<=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 n;t?n={top:i.top+document.documentElement.scrollTop,left:i.left}:n={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-n.left,a=e.top-n.top,l=i.width/this.getColumn(),d=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/d)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,n){return this.engine.isAreaEmpty(e,t,i,n)}makeWidget(e,t){const i=B.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const n=i.gridstackNode;this._updateContainerHeight(),n.subGridOpts&&this.makeSubGrid(i,n.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(n=>this.on(n,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=n=>t(n):this._gsEventHandler[e]=n=>{n.detail&&t(n,n.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(n=>{if(n.parentElement&&n.parentElement!==this.el)return;let o=n.gridstackNode;o||(o=this.engine.nodes.find(a=>n===a.el)),o&&(t&&B.addRemoveCB&&B.addRemoveCB(this.el,o,!1,!1),delete n.gridstackNode,this._removeDD(n),this.engine.removeNode(o,t,i),t&&n.parentElement&&n.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(n=>{this.prepareDragDrop(n.el),n.subGrid&&i&&n.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 n=i?.gridstackNode;if(!n)return;const o={...R.copyPos({},n),...R.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const a=["x","y","w","h"];let l;if(a.some(u=>o[u]!==void 0&&o[u]!==n[u])&&(l={},a.forEach(u=>{l[u]=o[u]!==void 0?o[u]:n[u],delete o[u]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const u=i.querySelector(".grid-stack-item-content");u&&u.textContent!==o.content&&(n.content=o.content,B.renderCB(u,o),n.subGrid?.el&&(u.appendChild(n.subGrid.el),n.subGrid.opts.styleInHead||n.subGrid._updateStyles(!0))),delete o.content}let d=!1,c=!1;for(const u in o)u[0]!=="_"&&n[u]!==o[u]&&(n[u]=o[u],d=!0,c=c||!this.opts.staticGrid&&(u==="noResize"||u==="noMove"||u==="locked"));if(R.sanitizeMinMax(n),l){const u=l.w!==void 0&&l.w!==n.w;this.moveNode(n,l),u&&n.subGrid?n.subGrid.onResize(this.hasAnimationCSS()?n.w:void 0):this.resizeToContentCheck(u,n),delete n._orig}(l||d)&&this._writeAttr(i,n),c&&this.prepareDragDrop(n.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 n=i.getCellHeight(!0);if(!n)return;let o=t.h?t.h*n: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,d=t.h?t.h*n-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||d}}if(d===c)return;o+=c-d;let u=Math.ceil(o/n);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&u>h&&(u=h,e.classList.add("size-to-content-max")),t.minH&&u<t.minH?u=t.minH:t.maxH&&u>t.maxH&&(u=t.maxH),u!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:u}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){B.resizeToContentCB?B.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return B.getElements(e).forEach(i=>{const n=i.gridstackNode;if(!R.canBeRotated(n))return;const o={w:n.h,h:n.w,minH:n.minW,minW:n.minH,maxH:n.maxW,maxW:n.maxH};if(t){const l=t.left>0?Math.floor(t.left/this.cellWidth()):0,d=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=n.x+l-(n.h-(d+1)),o.y=n.y+d-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=n._orig;this.update(i,o),n._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,n={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(n)}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,n=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}${n}`);const l=this.opts.marginTop+this.opts.marginUnit,d=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,u=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: ${d}; left: ${u};`),R.addCSSRule(this._styles,f,`top: ${l}; right: ${c}; bottom: ${d}; left: ${u};`),R.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${l};`),R.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${d}`),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: ${d}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${u}; top: ${l}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${u}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-sw`,`left: ${u}; bottom: ${d}`)}if(t=t||this._styles._max,t>this._styles._max){const a=l=>i*l+n;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,n=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=R.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===n){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+n),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 n=R.shouldSizeToContent(i);return n?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),n&&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 n in i)t[n]?e.setAttribute(i[n],String(t[n])):e.removeAttribute(i[n]);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 n=e.getAttribute("gs-size-to-content");n&&(n==="true"||n==="false"?i.sizeToContent=R.toBool(n):i.sizeToContent=parseInt(n,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(n=>{R.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.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,n=document){t?.pause!==void 0&&(H.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?R.getElements(e,n):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 n=i.gridstackNode;n&&(t?delete n.noMove:n.noMove=!0,this.prepareDragDrop(n.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(B.getElements(e).forEach(i=>{const n=i.gridstackNode;n&&(t?delete n.noResize:n.noResize=!0,this.prepareDragDrop(n.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=(n,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)*(n.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(n.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:d,left:c}=a.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,d-=u.top;const h={position:{top:d*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(d/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,n,h,l,t,e)}else this._dragOrResize(a,n,h,l,t,e)};return _e.droppable(this.el,{accept:n=>{const o=n.gridstackNode||this._readAttr(n,!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(n);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=n.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",(n,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 u=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(u){try{l=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}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 d=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:d,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=d,l.h=c,l._temporaryRemoved=!0),B._itemRemoving(l.el,!1),_e.on(o,"drag",i),i(n,o,a),!1}).on(this.el,"dropout",(n,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",(n,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const d=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const u=d&&this.opts.animate;u&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,d&&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||(d&&(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),!d))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({...n,type:"dropped"},h&&h.grid?h:void 0,l),u&&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 n=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||n&&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,d;const c=(f,m)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),d=this.getCellHeight(!0),this._onStartMoving(e,f,m,i,l,d)},u=(f,m)=>{this._dragOrResize(e,f,m,i,l,d)},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:u}).resizable(e,{start:c,stop:h,resize:u}),i._initDD=!0}return _e.draggable(e,n?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,n,o,a){if(this.engine.cleanNodes().beginUpdate(n),this._writePosAttr(this.placeholder,n),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=n,n.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(n.el=this.placeholder,n._lastUiPosition=i.position,n._prevYPix=i.position.top,n._moving=t.type==="dragstart",delete n._lastTried,t.type==="dropover"&&n._temporaryRemoved&&(this.engine.addNode(n),n._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()-n.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-n.y;_e.resizable(e,"option","minWidth",o*Math.min(n.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(n.minH||1,d)).resizable(e,"option","maxWidth",o*Math.min(n.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(n.maxW||Number.MAX_SAFE_INTEGER,n.x+n.w)).resizable(e,"option","maxHeight",a*Math.min(n.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",a*Math.min(n.maxH||Number.MAX_SAFE_INTEGER,n.y+n.h))}}_dragOrResize(e,t,i,n,o,a){const l={...n._orig};let d,c=this.opts.marginLeft,u=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,_),u=Math.min(u,_),h=Math.min(h,m),f=Math.min(f,m),t.type==="drag"){if(n._temporaryRemoved)return;const C=i.position.top-n._prevYPix;n._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&R.updateScrollPosition(e,i.position,C);const T=i.position.left+(i.position.left>n._lastUiPosition.left?-u:c),k=i.position.top+(i.position.top>n._lastUiPosition.top?-f:h);l.x=Math.round(T/o),l.y=Math.round(k/a);const E=this._extraDragRow;if(this.engine.collide(n,l)){const b=this.getRow();let v=Math.max(0,l.y+n.h-b);this.opts.maxRow&&b+v>this.opts.maxRow&&(v=Math.max(0,this.opts.maxRow-b)),this._extraDragRow=v}else this._extraDragRow=0;if(this._extraDragRow!==E&&this._updateContainerHeight(),n.x===l.x&&n.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),n.w===l.w&&n.h===l.h)||n._lastTried&&n._lastTried.w===l.w&&n._lastTried.h===l.h)return;const C=i.position.left+c,T=i.position.top+h;l.x=Math.round(C/o),l.y=Math.round(T/a),d=!0}n._event=t,n._lastTried=l;const O={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:n.w*o)-c-u,h:(i.size?i.size.height:n.h*a)-h-f};if(this.engine.moveNodeCheck(n,{...l,cellWidth:o,cellHeight:a,rect:O,resizing:d})){n._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,u,f,c),delete n._skipDown,d&&n.subGrid&&n.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const C=t.target;n._sidebarOrig||this._writePosAttr(C,n),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 n=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=n,this.opts.removable===!0&&B._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return hg(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 gg=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],_g={class:"grid-stack-item-content"},yg=Ce(s.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:Ye},columns:{default:mt}},emits:["update-tiles"],setup(r,{expose:e,emit:t}){const i=r,n=t,o=s.ref(null),a=s.ref(new Map(i.tiles.map(m=>[`${m.id}`,m])));let l=null;const d=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),u=(m,_)=>{l&&(c(_).forEach(C=>{a.value.set(`${C.id}`,C)}),n("update-tiles",Array.from(a.value.values())))},h=(m,_)=>{_.forEach(O=>{a.value.delete(`${O.el?.getAttribute("data-id")}`)}),n("update-tiles",Array.from(a.value.values()))};s.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",u),l.on("added",u),l.on("removed",h))}),s.onUnmounted(()=>{l&&l.destroy(!1)});const f=m=>{if(l&&o.value){const _=o.value.querySelector(d(m));_&&l.removeWidget(_)}};return s.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 s.nextTick(),l.makeWidget(d(C.id),{autoPosition:!0,w:C.layout.size.cols,h:C.layout.size.rows})}}),s.watchEffect(()=>{i.tiles.forEach(m=>{a.value.set(`${m.id}`,m)})}),e({removeWidget:f}),(m,_)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.tiles,O=>(s.openBlock(),s.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},[s.createElementVNode("div",_g,[s.renderSlot(m.$slots,"tile",{fitToContent:!1,tile:O},void 0,!0)])],8,gg))),128))],512))}}),[["__scopeId","data-v-a060e0c5"]]),Rg=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}},Cg={key:0,class:"fullscreen-header"},Eg={key:0,class:"tile-container slottable-tile"},Og=Ce(s.defineComponent({__name:"DashboardRenderer",props:s.mergeModels({context:{},preview:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:s.mergeModels(["edit-tile","tile-time-range-zoom","tiles-loaded"],["update:modelValue"]),setup(r,{expose:e,emit:t}){if(s.useCssVars(w=>({v577760a8:u.value})),r.context.disableCoordination!==!0){const w=Gr();s.provide(Gi,w)}const i=t,n=s.useModel(r,"modelValue"),{i18n:o}=ce.useI18n(),a=s.ref(0),l=s.ref(null),d=s.ref(),c=s.ref(),u=s.ref("scale(1)"),h=new Set,f=s.inject(ve);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=s.computed(()=>{const D=`renderer.trendRange.${A.value.type==="absolute"?"custom":A.value.time_range}`;return o.te(D)?o.t(D):""}),T=(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=s.computed(()=>n.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",Z=Ia(D,C.value);return Z!==D.header_description&&(D={...D,header_description:Z}),{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",v=w=>w.type==="slottable",U=w=>{if(w.type==="slottable")return w.id;const D=w.meta?.chart;return D&&v(D)?D.id:void 0},z=w=>{try{const D=Rg(w);n.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});n.value.tiles=D.sort(T)},S=async()=>{if(u.value="scale(1)",await s.nextTick(),c.value){const{availWidth:w,availHeight:D}=window.screen,{width:I,height:Z}=c.value.getBoundingClientRect(),re=Math.min(D/Z,w/I);u.value=`scale(${re})`}},x=()=>{d.value&&(document.fullscreenElement?document.exitFullscreen():d.value.requestFullscreen())},N=s.ref(!1),K=()=>{N.value=document.fullscreenElement!==null,N.value&&S()},q=s.computed(()=>n.value.preset_filters??[]),{editable:V,enrichedContext:P,queryReady:F,showTileActions:M,timeSpec:A}=ce.useDashboardContext({globalFilters:q,context:s.computed(()=>r.context),isFullscreen:N,preview:s.computed(()=>r.preview)});return e({refresh:g,toggleFullscreen:x,exportPdf:m,pdfExportState:_}),(w,D)=>{const I=s.resolveComponent("KAlert");return s.openBlock(),s.createElementBlock("div",{ref_key:"dashboardContainer",ref:d,class:s.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":N.value}]),onFullscreenchange:K},[s.createElementVNode("div",{ref_key:"layoutContainer",ref:c,class:"layout"},[s.unref(f)&&N.value?(s.openBlock(),s.createElementBlock("div",Cg,[s.renderSlot(w.$slots,"fullscreenHeader",{},void 0,!0)])):s.createCommentVNode("",!0),s.unref(f)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(V)&&!N.value?yg:Lr),{key:2,ref_key:"gridLayoutRef",ref:l,columns:n.value.columns,"tile-height":n.value.tile_height,tiles:k.value,onUpdateTiles:y},{tile:s.withCtx(({tile:Z,fitToContent:re})=>[b(Z)?(s.openBlock(),s.createElementBlock("div",Eg,[s.renderSlot(w.$slots,U(Z),{},void 0,!0)])):(s.openBlock(),s.createBlock(Ar,{key:N.value?`${Z.id}-tile`:`${Z.id}-tile-fullscreen`,"refresh-counter":a.value,"onUpdate:refreshCounter":D[0]||(D[0]=te=>a.value=te),class:"tile-container",context:s.unref(P),definition:Z.meta,"fit-to-content":re,height:Z.layout.size.rows*(n.value.tile_height||s.unref(Ye))+parseInt(s.unref(zi),10),"hide-actions":!s.unref(M),"is-fullscreen":N.value,preview:r.preview,"query-ready":s.unref(F),"tile-id":Z.id,"tile-type":Z.type,onDuplicateTile:te=>z(Z),onEditTile:te=>E(Z),onRemoveTile:te=>p(Z),onTileLoaded:te=>O(Z),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"])):(s.openBlock(),s.createBlock(I,{key:1,appearance:"danger"},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(o).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-9925f70d"]]),bg=s.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=s.useTemplateRef("root"),n=s.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=E=>{a("tile-time-range-zoom",E)},d=E=>{a("chart-data",E)},c=E=>{a("tile-bounds-change",E)},{i18n:u}=ce.useI18n(),{enrichedContext:h,queryReady:f}=ce.useDashboardContext({globalFilters:s.toRef(()=>r.globalFilters),context:s.toRef(()=>r.context),preview:s.computed(()=>r.preview)}),m=s.computed(()=>Ie(r.definition)),_=s.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=s.ref(Ye);let C;s.onMounted(()=>{const E=i.value?.parentElement;E&&(O.value=E.getBoundingClientRect().height,C=new ResizeObserver(([b])=>{const{height:v}=b.contentRect;O.value=v}),C.observe(E))}),s.onUnmounted(()=>C?.disconnect());const T=s.ref(0);return e({refresh:()=>{T.value++},getExportData:()=>n.value?.getExportData()}),(E,b)=>{const v=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[_.value?(s.openBlock(),s.createBlock(v,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(u).t("renderer.not_configured.title")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(u).t("renderer.not_configured.description")),1)]),_:1})):(s.openBlock(),s.createBlock(Ar,{key:1,ref:"dashboard-tile","refresh-counter":T.value,"onUpdate:refreshCounter":b[0]||(b[0]=U=>T.value=U),context:{...s.unref(h),editable:!1},definition:r.definition,height:O.value,"hide-actions":"",preview:r.preview,"query-ready":s.unref(f),"show-refresh":"","tile-id":s.unref(o),onChartData:d,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),wg=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},Tg=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}}},vg=(r,e=mt)=>{if(!r.length)return[];let t=0,i=0,n=0;const o=[];for(const a of r){const l=a.layout?.size?.cols??1,d=a.layout?.size?.rows??1;i+l>e&&(t+=n,i=0,n=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,n=Math.max(n,d)}return o},Sg=(r,e)=>{if(e){const n=r.tiles.map(Tg);return{...r,tiles:n}}const t=r.tiles.map(wg).filter(n=>n!==void 0),i=vg(t,r.columns);return{...r,tiles:i}},xg=Object.freeze(Object.defineProperty({__proto__:null,default:s.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=s.ref(void 0),n=s.computed(()=>i.value?si.exploreResultToCountryMetrics(i.value):{}),o=s.computed(()=>i.value?i.value?.meta.metric_names&&i.value.meta.metric_names[0]:""),a=s.computed(()=>t.query.limit!==void 0&&t.query.limit>0?t.query.limit:Q.COUNTRIES.length),l=s.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}),d=s.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},u=e,h=f=>{u("bounds-change",f)};return(f,m)=>(s.openBlock(),s.createBlock(Ke,{context:r.context,"limit-override":a.value,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c},{default:s.withCtx(()=>[s.createVNode(s.unref(si.AnalyticsGeoMap),{bounds:r.chartOptions.bounds,"country-metrics":n.value,"fit-to-country":r.chartOptions.fit_to_country,metric:o.value,"metric-unit":d.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=Og,W.DashboardTilePreview=bg,W.ENTITY_ID_TOKEN=Ut,W.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Yi,W.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Vi,W.GridLayout=Lr,W.INJECT_DASHBOARD_COORDINATOR=Gi,W.INJECT_QUERY_PROVIDER=ve,W.TIMEFRAME_TOKEN=$i,W.configureAllowedDefinition=Sg,W.getTimeRangeDurationMs=Pt,W.isTimeRangeUnsupported=qt,W.isTreemapCompatible=Qt,W.limitTimeRange=Ht,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -6382,10 +6382,14 @@ const { i18n: Dc } = mn(), pn = (r, e) => {
|
|
|
6382
6382
|
data: r.data ?? [],
|
|
6383
6383
|
// Drill-down: click a group to zoom in, and use the breadcrumb to go back
|
|
6384
6384
|
nodeClick: r.drillDown ? "zoomToNode" : !1,
|
|
6385
|
+
// `max: Infinity`: ECharts' default cap (5x) stops small nodes on dense charts from ever getting big enough to read.
|
|
6386
|
+
// `min: 1`: no zooming out past the full chart.
|
|
6387
|
+
// `zoomToNodeRatio: 0.2`: a clicked node fills ~20% of the chart, big enough to read while keeping its neighbors in view
|
|
6388
|
+
...r.drillDown ? { scaleLimit: { min: 1, max: 1 / 0 }, zoomToNodeRatio: 0.2 } : {},
|
|
6385
6389
|
// Defaults to the full depth
|
|
6386
6390
|
leafDepth: r.leafDepth ?? n(r.data),
|
|
6387
|
-
//
|
|
6388
|
-
roam:
|
|
6391
|
+
// Wheel to zoom, drag to pan
|
|
6392
|
+
roam: r.drillDown,
|
|
6389
6393
|
// Fill the chart area, leaving room at the bottom for the breadcrumb with drill-down
|
|
6390
6394
|
left: 0,
|
|
6391
6395
|
top: 0,
|
|
@@ -6718,7 +6722,7 @@ ${r.valueFormatter ? r.valueFormatter(Number(c)) : String(c)}` : void 0
|
|
|
6718
6722
|
preview: R(() => r.preview)
|
|
6719
6723
|
}), s = Hr(r, "refreshCounter"), o = () => {
|
|
6720
6724
|
O.value = !0, s.value++;
|
|
6721
|
-
}, a = t, c = zr(() => import("./GeoMapRenderer-
|
|
6725
|
+
}, a = t, c = zr(() => import("./GeoMapRenderer-CltAO-t2.js")), l = Ke(We), u = mt(), { datasourceConfigMap: d, stripUnknownFilters: h } = ht(u), { i18n: f } = ve.useI18n(), g = Y(), b = Y({ status: "loading" }), v = Y(!1), S = 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(() => Fe(r.definition) || di(r.definition) ? !1 : !("allow_csv_export" in E.value) || E.value.allow_csv_export !== !1), {
|
|
6722
6726
|
exploreLinkKebabMenu: p,
|
|
6723
6727
|
requestsLinkKebabMenu: _,
|
|
6724
6728
|
canShowKebabMenu: I,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/dashboard-renderer",
|
|
3
|
-
"version": "9.2.0",
|
|
3
|
+
"version": "9.2.1-pr.3923.2760ff225.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/dashboard-renderer.umd.js",
|
|
6
6
|
"module": "./dist/dashboard-renderer.es.js",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@kong-ui-public/analytics-chart": "^12.1.0",
|
|
25
|
-
"@kong-ui-public/analytics-config-store": "^1.4.
|
|
26
|
-
"@kong-ui-public/analytics-geo-map": "^1.9.
|
|
27
|
-
"@kong-ui-public/analytics-metric-provider": "^11.6.
|
|
28
|
-
"@kong-ui-public/analytics-utilities": "^13.2.0",
|
|
29
|
-
"@kong-ui-public/echarts": "^0.7.
|
|
24
|
+
"@kong-ui-public/analytics-chart": "^12.1.1-pr.3923.2760ff225.0",
|
|
25
|
+
"@kong-ui-public/analytics-config-store": "^1.4.62-pr.3923.2760ff225.0",
|
|
26
|
+
"@kong-ui-public/analytics-geo-map": "^1.9.58-pr.3923.2760ff225.0",
|
|
27
|
+
"@kong-ui-public/analytics-metric-provider": "^11.6.69-pr.3923.2760ff225.0",
|
|
28
|
+
"@kong-ui-public/analytics-utilities": "^13.2.1-pr.3923.2760ff225.0",
|
|
29
|
+
"@kong-ui-public/echarts": "^0.7.5-pr.3923.2760ff225.0",
|
|
30
30
|
"@kong-ui-public/entities-shared": "^3.70.2",
|
|
31
31
|
"@kong-ui-public/i18n": "^2.5.1",
|
|
32
32
|
"@kong-ui-public/sandbox-layout": "^2.7.11",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"errorLimit": "2MB"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@kong-ui-public/analytics-chart": "^12.1.0",
|
|
66
|
-
"@kong-ui-public/analytics-config-store": "^1.4.
|
|
67
|
-
"@kong-ui-public/analytics-geo-map": "^1.9.
|
|
68
|
-
"@kong-ui-public/analytics-metric-provider": "^11.6.
|
|
69
|
-
"@kong-ui-public/analytics-utilities": "^13.2.0",
|
|
65
|
+
"@kong-ui-public/analytics-chart": "^12.1.1-pr.3923.2760ff225.0",
|
|
66
|
+
"@kong-ui-public/analytics-config-store": "^1.4.62-pr.3923.2760ff225.0",
|
|
67
|
+
"@kong-ui-public/analytics-geo-map": "^1.9.58-pr.3923.2760ff225.0",
|
|
68
|
+
"@kong-ui-public/analytics-metric-provider": "^11.6.69-pr.3923.2760ff225.0",
|
|
69
|
+
"@kong-ui-public/analytics-utilities": "^13.2.1-pr.3923.2760ff225.0",
|
|
70
70
|
"@kong-ui-public/i18n": "^2.5.1",
|
|
71
71
|
"@kong/icons": "^1.58.0",
|
|
72
72
|
"@kong/kongponents": "^9.64.0",
|