@kong-ui-public/dashboard-renderer 9.4.6 → 10.0.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,15 +1,15 @@
1
- (function(W,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong/icons"),require("@kong-ui-public/analytics-chart"),require("swrv"),require("@kong-ui-public/analytics-metric-provider"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong/kongponents"),require("vue-echarts"),require("echarts/core"),require("echarts/renderers"),require("echarts/components"),require("echarts/charts"),require("axios"),require("@kong-ui-public/analytics-geo-map")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/analytics-utilities","@kong/icons","@kong-ui-public/analytics-chart","swrv","@kong-ui-public/analytics-metric-provider","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong/kongponents","vue-echarts","echarts/core","echarts/renderers","echarts/components","echarts/charts","axios","@kong-ui-public/analytics-geo-map"],s):(W=typeof globalThis<"u"?globalThis:W||self,s(W["kong-ui-public-dashboard-renderer"]={},W.Vue,W["kong-ui-public-analytics-utilities"],W.KongIcons,W["kong-ui-public-analytics-chart"],W.swrv,W["kong-ui-public-analytics-metric-provider"],W.AgGridVue,W.agGridCommunity,W["kong-ui-public-i18n"],W["kong-ui-public-analytics-config-store"],W.Kongponents,W.VueECharts,W.echarts,W.echarts,W.echarts,W.echarts,W.axios,W["kong-ui-public-analytics-geo-map"]))})(this,(function(W,s,Q,ie,we,ni,si,zr,Qe,at,Ne,Pr,qr,bt,Hr,lt,oi,Ng,ai){"use strict";const Gr=r=>{const e=r.length;let t=5381;for(let i=0;i<e;i++)t=t*33^r.charCodeAt(i);return t>>>0},$r="#0044f4",li="#6c7489",Fr="#d60027",Wr="#ffc400",Vr="#bee2ff",Yr="#8fc1ff",Xr="#5f9aff",jr="#306fff",Qr="#b5ffee",Zr="#00fabe",Jr="#00d6a4",en="#00a17b",tn="#007d60",rn="#005944",nn="#b5ffee",sn="#00fabe",on="#b5ffee",an="#00a17b",ln="#fff296",cn="#ffe04b",un="#ffc400",dn="#b37600",hn="#995c00",fn="#804400",mn="#fff296",pn="#ffe04b",gn="#ffc2b3",_n="#ff9877",yn="#ff723c",Rn="#f75008",Cn="#d13500",En="#a31f00",On="#ffc2b3",bn="#ff9877",wn="#ff723c",Tn="#f75008",vn="#d13500",Sn="#a31f00",xn="#ffc2b3",In="#ff9877",Dn="#ff723c",kn="#f75008",Nn="#d13500",An="#a31f00",Ln="#ffc2b3",Un="#ff9877",Kn="#ff723c",Mn="#f75008",Bn="#d13500",zn="#a31f00",Pn="#ffc2b3",qn="#ff9877",Hn="#ff723c",Gn="#f75008",$n="#d13500",Fn="#ffabab",Wn="#ff7272",Vn="#ff3954",Yn="#f50045",Xn="#d60027",jn="#ad000e",Qn="#ffabab",Zn="#ff7272",Jn="#ff3954",es="#f50045",ts="#d60027",is="#eefaff",rs="#ecfffb",ns="#fffce0",ss="#fff1ef",os="#ffe5e5",as="#5f9aff",ls="#00d6a4",cs="#ffc400",us="#ff723c",ds="#ff3954",hs={100:Vr,101:Yr,102:Xr,103:jr,200:Qr,201:Zr,202:Jr,203:en,204:tn,205:rn,206:nn,207:sn,208:on,226:an,300:ln,301:cn,302:un,303:dn,304:hn,305:fn,307:mn,308:pn,400:gn,401:_n,402:yn,403:Rn,404:Cn,405:En,406:On,407:bn,408:wn,409:Tn,410:vn,411:Sn,412:xn,413:In,414:Dn,415:kn,416:Nn,417:An,418:Ln,421:Un,422:Kn,423:Mn,424:Bn,425:zn,426:Pn,428:qn,429:Hn,431:Gn,451:$n,500:Fn,501:Wn,502:Vn,503:Yn,504:Xn,505:jn,506:Qn,507:Zn,508:Jn,510:es,511:ts},fs={100:is,200:rs,300:ns,400:ss,500:os},ci={"1XX":as,"2XX":ls,"3XX":cs,"4XX":us,"5XX":ds},ms={error:Fr,warning:Wr,empty:"#9DA99D",neutral:li,____OTHER____:$r},wt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],Tt=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],ps=r=>Gr(r),gs=({theme:r="light"}={})=>r==="dark"?Tt:wt,ui=({discriminator:r,theme:e="light"})=>{const t=Math.abs(Math.floor(r));return e==="dark"?Tt[t%Tt.length]:wt[t%wt.length]},Ze=({state:r})=>ms[r]??li,_s=({statusCode:r})=>{const e=typeof r=="number"?r:Number.parseInt(r,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return hs[t]??fs[i]??Ze({state:"neutral"})},ys=({group:r})=>ci[r]?ci[r]:Ze({state:"neutral"}),Rs=({discriminator:r=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:n=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:l=void 0,customDimensionColors:d=void 0})=>{let c="light";if(s.hasInjectionContext()&&(c=s.inject("app:konnectColorMode",s.computed(()=>"light")).value),e!==void 0)return Ze({state:e});if(i!==void 0&&d!==void 0&&d[i])return d[i];if(i&&["empty","____OTHER____"].includes(i))return Ze({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return _s({statusCode:i});if(t==="status_code_grouped")return ys({group:i})}if(r!==void 0)return ui({discriminator:r,theme:c});if(t||i||n){const u=`${t??""}${i??""}${n??""}`,h=o?o.resolveDiscriminator({name:u,order:a,chartUuid:l,theme:c}):ps(u);return ui({discriminator:h,theme:c})}return Ze({state:"neutral"})},Cs="__no_chart__";function Es(){const r=new Map,e=new Map,t=new Map,i=o=>{e.set(o,(e.get(o)??0)+1)},n=(o,a)=>{let l=-1,d=1/0;for(let c=0;c<o;c++){if(a.has(c))continue;const u=e.get(c)??0;u<d&&(l=c,d=u)}return l!==-1?l:o<1?0:n(o,new Set)};return{resolveDiscriminator:({name:o,order:a,chartUuid:l,theme:d})=>{const c=l??Cs,u=a??null,h=gs({theme:d});let f;if(r.has(o))f=r.get(o);else{const m=new Set,_=t.get(c);u!==null&&_?.order!==null&&_?.order!==void 0&&u===_.order+1&&m.add(_.index);const O=h.length;f=n(O,m),r.set(o,f),i(f)}return t.set(c,{order:u,index:f}),f},reset:()=>{r.clear(),e.clear(),t.clear()}}}function Os(){const r=s.ref(null),e=s.ref(null),t=s.ref(null),i=s.ref(null),n=s.ref(null),o=300,a=300,l=10,d=Es(),c=({chartUuid:h,timestamp:f=null,dimension:m=null,dimensionValue:_=null,metric:O=null})=>{r.value=h,e.value=f,t.value=m,i.value=_,n.value=O},u=({chartUuid:h})=>{r.value===h&&(r.value=null,e.value=null,t.value=null,i.value=null,n.value=null)};return{activate:c,activeChart:s.readonly(r),activeDimension:s.readonly(t),activeDimensionValue:s.readonly(i),activeMetric:s.readonly(n),activeTimestamp:s.readonly(e),deactivate:u,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l,color:d}}const bs={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ws=(r,e,t)=>{let i;const n=bs[r];return typeof n=="string"?i=n:e===1?i=n.one:i=n.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function vt(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const Ts={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vs={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ss={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},xs={date:vt({formats:Ts,defaultWidth:"full"}),time:vt({formats:vs,defaultWidth:"full"}),dateTime:vt({formats:Ss,defaultWidth:"full"})},Is={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ds=(r,e,t,i)=>Is[r];function Je(r){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let n;if(i==="formatting"&&r.formattingValues){const a=r.defaultFormattingWidth||r.defaultWidth,l=t?.width?String(t.width):a;n=r.formattingValues[l]||r.formattingValues[a]}else{const a=r.defaultWidth,l=t?.width?String(t.width):r.defaultWidth;n=r.values[l]||r.values[a]}const o=r.argumentCallback?r.argumentCallback(e):e;return n[o]}}const ks={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ns={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},As={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ls={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Us={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Ks={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ms={ordinalNumber:(r,e)=>{const t=Number(r),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:Je({values:ks,defaultWidth:"wide"}),quarter:Je({values:Ns,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Je({values:As,defaultWidth:"wide"}),day:Je({values:Ls,defaultWidth:"wide"}),dayPeriod:Je({values:Us,defaultWidth:"wide",formattingValues:Ks,defaultFormattingWidth:"wide"})};function et(r){return(e,t={})=>{const i=t.width,n=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],o=e.match(n);if(!o)return null;const a=o[0],l=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],d=Array.isArray(l)?zs(l,h=>h.test(a)):Bs(l,h=>h.test(a));let c;c=r.valueCallback?r.valueCallback(d):d,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(a.length);return{value:c,rest:u}}}function Bs(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function zs(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Ps(r){return(e,t={})=>{const i=e.match(r.matchPattern);if(!i)return null;const n=i[0],o=e.match(r.parsePattern);if(!o)return null;let a=r.valueCallback?r.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(n.length);return{value:a,rest:l}}}const qs=/^(\d+)(th|st|nd|rd)?/i,Hs=/\d+/i,Gs={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$s={any:[/^b/i,/^(a|c)/i]},Fs={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ws={any:[/1/i,/2/i,/3/i,/4/i]},Vs={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Ys={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Xs={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},js={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Qs={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Zs={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Js={ordinalNumber:Ps({matchPattern:qs,parsePattern:Hs,valueCallback:r=>parseInt(r,10)}),era:et({matchPatterns:Gs,defaultMatchWidth:"wide",parsePatterns:$s,defaultParseWidth:"any"}),quarter:et({matchPatterns:Fs,defaultMatchWidth:"wide",parsePatterns:Ws,defaultParseWidth:"any",valueCallback:r=>r+1}),month:et({matchPatterns:Vs,defaultMatchWidth:"wide",parsePatterns:Ys,defaultParseWidth:"any"}),day:et({matchPatterns:Xs,defaultMatchWidth:"wide",parsePatterns:js,defaultParseWidth:"any"}),dayPeriod:et({matchPatterns:Qs,defaultMatchWidth:"any",parsePatterns:Zs,defaultParseWidth:"any"})},eo={code:"en-US",formatDistance:ws,formatLong:xs,formatRelative:Ds,localize:Ms,match:Js,options:{weekStartsOn:0,firstWeekContainsDate:1}};let to={};function tt(){return to}const di=6048e5,io=864e5,hi=Symbol.for("constructDateFrom");function Le(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&hi in r?r[hi](e):r instanceof Date?new r.constructor(e):new Date(e)}function Te(r,e){return Le(e||r,r)}function fi(r){const e=Te(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function ro(r,...e){const t=Le.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function mi(r,e){const t=Te(r,e?.in);return t.setHours(0,0,0,0),t}function no(r,e,t){const[i,n]=ro(t?.in,r,e),o=mi(i),a=mi(n),l=+o-fi(o),d=+a-fi(a);return Math.round((l-d)/io)}function so(r,e){const t=Te(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function oo(r,e){const t=Te(r,e?.in);return no(t,so(t))+1}function it(r,e){const t=tt(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=Te(r,e?.in),o=n.getDay(),a=(o<i?7:0)+o-i;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}function ct(r,e){return it(r,{...e,weekStartsOn:1})}function pi(r,e){const t=Te(r,e?.in),i=t.getFullYear(),n=Le(t,0);n.setFullYear(i+1,0,4),n.setHours(0,0,0,0);const o=ct(n),a=Le(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=ct(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function ao(r,e){const t=pi(r,e),i=Le(r,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),ct(i)}function lo(r,e){const t=Te(r,e?.in),i=+ct(t)-+ao(t);return Math.round(i/di)+1}function gi(r,e){const t=Te(r,e?.in),i=t.getFullYear(),n=tt(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=Le(e?.in||r,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=it(a,e),d=Le(e?.in||r,0);d.setFullYear(i,0,o),d.setHours(0,0,0,0);const c=it(d,e);return+t>=+l?i+1:+t>=+c?i:i-1}function co(r,e){const t=tt(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=gi(r,e),o=Le(e?.in||r,0);return o.setFullYear(n,0,i),o.setHours(0,0,0,0),it(o,e)}function uo(r,e){const t=Te(r,e?.in),i=+it(t,e)-+co(t,e);return Math.round(i/di)+1}function ne(r,e){const t=r<0?"-":"",i=Math.abs(r).toString().padStart(e,"0");return t+i}const Ue={y(r,e){const t=r.getFullYear(),i=t>0?t:1-t;return ne(e==="yy"?i%100:i,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):ne(t+1,2)},d(r,e){return ne(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(r,e){return ne(r.getHours()%12||12,e.length)},H(r,e){return ne(r.getHours(),e.length)},m(r,e){return ne(r.getMinutes(),e.length)},s(r,e){return ne(r.getSeconds(),e.length)},S(r,e){const t=e.length,i=r.getMilliseconds(),n=Math.trunc(i*Math.pow(10,t-3));return ne(n,e.length)}},Fe={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},_i={G:function(r,e,t){const i=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});default:return t.era(i,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const i=r.getFullYear(),n=i>0?i:1-i;return t.ordinalNumber(n,{unit:"year"})}return Ue.y(r,e)},Y:function(r,e,t,i){const n=gi(r,i),o=n>0?n:1-n;if(e==="YY"){const a=o%100;return ne(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):ne(o,e.length)},R:function(r,e){const t=pi(r);return ne(t,e.length)},u:function(r,e){const t=r.getFullYear();return ne(t,e.length)},Q:function(r,e,t){const i=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return ne(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(r,e,t){const i=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return ne(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(r,e,t){const i=r.getMonth();switch(e){case"M":case"MM":return Ue.M(r,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(r,e,t){const i=r.getMonth();switch(e){case"L":return String(i+1);case"LL":return ne(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(r,e,t,i){const n=uo(r,i);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):ne(n,e.length)},I:function(r,e,t){const i=lo(r);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):ne(i,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Ue.d(r,e)},D:function(r,e,t){const i=oo(r);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):ne(i,e.length)},E:function(r,e,t){const i=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(r,e,t,i){const n=r.getDay(),o=(n-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return ne(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},c:function(r,e,t,i){const n=r.getDay(),o=(n-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return ne(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},i:function(r,e,t){const i=r.getDay(),n=i===0?7:i;switch(e){case"i":return String(n);case"ii":return ne(n,e.length);case"io":return t.ordinalNumber(n,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(r,e,t){const n=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(r,e,t){const i=r.getHours();let n;switch(i===12?n=Fe.noon:i===0?n=Fe.midnight:n=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(r,e,t){const i=r.getHours();let n;switch(i>=17?n=Fe.evening:i>=12?n=Fe.afternoon:i>=4?n=Fe.morning:n=Fe.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let i=r.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return Ue.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Ue.H(r,e)},K:function(r,e,t){const i=r.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):ne(i,e.length)},k:function(r,e,t){let i=r.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):ne(i,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ue.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Ue.s(r,e)},S:function(r,e){return Ue.S(r,e)},X:function(r,e,t){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Ri(i);case"XXXX":case"XX":return Pe(i);default:return Pe(i,":")}},x:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"x":return Ri(i);case"xxxx":case"xx":return Pe(i);default:return Pe(i,":")}},O:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+yi(i,":");default:return"GMT"+Pe(i,":")}},z:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+yi(i,":");default:return"GMT"+Pe(i,":")}},t:function(r,e,t){const i=Math.trunc(+r/1e3);return ne(i,e.length)},T:function(r,e,t){return ne(+r,e.length)}};function yi(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=Math.trunc(i/60),o=i%60;return o===0?t+String(n):t+String(n)+e+ne(o,2)}function Ri(r,e){return r%60===0?(r>0?"-":"+")+ne(Math.abs(r)/60,2):Pe(r,e)}function Pe(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=ne(Math.trunc(i/60),2),o=ne(i%60,2);return t+n+e+o}const Ci=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Ei=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},ho={p:Ei,P:(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],i=t[1],n=t[2];if(!n)return Ci(r,e);let o;switch(i){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",Ci(i,e)).replace("{{time}}",Ei(n,e))}},fo=/^D+$/,mo=/^Y+$/,po=["D","DD","YY","YYYY"];function go(r){return fo.test(r)}function _o(r){return mo.test(r)}function yo(r,e,t){const i=Ro(r,e,t);if(console.warn(i),po.includes(r))throw new RangeError(i)}function Ro(r,e,t){const i=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Co(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function Eo(r){return!(!Co(r)&&typeof r!="number"||isNaN(+Te(r)))}const Oo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,wo=/^'([^]*?)'?$/,To=/''/g,vo=/[a-zA-Z]/;function So(r,e,t){const i=tt(),n=t?.locale??i.locale??eo,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,l=Te(r,t?.in);if(!Eo(l))throw new RangeError("Invalid time value");let d=e.match(bo).map(u=>{const h=u[0];if(h==="p"||h==="P"){const f=ho[h];return f(u,n.formatLong)}return u}).join("").match(Oo).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const h=u[0];if(h==="'")return{isToken:!1,value:xo(u)};if(_i[h])return{isToken:!0,value:u};if(h.match(vo))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:u}});n.localize.preprocessor&&(d=n.localize.preprocessor(l,d));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:n};return d.map(u=>{if(!u.isToken)return u.value;const h=u.value;(!t?.useAdditionalWeekYearTokens&&_o(h)||!t?.useAdditionalDayOfYearTokens&&go(h))&&yo(h,e,String(r));const f=_i[h[0]];return f(l,h,n.localize,c)}).join("")}function xo(r){const e=r.match(wo);return e?e[1].replace(To,"'"):r}function Io(){return Object.assign({},tt())}function Oi(r,e,t){const i=Io(),n=No(r,t.timeZone,t.locale??i.locale);return"formatToParts"in n?Do(n,e):ko(n,e)}function Do(r,e){const t=r.formatToParts(e);for(let i=t.length-1;i>=0;--i)if(t[i].type==="timeZoneName")return t[i].value}function ko(r,e){const t=r.format(e).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(t);return i?i[0].substr(1):""}function No(r,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:r})}function Ao(r,e){const t=Bo(e);return"formatToParts"in t?Uo(t,r):Ko(t,r)}const Lo={year:0,month:1,day:2,hour:3,minute:4,second:5};function Uo(r,e){try{const t=r.formatToParts(e),i=[];for(let n=0;n<t.length;n++){const o=Lo[t[n].type];o!==void 0&&(i[o]=parseInt(t[n].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Ko(r,e){const t=r.format(e),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const St={},bi=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),Mo=bi==="06/25/2014, 00:00:00"||bi==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function Bo(r){return St[r]||(St[r]=Mo?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:r,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),St[r]}function wi(r,e,t,i,n,o,a){const l=new Date(0);return l.setUTCFullYear(r,e,t),l.setUTCHours(i,n,o,a),l}const Ti=36e5,zo=6e4,xt={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function It(r,e,t){if(!r)return 0;let i=xt.timezoneZ.exec(r);if(i)return 0;let n,o;if(i=xt.timezoneHH.exec(r),i)return n=parseInt(i[1],10),vi(n)?-(n*Ti):NaN;if(i=xt.timezoneHHMM.exec(r),i){n=parseInt(i[2],10);const a=parseInt(i[3],10);return vi(n,a)?(o=Math.abs(n)*Ti+a*zo,i[1]==="+"?-o:o):NaN}if(Ho(r)){e=new Date(e||Date.now());const a=t?e:Po(e),l=Dt(a,r);return-(t?l:qo(e,l,r))}return NaN}function Po(r){return wi(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())}function Dt(r,e){const t=Ao(r,e),i=wi(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let n=r.getTime();const o=n%1e3;return n-=o>=0?o:1e3+o,i-n}function qo(r,e,t){let n=r.getTime()-e;const o=Dt(new Date(n),t);if(e===o)return e;n-=o-e;const a=Dt(new Date(n),t);return o===a?o:Math.max(o,a)}function vi(r,e){return-23<=r&&r<=23&&(e==null||0<=e&&e<=59)}const Si={};function Ho(r){if(Si[r])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:r}),Si[r]=!0,!0}catch{return!1}}const Go=60*1e3,$o={X:function(r,e,t){const i=kt(t.timeZone,r);if(i===0)return"Z";switch(e){case"X":return xi(i);case"XXXX":case"XX":return We(i);default:return We(i,":")}},x:function(r,e,t){const i=kt(t.timeZone,r);switch(e){case"x":return xi(i);case"xxxx":case"xx":return We(i);default:return We(i,":")}},O:function(r,e,t){const i=kt(t.timeZone,r);switch(e){case"O":case"OO":case"OOO":return"GMT"+Fo(i,":");default:return"GMT"+We(i,":")}},z:function(r,e,t){switch(e){case"z":case"zz":case"zzz":return Oi("short",r,t);default:return Oi("long",r,t)}}};function kt(r,e){const t=r?It(r,e,!0)/Go:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+r);return t}function ut(r,e){const t=r<0?"-":"";let i=Math.abs(r).toString();for(;i.length<e;)i="0"+i;return t+i}function We(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=ut(Math.floor(i/60),2),o=ut(Math.floor(i%60),2);return t+n+e+o}function xi(r,e){return r%60===0?(r>0?"-":"+")+ut(Math.abs(r)/60,2):We(r,e)}function Fo(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=Math.floor(i/60),o=i%60;return o===0?t+String(n):t+String(n)+e+ut(o,2)}function Ii(r){const e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return e.setUTCFullYear(r.getFullYear()),+r-+e}const Wo=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Nt=36e5,Di=6e4,Vo=2,ge={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Wo};function ki(r,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(r===null)return new Date(NaN);const t=e.additionalDigits==null?Vo:Number(e.additionalDigits);if(t!==2&&t!==1&&t!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]")return new Date(r.getTime());if(typeof r=="number"||Object.prototype.toString.call(r)==="[object Number]")return new Date(r);if(Object.prototype.toString.call(r)!=="[object String]")return new Date(NaN);const i=Yo(r),{year:n,restDateString:o}=Xo(i.date,t),a=jo(o,n);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let d=0,c;if(i.time&&(d=Qo(i.time),d===null||isNaN(d)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=It(i.timeZone||e.timeZone,new Date(l+d)),isNaN(c))return new Date(NaN)}else c=Ii(new Date(l+d)),c=Ii(new Date(l+d+c));return new Date(l+d+c)}else return new Date(NaN)}function Yo(r){const e={};let t=ge.dateTimePattern.exec(r),i;if(t?(e.date=t[1],i=t[3]):(t=ge.datePattern.exec(r),t?(e.date=t[1],i=t[2]):(e.date=null,i=r)),i){const n=ge.timeZone.exec(i);n?(e.time=i.replace(n[1],""),e.timeZone=n[1].trim()):e.time=i}return e}function Xo(r,e){if(r){const t=ge.YYY[e],i=ge.YYYYY[e];let n=ge.YYYY.exec(r)||i.exec(r);if(n){const o=n[1];return{year:parseInt(o,10),restDateString:r.slice(o.length)}}if(n=ge.YY.exec(r)||t.exec(r),n){const o=n[1];return{year:parseInt(o,10)*100,restDateString:r.slice(o.length)}}}return{year:null}}function jo(r,e){if(e===null)return null;let t,i,n;if(!r||!r.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=ge.MM.exec(r);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Li(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=ge.DDD.exec(r),o){t=new Date(0);const a=parseInt(o[1],10);return ea(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=ge.MMDD.exec(r),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Li(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=ge.Www.exec(r),o)return n=parseInt(o[1],10)-1,Ui(n)?Ni(e,n):new Date(NaN);if(o=ge.WwwD.exec(r),o){n=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Ui(n,a)?Ni(e,n,a):new Date(NaN)}return null}function Qo(r){let e,t,i=ge.HH.exec(r);if(i)return e=parseFloat(i[1].replace(",",".")),At(e)?e%24*Nt:NaN;if(i=ge.HHMM.exec(r),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),At(e,t)?e%24*Nt+t*Di:NaN;if(i=ge.HHMMSS.exec(r),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const n=parseFloat(i[3].replace(",","."));return At(e,t,n)?e%24*Nt+t*Di+n*1e3:NaN}return null}function Ni(r,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(r,0,4);const n=i.getUTCDay()||7,o=e*7+t+1-n;return i.setUTCDate(i.getUTCDate()+o),i}const Zo=[31,28,31,30,31,30,31,31,30,31,30,31],Jo=[31,29,31,30,31,30,31,31,30,31,30,31];function Ai(r){return r%400===0||r%4===0&&r%100!==0}function Li(r,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=Ai(r);if(i&&t>Jo[e]||!i&&t>Zo[e])return!1}return!0}function ea(r,e){if(e<1)return!1;const t=Ai(r);return!(t&&e>366||!t&&e>365)}function Ui(r,e){return!(r<0||r>52||e!=null&&(e<0||e>6))}function At(r,e,t){return!(r<0||r>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const ta=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Lt(r,e,t={}){e=String(e);const i=e.match(ta);if(i){const n=ki(t.originalDate||r,t);e=i.reduce(function(o,a){if(a[0]==="'")return o;const l=o.indexOf(a),d=o[l-1]==="'",c=o.replace(a,"'"+$o[a[0]](n,a,t)+"'");return d?c.substring(0,l-1)+c.substring(l+1):c},e)}return So(r,e,t)}function ia(r,e,t){r=ki(r,t);const i=It(e,r,!0),n=new Date(r.getTime()-i),o=new Date(0);return o.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),o.setHours(n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()),o}function ra(r,e,t,i){return i={...i,timeZone:e,originalDate:r},Lt(ia(r,e,{timeZone:i.timeZone}),t,i)}const Ut="#6c7489",Ki="12px",na="16px",Mi="20px",Bi="32px",zi="20px";var dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ht={exports:{}},oa=ht.exports,Pi;function aa(){return Pi||(Pi=1,(function(r,e){(function(t,i){i()})(oa,function(){function t(c,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,u,h){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){d(f.response,u,h)},f.onerror=function(){console.error("could not download file")},f.send()}function n(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function o(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof dt=="object"&&dt.global===dt?dt:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),d=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,u,h){var f=a.URL||a.webkitURL,m=document.createElement("a");u=u||c.name||"download",m.download=u,m.rel="noopener",typeof c=="string"?(m.href=c,m.origin===location.origin?o(m):n(m.href)?i(c,u,h):o(m,m.target="_blank")):(m.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(m.href)},4e4),setTimeout(function(){o(m)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,h){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,h),u);else if(n(c))i(c,u,h);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){o(f)})}}:function(c,u,h,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return i(c,u,h);var m=c.type==="application/octet-stream",_=/constructor/i.test(a.HTMLElement)||a.safari,O=/CriOS\/[\d]+/.test(navigator.userAgent);if((O||m&&_||l)&&typeof FileReader<"u"){var C=new FileReader;C.onloadend=function(){var E=C.result;E=O?E:E.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=E:location=E,f=null},C.readAsDataURL(c)}else{var T=a.URL||a.webkitURL,k=T.createObjectURL(c);f?f.location=k:location.href=k,f=null,setTimeout(function(){T.revokeObjectURL(k)},4e4)}});a.saveAs=d.saveAs=d,r.exports=d})})(ht)),ht.exports}var la=aa(),ft={exports:{}};var ca=ft.exports,qi;function ua(){return qi||(qi=1,(function(r,e){((t,i)=>{r.exports=i()})(ca,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},n=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,d={};function c(p){return p.charCodeAt(0)===65279?p.slice(1):p}function u(p){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(g){var y=v(g);y.chunkSize=parseInt(y.chunkSize),g.step||g.chunk||(y.chunkSize=null),this._handle=new O(y),(this._handle.streamer=this)._config=y}).call(this,p),this.parseChunk=function(g,y){var S=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<S){let N=this._config.newline;N||(x=this._config.quoteChar||'"',N=this._handle.guessLineEndings(g,x)),g=[...g.split(N).slice(S)].join(N)}this.isFirstChunk&&z(this._config.beforeFirstChunk)&&(x=this._config.beforeFirstChunk(g))!==void 0&&(g=x),this.isFirstChunk=!1,this._halted=!1;var S=this._partialLine+g,x=(this._partialLine="",this._handle.parse(S,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(g=x.meta.cursor,S=(this._finished||(this._partialLine=S.substring(g-this._baseIndex),this._baseIndex=g),x&&x.data&&(this._rowCount+=x.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:x,workerId:d.WORKER_ID,finished:S});else if(z(this._config.chunk)&&!y){if(this._config.chunk(x,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=x=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(x.data),this._completeResults.errors=this._completeResults.errors.concat(x.errors),this._completeResults.meta=x.meta),this._completed||!S||!z(this._config.complete)||x&&x.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),S||x&&x.meta.paused||this._nextChunk(),x}this._halted=!0},this._sendError=function(g){z(this._config.error)?this._config.error(g):o&&this._config.error&&i.postMessage({workerId:d.WORKER_ID,error:g,finished:!1})}}function h(p){var g;(p=p||{}).chunkSize||(p.chunkSize=d.RemoteChunkSize),u.call(this,p),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(y){this._input=y,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(g=new XMLHttpRequest,this._config.withCredentials&&(g.withCredentials=this._config.withCredentials),n||(g.onload=U(this._chunkLoaded,this),g.onerror=U(this._chunkError,this)),g.ontimeout=U(this._chunkTimeout,this),g.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadTimeout&&!n&&(g.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var y,S=this._config.downloadRequestHeaders;for(y in S)g.setRequestHeader(y,S[y])}var x;this._config.chunkSize&&(x=this._start+this._config.chunkSize-1,g.setRequestHeader("Range","bytes="+this._start+"-"+x));try{g.send(this._config.downloadRequestBody)}catch(N){this._chunkError(N.message)}n&&g.status===0&&this._chunkError()}},this._chunkLoaded=function(){g.readyState===4&&(g.status<200||400<=g.status?this._chunkError():(this._start+=this._config.chunkSize||g.responseText.length,this._finished=!this._config.chunkSize||this._start>=(y=>(y=y.getResponseHeader("Content-Range"))!==null?parseInt(y.substring(y.lastIndexOf("/")+1)):-1)(g),this.parseChunk(g.responseText)))},this._chunkError=function(y){y=g.statusText||y,this._sendError(new Error(y))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function f(p){(p=p||{}).chunkSize||(p.chunkSize=d.LocalChunkSize),u.call(this,p);var g,y,S=typeof FileReader<"u";this.stream=function(x){this._input=x,y=x.slice||x.webkitSlice||x.mozSlice,S?((g=new FileReader).onload=U(this._chunkLoaded,this),g.onerror=U(this._chunkError,this)):g=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var x=this._input,N=(this._config.chunkSize&&(N=Math.min(this._start+this._config.chunkSize,this._input.size),x=y.call(x,this._start,N)),g.readAsText(x,this._config.encoding));S||this._chunkLoaded({target:{result:N}})},this._chunkLoaded=function(x){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(x.target.result)},this._chunkError=function(){this._sendError(g.error)}}function m(p){var g;u.call(this,p=p||{}),this.stream=function(y){return g=y,this._nextChunk()},this._nextChunk=function(){var y,S;if(!this._finished)return y=this._config.chunkSize,g=y?(S=g.substring(0,y),g.substring(y)):(S=g,""),this._finished=!g,this.parseChunk(S)}}function _(p){u.call(this,p=p||{});var g=[],y=!0,S=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(x){this._input=x,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){S&&g.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),g.length?this.parseChunk(g.shift()):y=!0},this._streamData=U(function(x){try{g.push(typeof x=="string"?x:x.toString(this._config.encoding)),y&&(y=!1,this._checkIsFinished(),this.parseChunk(g.shift()))}catch(N){this._streamError(N)}},this),this._streamError=U(function(x){this._streamCleanUp(),this._sendError(x)},this),this._streamEnd=U(function(){this._streamCleanUp(),S=!0,this._streamData("")},this),this._streamCleanUp=U(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function O(p){var g,y,S,x,N=Math.pow(2,53),K=-N,q=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,V=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,P=this,$=0,M=0,A=!1,w=!1,D=[],I={data:[],errors:[],meta:{}};function Z(Y){return p.skipEmptyLines==="greedy"?Y.join("").trim()==="":Y.length===1&&Y[0].length===0}function re(){if(I&&S&&(he("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+d.DefaultDelimiter+"'"),S=!1),p.skipEmptyLines&&(I.data=I.data.filter(function(G){return!Z(G)})),te()){let G=function(le){D.push(le)};if(I)if(Array.isArray(I.data[0])){for(var Y=0;te()&&Y<I.data.length;Y++)I.data[Y].forEach(G);I.data.splice(0,1)}else I.data.forEach(G)}function X(G,le){for(var ue=p.header?{}:[],J=0;J<G.length;J++){var se=J,j=G[J],j=((Re,F)=>(oe=>(p.dynamicTypingFunction&&p.dynamicTyping[oe]===void 0&&(p.dynamicTyping[oe]=p.dynamicTypingFunction(oe)),(p.dynamicTyping[oe]||p.dynamicTyping)===!0))(Re)?F==="true"||F==="TRUE"||F!=="false"&&F!=="FALSE"&&((oe=>{if(q.test(oe)&&(oe=parseFloat(oe),K<oe&&oe<N))return 1})(F)?parseFloat(F):V.test(F)?new Date(F):F===""?null:F):F)(se=p.header?J>=D.length?"__parsed_extra":D[J]:se,j=p.transform?p.transform(j,se):j);se==="__parsed_extra"?(ue[se]=ue[se]||[],ue[se].push(j)):ue[se]=j}return p.header&&(J>D.length?he("FieldMismatch","TooManyFields","Too many fields: expected "+D.length+" fields but parsed "+J,M+le):J<D.length&&he("FieldMismatch","TooFewFields","Too few fields: expected "+D.length+" fields but parsed "+J,M+le)),ue}var ae;I&&(p.header||p.dynamicTyping||p.transform)&&(ae=1,!I.data.length||Array.isArray(I.data[0])?(I.data=I.data.map(X),ae=I.data.length):I.data=X(I.data,0),p.header&&I.meta&&(I.meta.fields=D),M+=ae)}function te(){return p.header&&D.length===0}function he(Y,X,ae,G){Y={type:Y,code:X,message:ae},G!==void 0&&(Y.row=G),I.errors.push(Y)}z(p.step)&&(x=p.step,p.step=function(Y){I=Y,te()?re():(re(),I.data.length!==0&&($+=Y.data.length,p.preview&&$>p.preview?y.abort():(I.data=I.data[0],x(I,P))))}),this.parse=function(Y,X,ae){var G=p.quoteChar||'"',G=(p.newline||(p.newline=this.guessLineEndings(Y,G)),S=!1,p.delimiter?z(p.delimiter)&&(p.delimiter=p.delimiter(Y),I.meta.delimiter=p.delimiter):((G=((le,ue,J,se,j)=>{var Re,F,oe,Ae;j=j||[","," ","|",";",d.RECORD_SEP,d.UNIT_SEP];for(var Me=0;Me<j.length;Me++){for(var Ee,qe=j[Me],fe=0,Oe=0,de=0,pe=(oe=void 0,new T({comments:se,delimiter:qe,newline:ue,preview:10}).parse(le)),xe=0;xe<pe.data.length;xe++)J&&Z(pe.data[xe])?de++:(Ee=pe.data[xe].length,Oe+=Ee,oe===void 0?oe=Ee:0<Ee&&(fe+=Math.abs(Ee-oe),oe=Ee));0<pe.data.length&&(Oe/=pe.data.length-de),1.99<Oe&&(F===void 0||fe<F||fe===F&&Ae<Oe)&&(F=fe,Re=qe,Ae=Oe)}return{successful:!!(p.delimiter=Re),bestDelimiter:Re}})(Y,p.newline,p.skipEmptyLines,p.comments,p.delimitersToGuess)).successful?p.delimiter=G.bestDelimiter:(S=!0,p.delimiter=d.DefaultDelimiter),I.meta.delimiter=p.delimiter),v(p));return G.header=te(),p.preview&&p.header&&G.preview++,g=Y,y=new T(G),I=y.parse(g,X,ae),re(),A?{meta:{paused:!0}}:I||{meta:{paused:!1}}},this.paused=function(){return A},this.pause=function(){A=!0,y.abort(),g=z(p.chunk)?"":g.substring(y.getCharIndex())},this.resume=function(){P.streamer._halted?(A=!1,P.streamer.parseChunk(g,!0)):setTimeout(P.resume,3)},this.aborted=function(){return w},this.abort=function(){w=!0,y.abort(),I.meta.aborted=!0,z(p.complete)&&p.complete(I),g=""},this.guessLineEndings=function(le,G){le=le.substring(0,1048576);var G=new RegExp(C(G)+"([^]*?)"+C(G),"gm"),ae=(le=le.replace(G,"")).split("\r"),G=le.split(`
2
- `),le=1<G.length&&G[0].length<ae[0].length;if(ae.length===1||le)return`
3
- `;for(var ue=0,J=0;J<ae.length;J++)ae[J][0]===`
4
- `&&ue++;return ue>=ae.length/2?`\r
5
- `:"\r"}}function C(p){return p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T(p){var g=(p=p||{}).delimiter,y=p.newline,S=p.comments,x=p.step,N=p.preview,K=p.fastMode,q=null,V=!1,P=p.quoteChar==null?'"':p.quoteChar,$=P;if(p.escapeChar!==void 0&&($=p.escapeChar),(typeof g!="string"||-1<d.BAD_DELIMITERS.indexOf(g))&&(g=","),S===g)throw new Error("Comment character same as delimiter");S===!0?S="#":(typeof S!="string"||-1<d.BAD_DELIMITERS.indexOf(S))&&(S=!1),y!==`
6
- `&&y!=="\r"&&y!==`\r
7
- `&&(y=`
8
- `);var M=0,A=!1;this.parse=function(w,D,I){if(typeof w!="string")throw new Error("Input must be a string");var Z=w.length,re=g.length,te=y.length,he=S.length,Y=z(x),X=[],ae=[],G=[],le=M=0;if(!w)return fe();if(K||K!==!1&&w.indexOf(P)===-1){for(var ue=w.split(y),J=0;J<ue.length;J++){if(G=ue[J],M+=G.length,J!==ue.length-1)M+=y.length;else if(I)return fe();if(!S||G.substring(0,he)!==S){if(Y){if(X=[],Ae(G.split(g)),Oe(),A)return fe()}else Ae(G.split(g));if(N&&N<=J)return X=X.slice(0,N),fe(!0)}}return fe()}for(var se=w.indexOf(g,M),j=w.indexOf(y,M),Re=new RegExp(C($)+C(P),"g"),F=w.indexOf(P,M);;)if(w[M]===P)for(F=M,M++;;){if((F=w.indexOf(P,F+1))===-1)return I||ae.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:X.length,index:M}),Ee();if(F===Z-1)return Ee(w.substring(M,F).replace(Re,P));if(P===$&&w[F+1]===$)F++;else if(P===$||F===0||w[F-1]!==$){se!==-1&&se<F+1&&(se=w.indexOf(g,F+1));var oe=Me((j=j!==-1&&j<F+1?w.indexOf(y,F+1):j)===-1?se:Math.min(se,j));if(w.substr(F+1+oe,re)===g){G.push(w.substring(M,F).replace(Re,P)),w[M=F+1+oe+re]!==P&&(F=w.indexOf(P,M)),se=w.indexOf(g,M),j=w.indexOf(y,M);break}if(oe=Me(j),w.substring(F+1+oe,F+1+oe+te)===y){if(G.push(w.substring(M,F).replace(Re,P)),qe(F+1+oe+te),se=w.indexOf(g,M),F=w.indexOf(P,M),Y&&(Oe(),A))return fe();if(N&&X.length>=N)return fe(!0);break}ae.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:X.length,index:M}),F++}}else if(S&&G.length===0&&w.substring(M,M+he)===S){if(j===-1)return fe();M=j+te,j=w.indexOf(y,M),se=w.indexOf(g,M)}else if(se!==-1&&(se<j||j===-1))G.push(w.substring(M,se)),M=se+re,se=w.indexOf(g,M);else{if(j===-1)break;if(G.push(w.substring(M,j)),qe(j+te),Y&&(Oe(),A))return fe();if(N&&X.length>=N)return fe(!0)}return Ee();function Ae(de){X.push(de),le=M}function Me(de){var pe=0;return pe=de!==-1&&(de=w.substring(F+1,de))&&de.trim()===""?de.length:pe}function Ee(de){return I||(de===void 0&&(de=w.substring(M)),G.push(de),M=Z,Ae(G),Y&&Oe()),fe()}function qe(de){M=de,Ae(G),G=[],j=w.indexOf(y,M)}function fe(de){if(p.header&&!D&&X.length&&!V){var pe=X[0],xe=Object.create(null),je=new Set(pe);let Ot=!1;for(let Be=0;Be<pe.length;Be++){let be=c(pe[Be]);if(xe[be=z(p.transformHeader)?p.transformHeader(be,Be):be]){let He,L=xe[be];for(;He=be+"_"+L,L++,je.has(He););je.add(He),pe[Be]=He,xe[be]++,Ot=!0,(q=q===null?{}:q)[He]=be}else xe[be]=1,pe[Be]=be;je.add(be)}Ot&&console.warn("Duplicate headers found and renamed."),V=!0}return{data:X,errors:ae,meta:{delimiter:g,linebreak:y,aborted:A,truncated:!!de,cursor:le+(D||0),renamedHeaders:q}}}function Oe(){x(fe()),X=[],ae=[]}},this.abort=function(){A=!0},this.getCharIndex=function(){return M}}function k(p){var g=p.data,y=a[g.workerId],S=!1;if(g.error)y.userError(g.error,g.file);else if(g.results&&g.results.data){var x={abort:function(){S=!0,E(g.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(z(y.userStep)){for(var N=0;N<g.results.data.length&&(y.userStep({data:g.results.data[N],errors:g.results.errors,meta:g.results.meta},x),!S);N++);delete g.results}else z(y.userChunk)&&(y.userChunk(g.results,x,g.file),delete g.results)}g.finished&&!S&&E(g.workerId,g.results)}function E(p,g){var y=a[p];z(y.userComplete)&&y.userComplete(g),y.terminate(),delete a[p]}function b(){throw new Error("Not implemented.")}function v(p){if(typeof p!="object"||p===null)return p;var g,y=Array.isArray(p)?[]:{};for(g in p)y[g]=v(p[g]);return y}function U(p,g){return function(){p.apply(g,arguments)}}function z(p){return typeof p=="function"}return d.parse=function(p,g){var y=(g=g||{}).dynamicTyping||!1;if(z(y)&&(g.dynamicTypingFunction=y,y={}),g.dynamicTyping=y,g.transform=!!z(g.transform)&&g.transform,g.downloadTimeout!==void 0){var y=parseInt(g.downloadTimeout);if(isNaN(y))throw new Error("Config downloadTimeout value ("+g.downloadTimeout+") not parsable by parseInt(val).");g.downloadTimeout=y}if(!g.worker||!d.WORKERS_SUPPORTED)return y=null,d.NODE_STREAM_INPUT,typeof p=="string"?(p=c(p),y=new(g.download?h:m)(g)):p.readable===!0&&z(p.read)&&z(p.on)?y=new _(g):(i.File&&p instanceof File||p instanceof Object)&&(y=new f(g)),y.stream(p);(y=(()=>{var S;return!!d.WORKERS_SUPPORTED&&(S=(()=>{var x=i.URL||i.webkitURL||null,N=t.toString();return d.BLOB_URL||(d.BLOB_URL=x.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",N,")();"],{type:"text/javascript"})))})(),(S=new i.Worker(S)).onmessage=k,S.id=l++,a[S.id]=S)})()).userStep=g.step,y.userChunk=g.chunk,y.userComplete=g.complete,y.userError=g.error,g.step=z(g.step),g.chunk=z(g.chunk),g.complete=z(g.complete),g.error=z(g.error),delete g.worker,y.postMessage({input:p,config:g,workerId:y.id})},d.unparse=function(p,g){var y=!1,S=!0,x=",",N=`\r
9
- `,K='"',q=K+K,V=!1,P=null,$=!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?$=g.escapeFormulae:typeof g.escapeFormulae=="boolean"&&g.escapeFormulae&&($=/^[=+\-@\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,$&&typeof D=="string"&&$.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
- `,'"',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 da=ua(),Ve=(r=>(r.String="string",r.Number="number",r.Boolean="boolean",r.Object="object",r.Undefined="undefined",r))(Ve||{});const ha=["id"],fa=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=da.unparse(o.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
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});la.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,ha))}}),ma=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(fa,{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_gateway_version:"AI gateway version",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 Kt(){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",Mt="{entity-id}",$i="{cp-id}",Fi="{timeframe}",Wi=30*1e3,Vi=3e5,Yi=36e5;function pa(){const r=s.inject(ve);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var Bt={exports:{}},Xi;function ga(){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})(Bt)),Bt.exports}var _a=ga();const ya=sa(_a);class zt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,zt)}}const ji=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function Ra(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 zt;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 Ca(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 Ea=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=Ca(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>Ea&&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 Oa extends ya{#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=Ra(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 ba=()=>{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 Oa({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 wa(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 Ta({method:r="warn",formatter:e=wa}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const va=Error.captureStackTrace;var Sa=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,va?.(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 xa(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function Ia(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||xa(i,n),l=(d={},c={})=>{const u=new Sa({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 Da=typeof window<"u",ka=Ia({reporters:[Ta()],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",Pt=r=>r?.query?.datasource==="requests",qt=r=>!!r&&!Ie(r)&&!Pt(r),Na=(r,e)=>{const t=r.header_description??("description"in r.chart?r.chart.description:void 0);if(t)return t.replaceAll(Fi,e)||void 0},Aa=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],La=r=>Aa.includes(r);function Ua({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&&La(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(!qt(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 Ht=r=>r.type==="relative"?Q.TimePeriods.get(Q.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Ka=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),Gt=(r,e)=>{if(!r||!e?.length)return;const t=Ht(r),i=Ka(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},$t=(r,e)=>{const t=Gt(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 Ma(){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=$t(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 Ba="24H",za={status_code:"response_http_status",upstream_status_code:"upstream_status"},Pa={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"},qa=r=>Q.relativeTimeRangeValuesRequestV2.includes(r),Ha=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:qa(t)?t:Ba,...e}},tr=r=>za[r]??r,Ga=r=>({metric:tr(r.metric),dimension:r.dimension?tr(r.dimension):void 0,unroll:r.unroll,metricUnit:Pa[r.metric],extraFields:r.extra_fields}),Ft="requests";function $a(){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 $t(c&&{...c,tz:c.tz??d.tz},t.value[Ft]?.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:Ft,filters:[...l.filters??[],...d.filters]});return Q.fetchAllRequests(c,{datasource:Ft,query:{filters:h,time_range:Ha(o(l,d))}},u,{maxRecords:l.max_records})}}}function Fa({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 Wa=6,ir=6,rr=4;function Va(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 Ya(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 Xa(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 ja(r){const{i18n:e}=Kt(),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=Ya(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=Wa+(l?rr:0),K=S-h*2,q=x-h*2-N-ir,V=v.width/K,P=q*V,$=Xa(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<$.length;A++){A>0&&y.addPage();const{startY:w,height:D}=$[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),Va(y,{...M,pageLabel:e.t("pdfExport.pageOf",{page:String(A+1),total:String($.length)})})}if(_==="blob"){const A=y.output("blob");return t.value={status:"complete",pageCount:$.length},A}y.save(o),t.value={status:"complete",pageCount:$.length}}catch(k){t.value={status:"error",error:k}}finally{Q.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const Qa=r=>r.toLowerCase().endsWith("count")?"":r;function Za(){const{i18n:r}=Kt(),{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:Qa})}}}const ce={useContextLinks:Ua,useDashboardContext:Fa,useEvaluateFeatureFlag:pa,useExportPdf:ja,useI18n:Kt,useIssueQuery:Ma,useIssueRequestsQuery:$a,useMetricFormatter:Za,useRequestQueue:ba},Ja={class:"kong-ui-public-csv-export-modal"},el={key:0,class:"selected-range"},tl={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:Lt(U,"yyyy-MM-dd HH:mm:ss"),tzOffset:Lt(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",el,[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",tl,[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(Ut)})`,size:`var(--kui-icon-size-30, ${s.unref(na)})`},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(ma,{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 il=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=il){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}=ni(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)}}}),rl=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(rl,[["__scopeId","data-v-22077b88"]]),nl={class:"analytics-chart"},Wt=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",nl,[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(Wt,{"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"]))}}),sl={class:"analytics-chart"},ol={key:3,class:"analytics-chart"},al=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?Ht(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}=ni(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,Ga(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",ol,[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",sl,[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(Wt,{"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"]))}}),ll=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(si.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(si.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 cl=r=>!!r?.length;function ul(r,e,t,i=cl){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 dl=({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"})}})},hl=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},fl=({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},ml=({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($=>{V=$}),resolve:$=>V($)};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 $=n.get(K-1);if(!$)return p(K,q),"failed";const M=await $.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:$})=>{$.cursor!==void 0&&i.set(K,$.cursor),V.successCallback($.data,fl({startRow:V.startRow,rowsLength:$.data.length,pageSize:P,total:$.total,hasMore:$.hasMore})),V.startRow===0&&(d.value=$.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:$}=hl({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:$,cursor:w,sort:t?.value});if(!T(q,M)){V.failCallback(),p(P,A);return}y({blockIndex:P,currentBlockCompletion:A,getRowsParams:V,pageSize:$,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)}},pl={title:"No Data",message:"There is no data to display."},gl={title:"An error occurred",message:"Data cannot be displayed due to an error."},_l={emptyState:pl,errorState:gl};function dr(){const r=at.createI18n("en-us",_l);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:yl}=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,Rl=(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}),Cl=(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"},El=(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},Ol=r=>{const e=t=>yl.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)??Ol(i)},mr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,bl=({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:""}),wl=["data-threshold"],Tl={class:"table-data-grid-cell-label-track"},vl={class:"table-data-grid-cell-label"},Sl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},xl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},Il=["data-text"],Dl=["data-text"],kl=["data-threshold"],Nl=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?El(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?Cl(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",Tl,[s.createElementVNode("span",vl,[(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",Sl,"("+s.toDisplayString(f.value)+")",1)):s.createCommentVNode("",!0)]),O.value?(s.openBlock(),s.createElementBlock("span",xl,[s.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":O.value.value},null,8,Il),O.value.relative?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${O.value.relative})`},null,8,Dl)):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,kl)):s.createCommentVNode("",!0)],10,wl)}}}),Al=({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,Rl(m,_)]))}),u=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(_=>_.bar).map(_=>[_.key,bl({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:Nl,cellRendererParams:{headerDef:m}}};return{columnDefs:s.computed(()=>r.value.map(f)),gridContext:h}},Vt=({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,Ll=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:n,onExternalConfigChange:o})=>{const a=s.computed(()=>t.value?Vt({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=s.ref(a.value??Vt({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=Vt({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}},Ul=({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)}}},Kl=({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}},Ml={key:0,class:"table-error-state","data-testid":"table-error-state"},Bl={key:1,class:"table-empty-state","data-testid":"table-empty-state"},zl=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:_}=Ll({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}=Kl({activeSort:f,patchTableConfig:_}),T=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Qe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:b}=Ul({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"?ml({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}=Al({headers:s.toRef(()=>r.headers),mode:t,rows:S,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:q,state:V}=ul(g,s.toRef(()=>z?.error.value),y),P=s.computed(()=>V.value===K.SUCCESS&&!q.value);z&&dl({emitState:A=>i("state",A),fetchLifecycleState:V,hasData:q});const $=()=>{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],$);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",Ml,[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",Bl,[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:$,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)}}}),Pl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},gr=Pl(zl,[["__scopeId","data-v-01cd8bcd"]]),_r=3,ql={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},Yt=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},Hl=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!(Yt(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return ql[t.toLowerCase()]},Gl=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},$l=r=>r.toLocaleLowerCase().endsWith("count"),Fl=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]=Gl(i.event[o])}),n})},Wl=({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)=>Yt(e,E)?.label||b,m=(E,b)=>{if($l(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=Yt(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}},Vl={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",Vl,s.toDisplayString(r.entityLinkData.label),1))}}),Yl=["data-testid"],Xl={key:1},jl=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(()=>Fl(r.data)),n=s.computed(()=>Wl({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)=>Hl({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($i,k).replace(Mt,E)}return C.replace(Mt,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",Xl,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,Yl)}}}),[["__scopeId","data-v-f6b76589"]]),Ql=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(jl,{"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"]))}}),Zl=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}}),ec={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}},tc={platform:Cr,platform_usage:Cr},ic=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(()=>ec[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=tc[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"]]),rc=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(Wt,{"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"]))}}),nc="#ffffff",sc="#0044f4",oc="#d60027",ac="#ad000e",lc="#850000",cc="#5c0000",uc="#ff3954",dc="#ffabab",hc="#ffe5e5",fc="#ecfcff",mc="#6f28ff",pc="#f1f0ff",gc="#e0e4ea",_c="#0044f4",yc="#0030cc",Rc="#002099",Cc="#001466",Ec="#5f9aff",Oc="#bee2ff",bc="#eefaff",wc="#0d0e14",Tc="#6c7489",vc="#52596e",Sc="#3a3f51",xc="#232633",Ic="#afb7c5",Dc="#e0e4ea",kc="#f9fafb",Nc="rgba(13, 14, 20, 0.6)",Ac="#0044f4",Lc="#0030cc",Uc="#002099",Kc="#001466",Mc="#5f9aff",Bc="#bee2ff",zc="#eefaff",Pc="#007d60",qc="#005944",Hc="#004737",Gc="#003629",$c="#00d6a4",Fc="#b5ffee",Wc="#ecfffb",Vc="rgba(0, 0, 0, 0)",Yc="#995c00",Xc="#804400",jc="#662d00",Qc="#4d1b00",Zc="#ffc400",Jc="#fff296",eu="#fffce0",tu="#e0e4ea",iu="#0044f4",ru="#d60027",nu="#ad000e",su="#850000",ou="#5c0000",au="#ff3954",lu="#ffabab",cu="#ffe5e5",uu="#6f28ff",du="#e0e4ea",hu="rgba(255, 255, 255, 0.2)",fu="#6c7489",mu="#52596e",pu="#3a3f51",gu="#232633",_u="#afb7c5",yu="#e0e4ea",Ru="#f9fafb",Cu="#0044f4",Eu="#0030cc",Ou="#002099",bu="#001466",wu="#5f9aff",Tu="#bee2ff",vu="#eefaff",Su="rgba(0, 0, 0, 0)",xu="#0044f4",Iu="#0d0e14",Du="#0044f4",ku="#d60027",Nu="#ad000e",Au="#850000",Lu="#5c0000",Uu="#ff3954",Ku="#ffabab",Mu="#ffe5e5",Bu="#00abd2",zu="#d60067",Pu="#6f28ff",qu="#5e00f5",Hu="#afb7c5",Gu="#0044f4",$u="#0030cc",Fu="#002099",Wu="#001466",Vu="#5f9aff",Yu="#bee2ff",Xu="#eefaff",ju="#ffffff",Qu="#6c7489",Zu="#52596e",Ju="#3a3f51",ed="#232633",td="#afb7c5",id="#e0e4ea",rd="#f9fafb",nd="#0044f4",sd="#0030cc",od="#002099",ad="#001466",ld="#5f9aff",cd="#bee2ff",ud="#eefaff",dd="#007d60",hd="#005944",fd="#004737",md="#003629",pd="#00d6a4",gd="#b5ffee",_d="#ecfffb",yd="#995c00",Rd="#804400",Cd="#662d00",Ed="#4d1b00",Od="#ffc400",bd="#fff296",wd="#fffce0",Td="0.2s",vd="0px",Sd="2px",xd="4px",Id="6px",Dd="8px",kd="10px",Nd="50%",Ad="100px",Ld="0px",Ud="1px",Kd="2px",Md="4px",Bd="640px",zd="768px",Pd="1024px",qd="1280px",Hd="1536px",Gd="'JetBrains Mono', Consolas, monospace",$d="'Inter', Roboto, Helvetica, sans-serif",Xt="'Inter', Roboto, Helvetica, sans-serif",Fd="10px",Wd="12px",Vd="14px",Yd="16px",Xd="18px",jd="20px",Qd="24px",Zd="32px",Jd="40px",eh="48px",th="700",ih="500",rh="400",nh="600",sh="#f50045",oh="#828a9e",ah="#306fff",lh="#00a17b",ch="#ffc400",uh="10px",dh="12px",hh="16px",fh="20px",mh="24px",ph="32px",gh="40px",_h="48px",yh="normal",Rh="-0.12px",Ch="-0.24px",Eh="-0.32px",Oh="-0.4px",bh="-0.48px",wh="normal",Th="12px",vh="16px",Sh="20px",xh="24px",Ih="28px",Dh="32px",kh="36px",Nh="40px",Ah="48px",Lh="56px",Uh="#f1f0ff",Kh="#ffe5e5",Mh="#eefaff",Bh="#52596e",zh="#e0e4ea",Ph="#ecfcff",qh="#ecfffb",Hh="#fffce0",Gh="#fff0f7",$h="#6f28ff",Fh="#5e00f5",Wh="#d60027",Vh="#ad000e",Yh="#0044f4",Xh="#0030cc",jh="#e0e4ea",Qh="#afb7c5",Zh="#52596e",Jh="#3a3f51",ef="#00819d",tf="#00647a",rf="#007d60",nf="#005944",sf="#995c00",of="#804400",af="#d60067",lf="#ad0053",cf="#000933",uf="rgba(255, 255, 255, 0.12)",df="rgba(255, 255, 255, 0.12)",hf="#00fabe",ff="rgba(255, 255, 255, 0.24)",mf="#bee2ff",pf="#ffffff",gf="#eefaff",_f="#00fabe",yf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",Rf="4px 0 0 0 #00fabe inset",Cf="0 0 0 1px rgba(255, 255, 255, 0.60) inset",Ef="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",Of="0px 0px 0px 1px #e0e4ea inset",bf="0px 0px 0px 1px #d60027 inset",wf="0px 0px 0px 1px #ad000e inset",Tf="0px 0px 0px 1px #e0e4ea inset",vf="0px 0px 0px 1px #0044f4 inset",Sf="0px 0px 0px 1px #001466 inset",xf="0px 0px 0px 1px #5f9aff inset",If="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Df="0px",kf="2px",Nf="4px",Af="6px",Lf="8px",Uf="12px",Kf="16px",Mf="20px",Bf="24px",zf="32px",Pf="40px",qf="48px",Hf="56px",Gf="64px",$f="80px",Ff="96px",Wf="auto",Vf="#bee2ff",Yf="#8fc1ff",Xf="#5f9aff",jf="#306fff",Qf="#b5ffee",Zf="#00fabe",Jf="#00d6a4",em="#00a17b",tm="#007d60",im="#005944",rm="#b5ffee",nm="#00fabe",sm="#b5ffee",om="#00a17b",am="#fff296",lm="#ffe04b",cm="#ffc400",um="#b37600",dm="#995c00",hm="#804400",fm="#fff296",mm="#ffe04b",pm="#ffc2b3",gm="#ff9877",_m="#ff723c",ym="#f75008",Rm="#d13500",Cm="#a31f00",Em="#ffc2b3",Om="#ff9877",bm="#ff723c",wm="#f75008",Tm="#d13500",vm="#a31f00",Sm="#ffc2b3",xm="#ff9877",Im="#ff723c",Dm="#f75008",km="#d13500",Nm="#a31f00",Am="#ffc2b3",Lm="#ff9877",Um="#ff723c",Km="#f75008",Mm="#d13500",Bm="#a31f00",zm="#ffc2b3",Pm="#ff9877",qm="#ff723c",Hm="#f75008",Gm="#d13500",$m="#ffabab",Fm="#ff7272",Wm="#ff3954",Vm="#f50045",Ym="#d60027",Xm="#ad000e",jm="#ffabab",Qm="#ff7272",Zm="#ff3954",Jm="#f50045",ep="#d60027",tp="#eefaff",ip="#ecfffb",rp="#fffce0",np="#fff1ef",sp="#ffe5e5",op="#5f9aff",ap="#00d6a4",lp="#ffc400",cp="#ff723c",up="#ff3954",dp="#eefaff",hp="#ecfffb",fp="#fffce0",mp="#fff1ef",pp="#ffe5e5",gp="#0044f4",_p="#007d60",yp="#995c00",Rp="#d13500",Cp="#d60027",Er=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Td,KUI_BORDER_RADIUS_0:vd,KUI_BORDER_RADIUS_10:Sd,KUI_BORDER_RADIUS_20:xd,KUI_BORDER_RADIUS_30:Id,KUI_BORDER_RADIUS_40:Dd,KUI_BORDER_RADIUS_50:kd,KUI_BORDER_RADIUS_CIRCLE:Nd,KUI_BORDER_RADIUS_ROUND:Ad,KUI_BORDER_WIDTH_0:Ld,KUI_BORDER_WIDTH_10:Ud,KUI_BORDER_WIDTH_20:Kd,KUI_BORDER_WIDTH_30:Md,KUI_BREAKPOINT_DESKTOP:Hd,KUI_BREAKPOINT_LAPTOP:qd,KUI_BREAKPOINT_MOBILE:Bd,KUI_BREAKPOINT_PHABLET:zd,KUI_BREAKPOINT_TABLET:Pd,KUI_COLOR_BACKGROUND:nc,KUI_COLOR_BACKGROUND_ACCENT:sc,KUI_COLOR_BACKGROUND_DANGER:oc,KUI_COLOR_BACKGROUND_DANGER_STRONG:ac,KUI_COLOR_BACKGROUND_DANGER_STRONGER:lc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:cc,KUI_COLOR_BACKGROUND_DANGER_WEAK:uc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:dc,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:hc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:fc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:mc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:pc,KUI_COLOR_BACKGROUND_DISABLED:gc,KUI_COLOR_BACKGROUND_INFO:_c,KUI_COLOR_BACKGROUND_INFO_STRONG:yc,KUI_COLOR_BACKGROUND_INFO_STRONGER:Rc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:Cc,KUI_COLOR_BACKGROUND_INFO_WEAK:Ec,KUI_COLOR_BACKGROUND_INFO_WEAKER:Oc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:bc,KUI_COLOR_BACKGROUND_INVERSE:wc,KUI_COLOR_BACKGROUND_NEUTRAL:Tc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:vc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:Sc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:xc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Ic,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:Dc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:kc,KUI_COLOR_BACKGROUND_OVERLAY:Nc,KUI_COLOR_BACKGROUND_PRIMARY:Ac,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Lc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:Uc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Kc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Mc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Bc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:zc,KUI_COLOR_BACKGROUND_SUCCESS:Pc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:qc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Hc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:Gc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:$c,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:Fc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Wc,KUI_COLOR_BACKGROUND_TRANSPARENT:Vc,KUI_COLOR_BACKGROUND_WARNING:Yc,KUI_COLOR_BACKGROUND_WARNING_STRONG:Xc,KUI_COLOR_BACKGROUND_WARNING_STRONGER:jc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:Qc,KUI_COLOR_BACKGROUND_WARNING_WEAK:Zc,KUI_COLOR_BACKGROUND_WARNING_WEAKER:Jc,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:eu,KUI_COLOR_BORDER:tu,KUI_COLOR_BORDER_ACCENT:iu,KUI_COLOR_BORDER_DANGER:ru,KUI_COLOR_BORDER_DANGER_STRONG:nu,KUI_COLOR_BORDER_DANGER_STRONGER:su,KUI_COLOR_BORDER_DANGER_STRONGEST:ou,KUI_COLOR_BORDER_DANGER_WEAK:au,KUI_COLOR_BORDER_DANGER_WEAKER:lu,KUI_COLOR_BORDER_DANGER_WEAKEST:cu,KUI_COLOR_BORDER_DECORATIVE_PURPLE:uu,KUI_COLOR_BORDER_DISABLED:du,KUI_COLOR_BORDER_INVERSE:hu,KUI_COLOR_BORDER_NEUTRAL:fu,KUI_COLOR_BORDER_NEUTRAL_STRONG:mu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:pu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:gu,KUI_COLOR_BORDER_NEUTRAL_WEAK:_u,KUI_COLOR_BORDER_NEUTRAL_WEAKER:yu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:Ru,KUI_COLOR_BORDER_PRIMARY:Cu,KUI_COLOR_BORDER_PRIMARY_STRONG:Eu,KUI_COLOR_BORDER_PRIMARY_STRONGER:Ou,KUI_COLOR_BORDER_PRIMARY_STRONGEST:bu,KUI_COLOR_BORDER_PRIMARY_WEAK:wu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Tu,KUI_COLOR_BORDER_PRIMARY_WEAKEST:vu,KUI_COLOR_BORDER_TRANSPARENT:Su,KUI_COLOR_BRAND:xu,KUI_COLOR_TEXT:Iu,KUI_COLOR_TEXT_ACCENT:Du,KUI_COLOR_TEXT_DANGER:ku,KUI_COLOR_TEXT_DANGER_STRONG:Nu,KUI_COLOR_TEXT_DANGER_STRONGER:Au,KUI_COLOR_TEXT_DANGER_STRONGEST:Lu,KUI_COLOR_TEXT_DANGER_WEAK:Uu,KUI_COLOR_TEXT_DANGER_WEAKER:Ku,KUI_COLOR_TEXT_DANGER_WEAKEST:Mu,KUI_COLOR_TEXT_DECORATIVE_AQUA:Bu,KUI_COLOR_TEXT_DECORATIVE_PINK:zu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Pu,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:qu,KUI_COLOR_TEXT_DISABLED:Hu,KUI_COLOR_TEXT_INFO:Gu,KUI_COLOR_TEXT_INFO_STRONG:$u,KUI_COLOR_TEXT_INFO_STRONGER:Fu,KUI_COLOR_TEXT_INFO_STRONGEST:Wu,KUI_COLOR_TEXT_INFO_WEAK:Vu,KUI_COLOR_TEXT_INFO_WEAKER:Yu,KUI_COLOR_TEXT_INFO_WEAKEST:Xu,KUI_COLOR_TEXT_INVERSE:ju,KUI_COLOR_TEXT_NEUTRAL:Qu,KUI_COLOR_TEXT_NEUTRAL_STRONG:Zu,KUI_COLOR_TEXT_NEUTRAL_STRONGER:Ju,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:ed,KUI_COLOR_TEXT_NEUTRAL_WEAK:td,KUI_COLOR_TEXT_NEUTRAL_WEAKER:id,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:rd,KUI_COLOR_TEXT_PRIMARY:nd,KUI_COLOR_TEXT_PRIMARY_STRONG:sd,KUI_COLOR_TEXT_PRIMARY_STRONGER:od,KUI_COLOR_TEXT_PRIMARY_STRONGEST:ad,KUI_COLOR_TEXT_PRIMARY_WEAK:ld,KUI_COLOR_TEXT_PRIMARY_WEAKER:cd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:ud,KUI_COLOR_TEXT_SUCCESS:dd,KUI_COLOR_TEXT_SUCCESS_STRONG:hd,KUI_COLOR_TEXT_SUCCESS_STRONGER:fd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:md,KUI_COLOR_TEXT_SUCCESS_WEAK:pd,KUI_COLOR_TEXT_SUCCESS_WEAKER:gd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:_d,KUI_COLOR_TEXT_WARNING:yd,KUI_COLOR_TEXT_WARNING_STRONG:Rd,KUI_COLOR_TEXT_WARNING_STRONGER:Cd,KUI_COLOR_TEXT_WARNING_STRONGEST:Ed,KUI_COLOR_TEXT_WARNING_WEAK:Od,KUI_COLOR_TEXT_WARNING_WEAKER:bd,KUI_COLOR_TEXT_WARNING_WEAKEST:wd,KUI_FONT_FAMILY_CODE:Gd,KUI_FONT_FAMILY_HEADING:$d,KUI_FONT_FAMILY_TEXT:Xt,KUI_FONT_SIZE_10:Fd,KUI_FONT_SIZE_100:eh,KUI_FONT_SIZE_20:Wd,KUI_FONT_SIZE_30:Vd,KUI_FONT_SIZE_40:Yd,KUI_FONT_SIZE_50:Xd,KUI_FONT_SIZE_60:jd,KUI_FONT_SIZE_70:Qd,KUI_FONT_SIZE_80:Zd,KUI_FONT_SIZE_90:Jd,KUI_FONT_WEIGHT_BOLD:th,KUI_FONT_WEIGHT_MEDIUM:ih,KUI_FONT_WEIGHT_REGULAR:rh,KUI_FONT_WEIGHT_SEMIBOLD:nh,KUI_ICON_COLOR_DANGER:sh,KUI_ICON_COLOR_NEUTRAL:oh,KUI_ICON_COLOR_PRIMARY:ah,KUI_ICON_COLOR_SUCCESS:lh,KUI_ICON_COLOR_WARNING:ch,KUI_ICON_SIZE_10:uh,KUI_ICON_SIZE_20:dh,KUI_ICON_SIZE_30:hh,KUI_ICON_SIZE_40:fh,KUI_ICON_SIZE_50:mh,KUI_ICON_SIZE_60:ph,KUI_ICON_SIZE_70:gh,KUI_ICON_SIZE_80:_h,KUI_LETTER_SPACING_0:yh,KUI_LETTER_SPACING_MINUS_10:Rh,KUI_LETTER_SPACING_MINUS_20:Ch,KUI_LETTER_SPACING_MINUS_30:Eh,KUI_LETTER_SPACING_MINUS_40:Oh,KUI_LETTER_SPACING_MINUS_50:bh,KUI_LETTER_SPACING_NORMAL:wh,KUI_LINE_HEIGHT_10:Th,KUI_LINE_HEIGHT_100:Lh,KUI_LINE_HEIGHT_20:vh,KUI_LINE_HEIGHT_30:Sh,KUI_LINE_HEIGHT_40:xh,KUI_LINE_HEIGHT_50:Ih,KUI_LINE_HEIGHT_60:Dh,KUI_LINE_HEIGHT_70:kh,KUI_LINE_HEIGHT_80:Nh,KUI_LINE_HEIGHT_90:Ah,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Uh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Kh,KUI_METHOD_COLOR_BACKGROUND_GET:Mh,KUI_METHOD_COLOR_BACKGROUND_HEAD:Bh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:zh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Ph,KUI_METHOD_COLOR_BACKGROUND_POST:qh,KUI_METHOD_COLOR_BACKGROUND_PUT:Hh,KUI_METHOD_COLOR_BACKGROUND_TRACE:Gh,KUI_METHOD_COLOR_TEXT_CONNECT:$h,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:Fh,KUI_METHOD_COLOR_TEXT_DELETE:Wh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Vh,KUI_METHOD_COLOR_TEXT_GET:Yh,KUI_METHOD_COLOR_TEXT_GET_STRONG:Xh,KUI_METHOD_COLOR_TEXT_HEAD:jh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:Qh,KUI_METHOD_COLOR_TEXT_OPTIONS:Zh,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:Jh,KUI_METHOD_COLOR_TEXT_PATCH:ef,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:tf,KUI_METHOD_COLOR_TEXT_POST:rf,KUI_METHOD_COLOR_TEXT_POST_STRONG:nf,KUI_METHOD_COLOR_TEXT_PUT:sf,KUI_METHOD_COLOR_TEXT_PUT_STRONG:of,KUI_METHOD_COLOR_TEXT_TRACE:af,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:lf,KUI_NAVIGATION_COLOR_BACKGROUND:cf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:uf,KUI_NAVIGATION_COLOR_BORDER:df,KUI_NAVIGATION_COLOR_BORDER_CHILD:hf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:ff,KUI_NAVIGATION_COLOR_TEXT:mf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:pf,KUI_NAVIGATION_COLOR_TEXT_HOVER:gf,KUI_NAVIGATION_COLOR_TEXT_SELECTED:_f,KUI_NAVIGATION_SHADOW_BORDER:yf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:Rf,KUI_NAVIGATION_SHADOW_FOCUS:Cf,KUI_SHADOW:Ef,KUI_SHADOW_BORDER:Of,KUI_SHADOW_BORDER_DANGER:bf,KUI_SHADOW_BORDER_DANGER_STRONG:wf,KUI_SHADOW_BORDER_DISABLED:Tf,KUI_SHADOW_BORDER_PRIMARY:vf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:Sf,KUI_SHADOW_BORDER_PRIMARY_WEAK:xf,KUI_SHADOW_FOCUS:If,KUI_SPACE_0:Df,KUI_SPACE_10:kf,KUI_SPACE_100:Pf,KUI_SPACE_110:qf,KUI_SPACE_120:Hf,KUI_SPACE_130:Gf,KUI_SPACE_140:$f,KUI_SPACE_150:Ff,KUI_SPACE_20:Nf,KUI_SPACE_30:Af,KUI_SPACE_40:Lf,KUI_SPACE_50:Uf,KUI_SPACE_60:Kf,KUI_SPACE_70:Mf,KUI_SPACE_80:Bf,KUI_SPACE_90:zf,KUI_SPACE_AUTO:Wf,KUI_STATUS_COLOR_100:Vf,KUI_STATUS_COLOR_100S:op,KUI_STATUS_COLOR_101:Yf,KUI_STATUS_COLOR_102:Xf,KUI_STATUS_COLOR_103:jf,KUI_STATUS_COLOR_1NA:tp,KUI_STATUS_COLOR_200:Qf,KUI_STATUS_COLOR_200S:ap,KUI_STATUS_COLOR_201:Zf,KUI_STATUS_COLOR_202:Jf,KUI_STATUS_COLOR_203:em,KUI_STATUS_COLOR_204:tm,KUI_STATUS_COLOR_205:im,KUI_STATUS_COLOR_206:rm,KUI_STATUS_COLOR_207:nm,KUI_STATUS_COLOR_208:sm,KUI_STATUS_COLOR_226:om,KUI_STATUS_COLOR_2NA:ip,KUI_STATUS_COLOR_300:am,KUI_STATUS_COLOR_300S:lp,KUI_STATUS_COLOR_301:lm,KUI_STATUS_COLOR_302:cm,KUI_STATUS_COLOR_303:um,KUI_STATUS_COLOR_304:dm,KUI_STATUS_COLOR_305:hm,KUI_STATUS_COLOR_307:fm,KUI_STATUS_COLOR_308:mm,KUI_STATUS_COLOR_3NA:rp,KUI_STATUS_COLOR_400:pm,KUI_STATUS_COLOR_400S:cp,KUI_STATUS_COLOR_401:gm,KUI_STATUS_COLOR_402:_m,KUI_STATUS_COLOR_403:ym,KUI_STATUS_COLOR_404:Rm,KUI_STATUS_COLOR_405:Cm,KUI_STATUS_COLOR_406:Em,KUI_STATUS_COLOR_407:Om,KUI_STATUS_COLOR_408:bm,KUI_STATUS_COLOR_409:wm,KUI_STATUS_COLOR_410:Tm,KUI_STATUS_COLOR_411:vm,KUI_STATUS_COLOR_412:Sm,KUI_STATUS_COLOR_413:xm,KUI_STATUS_COLOR_414:Im,KUI_STATUS_COLOR_415:Dm,KUI_STATUS_COLOR_416:km,KUI_STATUS_COLOR_417:Nm,KUI_STATUS_COLOR_418:Am,KUI_STATUS_COLOR_421:Lm,KUI_STATUS_COLOR_422:Um,KUI_STATUS_COLOR_423:Km,KUI_STATUS_COLOR_424:Mm,KUI_STATUS_COLOR_425:Bm,KUI_STATUS_COLOR_426:zm,KUI_STATUS_COLOR_428:Pm,KUI_STATUS_COLOR_429:qm,KUI_STATUS_COLOR_431:Hm,KUI_STATUS_COLOR_451:Gm,KUI_STATUS_COLOR_4NA:np,KUI_STATUS_COLOR_500:$m,KUI_STATUS_COLOR_500S:up,KUI_STATUS_COLOR_501:Fm,KUI_STATUS_COLOR_502:Wm,KUI_STATUS_COLOR_503:Vm,KUI_STATUS_COLOR_504:Ym,KUI_STATUS_COLOR_505:Xm,KUI_STATUS_COLOR_506:jm,KUI_STATUS_COLOR_507:Qm,KUI_STATUS_COLOR_508:Zm,KUI_STATUS_COLOR_510:Jm,KUI_STATUS_COLOR_511:ep,KUI_STATUS_COLOR_5NA:sp,KUI_STATUS_COLOR_BACKGROUND_100:dp,KUI_STATUS_COLOR_BACKGROUND_200:hp,KUI_STATUS_COLOR_BACKGROUND_300:fp,KUI_STATUS_COLOR_BACKGROUND_400:mp,KUI_STATUS_COLOR_BACKGROUND_500:pp,KUI_STATUS_COLOR_TEXT_100:gp,KUI_STATUS_COLOR_TEXT_200:_p,KUI_STATUS_COLOR_TEXT_300:yp,KUI_STATUS_COLOR_TEXT_400:Rp,KUI_STATUS_COLOR_TEXT_500:Cp},Symbol.toStringTag,{value:"Module"})),Or=Object.keys(Er).filter(r=>r.startsWith("KUI_COLOR")),br=r=>Er[r],Ep=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(Ep(t),br(t))]))},jt=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},Op=()=>typeof window>"u"?Xt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Xt,bp=r=>{const e=Op(),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}}}},wp=r=>s.computed(()=>bp(r.value)),Tp={class:"kong-ui-public-echarts-tooltip"},vp={class:"tooltip-title"},Sp={class:"title"},xp={key:0,class:"subtitle"},Ip={class:"context"},Dp={class:"metric"},kp={class:"tooltip-rows"},Np={class:"display-value"},Ap=s.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Tp,[s.createElementVNode("div",vp,[s.createElementVNode("div",Sp,s.toDisplayString(r.title),1),r.context||r.metric?(s.openBlock(),s.createElementBlock("div",xp,[s.createElementVNode("div",Ip,s.toDisplayString(r.context),1),s.createElementVNode("div",Dp,s.toDisplayString(r.metric),1)])):s.createCommentVNode("",!0)]),s.createElementVNode("ul",kp,[(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",Np,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},Lp=Tr(Ap,[["__scopeId","data-v-ca633353"]]),Qt=r=>Array.isArray(r)?r:[r],vr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,Zt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Up=r=>Array.isArray(r)?r[r.length-1]:r,Kp=r=>{const e=Qt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>Zt(i,i.seriesName??"",Up(i.value)))}},Mp=r=>{let e;return s.getCurrentScope()&&s.onScopeDispose(()=>{e&&s.render(null,e)}),t=>{const i=(r()??Kp)(t);return i?(e??=document.createElement("div"),s.render(s.h(Lp,i),e),e):""}},Bp={class:"kong-ui-public-echarts"},zp=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=jt(),t=wp(e),i=Mp(()=>r.tooltipContent),n=s.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(s.openBlock(),s.createElementBlock("div",Bp,[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(zp,[["__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},Pp=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([oi.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=jt(),t=a=>{const[l]=Qt(a),[d,c,u]=l.value;return{title:r.tooltipTitle,context:vr(d,r.xAxisLabels),metric:r.seriesName,rows:[Zt(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"]))}}),qp=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([oi.TreemapChart]);const e=jt(),t=l=>{const[d]=Qt(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:[Zt(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
- ${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},Hp=(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},Gp=(r,e,t)=>{const i=[];for(let n=r;n<e;n+=t)i.push(n);return i},$p=(r,e,t)=>{const i=o=>ra(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}))},Fp=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},Wp=(r,e)=>r[e]?.name??e,Vp=(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=Hp(new Date(n).getTime(),c,f.map(({timestamp:T})=>new Date(T).getTime())),_=Gp(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,Fp(O,String(k[d])),b])}return{data:C,xAxisLabels:$p(_,u,h),yAxisLabels:O.map(T=>Wp(t[d],T))}},Yp={class:"wrapper","data-testid":"heatmap-chart"},Xp=10,jp=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=Vp(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",Yp,[d(f)?(s.openBlock(),s.createBlock(s.unref(Pp),s.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":Xp},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)}),Qp=(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},Jt=(r,e)=>!e.includes("time")&&(!r||Q.isMetricSupported("treemap",r)),Nr=(r,e)=>{r.value=Number(r.value??0)+e},Zp=(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:Qp(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(!Jt(n,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...Zp(r.data,n,t,o,e).values()].map(({node:l,children:d})=>d.size?{...l,children:[...d.values()]}:l)},eg={class:"wrapper","data-testid":"treemap-chart"},tg=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(()=>Jt(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",eg,[a.value?c(m)?(s.openBlock(),s.createBlock(s.unref(qp),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"]]),ig=["data-testid"],rg={key:0,class:"tile-header"},ng={class:"badge-container"},sg={class:"badge-text"},og={class:"badge-text"},ag={key:0,class:"metric-selector-wrapper"},lg={key:1},cg=["data-testid"],ug=["data-testid"],dg=["data-testid"],hg={class:"delete-option"},fg=["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(()=>kg)),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)||Pt(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:$,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:jp,treemap:tg,timeseries_line:ur,timeseries_bar:ur,scatter:al,horizontal_bar:cr,vertical_bar:cr,gauge:lr,donut:rc,golden_signals:ll,top_n:Ql,top_talkers:Zl,table:ic,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",$e=!!L?.emits?.includes("loading-change"),ii={query:r.definition.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:o.value,zoomConfiguration:n.value},ri={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:{...ii,...ee?{}:ri,...r.definition.chart.type==="top_n"?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:$e}}}),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 Gt(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),F=s.computed(()=>ue.value.map(L=>({value:L,label:Re(L)?m.t(`chartLabels.${L}`):L}))),oe=s.computed(()=>{if(!qt(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=qt(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(Pt(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:$(M(L,ee))}:void 0};return e({getExportData:je}),(L,ee)=>{const me=s.resolveComponent("KTooltip"),Ge=s.resolveComponent("KBadge"),ze=s.resolveComponent("KButton"),$e=s.resolveComponent("KDropdownItem"),ii=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",rg,[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",ng,[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",sg,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",og,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",ag,[s.createVNode(s.unref(Pr.KSegmentedControl),{modelValue:J.value,"onUpdate:modelValue":ee[0]||(ee[0]=ri=>J.value=ri),class:"metric-selector","data-testid":"metric-selector",options:F.value},null,8,["modelValue","options"])])):s.createCommentVNode("",!0),r.showRefresh?(s.openBlock(),s.createElementBlock("div",lg,[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,cg)):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(Ut)})`,"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(ii,{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($e,{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($e,{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($e,{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,dg)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),r.context.editable?(s.openBlock(),s.createBlock($e,{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($e,{key:4,"data-testid":`remove-tile-${r.tileId}`,onClick:fe},{default:s.withCtx(()=>[s.createElementVNode("span",hg,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(Ut)})`,"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,ug)):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,fg)],10,ig)}}}),[["__scopeId","data-v-a062c19f"]]),mg=(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(()=>mg(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 pg(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&&gt(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 ei{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 ei{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 gg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ot extends ei{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(gg)||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 _g extends ei{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 ti{static init(e){return e.ddElement||(e.ddElement=new ti(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 _g(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class yg{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?ti.init(a):null)).filter(a=>a):[]}}const _e=new yg;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
- 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
- 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 pg(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 Rg=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],Cg={class:"grid-stack-item-content"},Eg=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",Cg,[s.renderSlot(m.$slots,"tile",{fitToContent:!1,tile:O},void 0,!0)])],8,Rg))),128))],512))}}),[["__scopeId","data-v-a060e0c5"]]),Og=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}},bg={key:0,class:"fullscreen-header"},wg={key:0,class:"tile-container slottable-tile"},Tg=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=Os();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=Na(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=Og(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:$,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",bg,[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?Eg: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",wg,[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($),"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"]]),vg=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)}}}),Sg=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},xg=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}}},Ig=(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},Dg=(r,e)=>{if(e){const n=r.tiles.map(xg);return{...r,tiles:n}}const t=r.tiles.map(Sg).filter(n=>n!==void 0),i=Ig(t,r.columns);return{...r,tiles:i}},kg=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?ai.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(ai.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=$i,W.CsvExportModal=sr,W.DASHBOARD_COLS=mt,W.DEFAULT_TILE_HEIGHT=Ye,W.DEFAULT_TILE_REFRESH_INTERVAL_MS=Wi,W.DashboardRenderer=Tg,W.DashboardTilePreview=vg,W.ENTITY_ID_TOKEN=Mt,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=Fi,W.configureAllowedDefinition=Dg,W.getTimeRangeDurationMs=Ht,W.isTimeRangeUnsupported=Gt,W.isTreemapCompatible=Jt,W.limitTimeRange=$t,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(W,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong/icons"),require("@kong-ui-public/analytics-chart"),require("swrv"),require("@kong-ui-public/analytics-metric-provider"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong/kongponents"),require("vue-echarts"),require("echarts/core"),require("echarts/renderers"),require("echarts/components"),require("echarts/charts"),require("axios"),require("@kong-ui-public/analytics-geo-map")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/analytics-utilities","@kong/icons","@kong-ui-public/analytics-chart","swrv","@kong-ui-public/analytics-metric-provider","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong/kongponents","vue-echarts","echarts/core","echarts/renderers","echarts/components","echarts/charts","axios","@kong-ui-public/analytics-geo-map"],s):(W=typeof globalThis<"u"?globalThis:W||self,s(W["kong-ui-public-dashboard-renderer"]={},W.Vue,W["kong-ui-public-analytics-utilities"],W.KongIcons,W["kong-ui-public-analytics-chart"],W.swrv,W["kong-ui-public-analytics-metric-provider"],W.AgGridVue,W.agGridCommunity,W["kong-ui-public-i18n"],W["kong-ui-public-analytics-config-store"],W.Kongponents,W.VueECharts,W.echarts,W.echarts,W.echarts,W.echarts,W.axios,W["kong-ui-public-analytics-geo-map"]))})(this,(function(W,s,Z,re,we,ni,si,zr,Qe,at,Te,Pr,qr,wt,Hr,lt,oi,Lg,ai){"use strict";const Gr=r=>{const e=r.length;let t=5381;for(let i=0;i<e;i++)t=t*33^r.charCodeAt(i);return t>>>0},Fr="#0044f4",li="#6c7489",$r="#d60027",Wr="#ffc400",Vr="#bee2ff",Yr="#8fc1ff",Xr="#5f9aff",jr="#306fff",Qr="#b5ffee",Zr="#00fabe",Jr="#00d6a4",en="#00a17b",tn="#007d60",rn="#005944",nn="#b5ffee",sn="#00fabe",on="#b5ffee",an="#00a17b",ln="#fff296",cn="#ffe04b",un="#ffc400",dn="#b37600",hn="#995c00",fn="#804400",mn="#fff296",pn="#ffe04b",gn="#ffc2b3",_n="#ff9877",yn="#ff723c",Rn="#f75008",Cn="#d13500",En="#a31f00",On="#ffc2b3",bn="#ff9877",wn="#ff723c",Tn="#f75008",vn="#d13500",Sn="#a31f00",xn="#ffc2b3",In="#ff9877",Dn="#ff723c",kn="#f75008",Nn="#d13500",An="#a31f00",Ln="#ffc2b3",Un="#ff9877",Kn="#ff723c",Mn="#f75008",Bn="#d13500",zn="#a31f00",Pn="#ffc2b3",qn="#ff9877",Hn="#ff723c",Gn="#f75008",Fn="#d13500",$n="#ffabab",Wn="#ff7272",Vn="#ff3954",Yn="#f50045",Xn="#d60027",jn="#ad000e",Qn="#ffabab",Zn="#ff7272",Jn="#ff3954",es="#f50045",ts="#d60027",is="#eefaff",rs="#ecfffb",ns="#fffce0",ss="#fff1ef",os="#ffe5e5",as="#5f9aff",ls="#00d6a4",cs="#ffc400",us="#ff723c",ds="#ff3954",hs={100:Vr,101:Yr,102:Xr,103:jr,200:Qr,201:Zr,202:Jr,203:en,204:tn,205:rn,206:nn,207:sn,208:on,226:an,300:ln,301:cn,302:un,303:dn,304:hn,305:fn,307:mn,308:pn,400:gn,401:_n,402:yn,403:Rn,404:Cn,405:En,406:On,407:bn,408:wn,409:Tn,410:vn,411:Sn,412:xn,413:In,414:Dn,415:kn,416:Nn,417:An,418:Ln,421:Un,422:Kn,423:Mn,424:Bn,425:zn,426:Pn,428:qn,429:Hn,431:Gn,451:Fn,500:$n,501:Wn,502:Vn,503:Yn,504:Xn,505:jn,506:Qn,507:Zn,508:Jn,510:es,511:ts},fs={100:is,200:rs,300:ns,400:ss,500:os},ci={"1XX":as,"2XX":ls,"3XX":cs,"4XX":us,"5XX":ds},ms={error:$r,warning:Wr,empty:"#9DA99D",neutral:li,____OTHER____:Fr},Tt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],vt=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],ps=r=>Gr(r),gs=({theme:r="light"}={})=>r==="dark"?vt:Tt,ui=({discriminator:r,theme:e="light"})=>{const t=Math.abs(Math.floor(r));return e==="dark"?vt[t%vt.length]:Tt[t%Tt.length]},Ze=({state:r})=>ms[r]??li,_s=({statusCode:r})=>{const e=typeof r=="number"?r:Number.parseInt(r,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return hs[t]??fs[i]??Ze({state:"neutral"})},ys=({group:r})=>ci[r]?ci[r]:Ze({state:"neutral"}),Rs=({discriminator:r=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:n=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:l=void 0,customDimensionColors:u=void 0})=>{let c="light";if(s.hasInjectionContext()&&(c=s.inject("app:konnectColorMode",s.computed(()=>"light")).value),e!==void 0)return Ze({state:e});if(i!==void 0&&u!==void 0&&u[i])return u[i];if(i&&["empty","____OTHER____"].includes(i))return Ze({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return _s({statusCode:i});if(t==="status_code_grouped")return ys({group:i})}if(r!==void 0)return ui({discriminator:r,theme:c});if(t||i||n){const d=`${t??""}${i??""}${n??""}`,h=o?o.resolveDiscriminator({name:d,order:a,chartUuid:l,theme:c}):ps(d);return ui({discriminator:h,theme:c})}return Ze({state:"neutral"})},Cs="__no_chart__";function Es(){const r=new Map,e=new Map,t=new Map,i=o=>{e.set(o,(e.get(o)??0)+1)},n=(o,a)=>{let l=-1,u=1/0;for(let c=0;c<o;c++){if(a.has(c))continue;const d=e.get(c)??0;d<u&&(l=c,u=d)}return l!==-1?l:o<1?0:n(o,new Set)};return{resolveDiscriminator:({name:o,order:a,chartUuid:l,theme:u})=>{const c=l??Cs,d=a??null,h=gs({theme:u});let f;if(r.has(o))f=r.get(o);else{const m=new Set,R=t.get(c);d!==null&&R?.order!==null&&R?.order!==void 0&&d===R.order+1&&m.add(R.index);const E=h.length;f=n(E,m),r.set(o,f),i(f)}return t.set(c,{order:d,index:f}),f},reset:()=>{r.clear(),e.clear(),t.clear()}}}function Os(){const r=s.ref(null),e=s.ref(null),t=s.ref(null),i=s.ref(null),n=s.ref(null),o=300,a=300,l=10,u=Es(),c=({chartUuid:h,timestamp:f=null,dimension:m=null,dimensionValue:R=null,metric:E=null})=>{r.value=h,e.value=f,t.value=m,i.value=R,n.value=E},d=({chartUuid:h})=>{r.value===h&&(r.value=null,e.value=null,t.value=null,i.value=null,n.value=null)};return{activate:c,activeChart:s.readonly(r),activeDimension:s.readonly(t),activeDimensionValue:s.readonly(i),activeMetric:s.readonly(n),activeTimestamp:s.readonly(e),deactivate:d,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l,color:u}}const bs={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ws=(r,e,t)=>{let i;const n=bs[r];return typeof n=="string"?i=n:e===1?i=n.one:i=n.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function St(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const Ts={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vs={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ss={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},xs={date:St({formats:Ts,defaultWidth:"full"}),time:St({formats:vs,defaultWidth:"full"}),dateTime:St({formats:Ss,defaultWidth:"full"})},Is={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ds=(r,e,t,i)=>Is[r];function Je(r){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let n;if(i==="formatting"&&r.formattingValues){const a=r.defaultFormattingWidth||r.defaultWidth,l=t?.width?String(t.width):a;n=r.formattingValues[l]||r.formattingValues[a]}else{const a=r.defaultWidth,l=t?.width?String(t.width):r.defaultWidth;n=r.values[l]||r.values[a]}const o=r.argumentCallback?r.argumentCallback(e):e;return n[o]}}const ks={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ns={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},As={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ls={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Us={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Ks={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ms={ordinalNumber:(r,e)=>{const t=Number(r),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:Je({values:ks,defaultWidth:"wide"}),quarter:Je({values:Ns,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Je({values:As,defaultWidth:"wide"}),day:Je({values:Ls,defaultWidth:"wide"}),dayPeriod:Je({values:Us,defaultWidth:"wide",formattingValues:Ks,defaultFormattingWidth:"wide"})};function et(r){return(e,t={})=>{const i=t.width,n=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],o=e.match(n);if(!o)return null;const a=o[0],l=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],u=Array.isArray(l)?zs(l,h=>h.test(a)):Bs(l,h=>h.test(a));let c;c=r.valueCallback?r.valueCallback(u):u,c=t.valueCallback?t.valueCallback(c):c;const d=e.slice(a.length);return{value:c,rest:d}}}function Bs(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function zs(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Ps(r){return(e,t={})=>{const i=e.match(r.matchPattern);if(!i)return null;const n=i[0],o=e.match(r.parsePattern);if(!o)return null;let a=r.valueCallback?r.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(n.length);return{value:a,rest:l}}}const qs=/^(\d+)(th|st|nd|rd)?/i,Hs=/\d+/i,Gs={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Fs={any:[/^b/i,/^(a|c)/i]},$s={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ws={any:[/1/i,/2/i,/3/i,/4/i]},Vs={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Ys={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Xs={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},js={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Qs={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Zs={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Js={ordinalNumber:Ps({matchPattern:qs,parsePattern:Hs,valueCallback:r=>parseInt(r,10)}),era:et({matchPatterns:Gs,defaultMatchWidth:"wide",parsePatterns:Fs,defaultParseWidth:"any"}),quarter:et({matchPatterns:$s,defaultMatchWidth:"wide",parsePatterns:Ws,defaultParseWidth:"any",valueCallback:r=>r+1}),month:et({matchPatterns:Vs,defaultMatchWidth:"wide",parsePatterns:Ys,defaultParseWidth:"any"}),day:et({matchPatterns:Xs,defaultMatchWidth:"wide",parsePatterns:js,defaultParseWidth:"any"}),dayPeriod:et({matchPatterns:Qs,defaultMatchWidth:"any",parsePatterns:Zs,defaultParseWidth:"any"})},eo={code:"en-US",formatDistance:ws,formatLong:xs,formatRelative:Ds,localize:Ms,match:Js,options:{weekStartsOn:0,firstWeekContainsDate:1}};let to={};function tt(){return to}const di=6048e5,io=864e5,hi=Symbol.for("constructDateFrom");function Le(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&hi in r?r[hi](e):r instanceof Date?new r.constructor(e):new Date(e)}function ve(r,e){return Le(e||r,r)}function fi(r){const e=ve(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function ro(r,...e){const t=Le.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function mi(r,e){const t=ve(r,e?.in);return t.setHours(0,0,0,0),t}function no(r,e,t){const[i,n]=ro(t?.in,r,e),o=mi(i),a=mi(n),l=+o-fi(o),u=+a-fi(a);return Math.round((l-u)/io)}function so(r,e){const t=ve(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function oo(r,e){const t=ve(r,e?.in);return no(t,so(t))+1}function it(r,e){const t=tt(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=ve(r,e?.in),o=n.getDay(),a=(o<i?7:0)+o-i;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}function ct(r,e){return it(r,{...e,weekStartsOn:1})}function pi(r,e){const t=ve(r,e?.in),i=t.getFullYear(),n=Le(t,0);n.setFullYear(i+1,0,4),n.setHours(0,0,0,0);const o=ct(n),a=Le(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=ct(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function ao(r,e){const t=pi(r,e),i=Le(r,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),ct(i)}function lo(r,e){const t=ve(r,e?.in),i=+ct(t)-+ao(t);return Math.round(i/di)+1}function gi(r,e){const t=ve(r,e?.in),i=t.getFullYear(),n=tt(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=Le(e?.in||r,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=it(a,e),u=Le(e?.in||r,0);u.setFullYear(i,0,o),u.setHours(0,0,0,0);const c=it(u,e);return+t>=+l?i+1:+t>=+c?i:i-1}function co(r,e){const t=tt(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=gi(r,e),o=Le(e?.in||r,0);return o.setFullYear(n,0,i),o.setHours(0,0,0,0),it(o,e)}function uo(r,e){const t=ve(r,e?.in),i=+it(t,e)-+co(t,e);return Math.round(i/di)+1}function se(r,e){const t=r<0?"-":"",i=Math.abs(r).toString().padStart(e,"0");return t+i}const Ue={y(r,e){const t=r.getFullYear(),i=t>0?t:1-t;return se(e==="yy"?i%100:i,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):se(t+1,2)},d(r,e){return se(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(r,e){return se(r.getHours()%12||12,e.length)},H(r,e){return se(r.getHours(),e.length)},m(r,e){return se(r.getMinutes(),e.length)},s(r,e){return se(r.getSeconds(),e.length)},S(r,e){const t=e.length,i=r.getMilliseconds(),n=Math.trunc(i*Math.pow(10,t-3));return se(n,e.length)}},$e={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},_i={G:function(r,e,t){const i=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});default:return t.era(i,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const i=r.getFullYear(),n=i>0?i:1-i;return t.ordinalNumber(n,{unit:"year"})}return Ue.y(r,e)},Y:function(r,e,t,i){const n=gi(r,i),o=n>0?n:1-n;if(e==="YY"){const a=o%100;return se(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):se(o,e.length)},R:function(r,e){const t=pi(r);return se(t,e.length)},u:function(r,e){const t=r.getFullYear();return se(t,e.length)},Q:function(r,e,t){const i=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return se(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(r,e,t){const i=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return se(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(r,e,t){const i=r.getMonth();switch(e){case"M":case"MM":return Ue.M(r,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(r,e,t){const i=r.getMonth();switch(e){case"L":return String(i+1);case"LL":return se(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(r,e,t,i){const n=uo(r,i);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):se(n,e.length)},I:function(r,e,t){const i=lo(r);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):se(i,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Ue.d(r,e)},D:function(r,e,t){const i=oo(r);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):se(i,e.length)},E:function(r,e,t){const i=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(r,e,t,i){const n=r.getDay(),o=(n-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return se(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},c:function(r,e,t,i){const n=r.getDay(),o=(n-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return se(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},i:function(r,e,t){const i=r.getDay(),n=i===0?7:i;switch(e){case"i":return String(n);case"ii":return se(n,e.length);case"io":return t.ordinalNumber(n,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(r,e,t){const n=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(r,e,t){const i=r.getHours();let n;switch(i===12?n=$e.noon:i===0?n=$e.midnight:n=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(r,e,t){const i=r.getHours();let n;switch(i>=17?n=$e.evening:i>=12?n=$e.afternoon:i>=4?n=$e.morning:n=$e.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let i=r.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return Ue.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Ue.H(r,e)},K:function(r,e,t){const i=r.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):se(i,e.length)},k:function(r,e,t){let i=r.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):se(i,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ue.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Ue.s(r,e)},S:function(r,e){return Ue.S(r,e)},X:function(r,e,t){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Ri(i);case"XXXX":case"XX":return Pe(i);default:return Pe(i,":")}},x:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"x":return Ri(i);case"xxxx":case"xx":return Pe(i);default:return Pe(i,":")}},O:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+yi(i,":");default:return"GMT"+Pe(i,":")}},z:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+yi(i,":");default:return"GMT"+Pe(i,":")}},t:function(r,e,t){const i=Math.trunc(+r/1e3);return se(i,e.length)},T:function(r,e,t){return se(+r,e.length)}};function yi(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=Math.trunc(i/60),o=i%60;return o===0?t+String(n):t+String(n)+e+se(o,2)}function Ri(r,e){return r%60===0?(r>0?"-":"+")+se(Math.abs(r)/60,2):Pe(r,e)}function Pe(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=se(Math.trunc(i/60),2),o=se(i%60,2);return t+n+e+o}const Ci=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Ei=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},ho={p:Ei,P:(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],i=t[1],n=t[2];if(!n)return Ci(r,e);let o;switch(i){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",Ci(i,e)).replace("{{time}}",Ei(n,e))}},fo=/^D+$/,mo=/^Y+$/,po=["D","DD","YY","YYYY"];function go(r){return fo.test(r)}function _o(r){return mo.test(r)}function yo(r,e,t){const i=Ro(r,e,t);if(console.warn(i),po.includes(r))throw new RangeError(i)}function Ro(r,e,t){const i=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Co(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function Eo(r){return!(!Co(r)&&typeof r!="number"||isNaN(+ve(r)))}const Oo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,wo=/^'([^]*?)'?$/,To=/''/g,vo=/[a-zA-Z]/;function So(r,e,t){const i=tt(),n=t?.locale??i.locale??eo,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,l=ve(r,t?.in);if(!Eo(l))throw new RangeError("Invalid time value");let u=e.match(bo).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=ho[h];return f(d,n.formatLong)}return d}).join("").match(Oo).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:xo(d)};if(_i[h])return{isToken:!0,value:d};if(h.match(vo))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});n.localize.preprocessor&&(u=n.localize.preprocessor(l,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:n};return u.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!t?.useAdditionalWeekYearTokens&&_o(h)||!t?.useAdditionalDayOfYearTokens&&go(h))&&yo(h,e,String(r));const f=_i[h[0]];return f(l,h,n.localize,c)}).join("")}function xo(r){const e=r.match(wo);return e?e[1].replace(To,"'"):r}function Io(){return Object.assign({},tt())}function Oi(r,e,t){const i=Io(),n=No(r,t.timeZone,t.locale??i.locale);return"formatToParts"in n?Do(n,e):ko(n,e)}function Do(r,e){const t=r.formatToParts(e);for(let i=t.length-1;i>=0;--i)if(t[i].type==="timeZoneName")return t[i].value}function ko(r,e){const t=r.format(e).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(t);return i?i[0].substr(1):""}function No(r,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:r})}function Ao(r,e){const t=Bo(e);return"formatToParts"in t?Uo(t,r):Ko(t,r)}const Lo={year:0,month:1,day:2,hour:3,minute:4,second:5};function Uo(r,e){try{const t=r.formatToParts(e),i=[];for(let n=0;n<t.length;n++){const o=Lo[t[n].type];o!==void 0&&(i[o]=parseInt(t[n].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Ko(r,e){const t=r.format(e),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const xt={},bi=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),Mo=bi==="06/25/2014, 00:00:00"||bi==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function Bo(r){return xt[r]||(xt[r]=Mo?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:r,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),xt[r]}function wi(r,e,t,i,n,o,a){const l=new Date(0);return l.setUTCFullYear(r,e,t),l.setUTCHours(i,n,o,a),l}const Ti=36e5,zo=6e4,It={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Dt(r,e,t){if(!r)return 0;let i=It.timezoneZ.exec(r);if(i)return 0;let n,o;if(i=It.timezoneHH.exec(r),i)return n=parseInt(i[1],10),vi(n)?-(n*Ti):NaN;if(i=It.timezoneHHMM.exec(r),i){n=parseInt(i[2],10);const a=parseInt(i[3],10);return vi(n,a)?(o=Math.abs(n)*Ti+a*zo,i[1]==="+"?-o:o):NaN}if(Ho(r)){e=new Date(e||Date.now());const a=t?e:Po(e),l=kt(a,r);return-(t?l:qo(e,l,r))}return NaN}function Po(r){return wi(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())}function kt(r,e){const t=Ao(r,e),i=wi(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let n=r.getTime();const o=n%1e3;return n-=o>=0?o:1e3+o,i-n}function qo(r,e,t){let n=r.getTime()-e;const o=kt(new Date(n),t);if(e===o)return e;n-=o-e;const a=kt(new Date(n),t);return o===a?o:Math.max(o,a)}function vi(r,e){return-23<=r&&r<=23&&(e==null||0<=e&&e<=59)}const Si={};function Ho(r){if(Si[r])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:r}),Si[r]=!0,!0}catch{return!1}}const Go=60*1e3,Fo={X:function(r,e,t){const i=Nt(t.timeZone,r);if(i===0)return"Z";switch(e){case"X":return xi(i);case"XXXX":case"XX":return We(i);default:return We(i,":")}},x:function(r,e,t){const i=Nt(t.timeZone,r);switch(e){case"x":return xi(i);case"xxxx":case"xx":return We(i);default:return We(i,":")}},O:function(r,e,t){const i=Nt(t.timeZone,r);switch(e){case"O":case"OO":case"OOO":return"GMT"+$o(i,":");default:return"GMT"+We(i,":")}},z:function(r,e,t){switch(e){case"z":case"zz":case"zzz":return Oi("short",r,t);default:return Oi("long",r,t)}}};function Nt(r,e){const t=r?Dt(r,e,!0)/Go:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+r);return t}function ut(r,e){const t=r<0?"-":"";let i=Math.abs(r).toString();for(;i.length<e;)i="0"+i;return t+i}function We(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=ut(Math.floor(i/60),2),o=ut(Math.floor(i%60),2);return t+n+e+o}function xi(r,e){return r%60===0?(r>0?"-":"+")+ut(Math.abs(r)/60,2):We(r,e)}function $o(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=Math.floor(i/60),o=i%60;return o===0?t+String(n):t+String(n)+e+ut(o,2)}function Ii(r){const e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return e.setUTCFullYear(r.getFullYear()),+r-+e}const Wo=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,At=36e5,Di=6e4,Vo=2,pe={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Wo};function ki(r,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(r===null)return new Date(NaN);const t=e.additionalDigits==null?Vo:Number(e.additionalDigits);if(t!==2&&t!==1&&t!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]")return new Date(r.getTime());if(typeof r=="number"||Object.prototype.toString.call(r)==="[object Number]")return new Date(r);if(Object.prototype.toString.call(r)!=="[object String]")return new Date(NaN);const i=Yo(r),{year:n,restDateString:o}=Xo(i.date,t),a=jo(o,n);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let u=0,c;if(i.time&&(u=Qo(i.time),u===null||isNaN(u)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=Dt(i.timeZone||e.timeZone,new Date(l+u)),isNaN(c))return new Date(NaN)}else c=Ii(new Date(l+u)),c=Ii(new Date(l+u+c));return new Date(l+u+c)}else return new Date(NaN)}function Yo(r){const e={};let t=pe.dateTimePattern.exec(r),i;if(t?(e.date=t[1],i=t[3]):(t=pe.datePattern.exec(r),t?(e.date=t[1],i=t[2]):(e.date=null,i=r)),i){const n=pe.timeZone.exec(i);n?(e.time=i.replace(n[1],""),e.timeZone=n[1].trim()):e.time=i}return e}function Xo(r,e){if(r){const t=pe.YYY[e],i=pe.YYYYY[e];let n=pe.YYYY.exec(r)||i.exec(r);if(n){const o=n[1];return{year:parseInt(o,10),restDateString:r.slice(o.length)}}if(n=pe.YY.exec(r)||t.exec(r),n){const o=n[1];return{year:parseInt(o,10)*100,restDateString:r.slice(o.length)}}}return{year:null}}function jo(r,e){if(e===null)return null;let t,i,n;if(!r||!r.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=pe.MM.exec(r);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Li(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=pe.DDD.exec(r),o){t=new Date(0);const a=parseInt(o[1],10);return ea(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=pe.MMDD.exec(r),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Li(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=pe.Www.exec(r),o)return n=parseInt(o[1],10)-1,Ui(n)?Ni(e,n):new Date(NaN);if(o=pe.WwwD.exec(r),o){n=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Ui(n,a)?Ni(e,n,a):new Date(NaN)}return null}function Qo(r){let e,t,i=pe.HH.exec(r);if(i)return e=parseFloat(i[1].replace(",",".")),Lt(e)?e%24*At:NaN;if(i=pe.HHMM.exec(r),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),Lt(e,t)?e%24*At+t*Di:NaN;if(i=pe.HHMMSS.exec(r),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const n=parseFloat(i[3].replace(",","."));return Lt(e,t,n)?e%24*At+t*Di+n*1e3:NaN}return null}function Ni(r,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(r,0,4);const n=i.getUTCDay()||7,o=e*7+t+1-n;return i.setUTCDate(i.getUTCDate()+o),i}const Zo=[31,28,31,30,31,30,31,31,30,31,30,31],Jo=[31,29,31,30,31,30,31,31,30,31,30,31];function Ai(r){return r%400===0||r%4===0&&r%100!==0}function Li(r,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=Ai(r);if(i&&t>Jo[e]||!i&&t>Zo[e])return!1}return!0}function ea(r,e){if(e<1)return!1;const t=Ai(r);return!(t&&e>366||!t&&e>365)}function Ui(r,e){return!(r<0||r>52||e!=null&&(e<0||e>6))}function Lt(r,e,t){return!(r<0||r>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const ta=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Ut(r,e,t={}){e=String(e);const i=e.match(ta);if(i){const n=ki(t.originalDate||r,t);e=i.reduce(function(o,a){if(a[0]==="'")return o;const l=o.indexOf(a),u=o[l-1]==="'",c=o.replace(a,"'"+Fo[a[0]](n,a,t)+"'");return u?c.substring(0,l-1)+c.substring(l+1):c},e)}return So(r,e,t)}function ia(r,e,t){r=ki(r,t);const i=Dt(e,r,!0),n=new Date(r.getTime()-i),o=new Date(0);return o.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),o.setHours(n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()),o}function ra(r,e,t,i){return i={...i,timeZone:e,originalDate:r},Ut(ia(r,e,{timeZone:i.timeZone}),t,i)}const Kt="#6c7489",Ki="12px",na="16px",Mi="20px",Bi="32px",zi="20px";var dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ht={exports:{}},oa=ht.exports,Pi;function aa(){return Pi||(Pi=1,(function(r,e){(function(t,i){i()})(oa,function(){function t(c,d){return typeof d>"u"?d={autoBom:!1}:typeof d!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),d={autoBom:!d}),d.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,d,h){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){u(f.response,d,h)},f.onerror=function(){console.error("could not download file")},f.send()}function n(c){var d=new XMLHttpRequest;d.open("HEAD",c,!1);try{d.send()}catch{}return 200<=d.status&&299>=d.status}function o(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(d)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof dt=="object"&&dt.global===dt?dt:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,d,h){var f=a.URL||a.webkitURL,m=document.createElement("a");d=d||c.name||"download",m.download=d,m.rel="noopener",typeof c=="string"?(m.href=c,m.origin===location.origin?o(m):n(m.href)?i(c,d,h):o(m,m.target="_blank")):(m.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(m.href)},4e4),setTimeout(function(){o(m)},0))}:"msSaveOrOpenBlob"in navigator?function(c,d,h){if(d=d||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,h),d);else if(n(c))i(c,d,h);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){o(f)})}}:function(c,d,h,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return i(c,d,h);var m=c.type==="application/octet-stream",R=/constructor/i.test(a.HTMLElement)||a.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||m&&R||l)&&typeof FileReader<"u"){var C=new FileReader;C.onloadend=function(){var w=C.result;w=E?w:w.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=w:location=w,f=null},C.readAsDataURL(c)}else{var x=a.URL||a.webkitURL,I=x.createObjectURL(c);f?f.location=I:location.href=I,f=null,setTimeout(function(){x.revokeObjectURL(I)},4e4)}});a.saveAs=u.saveAs=u,r.exports=u})})(ht)),ht.exports}var la=aa(),ft={exports:{}};var ca=ft.exports,qi;function ua(){return qi||(qi=1,(function(r,e){((t,i)=>{r.exports=i()})(ca,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},n=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,u={};function c(p){return p.charCodeAt(0)===65279?p.slice(1):p}function d(p){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(g){var _=v(g);_.chunkSize=parseInt(_.chunkSize),g.step||g.chunk||(_.chunkSize=null),this._handle=new E(_),(this._handle.streamer=this)._config=_}).call(this,p),this.parseChunk=function(g,_){var T=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<T){let L=this._config.newline;L||(S=this._config.quoteChar||'"',L=this._handle.guessLineEndings(g,S)),g=[...g.split(L).slice(T)].join(L)}this.isFirstChunk&&A(this._config.beforeFirstChunk)&&(S=this._config.beforeFirstChunk(g))!==void 0&&(g=S),this.isFirstChunk=!1,this._halted=!1;var T=this._partialLine+g,S=(this._partialLine="",this._handle.parse(T,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(g=S.meta.cursor,T=(this._finished||(this._partialLine=T.substring(g-this._baseIndex),this._baseIndex=g),S&&S.data&&(this._rowCount+=S.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:S,workerId:u.WORKER_ID,finished:T});else if(A(this._config.chunk)&&!_){if(this._config.chunk(S,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=S=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(S.data),this._completeResults.errors=this._completeResults.errors.concat(S.errors),this._completeResults.meta=S.meta),this._completed||!T||!A(this._config.complete)||S&&S.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),T||S&&S.meta.paused||this._nextChunk(),S}this._halted=!0},this._sendError=function(g){A(this._config.error)?this._config.error(g):o&&this._config.error&&i.postMessage({workerId:u.WORKER_ID,error:g,finished:!1})}}function h(p){var g;(p=p||{}).chunkSize||(p.chunkSize=u.RemoteChunkSize),d.call(this,p),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(_){this._input=_,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(g=new XMLHttpRequest,this._config.withCredentials&&(g.withCredentials=this._config.withCredentials),n||(g.onload=N(this._chunkLoaded,this),g.onerror=N(this._chunkError,this)),g.ontimeout=N(this._chunkTimeout,this),g.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadTimeout&&!n&&(g.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var _,T=this._config.downloadRequestHeaders;for(_ in T)g.setRequestHeader(_,T[_])}var S;this._config.chunkSize&&(S=this._start+this._config.chunkSize-1,g.setRequestHeader("Range","bytes="+this._start+"-"+S));try{g.send(this._config.downloadRequestBody)}catch(L){this._chunkError(L.message)}n&&g.status===0&&this._chunkError()}},this._chunkLoaded=function(){g.readyState===4&&(g.status<200||400<=g.status?this._chunkError():(this._start+=this._config.chunkSize||g.responseText.length,this._finished=!this._config.chunkSize||this._start>=(_=>(_=_.getResponseHeader("Content-Range"))!==null?parseInt(_.substring(_.lastIndexOf("/")+1)):-1)(g),this.parseChunk(g.responseText)))},this._chunkError=function(_){_=g.statusText||_,this._sendError(new Error(_))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function f(p){(p=p||{}).chunkSize||(p.chunkSize=u.LocalChunkSize),d.call(this,p);var g,_,T=typeof FileReader<"u";this.stream=function(S){this._input=S,_=S.slice||S.webkitSlice||S.mozSlice,T?((g=new FileReader).onload=N(this._chunkLoaded,this),g.onerror=N(this._chunkError,this)):g=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var S=this._input,L=(this._config.chunkSize&&(L=Math.min(this._start+this._config.chunkSize,this._input.size),S=_.call(S,this._start,L)),g.readAsText(S,this._config.encoding));T||this._chunkLoaded({target:{result:L}})},this._chunkLoaded=function(S){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(S.target.result)},this._chunkError=function(){this._sendError(g.error)}}function m(p){var g;d.call(this,p=p||{}),this.stream=function(_){return g=_,this._nextChunk()},this._nextChunk=function(){var _,T;if(!this._finished)return _=this._config.chunkSize,g=_?(T=g.substring(0,_),g.substring(_)):(T=g,""),this._finished=!g,this.parseChunk(T)}}function R(p){d.call(this,p=p||{});var g=[],_=!0,T=!1;this.pause=function(){d.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){d.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(S){this._input=S,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){T&&g.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),g.length?this.parseChunk(g.shift()):_=!0},this._streamData=N(function(S){try{g.push(typeof S=="string"?S:S.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(g.shift()))}catch(L){this._streamError(L)}},this),this._streamError=N(function(S){this._streamCleanUp(),this._sendError(S)},this),this._streamEnd=N(function(){this._streamCleanUp(),T=!0,this._streamData("")},this),this._streamCleanUp=N(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function E(p){var g,_,T,S,L=Math.pow(2,53),K=-L,q=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,V=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,P=this,F=0,M=0,U=!1,b=!1,k=[],D={data:[],errors:[],meta:{}};function j(Y){return p.skipEmptyLines==="greedy"?Y.join("").trim()==="":Y.length===1&&Y[0].length===0}function ne(){if(D&&T&&(Re("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),T=!1),p.skipEmptyLines&&(D.data=D.data.filter(function(G){return!j(G)})),ie()){let G=function(ce){k.push(ce)};if(D)if(Array.isArray(D.data[0])){for(var Y=0;ie()&&Y<D.data.length;Y++)D.data[Y].forEach(G);D.data.splice(0,1)}else D.data.forEach(G)}function X(G,ce){for(var ue=p.header?{}:[],ee=0;ee<G.length;ee++){var J=ee,Q=G[ee],Q=((_e,$)=>(oe=>(p.dynamicTypingFunction&&p.dynamicTyping[oe]===void 0&&(p.dynamicTyping[oe]=p.dynamicTypingFunction(oe)),(p.dynamicTyping[oe]||p.dynamicTyping)===!0))(_e)?$==="true"||$==="TRUE"||$!=="false"&&$!=="FALSE"&&((oe=>{if(q.test(oe)&&(oe=parseFloat(oe),K<oe&&oe<L))return 1})($)?parseFloat($):V.test($)?new Date($):$===""?null:$):$)(J=p.header?ee>=k.length?"__parsed_extra":k[ee]:J,Q=p.transform?p.transform(Q,J):Q);J==="__parsed_extra"?(ue[J]=ue[J]||[],ue[J].push(Q)):ue[J]=Q}return p.header&&(ee>k.length?Re("FieldMismatch","TooManyFields","Too many fields: expected "+k.length+" fields but parsed "+ee,M+ce):ee<k.length&&Re("FieldMismatch","TooFewFields","Too few fields: expected "+k.length+" fields but parsed "+ee,M+ce)),ue}var le;D&&(p.header||p.dynamicTyping||p.transform)&&(le=1,!D.data.length||Array.isArray(D.data[0])?(D.data=D.data.map(X),le=D.data.length):D.data=X(D.data,0),p.header&&D.meta&&(D.meta.fields=k),M+=le)}function ie(){return p.header&&k.length===0}function Re(Y,X,le,G){Y={type:Y,code:X,message:le},G!==void 0&&(Y.row=G),D.errors.push(Y)}A(p.step)&&(S=p.step,p.step=function(Y){D=Y,ie()?ne():(ne(),D.data.length!==0&&(F+=Y.data.length,p.preview&&F>p.preview?_.abort():(D.data=D.data[0],S(D,P))))}),this.parse=function(Y,X,le){var G=p.quoteChar||'"',G=(p.newline||(p.newline=this.guessLineEndings(Y,G)),T=!1,p.delimiter?A(p.delimiter)&&(p.delimiter=p.delimiter(Y),D.meta.delimiter=p.delimiter):((G=((ce,ue,ee,J,Q)=>{var _e,$,oe,Ae;Q=Q||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Me=0;Me<Q.length;Me++){for(var Ee,qe=Q[Me],he=0,Oe=0,de=0,me=(oe=void 0,new x({comments:J,delimiter:qe,newline:ue,preview:10}).parse(ce)),Ie=0;Ie<me.data.length;Ie++)ee&&j(me.data[Ie])?de++:(Ee=me.data[Ie].length,Oe+=Ee,oe===void 0?oe=Ee:0<Ee&&(he+=Math.abs(Ee-oe),oe=Ee));0<me.data.length&&(Oe/=me.data.length-de),1.99<Oe&&($===void 0||he<$||he===$&&Ae<Oe)&&($=he,_e=qe,Ae=Oe)}return{successful:!!(p.delimiter=_e),bestDelimiter:_e}})(Y,p.newline,p.skipEmptyLines,p.comments,p.delimitersToGuess)).successful?p.delimiter=G.bestDelimiter:(T=!0,p.delimiter=u.DefaultDelimiter),D.meta.delimiter=p.delimiter),v(p));return G.header=ie(),p.preview&&p.header&&G.preview++,g=Y,_=new x(G),D=_.parse(g,X,le),ne(),U?{meta:{paused:!0}}:D||{meta:{paused:!1}}},this.paused=function(){return U},this.pause=function(){U=!0,_.abort(),g=A(p.chunk)?"":g.substring(_.getCharIndex())},this.resume=function(){P.streamer._halted?(U=!1,P.streamer.parseChunk(g,!0)):setTimeout(P.resume,3)},this.aborted=function(){return b},this.abort=function(){b=!0,_.abort(),D.meta.aborted=!0,A(p.complete)&&p.complete(D),g=""},this.guessLineEndings=function(ce,G){ce=ce.substring(0,1048576);var G=new RegExp(C(G)+"([^]*?)"+C(G),"gm"),le=(ce=ce.replace(G,"")).split("\r"),G=ce.split(`
2
+ `),ce=1<G.length&&G[0].length<le[0].length;if(le.length===1||ce)return`
3
+ `;for(var ue=0,ee=0;ee<le.length;ee++)le[ee][0]===`
4
+ `&&ue++;return ue>=le.length/2?`\r
5
+ `:"\r"}}function C(p){return p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(p){var g=(p=p||{}).delimiter,_=p.newline,T=p.comments,S=p.step,L=p.preview,K=p.fastMode,q=null,V=!1,P=p.quoteChar==null?'"':p.quoteChar,F=P;if(p.escapeChar!==void 0&&(F=p.escapeChar),(typeof g!="string"||-1<u.BAD_DELIMITERS.indexOf(g))&&(g=","),T===g)throw new Error("Comment character same as delimiter");T===!0?T="#":(typeof T!="string"||-1<u.BAD_DELIMITERS.indexOf(T))&&(T=!1),_!==`
6
+ `&&_!=="\r"&&_!==`\r
7
+ `&&(_=`
8
+ `);var M=0,U=!1;this.parse=function(b,k,D){if(typeof b!="string")throw new Error("Input must be a string");var j=b.length,ne=g.length,ie=_.length,Re=T.length,Y=A(S),X=[],le=[],G=[],ce=M=0;if(!b)return he();if(K||K!==!1&&b.indexOf(P)===-1){for(var ue=b.split(_),ee=0;ee<ue.length;ee++){if(G=ue[ee],M+=G.length,ee!==ue.length-1)M+=_.length;else if(D)return he();if(!T||G.substring(0,Re)!==T){if(Y){if(X=[],Ae(G.split(g)),Oe(),U)return he()}else Ae(G.split(g));if(L&&L<=ee)return X=X.slice(0,L),he(!0)}}return he()}for(var J=b.indexOf(g,M),Q=b.indexOf(_,M),_e=new RegExp(C(F)+C(P),"g"),$=b.indexOf(P,M);;)if(b[M]===P)for($=M,M++;;){if(($=b.indexOf(P,$+1))===-1)return D||le.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:X.length,index:M}),Ee();if($===j-1)return Ee(b.substring(M,$).replace(_e,P));if(P===F&&b[$+1]===F)$++;else if(P===F||$===0||b[$-1]!==F){J!==-1&&J<$+1&&(J=b.indexOf(g,$+1));var oe=Me((Q=Q!==-1&&Q<$+1?b.indexOf(_,$+1):Q)===-1?J:Math.min(J,Q));if(b.substr($+1+oe,ne)===g){G.push(b.substring(M,$).replace(_e,P)),b[M=$+1+oe+ne]!==P&&($=b.indexOf(P,M)),J=b.indexOf(g,M),Q=b.indexOf(_,M);break}if(oe=Me(Q),b.substring($+1+oe,$+1+oe+ie)===_){if(G.push(b.substring(M,$).replace(_e,P)),qe($+1+oe+ie),J=b.indexOf(g,M),$=b.indexOf(P,M),Y&&(Oe(),U))return he();if(L&&X.length>=L)return he(!0);break}le.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:X.length,index:M}),$++}}else if(T&&G.length===0&&b.substring(M,M+Re)===T){if(Q===-1)return he();M=Q+ie,Q=b.indexOf(_,M),J=b.indexOf(g,M)}else if(J!==-1&&(J<Q||Q===-1))G.push(b.substring(M,J)),M=J+ne,J=b.indexOf(g,M);else{if(Q===-1)break;if(G.push(b.substring(M,Q)),qe(Q+ie),Y&&(Oe(),U))return he();if(L&&X.length>=L)return he(!0)}return Ee();function Ae(de){X.push(de),ce=M}function Me(de){var me=0;return me=de!==-1&&(de=b.substring($+1,de))&&de.trim()===""?de.length:me}function Ee(de){return D||(de===void 0&&(de=b.substring(M)),G.push(de),M=j,Ae(G),Y&&Oe()),he()}function qe(de){M=de,Ae(G),G=[],Q=b.indexOf(_,M)}function he(de){if(p.header&&!k&&X.length&&!V){var me=X[0],Ie=Object.create(null),je=new Set(me);let bt=!1;for(let Be=0;Be<me.length;Be++){let be=c(me[Be]);if(Ie[be=A(p.transformHeader)?p.transformHeader(be,Be):be]){let He,B=Ie[be];for(;He=be+"_"+B,B++,je.has(He););je.add(He),me[Be]=He,Ie[be]++,bt=!0,(q=q===null?{}:q)[He]=be}else Ie[be]=1,me[Be]=be;je.add(be)}bt&&console.warn("Duplicate headers found and renamed."),V=!0}return{data:X,errors:le,meta:{delimiter:g,linebreak:_,aborted:U,truncated:!!de,cursor:ce+(k||0),renamedHeaders:q}}}function Oe(){S(he()),X=[],le=[]}},this.abort=function(){U=!0},this.getCharIndex=function(){return M}}function I(p){var g=p.data,_=a[g.workerId],T=!1;if(g.error)_.userError(g.error,g.file);else if(g.results&&g.results.data){var S={abort:function(){T=!0,w(g.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:O,resume:O};if(A(_.userStep)){for(var L=0;L<g.results.data.length&&(_.userStep({data:g.results.data[L],errors:g.results.errors,meta:g.results.meta},S),!T);L++);delete g.results}else A(_.userChunk)&&(_.userChunk(g.results,S,g.file),delete g.results)}g.finished&&!T&&w(g.workerId,g.results)}function w(p,g){var _=a[p];A(_.userComplete)&&_.userComplete(g),_.terminate(),delete a[p]}function O(){throw new Error("Not implemented.")}function v(p){if(typeof p!="object"||p===null)return p;var g,_=Array.isArray(p)?[]:{};for(g in p)_[g]=v(p[g]);return _}function N(p,g){return function(){p.apply(g,arguments)}}function A(p){return typeof p=="function"}return u.parse=function(p,g){var _=(g=g||{}).dynamicTyping||!1;if(A(_)&&(g.dynamicTypingFunction=_,_={}),g.dynamicTyping=_,g.transform=!!A(g.transform)&&g.transform,g.downloadTimeout!==void 0){var _=parseInt(g.downloadTimeout);if(isNaN(_))throw new Error("Config downloadTimeout value ("+g.downloadTimeout+") not parsable by parseInt(val).");g.downloadTimeout=_}if(!g.worker||!u.WORKERS_SUPPORTED)return _=null,u.NODE_STREAM_INPUT,typeof p=="string"?(p=c(p),_=new(g.download?h:m)(g)):p.readable===!0&&A(p.read)&&A(p.on)?_=new R(g):(i.File&&p instanceof File||p instanceof Object)&&(_=new f(g)),_.stream(p);(_=(()=>{var T;return!!u.WORKERS_SUPPORTED&&(T=(()=>{var S=i.URL||i.webkitURL||null,L=t.toString();return u.BLOB_URL||(u.BLOB_URL=S.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",L,")();"],{type:"text/javascript"})))})(),(T=new i.Worker(T)).onmessage=I,T.id=l++,a[T.id]=T)})()).userStep=g.step,_.userChunk=g.chunk,_.userComplete=g.complete,_.userError=g.error,g.step=A(g.step),g.chunk=A(g.chunk),g.complete=A(g.complete),g.error=A(g.error),delete g.worker,_.postMessage({input:p,config:g,workerId:_.id})},u.unparse=function(p,g){var _=!1,T=!0,S=",",L=`\r
9
+ `,K='"',q=K+K,V=!1,P=null,F=!1,M=((()=>{if(typeof g=="object"){if(typeof g.delimiter!="string"||u.BAD_DELIMITERS.filter(function(k){return g.delimiter.indexOf(k)!==-1}).length||(S=g.delimiter),typeof g.quotes!="boolean"&&typeof g.quotes!="function"&&!Array.isArray(g.quotes)||(_=g.quotes),typeof g.skipEmptyLines!="boolean"&&typeof g.skipEmptyLines!="string"||(V=g.skipEmptyLines),typeof g.newline=="string"&&(L=g.newline),typeof g.quoteChar=="string"&&(K=g.quoteChar,q=K+K),typeof g.header=="boolean"&&(T=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 U(null,p,V);if(typeof p[0]=="object")return U(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])),U(p.fields||[],p.data||[],V);throw new Error("Unable to serialize unrecognized input");function U(k,D,j){var ne="",ie=(typeof k=="string"&&(k=JSON.parse(k)),typeof D=="string"&&(D=JSON.parse(D)),Array.isArray(k)&&0<k.length),Re=!Array.isArray(D[0]);if(ie&&T){for(var Y=0;Y<k.length;Y++)0<Y&&(ne+=S),ne+=b(k[Y],Y);0<D.length&&(ne+=L)}for(var X=0;X<D.length;X++){var le=(ie?k:D[X]).length,G=!1,ce=ie?Object.keys(D[X]).length===0:D[X].length===0;if(j&&!ie&&(G=j==="greedy"?D[X].join("").trim()==="":D[X].length===1&&D[X][0].length===0),j==="greedy"&&ie){for(var ue=[],ee=0;ee<le;ee++){var J=Re?k[ee]:ee;ue.push(D[X][J])}G=ue.join("").trim()===""}if(!G){for(var Q=0;Q<le;Q++){0<Q&&!ce&&(ne+=S);var _e=ie&&Re?k[Q]:Q;ne+=b(D[X][_e],Q)}X<D.length-1&&(!j||0<le&&!ce)&&(ne+=L)}}return ne}function b(k,D){var j,ne,ie;return k==null?"":k.constructor===Date?isNaN(k.getTime())?"":k.toISOString():(ie=!1,F&&typeof k=="string"&&F.test(k)&&(k="'"+k,ie=!0),ne=(j=k.toString()).replace(M,q),(ie=ie||_===!0||typeof _=="function"&&_(k,D)||Array.isArray(_)&&_[D]||((Re,Y)=>{for(var X=0;X<Y.length;X++)if(-1<Re.indexOf(Y[X]))return!0;return!1})(ne,u.BAD_DELIMITERS)||-1<ne.indexOf(S)||-1<j.indexOf(K)||ne.charAt(0)===" "||ne.charAt(ne.length-1)===" ")?K+ne+K:ne)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
10
+ `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!n&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=x,u.ParserHandle=E,u.NetworkStreamer=h,u.FileStreamer=f,u.StringStreamer=m,u.ReadableStreamStreamer=R,o&&(i.onmessage=function(p){p=p.data,u.WORKER_ID===void 0&&p&&(u.WORKER_ID=p.workerId),typeof p.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(p.input,p.config),finished:!0}):(i.File&&p.input instanceof File||p.input instanceof Object)&&(p=u.parse(p.input,p.config))&&i.postMessage({workerId:u.WORKER_ID,results:p,finished:!0})}),(h.prototype=Object.create(d.prototype)).constructor=h,(f.prototype=Object.create(d.prototype)).constructor=f,(m.prototype=Object.create(m.prototype)).constructor=m,(R.prototype=Object.create(d.prototype)).constructor=R,u})})(ft)),ft.exports}var da=ua(),Ve=(r=>(r.String="string",r.Number="number",r.Boolean="boolean",r.Object="object",r.Undefined="undefined",r))(Ve||{});const ha=["id"],fa=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 d=u();return d.length?d:null}),a=()=>{const d=i.labels;if(typeof i.fields!==Ve.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return d!==null&&typeof d===Ve.Object?h=>Object.fromEntries(Object.entries(h).map(([f,m])=>[d[f]||f,m])):h=>h},l=()=>{const d=i.fields;if(typeof i.fields!==Ve.Object&&!Array.isArray(d))throw new Error("Fields needs to be an array of strings.");return Array.isArray(d)?h=>Object.fromEntries(d.filter(f=>f in h).map(f=>[f,h[f]])):h=>h},u=()=>{if(typeof i.fields===Ve.Undefined&&typeof i.labels===Ve.Undefined)return i.data;const d=a(),h=l();return i.data.map(f=>d(h(f)))},c=()=>{if(!o.value){console.warn("No data to export");return}t("export-started",o.value);let d=da.unparse(o.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(d="SEP="+i.delimiter+`\r
11
+ `+d),i.encoding==="utf-8"&&(d="\uFEFF"+d),t("export-finished",i.filename),!i.testing){const h=new Blob([d],{type:"text/csv;charset="+i.encoding});la.saveAs(h,i.filename)}};return(d,h)=>(s.openBlock(),s.createElementBlock("div",{id:n.value,"data-testid":"export-csv",onClick:c},[s.renderSlot(d.$slots,"default",{},()=>[s.createTextVNode("Download "+s.toDisplayString(r.filename),1)])],8,ha))}}),ma=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(fa,{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"])]))}}),pa={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_gateway_version:"AI gateway version",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 mt(){const r=at.createI18n("en-us",pa);return{i18n:r,i18nT:at.i18nTComponent(r)}}const Ye=170,pt=6,Se="analytics-query-provider",Hi="analytics-dashboard-coordinator",Mt="{entity-id}",Gi="{cp-id}",Fi="{timeframe}",$i=30*1e3,Wi=3e5,Vi=36e5;function ga(){const r=s.inject(Se);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var Bt={exports:{}},Yi;function _a(){return Yi||(Yi=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(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function o(u,c,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new n(d,h||u,f),R=t?t+c:c;return u._events[R]?u._events[R].fn?u._events[R]=[u._events[R],m]:u._events[R].push(m):(u._events[R]=m,u._eventsCount++),u}function a(u,c){--u._eventsCount===0?u._events=new i:delete u._events[c]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],d,h;if(this._eventsCount===0)return c;for(h in d=this._events)e.call(d,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},l.prototype.listeners=function(c){var d=t?t+c:c,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,m=h.length,R=new Array(m);f<m;f++)R[f]=h[f].fn;return R},l.prototype.listenerCount=function(c){var d=t?t+c:c,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,d,h,f,m,R){var E=t?t+c:c;if(!this._events[E])return!1;var C=this._events[E],x=arguments.length,I,w;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),x){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,h),!0;case 4:return C.fn.call(C.context,d,h,f),!0;case 5:return C.fn.call(C.context,d,h,f,m),!0;case 6:return C.fn.call(C.context,d,h,f,m,R),!0}for(w=1,I=new Array(x-1);w<x;w++)I[w-1]=arguments[w];C.fn.apply(C.context,I)}else{var O=C.length,v;for(w=0;w<O;w++)switch(C[w].once&&this.removeListener(c,C[w].fn,void 0,!0),x){case 1:C[w].fn.call(C[w].context);break;case 2:C[w].fn.call(C[w].context,d);break;case 3:C[w].fn.call(C[w].context,d,h);break;case 4:C[w].fn.call(C[w].context,d,h,f);break;default:if(!I)for(v=1,I=new Array(x-1);v<x;v++)I[v-1]=arguments[v];C[w].fn.apply(C[w].context,I)}}return!0},l.prototype.on=function(c,d,h){return o(this,c,d,h,!1)},l.prototype.once=function(c,d,h){return o(this,c,d,h,!0)},l.prototype.removeListener=function(c,d,h,f){var m=t?t+c:c;if(!this._events[m])return this;if(!d)return a(this,m),this;var R=this._events[m];if(R.fn)R.fn===d&&(!f||R.once)&&(!h||R.context===h)&&a(this,m);else{for(var E=0,C=[],x=R.length;E<x;E++)(R[E].fn!==d||f&&!R[E].once||h&&R[E].context!==h)&&C.push(R[E]);C.length?this._events[m]=C.length===1?C[0]:C:a(this,m)}return this},l.prototype.removeAllListeners=function(c){var d;return c?(d=t?t+c:c,this._events[d]&&a(this,d)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,r.exports=l})(Bt)),Bt.exports}var ya=_a();const Ra=sa(ya);class zt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,zt)}}const Xi=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function Ca(r,e){const{milliseconds:t,fallback:i,message:n,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,u;const d=new Promise((h,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(a?.aborted){f(Xi(a));return}if(a&&(u=()=>{f(Xi(a))},a.addEventListener("abort",u,{once:!0})),r.then(h,f),t===Number.POSITIVE_INFINITY)return;const m=new zt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(R){f(R)}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(()=>{d.clear(),u&&a&&a.removeEventListener("abort",u)});return d.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},d}function Ea(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 Oa=100;class ji{#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=Ea(this.#t,a,(u,c)=>c.priority-u.priority);this.#t.splice(l,0,a)}setPriority(e,t){const i=this.#t.findIndex((o,a)=>a>=this.#e&&o.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[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>Oa&&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 ba extends Ra{#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:ji,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 d=e({signal:t.signal});if(t.timeout!==void 0&&(d=Ca(Promise.resolve(d),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#r} running, ${this.#i.size} waiting)`})),t.signal){const{signal:f}=t;d=Promise.race([d,new Promise((m,R)=>{c=()=>{R(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await d;i(h),this.emit("completed",h)}catch(d){n(d),this.emit("error",d)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#M()})}};this.#i.enqueue(l,t);const u=()=>{if(this.#i instanceof ji){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,d=()=>{a(),u(),n(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",d),this.#E.delete(a)},c.aborted){d();return}c.addEventListener("abort",d,{once:!0}),this.#E.add(a)}this.emit("add"),this.#y()})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this.#d?(this.#d=!1,this.#T(),this):this}pause(){this.#d=!0}clear(){for(const e of this.#E)e();this.#i=new this.#v,this.#w(),this.#k(),this.emit("empty"),this.#r===0&&(this.#x(),this.emit("idle")),this.emit("next")}async onEmpty(){this.#i.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#i.size<e||await this.#h(["next","active"],()=>this.#i.size<e)}async onIdle(){this.#r===0&&this.#i.size===0||await this.#h("idle")}async onPendingZero(){this.#r!==0&&await this.#h("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#h("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#h("rateLimitCleared")}onError(){return new Promise((e,t)=>{const i=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 wa=()=>{const r=Te.useAnalyticsConfigStore(),e=s.inject(Se);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 ba({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(Se,i)};function Ta(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 Qi(r,...e){return typeof r=="function"?r(...e):r}function va({method:r="warn",formatter:e=Ta}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const Sa=Error.captureStackTrace;var xa=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,Sa?.(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 Ia(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function Da(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||Ia(i,n),l=(u={},c={})=>{const d=new xa({code:n,why:Qi(o.why,u),fix:Qi(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[n]=l}return t}const ka=typeof window<"u",Na=Da({reporters:[va()],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 Zi;process.env.NODE_ENV;const Ji=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 De=r=>r?.chart.type==="table",Pt=r=>r?.query?.datasource==="requests",qt=r=>!!r&&!De(r)&&!Pt(r),Aa=(r,e)=>{const t=r.header_description??("description"in r.chart?r.chart.description:void 0);if(t)return t.replaceAll(Fi,e)||void 0},La=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],Ua=r=>La.includes(r);function Ka({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),u=Te.useAnalyticsConfigStore(),c=Te.useDatasourceConfigStore(),{stripUnknownFilters:d,loading:h}=Xe(c),f=s.computed(()=>De(t.value));s.onMounted(async()=>{n.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const m=s.computed(()=>u.analytics&&u.percentiles),R=s.computed(()=>{const _=t.value.chart.type;return["golden_signals","gauge"].includes(_)?!1:_==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),E=s.computed(()=>o.value&&t.value.query&&!f.value&&t.value.query.datasource!=="llm_usage"&&t.value.query.datasource!=="managed_cache_usage"&&!Z.isPlatformDatasource(t.value.query.datasource)&&m.value&&!h.value),C=s.computed(()=>n.value&&t.value.query&&Ua(t.value.query.datasource)&&m.value&&!h.value),x=s.computed(()=>i.value?Z.msToGranularity(i.value.meta.granularity_ms):void 0),I=s.computed(()=>{const _=t.value,T=[...e.value.filters,..._.query.filters??[]],S="metrics"in _.query?_.query.metrics:void 0,L=_.query?.datasource??"api_usage";return d.value({datasource:L,filters:T,queryFields:S})}),w=s.computed(()=>{if(!C.value||!R.value)return"";const _=t.value;if(De(_))return g({..._.query,filters:I.value});const T=_.query.time_range||e.value.timeSpec,S=p(T,I.value);return g(S)}),O=s.computed(()=>{if(!E.value||!R.value)return"";const _=I.value,T=t.value;if(De(T))return"";const S=N(T.query.time_range||e.value.timeSpec,_);return v(S)}),v=_=>E.value?`${o.value}?q=${JSON.stringify(_)}`:"",N=(_,T)=>{const S=i.value?.meta?.start?new Date(i.value.meta.start):void 0,L=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:T,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?S:void 0,end:_.type==="absolute"?L:void 0}}},A=(_,T)=>({filter:T,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),p=(_,T)=>{const S=t.value;if(!qt(S))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const L=[...S.query.dimensions??[]],K=[...S.query.metrics??[]];return{filters:T,metrics:K,dimensions:L,time_range:_,granularity:S.query.granularity||x.value||void 0}},g=_=>{if(!C.value)return"";const T=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${n.value}?q=${JSON.stringify(_)}&d=${T}&c=${t.value.chart.type}`};return s.watch([E,C],([_,T])=>{_&&(a.value={href:""}),T&&(l.value={href:""})}),{exploreLinkKebabMenu:w,requestsLinkKebabMenu:O,canShowKebabMenu:R,canGenerateRequestsLink:E,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:A,buildExploreLink:g,buildRequestLink:v}}const Ht=r=>r.type==="relative"?Z.TimePeriods.get(Z.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Ma=r=>r.reduce((e,t)=>{const i=Z.TimePeriods.get(Z.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Gt=(r,e)=>{if(!r||!e?.length)return;const t=Ht(r),i=Ma(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},Ft=(r,e)=>{const t=Gt(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 Ba(){const r=s.inject(Se),e=Te.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;return s.onUnmounted(()=>{n?.abort()}),{issueQuery:async(a,l,u)=>{if(!r)throw new Error("Query bridge is not defined");n?.abort();const c=new AbortController;n=c,await e.isReady();const{datasource:d,limit:h,...f}=a,m=d||"basic",R=Z.isPlatformDatasource(m),E=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:I})=>!R||!Z.requestFilterTypeEmptyV2.some(w=>w===I));let C=a.time_range;!C&&l.timeSpec?C={...l.timeSpec,tz:l.tz}:C&&!C.tz&&(C={...C,tz:l.tz}),C=Ft(C,t.value[m]?.timeRangeOptions);const x={datasource:m,query:{...f,time_range:C,filters:E,limit:u??h}};return r.queryFn(x,c)}}}const za="24H",Pa={status_code:"response_http_status",upstream_status_code:"upstream_status"},qa={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"},Ha=r=>Z.relativeTimeRangeValuesRequestV2.includes(r),Ga=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:Ha(t)?t:za,...e}},er=r=>Pa[r]??r,Fa=r=>({metric:er(r.metric),dimension:r.dimension?er(r.dimension):void 0,unroll:r.unroll,metricUnit:qa[r.metric],extraFields:r.extra_fields}),$t="requests";function $a(){const r=s.inject(Se),e=Te.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;s.onUnmounted(()=>{n?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return Ft(c&&{...c,tz:c.tz??u.tz},t.value[$t]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");n?.abort();const d=new AbortController;n=d,await e.isReady();const h=i.value({datasource:$t,filters:[...l.filters??[],...u.filters]});return Z.fetchAllRequests(c,{datasource:$t,query:{filters:h,time_range:Ga(o(l,u))}},d,{maxRecords:l.max_records})}}}function Wa({context:r,globalFilters:e=s.ref([]),isFullscreen:t=s.ref(!1),preview:i=s.ref(!1)}){const n=Te.useAnalyticsConfigStore(),o=Te.useDatasourceConfigStore(),{loading:a}=Xe(n),{loading:l}=Xe(o),u=s.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:n.defaultQueryTimeForOrg}),c=s.computed(()=>{const{tz:O}=r.value;return O||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=s.computed(()=>{const{editable:O}=r.value;return O===void 0||i.value?!1:O}),h=s.computed(()=>{const{showTileActions:O}=r.value;return i.value?!1:O===void 0?!0:O}),f=s.computed(()=>[...r.value.filters??[],...e.value]),m=s.computed(()=>{let{refreshInterval:O}=r.value;if(O===void 0&&(O=$i),t.value){let v=!1;if(u.value.type==="relative")v=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const p=u.value.start.getTime(),g=u.value.end.getTime();v=Math.abs(g-p)<=864e5}const N=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<N||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?O=0:v?O=Wi:O=Vi}return O}),R=s.computed(()=>({filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:m.value,editable:d.value,showTileActions:h.value})),E=s.computed(()=>!a.value&&!l.value),C=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),x=s.computed(()=>!i.value),I=s.computed(()=>!i.value),w=s.computed(()=>({enabled:C.value,showExploreAction:x.value,showRequestsAction:I.value,showZoomInAction:C.value}));return{editable:d,enrichedContext:R,filters:f,queryReady:E,refreshInterval:m,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:w}}const Va=6,tr=6,ir=4;function Ya(r,e){const{pageWidth:t,pageHeight:i,margin:n}=e,o=n+1,a=n+e.headerHeight-3,l=i-n-tr+3,u=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+ir),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,u);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const d=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(d,n+c,u,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(d,n+c,u)),r.setTextColor(120),r.text(e.pageLabel,t-n,u,{align:"right"})}function Xa(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),u=Math.round(a.bottom-i),c=n.get(l);n.set(l,c!==void 0?Math.max(c,u):u)}),[...n.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function ja(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const u=Math.min(t,e-l);a.push({startY:l,height:u}),l+=u}return a}const n=[];let o=0;for(const a of r){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(n.push({startY:o,height:l-o}),o=l):(n.push({startY:o,height:u-o}),o=u))}return o<e&&n.push({startY:o,height:e-o}),n}function Qa(r){const{i18n:e}=mt(),t=s.ref({status:"idle"});async function i(n={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:u,orientation:c="landscape",pageSize:d="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:R="download",onBeforeCapture:E,onAfterCapture:C}=n,x=r.value;if(!x){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await E?.();const[{snapdom:I},{jsPDF:w}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const O={name:"kong-webgl-snapshot",beforeClone:()=>Z.prepareForCapture(),afterClone:()=>Z.restoreAfterCapture()},v=await I.toCanvas(x,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[O]}),N=Xa(x),A=x.getBoundingClientRect().width,p=A?v.width/A:f;t.value={status:"generating"};const g=new Date,_=new w({orientation:c,unit:"mm",format:d}),T=_.internal.pageSize.getWidth(),S=_.internal.pageSize.getHeight(),L=Va+(l?ir:0),K=T-h*2,q=S-h*2-L-tr,V=v.width/K,P=q*V,F=ja(N,v.height,P,p),M={title:a,subtitle:l,dashboardUrl:u,generatedAt:e.t("pdfExport.generated",{timestamp:g.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:T,pageHeight:S,headerHeight:L,margin:h};for(let U=0;U<F.length;U++){U>0&&_.addPage();const{startY:b,height:k}=F[U],D=document.createElement("canvas");D.width=v.width,D.height=k,D.getContext("2d").drawImage(v,0,b,v.width,k,0,0,v.width,k),_.addImage(D.toDataURL("image/png"),"PNG",h,h+L,K,k/V),Ya(_,{...M,pageLabel:e.t("pdfExport.pageOf",{page:String(U+1),total:String(F.length)})})}if(R==="blob"){const U=_.output("blob");return t.value={status:"complete",pageCount:F.length},U}_.save(o),t.value={status:"complete",pageCount:F.length}}catch(I){t.value={status:"error",error:I}}finally{Z.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const Za=r=>r.toLowerCase().endsWith("count")?"":r;function Ja(){const{i18n:r}=mt(),{formatUnit:e}=Z.unitFormatter({i18n:r}),t=ae.useFieldLabel();return i=>{const n=i.meta?.metric_names?.[0]??"",o=i.meta?.metric_units?.[n]??"";return{seriesName:t(n),valueFormatter:a=>e(a,o,{translateUnit:Za})}}}const rr=(r,e,t,{prefix:i="chartLabels",fallback:n=t}={})=>{const o=`${i}.${t}`;return e.get(t)||(r.te(o)?r.t(o):n)};function el(){const{i18n:r}=mt(),e=Te.useDatasourceConfigStore();return(t,i)=>rr(r,e.fieldTranslationMap,t,i)}const ae={useContextLinks:Ka,useDashboardContext:Wa,useEvaluateFeatureFlag:ga,useExportPdf:Qa,useFieldLabel:el,useI18n:mt,useIssueQuery:Ba,useIssueRequestsQuery:$a,useMetricFormatter:Ja,useRequestQueue:wa},tl={class:"kong-ui-public-csv-export-modal"},il={key:0,class:"selected-range"},rl={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}=ae.useI18n(),i=ae.useFieldLabel(),n=r,o=e,a=`${n.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,l=s.ref(1),u=s.computed(()=>m.value.rows.length),c=s.computed(()=>n.exportState.status==="success"&&!!n.exportState.chartData?.data?.length),d=s.computed(()=>{if(n.exportState.status!=="success"||!n.exportState.chartData?.meta)return"";const{start:E,end:C}=n.exportState.chartData.meta;return!E||!C?"":new Date(E).getTime()===new Date(C).getTime()?t.t("csvExport.exportAsOf",{time:Z.formatTimestamp(new Date(E),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${Z.formatTimestamp(new Date(E))} - ${Z.formatTimestamp(new Date(C),{includeTZ:!0})}`}),h=s.computed(()=>n.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(nr,u.value),rowsTotal:u.value,plural:u.value===1?"":"s"})),f=()=>{o("closeModal")},m=s.computed(()=>{if(n.exportState.status!=="success"||!c.value||!n.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const E=n.exportState.chartData,C=E.data.some(N=>N.timestamp!==E.data[0].timestamp),x=E.data.map(N=>{const A=new Date(N.timestamp);return{...Object.keys(N.event).reduce((g,_)=>{if(_ in E.meta.display){const T=N.event[_],S=E.meta.display[_];g[_]=T&&S?.[T]?.name||N.event[_]}else g[_]=N.event[_];return g},{}),...C?{timestamp:Ut(A,"yyyy-MM-dd HH:mm:ss"),tzOffset:Ut(A,"XXX")}:{}}});let I=[];C&&(I=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const w="display"in n.exportState.chartData.meta&&n.exportState.chartData.meta.display?n.exportState.chartData.meta.display:{},O=[...I,...Object.keys(w).map(N=>({label:i(N),key:N})),...n.exportState.chartData.meta.metric_names.map(N=>({label:i(N),key:N}))],v=O.reduce((N,A)=>(N[A.key]=A.label,N),{});return{headers:O,csvHeaders:v,rows:x}}),R=async()=>{if(n.exportState.status!=="success")return{total:0,data:[]};const{rows:E}=m.value;return{total:Number(E.length)||0,data:E.slice(0,nr)}};return s.watch(m,()=>{l.value++}),(E,C)=>{const x=s.resolveComponent("KSkeleton"),I=s.resolveComponent("KEmptyState"),w=s.resolveComponent("KTableData"),O=s.resolveComponent("KTooltip"),v=s.resolveComponent("KButton"),N=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",tl,[s.createVNode(N,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:s.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:f,onKeyup:s.withKeys(f,["esc"])},{default:s.withCtx(()=>[s.createElementVNode("div",null,[r.exportState.status==="success"&&c.value?(s.openBlock(),s.createElementBlock("div",il,[s.createElementVNode("p",null,s.toDisplayString(r.modalDescription?r.modalDescription:s.unref(t).t("csvExport.exportDescription")),1),s.createElementVNode("p",null,s.toDisplayString(d.value),1)])):s.createCommentVNode("",!0),r.exportState.status==="loading"?(s.openBlock(),s.createBlock(x,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(s.openBlock(),s.createBlock(w,{key:2,class:"vitals-table",fetcher:R,"fetcher-cache-key":String(l.value),headers:m.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":s.withCtx(()=>[s.createVNode(I,{"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(I,{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"&&c.value?(s.openBlock(),s.createElementBlock("div",rl,[s.createTextVNode(s.toDisplayString(h.value)+" ",1),s.createVNode(O,{class:"preview-tooltip",placement:"right",text:s.unref(t).t("csvExport.maximumRecordAmount",{value:s.unref(Z.EXPORT_RECORD_LIMIT)})},{default:s.withCtx(()=>[s.createVNode(s.unref(re.InfoIcon),{color:`var(--kui-color-text-neutral, ${s.unref(Kt)})`,size:`var(--kui-icon-size-30, ${s.unref(na)})`},null,8,["color","size"])]),_:1},8,["text"])])):s.createCommentVNode("",!0)])]),"footer-actions":s.withCtx(()=>[s.createVNode(v,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.cancelButton")),1)]),_:1}),s.createVNode(ma,{class:"vitals-report-export-button",filename:a,headers:m.value.csvHeaders,rows:m.value.rows},{default:s.withCtx(()=>[s.createVNode(v,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!c.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 nl=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=nl){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}=ae.useI18n(),{issueQuery:o}=ae.useIssueQuery(),a=s.inject(Se),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=ni(l,async()=>{const I=l();try{const w=await o(t.query,t.context,t.limitOverride);return l()!==I?void 0:(m.value=null,w)}catch(w){if(l()!==I)return;throw m.value=we.handleQueryError(w),w}finally{l()===I&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=ar(u,c,d),m=s.ref(null),R=s.computed(()=>h.value===f.ERROR||!!m.value),E=s.computed(()=>!t.queryReady||h.value===f.PENDING),C=s.ref(),x=s.computed(()=>u.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return s.watch([()=>u.value,()=>h.value],([I,w])=>{I&&(w==="SUCCESS_HAS_DATA"||w==="SUCCESS")&&I!==C.value&&(C.value=I,i("chart-data",I))}),(I,w)=>{const O=s.resolveComponent("KSkeleton"),v=s.resolveComponent("KEmptyState");return(E.value||!s.unref(u)&&!R.value)&&!x.value?(s.openBlock(),s.createBlock(O,{key:0,class:"chart-skeleton",type:"table"})):R.value&&!E.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(re.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(re.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)):x.value?s.renderSlot(I.$slots,"default",{data:x.value},void 0,void 0,2):s.createCommentVNode("",!0)}}}),sl=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(sl,[["__scopeId","data-v-22077b88"]]),ol={class:"analytics-chart"},Wt=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}=ae.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")},u=c=>{i("chart-data",c)};return(c,d)=>{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:u},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",ol,[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:d[0]||(d[0]=m=>i("select-chart-range",m)),onZoomTimeRange:d[1]||(d[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(Wt,{"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"]))}}),al={class:"analytics-chart"},ll={key:3,class:"analytics-chart"},cl=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}=ae.useI18n(),{issueRequestsQuery:o}=ae.useIssueRequestsQuery(),a=s.computed(()=>t.query.datasource==="requests"),l=s.computed(()=>{const O=t.query,v=O.time_range??t.context.timeSpec,N=v?Ht(v):void 0;if(!N)return O;const A=Z.finestGranularityForDuration(N);let p;return O.granularity&&Z.Granularities[O.granularity]>=Z.Granularities[A]?p=O.granularity:p=A,{...O,granularity:p}}),u=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=s.ref(null),{data:d,error:h,isValidating:f}=ni(u,async()=>{const O=u(),v=t.query;try{const N=await o(v,t.context);return u()!==O?void 0:(c.value=null,we.requestsToScatterData(N,Fa(v)))}catch(N){if(u()!==O)return;throw c.value=we.handleQueryError(N),N}finally{u()===O&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:R}=ar(d,h,f),E=s.ref(),C=s.computed(()=>d.value??E.value);s.watch(d,O=>{O&&(E.value=O)});const x=s.computed(()=>m.value===R.ERROR||!!c.value),I=s.computed(()=>!x.value&&(!t.queryReady||m.value===R.PENDING)&&!C.value),w=s.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(O=>({percentile:O.percentile,label:O.label,borderDash:O.border_dash,color:O.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(O,v)=>{const N=s.resolveComponent("KSkeleton"),A=s.resolveComponent("KEmptyState");return a.value?I.value?(s.openBlock(),s.createBlock(N,{key:1,class:"chart-skeleton",type:"table"})):x.value?(s.openBlock(),s.createBlock(A,{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(re.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(re.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",ll,[s.createVNode(s.unref(we.AnalyticsChart),{"chart-data":C.value,"chart-options":w.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",al,[s.createVNode(s.unref(we.AnalyticsChart),{"chart-data":p,"chart-options":w.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(Wt,{"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"]))}}),ul=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(si.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(si.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 dl=r=>!!r?.length;function hl(r,e,t,i=dl){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 fl=({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"})}})},ml=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},pl=({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},gl=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,n=new Map,o=s.ref(0),a=s.ref(0),l=s.shallowRef(),u=s.shallowRef(),c=s.shallowRef(),d=s.ref(0),h=s.ref(!1);let f,m,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;const C=K=>K===o.value&&f===r.value&&m===e?.value,x=(K,q)=>C(K)&&q===a.value&&R===t?.value?.sortColumnKey&&E===t?.value?.sortColumnOrder,I=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},w=()=>{h.value=d.value>0},O=()=>{a.value+=1,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;for(const K of n.values())K.resolve(!1);i.clear(),n.clear(),u.value=void 0,c.value=void 0,d.value=0,w()},v=()=>{c.value=void 0,d.value+=1,w()},N=()=>{d.value=Math.max(0,d.value-1),w()},A=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 x(V,P)?M?"ready":(p(K,q),"failed"):(p(K,q),"stale")},_=({blockIndex:K,currentBlockCompletion:q,getRowsParams:V,pageSize:P,result:F})=>{F.cursor!==void 0&&i.set(K,F.cursor),V.successCallback(F.data,pl({startRow:V.startRow,rowsLength:F.data.length,pageSize:P,total:F.total,hasMore:F.hasMore})),V.startRow===0&&(u.value=F.data),q.resolve(!0)},T=({blockIndex:K,currentBlockCompletion:q,fetchError:V,getRowsParams:P})=>{c.value=V,P.failCallback(),p(K,q)},S=()=>{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,O(),{async getRows(V){if(!C(q)||!I(V.sortModel)){V.failCallback();return}const{blockIndex:P,pageSize:F}=ml({startRow:V.startRow,endRow:V.endRow});P===0&&n.has(0)&&O();const M=a.value,U=A(P);if(await g({blockIndex:P,currentBlockCompletion:U,datasourceId:q,requestGeneration:M})!=="ready"||!x(q,M)){V.failCallback(),p(P,U);return}v();try{const b=P>0?i.get(P-1):void 0,k=await K({mode:"infinite",pageSize:F,cursor:b,sort:t?.value});if(!x(q,M)){V.failCallback(),p(P,U);return}_({blockIndex:P,currentBlockCompletion:U,getRowsParams:V,pageSize:F,result:k})}catch(b){if(!x(q,M)){V.failCallback(),p(P,U);return}T({blockIndex:P,currentBlockCompletion:U,fetchError:b,getRowsParams:V})}finally{x(q,M)&&N()}}}},L=()=>{l.value=S()};return s.watch([r,()=>e?.value],()=>{L()},{immediate:!0}),s.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>O()),{datasource:s.readonly(l),data:s.shallowReadonly(u),error:s.readonly(c),isFetching:s.readonly(h)}},_l={title:"No Data",message:"There is no data to display."},yl={title:"An error occurred",message:"Data cannot be displayed due to an error."},Rl={emptyState:_l,errorState:yl};function dr(){const r=at.createI18n("en-us",Rl);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:Cl}=dr(),hr=(r,e)=>{const t=Reflect.get(e,r.key);return r.valueFormatter?r.valueFormatter(t,e):String(t??"")},gt=r=>typeof r!="number"?null:Number.isFinite(r)?r:null,El=(r,e)=>r.reduce((t,i)=>{const n=gt(Reflect.get(i,e.key));return n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)}},{sum:0,max:0}),Ol=(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"},bl=(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},wl=r=>{const e=t=>Cl.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)??wl(i)},mr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Tl=({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:gt(Reflect.get(n,e.key)),stats:t,header:e})):void 0}),{value:""}),vl=["data-threshold"],Sl={class:"table-data-grid-cell-label-track"},xl={class:"table-data-grid-cell-label"},Il={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},Dl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},kl=["data-text"],Nl=["data-text"],Al=["data-threshold"],Ll=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"),u=s.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=s.computed(()=>t.value.value),d=s.computed(()=>gt(c.value)),h=s.computed(()=>a.value?.stats[o.value.key]),f=s.computed(()=>o.value.showPercentage&&h.value?fr({value:d.value,stats:h.value,header:o.value}):void 0),m=s.computed(()=>!!o.value.bar&&!!h.value&&(d.value!==null||c.value===null||c.value===void 0)),R=s.computed(()=>m.value&&h.value?bl(d.value,h.value,o.value.bar)*100:0),E=s.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),C=s.computed(()=>o.value.thresholds?.length&&d.value!==null?Ol(d.value,o.value.thresholds):void 0),x=s.computed(()=>({column:o.value,refreshCell:()=>{const _=t.value.node;_&&t.value.api.refreshCells({force:!0,rowNodes:[_]})},row:t.value.data??{},rowIndex:t.value.node?.rowIndex??0,rowValue:t.value.value,selected:t.value.node?.isSelected()??!1})),I=(_,{slots:T})=>{const S=t.value.colDef?.colId,L=t.value.context?.cells?.slots;return!S||S==="cell-icon"||!L?.[S]?T.default?.():s.h("span",{class:"table-data-grid-cell-slot-content"},s.renderSlot(L,S,x.value,()=>T.default?.()??[]))},w=()=>{const _=t.value.context?.cells?.slots;return _?.["cell-icon"]?s.renderSlot(_,"cell-icon",x.value):null};let O,v,N=!1;const A=()=>{const _=i.value;n.value=!!_&&_.scrollWidth>_.clientWidth},p=()=>{N||(v!==void 0&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=void 0,A()}))},g=_=>{if(O?.disconnect(),_){O?.observe(_);const T=_.closest(".ag-cell");T&&O?.observe(T)}p()};return s.onMounted(()=>{O=new ResizeObserver(p),g(i.value)}),s.watch(i,g),s.onUnmounted(()=>{N=!0,O?.disconnect(),v!==void 0&&cancelAnimationFrame(v)}),e({refresh(_){return t.value=_,s.nextTick(p),!0}}),(_,T)=>{const S=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",Sl,[s.createElementVNode("span",xl,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(w))),(s.openBlock(),s.createBlock(s.resolveDynamicComponent(I),null,{default:s.withCtx(()=>[s.createVNode(S,{class:"table-data-grid-cell-tooltip",disabled:!n.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:u.value},{default:s.withCtx(()=>[s.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},s.toDisplayString(u.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(s.openBlock(),s.createElementBlock("span",Il,"("+s.toDisplayString(f.value)+")",1)):s.createCommentVNode("",!0)]),E.value?(s.openBlock(),s.createElementBlock("span",Dl,[s.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":E.value.value},null,8,kl),E.value.relative?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${E.value.relative})`},null,8,Nl)):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:`${R.value}%`})},null,4)],8,Al)):s.createCommentVNode("",!0)],10,vl)}}}),Ul=({headers:r,slots:e,initialSort:t,mode:i,rows:n,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,u=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);s.watch([r,()=>n?.value],()=>{r.value.forEach(m=>{if(!u(m))return;let R;if(a==="infinite"&&(m.showPercentage||m.bar)?R="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&n?.value?.some(C=>{const x=Reflect.get(C,m.key);return x!=null&&gt(x)===null})&&(R="contains non-finite or nonnumeric values; numeric presentation skips those values"),!R)return;const E=`${m.key}:${R}`;l.has(E)||(l.add(E),console.warn(`[TableDataGrid] Column "${m.key}" ${R}.`))})},{immediate:!0});const c=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(R=>R.showPercentage||R.bar).map(R=>[R.key,El(m,R)]))}),d=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(R=>R.bar).map(R=>[R.key,Tl({rows:m,header:R,stats:c.value[R.key]})]))}),h=s.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:d.value}})),f=m=>{const R=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,...R?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:E=>E.data?.[m.key],valueFormatter:E=>E.data?hr(m,E.data):String(E.value??""),width:m.width,cellRenderer:Ll,cellRendererParams:{headerDef:m}}};return{columnDefs:s.computed(()=>r.value.map(f)),gridContext:h}},Vt=({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?Vt({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=s.ref(a.value??Vt({config:void 0,headers:r.value,pageSize:e.value}));s.watch(a,h=>{h&&!pr(h,l.value)&&(l.value=h,o?.(h))});const u=h=>{const f=Vt({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||u({})},{deep:!0});const c=s.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),d=s.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:s.readonly(l),activeSort:c,activePageSize:d,patchTableConfig:u}},Ml=({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)}}},Bl=({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,u)=>(l.sortIndex??0)-(u.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}},zl={key:0,class:"table-error-state","data-testid":"table-error-state"},Pl={key:1,class:"table-empty-state","data-testid":"table-empty-state"},ql=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(),u=s.useTemplateRef("rootElement"),c=s.shallowRef("body"),d=()=>{const U=document.fullscreenElement;c.value=U instanceof HTMLElement&&U.contains(u.value??null)?U:"body"};s.onMounted(()=>{d(),document.addEventListener("fullscreenchange",d)}),s.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",d)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:R}=Kl({headers:s.toRef(()=>r.headers),pageSize:s.toRef(()=>r.pageSize),tableConfig:s.toRef(()=>r.tableConfig),emitSort:U=>i("sort",U),emitTableConfigUpdate:U=>i("update:tableConfig",U),onExternalConfigChange:U=>{l.value&&C(l.value,U)}}),{onSortChanged:E,applySortToGrid:C}=Bl({activeSort:f,patchTableConfig:R}),x=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),I=Qe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:w,onRowClick:O}=Ml({cellClick:U=>i("cell:click",U),headers:s.toRef(()=>r.headers),rowClick:(U,b)=>i("row:click",U,b)}),v={resizable:!1,sortable:!1,suppressMovable:!0},N=s.computed(()=>[m.value,r.refreshKey]),A=t==="infinite"?gl({fetcher:s.toRef(()=>r.fetcher),resetKey:N,sort:f}):void 0,p=A?.datasource,g=s.computed(()=>A?A.data.value:r.rows),_=s.computed(()=>A?.isFetching.value??!1),T=s.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:S,gridContext:L}=Ul({headers:s.toRef(()=>r.headers),mode:t,rows:T,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:q,state:V}=hl(g,s.toRef(()=>A?.error.value),_),P=s.computed(()=>V.value===K.SUCCESS&&!q.value);A&&fl({emitState:U=>i("state",U),fetchLifecycleState:V,hasData:q});const F=()=>{const U=l.value;if(!U||U.isDestroyed())return;const b=f.value,k=U.getColumnState().find(D=>D.sort);k?.colId===b.sortColumnKey&&(k?.sort??void 0)===b.sortColumnOrder||C(U,b)};s.watch([l,f],F);const M=U=>{l.value=U.api,i("grid:ready",U.api)};return(U,b)=>{const k=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"rootElement",ref:u,class:s.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":x.value}]),"data-testid":"table-data-grid"},[r.error?(s.openBlock(),s.createElementBlock("div",zl,[s.renderSlot(U.$slots,"error-state",{},()=>[s.createVNode(k,{"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",Pl,[s.renderSlot(U.$slots,"empty-state",{},()=>[s.createVNode(k,{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(S),context:s.unref(L),datasource:s.unref(t)==="infinite"?s.unref(p):void 0,"default-col-def":v,"dom-layout":x.value?"autoHeight":"normal","infinite-initial-row-count":s.unref(t)==="infinite"?1:void 0,loading:_.value,"row-data":s.unref(t)==="unpaginated"?T.value:void 0,"row-model-type":s.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:s.unref(I),onCellClicked:s.unref(w),onGridReady:M,onNewColumnsLoaded:F,onRowClicked:s.unref(O),onSortChanged:s.unref(E)},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)}}}),Hl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},gr=Hl(ql,[["__scopeId","data-v-01cd8bcd"]]),_r=3,Gl={anthropic:re.AnthropicIcon,azure:re.AzureIcon,bedrock:re.AmazonBedrockIcon,cerebras:re.CerebrasIcon,cohere:re.CohereIcon,databricks:re.DatabricksIcon,deepseek:re.DeepseekIcon,gemini:re.GeminiIcon,huggingface:re.HuggingFaceIcon,llama2:re.MetaLlamaIcon,mistral:re.MistralIcon,moonshot:re.KimiIcon,nvidia:re.NvidiaIcon,ollama:re.OllamaIcon,openai:re.OpenAiIcon,vertex:re.GoogleVertexIcon,vllm:re.VllmIcon,xai:re.GrokIcon},Yt=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},Fl=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!(Yt(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Gl[t.toLowerCase()]},$l=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},Wl=r=>r.toLocaleLowerCase().endsWith("count"),Vl=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]=$l(i.event[o])}),n})},Yl=({data:r,columnOptions:e,i18n:t,fieldTranslationMap:i})=>{const{formatUnit:n}=Z.unitFormatter({i18n:t}),o=r?.data??[],a=r?.meta,l=a?.display??{},u=Object.keys(l).slice(0,_r),c=a?.metric_names??[],d=c[0],h=u.length>1,f=O=>rr(t,i,O),m=(O,v)=>Yt(e,O)?.label||v,R=(O,v)=>{if(Wl(O)||O==="requests")return"";const N=v===1?"":"s",A=`chartUnits.${O}`;return t.messages[A]?t.formatMessage({id:A},{plural:N}):O},E=O=>{const v=N=>n(N,"%",{translateUnit:R});return O>0&&O<.01?`< ${v(.01)}`:v(O)},C=(O,v)=>{const N=O.event[v];if(N==null)return"–";const A=typeof N=="number"?N:Number(N);if(Number.isNaN(A))return"–";const p=a?.metric_units?.[v]||"count";return p==="%"?E(A):n(A,p,{approximate:["count","count/minute","token count"].includes(p),isBytes1024:!0,translateUnit:R})},x=(O,v)=>{const N=String(O.record.event[v]),A=l[v]?.[N];return{id:N,label:A?.name||"-",deleted:!!A?.deleted}},I=u.map(O=>({key:O,label:m(O,h?f(O):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(v,N)=>x(N,O).label,sortable:!1}));c.forEach(O=>{const v=Yt(e,O);I.push({key:O,label:v?.label||f(O),type:"metric",valueFormatter:(N,A)=>C(A.record,O),showPercentage:v?.value==="relative",percentageFormatter:E,bar:v?.bar==="max"?"absolute":v?.bar,thresholds:v?.thresholds,sortable:!1})});const w=o.length?a?u.some(O=>!Object.keys(l[O]||{}).length)?t.t("topNTable.errors.display"):d?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:I,errorMessage:w,getDimension:x}},Xl={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",Xl,s.toDisplayString(r.entityLinkData.label),1))}}),jl=["data-testid"],Ql={key:1},Zl=Ce(s.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=s.inject(Se),t=Te.useDatasourceConfigStore(),{i18n:i}=ae.useI18n(),n=s.computed(()=>Vl(r.data)),o=s.computed(()=>Yl({data:r.data,columnOptions:r.chartOptions.column_options,i18n:i,fieldTranslationMap:t.fieldTranslationMap})),a=s.computed(()=>o.value.headers.map(E=>({...E,minWidth:E.type==="dimension"?160:E.bar?260:140}))),l=s.computed(()=>o.value.headers.filter(E=>E.type==="dimension")),u=s.computed(()=>({fitToContent:r.fitToContent})),c=s.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),d=(E,C)=>Fl({columnOptions:r.chartOptions.column_options,columnKey:E,rawValue:C}),h=s.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return yr}return yr}),f=E=>{const C=r.chartOptions.entity_links;return C&&(C[E]||Object.entries(C).find(([x])=>x.toLowerCase()===E.toLowerCase())?.[1])||""},m=E=>f(E)||l.value[0]?.key===E&&r.chartOptions.entity_link||"",R=(E,C)=>{const x=m(C),I=String(E[C]);if(I.includes(":")){const[w,O]=I.split(":");return x.replace(Gi,w).replace(Mt,O)}return x.replace(Mt,I)};return(E,C)=>{const x=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{class:"top-n-data-grid","data-testid":n.value.length?"top-n-table":void 0,style:s.normalizeStyle(c.value)},[s.createVNode(s.unref(gr),{error:!!o.value.errorMessage,headers:a.value,mode:"unpaginated",rows:n.value,"table-config":u.value},s.createSlots({"error-state":s.withCtx(()=>[s.createVNode(x,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(re.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(o.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(x,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:s.unref(i).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":s.withCtx(({column:I,rowValue:w})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(d(I.key,w)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[s.renderList(l.value,I=>({name:I.key,fn:s.withCtx(({row:w})=>[m(I.key)&&w[I.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(h),{key:0,class:"top-n-entity-link","entity-link-data":o.value.getDimension(w,I.key),"external-link":R(w,I.key)},null,8,["entity-link-data","external-link"])):o.value.getDimension(w,I.key).label==="empty"?(s.openBlock(),s.createElementBlock("i",Ql,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,jl)}}}),[["__scopeId","data-v-5705b32b"]]),Jl=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(Zl,{"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"]))}}),ec=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,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===n.value.length&&(l.clear(),i("query-complete"))};return s.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(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=>u(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"]))}}),tc=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=({columns:r,fieldLabel:e})=>r.map(t=>({key:t,label:e(t)})),ic={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 u=n.query,c=a({datasource:n.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:n.datasource,query:{columns:u.columns,cursor:t===void 0?u.cursor:String(t),entity:u.entity,filters:c,page_size:i}},r);return d.meta.columns?.length&&o?.(d.meta.columns),{data:tc(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},rc={platform:Cr,platform_usage:Cr},nc=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(Se),o=Te.useDatasourceConfigStore(),a=ae.useFieldLabel(),l=new AbortController,u=s.ref([]),c=s.ref(!1),d=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(()=>ic[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,fieldLabel:C=>a(C)})),R=s.computed(()=>async({cursor:C,pageSize:x})=>{try{await o.isReady();const I=rc[h.value.datasource];if(!I)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const w=await I({abortController:l,context:t.context,cursor:C,pageSize:x,query:h.value,onResponseColumns:O=>{u.value=O},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:n?.tabularQueryFn});return c.value=!1,w}catch(I){throw c.value=!0,I}}),E=C=>{C.state==="error"&&(c.value=!0),i("loading-change",C.state==="loading")};return(C,x)=>{const I=s.resolveComponent("KSkeleton");return s.openBlock(),s.createElementBlock("div",{class:"table-data-grid-renderer",style:s.normalizeStyle(d.value)},[r.queryReady?(s.openBlock(),s.createBlock(s.unref(gr),{key:1,error:c.value,fetcher:R.value,headers:m.value,"page-size":r.query.page_size,"refresh-key":f.value,onState:E},null,8,["error","fetcher","headers","page-size","refresh-key"])):(s.openBlock(),s.createBlock(I,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c8caabc2"]]),sc=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(Wt,{"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"]))}}),oc="#ffffff",ac="#0044f4",lc="#d60027",cc="#ad000e",uc="#850000",dc="#5c0000",hc="#ff3954",fc="#ffabab",mc="#ffe5e5",pc="#ecfcff",gc="#6f28ff",_c="#f1f0ff",yc="#e0e4ea",Rc="#0044f4",Cc="#0030cc",Ec="#002099",Oc="#001466",bc="#5f9aff",wc="#bee2ff",Tc="#eefaff",vc="#0d0e14",Sc="#6c7489",xc="#52596e",Ic="#3a3f51",Dc="#232633",kc="#afb7c5",Nc="#e0e4ea",Ac="#f9fafb",Lc="rgba(13, 14, 20, 0.6)",Uc="#0044f4",Kc="#0030cc",Mc="#002099",Bc="#001466",zc="#5f9aff",Pc="#bee2ff",qc="#eefaff",Hc="#007d60",Gc="#005944",Fc="#004737",$c="#003629",Wc="#00d6a4",Vc="#b5ffee",Yc="#ecfffb",Xc="rgba(0, 0, 0, 0)",jc="#995c00",Qc="#804400",Zc="#662d00",Jc="#4d1b00",eu="#ffc400",tu="#fff296",iu="#fffce0",ru="#e0e4ea",nu="#0044f4",su="#d60027",ou="#ad000e",au="#850000",lu="#5c0000",cu="#ff3954",uu="#ffabab",du="#ffe5e5",hu="#6f28ff",fu="#e0e4ea",mu="rgba(255, 255, 255, 0.2)",pu="#6c7489",gu="#52596e",_u="#3a3f51",yu="#232633",Ru="#afb7c5",Cu="#e0e4ea",Eu="#f9fafb",Ou="#0044f4",bu="#0030cc",wu="#002099",Tu="#001466",vu="#5f9aff",Su="#bee2ff",xu="#eefaff",Iu="rgba(0, 0, 0, 0)",Du="#0044f4",ku="#0d0e14",Nu="#0044f4",Au="#d60027",Lu="#ad000e",Uu="#850000",Ku="#5c0000",Mu="#ff3954",Bu="#ffabab",zu="#ffe5e5",Pu="#00abd2",qu="#d60067",Hu="#6f28ff",Gu="#5e00f5",Fu="#afb7c5",$u="#0044f4",Wu="#0030cc",Vu="#002099",Yu="#001466",Xu="#5f9aff",ju="#bee2ff",Qu="#eefaff",Zu="#ffffff",Ju="#6c7489",ed="#52596e",td="#3a3f51",id="#232633",rd="#afb7c5",nd="#e0e4ea",sd="#f9fafb",od="#0044f4",ad="#0030cc",ld="#002099",cd="#001466",ud="#5f9aff",dd="#bee2ff",hd="#eefaff",fd="#007d60",md="#005944",pd="#004737",gd="#003629",_d="#00d6a4",yd="#b5ffee",Rd="#ecfffb",Cd="#995c00",Ed="#804400",Od="#662d00",bd="#4d1b00",wd="#ffc400",Td="#fff296",vd="#fffce0",Sd="0.2s",xd="0px",Id="2px",Dd="4px",kd="6px",Nd="8px",Ad="10px",Ld="50%",Ud="100px",Kd="0px",Md="1px",Bd="2px",zd="4px",Pd="640px",qd="768px",Hd="1024px",Gd="1280px",Fd="1536px",$d="'JetBrains Mono', Consolas, monospace",Wd="'Inter', Roboto, Helvetica, sans-serif",Xt="'Inter', Roboto, Helvetica, sans-serif",Vd="10px",Yd="12px",Xd="14px",jd="16px",Qd="18px",Zd="20px",Jd="24px",eh="32px",th="40px",ih="48px",rh="700",nh="500",sh="400",oh="600",ah="#f50045",lh="#828a9e",ch="#306fff",uh="#00a17b",dh="#ffc400",hh="10px",fh="12px",mh="16px",ph="20px",gh="24px",_h="32px",yh="40px",Rh="48px",Ch="normal",Eh="-0.12px",Oh="-0.24px",bh="-0.32px",wh="-0.4px",Th="-0.48px",vh="normal",Sh="12px",xh="16px",Ih="20px",Dh="24px",kh="28px",Nh="32px",Ah="36px",Lh="40px",Uh="48px",Kh="56px",Mh="#f1f0ff",Bh="#ffe5e5",zh="#eefaff",Ph="#52596e",qh="#e0e4ea",Hh="#ecfcff",Gh="#ecfffb",Fh="#fffce0",$h="#fff0f7",Wh="#6f28ff",Vh="#5e00f5",Yh="#d60027",Xh="#ad000e",jh="#0044f4",Qh="#0030cc",Zh="#e0e4ea",Jh="#afb7c5",ef="#52596e",tf="#3a3f51",rf="#00819d",nf="#00647a",sf="#007d60",of="#005944",af="#995c00",lf="#804400",cf="#d60067",uf="#ad0053",df="#000933",hf="rgba(255, 255, 255, 0.12)",ff="rgba(255, 255, 255, 0.12)",mf="#00fabe",pf="rgba(255, 255, 255, 0.24)",gf="#bee2ff",_f="#ffffff",yf="#eefaff",Rf="#00fabe",Cf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",Ef="4px 0 0 0 #00fabe inset",Of="0 0 0 1px rgba(255, 255, 255, 0.60) inset",bf="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",wf="0px 0px 0px 1px #e0e4ea inset",Tf="0px 0px 0px 1px #d60027 inset",vf="0px 0px 0px 1px #ad000e inset",Sf="0px 0px 0px 1px #e0e4ea inset",xf="0px 0px 0px 1px #0044f4 inset",If="0px 0px 0px 1px #001466 inset",Df="0px 0px 0px 1px #5f9aff inset",kf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Nf="0px",Af="2px",Lf="4px",Uf="6px",Kf="8px",Mf="12px",Bf="16px",zf="20px",Pf="24px",qf="32px",Hf="40px",Gf="48px",Ff="56px",$f="64px",Wf="80px",Vf="96px",Yf="auto",Xf="#bee2ff",jf="#8fc1ff",Qf="#5f9aff",Zf="#306fff",Jf="#b5ffee",em="#00fabe",tm="#00d6a4",im="#00a17b",rm="#007d60",nm="#005944",sm="#b5ffee",om="#00fabe",am="#b5ffee",lm="#00a17b",cm="#fff296",um="#ffe04b",dm="#ffc400",hm="#b37600",fm="#995c00",mm="#804400",pm="#fff296",gm="#ffe04b",_m="#ffc2b3",ym="#ff9877",Rm="#ff723c",Cm="#f75008",Em="#d13500",Om="#a31f00",bm="#ffc2b3",wm="#ff9877",Tm="#ff723c",vm="#f75008",Sm="#d13500",xm="#a31f00",Im="#ffc2b3",Dm="#ff9877",km="#ff723c",Nm="#f75008",Am="#d13500",Lm="#a31f00",Um="#ffc2b3",Km="#ff9877",Mm="#ff723c",Bm="#f75008",zm="#d13500",Pm="#a31f00",qm="#ffc2b3",Hm="#ff9877",Gm="#ff723c",Fm="#f75008",$m="#d13500",Wm="#ffabab",Vm="#ff7272",Ym="#ff3954",Xm="#f50045",jm="#d60027",Qm="#ad000e",Zm="#ffabab",Jm="#ff7272",ep="#ff3954",tp="#f50045",ip="#d60027",rp="#eefaff",np="#ecfffb",sp="#fffce0",op="#fff1ef",ap="#ffe5e5",lp="#5f9aff",cp="#00d6a4",up="#ffc400",dp="#ff723c",hp="#ff3954",fp="#eefaff",mp="#ecfffb",pp="#fffce0",gp="#fff1ef",_p="#ffe5e5",yp="#0044f4",Rp="#007d60",Cp="#995c00",Ep="#d13500",Op="#d60027",Er=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Sd,KUI_BORDER_RADIUS_0:xd,KUI_BORDER_RADIUS_10:Id,KUI_BORDER_RADIUS_20:Dd,KUI_BORDER_RADIUS_30:kd,KUI_BORDER_RADIUS_40:Nd,KUI_BORDER_RADIUS_50:Ad,KUI_BORDER_RADIUS_CIRCLE:Ld,KUI_BORDER_RADIUS_ROUND:Ud,KUI_BORDER_WIDTH_0:Kd,KUI_BORDER_WIDTH_10:Md,KUI_BORDER_WIDTH_20:Bd,KUI_BORDER_WIDTH_30:zd,KUI_BREAKPOINT_DESKTOP:Fd,KUI_BREAKPOINT_LAPTOP:Gd,KUI_BREAKPOINT_MOBILE:Pd,KUI_BREAKPOINT_PHABLET:qd,KUI_BREAKPOINT_TABLET:Hd,KUI_COLOR_BACKGROUND:oc,KUI_COLOR_BACKGROUND_ACCENT:ac,KUI_COLOR_BACKGROUND_DANGER:lc,KUI_COLOR_BACKGROUND_DANGER_STRONG:cc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:uc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:dc,KUI_COLOR_BACKGROUND_DANGER_WEAK:hc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:fc,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:mc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:pc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:gc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:_c,KUI_COLOR_BACKGROUND_DISABLED:yc,KUI_COLOR_BACKGROUND_INFO:Rc,KUI_COLOR_BACKGROUND_INFO_STRONG:Cc,KUI_COLOR_BACKGROUND_INFO_STRONGER:Ec,KUI_COLOR_BACKGROUND_INFO_STRONGEST:Oc,KUI_COLOR_BACKGROUND_INFO_WEAK:bc,KUI_COLOR_BACKGROUND_INFO_WEAKER:wc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Tc,KUI_COLOR_BACKGROUND_INVERSE:vc,KUI_COLOR_BACKGROUND_NEUTRAL:Sc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:xc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:Ic,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:Dc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:kc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:Nc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Ac,KUI_COLOR_BACKGROUND_OVERLAY:Lc,KUI_COLOR_BACKGROUND_PRIMARY:Uc,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Kc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:Mc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Bc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:zc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Pc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:qc,KUI_COLOR_BACKGROUND_SUCCESS:Hc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Gc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Fc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:$c,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:Wc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:Vc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Yc,KUI_COLOR_BACKGROUND_TRANSPARENT:Xc,KUI_COLOR_BACKGROUND_WARNING:jc,KUI_COLOR_BACKGROUND_WARNING_STRONG:Qc,KUI_COLOR_BACKGROUND_WARNING_STRONGER:Zc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:Jc,KUI_COLOR_BACKGROUND_WARNING_WEAK:eu,KUI_COLOR_BACKGROUND_WARNING_WEAKER:tu,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:iu,KUI_COLOR_BORDER:ru,KUI_COLOR_BORDER_ACCENT:nu,KUI_COLOR_BORDER_DANGER:su,KUI_COLOR_BORDER_DANGER_STRONG:ou,KUI_COLOR_BORDER_DANGER_STRONGER:au,KUI_COLOR_BORDER_DANGER_STRONGEST:lu,KUI_COLOR_BORDER_DANGER_WEAK:cu,KUI_COLOR_BORDER_DANGER_WEAKER:uu,KUI_COLOR_BORDER_DANGER_WEAKEST:du,KUI_COLOR_BORDER_DECORATIVE_PURPLE:hu,KUI_COLOR_BORDER_DISABLED:fu,KUI_COLOR_BORDER_INVERSE:mu,KUI_COLOR_BORDER_NEUTRAL:pu,KUI_COLOR_BORDER_NEUTRAL_STRONG:gu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:_u,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:yu,KUI_COLOR_BORDER_NEUTRAL_WEAK:Ru,KUI_COLOR_BORDER_NEUTRAL_WEAKER:Cu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:Eu,KUI_COLOR_BORDER_PRIMARY:Ou,KUI_COLOR_BORDER_PRIMARY_STRONG:bu,KUI_COLOR_BORDER_PRIMARY_STRONGER:wu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Tu,KUI_COLOR_BORDER_PRIMARY_WEAK:vu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Su,KUI_COLOR_BORDER_PRIMARY_WEAKEST:xu,KUI_COLOR_BORDER_TRANSPARENT:Iu,KUI_COLOR_BRAND:Du,KUI_COLOR_TEXT:ku,KUI_COLOR_TEXT_ACCENT:Nu,KUI_COLOR_TEXT_DANGER:Au,KUI_COLOR_TEXT_DANGER_STRONG:Lu,KUI_COLOR_TEXT_DANGER_STRONGER:Uu,KUI_COLOR_TEXT_DANGER_STRONGEST:Ku,KUI_COLOR_TEXT_DANGER_WEAK:Mu,KUI_COLOR_TEXT_DANGER_WEAKER:Bu,KUI_COLOR_TEXT_DANGER_WEAKEST:zu,KUI_COLOR_TEXT_DECORATIVE_AQUA:Pu,KUI_COLOR_TEXT_DECORATIVE_PINK:qu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Hu,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Gu,KUI_COLOR_TEXT_DISABLED:Fu,KUI_COLOR_TEXT_INFO:$u,KUI_COLOR_TEXT_INFO_STRONG:Wu,KUI_COLOR_TEXT_INFO_STRONGER:Vu,KUI_COLOR_TEXT_INFO_STRONGEST:Yu,KUI_COLOR_TEXT_INFO_WEAK:Xu,KUI_COLOR_TEXT_INFO_WEAKER:ju,KUI_COLOR_TEXT_INFO_WEAKEST:Qu,KUI_COLOR_TEXT_INVERSE:Zu,KUI_COLOR_TEXT_NEUTRAL:Ju,KUI_COLOR_TEXT_NEUTRAL_STRONG:ed,KUI_COLOR_TEXT_NEUTRAL_STRONGER:td,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:id,KUI_COLOR_TEXT_NEUTRAL_WEAK:rd,KUI_COLOR_TEXT_NEUTRAL_WEAKER:nd,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:sd,KUI_COLOR_TEXT_PRIMARY:od,KUI_COLOR_TEXT_PRIMARY_STRONG:ad,KUI_COLOR_TEXT_PRIMARY_STRONGER:ld,KUI_COLOR_TEXT_PRIMARY_STRONGEST:cd,KUI_COLOR_TEXT_PRIMARY_WEAK:ud,KUI_COLOR_TEXT_PRIMARY_WEAKER:dd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:hd,KUI_COLOR_TEXT_SUCCESS:fd,KUI_COLOR_TEXT_SUCCESS_STRONG:md,KUI_COLOR_TEXT_SUCCESS_STRONGER:pd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:gd,KUI_COLOR_TEXT_SUCCESS_WEAK:_d,KUI_COLOR_TEXT_SUCCESS_WEAKER:yd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:Rd,KUI_COLOR_TEXT_WARNING:Cd,KUI_COLOR_TEXT_WARNING_STRONG:Ed,KUI_COLOR_TEXT_WARNING_STRONGER:Od,KUI_COLOR_TEXT_WARNING_STRONGEST:bd,KUI_COLOR_TEXT_WARNING_WEAK:wd,KUI_COLOR_TEXT_WARNING_WEAKER:Td,KUI_COLOR_TEXT_WARNING_WEAKEST:vd,KUI_FONT_FAMILY_CODE:$d,KUI_FONT_FAMILY_HEADING:Wd,KUI_FONT_FAMILY_TEXT:Xt,KUI_FONT_SIZE_10:Vd,KUI_FONT_SIZE_100:ih,KUI_FONT_SIZE_20:Yd,KUI_FONT_SIZE_30:Xd,KUI_FONT_SIZE_40:jd,KUI_FONT_SIZE_50:Qd,KUI_FONT_SIZE_60:Zd,KUI_FONT_SIZE_70:Jd,KUI_FONT_SIZE_80:eh,KUI_FONT_SIZE_90:th,KUI_FONT_WEIGHT_BOLD:rh,KUI_FONT_WEIGHT_MEDIUM:nh,KUI_FONT_WEIGHT_REGULAR:sh,KUI_FONT_WEIGHT_SEMIBOLD:oh,KUI_ICON_COLOR_DANGER:ah,KUI_ICON_COLOR_NEUTRAL:lh,KUI_ICON_COLOR_PRIMARY:ch,KUI_ICON_COLOR_SUCCESS:uh,KUI_ICON_COLOR_WARNING:dh,KUI_ICON_SIZE_10:hh,KUI_ICON_SIZE_20:fh,KUI_ICON_SIZE_30:mh,KUI_ICON_SIZE_40:ph,KUI_ICON_SIZE_50:gh,KUI_ICON_SIZE_60:_h,KUI_ICON_SIZE_70:yh,KUI_ICON_SIZE_80:Rh,KUI_LETTER_SPACING_0:Ch,KUI_LETTER_SPACING_MINUS_10:Eh,KUI_LETTER_SPACING_MINUS_20:Oh,KUI_LETTER_SPACING_MINUS_30:bh,KUI_LETTER_SPACING_MINUS_40:wh,KUI_LETTER_SPACING_MINUS_50:Th,KUI_LETTER_SPACING_NORMAL:vh,KUI_LINE_HEIGHT_10:Sh,KUI_LINE_HEIGHT_100:Kh,KUI_LINE_HEIGHT_20:xh,KUI_LINE_HEIGHT_30:Ih,KUI_LINE_HEIGHT_40:Dh,KUI_LINE_HEIGHT_50:kh,KUI_LINE_HEIGHT_60:Nh,KUI_LINE_HEIGHT_70:Ah,KUI_LINE_HEIGHT_80:Lh,KUI_LINE_HEIGHT_90:Uh,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Mh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Bh,KUI_METHOD_COLOR_BACKGROUND_GET:zh,KUI_METHOD_COLOR_BACKGROUND_HEAD:Ph,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:qh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Hh,KUI_METHOD_COLOR_BACKGROUND_POST:Gh,KUI_METHOD_COLOR_BACKGROUND_PUT:Fh,KUI_METHOD_COLOR_BACKGROUND_TRACE:$h,KUI_METHOD_COLOR_TEXT_CONNECT:Wh,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:Vh,KUI_METHOD_COLOR_TEXT_DELETE:Yh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Xh,KUI_METHOD_COLOR_TEXT_GET:jh,KUI_METHOD_COLOR_TEXT_GET_STRONG:Qh,KUI_METHOD_COLOR_TEXT_HEAD:Zh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:Jh,KUI_METHOD_COLOR_TEXT_OPTIONS:ef,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:tf,KUI_METHOD_COLOR_TEXT_PATCH:rf,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:nf,KUI_METHOD_COLOR_TEXT_POST:sf,KUI_METHOD_COLOR_TEXT_POST_STRONG:of,KUI_METHOD_COLOR_TEXT_PUT:af,KUI_METHOD_COLOR_TEXT_PUT_STRONG:lf,KUI_METHOD_COLOR_TEXT_TRACE:cf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:uf,KUI_NAVIGATION_COLOR_BACKGROUND:df,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:hf,KUI_NAVIGATION_COLOR_BORDER:ff,KUI_NAVIGATION_COLOR_BORDER_CHILD:mf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:pf,KUI_NAVIGATION_COLOR_TEXT:gf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:_f,KUI_NAVIGATION_COLOR_TEXT_HOVER:yf,KUI_NAVIGATION_COLOR_TEXT_SELECTED:Rf,KUI_NAVIGATION_SHADOW_BORDER:Cf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:Ef,KUI_NAVIGATION_SHADOW_FOCUS:Of,KUI_SHADOW:bf,KUI_SHADOW_BORDER:wf,KUI_SHADOW_BORDER_DANGER:Tf,KUI_SHADOW_BORDER_DANGER_STRONG:vf,KUI_SHADOW_BORDER_DISABLED:Sf,KUI_SHADOW_BORDER_PRIMARY:xf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:If,KUI_SHADOW_BORDER_PRIMARY_WEAK:Df,KUI_SHADOW_FOCUS:kf,KUI_SPACE_0:Nf,KUI_SPACE_10:Af,KUI_SPACE_100:Hf,KUI_SPACE_110:Gf,KUI_SPACE_120:Ff,KUI_SPACE_130:$f,KUI_SPACE_140:Wf,KUI_SPACE_150:Vf,KUI_SPACE_20:Lf,KUI_SPACE_30:Uf,KUI_SPACE_40:Kf,KUI_SPACE_50:Mf,KUI_SPACE_60:Bf,KUI_SPACE_70:zf,KUI_SPACE_80:Pf,KUI_SPACE_90:qf,KUI_SPACE_AUTO:Yf,KUI_STATUS_COLOR_100:Xf,KUI_STATUS_COLOR_100S:lp,KUI_STATUS_COLOR_101:jf,KUI_STATUS_COLOR_102:Qf,KUI_STATUS_COLOR_103:Zf,KUI_STATUS_COLOR_1NA:rp,KUI_STATUS_COLOR_200:Jf,KUI_STATUS_COLOR_200S:cp,KUI_STATUS_COLOR_201:em,KUI_STATUS_COLOR_202:tm,KUI_STATUS_COLOR_203:im,KUI_STATUS_COLOR_204:rm,KUI_STATUS_COLOR_205:nm,KUI_STATUS_COLOR_206:sm,KUI_STATUS_COLOR_207:om,KUI_STATUS_COLOR_208:am,KUI_STATUS_COLOR_226:lm,KUI_STATUS_COLOR_2NA:np,KUI_STATUS_COLOR_300:cm,KUI_STATUS_COLOR_300S:up,KUI_STATUS_COLOR_301:um,KUI_STATUS_COLOR_302:dm,KUI_STATUS_COLOR_303:hm,KUI_STATUS_COLOR_304:fm,KUI_STATUS_COLOR_305:mm,KUI_STATUS_COLOR_307:pm,KUI_STATUS_COLOR_308:gm,KUI_STATUS_COLOR_3NA:sp,KUI_STATUS_COLOR_400:_m,KUI_STATUS_COLOR_400S:dp,KUI_STATUS_COLOR_401:ym,KUI_STATUS_COLOR_402:Rm,KUI_STATUS_COLOR_403:Cm,KUI_STATUS_COLOR_404:Em,KUI_STATUS_COLOR_405:Om,KUI_STATUS_COLOR_406:bm,KUI_STATUS_COLOR_407:wm,KUI_STATUS_COLOR_408:Tm,KUI_STATUS_COLOR_409:vm,KUI_STATUS_COLOR_410:Sm,KUI_STATUS_COLOR_411:xm,KUI_STATUS_COLOR_412:Im,KUI_STATUS_COLOR_413:Dm,KUI_STATUS_COLOR_414:km,KUI_STATUS_COLOR_415:Nm,KUI_STATUS_COLOR_416:Am,KUI_STATUS_COLOR_417:Lm,KUI_STATUS_COLOR_418:Um,KUI_STATUS_COLOR_421:Km,KUI_STATUS_COLOR_422:Mm,KUI_STATUS_COLOR_423:Bm,KUI_STATUS_COLOR_424:zm,KUI_STATUS_COLOR_425:Pm,KUI_STATUS_COLOR_426:qm,KUI_STATUS_COLOR_428:Hm,KUI_STATUS_COLOR_429:Gm,KUI_STATUS_COLOR_431:Fm,KUI_STATUS_COLOR_451:$m,KUI_STATUS_COLOR_4NA:op,KUI_STATUS_COLOR_500:Wm,KUI_STATUS_COLOR_500S:hp,KUI_STATUS_COLOR_501:Vm,KUI_STATUS_COLOR_502:Ym,KUI_STATUS_COLOR_503:Xm,KUI_STATUS_COLOR_504:jm,KUI_STATUS_COLOR_505:Qm,KUI_STATUS_COLOR_506:Zm,KUI_STATUS_COLOR_507:Jm,KUI_STATUS_COLOR_508:ep,KUI_STATUS_COLOR_510:tp,KUI_STATUS_COLOR_511:ip,KUI_STATUS_COLOR_5NA:ap,KUI_STATUS_COLOR_BACKGROUND_100:fp,KUI_STATUS_COLOR_BACKGROUND_200:mp,KUI_STATUS_COLOR_BACKGROUND_300:pp,KUI_STATUS_COLOR_BACKGROUND_400:gp,KUI_STATUS_COLOR_BACKGROUND_500:_p,KUI_STATUS_COLOR_TEXT_100:yp,KUI_STATUS_COLOR_TEXT_200:Rp,KUI_STATUS_COLOR_TEXT_300:Cp,KUI_STATUS_COLOR_TEXT_400:Ep,KUI_STATUS_COLOR_TEXT_500:Op},Symbol.toStringTag,{value:"Module"})),Or=Object.keys(Er).filter(r=>r.startsWith("KUI_COLOR")),br=r=>Er[r],bp=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(bp(t),br(t))]))},jt=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},wp=()=>typeof window>"u"?Xt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Xt,Tp=r=>{const e=wp(),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}}}},vp=r=>s.computed(()=>Tp(r.value)),Sp={class:"kong-ui-public-echarts-tooltip"},xp={class:"tooltip-title"},Ip={class:"title"},Dp={key:0,class:"subtitle"},kp={class:"context"},Np={class:"metric"},Ap={class:"tooltip-rows"},Lp={class:"display-value"},Up=s.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Sp,[s.createElementVNode("div",xp,[s.createElementVNode("div",Ip,s.toDisplayString(r.title),1),r.context||r.metric?(s.openBlock(),s.createElementBlock("div",Dp,[s.createElementVNode("div",kp,s.toDisplayString(r.context),1),s.createElementVNode("div",Np,s.toDisplayString(r.metric),1)])):s.createCommentVNode("",!0)]),s.createElementVNode("ul",Ap,[(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",Lp,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(Up,[["__scopeId","data-v-ca633353"]]),Qt=r=>Array.isArray(r)?r:[r],vr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,Zt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Mp=r=>Array.isArray(r)?r[r.length-1]:r,Bp=r=>{const e=Qt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>Zt(i,i.seriesName??"",Mp(i.value)))}},zp=r=>{let e;return s.getCurrentScope()&&s.onScopeDispose(()=>{e&&s.render(null,e)}),t=>{const i=(r()??Bp)(t);return i?(e??=document.createElement("div"),s.render(s.h(Kp,i),e),e):""}},Pp={class:"kong-ui-public-echarts"},qp=s.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){s.useCssVars(o=>({v1cecfeed:o.height})),wt.use([Hr.CanvasRenderer,lt.GridComponent,lt.TooltipComponent]);const e=jt(),t=vp(e),i=zp(()=>r.tooltipContent),n=s.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(s.openBlock(),s.createElementBlock("div",Pp,[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(qp,[["__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},Hp=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){wt.use([oi.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=jt(),t=a=>{const[l]=Qt(a),[u,c,d]=l.value;return{title:r.tooltipTitle,context:vr(u,r.xAxisLabels),metric:r.seriesName,rows:[Zt(l,vr(c,r.yAxisLabels),d,r.valueFormatter)]}},i=a=>({type:"slider",yAxisIndex:0,startValue:0,endValue:a-1,zoomLock:!0,right:10,width:8,handleSize:0,moveHandleSize:0,showDetail:!1,brushSelect:!1,showDataShadow:!1,borderColor:"transparent",backgroundColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST,fillerColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK}),n=s.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),u=r.valueFormatter?c=>r.valueFormatter(Number(c)):void 0;return{grid:{top:10,left:10,right:l?30:20,bottom:70,outerBoundsMode:"same",outerBoundsContain:"axisLabel"},xAxis:{type:"category",data:r.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:r.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:r.min??0,max:r.max??a.reduce((c,[,,d])=>Math.max(c,d),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:r.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:u},...l?{dataZoom:[i(r.visibleRows)]}:{},series:[nt({name:r.seriesName,type:"heatmap",data:a,animation:!1,label:{show:r.showValues??!1,formatter:r.valueFormatter?({value:c})=>r.valueFormatter(Number(c[2])):void 0},itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{shadowBlur:5,shadowColor:e.value.KUI_COLOR_BACKGROUND_OVERLAY}}},r.seriesOption)]}}),o=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"]))}}),Gp=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){wt.use([oi.TreemapChart]);const e=jt(),t=l=>{const[u]=Qt(l),c=u.treePathInfo??[];if(c.length===1)return;const d=c.slice(1,-1).map(({name:h})=>h);return{title:r.tooltipTitle,context:d.length?d.join(" / "):void 0,metric:r.seriesName,rows:[Zt(u,u.name,Number(u.value),r.valueFormatter)]}},i=()=>[e.value.KUI_COLOR_BACKGROUND_PRIMARY_WEAK,e.value.KUI_COLOR_BACKGROUND_SUCCESS_WEAK,e.value.KUI_COLOR_BACKGROUND_WARNING_WEAK,e.value.KUI_COLOR_BACKGROUND_DANGER_WEAK,e.value.KUI_COLOR_BACKGROUND_INFO_WEAK,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST],n=(l=[])=>l.reduce((u,c)=>Math.max(u,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:u})=>`${l}
13
+ ${r.valueFormatter?r.valueFormatter(Number(u)):String(u)}`:void 0}},r.seriesOption)]})),a=s.computed(()=>nt(o.value,r.option));return(l,u)=>(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},Fp=(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},$p=(r,e,t)=>{const i=[];for(let n=r;n<e;n+=t)i.push(n);return i},Wp=(r,e,t)=>{const i=o=>ra(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}))},Vp=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},Yp=(r,e)=>r[e]?.name??e,Xp=(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],u=t&&Object.keys(t).find(x=>x!=="time");if(!l||!u||!n||!o){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const c=a||Z.Granularities.daily,d=Z.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=r.data,m=Fp(new Date(n).getTime(),c,f.map(({timestamp:x})=>new Date(x).getTime())),R=$p(m,new Date(o).getTime(),c),E=[],C=[];for(const{timestamp:x,event:I}of f){const w=Math.floor((new Date(x).getTime()-m)/c),O=Ir(I[l]);w<0||w>=R.length||O===void 0||C.push([w,Vp(E,String(I[u])),O])}return{data:C,xAxisLabels:Wp(R,d,h),yAxisLabels:E.map(x=>Yp(t[u],x))}},jp={class:"wrapper","data-testid":"heatmap-chart"},Qp=10,Zp=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}=ae.useI18n(),o=ae.useMetricFormatter(),a=c=>{const d=Xp(c,{tz:t.context.tz});if(d?.data.length)return{data:d.data,xAxisLabels:d.xAxisLabels,yAxisLabels:d.yAxisLabels,...o(c)}},l=new WeakMap,u=c=>(l.has(c)||l.set(c,a(c)),l.get(c));return(c,d)=>{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:d[0]||(d[0]=f=>i("chart-data",f)),onQueryComplete:d[1]||(d[1]=f=>i("query-complete"))},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",jp,[u(f)?(s.openBlock(),s.createBlock(s.unref(Hp),s.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":Qp},u(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)}),Jp=(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},Jt=(r,e)=>!e.includes("time")&&(!r||Z.isMetricSupported("treemap",r)),Nr=(r,e)=>{r.value=Number(r.value??0)+e},eg=(r,e,t,[i,n],o)=>{const a=new Map,l=(u,c)=>String(u[c]);for(const{event:u}of r){const c=Ir(u[e]);if(c===void 0)continue;const d=l(u,i),h=kr(a,d,()=>({node:Jp(i,t[i],d,o),children:new Map}));if(!n){Nr(h.node,c);continue}const f=l(u,n),m=kr(h.children,f,()=>Dr(t[n],f,o));Nr(m,c)}return a},tg=(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(!Jt(n,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...eg(r.data,n,t,o,e).values()].map(({node:l,children:u})=>u.size?{...l,children:[...u.values()]}:l)},ig={class:"wrapper","data-testid":"treemap-chart"},rg=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}=ae.useI18n(),o=ae.useMetricFormatter(),a=s.computed(()=>Jt(t.query.metrics?.[0],t.query.dimensions??[])),l=d=>{const h=tg(d,{otherLabel:n.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(d)}},u=new WeakMap,c=d=>(u.has(d)||u.set(d,l(d)),u.get(d));return(d,h)=>{const f=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",ig,[a.value?c(m)?(s.openBlock(),s.createBlock(s.unref(Gp),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"]]),ng=["data-testid"],sg={key:0,class:"tile-header"},og={class:"badge-container"},ag={class:"badge-text"},lg={class:"badge-text"},cg={key:0,class:"metric-selector-wrapper"},ug={key:1},dg=["data-testid"],hg=["data-testid"],fg=["data-testid"],mg={class:"delete-option"},pg=["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(B=>({dfd92552:`${B.height}px`}));const i=parseInt(zi,10),n=ae.useFieldLabel(),{zoomConfiguration:o}=ae.useDashboardContext({context:s.computed(()=>r.context),preview:s.computed(()=>r.preview)}),a=s.useModel(r,"refreshCounter"),l=()=>{O.value=!0,a.value++},u=t,c=s.defineAsyncComponent(()=>Promise.resolve().then(()=>Ag)),d=s.inject(Se),h=Te.useDatasourceConfigStore(),{datasourceConfigMap:f,stripUnknownFilters:m}=Xe(h),{i18n:R}=ae.useI18n(),E=s.ref(),C=s.ref({status:"loading"}),x=s.ref(!1),I=s.ref(),w=s.ref(!1),O=s.ref(!0),v=s.computed(()=>r.definition.chart),N=s.computed(()=>"chart_title"in v.value?v.value.chart_title:void 0),A=s.computed(()=>r.definition.header_description),p=s.computed(()=>v.value.type==="slottable"),g=s.computed(()=>De(r.definition)||Pt(r.definition)?!1:!("allow_csv_export"in v.value)||v.value.allow_csv_export!==!1),{exploreLinkKebabMenu:_,requestsLinkKebabMenu:T,canShowKebabMenu:S,canGenerateRequestsLink:L,canGenerateExploreLink:K,requestsLinkZoomActions:q,exploreLinkZoomActions:V,buildExploreQuery:P,buildExploreLink:F,buildRequestLink:M,buildRequestsQueryZoomActions:U}=ae.useContextLinks({queryBridge:d,chartData:s.readonly(E),definition:s.toRef(()=>r.definition),context:s.readonly(s.toRef(()=>r.context))}),{issueQuery:b}=ae.useIssueQuery();s.watch(()=>r.definition,async(B,te)=>{await s.nextTick(),I.value&&(w.value=I.value.scrollWidth>I.value.clientWidth);try{JSON.stringify(B?.query)!==JSON.stringify(te?.query)&&(O.value=!0)}catch{}},{immediate:!0,deep:!0});const k=s.computed(()=>R.t("csvExport.defaultFilename")),D=s.computed(()=>!!_.value||g.value||!!r.context.editable),j=s.computed(()=>!r.hideActions&&S.value&&D.value),ne=s.computed(()=>j.value&&D.value&&!r.isFullscreen),ie={heatmap:Zp,treemap:rg,timeseries_line:ur,timeseries_bar:ur,scatter:cl,horizontal_bar:cr,vertical_bar:cr,gauge:lr,donut:sc,golden_signals:ul,top_n:Jl,top_talkers:ec,table:nc,slottable:void 0,single_value:lr,choropleth_map:c},Re=s.computed(()=>({...Y.value?.rendererEvents.supportsRequests?{"select-chart-range":He}:{},...Y.value?.rendererEvents.supportsZoom?{"zoom-time-range":Be}:{},...Y.value?.rendererEvents.supportsBounds?{"bounds-change":be}:{},...Y.value?.rendererEvents.supportsLoadingChange?{"loading-change":me}:{}})),Y=s.computed(()=>{const B=ie[r.definition.chart.type],te=De(r.definition),fe=!!B?.emits?.includes("select-chart-range"),Ge=!!B?.emits?.includes("zoom-time-range"),ze=r.definition.chart.type==="choropleth_map",Fe=!!B?.emits?.includes("loading-change"),ii={query:r.definition.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:a.value,zoomConfiguration:o.value},ri={chartOptions:r.definition.chart,activeMetric:J.value,headerDescription:A.value,requestsLink:o.value.showRequestsAction?q.value:void 0,exploreLink:o.value.showExploreAction?V.value:void 0};return B&&{component:B,rendererProps:{...ii,...te?{}:ri,...r.definition.chart.type==="top_n"?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:fe,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:Fe}}}),X=s.computed(()=>{if(De(r.definition))return null;const B=r.definition.query,te=B?.time_range;if(Z.isPlatformDatasource(B?.datasource)&&!B.dimensions?.includes("time"))return R.t("renderer.as_of_today");if(te?.type==="relative"){const fe=Z.TimePeriods.get(Z.TIMEFRAME_LOOKUP[te.time_range]);return fe?fe.display:(console.warn("Did not recognize the given relative time range:",te.time_range),te.time_range)}else if(te?.type==="absolute"){const fe=te.tz||"Etc/UTC";return`${Z.formatTime(te.start,{short:!0,tz:fe})} - ${Z.formatTime(te.end,{short:!0,tz:fe})}`}return null}),le=s.computed(()=>{const B=r.definition.query,te=B?.datasource,fe=te?f.value[te]?.timeRangeOptions:void 0,ze=(B&&"time_range"in B?B.time_range:void 0)??r.context.timeSpec;return Gt(ze,fe)}),G=s.computed(()=>p.value?!1:[!!N.value,ne.value,!!X.value,le.value,!!A.value,r.showRefresh,_e.value].some(Boolean)),ce=s.computed(()=>E.value?Z.msToGranularity(E.value.meta.granularity_ms):void 0),ue=s.computed(()=>["timeseries_line","timeseries_bar"].includes(v.value.type)),ee=s.computed(()=>E.value?.meta.metric_names??[]),J=s.ref();s.watch(ee,B=>{(!J.value||!B.includes(J.value))&&(J.value=B[0])},{immediate:!0});const Q=s.computed(()=>{const B=v.value;return B.type!=="timeseries_line"?!1:ee.value.some(te=>B.metric_axis_map?.[te]==="right")}),_e=s.computed(()=>ue.value&&!Q.value&&(E.value?.data.length??0)>0&&ee.value.length>1&&Object.keys(E.value?.meta.display??{}).length>0),$=s.computed(()=>ee.value.map(B=>({value:B,label:n(B)}))),oe=s.computed(()=>{if(!qt(r.definition)||!ue.value||!r.queryReady||O.value)return!1;const B=r.definition.query.granularity;return!B||!ce.value?!1:B!==ce.value}),Ae=s.computed(()=>{const B=Z.msToGranularity(E.value?.meta.granularity_ms??0)??"unknown",te=qt(r.definition)?r.definition.query.granularity??"unknown":"unknown";return R.t("query_aged_out_warning",{currentGranularity:R.t(`granularities.${B}`),savedGranularity:R.t(`granularities.${te}`)})}),Me=s.computed(()=>{const B=[...r.context.filters,...r.definition.query.filters??[]],te="metrics"in r.definition.query?r.definition.query.metrics:void 0,fe=r.definition.query.datasource??"api_usage";return m.value({datasource:fe,filters:B,queryFields:te})}),Ee=()=>{u("edit-tile",r.definition)},qe=()=>{u("duplicate-tile",r.definition)},he=()=>{u("remove-tile",r.definition)},Oe=B=>{E.value=B,O.value=!1,u("chart-data",B),u("tile-loaded")},de=()=>{O.value=!1,u("tile-loaded")},me=B=>{O.value=B,B||u("tile-loaded")},Ie=()=>{x.value=!1},je=()=>{if(Pt(r.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const B=r.definition.query.datasource?.startsWith("goap");return d?.staticConfig?.increaseCsvExportLimit!==!1&&!B?b(r.definition.query,r.context,Z.EXPORT_RECORD_LIMIT):E.value?Promise.resolve(E.value):new Promise(fe=>{const Ge=s.watch(E,ze=>{ze&&(fe(ze),Ge())})})},bt=async()=>{x.value=!0,C.value={status:"loading"};try{const B=await je();C.value={status:"success",chartData:B}}catch(B){C.value={status:"error",error:B}}},Be=B=>{const te={tileId:r.tileId.toString(),timeRange:B};u("tile-time-range-zoom",te)},be=B=>{const te={tileId:r.tileId.toString(),bounds:B};u("tile-bounds-change",te)},He=B=>{const te=Me.value,fe=P(B,te);V.value=K.value?{href:F(fe)}:void 0,q.value=L.value?{href:M(U(B,te))}:void 0};return e({getExportData:je}),(B,te)=>{const fe=s.resolveComponent("KTooltip"),Ge=s.resolveComponent("KBadge"),ze=s.resolveComponent("KButton"),Fe=s.resolveComponent("KDropdownItem"),ii=s.resolveComponent("KDropdown");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["tile-boundary",{editable:r.context.editable,headless:!G.value}]),"data-testid":`tile-${r.tileId}`},[G.value&&!p.value?(s.openBlock(),s.createElementBlock("div",sg,[s.createVNode(fe,{class:"title-tooltip",disabled:!w.value,"max-width":"500",text:N.value},{default:s.withCtx(()=>[s.createElementVNode("div",{ref_key:"titleRef",ref:I,class:"title"},s.toDisplayString(N.value),513)]),_:1},8,["disabled","text"]),s.createElementVNode("div",og,[le.value?(s.openBlock(),s.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:s.unref(R).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:s.withCtx(()=>[s.createVNode(s.unref(re.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Ki)})`},null,8,["size"])]),default:s.withCtx(()=>[s.createElementVNode("span",ag,s.toDisplayString(s.unref(R).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):s.createCommentVNode("",!0),X.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",lg,s.toDisplayString(X.value),1)]),_:2},[oe.value?{name:"icon",fn:s.withCtx(()=>[s.createVNode(s.unref(re.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Ki)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):s.createCommentVNode("",!0)]),_e.value?(s.openBlock(),s.createElementBlock("div",cg,[s.createVNode(s.unref(Pr.KSegmentedControl),{modelValue:J.value,"onUpdate:modelValue":te[0]||(te[0]=ri=>J.value=ri),class:"metric-selector","data-testid":"metric-selector",options:$.value},null,8,["modelValue","options"])])):s.createCommentVNode("",!0),r.showRefresh?(s.openBlock(),s.createElementBlock("div",ug,[s.createVNode(ze,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${r.tileId}`,disabled:O.value,icon:"",size:"small",onClick:l},{default:s.withCtx(()=>[O.value?(s.openBlock(),s.createBlock(s.unref(re.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(re.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),A.value?(s.openBlock(),s.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${r.tileId}`},s.toDisplayString(A.value),9,dg)):s.createCommentVNode("",!0),j.value?(s.openBlock(),s.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${r.tileId}`},[j.value&&r.context.editable&&!r.isFullscreen?(s.openBlock(),s.createBlock(s.unref(re.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${s.unref(Kt)})`,"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),j.value&&D.value&&!r.isFullscreen?(s.openBlock(),s.createBlock(ii,{key:1,class:"dropdown","data-testid":`chart-action-menu-${r.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:s.withCtx(()=>[s.unref(_)?(s.openBlock(),s.createBlock(Fe,{key:0,"data-testid":`chart-jump-to-explore-${r.tileId}`,item:{label:s.unref(R).t("jumpToExplore"),to:s.unref(_)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),!s.unref(De)(r.definition)&&s.unref(T)?(s.openBlock(),s.createBlock(Fe,{key:1,"data-testid":`chart-jump-to-requests-${r.tileId}`,item:{label:s.unref(R).t("jumpToRequests"),to:s.unref(T)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),g.value?(s.openBlock(),s.createBlock(Fe,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${r.tileId}`,onClick:bt},{default:s.withCtx(()=>[s.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${r.tileId}`},s.toDisplayString(s.unref(R).t("csvExport.exportAsCsv")),9,fg)]),_: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(R).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:he},{default:s.withCtx(()=>[s.createElementVNode("span",mg,s.toDisplayString(s.unref(R).t("renderer.delete")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(re.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${s.unref(Kt)})`,"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,hg)):s.createCommentVNode("",!0),x.value?(s.openBlock(),s.createBlock(sr,{key:4,"data-testid":`csv-export-modal-${r.tileId}`,"export-state":C.value,filename:k.value,onCloseModal:Ie},null,8,["data-testid","export-state","filename"])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["tile-content",`type-${r.tileType}-${v.value.type}`]),"data-testid":`tile-content-${r.tileId}`},[Y.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(Y.value.component),s.mergeProps({key:0},Y.value.rendererProps,s.toHandlers(Re.value),{onChartData:Oe,onQueryComplete:de}),null,16)):s.createCommentVNode("",!0)],10,pg)],10,ng)}}}),[["__scopeId","data-v-06880303"]]),gg=(r,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),u=o.layout.size.rows===1&&!!o.layout.size.fit_to_content;t=Math.max(t,a+o.layout.size.rows),l===void 0?i.set(a,u):i.set(a,l&&u)});const 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:()=>pt},tiles:{type:Array,required:!0}},setup(r){s.useCssVars(u=>({v6834ae83:e.columns,v9c95201e:a.value}));const e=r,t=s.ref(null),i=s.ref(0),n=new ResizeObserver(u=>{window.requestAnimationFrame(()=>{!Array.isArray(u)||!u.length||(i.value=u[0].contentRect.width)})});s.onMounted(()=>{t.value&&n.observe(t.value)}),s.onUnmounted(()=>{t.value&&n.unobserve(t.value)});const o=s.computed(()=>gg(e.tileHeight,e.tiles)),a=s.computed(()=>o.value.join(" ")),l=s.computed(()=>e.tiles.map((u,c)=>({key:`tile-${c}`,tile:u,style:{"grid-column-start":u.layout.position.col+1,"grid-column-end":u.layout.position.col+1+u.layout.size.cols,"grid-row-start":u.layout.position.row+1,"grid-row-end":u.layout.position.row+1+u.layout.size.rows}})));return(u,c)=>(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,d=>(s.openBlock(),s.createElementBlock("div",{key:d.key,class:s.normalizeClass(["grid-cell",{"empty-cell":!d.tile}]),style:s.normalizeStyle(d.style)},[s.renderSlot(u.$slots,"tile",{fitToContent:o.value[d.tile.layout.position.row]==="auto",style:s.normalizeStyle(d.style),tile:d.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-aa4f1c68"]]);function _g(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 y{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 y.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&&(y.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,u=this.getScrollElement(e);if(u!==null){const c=u.scrollTop;n.top<0&&i<0?e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=a>i?i:a),t.top+=u.scrollTop-c}}}static updateScrollResize(e,t,i){const n=this.getScrollElement(t),o=n.clientHeight,a=n===this.getScrollElement()?0:n.getBoundingClientRect().top,l=e.clientY-a,u=l<i,c=l>o-i;u?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=y.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]=y.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=y.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");y.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 ke{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 u=0;for(;i=i||this.collide(e,o,n.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...l};c=this._loading&&y.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&c?y.copyPos(t,e):!i.locked&&c&&n.pack&&(this._packNodes(),t.y=i.y+i.h,y.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&&y.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&&y.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 u of i){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,h=Number.MAX_VALUE;n.y<c.y?d=(o.y+o.h-c.y)/c.h:n.y+n.h>c.y+c.h&&(d=(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,d);f>l&&(l=f,a=u)}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=y.isTouching(e,t)))return i();if(n!==!1){if(e.w===t.w&&e.x===t.x&&(n||(n=y.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=y.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,u)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=u[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=y.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??ke._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 y.defaults(e,n),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,y.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||y.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),y.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!y.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=y.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||y.samePos(e,e._orig)||(y.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 u=l%i,c=Math.floor(l/i);if(u+e.w>i)continue;const d={x:u,y:c,w:e.w,h:e.h};t.find(h=>y.isIntercepted(d,h))||((e.x!==u||e.y!==c)&&(e._dirty=!0),e.x=u,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,t=!1,i){const 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 ke({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(u=>u._id===a._id);l&&(y.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new ke({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=y.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=y.copyPos({},e,!0);if(y.copyPos(o,t),this.nodeBoundFix(o,n),y.copyPos(t,o),!t.forceCollide&&y.samePos(e,t))return!1;const a=y.copyPos({},e),l=this.collideAll(e,o,t.skip);let u=!0;if(l.length){const c=e._moving&&!t.nested;let d=c?this.directionCollideCoverage(e,t,l):l[0];if(c&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=y.areaIntercept(t.rect,d._rect),f=y.area(t.rect),m=y.area(d._rect);h/(f<m?f:m)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?u=!this._fixCollisions(e,o,d,t):(u=!1,i&&delete t.pack)}return u&&!y.samePos(e,o)&&(e._dirty=!0,y.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!y.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),u={...a,...l||{}};y.removeInternalForSave(u,!e),t&&t(a,u),o.push(u)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const 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:y.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],u=this._layouts.length-1;!l.length&&e!==u&&this._layouts[u]?.length&&(e=u,this._layouts[u].forEach(c=>{const d=a.find(h=>h._id===c._id);d&&(!n&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=!0))})),l.forEach(c=>{const d=a.findIndex(h=>h._id===c._id);if(d!==-1){const h=a[d];if(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(d,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,u=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(d=>{d.x=t===1?0:u?Math.round(d.x*l):Math.min(d.x,t-1),d.w=t===1||e===1?1:c?Math.round(d.w*l)||1:Math.min(d.w,t),o.push(d)}),a=[]}o=y.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(u=>u.id===o.id):void 0;o._id=l?._id??ke._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??ke._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}}ke._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 xe=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 Ne{}function _t(r,e){r.touches.length>1||(r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r.changedTouches[0],e))}function Ur(r,e){r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r,e)}function yt(r){Ne.touchHandled||(Ne.touchHandled=!0,_t(r,"mousedown"))}function Rt(r){Ne.touchHandled&&_t(r,"mousemove")}function Ct(r){if(!Ne.touchHandled)return;Ne.pointerLeaveTimeout&&(window.clearTimeout(Ne.pointerLeaveTimeout),delete Ne.pointerLeaveTimeout);const e=!!H.dragElement;_t(r,"mouseup"),e||_t(r,"click"),Ne.touchHandled=!1}function Et(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"&&(Ne.pointerLeaveTimeout=window.setTimeout(()=>{delete Ne.pointerLeaveTimeout,Ur(r,"mouseleave")},10))}class Ot{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(`${Ot.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),xe&&(this.el.addEventListener("touchstart",yt),this.el.addEventListener("pointerdown",Et)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),xe&&(this.el.removeEventListener("touchstart",yt),this.el.removeEventListener("pointerdown",Et)),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),xe&&(this.el.addEventListener("touchmove",Rt),this.el.addEventListener("touchend",Ct)),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),xe&&(this.el.removeEventListener("touchmove",Rt),this.el.removeEventListener("touchend",Ct)),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}}Ot.prefix="ui-resizable-";class ei{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 ei{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 Ot(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=y.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=y.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=y.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=y.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=y.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=y.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,u;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,u=!0);const c=this._constrainSize(n.width,n.height,l,u);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,u=(n?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,d=Math.min(a,Math.max(l,e)),h=Math.min(u,Math.max(c,t));return{width:d,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top: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 yg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ot extends ei{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),xe&&(e.addEventListener("touchstart",yt),e.addEventListener("pointerdown",Et))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),xe&&(t.removeEventListener("touchstart",yt),t.removeEventListener("pointerdown",Et))}),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(yg)||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),xe&&(e.currentTarget.addEventListener("touchmove",Rt),e.currentTarget.addEventListener("touchend",Ct)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),H.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=y.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=y.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const n=y.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),xe&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Rt,!0),e.currentTarget.removeEventListener("touchend",Ct,!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=y.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(!y.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",y.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=y.cloneNode(this.el)),e.parentElement||y.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 Rg extends ei{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),xe&&(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),xe&&(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=y.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=y.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=y.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 ti{static init(e){return e.ddElement||(e.ddElement=new ti(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 Rg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Cg{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 u=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:u,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,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=y.getElements(e);return n.length?n.map(a=>a.ddElement||(i?ti.init(a):null)).filter(a=>a):[]}}const ge=new Cg;class z{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=z.getGridElement(t);return i?(i.gridstack||(i.gridstack=new z(i,y.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
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"||(z.getGridElements(t).forEach(n=>{n.gridstack||(n.gridstack=new z(n,y.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
+ 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")||z.addRemoveCB)&&(z.addRemoveCB?i=z.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),z.init(t,i)}static registerEngine(e){z.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=y.createDiv([this.opts.placeholderClass,ye.itemClass,this.opts.itemClass]);const e=y.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=y.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={...y.cloneDeep(ye),column:y.toNumber(e.getAttribute("gs-column"))||ye.column,minRow:i||y.toNumber(e.getAttribute("gs-min-row"))||ye.minRow,maxRow:i||y.toNumber(e.getAttribute("gs-max-row"))||ye.maxRow,staticGrid:y.toBool(e.getAttribute("gs-static"))||ye.staticGrid,sizeToContent:y.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=y.toBool(e.getAttribute("gs-animate"))),t=y.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=xe),this._styleSheetClass="gs-id-"+ke._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const d=t.engineClass||z.engineClass||ke;if(this.engine=new d({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{let f=0;this.engine.nodes.forEach(m=>{f=Math.max(f,m.y+m.h)}),h.forEach(m=>{const R=m.el;R&&(m._removeDOM?(R&&R.remove(),delete m._removeDOM):this._writePosAttr(R,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:z.addRemoveCB?t=z.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 y.defaults(e,n),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=y.createDiv(["grid-stack-item",this.opts.itemClass]),i=y.createDiv(["grid-stack-item-content"],t);return y.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([n])=>{n.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,z.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):z.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=y.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let u;t.column==="auto"&&(u=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let c=o.el.querySelector(".grid-stack-item-content"),d,h;if(n&&(this._removeDD(o.el),h={...o,x:0,y:0},y.removeInternalForSave(h),delete h.subGridOpts,o.content&&(h.content=o.content,delete o.content),z.addRemoveCB?d=z.addRemoveCB(this.el,h,!0,!1):(d=y.createDiv(["grid-stack-item"]),d.appendChild(c),c=y.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const m=u?t.column:o.w,R=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:m,h:R}),setTimeout(()=>E.transition=null)}const f=o.subGrid=z.addGrid(c,t);return i?._moving&&(f._isTemp=!0),u&&(f._autoColumn=!0),n&&f.makeWidget(d,h),i&&(i._moving?window.setTimeout(()=>y.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(()=>y.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=z.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=y.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,y.removeInternalAndSame(o,ye),o.children=n,o}return n}load(e,t=z.addRemoveCB||!0){e=y.cloneDeep(e);const i=this.getColumn();e.forEach(c=>{c.w=c.w||1,c.h=c.h||1}),e=y.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=z.addRemoveCB;typeof t=="function"&&(z.addRemoveCB=t);const a=[];this.batchUpdate();const l=!this.engine.nodes.length;l&&this.setAnimation(!1),!l&&t&&[...this.engine.nodes].forEach(d=>{if(!d.id)return;y.find(e,d.id)||(z.addRemoveCB&&z.addRemoveCB(this.el,d,!1,!1),a.push(d),this.removeWidget(d.el,!0,!1))}),this.engine._loading=!0;const u=[];return this.engine.nodes=this.engine.nodes.filter(c=>y.find(e,c.id)?(u.push(c),!1):!0),e.forEach(c=>{const d=y.find(u,c.id);if(d){if(y.shouldSizeToContent(d)&&(c.h=d.h),this.engine.nodeBoundFix(c),(c.autoPosition||c.x===void 0||c.y===void 0)&&(c.w=c.w||d.w,c.h=c.h||d.h,this.engine.findEmptyPosition(c)),this.engine.nodes.push(d),y.samePos(d,c)&&this.engine.nodes.length>1&&(this.moveNode(d,{...c,forceCollide:!0}),y.copyPos(c,d)),this.update(d.el,c),c.subGridOpts?.children){const h=d.el.querySelector(".grid-stack");h&&h.gridstack&&h.gridstack.load(c.subGridOpts.children)}}else t&&this.addWidget(c)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?z.addRemoveCB=o:delete z.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=y.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=y.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(),u=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,n){return this.engine.isAreaEmpty(e,t,i,n)}makeWidget(e,t){const i=z.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?(z.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&&z.addRemoveCB&&z.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&&z.addRemoveCB&&z.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 z.getElements(e).forEach(i=>{const n=i?.gridstackNode;if(!n)return;const o={...y.copyPos({},n),...y.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const a=["x","y","w","h"];let l;if(a.some(d=>o[d]!==void 0&&o[d]!==n[d])&&(l={},a.forEach(d=>{l[d]=o[d]!==void 0?o[d]:n[d],delete o[d]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(n.content=o.content,z.renderCB(d,o),n.subGrid?.el&&(d.appendChild(n.subGrid.el),n.subGrid.opts.styleInHead||n.subGrid._updateStyles(!0))),delete o.content}let u=!1,c=!1;for(const d in o)d[0]!=="_"&&n[d]!==o[d]&&(n[d]=o[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(y.sanitizeMinMax(n),l){const d=l.w!==void 0&&l.w!==n.w;this.moveNode(n,l),d&&n.subGrid?n.subGrid.onResize(this.hasAnimationCSS()?n.w:void 0):this.resizeToContentCheck(d,n),delete n._orig}(l||u)&&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(z.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=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} '${z.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||u}}if(u===c)return;o+=c-u;let d=Math.ceil(o/n);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&d>h&&(d=h,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){z.resizeToContentCB?z.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return z.getElements(e).forEach(i=>{const n=i.gridstackNode;if(!y.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,u=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=n.x+l-(n.h-(u+1)),o.y=n.y+u-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=y.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;y.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=y.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,y.addCSSRule(this._styles,o,`height: ${i}${n}`);const l=this.opts.marginTop+this.opts.marginUnit,u=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,d=this.opts.marginLeft+this.opts.marginUnit,h=`${o} > .grid-stack-item-content`,f=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;y.addCSSRule(this._styles,h,`top: ${l}; right: ${c}; bottom: ${u}; left: ${d};`),y.addCSSRule(this._styles,f,`top: ${l}; right: ${c}; bottom: ${u}; left: ${d};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${l};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${u}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-ne`,`right: ${c}; top: ${l}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-e`,`right: ${c}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-se`,`right: ${c}; bottom: ${u}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${d}; top: ${l}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${d}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-sw`,`left: ${d}; bottom: ${u}`)}if(t=t||this._styles._max,t>this._styles._max){const a=l=>i*l+n;for(let l=this._styles._max+1;l<=t;l++)y.addCSSRule(this._styles,`${o}[gs-y="${l}"]`,`top: ${a(l)}`),y.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=y.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&&y.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=y.shouldSizeToContent(i);return n?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),n&&this.resizeToContentCheck(!1,i),y.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=y.toNumber(e.getAttribute("gs-x")),i.y=y.toNumber(e.getAttribute("gs-y")),i.w=y.toNumber(e.getAttribute("gs-w")),i.h=y.toNumber(e.getAttribute("gs-h")),i.autoPosition=y.toBool(e.getAttribute("gs-auto-position")),i.noResize=y.toBool(e.getAttribute("gs-no-resize")),i.noMove=y.toBool(e.getAttribute("gs-no-move")),i.locked=y.toBool(e.getAttribute("gs-locked"));const n=e.getAttribute("gs-size-to-content");n&&(n==="true"||n==="false"?i.sizeToContent=y.toBool(n):i.sizeToContent=parseInt(n,10)),i.id=e.getAttribute("gs-id"),i.maxW=y.toNumber(e.getAttribute("gs-max-w")),i.minW=y.toNumber(e.getAttribute("gs-min-w")),i.maxH=y.toNumber(e.getAttribute("gs-max-h")),i.minH=y.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)y.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>y.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(n=>{y.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=y.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 y.getElement(e)}static getElements(e=".grid-stack-item"){return y.getElements(e)}static getGridElement(e){return z.getElement(e)}static getGridElements(e){return y.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=y.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=y.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=y.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=y.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=y.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 ge}static setupDragIn(e,t,i,n=document){t?.pause!==void 0&&(H.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?y.getElements(e,n):e).forEach((a,l)=>{ge.isDraggable(a)||ge.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:(z.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:(z.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&&z._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return ge.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 ge.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:u,left:c}=a.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;const h={position:{top:u*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/t)),l.y=Math.max(0,Math.round(u/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){ge.off(o,"drag");return}l._willFitPos&&(y.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 ge.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 d=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(d){try{l=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const u=l.w||Math.round(a.offsetWidth/t)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=l),o.gridstackNode=l={...l,w:u,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=u,l.h=c,l._temporaryRemoved=!0),z._itemRemoving(l.el,!1),ge.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 u=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const d=u&&this.opts.animate;d&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,u&&h?.grid&&h.grid!==this){const m=h.grid;m.engine.removeNodeFromLayoutCache(h),m.engine.removedNodes.push(h),m._triggerRemoveEvent()._triggerChangeEvent(),m.parentGridNode&&!m.engine.nodes.length&&m.opts.subGridDynamic&&m.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,ge.off(o,"drag"),a!==o?(a.remove(),o=a):o.remove(),this._removeDD(o),!u))return!1;const f=l.subGrid?.el?.gridstack;return y.copyPos(l,this._readAttr(this.placeholder)),y.removePositioningStyles(o),c&&(l.content||l.subGridOpts||z.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),d&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!ge.isDroppable(e)&&ge.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>z._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>z._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,u;const c=(f,m)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,f,m,i,l,u)},d=(f,m)=>{this._dragOrResize(e,f,m,i,l,u)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const m=i.w!==i._orig.w,R=f.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const E=e.gridstackNode.grid;E._gsEventHandler[f.type]&&E._gsEventHandler[f.type](f,R),E.engine.nodes.push(i),E.removeWidget(e,!0,!0)}else y.removePositioningStyles(R),i._temporaryRemoved?(y.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,R);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))}};ge.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return ge.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=y.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=y.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,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-n.y;ge.resizable(e,"option","minWidth",o*Math.min(n.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(n.minH||1,u)).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,u)).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 u,c=this.opts.marginLeft,d=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const m=Math.round(a*.1),R=Math.round(o*.1);if(c=Math.min(c,R),d=Math.min(d,R),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&&y.updateScrollPosition(e,i.position,C);const x=i.position.left+(i.position.left>n._lastUiPosition.left?-d:c),I=i.position.top+(i.position.top>n._lastUiPosition.top?-f:h);l.x=Math.round(x/o),l.y=Math.round(I/a);const w=this._extraDragRow;if(this.engine.collide(n,l)){const O=this.getRow();let v=Math.max(0,l.y+n.h-O);this.opts.maxRow&&O+v>this.opts.maxRow&&(v=Math.max(0,this.opts.maxRow-O)),this._extraDragRow=v}else this._extraDragRow=0;if(this._extraDragRow!==w&&this._updateContainerHeight(),n.x===l.x&&n.y===l.y)return}else if(t.type==="resize"){if(l.x<0||(y.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,x=i.position.top+h;l.x=Math.round(C/o),l.y=Math.round(x/a),u=!0}n._event=t,n._lastTried=l;const E={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:n.w*o)-c-d,h:(i.size?i.size.height:n.h*a)-h-f};if(this.engine.moveNodeCheck(n,{...l,cellWidth:o,cellHeight:a,rect:E,resizing:u})){n._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,d,f,c),delete n._skipDown,u&&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,ge.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&&z._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return _g(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}z.renderCB=(r,e)=>{r&&e?.content&&(r.textContent=e.content)},z.resizeToContentParent=".grid-stack-item-content",z.Utils=y,z.Engine=ke,z.GDRev="11.5.1";const Eg=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],Og={class:"grid-stack-item-content"},bg=Ce(s.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:Ye},columns:{default:pt}},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 u=m=>`[data-id="${m}"]`,c=m=>m.map(R=>{const E=a.value.get(`${R.el?.getAttribute("data-id")}`);if(E)return{...E,layout:{position:{col:Number(R.x),row:Number(R.y)},size:{cols:Number(R.w),rows:Number(R.h)}}}}).filter(R=>R!==void 0),d=(m,R)=>{l&&(c(R).forEach(C=>{a.value.set(`${C.id}`,C)}),n("update-tiles",Array.from(a.value.values())))},h=(m,R)=>{R.forEach(E=>{a.value.delete(`${E.el?.getAttribute("data-id")}`)}),n("update-tiles",Array.from(a.value.values()))};s.onMounted(()=>{o.value&&(l=z.init({margin:5,column:i.columns,cellHeight:i.tileHeight,resizable:{handles:"se, sw"},handle:".tile-header"},o.value),l.on("change",d),l.on("added",d),l.on("removed",h))}),s.onUnmounted(()=>{l&&l.destroy(!1)});const f=m=>{if(l&&o.value){const R=o.value.querySelector(u(m));R&&l.removeWidget(R)}};return s.watch(()=>i.tiles.length,async(m,R)=>{if(m>R&&l){const E=i.tiles.slice(R);for(const C of E)a.value.set(`${C.id}`,C),await s.nextTick(),l.makeWidget(u(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,R)=>(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,E=>(s.openBlock(),s.createElementBlock("div",{key:E.id,class:"grid-stack-item","data-id":`${E.id}`,"data-testid":`grid-stack-item-${E.id}`,"gs-h":E.layout.size.rows,"gs-lazy-load":!0,"gs-w":E.layout.size.cols,"gs-x":E.layout.position.col,"gs-y":E.layout.position.row},[s.createElementVNode("div",Og,[s.renderSlot(m.$slots,"tile",{fitToContent:!1,tile:E},void 0,!0)])],8,Eg))),128))],512))}}),[["__scopeId","data-v-a060e0c5"]]),wg=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}},Tg={key:0,class:"fullscreen-header"},vg={key:0,class:"tile-container slottable-tile"},Sg=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(b=>({v577760a8:d.value})),r.context.disableCoordination!==!0){const b=Os();s.provide(Hi,b)}const i=t,n=s.useModel(r,"modelValue"),{i18n:o}=ae.useI18n(),a=s.ref(0),l=s.ref(null),u=s.ref(),c=s.ref(),d=s.ref("scale(1)"),h=new Set,f=s.inject(Se);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")),ae.useRequestQueue();const{exportPdf:m,exportState:R}=ae.useExportPdf(c),E=b=>{h.add(b.id);const k=I.value.filter(D=>!O(D)).length;h.size>=k&&i("tiles-loaded",!0)},C=s.computed(()=>{const k=`renderer.trendRange.${U.value.type==="absolute"?"custom":U.value.time_range}`;return o.te(k)?o.t(k):""}),x=(b,k)=>{const D=b.layout.position.row-k.layout.position.row;return D!==0?D:b.layout.position.col-k.layout.position.col},I=s.computed(()=>n.value.tiles.map(b=>{if(V.value&&!b.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",b),b.type==="slottable")return{layout:b.layout,type:b.type,id:b.id??crypto.randomUUID()};let k=b.definition;const D=b.type??"chart",j=Aa(k,C.value);return j!==k.header_description&&(k={...k,header_description:j}),{layout:b.layout,meta:k,type:D,id:b.id??crypto.randomUUID()}})),w=b=>{i("edit-tile",b)},O=b=>b.type==="slottable"?!0:b.meta?.chart.type==="slottable",v=b=>b.type==="slottable",N=b=>{if(b.type==="slottable")return b.id;const k=b.meta?.chart;return k&&v(k)?k.id:void 0},A=b=>{try{const k=wg(b);n.value.tiles.push(JSON.parse(JSON.stringify(k)))}catch(k){console.warn(k)}},p=b=>{l.value&&l.value.removeWidget(b.id),h.delete(b.id)},g=()=>{h.clear(),a.value++},_=b=>{const k=b.map(D=>D.type==="slottable"?{id:D.id,type:D.type,layout:D.layout}:{id:D.id,type:D.type,layout:D.layout,definition:D.meta});n.value.tiles=k.sort(x)},T=async()=>{if(d.value="scale(1)",await s.nextTick(),c.value){const{availWidth:b,availHeight:k}=window.screen,{width:D,height:j}=c.value.getBoundingClientRect(),ne=Math.min(k/j,b/D);d.value=`scale(${ne})`}},S=()=>{u.value&&(document.fullscreenElement?document.exitFullscreen():u.value.requestFullscreen())},L=s.ref(!1),K=()=>{L.value=document.fullscreenElement!==null,L.value&&T()},q=s.computed(()=>n.value.preset_filters??[]),{editable:V,enrichedContext:P,queryReady:F,showTileActions:M,timeSpec:U}=ae.useDashboardContext({globalFilters:q,context:s.computed(()=>r.context),isFullscreen:L,preview:s.computed(()=>r.preview)});return e({refresh:g,toggleFullscreen:S,exportPdf:m,pdfExportState:R}),(b,k)=>{const D=s.resolveComponent("KAlert");return s.openBlock(),s.createElementBlock("div",{ref_key:"dashboardContainer",ref:u,class:s.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":L.value}]),onFullscreenchange:K},[s.createElementVNode("div",{ref_key:"layoutContainer",ref:c,class:"layout"},[s.unref(f)&&L.value?(s.openBlock(),s.createElementBlock("div",Tg,[s.renderSlot(b.$slots,"fullscreenHeader",{},void 0,!0)])):s.createCommentVNode("",!0),s.unref(f)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(V)&&!L.value?bg:Lr),{key:2,ref_key:"gridLayoutRef",ref:l,columns:n.value.columns,"tile-height":n.value.tile_height,tiles:I.value,onUpdateTiles:_},{tile:s.withCtx(({tile:j,fitToContent:ne})=>[O(j)?(s.openBlock(),s.createElementBlock("div",vg,[s.renderSlot(b.$slots,N(j),{},void 0,!0)])):(s.openBlock(),s.createBlock(Ar,{key:L.value?`${j.id}-tile`:`${j.id}-tile-fullscreen`,"refresh-counter":a.value,"onUpdate:refreshCounter":k[0]||(k[0]=ie=>a.value=ie),class:"tile-container",context:s.unref(P),definition:j.meta,"fit-to-content":ne,height:j.layout.size.rows*(n.value.tile_height||s.unref(Ye))+parseInt(s.unref(zi),10),"hide-actions":!s.unref(M),"is-fullscreen":L.value,preview:r.preview,"query-ready":s.unref(F),"tile-id":j.id,"tile-type":j.type,onDuplicateTile:ie=>A(j),onEditTile:ie=>w(j),onRemoveTile:ie=>p(j),onTileLoaded:ie=>E(j),onTileTimeRangeZoom:k[1]||(k[1]=ie=>i("tile-time-range-zoom",ie))},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(D,{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"]]),xg=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=w=>{a("tile-time-range-zoom",w)},u=w=>{a("chart-data",w)},c=w=>{a("tile-bounds-change",w)},{i18n:d}=ae.useI18n(),{enrichedContext:h,queryReady:f}=ae.useDashboardContext({globalFilters:s.toRef(()=>r.globalFilters),context:s.toRef(()=>r.context),preview:s.computed(()=>r.preview)}),m=s.computed(()=>De(r.definition)),R=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),E=s.ref(Ye);let C;s.onMounted(()=>{const w=i.value?.parentElement;w&&(E.value=w.getBoundingClientRect().height,C=new ResizeObserver(([O])=>{const{height:v}=O.contentRect;E.value=v}),C.observe(w))}),s.onUnmounted(()=>C?.disconnect());const x=s.ref(0);return e({refresh:()=>{x.value++},getExportData:()=>n.value?.getExportData()}),(w,O)=>{const v=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[R.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(d).t("renderer.not_configured.title")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(d).t("renderer.not_configured.description")),1)]),_:1})):(s.openBlock(),s.createBlock(Ar,{key:1,ref:"dashboard-tile","refresh-counter":x.value,"onUpdate:refreshCounter":O[0]||(O[0]=N=>x.value=N),context:{...s.unref(h),editable:!1},definition:r.definition,height:E.value,"hide-actions":"",preview:r.preview,"query-ready":s.unref(f),"show-refresh":"","tile-id":s.unref(o),onChartData:u,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),Ig=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},Dg=r=>{if(r.type!=="chart"||De(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}}},kg=(r,e=pt)=>{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,u=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,u)}return o},Ng=(r,e)=>{if(e){const n=r.tiles.map(Dg);return{...r,tiles:n}}const t=r.tiles.map(Ig).filter(n=>n!==void 0),i=kg(t,r.columns);return{...r,tiles:i}},Ag=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?ai.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:Z.COUNTRIES.length),l=s.computed(()=>{if(!t.query.filters?.find(({field:m,operator:R})=>m==="country_code"&&(R==="not_empty"||R==="empty"||R==="in"))){const m={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],m]}}return t.query}),u=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},d=e,h=f=>{d("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(ai.AnalyticsGeoMap),{bounds:r.chartOptions.bounds,"country-metrics":n.value,"fit-to-country":r.chartOptions.fit_to_country,metric:o.value,"metric-unit":u.value,"with-legend":r.chartOptions.legend||!1,onBoundsChange:h},null,8,["bounds","country-metrics","fit-to-country","metric","metric-unit","with-legend"])]),_:1},8,["context","limit-override","query","query-ready","refresh-counter"]))}})},Symbol.toStringTag,{value:"Module"}));W.CP_ID_TOKEN=Gi,W.CsvExportModal=sr,W.DASHBOARD_COLS=pt,W.DEFAULT_TILE_HEIGHT=Ye,W.DEFAULT_TILE_REFRESH_INTERVAL_MS=$i,W.DashboardRenderer=Sg,W.DashboardTilePreview=xg,W.ENTITY_ID_TOKEN=Mt,W.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Vi,W.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Wi,W.GridLayout=Lr,W.INJECT_DASHBOARD_COORDINATOR=Hi,W.INJECT_QUERY_PROVIDER=Se,W.TIMEFRAME_TOKEN=Fi,W.configureAllowedDefinition=Ng,W.getTimeRangeDurationMs=Ht,W.isTimeRangeUnsupported=Gt,W.isTreemapCompatible=Jt,W.limitTimeRange=Ft,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));