@kong-ui-public/dashboard-renderer 10.6.2 → 10.7.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,4 +1,4 @@
1
- (function(ie,n){typeof exports=="object"&&typeof module<"u"?n(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"],n):(ie=typeof globalThis<"u"?globalThis:ie||self,n(ie["kong-ui-public-dashboard-renderer"]={},ie.Vue,ie["kong-ui-public-analytics-utilities"],ie.KongIcons,ie["kong-ui-public-analytics-chart"],ie.swrv,ie["kong-ui-public-analytics-metric-provider"],ie.AgGridVue,ie.agGridCommunity,ie["kong-ui-public-i18n"],ie["kong-ui-public-analytics-config-store"],ie.Kongponents,ie.VueECharts,ie.echarts,ie.echarts,ie.echarts,ie.echarts,ie.axios,ie["kong-ui-public-analytics-geo-map"]))})(this,(function(ie,n,ne,oe,Re,si,oi,Wr,je,ct,Se,ai,Vr,St,Yr,ut,li,s_,ci){"use strict";const Xr=r=>{const e=r.length;let t=5381;for(let i=0;i<e;i++)t=t*33^r.charCodeAt(i);return t>>>0},jr="#0044f4",ui="#6c7489",Qr="#d60027",Zr="#ffc400",Jr="#bee2ff",en="#8fc1ff",tn="#5f9aff",rn="#306fff",nn="#b5ffee",sn="#00fabe",on="#00d6a4",an="#00a17b",ln="#007d60",cn="#005944",un="#b5ffee",dn="#00fabe",hn="#b5ffee",fn="#00a17b",mn="#fff296",pn="#ffe04b",gn="#ffc400",_n="#b37600",yn="#995c00",Rn="#804400",Cn="#fff296",En="#ffe04b",bn="#ffc2b3",On="#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",Mn="#ff723c",Kn="#f75008",Bn="#d13500",zn="#a31f00",Pn="#ffc2b3",qn="#ff9877",Hn="#ff723c",Gn="#f75008",$n="#d13500",Fn="#a31f00",Wn="#ffc2b3",Vn="#ff9877",Yn="#ff723c",Xn="#f75008",jn="#d13500",Qn="#ffabab",Zn="#ff7272",Jn="#ff3954",es="#f50045",ts="#d60027",is="#ad000e",rs="#ffabab",ns="#ff7272",ss="#ff3954",os="#f50045",as="#d60027",ls="#eefaff",cs="#ecfffb",us="#fffce0",ds="#fff1ef",hs="#ffe5e5",fs="#5f9aff",ms="#00d6a4",ps="#ffc400",gs="#ff723c",_s="#ff3954",ys={100:Jr,101:en,102:tn,103:rn,200:nn,201:sn,202:on,203:an,204:ln,205:cn,206:un,207:dn,208:hn,226:fn,300:mn,301:pn,302:gn,303:_n,304:yn,305:Rn,307:Cn,308:En,400:bn,401:On,402:wn,403:Tn,404:vn,405:Sn,406:xn,407:In,408:Dn,409:kn,410:Nn,411:An,412:Ln,413:Un,414:Mn,415:Kn,416:Bn,417:zn,418:Pn,421:qn,422:Hn,423:Gn,424:$n,425:Fn,426:Wn,428:Vn,429:Yn,431:Xn,451:jn,500:Qn,501:Zn,502:Jn,503:es,504:ts,505:is,506:rs,507:ns,508:ss,510:os,511:as},Rs={100:ls,200:cs,300:us,400:ds,500:hs},di={"1XX":fs,"2XX":ms,"3XX":ps,"4XX":gs,"5XX":_s},Cs={error:Qr,warning:Zr,empty:"#9DA99D",neutral:ui,____OTHER____:jr},xt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],It=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],Es=r=>Xr(r),bs=({theme:r="light"}={})=>r==="dark"?It:xt,hi=({discriminator:r,theme:e="light"})=>{const t=Math.abs(Math.floor(r));return e==="dark"?It[t%It.length]:xt[t%xt.length]},Qe=({state:r})=>Cs[r]??ui,Os=({statusCode:r})=>{const e=typeof r=="number"?r:Number.parseInt(r,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return ys[t]??Rs[i]??Qe({state:"neutral"})},ws=({group:r})=>di[r]?di[r]:Qe({state:"neutral"}),Ts=({discriminator:r=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:s=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:l=void 0,customDimensionColors:u=void 0})=>{let c="light";if(n.hasInjectionContext()&&(c=n.inject("app:konnectColorMode",n.computed(()=>"light")).value),e!==void 0)return Qe({state:e});if(i!==void 0&&u!==void 0&&u[i])return u[i];if(i&&["empty","____OTHER____"].includes(i))return Qe({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return Os({statusCode:i});if(t==="status_code_grouped")return ws({group:i})}if(r!==void 0)return hi({discriminator:r,theme:c});if(t||i||s){const d=`${t??""}${i??""}${s??""}`,h=o?o.resolveDiscriminator({name:d,order:a,chartUuid:l,theme:c}):Es(d);return hi({discriminator:h,theme:c})}return Qe({state:"neutral"})},vs="__no_chart__";function Ss(){const r=new Map,e=new Map,t=new Map,i=o=>{e.set(o,(e.get(o)??0)+1)},s=(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:s(o,new Set)};return{resolveDiscriminator:({name:o,order:a,chartUuid:l,theme:u})=>{const c=l??vs,d=a??null,h=bs({theme:u});let f;if(r.has(o))f=r.get(o);else{const m=new Set,C=t.get(c);d!==null&&C?.order!==null&&C?.order!==void 0&&d===C.order+1&&m.add(C.index);const b=h.length;f=s(b,m),r.set(o,f),i(f)}return t.set(c,{order:d,index:f}),f},reset:()=>{r.clear(),e.clear(),t.clear()}}}function xs(){const r=n.ref(null),e=n.ref(null),t=n.ref(null),i=n.ref(null),s=n.ref(null),o=300,a=300,l=10,u=Ss(),c=({chartUuid:h,timestamp:f=null,dimension:m=null,dimensionValue:C=null,metric:b=null})=>{r.value=h,e.value=f,t.value=m,i.value=C,s.value=b},d=({chartUuid:h})=>{r.value===h&&(r.value=null,e.value=null,t.value=null,i.value=null,s.value=null)};return{activate:c,activeChart:n.readonly(r),activeDimension:n.readonly(t),activeDimensionValue:n.readonly(i),activeMetric:n.readonly(s),activeTimestamp:n.readonly(e),deactivate:d,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l,color:u}}const Is={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"}},Ds=(r,e,t)=>{let i;const s=Is[r];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function Dt(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const ks={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ns={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},As={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ls={date:Dt({formats:ks,defaultWidth:"full"}),time:Dt({formats:Ns,defaultWidth:"full"}),dateTime:Dt({formats:As,defaultWidth:"full"})},Us={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ms=(r,e,t,i)=>Us[r];function Ze(r){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let s;if(i==="formatting"&&r.formattingValues){const a=r.defaultFormattingWidth||r.defaultWidth,l=t?.width?String(t.width):a;s=r.formattingValues[l]||r.formattingValues[a]}else{const a=r.defaultWidth,l=t?.width?String(t.width):r.defaultWidth;s=r.values[l]||r.values[a]}const o=r.argumentCallback?r.argumentCallback(e):e;return s[o]}}const Ks={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Bs={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zs={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"]},Ps={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"]},qs={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"}},Hs={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"}},Gs={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:Ze({values:Ks,defaultWidth:"wide"}),quarter:Ze({values:Bs,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ze({values:zs,defaultWidth:"wide"}),day:Ze({values:Ps,defaultWidth:"wide"}),dayPeriod:Ze({values:qs,defaultWidth:"wide",formattingValues:Hs,defaultFormattingWidth:"wide"})};function Je(r){return(e,t={})=>{const i=t.width,s=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],o=e.match(s);if(!o)return null;const a=o[0],l=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],u=Array.isArray(l)?Fs(l,h=>h.test(a)):$s(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 $s(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Fs(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Ws(r){return(e,t={})=>{const i=e.match(r.matchPattern);if(!i)return null;const s=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(s.length);return{value:a,rest:l}}}const Vs=/^(\d+)(th|st|nd|rd)?/i,Ys=/\d+/i,Xs={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},js={any:[/^b/i,/^(a|c)/i]},Qs={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Zs={any:[/1/i,/2/i,/3/i,/4/i]},Js={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},eo={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]},to={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},io={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]},ro={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},no={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}},so={ordinalNumber:Ws({matchPattern:Vs,parsePattern:Ys,valueCallback:r=>parseInt(r,10)}),era:Je({matchPatterns:Xs,defaultMatchWidth:"wide",parsePatterns:js,defaultParseWidth:"any"}),quarter:Je({matchPatterns:Qs,defaultMatchWidth:"wide",parsePatterns:Zs,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Je({matchPatterns:Js,defaultMatchWidth:"wide",parsePatterns:eo,defaultParseWidth:"any"}),day:Je({matchPatterns:to,defaultMatchWidth:"wide",parsePatterns:io,defaultParseWidth:"any"}),dayPeriod:Je({matchPatterns:ro,defaultMatchWidth:"any",parsePatterns:no,defaultParseWidth:"any"})},oo={code:"en-US",formatDistance:Ds,formatLong:Ls,formatRelative:Ms,localize:Gs,match:so,options:{weekStartsOn:0,firstWeekContainsDate:1}};let ao={};function et(){return ao}const fi=6048e5,lo=864e5,mi=Symbol.for("constructDateFrom");function Me(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&mi in r?r[mi](e):r instanceof Date?new r.constructor(e):new Date(e)}function xe(r,e){return Me(e||r,r)}function pi(r){const e=xe(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 co(r,...e){const t=Me.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function gi(r,e){const t=xe(r,e?.in);return t.setHours(0,0,0,0),t}function uo(r,e,t){const[i,s]=co(t?.in,r,e),o=gi(i),a=gi(s),l=+o-pi(o),u=+a-pi(a);return Math.round((l-u)/lo)}function ho(r,e){const t=xe(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function fo(r,e){const t=xe(r,e?.in);return uo(t,ho(t))+1}function tt(r,e){const t=et(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=xe(r,e?.in),o=s.getDay(),a=(o<i?7:0)+o-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function dt(r,e){return tt(r,{...e,weekStartsOn:1})}function _i(r,e){const t=xe(r,e?.in),i=t.getFullYear(),s=Me(t,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=dt(s),a=Me(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=dt(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function mo(r,e){const t=_i(r,e),i=Me(r,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),dt(i)}function po(r,e){const t=xe(r,e?.in),i=+dt(t)-+mo(t);return Math.round(i/fi)+1}function yi(r,e){const t=xe(r,e?.in),i=t.getFullYear(),s=et(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Me(e?.in||r,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=tt(a,e),u=Me(e?.in||r,0);u.setFullYear(i,0,o),u.setHours(0,0,0,0);const c=tt(u,e);return+t>=+l?i+1:+t>=+c?i:i-1}function go(r,e){const t=et(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,s=yi(r,e),o=Me(e?.in||r,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),tt(o,e)}function _o(r,e){const t=xe(r,e?.in),i=+tt(t,e)-+go(t,e);return Math.round(i/fi)+1}function le(r,e){const t=r<0?"-":"",i=Math.abs(r).toString().padStart(e,"0");return t+i}const Ke={y(r,e){const t=r.getFullYear(),i=t>0?t:1-t;return le(e==="yy"?i%100:i,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):le(t+1,2)},d(r,e){return le(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 le(r.getHours()%12||12,e.length)},H(r,e){return le(r.getHours(),e.length)},m(r,e){return le(r.getMinutes(),e.length)},s(r,e){return le(r.getSeconds(),e.length)},S(r,e){const t=e.length,i=r.getMilliseconds(),s=Math.trunc(i*Math.pow(10,t-3));return le(s,e.length)}},We={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ri={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(),s=i>0?i:1-i;return t.ordinalNumber(s,{unit:"year"})}return Ke.y(r,e)},Y:function(r,e,t,i){const s=yi(r,i),o=s>0?s:1-s;if(e==="YY"){const a=o%100;return le(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):le(o,e.length)},R:function(r,e){const t=_i(r);return le(t,e.length)},u:function(r,e){const t=r.getFullYear();return le(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 le(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 le(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 Ke.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 le(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 s=_o(r,i);return e==="wo"?t.ordinalNumber(s,{unit:"week"}):le(s,e.length)},I:function(r,e,t){const i=po(r);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):le(i,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Ke.d(r,e)},D:function(r,e,t){const i=fo(r);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):le(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 s=r.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return le(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},c:function(r,e,t,i){const s=r.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return le(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(s,{width:"narrow",context:"standalone"});case"cccccc":return t.day(s,{width:"short",context:"standalone"});default:return t.day(s,{width:"wide",context:"standalone"})}},i:function(r,e,t){const i=r.getDay(),s=i===0?7:i;switch(e){case"i":return String(s);case"ii":return le(s,e.length);case"io":return t.ordinalNumber(s,{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 s=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(r,e,t){const i=r.getHours();let s;switch(i===12?s=We.noon:i===0?s=We.midnight:s=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(r,e,t){const i=r.getHours();let s;switch(i>=17?s=We.evening:i>=12?s=We.afternoon:i>=4?s=We.morning:s=We.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{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 Ke.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Ke.H(r,e)},K:function(r,e,t){const i=r.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):le(i,e.length)},k:function(r,e,t){let i=r.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):le(i,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ke.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Ke.s(r,e)},S:function(r,e){return Ke.S(r,e)},X:function(r,e,t){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Ei(i);case"XXXX":case"XX":return qe(i);default:return qe(i,":")}},x:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"x":return Ei(i);case"xxxx":case"xx":return qe(i);default:return qe(i,":")}},O:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ci(i,":");default:return"GMT"+qe(i,":")}},z:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ci(i,":");default:return"GMT"+qe(i,":")}},t:function(r,e,t){const i=Math.trunc(+r/1e3);return le(i,e.length)},T:function(r,e,t){return le(+r,e.length)}};function Ci(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=Math.trunc(i/60),o=i%60;return o===0?t+String(s):t+String(s)+e+le(o,2)}function Ei(r,e){return r%60===0?(r>0?"-":"+")+le(Math.abs(r)/60,2):qe(r,e)}function qe(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=le(Math.trunc(i/60),2),o=le(i%60,2);return t+s+e+o}const bi=(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"})}},Oi=(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"})}},yo={p:Oi,P:(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],i=t[1],s=t[2];if(!s)return bi(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}}",bi(i,e)).replace("{{time}}",Oi(s,e))}},Ro=/^D+$/,Co=/^Y+$/,Eo=["D","DD","YY","YYYY"];function bo(r){return Ro.test(r)}function Oo(r){return Co.test(r)}function wo(r,e,t){const i=To(r,e,t);if(console.warn(i),Eo.includes(r))throw new RangeError(i)}function To(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 vo(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function So(r){return!(!vo(r)&&typeof r!="number"||isNaN(+xe(r)))}const xo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Io=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Do=/^'([^]*?)'?$/,ko=/''/g,No=/[a-zA-Z]/;function Ao(r,e,t){const i=et(),s=t?.locale??i.locale??oo,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=xe(r,t?.in);if(!So(l))throw new RangeError("Invalid time value");let u=e.match(Io).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=yo[h];return f(d,s.formatLong)}return d}).join("").match(xo).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:Lo(d)};if(Ri[h])return{isToken:!0,value:d};if(h.match(No))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(u=s.localize.preprocessor(l,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return u.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!t?.useAdditionalWeekYearTokens&&Oo(h)||!t?.useAdditionalDayOfYearTokens&&bo(h))&&wo(h,e,String(r));const f=Ri[h[0]];return f(l,h,s.localize,c)}).join("")}function Lo(r){const e=r.match(Do);return e?e[1].replace(ko,"'"):r}function Uo(){return Object.assign({},et())}function wi(r,e,t){const i=Uo(),s=Bo(r,t.timeZone,t.locale??i.locale);return"formatToParts"in s?Mo(s,e):Ko(s,e)}function Mo(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 Bo(r,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:r})}function zo(r,e){const t=$o(e);return"formatToParts"in t?qo(t,r):Ho(t,r)}const Po={year:0,month:1,day:2,hour:3,minute:4,second:5};function qo(r,e){try{const t=r.formatToParts(e),i=[];for(let s=0;s<t.length;s++){const o=Po[t[s].type];o!==void 0&&(i[o]=parseInt(t[s].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Ho(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 kt={},Ti=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")),Go=Ti==="06/25/2014, 00:00:00"||Ti==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function $o(r){return kt[r]||(kt[r]=Go?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"})),kt[r]}function vi(r,e,t,i,s,o,a){const l=new Date(0);return l.setUTCFullYear(r,e,t),l.setUTCHours(i,s,o,a),l}const Si=36e5,Fo=6e4,Nt={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function At(r,e,t){if(!r)return 0;let i=Nt.timezoneZ.exec(r);if(i)return 0;let s,o;if(i=Nt.timezoneHH.exec(r),i)return s=parseInt(i[1],10),xi(s)?-(s*Si):NaN;if(i=Nt.timezoneHHMM.exec(r),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return xi(s,a)?(o=Math.abs(s)*Si+a*Fo,i[1]==="+"?-o:o):NaN}if(Yo(r)){e=new Date(e||Date.now());const a=t?e:Wo(e),l=Lt(a,r);return-(t?l:Vo(e,l,r))}return NaN}function Wo(r){return vi(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())}function Lt(r,e){const t=zo(r,e),i=vi(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let s=r.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function Vo(r,e,t){let s=r.getTime()-e;const o=Lt(new Date(s),t);if(e===o)return e;s-=o-e;const a=Lt(new Date(s),t);return o===a?o:Math.max(o,a)}function xi(r,e){return-23<=r&&r<=23&&(e==null||0<=e&&e<=59)}const Ii={};function Yo(r){if(Ii[r])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:r}),Ii[r]=!0,!0}catch{return!1}}const Xo=60*1e3,jo={X:function(r,e,t){const i=Ut(t.timeZone,r);if(i===0)return"Z";switch(e){case"X":return Di(i);case"XXXX":case"XX":return Ve(i);default:return Ve(i,":")}},x:function(r,e,t){const i=Ut(t.timeZone,r);switch(e){case"x":return Di(i);case"xxxx":case"xx":return Ve(i);default:return Ve(i,":")}},O:function(r,e,t){const i=Ut(t.timeZone,r);switch(e){case"O":case"OO":case"OOO":return"GMT"+Qo(i,":");default:return"GMT"+Ve(i,":")}},z:function(r,e,t){switch(e){case"z":case"zz":case"zzz":return wi("short",r,t);default:return wi("long",r,t)}}};function Ut(r,e){const t=r?At(r,e,!0)/Xo:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+r);return t}function ht(r,e){const t=r<0?"-":"";let i=Math.abs(r).toString();for(;i.length<e;)i="0"+i;return t+i}function Ve(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=ht(Math.floor(i/60),2),o=ht(Math.floor(i%60),2);return t+s+e+o}function Di(r,e){return r%60===0?(r>0?"-":"+")+ht(Math.abs(r)/60,2):Ve(r,e)}function Qo(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=Math.floor(i/60),o=i%60;return o===0?t+String(s):t+String(s)+e+ht(o,2)}function ki(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 Zo=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Mt=36e5,Ni=6e4,Jo=2,Ce={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:Zo};function Ai(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?Jo: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=ea(r),{year:s,restDateString:o}=ta(i.date,t),a=ia(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let u=0,c;if(i.time&&(u=ra(i.time),u===null||isNaN(u)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=At(i.timeZone||e.timeZone,new Date(l+u)),isNaN(c))return new Date(NaN)}else c=ki(new Date(l+u)),c=ki(new Date(l+u+c));return new Date(l+u+c)}else return new Date(NaN)}function ea(r){const e={};let t=Ce.dateTimePattern.exec(r),i;if(t?(e.date=t[1],i=t[3]):(t=Ce.datePattern.exec(r),t?(e.date=t[1],i=t[2]):(e.date=null,i=r)),i){const s=Ce.timeZone.exec(i);s?(e.time=i.replace(s[1],""),e.timeZone=s[1].trim()):e.time=i}return e}function ta(r,e){if(r){const t=Ce.YYY[e],i=Ce.YYYYY[e];let s=Ce.YYYY.exec(r)||i.exec(r);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:r.slice(o.length)}}if(s=Ce.YY.exec(r)||t.exec(r),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:r.slice(o.length)}}}return{year:null}}function ia(r,e){if(e===null)return null;let t,i,s;if(!r||!r.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=Ce.MM.exec(r);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Mi(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=Ce.DDD.exec(r),o){t=new Date(0);const a=parseInt(o[1],10);return oa(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=Ce.MMDD.exec(r),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Mi(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=Ce.Www.exec(r),o)return s=parseInt(o[1],10)-1,Ki(s)?Li(e,s):new Date(NaN);if(o=Ce.WwwD.exec(r),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Ki(s,a)?Li(e,s,a):new Date(NaN)}return null}function ra(r){let e,t,i=Ce.HH.exec(r);if(i)return e=parseFloat(i[1].replace(",",".")),Kt(e)?e%24*Mt:NaN;if(i=Ce.HHMM.exec(r),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),Kt(e,t)?e%24*Mt+t*Ni:NaN;if(i=Ce.HHMMSS.exec(r),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Kt(e,t,s)?e%24*Mt+t*Ni+s*1e3:NaN}return null}function Li(r,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(r,0,4);const s=i.getUTCDay()||7,o=e*7+t+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const na=[31,28,31,30,31,30,31,31,30,31,30,31],sa=[31,29,31,30,31,30,31,31,30,31,30,31];function Ui(r){return r%400===0||r%4===0&&r%100!==0}function Mi(r,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=Ui(r);if(i&&t>sa[e]||!i&&t>na[e])return!1}return!0}function oa(r,e){if(e<1)return!1;const t=Ui(r);return!(t&&e>366||!t&&e>365)}function Ki(r,e){return!(r<0||r>52||e!=null&&(e<0||e>6))}function Kt(r,e,t){return!(r<0||r>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const aa=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Bt(r,e,t={}){e=String(e);const i=e.match(aa);if(i){const s=Ai(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,"'"+jo[a[0]](s,a,t)+"'");return u?c.substring(0,l-1)+c.substring(l+1):c},e)}return Ao(r,e,t)}function la(r,e,t){r=Ai(r,t);const i=At(e,r,!0),s=new Date(r.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function ca(r,e,t,i){return i={...i,timeZone:e,originalDate:r},Bt(la(r,e,{timeZone:i.timeZone}),t,i)}const ua="#6c7489",da="768px",Bi="12px",ha="16px",zi="32px",fa="12px",Pi="20px";var ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ma(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var mt={exports:{}},pa=mt.exports,qi;function ga(){return qi||(qi=1,(function(r,e){(function(t,i){i()})(pa,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 s(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 ft=="object"&&ft.global===ft?ft: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):s(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(s(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",C=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||m&&C||l)&&typeof FileReader<"u"){var R=new FileReader;R.onloadend=function(){var O=R.result;O=b?O:O.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=O:location=O,f=null},R.readAsDataURL(c)}else{var w=a.URL||a.webkitURL,U=w.createObjectURL(c);f?f.location=U:location.href=U,f=null,setTimeout(function(){w.revokeObjectURL(U)},4e4)}});a.saveAs=u.saveAs=u,r.exports=u})})(mt)),mt.exports}var _a=ga(),pt={exports:{}};var ya=pt.exports,Hi;function Ra(){return Hi||(Hi=1,(function(r,e){((t,i)=>{r.exports=i()})(ya,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},s=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,u={};function c(g){return g.charCodeAt(0)===65279?g.slice(1):g}function d(g){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(p){var _=k(p);_.chunkSize=parseInt(_.chunkSize),p.step||p.chunk||(_.chunkSize=null),this._handle=new b(_),(this._handle.streamer=this)._config=_}).call(this,g),this.parseChunk=function(p,_){var M=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<M){let F=this._config.newline;F||(D=this._config.quoteChar||'"',F=this._handle.guessLineEndings(p,D)),p=[...p.split(F).slice(M)].join(F)}this.isFirstChunk&&B(this._config.beforeFirstChunk)&&(D=this._config.beforeFirstChunk(p))!==void 0&&(p=D),this.isFirstChunk=!1,this._halted=!1;var M=this._partialLine+p,D=(this._partialLine="",this._handle.parse(M,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(p=D.meta.cursor,M=(this._finished||(this._partialLine=M.substring(p-this._baseIndex),this._baseIndex=p),D&&D.data&&(this._rowCount+=D.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:D,workerId:u.WORKER_ID,finished:M});else if(B(this._config.chunk)&&!_){if(this._config.chunk(D,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=D=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(D.data),this._completeResults.errors=this._completeResults.errors.concat(D.errors),this._completeResults.meta=D.meta),this._completed||!M||!B(this._config.complete)||D&&D.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),M||D&&D.meta.paused||this._nextChunk(),D}this._halted=!0},this._sendError=function(p){B(this._config.error)?this._config.error(p):o&&this._config.error&&i.postMessage({workerId:u.WORKER_ID,error:p,finished:!1})}}function h(g){var p;(g=g||{}).chunkSize||(g.chunkSize=u.RemoteChunkSize),d.call(this,g),this._nextChunk=s?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(p=new XMLHttpRequest,this._config.withCredentials&&(p.withCredentials=this._config.withCredentials),s||(p.onload=I(this._chunkLoaded,this),p.onerror=I(this._chunkError,this)),p.ontimeout=I(this._chunkTimeout,this),p.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadTimeout&&!s&&(p.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var _,M=this._config.downloadRequestHeaders;for(_ in M)p.setRequestHeader(_,M[_])}var D;this._config.chunkSize&&(D=this._start+this._config.chunkSize-1,p.setRequestHeader("Range","bytes="+this._start+"-"+D));try{p.send(this._config.downloadRequestBody)}catch(F){this._chunkError(F.message)}s&&p.status===0&&this._chunkError()}},this._chunkLoaded=function(){p.readyState===4&&(p.status<200||400<=p.status?this._chunkError():(this._start+=this._config.chunkSize||p.responseText.length,this._finished=!this._config.chunkSize||this._start>=(_=>(_=_.getResponseHeader("Content-Range"))!==null?parseInt(_.substring(_.lastIndexOf("/")+1)):-1)(p),this.parseChunk(p.responseText)))},this._chunkError=function(_){_=p.statusText||_,this._sendError(new Error(_))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function f(g){(g=g||{}).chunkSize||(g.chunkSize=u.LocalChunkSize),d.call(this,g);var p,_,M=typeof FileReader<"u";this.stream=function(D){this._input=D,_=D.slice||D.webkitSlice||D.mozSlice,M?((p=new FileReader).onload=I(this._chunkLoaded,this),p.onerror=I(this._chunkError,this)):p=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var D=this._input,F=(this._config.chunkSize&&(F=Math.min(this._start+this._config.chunkSize,this._input.size),D=_.call(D,this._start,F)),p.readAsText(D,this._config.encoding));M||this._chunkLoaded({target:{result:F}})},this._chunkLoaded=function(D){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(D.target.result)},this._chunkError=function(){this._sendError(p.error)}}function m(g){var p;d.call(this,g=g||{}),this.stream=function(_){return p=_,this._nextChunk()},this._nextChunk=function(){var _,M;if(!this._finished)return _=this._config.chunkSize,p=_?(M=p.substring(0,_),p.substring(_)):(M=p,""),this._finished=!p,this.parseChunk(M)}}function C(g){d.call(this,g=g||{});var p=[],_=!0,M=!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(D){this._input=D,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){M&&p.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),p.length?this.parseChunk(p.shift()):_=!0},this._streamData=I(function(D){try{p.push(typeof D=="string"?D:D.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(p.shift()))}catch(F){this._streamError(F)}},this),this._streamError=I(function(D){this._streamCleanUp(),this._sendError(D)},this),this._streamEnd=I(function(){this._streamCleanUp(),M=!0,this._streamData("")},this),this._streamCleanUp=I(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(g){var p,_,M,D,F=Math.pow(2,53),v=-F,P=/^\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)))$/,W=this,T=0,x=0,q=!1,L=!1,G=[],N={data:[],errors:[],meta:{}};function ce(J){return g.skipEmptyLines==="greedy"?J.join("").trim()==="":J.length===1&&J[0].length===0}function ae(){if(N&&M&&(Q("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),M=!1),g.skipEmptyLines&&(N.data=N.data.filter(function(z){return!ce(z)})),ue()){let z=function(Y){G.push(Y)};if(N)if(Array.isArray(N.data[0])){for(var J=0;ue()&&J<N.data.length;J++)N.data[J].forEach(z);N.data.splice(0,1)}else N.data.forEach(z)}function S(z,Y){for(var te=g.header?{}:[],A=0;A<z.length;A++){var $=A,j=z[A],j=((de,ee)=>(se=>(g.dynamicTypingFunction&&g.dynamicTyping[se]===void 0&&(g.dynamicTyping[se]=g.dynamicTypingFunction(se)),(g.dynamicTyping[se]||g.dynamicTyping)===!0))(de)?ee==="true"||ee==="TRUE"||ee!=="false"&&ee!=="FALSE"&&((se=>{if(P.test(se)&&(se=parseFloat(se),v<se&&se<F))return 1})(ee)?parseFloat(ee):V.test(ee)?new Date(ee):ee===""?null:ee):ee)($=g.header?A>=G.length?"__parsed_extra":G[A]:$,j=g.transform?g.transform(j,$):j);$==="__parsed_extra"?(te[$]=te[$]||[],te[$].push(j)):te[$]=j}return g.header&&(A>G.length?Q("FieldMismatch","TooManyFields","Too many fields: expected "+G.length+" fields but parsed "+A,x+Y):A<G.length&&Q("FieldMismatch","TooFewFields","Too few fields: expected "+G.length+" fields but parsed "+A,x+Y)),te}var K;N&&(g.header||g.dynamicTyping||g.transform)&&(K=1,!N.data.length||Array.isArray(N.data[0])?(N.data=N.data.map(S),K=N.data.length):N.data=S(N.data,0),g.header&&N.meta&&(N.meta.fields=G),x+=K)}function ue(){return g.header&&G.length===0}function Q(J,S,K,z){J={type:J,code:S,message:K},z!==void 0&&(J.row=z),N.errors.push(J)}B(g.step)&&(D=g.step,g.step=function(J){N=J,ue()?ae():(ae(),N.data.length!==0&&(T+=J.data.length,g.preview&&T>g.preview?_.abort():(N.data=N.data[0],D(N,W))))}),this.parse=function(J,S,K){var z=g.quoteChar||'"',z=(g.newline||(g.newline=this.guessLineEndings(J,z)),M=!1,g.delimiter?B(g.delimiter)&&(g.delimiter=g.delimiter(J),N.meta.delimiter=g.delimiter):((z=((Y,te,A,$,j)=>{var de,ee,se,pe;j=j||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var _e=0;_e<j.length;_e++){for(var Oe,ze=j[_e],me=0,we=0,fe=0,ye=(se=void 0,new w({comments:$,delimiter:ze,newline:te,preview:10}).parse(Y)),Te=0;Te<ye.data.length;Te++)A&&ce(ye.data[Te])?fe++:(Oe=ye.data[Te].length,we+=Oe,se===void 0?se=Oe:0<Oe&&(me+=Math.abs(Oe-se),se=Oe));0<ye.data.length&&(we/=ye.data.length-fe),1.99<we&&(ee===void 0||me<ee||me===ee&&pe<we)&&(ee=me,de=ze,pe=we)}return{successful:!!(g.delimiter=de),bestDelimiter:de}})(J,g.newline,g.skipEmptyLines,g.comments,g.delimitersToGuess)).successful?g.delimiter=z.bestDelimiter:(M=!0,g.delimiter=u.DefaultDelimiter),N.meta.delimiter=g.delimiter),k(g));return z.header=ue(),g.preview&&g.header&&z.preview++,p=J,_=new w(z),N=_.parse(p,S,K),ae(),q?{meta:{paused:!0}}:N||{meta:{paused:!1}}},this.paused=function(){return q},this.pause=function(){q=!0,_.abort(),p=B(g.chunk)?"":p.substring(_.getCharIndex())},this.resume=function(){W.streamer._halted?(q=!1,W.streamer.parseChunk(p,!0)):setTimeout(W.resume,3)},this.aborted=function(){return L},this.abort=function(){L=!0,_.abort(),N.meta.aborted=!0,B(g.complete)&&g.complete(N),p=""},this.guessLineEndings=function(Y,z){Y=Y.substring(0,1048576);var z=new RegExp(R(z)+"([^]*?)"+R(z),"gm"),K=(Y=Y.replace(z,"")).split("\r"),z=Y.split(`
1
+ (function(ie,n){typeof exports=="object"&&typeof module<"u"?n(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"],n):(ie=typeof globalThis<"u"?globalThis:ie||self,n(ie["kong-ui-public-dashboard-renderer"]={},ie.Vue,ie["kong-ui-public-analytics-utilities"],ie.KongIcons,ie["kong-ui-public-analytics-chart"],ie.swrv,ie["kong-ui-public-analytics-metric-provider"],ie.AgGridVue,ie.agGridCommunity,ie["kong-ui-public-i18n"],ie["kong-ui-public-analytics-config-store"],ie.Kongponents,ie.VueECharts,ie.echarts,ie.echarts,ie.echarts,ie.echarts,ie.axios,ie["kong-ui-public-analytics-geo-map"]))})(this,(function(ie,n,ne,oe,Re,oi,ai,Wr,je,ct,Se,li,Vr,St,Yr,ut,ci,s_,ui){"use strict";const Xr=r=>{const e=r.length;let t=5381;for(let i=0;i<e;i++)t=t*33^r.charCodeAt(i);return t>>>0},jr="#0044f4",di="#6c7489",Qr="#d60027",Zr="#ffc400",Jr="#bee2ff",en="#8fc1ff",tn="#5f9aff",rn="#306fff",nn="#b5ffee",sn="#00fabe",on="#00d6a4",an="#00a17b",ln="#007d60",cn="#005944",un="#b5ffee",dn="#00fabe",hn="#b5ffee",fn="#00a17b",mn="#fff296",pn="#ffe04b",gn="#ffc400",_n="#b37600",yn="#995c00",Rn="#804400",Cn="#fff296",En="#ffe04b",bn="#ffc2b3",On="#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",Mn="#ff723c",Kn="#f75008",Bn="#d13500",zn="#a31f00",Pn="#ffc2b3",qn="#ff9877",Hn="#ff723c",Gn="#f75008",$n="#d13500",Fn="#a31f00",Wn="#ffc2b3",Vn="#ff9877",Yn="#ff723c",Xn="#f75008",jn="#d13500",Qn="#ffabab",Zn="#ff7272",Jn="#ff3954",es="#f50045",ts="#d60027",is="#ad000e",rs="#ffabab",ns="#ff7272",ss="#ff3954",os="#f50045",as="#d60027",ls="#eefaff",cs="#ecfffb",us="#fffce0",ds="#fff1ef",hs="#ffe5e5",fs="#5f9aff",ms="#00d6a4",ps="#ffc400",gs="#ff723c",_s="#ff3954",ys={100:Jr,101:en,102:tn,103:rn,200:nn,201:sn,202:on,203:an,204:ln,205:cn,206:un,207:dn,208:hn,226:fn,300:mn,301:pn,302:gn,303:_n,304:yn,305:Rn,307:Cn,308:En,400:bn,401:On,402:wn,403:Tn,404:vn,405:Sn,406:xn,407:In,408:Dn,409:kn,410:Nn,411:An,412:Ln,413:Un,414:Mn,415:Kn,416:Bn,417:zn,418:Pn,421:qn,422:Hn,423:Gn,424:$n,425:Fn,426:Wn,428:Vn,429:Yn,431:Xn,451:jn,500:Qn,501:Zn,502:Jn,503:es,504:ts,505:is,506:rs,507:ns,508:ss,510:os,511:as},Rs={100:ls,200:cs,300:us,400:ds,500:hs},hi={"1XX":fs,"2XX":ms,"3XX":ps,"4XX":gs,"5XX":_s},Cs={error:Qr,warning:Zr,empty:"#9DA99D",neutral:di,____OTHER____:jr},xt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],It=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],Es=r=>Xr(r),bs=({theme:r="light"}={})=>r==="dark"?It:xt,fi=({discriminator:r,theme:e="light"})=>{const t=Math.abs(Math.floor(r));return e==="dark"?It[t%It.length]:xt[t%xt.length]},Qe=({state:r})=>Cs[r]??di,Os=({statusCode:r})=>{const e=typeof r=="number"?r:Number.parseInt(r,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return ys[t]??Rs[i]??Qe({state:"neutral"})},ws=({group:r})=>hi[r]?hi[r]:Qe({state:"neutral"}),Ts=({discriminator:r=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:s=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:l=void 0,customDimensionColors:u=void 0})=>{let c="light";if(n.hasInjectionContext()&&(c=n.inject("app:konnectColorMode",n.computed(()=>"light")).value),e!==void 0)return Qe({state:e});if(i!==void 0&&u!==void 0&&u[i])return u[i];if(i&&["empty","____OTHER____"].includes(i))return Qe({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return Os({statusCode:i});if(t==="status_code_grouped")return ws({group:i})}if(r!==void 0)return fi({discriminator:r,theme:c});if(t||i||s){const d=`${t??""}${i??""}${s??""}`,h=o?o.resolveDiscriminator({name:d,order:a,chartUuid:l,theme:c}):Es(d);return fi({discriminator:h,theme:c})}return Qe({state:"neutral"})},vs="__no_chart__";function Ss(){const r=new Map,e=new Map,t=new Map,i=o=>{e.set(o,(e.get(o)??0)+1)},s=(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:s(o,new Set)};return{resolveDiscriminator:({name:o,order:a,chartUuid:l,theme:u})=>{const c=l??vs,d=a??null,h=bs({theme:u});let f;if(r.has(o))f=r.get(o);else{const m=new Set,C=t.get(c);d!==null&&C?.order!==null&&C?.order!==void 0&&d===C.order+1&&m.add(C.index);const b=h.length;f=s(b,m),r.set(o,f),i(f)}return t.set(c,{order:d,index:f}),f},reset:()=>{r.clear(),e.clear(),t.clear()}}}function xs(){const r=n.ref(null),e=n.ref(null),t=n.ref(null),i=n.ref(null),s=n.ref(null),o=300,a=300,l=10,u=Ss(),c=({chartUuid:h,timestamp:f=null,dimension:m=null,dimensionValue:C=null,metric:b=null})=>{r.value=h,e.value=f,t.value=m,i.value=C,s.value=b},d=({chartUuid:h})=>{r.value===h&&(r.value=null,e.value=null,t.value=null,i.value=null,s.value=null)};return{activate:c,activeChart:n.readonly(r),activeDimension:n.readonly(t),activeDimensionValue:n.readonly(i),activeMetric:n.readonly(s),activeTimestamp:n.readonly(e),deactivate:d,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l,color:u}}const Is={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"}},Ds=(r,e,t)=>{let i;const s=Is[r];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function Dt(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const ks={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ns={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},As={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ls={date:Dt({formats:ks,defaultWidth:"full"}),time:Dt({formats:Ns,defaultWidth:"full"}),dateTime:Dt({formats:As,defaultWidth:"full"})},Us={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ms=(r,e,t,i)=>Us[r];function Ze(r){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let s;if(i==="formatting"&&r.formattingValues){const a=r.defaultFormattingWidth||r.defaultWidth,l=t?.width?String(t.width):a;s=r.formattingValues[l]||r.formattingValues[a]}else{const a=r.defaultWidth,l=t?.width?String(t.width):r.defaultWidth;s=r.values[l]||r.values[a]}const o=r.argumentCallback?r.argumentCallback(e):e;return s[o]}}const Ks={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Bs={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zs={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"]},Ps={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"]},qs={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"}},Hs={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"}},Gs={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:Ze({values:Ks,defaultWidth:"wide"}),quarter:Ze({values:Bs,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ze({values:zs,defaultWidth:"wide"}),day:Ze({values:Ps,defaultWidth:"wide"}),dayPeriod:Ze({values:qs,defaultWidth:"wide",formattingValues:Hs,defaultFormattingWidth:"wide"})};function Je(r){return(e,t={})=>{const i=t.width,s=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],o=e.match(s);if(!o)return null;const a=o[0],l=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],u=Array.isArray(l)?Fs(l,h=>h.test(a)):$s(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 $s(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Fs(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Ws(r){return(e,t={})=>{const i=e.match(r.matchPattern);if(!i)return null;const s=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(s.length);return{value:a,rest:l}}}const Vs=/^(\d+)(th|st|nd|rd)?/i,Ys=/\d+/i,Xs={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},js={any:[/^b/i,/^(a|c)/i]},Qs={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Zs={any:[/1/i,/2/i,/3/i,/4/i]},Js={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},eo={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]},to={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},io={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]},ro={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},no={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}},so={ordinalNumber:Ws({matchPattern:Vs,parsePattern:Ys,valueCallback:r=>parseInt(r,10)}),era:Je({matchPatterns:Xs,defaultMatchWidth:"wide",parsePatterns:js,defaultParseWidth:"any"}),quarter:Je({matchPatterns:Qs,defaultMatchWidth:"wide",parsePatterns:Zs,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Je({matchPatterns:Js,defaultMatchWidth:"wide",parsePatterns:eo,defaultParseWidth:"any"}),day:Je({matchPatterns:to,defaultMatchWidth:"wide",parsePatterns:io,defaultParseWidth:"any"}),dayPeriod:Je({matchPatterns:ro,defaultMatchWidth:"any",parsePatterns:no,defaultParseWidth:"any"})},oo={code:"en-US",formatDistance:Ds,formatLong:Ls,formatRelative:Ms,localize:Gs,match:so,options:{weekStartsOn:0,firstWeekContainsDate:1}};let ao={};function et(){return ao}const mi=6048e5,lo=864e5,pi=Symbol.for("constructDateFrom");function Me(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&pi in r?r[pi](e):r instanceof Date?new r.constructor(e):new Date(e)}function xe(r,e){return Me(e||r,r)}function gi(r){const e=xe(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 co(r,...e){const t=Me.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function _i(r,e){const t=xe(r,e?.in);return t.setHours(0,0,0,0),t}function uo(r,e,t){const[i,s]=co(t?.in,r,e),o=_i(i),a=_i(s),l=+o-gi(o),u=+a-gi(a);return Math.round((l-u)/lo)}function ho(r,e){const t=xe(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function fo(r,e){const t=xe(r,e?.in);return uo(t,ho(t))+1}function tt(r,e){const t=et(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=xe(r,e?.in),o=s.getDay(),a=(o<i?7:0)+o-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function dt(r,e){return tt(r,{...e,weekStartsOn:1})}function yi(r,e){const t=xe(r,e?.in),i=t.getFullYear(),s=Me(t,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=dt(s),a=Me(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=dt(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function mo(r,e){const t=yi(r,e),i=Me(r,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),dt(i)}function po(r,e){const t=xe(r,e?.in),i=+dt(t)-+mo(t);return Math.round(i/mi)+1}function Ri(r,e){const t=xe(r,e?.in),i=t.getFullYear(),s=et(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Me(e?.in||r,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=tt(a,e),u=Me(e?.in||r,0);u.setFullYear(i,0,o),u.setHours(0,0,0,0);const c=tt(u,e);return+t>=+l?i+1:+t>=+c?i:i-1}function go(r,e){const t=et(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,s=Ri(r,e),o=Me(e?.in||r,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),tt(o,e)}function _o(r,e){const t=xe(r,e?.in),i=+tt(t,e)-+go(t,e);return Math.round(i/mi)+1}function le(r,e){const t=r<0?"-":"",i=Math.abs(r).toString().padStart(e,"0");return t+i}const Ke={y(r,e){const t=r.getFullYear(),i=t>0?t:1-t;return le(e==="yy"?i%100:i,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):le(t+1,2)},d(r,e){return le(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 le(r.getHours()%12||12,e.length)},H(r,e){return le(r.getHours(),e.length)},m(r,e){return le(r.getMinutes(),e.length)},s(r,e){return le(r.getSeconds(),e.length)},S(r,e){const t=e.length,i=r.getMilliseconds(),s=Math.trunc(i*Math.pow(10,t-3));return le(s,e.length)}},We={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ci={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(),s=i>0?i:1-i;return t.ordinalNumber(s,{unit:"year"})}return Ke.y(r,e)},Y:function(r,e,t,i){const s=Ri(r,i),o=s>0?s:1-s;if(e==="YY"){const a=o%100;return le(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):le(o,e.length)},R:function(r,e){const t=yi(r);return le(t,e.length)},u:function(r,e){const t=r.getFullYear();return le(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 le(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 le(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 Ke.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 le(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 s=_o(r,i);return e==="wo"?t.ordinalNumber(s,{unit:"week"}):le(s,e.length)},I:function(r,e,t){const i=po(r);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):le(i,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Ke.d(r,e)},D:function(r,e,t){const i=fo(r);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):le(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 s=r.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return le(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},c:function(r,e,t,i){const s=r.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return le(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(s,{width:"narrow",context:"standalone"});case"cccccc":return t.day(s,{width:"short",context:"standalone"});default:return t.day(s,{width:"wide",context:"standalone"})}},i:function(r,e,t){const i=r.getDay(),s=i===0?7:i;switch(e){case"i":return String(s);case"ii":return le(s,e.length);case"io":return t.ordinalNumber(s,{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 s=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(r,e,t){const i=r.getHours();let s;switch(i===12?s=We.noon:i===0?s=We.midnight:s=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(r,e,t){const i=r.getHours();let s;switch(i>=17?s=We.evening:i>=12?s=We.afternoon:i>=4?s=We.morning:s=We.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{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 Ke.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Ke.H(r,e)},K:function(r,e,t){const i=r.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):le(i,e.length)},k:function(r,e,t){let i=r.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):le(i,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ke.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Ke.s(r,e)},S:function(r,e){return Ke.S(r,e)},X:function(r,e,t){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return bi(i);case"XXXX":case"XX":return qe(i);default:return qe(i,":")}},x:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"x":return bi(i);case"xxxx":case"xx":return qe(i);default:return qe(i,":")}},O:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ei(i,":");default:return"GMT"+qe(i,":")}},z:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ei(i,":");default:return"GMT"+qe(i,":")}},t:function(r,e,t){const i=Math.trunc(+r/1e3);return le(i,e.length)},T:function(r,e,t){return le(+r,e.length)}};function Ei(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=Math.trunc(i/60),o=i%60;return o===0?t+String(s):t+String(s)+e+le(o,2)}function bi(r,e){return r%60===0?(r>0?"-":"+")+le(Math.abs(r)/60,2):qe(r,e)}function qe(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=le(Math.trunc(i/60),2),o=le(i%60,2);return t+s+e+o}const Oi=(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"})}},wi=(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"})}},yo={p:wi,P:(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],i=t[1],s=t[2];if(!s)return Oi(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}}",Oi(i,e)).replace("{{time}}",wi(s,e))}},Ro=/^D+$/,Co=/^Y+$/,Eo=["D","DD","YY","YYYY"];function bo(r){return Ro.test(r)}function Oo(r){return Co.test(r)}function wo(r,e,t){const i=To(r,e,t);if(console.warn(i),Eo.includes(r))throw new RangeError(i)}function To(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 vo(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function So(r){return!(!vo(r)&&typeof r!="number"||isNaN(+xe(r)))}const xo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Io=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Do=/^'([^]*?)'?$/,ko=/''/g,No=/[a-zA-Z]/;function Ao(r,e,t){const i=et(),s=t?.locale??i.locale??oo,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=xe(r,t?.in);if(!So(l))throw new RangeError("Invalid time value");let u=e.match(Io).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=yo[h];return f(d,s.formatLong)}return d}).join("").match(xo).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:Lo(d)};if(Ci[h])return{isToken:!0,value:d};if(h.match(No))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(u=s.localize.preprocessor(l,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return u.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!t?.useAdditionalWeekYearTokens&&Oo(h)||!t?.useAdditionalDayOfYearTokens&&bo(h))&&wo(h,e,String(r));const f=Ci[h[0]];return f(l,h,s.localize,c)}).join("")}function Lo(r){const e=r.match(Do);return e?e[1].replace(ko,"'"):r}function Uo(){return Object.assign({},et())}function Ti(r,e,t){const i=Uo(),s=Bo(r,t.timeZone,t.locale??i.locale);return"formatToParts"in s?Mo(s,e):Ko(s,e)}function Mo(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 Bo(r,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:r})}function zo(r,e){const t=$o(e);return"formatToParts"in t?qo(t,r):Ho(t,r)}const Po={year:0,month:1,day:2,hour:3,minute:4,second:5};function qo(r,e){try{const t=r.formatToParts(e),i=[];for(let s=0;s<t.length;s++){const o=Po[t[s].type];o!==void 0&&(i[o]=parseInt(t[s].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Ho(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 kt={},vi=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")),Go=vi==="06/25/2014, 00:00:00"||vi==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function $o(r){return kt[r]||(kt[r]=Go?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"})),kt[r]}function Si(r,e,t,i,s,o,a){const l=new Date(0);return l.setUTCFullYear(r,e,t),l.setUTCHours(i,s,o,a),l}const xi=36e5,Fo=6e4,Nt={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function At(r,e,t){if(!r)return 0;let i=Nt.timezoneZ.exec(r);if(i)return 0;let s,o;if(i=Nt.timezoneHH.exec(r),i)return s=parseInt(i[1],10),Ii(s)?-(s*xi):NaN;if(i=Nt.timezoneHHMM.exec(r),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Ii(s,a)?(o=Math.abs(s)*xi+a*Fo,i[1]==="+"?-o:o):NaN}if(Yo(r)){e=new Date(e||Date.now());const a=t?e:Wo(e),l=Lt(a,r);return-(t?l:Vo(e,l,r))}return NaN}function Wo(r){return Si(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())}function Lt(r,e){const t=zo(r,e),i=Si(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let s=r.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function Vo(r,e,t){let s=r.getTime()-e;const o=Lt(new Date(s),t);if(e===o)return e;s-=o-e;const a=Lt(new Date(s),t);return o===a?o:Math.max(o,a)}function Ii(r,e){return-23<=r&&r<=23&&(e==null||0<=e&&e<=59)}const Di={};function Yo(r){if(Di[r])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:r}),Di[r]=!0,!0}catch{return!1}}const Xo=60*1e3,jo={X:function(r,e,t){const i=Ut(t.timeZone,r);if(i===0)return"Z";switch(e){case"X":return ki(i);case"XXXX":case"XX":return Ve(i);default:return Ve(i,":")}},x:function(r,e,t){const i=Ut(t.timeZone,r);switch(e){case"x":return ki(i);case"xxxx":case"xx":return Ve(i);default:return Ve(i,":")}},O:function(r,e,t){const i=Ut(t.timeZone,r);switch(e){case"O":case"OO":case"OOO":return"GMT"+Qo(i,":");default:return"GMT"+Ve(i,":")}},z:function(r,e,t){switch(e){case"z":case"zz":case"zzz":return Ti("short",r,t);default:return Ti("long",r,t)}}};function Ut(r,e){const t=r?At(r,e,!0)/Xo:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+r);return t}function ht(r,e){const t=r<0?"-":"";let i=Math.abs(r).toString();for(;i.length<e;)i="0"+i;return t+i}function Ve(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=ht(Math.floor(i/60),2),o=ht(Math.floor(i%60),2);return t+s+e+o}function ki(r,e){return r%60===0?(r>0?"-":"+")+ht(Math.abs(r)/60,2):Ve(r,e)}function Qo(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=Math.floor(i/60),o=i%60;return o===0?t+String(s):t+String(s)+e+ht(o,2)}function Ni(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 Zo=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Mt=36e5,Ai=6e4,Jo=2,Ce={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:Zo};function Li(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?Jo: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=ea(r),{year:s,restDateString:o}=ta(i.date,t),a=ia(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let u=0,c;if(i.time&&(u=ra(i.time),u===null||isNaN(u)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=At(i.timeZone||e.timeZone,new Date(l+u)),isNaN(c))return new Date(NaN)}else c=Ni(new Date(l+u)),c=Ni(new Date(l+u+c));return new Date(l+u+c)}else return new Date(NaN)}function ea(r){const e={};let t=Ce.dateTimePattern.exec(r),i;if(t?(e.date=t[1],i=t[3]):(t=Ce.datePattern.exec(r),t?(e.date=t[1],i=t[2]):(e.date=null,i=r)),i){const s=Ce.timeZone.exec(i);s?(e.time=i.replace(s[1],""),e.timeZone=s[1].trim()):e.time=i}return e}function ta(r,e){if(r){const t=Ce.YYY[e],i=Ce.YYYYY[e];let s=Ce.YYYY.exec(r)||i.exec(r);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:r.slice(o.length)}}if(s=Ce.YY.exec(r)||t.exec(r),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:r.slice(o.length)}}}return{year:null}}function ia(r,e){if(e===null)return null;let t,i,s;if(!r||!r.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=Ce.MM.exec(r);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Ki(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=Ce.DDD.exec(r),o){t=new Date(0);const a=parseInt(o[1],10);return oa(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=Ce.MMDD.exec(r),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Ki(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=Ce.Www.exec(r),o)return s=parseInt(o[1],10)-1,Bi(s)?Ui(e,s):new Date(NaN);if(o=Ce.WwwD.exec(r),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Bi(s,a)?Ui(e,s,a):new Date(NaN)}return null}function ra(r){let e,t,i=Ce.HH.exec(r);if(i)return e=parseFloat(i[1].replace(",",".")),Kt(e)?e%24*Mt:NaN;if(i=Ce.HHMM.exec(r),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),Kt(e,t)?e%24*Mt+t*Ai:NaN;if(i=Ce.HHMMSS.exec(r),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Kt(e,t,s)?e%24*Mt+t*Ai+s*1e3:NaN}return null}function Ui(r,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(r,0,4);const s=i.getUTCDay()||7,o=e*7+t+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const na=[31,28,31,30,31,30,31,31,30,31,30,31],sa=[31,29,31,30,31,30,31,31,30,31,30,31];function Mi(r){return r%400===0||r%4===0&&r%100!==0}function Ki(r,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=Mi(r);if(i&&t>sa[e]||!i&&t>na[e])return!1}return!0}function oa(r,e){if(e<1)return!1;const t=Mi(r);return!(t&&e>366||!t&&e>365)}function Bi(r,e){return!(r<0||r>52||e!=null&&(e<0||e>6))}function Kt(r,e,t){return!(r<0||r>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const aa=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Bt(r,e,t={}){e=String(e);const i=e.match(aa);if(i){const s=Li(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,"'"+jo[a[0]](s,a,t)+"'");return u?c.substring(0,l-1)+c.substring(l+1):c},e)}return Ao(r,e,t)}function la(r,e,t){r=Li(r,t);const i=At(e,r,!0),s=new Date(r.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function ca(r,e,t,i){return i={...i,timeZone:e,originalDate:r},Bt(la(r,e,{timeZone:i.timeZone}),t,i)}const ua="#6c7489",da="768px",zi="12px",ha="16px",Pi="32px",fa="12px",qi="20px";var ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ma(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var mt={exports:{}},pa=mt.exports,Hi;function ga(){return Hi||(Hi=1,(function(r,e){(function(t,i){i()})(pa,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 s(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 ft=="object"&&ft.global===ft?ft: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):s(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(s(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",C=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||m&&C||l)&&typeof FileReader<"u"){var R=new FileReader;R.onloadend=function(){var O=R.result;O=b?O:O.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=O:location=O,f=null},R.readAsDataURL(c)}else{var w=a.URL||a.webkitURL,U=w.createObjectURL(c);f?f.location=U:location.href=U,f=null,setTimeout(function(){w.revokeObjectURL(U)},4e4)}});a.saveAs=u.saveAs=u,r.exports=u})})(mt)),mt.exports}var _a=ga(),pt={exports:{}};var ya=pt.exports,Gi;function Ra(){return Gi||(Gi=1,(function(r,e){((t,i)=>{r.exports=i()})(ya,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},s=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,u={};function c(g){return g.charCodeAt(0)===65279?g.slice(1):g}function d(g){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(p){var _=k(p);_.chunkSize=parseInt(_.chunkSize),p.step||p.chunk||(_.chunkSize=null),this._handle=new b(_),(this._handle.streamer=this)._config=_}).call(this,g),this.parseChunk=function(p,_){var M=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<M){let F=this._config.newline;F||(D=this._config.quoteChar||'"',F=this._handle.guessLineEndings(p,D)),p=[...p.split(F).slice(M)].join(F)}this.isFirstChunk&&B(this._config.beforeFirstChunk)&&(D=this._config.beforeFirstChunk(p))!==void 0&&(p=D),this.isFirstChunk=!1,this._halted=!1;var M=this._partialLine+p,D=(this._partialLine="",this._handle.parse(M,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(p=D.meta.cursor,M=(this._finished||(this._partialLine=M.substring(p-this._baseIndex),this._baseIndex=p),D&&D.data&&(this._rowCount+=D.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:D,workerId:u.WORKER_ID,finished:M});else if(B(this._config.chunk)&&!_){if(this._config.chunk(D,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=D=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(D.data),this._completeResults.errors=this._completeResults.errors.concat(D.errors),this._completeResults.meta=D.meta),this._completed||!M||!B(this._config.complete)||D&&D.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),M||D&&D.meta.paused||this._nextChunk(),D}this._halted=!0},this._sendError=function(p){B(this._config.error)?this._config.error(p):o&&this._config.error&&i.postMessage({workerId:u.WORKER_ID,error:p,finished:!1})}}function h(g){var p;(g=g||{}).chunkSize||(g.chunkSize=u.RemoteChunkSize),d.call(this,g),this._nextChunk=s?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(p=new XMLHttpRequest,this._config.withCredentials&&(p.withCredentials=this._config.withCredentials),s||(p.onload=I(this._chunkLoaded,this),p.onerror=I(this._chunkError,this)),p.ontimeout=I(this._chunkTimeout,this),p.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadTimeout&&!s&&(p.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var _,M=this._config.downloadRequestHeaders;for(_ in M)p.setRequestHeader(_,M[_])}var D;this._config.chunkSize&&(D=this._start+this._config.chunkSize-1,p.setRequestHeader("Range","bytes="+this._start+"-"+D));try{p.send(this._config.downloadRequestBody)}catch(F){this._chunkError(F.message)}s&&p.status===0&&this._chunkError()}},this._chunkLoaded=function(){p.readyState===4&&(p.status<200||400<=p.status?this._chunkError():(this._start+=this._config.chunkSize||p.responseText.length,this._finished=!this._config.chunkSize||this._start>=(_=>(_=_.getResponseHeader("Content-Range"))!==null?parseInt(_.substring(_.lastIndexOf("/")+1)):-1)(p),this.parseChunk(p.responseText)))},this._chunkError=function(_){_=p.statusText||_,this._sendError(new Error(_))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function f(g){(g=g||{}).chunkSize||(g.chunkSize=u.LocalChunkSize),d.call(this,g);var p,_,M=typeof FileReader<"u";this.stream=function(D){this._input=D,_=D.slice||D.webkitSlice||D.mozSlice,M?((p=new FileReader).onload=I(this._chunkLoaded,this),p.onerror=I(this._chunkError,this)):p=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var D=this._input,F=(this._config.chunkSize&&(F=Math.min(this._start+this._config.chunkSize,this._input.size),D=_.call(D,this._start,F)),p.readAsText(D,this._config.encoding));M||this._chunkLoaded({target:{result:F}})},this._chunkLoaded=function(D){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(D.target.result)},this._chunkError=function(){this._sendError(p.error)}}function m(g){var p;d.call(this,g=g||{}),this.stream=function(_){return p=_,this._nextChunk()},this._nextChunk=function(){var _,M;if(!this._finished)return _=this._config.chunkSize,p=_?(M=p.substring(0,_),p.substring(_)):(M=p,""),this._finished=!p,this.parseChunk(M)}}function C(g){d.call(this,g=g||{});var p=[],_=!0,M=!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(D){this._input=D,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){M&&p.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),p.length?this.parseChunk(p.shift()):_=!0},this._streamData=I(function(D){try{p.push(typeof D=="string"?D:D.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(p.shift()))}catch(F){this._streamError(F)}},this),this._streamError=I(function(D){this._streamCleanUp(),this._sendError(D)},this),this._streamEnd=I(function(){this._streamCleanUp(),M=!0,this._streamData("")},this),this._streamCleanUp=I(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(g){var p,_,M,D,F=Math.pow(2,53),v=-F,P=/^\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)))$/,W=this,T=0,x=0,q=!1,L=!1,G=[],N={data:[],errors:[],meta:{}};function ce(J){return g.skipEmptyLines==="greedy"?J.join("").trim()==="":J.length===1&&J[0].length===0}function ae(){if(N&&M&&(Q("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),M=!1),g.skipEmptyLines&&(N.data=N.data.filter(function(z){return!ce(z)})),ue()){let z=function(Y){G.push(Y)};if(N)if(Array.isArray(N.data[0])){for(var J=0;ue()&&J<N.data.length;J++)N.data[J].forEach(z);N.data.splice(0,1)}else N.data.forEach(z)}function S(z,Y){for(var te=g.header?{}:[],A=0;A<z.length;A++){var $=A,j=z[A],j=((de,ee)=>(se=>(g.dynamicTypingFunction&&g.dynamicTyping[se]===void 0&&(g.dynamicTyping[se]=g.dynamicTypingFunction(se)),(g.dynamicTyping[se]||g.dynamicTyping)===!0))(de)?ee==="true"||ee==="TRUE"||ee!=="false"&&ee!=="FALSE"&&((se=>{if(P.test(se)&&(se=parseFloat(se),v<se&&se<F))return 1})(ee)?parseFloat(ee):V.test(ee)?new Date(ee):ee===""?null:ee):ee)($=g.header?A>=G.length?"__parsed_extra":G[A]:$,j=g.transform?g.transform(j,$):j);$==="__parsed_extra"?(te[$]=te[$]||[],te[$].push(j)):te[$]=j}return g.header&&(A>G.length?Q("FieldMismatch","TooManyFields","Too many fields: expected "+G.length+" fields but parsed "+A,x+Y):A<G.length&&Q("FieldMismatch","TooFewFields","Too few fields: expected "+G.length+" fields but parsed "+A,x+Y)),te}var K;N&&(g.header||g.dynamicTyping||g.transform)&&(K=1,!N.data.length||Array.isArray(N.data[0])?(N.data=N.data.map(S),K=N.data.length):N.data=S(N.data,0),g.header&&N.meta&&(N.meta.fields=G),x+=K)}function ue(){return g.header&&G.length===0}function Q(J,S,K,z){J={type:J,code:S,message:K},z!==void 0&&(J.row=z),N.errors.push(J)}B(g.step)&&(D=g.step,g.step=function(J){N=J,ue()?ae():(ae(),N.data.length!==0&&(T+=J.data.length,g.preview&&T>g.preview?_.abort():(N.data=N.data[0],D(N,W))))}),this.parse=function(J,S,K){var z=g.quoteChar||'"',z=(g.newline||(g.newline=this.guessLineEndings(J,z)),M=!1,g.delimiter?B(g.delimiter)&&(g.delimiter=g.delimiter(J),N.meta.delimiter=g.delimiter):((z=((Y,te,A,$,j)=>{var de,ee,se,pe;j=j||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var _e=0;_e<j.length;_e++){for(var Oe,ze=j[_e],me=0,we=0,fe=0,ye=(se=void 0,new w({comments:$,delimiter:ze,newline:te,preview:10}).parse(Y)),Te=0;Te<ye.data.length;Te++)A&&ce(ye.data[Te])?fe++:(Oe=ye.data[Te].length,we+=Oe,se===void 0?se=Oe:0<Oe&&(me+=Math.abs(Oe-se),se=Oe));0<ye.data.length&&(we/=ye.data.length-fe),1.99<we&&(ee===void 0||me<ee||me===ee&&pe<we)&&(ee=me,de=ze,pe=we)}return{successful:!!(g.delimiter=de),bestDelimiter:de}})(J,g.newline,g.skipEmptyLines,g.comments,g.delimitersToGuess)).successful?g.delimiter=z.bestDelimiter:(M=!0,g.delimiter=u.DefaultDelimiter),N.meta.delimiter=g.delimiter),k(g));return z.header=ue(),g.preview&&g.header&&z.preview++,p=J,_=new w(z),N=_.parse(p,S,K),ae(),q?{meta:{paused:!0}}:N||{meta:{paused:!1}}},this.paused=function(){return q},this.pause=function(){q=!0,_.abort(),p=B(g.chunk)?"":p.substring(_.getCharIndex())},this.resume=function(){W.streamer._halted?(q=!1,W.streamer.parseChunk(p,!0)):setTimeout(W.resume,3)},this.aborted=function(){return L},this.abort=function(){L=!0,_.abort(),N.meta.aborted=!0,B(g.complete)&&g.complete(N),p=""},this.guessLineEndings=function(Y,z){Y=Y.substring(0,1048576);var z=new RegExp(R(z)+"([^]*?)"+R(z),"gm"),K=(Y=Y.replace(z,"")).split("\r"),z=Y.split(`
2
2
  `),Y=1<z.length&&z[0].length<K[0].length;if(K.length===1||Y)return`
3
3
  `;for(var te=0,A=0;A<K.length;A++)K[A][0]===`
4
4
  `&&te++;return te>=K.length/2?`\r
@@ -8,8 +8,8 @@
8
8
  `);var x=0,q=!1;this.parse=function(L,G,N){if(typeof L!="string")throw new Error("Input must be a string");var ce=L.length,ae=p.length,ue=_.length,Q=M.length,J=B(D),S=[],K=[],z=[],Y=x=0;if(!L)return me();if(v||v!==!1&&L.indexOf(W)===-1){for(var te=L.split(_),A=0;A<te.length;A++){if(z=te[A],x+=z.length,A!==te.length-1)x+=_.length;else if(N)return me();if(!M||z.substring(0,Q)!==M){if(J){if(S=[],pe(z.split(p)),we(),q)return me()}else pe(z.split(p));if(F&&F<=A)return S=S.slice(0,F),me(!0)}}return me()}for(var $=L.indexOf(p,x),j=L.indexOf(_,x),de=new RegExp(R(T)+R(W),"g"),ee=L.indexOf(W,x);;)if(L[x]===W)for(ee=x,x++;;){if((ee=L.indexOf(W,ee+1))===-1)return N||K.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:S.length,index:x}),Oe();if(ee===ce-1)return Oe(L.substring(x,ee).replace(de,W));if(W===T&&L[ee+1]===T)ee++;else if(W===T||ee===0||L[ee-1]!==T){$!==-1&&$<ee+1&&($=L.indexOf(p,ee+1));var se=_e((j=j!==-1&&j<ee+1?L.indexOf(_,ee+1):j)===-1?$:Math.min($,j));if(L.substr(ee+1+se,ae)===p){z.push(L.substring(x,ee).replace(de,W)),L[x=ee+1+se+ae]!==W&&(ee=L.indexOf(W,x)),$=L.indexOf(p,x),j=L.indexOf(_,x);break}if(se=_e(j),L.substring(ee+1+se,ee+1+se+ue)===_){if(z.push(L.substring(x,ee).replace(de,W)),ze(ee+1+se+ue),$=L.indexOf(p,x),ee=L.indexOf(W,x),J&&(we(),q))return me();if(F&&S.length>=F)return me(!0);break}K.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:S.length,index:x}),ee++}}else if(M&&z.length===0&&L.substring(x,x+Q)===M){if(j===-1)return me();x=j+ue,j=L.indexOf(_,x),$=L.indexOf(p,x)}else if($!==-1&&($<j||j===-1))z.push(L.substring(x,$)),x=$+ae,$=L.indexOf(p,x);else{if(j===-1)break;if(z.push(L.substring(x,j)),ze(j+ue),J&&(we(),q))return me();if(F&&S.length>=F)return me(!0)}return Oe();function pe(fe){S.push(fe),Y=x}function _e(fe){var ye=0;return ye=fe!==-1&&(fe=L.substring(ee+1,fe))&&fe.trim()===""?fe.length:ye}function Oe(fe){return N||(fe===void 0&&(fe=L.substring(x)),z.push(fe),x=ce,pe(z),J&&we()),me()}function ze(fe){x=fe,pe(z),z=[],j=L.indexOf(_,x)}function me(fe){if(g.header&&!G&&S.length&&!V){var ye=S[0],Te=Object.create(null),lt=new Set(ye);let Tt=!1;for(let Pe=0;Pe<ye.length;Pe++){let ve=c(ye[Pe]);if(Te[ve=B(g.transformHeader)?g.transformHeader(ve,Pe):ve]){let He,vt=Te[ve];for(;He=ve+"_"+vt,vt++,lt.has(He););lt.add(He),ye[Pe]=He,Te[ve]++,Tt=!0,(P=P===null?{}:P)[He]=ve}else Te[ve]=1,ye[Pe]=ve;lt.add(ve)}Tt&&console.warn("Duplicate headers found and renamed."),V=!0}return{data:S,errors:K,meta:{delimiter:p,linebreak:_,aborted:q,truncated:!!fe,cursor:Y+(G||0),renamedHeaders:P}}}function we(){D(me()),S=[],K=[]}},this.abort=function(){q=!0},this.getCharIndex=function(){return x}}function U(g){var p=g.data,_=a[p.workerId],M=!1;if(p.error)_.userError(p.error,p.file);else if(p.results&&p.results.data){var D={abort:function(){M=!0,O(p.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:E,resume:E};if(B(_.userStep)){for(var F=0;F<p.results.data.length&&(_.userStep({data:p.results.data[F],errors:p.results.errors,meta:p.results.meta},D),!M);F++);delete p.results}else B(_.userChunk)&&(_.userChunk(p.results,D,p.file),delete p.results)}p.finished&&!M&&O(p.workerId,p.results)}function O(g,p){var _=a[g];B(_.userComplete)&&_.userComplete(p),_.terminate(),delete a[g]}function E(){throw new Error("Not implemented.")}function k(g){if(typeof g!="object"||g===null)return g;var p,_=Array.isArray(g)?[]:{};for(p in g)_[p]=k(g[p]);return _}function I(g,p){return function(){g.apply(p,arguments)}}function B(g){return typeof g=="function"}return u.parse=function(g,p){var _=(p=p||{}).dynamicTyping||!1;if(B(_)&&(p.dynamicTypingFunction=_,_={}),p.dynamicTyping=_,p.transform=!!B(p.transform)&&p.transform,p.downloadTimeout!==void 0){var _=parseInt(p.downloadTimeout);if(isNaN(_))throw new Error("Config downloadTimeout value ("+p.downloadTimeout+") not parsable by parseInt(val).");p.downloadTimeout=_}if(!p.worker||!u.WORKERS_SUPPORTED)return _=null,u.NODE_STREAM_INPUT,typeof g=="string"?(g=c(g),_=new(p.download?h:m)(p)):g.readable===!0&&B(g.read)&&B(g.on)?_=new C(p):(i.File&&g instanceof File||g instanceof Object)&&(_=new f(p)),_.stream(g);(_=(()=>{var M;return!!u.WORKERS_SUPPORTED&&(M=(()=>{var D=i.URL||i.webkitURL||null,F=t.toString();return u.BLOB_URL||(u.BLOB_URL=D.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; ","(",F,")();"],{type:"text/javascript"})))})(),(M=new i.Worker(M)).onmessage=U,M.id=l++,a[M.id]=M)})()).userStep=p.step,_.userChunk=p.chunk,_.userComplete=p.complete,_.userError=p.error,p.step=B(p.step),p.chunk=B(p.chunk),p.complete=B(p.complete),p.error=B(p.error),delete p.worker,_.postMessage({input:g,config:p,workerId:_.id})},u.unparse=function(g,p){var _=!1,M=!0,D=",",F=`\r
9
9
  `,v='"',P=v+v,V=!1,W=null,T=!1,x=((()=>{if(typeof p=="object"){if(typeof p.delimiter!="string"||u.BAD_DELIMITERS.filter(function(G){return p.delimiter.indexOf(G)!==-1}).length||(D=p.delimiter),typeof p.quotes!="boolean"&&typeof p.quotes!="function"&&!Array.isArray(p.quotes)||(_=p.quotes),typeof p.skipEmptyLines!="boolean"&&typeof p.skipEmptyLines!="string"||(V=p.skipEmptyLines),typeof p.newline=="string"&&(F=p.newline),typeof p.quoteChar=="string"&&(v=p.quoteChar,P=v+v),typeof p.header=="boolean"&&(M=p.header),Array.isArray(p.columns)){if(p.columns.length===0)throw new Error("Option columns is empty");W=p.columns}p.escapeChar!==void 0&&(P=p.escapeChar+v),p.escapeFormulae instanceof RegExp?T=p.escapeFormulae:typeof p.escapeFormulae=="boolean"&&p.escapeFormulae&&(T=/^[=+\-@\t\r].*$/)}})(),new RegExp(R(v),"g"));if(typeof g=="string"&&(g=JSON.parse(g)),Array.isArray(g)){if(!g.length||Array.isArray(g[0]))return q(null,g,V);if(typeof g[0]=="object")return q(W||Object.keys(g[0]),g,V)}else if(typeof g=="object")return typeof g.data=="string"&&(g.data=JSON.parse(g.data)),Array.isArray(g.data)&&(g.fields||(g.fields=g.meta&&g.meta.fields||W),g.fields||(g.fields=Array.isArray(g.data[0])?g.fields:typeof g.data[0]=="object"?Object.keys(g.data[0]):[]),Array.isArray(g.data[0])||typeof g.data[0]=="object"||(g.data=[g.data])),q(g.fields||[],g.data||[],V);throw new Error("Unable to serialize unrecognized input");function q(G,N,ce){var ae="",ue=(typeof G=="string"&&(G=JSON.parse(G)),typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(G)&&0<G.length),Q=!Array.isArray(N[0]);if(ue&&M){for(var J=0;J<G.length;J++)0<J&&(ae+=D),ae+=L(G[J],J);0<N.length&&(ae+=F)}for(var S=0;S<N.length;S++){var K=(ue?G:N[S]).length,z=!1,Y=ue?Object.keys(N[S]).length===0:N[S].length===0;if(ce&&!ue&&(z=ce==="greedy"?N[S].join("").trim()==="":N[S].length===1&&N[S][0].length===0),ce==="greedy"&&ue){for(var te=[],A=0;A<K;A++){var $=Q?G[A]:A;te.push(N[S][$])}z=te.join("").trim()===""}if(!z){for(var j=0;j<K;j++){0<j&&!Y&&(ae+=D);var de=ue&&Q?G[j]:j;ae+=L(N[S][de],j)}S<N.length-1&&(!ce||0<K&&!Y)&&(ae+=F)}}return ae}function L(G,N){var ce,ae,ue;return G==null?"":G.constructor===Date?isNaN(G.getTime())?"":G.toISOString():(ue=!1,T&&typeof G=="string"&&T.test(G)&&(G="'"+G,ue=!0),ae=(ce=G.toString()).replace(x,P),(ue=ue||_===!0||typeof _=="function"&&_(G,N)||Array.isArray(_)&&_[N]||((Q,J)=>{for(var S=0;S<J.length;S++)if(-1<Q.indexOf(J[S]))return!0;return!1})(ae,u.BAD_DELIMITERS)||-1<ae.indexOf(D)||-1<ce.indexOf(v)||ae.charAt(0)===" "||ae.charAt(ae.length-1)===" ")?v+ae+v:ae)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
10
10
  `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=w,u.ParserHandle=b,u.NetworkStreamer=h,u.FileStreamer=f,u.StringStreamer=m,u.ReadableStreamStreamer=C,o&&(i.onmessage=function(g){g=g.data,u.WORKER_ID===void 0&&g&&(u.WORKER_ID=g.workerId),typeof g.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(g.input,g.config),finished:!0}):(i.File&&g.input instanceof File||g.input instanceof Object)&&(g=u.parse(g.input,g.config))&&i.postMessage({workerId:u.WORKER_ID,results:g,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,(C.prototype=Object.create(d.prototype)).constructor=C,u})})(pt)),pt.exports}var Ca=Ra(),Ye=(r=>(r.String="string",r.Number="number",r.Boolean="boolean",r.Object="object",r.Undefined="undefined",r))(Ye||{});const Ea=["id"],ba=n.defineComponent({__name:"VueJsonCsv",props:{data:{type:Array,required:!0},fields:{type:Array,required:!1,default:null},labels:{type:Object,required:!1,default:null},filename:{type:String,default:"report-data.csv"},delimiter:{type:String,default:",",required:!1},separatorExcel:{type:Boolean,default:!1},encoding:{type:String,default:"utf-8"},testing:{type:Boolean,required:!1,default:!1}},emits:["export-started","export-finished"],setup(r,{emit:e}){const t=e,i=r,s=n.computed(()=>`export_${new Date().getTime()}`),o=n.computed(()=>{const d=u();return d.length?d:null}),a=()=>{const d=i.labels;if(typeof i.fields!==Ye.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return d!==null&&typeof d===Ye.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!==Ye.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===Ye.Undefined&&typeof i.labels===Ye.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=Ca.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});_a.saveAs(h,i.filename)}};return(d,h)=>(n.openBlock(),n.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[n.renderSlot(d.$slots,"default",{},()=>[n.createTextVNode("Download "+n.toDisplayString(r.filename),1)])],8,Ea))}}),Oa=n.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(r){const e=r,t=n.computed(()=>Object.keys(e.headers));return(i,s)=>(n.openBlock(),n.createElementBlock("div",null,[n.createVNode(ba,{data:r.rows,fields:t.value,filename:r.filename,labels:r.headers},{default:n.withCtx(()=>[n.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}}),wa={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",tileActions:"Tile actions",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",principal_group:"Principal group",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 gt(){const r=ct.createI18n("en-us",wa);return{i18n:r,i18nT:ct.i18nTComponent(r)}}const it=170,zt=6,rt=20,Ie="analytics-query-provider",Gi="analytics-dashboard-coordinator",Pt="{entity-id}",$i="{cp-id}",Fi="{timeframe}",Wi=30*1e3,Vi=3e5,Yi=36e5;function Ta(){const r=n.inject(Ie);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var qt={exports:{}},Xi;function va(){return Xi||(Xi=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function o(u,c,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new s(d,h||u,f),C=t?t+c:c;return u._events[C]?u._events[C].fn?u._events[C]=[u._events[C],m]:u._events[C].push(m):(u._events[C]=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,C=new Array(m);f<m;f++)C[f]=h[f].fn;return C},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,C){var b=t?t+c:c;if(!this._events[b])return!1;var R=this._events[b],w=arguments.length,U,O;if(R.fn){switch(R.once&&this.removeListener(c,R.fn,void 0,!0),w){case 1:return R.fn.call(R.context),!0;case 2:return R.fn.call(R.context,d),!0;case 3:return R.fn.call(R.context,d,h),!0;case 4:return R.fn.call(R.context,d,h,f),!0;case 5:return R.fn.call(R.context,d,h,f,m),!0;case 6:return R.fn.call(R.context,d,h,f,m,C),!0}for(O=1,U=new Array(w-1);O<w;O++)U[O-1]=arguments[O];R.fn.apply(R.context,U)}else{var E=R.length,k;for(O=0;O<E;O++)switch(R[O].once&&this.removeListener(c,R[O].fn,void 0,!0),w){case 1:R[O].fn.call(R[O].context);break;case 2:R[O].fn.call(R[O].context,d);break;case 3:R[O].fn.call(R[O].context,d,h);break;case 4:R[O].fn.call(R[O].context,d,h,f);break;default:if(!U)for(k=1,U=new Array(w-1);k<w;k++)U[k-1]=arguments[k];R[O].fn.apply(R[O].context,U)}}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 C=this._events[m];if(C.fn)C.fn===d&&(!f||C.once)&&(!h||C.context===h)&&a(this,m);else{for(var b=0,R=[],w=C.length;b<w;b++)(C[b].fn!==d||f&&!C[b].once||h&&C[b].context!==h)&&R.push(C[b]);R.length?this._events[m]=R.length===1?R[0]:R: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})(qt)),qt.exports}var Sa=va();const xa=ma(Sa);class Ht extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,Ht)}}const ji=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function Ia(r,e){const{milliseconds:t,fallback:i,message:s,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,u;const d=new Promise((h,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(a?.aborted){f(ji(a));return}if(a&&(u=()=>{f(ji(a))},a.addEventListener("abort",u,{once:!0})),r.then(h,f),t===Number.POSITIVE_INFINITY)return;const m=new Ht;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(C){f(C)}return}typeof r.cancel=="function"&&r.cancel(),s===!1?h():s instanceof Error?f(s):(m.message=s??`Promise timed out after ${t} milliseconds`,f(m))},t)}).finally(()=>{d.clear(),u&&a&&a.removeEventListener("abort",u)});return d.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},d}function Da(r,e,t){let i=0,s=r.length;for(;s>0;){const o=Math.trunc(s/2);let a=i+o;t(r[a],e)<=0?(i=++a,s-=o+1):s=o}return i}const ka=100;class Qi{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:s}=t??{},{size:o}=this,a={priority:i,id:s,run:e};if(o===0){this.#t.length=0,this.#e=0,this.#t.push(a);return}if(this.#t.at(-1).priority>=i){this.#t.push(a);return}this.#s();const l=Da(this.#t,a,(u,c)=>c.priority-u.priority);this.#t.splice(l,0,a)}setPriority(e,t){const i=this.#t.findIndex((o,a)=>a>=this.#e&&o.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=this.#t.splice(i,1);this.enqueue(s.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,s)=>s<this.#e?!1:typeof e=="string"?i.id===e:i.run===e);t!==-1&&this.#t.splice(t,1)}dequeue(){if(this.#e===this.#t.length)return;const e=this.#t[this.#e];return this.#e++,this.#e===this.#t.length?(this.#t.length=0,this.#e=0):this.#e>ka&&this.#e>this.#t.length/2&&this.#s(),e?.run}filter(e){const t=[];for(let i=this.#e;i<this.#t.length;i++){const s=this.#t[i];s.priority===e.priority&&t.push(s.run)}return t}get size(){return this.#t.length-this.#e}#s(){this.#e!==0&&(this.#t.splice(0,this.#e),this.#e=0)}}class Na extends xa{#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()}#b(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--}#O(){return this.#o.length-this.#n}get#U(){return this.#e?!0:this.#a?this.#O()<this.#f:this.#s<this.#f}get#M(){return this.#r<this.#g}#K(){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.#b(e),this.#O()>=this.#f){const i=this.#o[this.#n],s=this.#c-(e-i);return this.#S(s),!0}return!1}if(this.#l===void 0){const t=this.#C-e;if(t<0)this.#s=this.#t?this.#r:0;else return this.#S(t),!0}return!1}#S(e){this.#u===void 0&&(this.#u=setTimeout(()=>{this.#B()},e))}#w(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#x(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#y(){if(this.#i.size===0){if(this.#w(),this.emit("empty"),this.#r===0){if(this.#x(),this.#a&&this.#n>0){const t=Date.now();this.#b(t)}this.emit("idle")}return!1}let e=!1;if(!this.#d){const t=Date.now(),i=!this.#z(t);if(this.#U&&this.#M){const s=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),s(),e=!0}}return e}#I(){this.#e||this.#l!==void 0||this.#a||(this.#l=setInterval(()=>{this.#D()},this.#c),this.#C=Date.now()+this.#c)}#D(){this.#a||(this.#l!==void 0&&(this.#s===0&&this.#r===0?this.#w():this.#C=Date.now()+this.#c),this.#s=this.#t?this.#r:0),this.#T(),this.#m()}#T(){for(;this.#y(););}get concurrency(){return this.#g}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#g=e,this.#T()}setPriority(e,t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);this.#i.setPriority(e,t)}async add(e,t={}){if(t={timeout:this.timeout,...t,id:t.id??(this.#N++).toString()},t.timeout!==void 0&&!(Number.isFinite(t.timeout)&&t.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);return new Promise((i,s)=>{const o=Symbol(`task-${t.id}`);let a=()=>{};const l=async()=>{a(),this.#r++,this.#_.set(o,{id:t.id,priority:t.priority??0,startTime:Date.now(),timeout:t.timeout});let c;try{try{t.signal?.throwIfAborted()}catch(f){throw this.#q(),this.#_.delete(o),f}let d=e({signal:t.signal});if(t.timeout!==void 0&&(d=Ia(Promise.resolve(d),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#r} running, ${this.#i.size} waiting)`})),t.signal){const{signal:f}=t;d=Promise.race([d,new Promise((m,C)=>{c=()=>{C(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await d;i(h),this.emit("completed",h)}catch(d){s(d),this.emit("error",d)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#K()})}};this.#i.enqueue(l,t);const u=()=>{if(this.#i instanceof Qi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,d=()=>{a(),u(),s(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",d),this.#E.delete(a)},c.aborted){d();return}c.addEventListener("abort",d,{once:!0}),this.#E.add(a)}this.emit("add"),this.#y()})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this.#d?(this.#d=!1,this.#T(),this):this}pause(){this.#d=!0}clear(){for(const e of this.#E)e();this.#i=new this.#v,this.#w(),this.#k(),this.emit("empty"),this.#r===0&&(this.#x(),this.emit("idle")),this.emit("next")}async onEmpty(){this.#i.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#i.size<e||await this.#h(["next","active"],()=>this.#i.size<e)}async onIdle(){this.#r===0&&this.#i.size===0||await this.#h("idle")}async onPendingZero(){this.#r!==0&&await this.#h("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#h("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#h("rateLimitCleared")}onError(){return new Promise((e,t)=>{const i=s=>{this.off("error",i),t(s)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(s=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);s()}};for(const a of i)this.on(a,o)})}get size(){return this.#i.size}sizeBy(e){return this.#i.filter(e).length}get pending(){return this.#r}get isPaused(){return this.#d}#P(){this.#e||(this.on("add",()=>{this.#i.size>0&&this.#m()}),this.on("next",()=>{this.#m()}))}#m(){this.#e||this.#R||(this.#R=!0,queueMicrotask(()=>{this.#R=!1,this.#k()}))}#q(){this.#e||(this.#L(),this.#m())}#k(){const e=this.#p;if(this.#e||this.#i.size===0){e&&(this.#p=!1,this.emit("rateLimitCleared"));return}let t;if(this.#a){const s=Date.now();this.#b(s),t=this.#O()}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 Aa=()=>{const r=Se.useAnalyticsConfigStore(),e=n.inject(Ie);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 Na({carryoverConcurrencyCount:!0,concurrency:r.maxParallelRequests,interval:r.requestInterval,intervalCap:r.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,o)=>t.add(()=>e.queryFn(s,o))};n.provide(Ie,i)};function La(r){const e=`[${r.name}] ${r.message}`,t=[];return r.fix&&t.push(`fix: ${r.fix}`),r.sources?.length&&t.push(`sources: ${r.sources.join(", ")}`),r.docs&&t.push(`see: ${r.docs}`),t.length===0?e:[e,...t.map((i,s)=>`${s<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
12
- `)}function Zi(r,...e){return typeof r=="function"?r(...e):r}function Ua({method:r="warn",formatter:e=La}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const Ma=Error.captureStackTrace;var Ka=class Fr extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=Fr){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,Ma?.(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 Ba(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function za(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const s of Object.keys(r.codes)){const o=r.codes[s],a=o.docs===!1?void 0:o.docs||Ba(i,s),l=(u={},c={})=>{const d=new Ka({code:s,why:Zi(o.why,u),fix:Zi(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[s]=l}return t}const Pa=typeof window<"u",qa=za({reporters:[Ua()],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"},PINIA_R1008:{why:r=>`"$dispose()" was called on an old instance of store "${r.id}" that has already been replaced by a new one. This also removes the new store.`,fix:"Avoid keeping references to disposed stores. Call the useStore() function again to get the current store.",docs:"https://pinia.vuejs.org/api/pinia/interfaces/StoreWithState.html#-dispose-"}}});let Ji;process.env.NODE_ENV;const er=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Xe(r){const e=n.toRaw(r),t={};for(const i in e){const s=e[i];s?.effect?t[i]=n.computed({get:()=>r[i],set(o){r[i]=o}}):(n.isRef(s)||n.isReactive(s))&&(t[i]=n.toRef(r,i))}return t}const Ne=r=>r?.chart.type==="table",_t=r=>r?.query?.datasource==="requests",Gt=r=>!!r&&!Ne(r)&&!_t(r),Ha=(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},Ga=r=>!r||r==="basic"?"api_usage":ne.isPlatformDatasource(r)?"platform_usage":r;function $a({queryBridge:r,context:e,definition:t,chartData:i}){const s=n.ref(""),o=n.ref(""),a=n.ref(void 0),l=n.ref(void 0),u=Se.useAnalyticsConfigStore(),c=Se.useDatasourceConfigStore(),{stripUnknownFilters:d,datasourceConfigMap:h,datasourceConfigError:f,loading:m}=Xe(c),C=n.computed(()=>Ne(t.value));n.onMounted(async()=>{s.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const b=n.computed(()=>u.analytics&&u.percentiles),R=n.computed(()=>{const v=t.value.chart.type;return["golden_signals","gauge"].includes(v)?!1:v==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),w=n.computed(()=>{const v=t.value.query?.datasource??"api_usage";return v.startsWith("goap")?!f.value:!!h.value[v]?.showRequestsLink}),U=n.computed(()=>{if(_t(t.value))return!1;const v=Ga(t.value.query?.datasource);return!!h.value[v]?.showInUI}),O=n.computed(()=>o.value&&t.value.query&&!C.value&&w.value&&b.value&&!m.value),E=n.computed(()=>s.value&&t.value.query&&U.value&&b.value&&!m.value),k=n.computed(()=>i.value?ne.msToGranularity(i.value.meta.granularity_ms):void 0),I=n.computed(()=>{const v=t.value,P=[...e.value.filters,...v.query.filters??[]],V="metrics"in v.query?v.query.metrics:void 0,W=v.query?.datasource??"api_usage";return d.value({datasource:W,filters:P,queryFields:V})}),B=n.computed(()=>{if(!E.value||!R.value)return"";const v=t.value;if(Ne(v))return F({...v.query,filters:I.value});const P=v.query.time_range||e.value.timeSpec,V=D(P,I.value);return F(V)}),g=n.computed(()=>{if(!O.value||!R.value)return"";const v=I.value,P=t.value;if(Ne(P))return"";const V=_(P.query.time_range||e.value.timeSpec,v);return p(V)}),p=v=>O.value?`${o.value}?q=${JSON.stringify(v)}`:"",_=(v,P)=>{const V=i.value?.meta?.start?new Date(i.value.meta.start):void 0,W=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:P,timeframe:{timePeriodsKey:v.type==="relative"?v.time_range:"custom",start:v.type==="absolute"?V:void 0,end:v.type==="absolute"?W:void 0}}},M=(v,P)=>({filter:P,timeframe:{timePeriodsKey:v.type==="relative"?v.time_range:"custom",start:v.type==="absolute"?v.start:void 0,end:v.type==="absolute"?v.end:void 0}}),D=(v,P)=>{const V=t.value;if(!Gt(V))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const W=[...V.query.dimensions??[]],T=[...V.query.metrics??[]];return{filters:P,metrics:T,dimensions:W,time_range:v,granularity:V.query.granularity||k.value||void 0}},F=v=>{if(!E.value)return"";const P=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${s.value}?q=${JSON.stringify(v)}&d=${P}&c=${t.value.chart.type}`};return n.watch([O,E],([v,P])=>{v&&(a.value={href:""}),P&&(l.value={href:""})}),{exploreLinkKebabMenu:B,requestsLinkKebabMenu:g,canShowKebabMenu:R,canGenerateRequestsLink:O,canGenerateExploreLink:E,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:D,buildRequestsQueryZoomActions:M,buildExploreLink:F,buildRequestLink:p}}const $t=r=>r.type==="relative"?ne.TimePeriods.get(ne.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Fa=r=>r.reduce((e,t)=>{const i=ne.TimePeriods.get(ne.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Ft=(r,e)=>{if(!r||!e?.length)return;const t=$t(r),i=Fa(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},Wt=(r,e)=>{const t=Ft(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 Wa(){const r=n.inject(Ie),e=Se.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;return n.onUnmounted(()=>{s?.abort()}),{issueQuery:async(a,l,u)=>{if(!r)throw new Error("Query bridge is not defined");s?.abort();const c=new AbortController;s=c,await e.isReady();const{datasource:d,limit:h,...f}=a,m=d||"basic",C=ne.isPlatformDatasource(m),b=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:U})=>!C||!ne.requestFilterTypeEmptyV2.some(O=>O===U));let R=a.time_range;!R&&l.timeSpec?R={...l.timeSpec,tz:l.tz}:R&&!R.tz&&(R={...R,tz:l.tz}),R=Wt(R,t.value[m]?.timeRangeOptions);const w={datasource:m,query:{...f,time_range:R,filters:b,limit:u??h}};return r.queryFn(w,c)}}}const Va="24H",Ya={status_code:"response_http_status",upstream_status_code:"upstream_status"},Xa={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"},ja=r=>ne.relativeTimeRangeValuesRequestV2.includes(r),Qa=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:ja(t)?t:Va,...e}},tr=r=>Ya[r]??r,Za=r=>({metric:tr(r.metric),dimension:r.dimension?tr(r.dimension):void 0,unroll:r.unroll,metricUnit:Xa[r.metric],extraFields:r.extra_fields}),Vt="requests";function Ja(){const r=n.inject(Ie),e=Se.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;n.onUnmounted(()=>{s?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return Wt(c&&{...c,tz:c.tz??u.tz},t.value[Vt]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");s?.abort();const d=new AbortController;s=d,await e.isReady();const h=i.value({datasource:Vt,filters:[...l.filters??[],...u.filters]});return ne.fetchAllRequests(c,{datasource:Vt,query:{filters:h,time_range:Qa(o(l,u))}},d,{maxRecords:l.max_records})}}}function el({context:r,globalFilters:e=n.ref([]),isFullscreen:t=n.ref(!1),preview:i=n.ref(!1)}){const s=Se.useAnalyticsConfigStore(),o=Se.useDatasourceConfigStore(),{loading:a}=Xe(s),{loading:l}=Xe(o),u=n.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:s.defaultQueryTimeForOrg}),c=n.computed(()=>{const{tz:E}=r.value;return E||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=n.computed(()=>{const{editable:E}=r.value;return E===void 0||i.value?!1:E}),h=n.computed(()=>{const{showTileActions:E}=r.value;return i.value?!1:E===void 0?!0:E}),f=n.computed(()=>[...r.value.filters??[],...e.value]),m=n.computed(()=>{let{refreshInterval:E}=r.value;if(E===void 0&&(E=Wi),t.value){let k=!1;if(u.value.type==="relative")k=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const g=u.value.start.getTime(),p=u.value.end.getTime();k=Math.abs(p-g)<=864e5}const I=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<I||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?E=0:k?E=Vi:E=Yi}return E}),C=n.computed(()=>({...r.value,filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:m.value,editable:d.value,showTileActions:h.value})),b=n.computed(()=>!a.value&&!l.value),R=n.computed(()=>!i.value&&!!n.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),w=n.computed(()=>!i.value),U=n.computed(()=>!i.value),O=n.computed(()=>({enabled:R.value,showExploreAction:w.value,showRequestsAction:U.value,showZoomInAction:R.value}));return{editable:d,enrichedContext:C,filters:f,queryReady:b,refreshInterval:m,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:O}}const tl=6,ir=6,rr=4;function il(r,e){const{pageWidth:t,pageHeight:i,margin:s}=e,o=s+1,a=s+e.headerHeight-3,l=i-s-ir+3,u=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,s,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-s,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,s,o+rr),r.setDrawColor(220),r.line(s,a,t-s,a),r.line(s,l,t-s,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,s,u);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const d=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(d,s+c,u,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(d,s+c,u)),r.setTextColor(120),r.text(e.pageLabel,t-s,u,{align:"right"})}function rl(r){const e=r.querySelectorAll(".kong-ui-public-grid-layout, .grid-stack"),t=[];if(e.forEach(o=>{t.push(...o.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item"))}),!t.length)return[];const i=r.getBoundingClientRect().top,s=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),u=Math.round(a.bottom-i),c=s.get(l);s.set(l,c!==void 0?Math.max(c,u):u)}),[...s.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function nl(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const u=Math.min(t,e-l);a.push({startY:l,height:u}),l+=u}return a}const s=[];let o=0;for(const a of r){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(s.push({startY:o,height:l-o}),o=l):(s.push({startY:o,height:u-o}),o=u))}return o<e&&s.push({startY:o,height:e-o}),s}function sl(r){const{i18n:e}=gt(),t=n.ref({status:"idle"});async function i(s={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:u,orientation:c="landscape",pageSize:d="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:C="download",onBeforeCapture:b,onAfterCapture:R}=s,w=r.value;if(!w){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await b?.();const[{snapdom:U},{jsPDF:O}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const E={name:"kong-webgl-snapshot",beforeClone:()=>ne.prepareForCapture(),afterClone:()=>ne.restoreAfterCapture()},k=await U.toCanvas(w,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[E]}),I=rl(w),B=w.getBoundingClientRect().width,g=B?k.width/B:f;t.value={status:"generating"};const p=new Date,_=new O({orientation:c,unit:"mm",format:d}),M=_.internal.pageSize.getWidth(),D=_.internal.pageSize.getHeight(),F=tl+(l?rr:0),v=M-h*2,P=D-h*2-F-ir,V=k.width/v,W=P*V,T=nl(I,k.height,W,g),x={title:a,subtitle:l,dashboardUrl:u,generatedAt:e.t("pdfExport.generated",{timestamp:p.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:M,pageHeight:D,headerHeight:F,margin:h};for(let q=0;q<T.length;q++){q>0&&_.addPage();const{startY:L,height:G}=T[q],N=document.createElement("canvas");N.width=k.width,N.height=G,N.getContext("2d").drawImage(k,0,L,k.width,G,0,0,k.width,G),_.addImage(N.toDataURL("image/png"),"PNG",h,h+F,v,G/V),il(_,{...x,pageLabel:e.t("pdfExport.pageOf",{page:String(q+1),total:String(T.length)})})}if(C==="blob"){const q=_.output("blob");return t.value={status:"complete",pageCount:T.length},q}_.save(o),t.value={status:"complete",pageCount:T.length}}catch(U){t.value={status:"error",error:U}}finally{ne.restoreAfterCapture(),await R?.()}}return{exportPdf:i,exportState:n.readonly(t)}}const ol=r=>r.toLowerCase().endsWith("count")?"":r;function al(){const{i18n:r}=gt(),{formatUnit:e}=ne.unitFormatter({i18n:r}),t=he.useFieldLabel();return i=>{const s=i.meta?.metric_names?.[0]??"",o=i.meta?.metric_units?.[s]??"";return{seriesName:t(s),valueFormatter:a=>e(a,o,{translateUnit:ol})}}}const nr=(r,e,t,{prefix:i="chartLabels",fallback:s=t}={})=>{const o=`${i}.${t}`;return e.get(t)||(r.te(o)?r.t(o):s)};function ll(){const{i18n:r}=gt(),e=Se.useDatasourceConfigStore();return(t,i)=>nr(r,e.fieldTranslationMap,t,i)}const he={useContextLinks:$a,useDashboardContext:el,useEvaluateFeatureFlag:Ta,useExportPdf:sl,useFieldLabel:ll,useI18n:gt,useIssueQuery:Wa,useIssueRequestsQuery:Ja,useMetricFormatter:al,useRequestQueue:Aa},cl={class:"kong-ui-public-csv-export-modal"},ul={key:0,class:"selected-range"},dl={key:4,class:"text-muted",tag:"span"},sr=3,or=n.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=he.useI18n(),i=he.useFieldLabel(),s=r,o=e,a=`${s.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,l=n.ref(1),u=n.computed(()=>m.value.rows.length),c=n.computed(()=>s.exportState.status==="success"&&!!s.exportState.chartData?.data?.length),d=n.computed(()=>{if(s.exportState.status!=="success"||!s.exportState.chartData?.meta)return"";const{start:b,end:R}=s.exportState.chartData.meta;return!b||!R?"":new Date(b).getTime()===new Date(R).getTime()?t.t("csvExport.exportAsOf",{time:ne.formatTimestamp(new Date(b),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ne.formatTimestamp(new Date(b))} - ${ne.formatTimestamp(new Date(R),{includeTZ:!0})}`}),h=n.computed(()=>s.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(sr,u.value),rowsTotal:u.value,plural:u.value===1?"":"s"})),f=()=>{o("closeModal")},m=n.computed(()=>{if(s.exportState.status!=="success"||!c.value||!s.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const b=s.exportState.chartData,R=b.data.some(I=>I.timestamp!==b.data[0].timestamp),w=b.data.map(I=>{const B=new Date(I.timestamp);return{...Object.keys(I.event).reduce((p,_)=>{if(_ in b.meta.display){const M=I.event[_],D=b.meta.display[_],F=M&&D?.[M]?.name||I.event[_];p[_]=M===Re.OTHER_DIMENSION_ID?t.t("chartLabels.____OTHER____"):F}else p[_]=I.event[_];return p},{}),...R?{timestamp:Bt(B,"yyyy-MM-dd HH:mm:ss"),tzOffset:Bt(B,"XXX")}:{}}});let U=[];R&&(U=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const O="display"in s.exportState.chartData.meta&&s.exportState.chartData.meta.display?s.exportState.chartData.meta.display:{},E=[...U,...Object.keys(O).map(I=>({label:i(I),key:I})),...s.exportState.chartData.meta.metric_names.map(I=>({label:i(I),key:I}))],k=E.reduce((I,B)=>(I[B.key]=B.label,I),{});return{headers:E,csvHeaders:k,rows:w}}),C=async()=>{if(s.exportState.status!=="success")return{total:0,data:[]};const{rows:b}=m.value;return{total:Number(b.length)||0,data:b.slice(0,sr)}};return n.watch(m,()=>{l.value++}),(b,R)=>{const w=n.resolveComponent("KSkeleton"),U=n.resolveComponent("KEmptyState"),O=n.resolveComponent("KTableData"),E=n.resolveComponent("KTooltip"),k=n.resolveComponent("KButton"),I=n.resolveComponent("KModal");return n.openBlock(),n.createElementBlock("div",cl,[n.createVNode(I,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:n.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:f,onKeyup:n.withKeys(f,["esc"])},{default:n.withCtx(()=>[n.createElementVNode("div",null,[r.exportState.status==="success"&&c.value?(n.openBlock(),n.createElementBlock("div",ul,[n.createElementVNode("p",null,n.toDisplayString(r.modalDescription?r.modalDescription:n.unref(t).t("csvExport.exportDescription")),1),n.createElementVNode("p",null,n.toDisplayString(d.value),1)])):n.createCommentVNode("",!0),r.exportState.status==="loading"?(n.openBlock(),n.createBlock(w,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(n.openBlock(),n.createBlock(O,{key:2,class:"vitals-table",fetcher:C,"fetcher-cache-key":String(l.value),headers:m.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":n.withCtx(()=>[n.createVNode(U,{"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRange")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):r.exportState.status==="error"?(n.openBlock(),n.createBlock(U,{key:3,"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.dataError")),1)]),_:1})):n.createCommentVNode("",!0),r.exportState.status==="success"&&c.value?(n.openBlock(),n.createElementBlock("div",dl,[n.createTextVNode(n.toDisplayString(h.value)+" ",1),n.createVNode(E,{class:"preview-tooltip",placement:"right",text:n.unref(t).t("csvExport.maximumRecordAmount",{value:n.unref(ne.EXPORT_RECORD_LIMIT)})},{default:n.withCtx(()=>[n.createVNode(n.unref(oe.InfoIcon),{color:`var(--kui-color-text-neutral, ${n.unref(ua)})`,size:`var(--kui-icon-size-30, ${n.unref(ha)})`},null,8,["color","size"])]),_:1},8,["text"])])):n.createCommentVNode("",!0)])]),"footer-actions":n.withCtx(()=>[n.createVNode(k,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.cancelButton")),1)]),_:1}),n.createVNode(Oa,{class:"vitals-report-export-button",filename:a,headers:m.value.csvHeaders,rows:m.value.rows},{default:n.withCtx(()=>[n.createVNode(k,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!c.value},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}});var ar=(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))(ar||{});const hl=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 lr(r=n.ref({}),e,t,i=hl){const s=n.ref("PENDING");return n.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){s.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){s.value="VALIDATING";return}if(r.value&&e.value){s.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){s.value="PENDING";return}if(r.value&&!e.value&&o){s.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){s.value="SUCCESS";return}r.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:ar}}const Be=n.defineComponent({__name:"QueryDataProvider",props:{context:{},limitOverride:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),{issueQuery:o}=he.useIssueQuery(),a=n.inject(Ie),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=si(l,async E=>{try{const k=await o(t.query,t.context,t.limitOverride);return l()!==E?void 0:(C.value=null,{key:E,result:k})}catch(k){if(l()!==E)return;throw C.value=Re.handleQueryError(k),k}finally{l()===E&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),h=n.computed(()=>u.value?.result),{state:f,swrvState:m}=lr(u,c,d),C=n.ref(null),b=n.computed(()=>f.value===m.ERROR||!!C.value),R=n.computed(()=>!t.queryReady||f.value===m.PENDING),w=n.ref(),U=n.computed(()=>h.value??(t.queryReady&&f.value===m.PENDING?w.value:void 0)),O=n.computed(()=>!!U.value&&u.value?.key!==l());return n.watch([()=>h.value,()=>f.value],([E,k])=>{E&&(k==="SUCCESS_HAS_DATA"||k==="SUCCESS")&&E!==w.value&&(w.value=E,i("chart-data",E))},{immediate:!0}),(E,k)=>{const I=n.resolveComponent("KSkeleton"),B=n.resolveComponent("KEmptyState");return(R.value||!h.value&&!b.value)&&!U.value?(n.openBlock(),n.createBlock(I,{key:0,class:"chart-skeleton",type:"table"})):b.value&&!R.value?(n.openBlock(),n.createBlock(B,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[C.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(oe.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(oe.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(C.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[C.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(C.value.details),1)]),key:"0"}:void 0]),1024)):U.value?(n.openBlock(),n.createBlock(n.unref(Re.LoadingOverlay),{key:2,loading:O.value},{default:n.withCtx(()=>[n.renderSlot(E.$slots,"default",{data:U.value})]),_:3},8,["loading"])):n.createCommentVNode("",!0)}}}),fl=n.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){const e=r,t=n.computed(()=>e.chartOptions.type==="single_value"),i=n.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend",compact:!!e.fitToContent,hideMetricName:!e.chartOptions.chart_title}:e.chartOptions);return(s,o)=>(n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:a})=>[n.createElementVNode("div",{class:n.normalizeClass(["analytics-chart",{"single-value":t.value,compact:t.value&&r.fitToContent}]),style:n.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[n.createVNode(n.unref(Re.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"]))}}),De=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},cr=De(fl,[["__scopeId","data-v-df5d87ad"]]),ml={class:"analytics-chart"},Yt=De(n.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),o=n.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold,metricAxisMap:t.chartOptions.metric_axis_map,yAxes:t.chartOptions.y_axes&&{left:a(t.chartOptions.y_axes.left),right:a(t.chartOptions.y_axes.right)},hideTruncationWarning:t.query.limit!==void 0&&t.query.limit>0})),a=c=>c&&{title:c.title,showGrid:c.show_grid},l=()=>{i("edit-tile")},u=c=>{i("chart-data",c)};return(c,d)=>{const h=n.resolveComponent("KDropdownItem");return n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:u},{default:n.withCtx(({data:f})=>[n.createElementVNode("div",ml,[n.createVNode(n.unref(Re.AnalyticsChart),n.mergeProps({"active-metric":r.activeMetric,"chart-data":f,"chart-options":o.value,"explore-link":r.exploreLink,"legend-position":"bottom","requests-link":r.requestsLink,"synthetics-data-key":r.chartOptions.synthetics_data_key,"timeseries-zoom":r.zoomConfiguration?.showZoomInAction,"tooltip-title":""},r.extraProps,{onSelectChartRange:d[0]||(d[0]=m=>i("select-chart-range",m)),onZoomTimeRange:d[1]||(d[1]=m=>i("zoom-time-range",m))}),n.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:n.withCtx(()=>[n.createVNode(h,{onClick:l},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["active-metric","chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-5e3d0a14"]]),ur=n.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Yt,{"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"]))}}),pl={class:"analytics-chart"},gl={key:3,class:"analytics-chart"},_l=De(n.defineComponent({__name:"ScatterChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),{issueRequestsQuery:o}=he.useIssueRequestsQuery(),a=n.computed(()=>t.query.datasource==="requests"),l=n.computed(()=>{const I=t.query,B=I.time_range??t.context.timeSpec,g=B?$t(B):void 0;if(!g)return I;const p=ne.finestGranularityForDuration(g);let _;return I.granularity&&ne.Granularities[I.granularity]>=ne.Granularities[p]?_=I.granularity:_=p,{...I,granularity:_}}),u=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=n.ref(null),{data:d,error:h,isValidating:f}=si(u,async I=>{const B=t.query;try{const g=await o(B,t.context);return u()!==I?void 0:(c.value=null,{key:I,result:Re.requestsToScatterData(g,Za(B))})}catch(g){if(u()!==I)return;throw c.value=Re.handleQueryError(g),g}finally{u()===I&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),m=n.computed(()=>d.value?.result),{state:C,swrvState:b}=lr(d,h,f),R=n.ref(),w=n.computed(()=>m.value??R.value);n.watch(m,I=>{I&&(R.value=I)});const U=n.computed(()=>C.value===b.ERROR||!!c.value),O=n.computed(()=>!U.value&&(!t.queryReady||C.value===b.PENDING)&&!w.value),E=n.computed(()=>!!w.value&&d.value?.key!==u()),k=n.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(I=>({percentile:I.percentile,label:I.label,borderDash:I.border_dash,color:I.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(I,B)=>{const g=n.resolveComponent("KSkeleton"),p=n.resolveComponent("KEmptyState");return a.value?O.value?(n.openBlock(),n.createBlock(g,{key:1,class:"chart-skeleton",type:"table"})):U.value?(n.openBlock(),n.createBlock(p,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[c.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(oe.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(oe.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):w.value?(n.openBlock(),n.createElementBlock("div",gl,[n.createVNode(n.unref(Re.AnalyticsChart),{"chart-data":w.value,"chart-options":k.value,"legend-position":"bottom",loading:E.value,"synthetics-data-key":r.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","loading","synthetics-data-key"])])):n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Be,{key:0,context:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:B[0]||(B[0]=_=>i("chart-data",_)),onQueryComplete:B[1]||(B[1]=_=>i("query-complete"))},{default:n.withCtx(({data:_})=>[n.createElementVNode("div",pl,[n.createVNode(n.unref(Re.AnalyticsChart),{"chart-data":_,"chart-options":k.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-f6f628be"]]),dr=n.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["zoom-time-range","select-chart-range"],setup(r,{emit:e}){const t=e;return(i,s)=>(n.openBlock(),n.createBlock(Yt,{"active-metric":r.activeMetric,"chart-options":r.chartOptions,context:r.context,"explore-link":r.exploreLink,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,"requests-link":r.requestsLink,"zoom-configuration":r.zoomConfiguration,onSelectChartRange:s[0]||(s[0]=o=>t("select-chart-range",o)),onZoomTimeRange:s[1]||(s[1]=o=>t("zoom-time-range",o))},null,8,["active-metric","chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link","zoom-configuration"]))}}),yl=De(n.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>{const s=e.query?.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:e.query?.datasource,overrideTimeRange:e.context.timeSpec,additionalFilter:e.context.filters,longCardTitles:e.chartOptions.long_card_titles,percentileLatency:e.chartOptions.percentile_latency,refreshInterval:e.context.refreshInterval,queryReady:e.queryReady,refreshCounter:e.refreshCounter}}),i=n.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(s,o)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[n.createVNode(n.unref(oi.MetricsProvider),n.normalizeProps(n.guardReactiveProps(t.value)),{default:n.withCtx(()=>[n.createVNode(n.unref(oi.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]),Rl="analytics-dashboard-coordinator",Cl=({gridApi:r,headers:e,coordinator:t=n.inject(Rl,void 0)})=>{const i=crypto.randomUUID(),s=n.ref(null),o=n.computed(()=>new Set(e.value.map(C=>C.key))),a=n.ref(null),l=C=>C==null?null:String(C),u=C=>{const b=a.value,R=s.value;return!!C&&b!==null&&R!==null&&l(C[b])===R};let c,d=0,h=null;t&&n.watch([t.activeChart,t.activeDimension,t.activeDimensionValue],([C,b,R])=>{clearTimeout(c);const w=b!==null&&o.value.has(b)&&C!==i;c=setTimeout(()=>{const U=w?R:null,O=w?b:null;if(U===s.value&&O===a.value)return;s.value=U,a.value=O;const E=r.value;E&&!E.isDestroyed()&&E.redrawRows()},t.DIMENSION_DEBOUNCE_MS)});const f=(C,b,R)=>{const w=l(R);if(!t||!b||!C||w===null||!o.value.has(C))return;const U=`${C}\0${w}`;if(U===h)return;const O=Date.now();O-d<t.DIMENSION_DEBOUNCE_MS||(d=O,h=U,t.activate({chartUuid:i,dimension:C,dimensionValue:w}))},m=()=>{h=null,d=0,t?.deactivate({chartUuid:i})};return n.onBeforeUnmount(()=>{clearTimeout(c),m()}),{isHighlighted:u,onCellHover:f,onGridLeave:m}};var nt=(r=>(r.PENDING="PENDING",r.LOADING="LOADING",r.SUCCESS="SUCCESS",r.ERROR="ERROR",r))(nt||{});const El=r=>!!r?.length;function bl(r,e,t,i=El){const s=n.computed(()=>i(r.value)),o=n.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":s.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:nt,hasData:s,state:o}}const Ol=({emitState:r,fetchLifecycleState:e,hasData:t})=>{n.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:s})=>{if(s!==nt.PENDING){if(s===nt.LOADING){r({hasData:i,state:"loading"});return}if(s===nt.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},wl=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},Tl=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:s})=>{if(typeof i=="number")return i;if(s!==!0&&(s===!1||e<t))return r+e},vl=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,s=new Map,o=n.ref(0),a=n.ref(0),l=n.shallowRef(),u=n.shallowRef(),c=n.shallowRef(),d=n.ref(0),h=n.ref(!1);let f,m,C=t?.value?.sortColumnKey,b=t?.value?.sortColumnOrder;const R=v=>v===o.value&&f===r.value&&m===e?.value,w=(v,P)=>R(v)&&P===a.value&&C===t?.value?.sortColumnKey&&b===t?.value?.sortColumnOrder,U=v=>{if(!t)return!0;const P=t.value;return!P?.sortColumnKey||!P.sortColumnOrder?v.length===0:v.length===1&&v[0].colId===P.sortColumnKey&&v[0].sort===P.sortColumnOrder},O=()=>{h.value=d.value>0},E=()=>{a.value+=1,C=t?.value?.sortColumnKey,b=t?.value?.sortColumnOrder;for(const v of s.values())v.resolve(!1);i.clear(),s.clear(),u.value=void 0,c.value=void 0,d.value=0,O()},k=()=>{c.value=void 0,d.value+=1,O()},I=()=>{d.value=Math.max(0,d.value-1),O()},B=v=>{const P=s.get(v);if(P)return P;let V;const W={promise:new Promise(T=>{V=T}),resolve:T=>V(T)};return s.set(v,W),W},g=(v,P)=>{P.resolve(!1),s.get(v)===P&&s.delete(v)},p=async({blockIndex:v,currentBlockCompletion:P,datasourceId:V,requestGeneration:W})=>{if(v===0)return"ready";const T=s.get(v-1);if(!T)return g(v,P),"failed";const x=await T.promise;return w(V,W)?x?"ready":(g(v,P),"failed"):(g(v,P),"stale")},_=({blockIndex:v,currentBlockCompletion:P,getRowsParams:V,pageSize:W,result:T})=>{T.cursor!==void 0&&i.set(v,T.cursor),V.successCallback(T.data,Tl({startRow:V.startRow,rowsLength:T.data.length,pageSize:W,total:T.total,hasMore:T.hasMore})),V.startRow===0&&(u.value=T.data),P.resolve(!0)},M=({blockIndex:v,currentBlockCompletion:P,fetchError:V,getRowsParams:W})=>{c.value=V,W.failCallback(),g(v,P)},D=()=>{const v=r.value;if(!v)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=v,m=e?.value;const P=o.value+1;return o.value=P,E(),{async getRows(V){if(!R(P)||!U(V.sortModel)){V.failCallback();return}const{blockIndex:W,pageSize:T}=wl({startRow:V.startRow,endRow:V.endRow});W===0&&s.has(0)&&E();const x=a.value,q=B(W);if(await p({blockIndex:W,currentBlockCompletion:q,datasourceId:P,requestGeneration:x})!=="ready"||!w(P,x)){V.failCallback(),g(W,q);return}k();try{const L=W>0?i.get(W-1):void 0,G=await v({mode:"infinite",pageSize:T,cursor:L,sort:t?.value});if(!w(P,x)){V.failCallback(),g(W,q);return}_({blockIndex:W,currentBlockCompletion:q,getRowsParams:V,pageSize:T,result:G})}catch(L){if(!w(P,x)){V.failCallback(),g(W,q);return}M({blockIndex:W,currentBlockCompletion:q,fetchError:L,getRowsParams:V})}finally{w(P,x)&&I()}}}},F=()=>{l.value=D()};return n.watch([r,()=>e?.value],()=>{F()},{immediate:!0}),n.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>E()),{datasource:n.readonly(l),data:n.shallowReadonly(u),error:n.readonly(c),isFetching:n.readonly(h)}},Sl={title:"No Data",message:"There is no data to display."},xl={title:"An error occurred",message:"Data cannot be displayed due to an error."},Il={emptyState:Sl,errorState:xl};function hr(){const r=ct.createI18n("en-us",Il);return{i18n:r,i18nT:ct.i18nTComponent(r)}}const{i18n:Dl}=hr(),fr=(r,e)=>{const t=Reflect.get(e,r.key);return r.valueFormatter?r.valueFormatter(t,e):String(t??"")},yt=r=>typeof r!="number"?null:Number.isFinite(r)?r:null,kl=(r,e)=>r.reduce((t,i)=>{const s=yt(Reflect.get(i,e.key));return s===null?t:{sum:t.sum+s,max:Math.max(t.max,s)}},{sum:0,max:0}),Nl=(r,e)=>{const t=(e??[]).filter(s=>Number.isFinite(s.value)&&r>=s.value);if(!t.length)return;const i=Math.max(...t.map(s=>s.value));return t.filter(s=>s.value===i).some(s=>s.type==="error")?"error":"warning"},Al=(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},Ll=r=>{const e=t=>Dl.formatNumber(t,{maximumFractionDigits:2});return r>0&&r<.01?`< ${e(.01)} %`:`${e(r)} %`},mr=({value:r,stats:e,header:t})=>{if(r===null||e.sum<=0)return;const i=r/e.sum*100;return t.percentageFormatter?.(i)??Ll(i)},pr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Ul=({rows:r,header:e,stats:t})=>r.reduce((i,s)=>({value:pr(i.value,fr(e,s))??"",relative:e.showPercentage?pr(i.relative,mr({value:yt(Reflect.get(s,e.key)),stats:t,header:e})):void 0}),{value:""}),Ml=["data-threshold"],Kl={class:"table-data-grid-cell-label-track"},Bl={class:"table-data-grid-cell-label"},zl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},Pl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},ql=["data-text"],Hl=["data-text"],Gl=["data-threshold"],$l=n.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=n.shallowRef(r.params),i=n.ref(null),s=n.ref(!1),o=n.computed(()=>t.value.headerDef??{key:"",label:""}),a=n.computed(()=>t.value.context?.presentation),l=n.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),u=n.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=n.computed(()=>t.value.value),d=n.computed(()=>yt(c.value)),h=n.computed(()=>a.value?.stats[o.value.key]),f=n.computed(()=>o.value.showPercentage&&h.value?mr({value:d.value,stats:h.value,header:o.value}):void 0),m=n.computed(()=>!!o.value.bar&&!!h.value&&(d.value!==null||c.value===null||c.value===void 0)),C=n.computed(()=>m.value&&h.value?Al(d.value,h.value,o.value.bar)*100:0),b=n.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),R=n.computed(()=>o.value.thresholds?.length&&d.value!==null?Nl(d.value,o.value.thresholds):void 0),w=n.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})),U=(_,{slots:M})=>{const D=t.value.colDef?.colId,F=t.value.context?.cells?.slots;return!D||D==="cell-icon"||!F?.[D]?M.default?.():n.h("span",{class:"table-data-grid-cell-slot-content"},n.renderSlot(F,D,w.value,()=>M.default?.()??[]))},O=()=>{const _=t.value.context?.cells?.slots;return _?.["cell-icon"]?n.renderSlot(_,"cell-icon",w.value):null};let E,k,I=!1;const B=()=>{const _=i.value;s.value=!!_&&_.scrollWidth>_.clientWidth},g=()=>{I||(k!==void 0&&cancelAnimationFrame(k),k=requestAnimationFrame(()=>{k=void 0,B()}))},p=_=>{if(E?.disconnect(),_){E?.observe(_);const M=_.closest(".ag-cell");M&&E?.observe(M)}g()};return n.onMounted(()=>{E=new ResizeObserver(g),p(i.value)}),n.watch(i,p),n.onUnmounted(()=>{I=!0,E?.disconnect(),k!==void 0&&cancelAnimationFrame(k)}),e({refresh(_){return t.value=_,n.nextTick(g),!0}}),(_,M)=>{const D=n.resolveComponent("KTooltip");return n.openBlock(),n.createElementBlock("span",{class:n.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":m.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${R.value}`]:!m.value&&!!R.value}]),"data-threshold":R.value},[n.createElementVNode("span",Kl,[n.createElementVNode("span",Bl,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(O))),(n.openBlock(),n.createBlock(n.resolveDynamicComponent(U),null,{default:n.withCtx(()=>[n.createVNode(D,{class:"table-data-grid-cell-tooltip",disabled:!s.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:u.value},{default:n.withCtx(()=>[n.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},n.toDisplayString(u.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(n.openBlock(),n.createElementBlock("span",zl,"("+n.toDisplayString(f.value)+")",1)):n.createCommentVNode("",!0)]),b.value?(n.openBlock(),n.createElementBlock("span",Pl,[n.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":b.value.value},null,8,ql),b.value.relative?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${b.value.relative})`},null,8,Hl)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":R.value},[n.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:n.normalizeStyle({width:`${C.value}%`})},null,4)],8,Gl)):n.createCommentVNode("",!0)],10,Ml)}}}),Fl=({headers:r,slots:e,initialSort:t,mode:i,rows:s,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,u=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);n.watch([r,()=>s?.value],()=>{r.value.forEach(m=>{if(!u(m))return;let C;if(a==="infinite"&&(m.showPercentage||m.bar)?C="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&s?.value?.some(R=>{const w=Reflect.get(R,m.key);return w!=null&&yt(w)===null})&&(C="contains non-finite or nonnumeric values; numeric presentation skips those values"),!C)return;const b=`${m.key}:${C}`;l.has(b)||(l.add(b),console.warn(`[TableDataGrid] Column "${m.key}" ${C}.`))})},{immediate:!0});const c=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(C=>C.showPercentage||C.bar).map(C=>[C.key,kl(m,C)]))}),d=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(C=>C.bar).map(C=>[C.key,Ul({rows:m,header:C,stats:c.value[C.key]})]))}),h=n.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:d.value}})),f=m=>{const C=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,...C?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:b=>b.data?.[m.key],valueFormatter:b=>b.data?fr(m,b.data):String(b.value??""),width:m.width,cellRenderer:$l,cellRendererParams:{headerDef:m}}};return{columnDefs:n.computed(()=>r.value.map(f)),gridContext:h}},Xt=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),s=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:s,sortColumnOrder:s?r?.sortColumnOrder:void 0,pageSize:r?.pageSize??t,...r?.fitToContent!==void 0?{fitToContent:r.fitToContent}:{}}},gr=(r,e)=>r.sortColumnKey===e.sortColumnKey&&r.sortColumnOrder===e.sortColumnOrder&&r.pageSize===e.pageSize&&r.fitToContent===e.fitToContent,Wl=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:s,onExternalConfigChange:o})=>{const a=n.computed(()=>t.value?Xt({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=n.ref(a.value??Xt({config:void 0,headers:r.value,pageSize:e.value}));n.watch(a,h=>{h&&!gr(h,l.value)&&(l.value=h,o?.(h))});const u=h=>{const f=Xt({config:{...l.value,...h},headers:r.value,pageSize:e.value});gr(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,s(f))};n.watch(r,()=>{t.value||u({})},{deep:!0});const c=n.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),d=n.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:n.readonly(l),activeSort:c,activePageSize:d,patchTableConfig:u}},Vl=({cellClick:r,headers:e,rowClick:t})=>{const i=n.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),s=a=>{const l=a.event?.target;return l instanceof Element?l.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},o=a=>{const l=s(a);return!!(l&&i.value.has(l))};return{onCellClick:a=>{const l=a.colDef.colId;!a.data||!l||r({columnKey:l,row:a.data,value:a.value})},onRowClick:a=>{a.data&&!o(a)&&t(a.data,a)}}},Yl=({activeSort:r,patchTableConfig:e})=>{const t=(i,s)=>{i.applyColumnState({state:s.sortColumnKey?[{colId:s.sortColumnKey,sort:s.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const s=i.api.getColumnState().filter(l=>l.sort).sort((l,u)=>(l.sortIndex??0)-(u.sortIndex??0)),o=s[s.length-1],a=o?{sortColumnKey:o.colId,sortColumnOrder:o.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(a.sortColumnKey!==r.value.sortColumnKey||a.sortColumnOrder!==r.value.sortColumnOrder)&&e(a),s.length>1&&t(i.api,a)},applySortToGrid:t}},Xl={key:0,class:"table-error-state","data-testid":"table-error-state"},jl={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Ql=n.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(r,{emit:e}){je.ModuleRegistry.registerModules([je.AllCommunityModule,je.ClientSideRowModelModule,je.InfiniteRowModelModule]);const t=r.mode??"infinite",i=e,{i18n:s}=hr(),{t:o}=s,a=n.useSlots(),l=n.shallowRef(),u=n.useTemplateRef("rootElement"),c=n.shallowRef("body"),d=()=>{const Q=document.fullscreenElement;c.value=Q instanceof HTMLElement&&Q.contains(u.value??null)?Q:"body"};n.onMounted(()=>{d(),document.addEventListener("fullscreenchange",d)}),n.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",d)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:C}=Wl({headers:n.toRef(()=>r.headers),pageSize:n.toRef(()=>r.pageSize),tableConfig:n.toRef(()=>r.tableConfig),emitSort:Q=>i("sort",Q),emitTableConfigUpdate:Q=>i("update:tableConfig",Q),onExternalConfigChange:Q=>{l.value&&R(l.value,Q)}}),{onSortChanged:b,applySortToGrid:R}=Yl({activeSort:f,patchTableConfig:C}),w=n.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),U=je.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:O,onRowClick:E}=Vl({cellClick:Q=>i("cell:click",Q),headers:n.toRef(()=>r.headers),rowClick:(Q,J)=>i("row:click",Q,J)}),{isHighlighted:k,onCellHover:I,onGridLeave:B}=Cl({gridApi:l,headers:n.toRef(()=>r.headers)}),g={"is-coordinator-highlighted":Q=>k(Q.data)},p=Q=>I(Q.colDef.colId,Q.data,Q.value),_={resizable:!1,sortable:!1,suppressMovable:!0},M=n.computed(()=>[m.value,r.refreshKey]),D=t==="infinite"?vl({fetcher:n.toRef(()=>r.fetcher),resetKey:M,sort:f}):void 0,F=D?.datasource,v=n.computed(()=>D?D.data.value:r.rows),P=n.computed(()=>D?.isFetching.value??!1),V=n.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:W,gridContext:T}=Fl({headers:n.toRef(()=>r.headers),mode:t,rows:V,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:x,hasData:q,state:L}=bl(v,n.toRef(()=>D?.error.value),P),G=n.computed(()=>L.value===x.SUCCESS&&!q.value);D&&Ol({emitState:Q=>i("state",Q),fetchLifecycleState:L,hasData:q});const N=()=>{const Q=l.value;if(!Q||Q.isDestroyed())return;const J=f.value,S=Q.getColumnState().find(K=>K.sort);S?.colId===J.sortColumnKey&&(S?.sort??void 0)===J.sortColumnOrder||R(Q,J)};n.watch([l,f],N);const ce=n.ref(!1),ae=Q=>{Q.direction==="vertical"&&(ce.value=Q.top>0)},ue=Q=>{l.value=Q.api,i("grid:ready",Q.api)};return(Q,J)=>{const S=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"rootElement",ref:u,class:n.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":w.value,"is-scrolled":ce.value}]),"data-testid":"table-data-grid",onMouseleave:J[0]||(J[0]=(...K)=>n.unref(B)&&n.unref(B)(...K))},[r.error?(n.openBlock(),n.createElementBlock("div",Xl,[n.renderSlot(Q.$slots,"error-state",{},()=>[n.createVNode(S,{"icon-variant":"error",message:n.unref(o)("errorState.message"),title:n.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):G.value?(n.openBlock(),n.createElementBlock("div",jl,[n.renderSlot(Q.$slots,"empty-state",{},()=>[n.createVNode(S,{message:n.unref(o)("emptyState.message"),title:n.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(n.openBlock(),n.createBlock(n.unref(Wr.AgGridVue),{key:2,"cache-block-size":n.unref(t)==="infinite"?n.unref(m):void 0,class:"table-data-grid-grid","column-defs":n.unref(W),context:n.unref(T),datasource:n.unref(t)==="infinite"?n.unref(F):void 0,"default-col-def":_,"dom-layout":w.value?"autoHeight":"normal","infinite-initial-row-count":n.unref(t)==="infinite"?1:void 0,loading:P.value,"row-class-rules":g,"row-data":n.unref(t)==="unpaginated"?V.value:void 0,"row-model-type":n.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:n.unref(U),onBodyScroll:ae,onCellClicked:n.unref(O),onCellMouseOver:p,onGridReady:ue,onNewColumnsLoaded:N,onRowClicked:n.unref(E),onSortChanged:n.unref(b)},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"]))],34)}}}),Zl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},_r=Zl(Ql,[["__scopeId","data-v-47e593a5"]]),yr=3,Jl={anthropic:oe.AnthropicIcon,azure:oe.AzureIcon,bedrock:oe.AmazonBedrockIcon,cerebras:oe.CerebrasIcon,cohere:oe.CohereIcon,databricks:oe.DatabricksIcon,deepseek:oe.DeepseekIcon,gemini:oe.GeminiIcon,huggingface:oe.HuggingFaceIcon,llama2:oe.MetaLlamaIcon,mistral:oe.MistralIcon,moonshot:oe.KimiIcon,nvidia:oe.NvidiaIcon,ollama:oe.OllamaIcon,openai:oe.OpenAiIcon,vertex:oe.GoogleVertexIcon,vllm:oe.VllmIcon,xai:oe.GrokIcon},jt=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},ec=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!(jt(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Jl[t.toLowerCase()]},tc=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},ic=r=>r.toLocaleLowerCase().endsWith("count"),rc=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,yr),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const s={record:i};return e.forEach(o=>{s[o]=i.event[o]}),t.forEach(o=>{s[o]=tc(i.event[o])}),s})},nc=({data:r,columnOptions:e,i18n:t,fieldTranslationMap:i})=>{const{formatUnit:s}=ne.unitFormatter({i18n:t}),o=r?.data??[],a=r?.meta,l=a?.display??{},u=Object.keys(l).slice(0,yr),c=a?.metric_names??[],d=c[0],h=u.length>1,f=E=>nr(t,i,E),m=(E,k)=>jt(e,E)?.label||k,C=(E,k)=>{if(ic(E)||E==="requests")return"";const I=k===1?"":"s",B=`chartUnits.${E}`;return t.messages[B]?t.formatMessage({id:B},{plural:I}):E},b=E=>{const k=I=>s(I,"%",{translateUnit:C});return E>0&&E<.01?`< ${k(.01)}`:k(E)},R=(E,k)=>{const I=E.event[k];if(I==null)return"–";const B=typeof I=="number"?I:Number(I);if(Number.isNaN(B))return"–";const g=a?.metric_units?.[k]||"count";return g==="%"?b(B):s(B,g,{approximate:["count","count/minute","token count"].includes(g),isBytes1024:!0,translateUnit:C})},w=(E,k)=>{const I=String(E.record.event[k]),B=l[k]?.[I];return{id:I,label:I===Re.OTHER_DIMENSION_ID?t.t("chartLabels.____OTHER____"):B?.name||"-",deleted:!!B?.deleted}},U=u.map(E=>({key:E,label:m(E,h?f(E):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(k,I)=>w(I,E).label,sortable:!1}));c.forEach(E=>{const k=jt(e,E);U.push({key:E,label:k?.label||f(E),type:"metric",valueFormatter:(I,B)=>R(B.record,E),showPercentage:k?.value==="relative",percentageFormatter:b,bar:k?.bar==="max"?"absolute":k?.bar,thresholds:k?.thresholds,sortable:!1})});const O=o.length?a?u.some(E=>!Object.keys(l[E]||{}).length)?t.t("topNTable.errors.display"):d?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:U,errorMessage:O,getDimension:w}},sc={class:"fallback-entity-link","data-testid":"entity-link-parent"},Rr=n.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",sc,n.toDisplayString(r.entityLinkData.label),1))}}),oc=["data-testid"],ac={key:1},lc=De(n.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=n.inject(Ie),t=Se.useDatasourceConfigStore(),{i18n:i}=he.useI18n(),s=n.computed(()=>rc(r.data)),o=n.computed(()=>nc({data:r.data,columnOptions:r.chartOptions.column_options,i18n:i,fieldTranslationMap:t.fieldTranslationMap})),a=n.computed(()=>o.value.headers.map(R=>({...R,minWidth:R.type==="dimension"?160:R.bar?260:140}))),l=n.computed(()=>o.value.headers.filter(R=>R.type==="dimension")),u=n.computed(()=>({fitToContent:r.fitToContent})),c=n.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),d=(R,w)=>ec({columnOptions:r.chartOptions.column_options,columnKey:R,rawValue:w}),h=n.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return Rr}return Rr}),f=R=>{const w=r.chartOptions.entity_links;return w&&(w[R]||Object.entries(w).find(([U])=>U.toLowerCase()===R.toLowerCase())?.[1])||""},m=R=>f(R)||l.value[0]?.key===R&&r.chartOptions.entity_link||"",C=(R,w)=>R[w]!=="empty"&&R[w]!==Re.OTHER_DIMENSION_ID,b=(R,w)=>{const U=m(w),O=String(R[w]);if(O.includes(":")){const[E,k]=O.split(":");return U.replace($i,E).replace(Pt,k)}return U.replace(Pt,O)};return(R,w)=>{const U=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{class:"top-n-data-grid","data-testid":s.value.length?"top-n-table":void 0,style:n.normalizeStyle(c.value)},[n.createVNode(n.unref(_r),{error:!!o.value.errorMessage,headers:a.value,mode:"unpaginated",rows:s.value,"table-config":u.value},n.createSlots({"error-state":n.withCtx(()=>[n.createVNode(U,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:n.withCtx(()=>[n.createVNode(n.unref(oe.WarningOutlineIcon))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(o.value.errorMessage),1)]),_:1})]),"empty-state":n.withCtx(()=>[n.createVNode(U,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:n.unref(i).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":n.withCtx(({column:O,rowValue:E})=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d(O.key,E)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[n.renderList(l.value,O=>({name:O.key,fn:n.withCtx(({row:E})=>[m(O.key)&&C(E,O.key)?(n.openBlock(),n.createBlock(n.unref(h),{key:0,class:"top-n-entity-link","entity-link-data":o.value.getDimension(E,O.key),"external-link":b(E,O.key)},null,8,["entity-link-data","external-link"])):o.value.getDimension(E,O.key).label==="empty"?(n.openBlock(),n.createElementBlock("i",ac,"empty")):n.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,oc)}}}),[["__scopeId","data-v-bbc29e85"]]),cc=n.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:i})=>[n.createVNode(lc,{"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"]))}}),uc=n.defineComponent({__name:"TopTalkersRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["query-complete"],setup(r,{emit:e}){const t=r,i=e,s=n.computed(()=>t.chartOptions.columns.map(c=>({dimension:c.dimension,label:c.label}))),o=c=>({...t.query,dimensions:[c.dimension],filters:[...t.query.filters??[],...c.filters??[]]}),a=n.computed(()=>new Map(s.value.map((c,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===s.value.length&&(l.clear(),i("query-complete"))};return n.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(n.openBlock(),n.createBlock(n.unref(Re.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:s.value,"size-metric":r.chartOptions.size_metric},{column:n.withCtx(({column:h})=>[n.createVNode(Be,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>u(h)},{default:n.withCtx(({data:f})=>[n.createVNode(n.unref(Re.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"]))}}),dc=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,s])=>{if(s===null)return;const o=r.meta.display?.[i]?.[String(s)]?.name;o&&(t[i]=o)}),t}),Cr=({columns:r,fieldLabel:e})=>r.map(t=>({key:t,label:e(t)})),hc={platform:Cr,platform_usage:Cr},Er=async({abortController:r,context:e,cursor:t,pageSize:i,query:s,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const u=s.query,c=a({datasource:s.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:s.datasource,query:{columns:u.columns,cursor:t===void 0?u.cursor:String(t),entity:u.entity,filters:c,page_size:i}},r);return d.meta.columns?.length&&o?.(d.meta.columns),{data:dc(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},fc={platform:Er,platform_usage:Er},mc=De(n.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,s=n.inject(Ie),o=Se.useDatasourceConfigStore(),a=he.useFieldLabel(),l=new AbortController,u=n.ref([]),c=n.ref(!1),d=n.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=n.computed(()=>({datasource:t.query.datasource,query:{columns:t.query.columns,cursor:t.query.cursor,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size}})),f=n.computed(()=>JSON.stringify({refreshCounter:t.refreshCounter,query:{columns:t.query.columns,datasource:t.query.datasource,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size},context:{filters:t.context.filters,timeSpec:t.context.timeSpec,tz:t.context.tz}}));n.onUnmounted(()=>{l.abort()});const m=n.computed(()=>hc[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,fieldLabel:R=>a(R)})),C=n.computed(()=>async({cursor:R,pageSize:w})=>{try{await o.isReady();const U=fc[h.value.datasource];if(!U)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const O=await U({abortController:l,context:t.context,cursor:R,pageSize:w,query:h.value,onResponseColumns:E=>{u.value=E},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:s?.tabularQueryFn});return c.value=!1,O}catch(U){throw c.value=!0,U}}),b=R=>{R.state==="error"&&(c.value=!0),i("loading-change",R.state==="loading")};return(R,w)=>{const U=n.resolveComponent("KSkeleton");return n.openBlock(),n.createElementBlock("div",{class:"table-data-grid-renderer",style:n.normalizeStyle(d.value)},[r.queryReady?(n.openBlock(),n.createBlock(n.unref(_r),{key:1,error:c.value,fetcher:C.value,headers:m.value,"page-size":r.query.page_size,"refresh-key":f.value,onState:b},null,8,["error","fetcher","headers","page-size","refresh-key"])):(n.openBlock(),n.createBlock(U,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c8caabc2"]]),pc=n.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Yt,{"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"]))}}),br="#ffffff",gc="#0044f4",_c="#d60027",yc="#ad000e",Rc="#850000",Cc="#5c0000",Ec="#ff3954",bc="#ffabab",Oc="#ffe5e5",wc="#ecfcff",Tc="#6f28ff",vc="#f1f0ff",Sc="#e0e4ea",xc="#0044f4",Ic="#0030cc",Dc="#002099",kc="#001466",Nc="#5f9aff",Ac="#bee2ff",Lc="#eefaff",Uc="#0d0e14",Mc="#6c7489",Kc="#52596e",Bc="#3a3f51",zc="#232633",Pc="#afb7c5",qc="#e0e4ea",Hc="#f9fafb",Gc="rgba(13, 14, 20, 0.6)",$c="#0044f4",Fc="#0030cc",Wc="#002099",Vc="#001466",Yc="#5f9aff",Xc="#bee2ff",jc="#eefaff",Qc="#007d60",Zc="#005944",Jc="#004737",eu="#003629",tu="#00d6a4",iu="#b5ffee",ru="#ecfffb",nu="rgba(0, 0, 0, 0)",su="#995c00",ou="#804400",au="#662d00",lu="#4d1b00",cu="#ffc400",uu="#fff296",du="#fffce0",Or="#e0e4ea",hu="#0044f4",fu="#d60027",mu="#ad000e",pu="#850000",gu="#5c0000",_u="#ff3954",yu="#ffabab",Ru="#ffe5e5",Cu="#6f28ff",Eu="#e0e4ea",bu="rgba(255, 255, 255, 0.2)",Ou="#6c7489",wu="#52596e",Tu="#3a3f51",vu="#232633",Su="#afb7c5",xu="#e0e4ea",Iu="#f9fafb",Du="#0044f4",ku="#0030cc",Nu="#002099",Au="#001466",Lu="#5f9aff",Uu="#bee2ff",Mu="#eefaff",Ku="rgba(0, 0, 0, 0)",Bu="#0044f4",zu="#0d0e14",Pu="#0044f4",qu="#d60027",Hu="#ad000e",Gu="#850000",$u="#5c0000",Fu="#ff3954",Wu="#ffabab",Vu="#ffe5e5",Yu="#00abd2",Xu="#d60067",ju="#6f28ff",Qu="#5e00f5",Zu="#afb7c5",Ju="#0044f4",ed="#0030cc",td="#002099",id="#001466",rd="#5f9aff",nd="#bee2ff",sd="#eefaff",od="#ffffff",ad="#6c7489",ld="#52596e",cd="#3a3f51",ud="#232633",dd="#afb7c5",hd="#e0e4ea",fd="#f9fafb",md="#0044f4",pd="#0030cc",gd="#002099",_d="#001466",yd="#5f9aff",Rd="#bee2ff",Cd="#eefaff",Ed="#007d60",bd="#005944",Od="#004737",wd="#003629",Td="#00d6a4",vd="#b5ffee",Sd="#ecfffb",xd="#995c00",Id="#804400",Dd="#662d00",kd="#4d1b00",Nd="#ffc400",Ad="#fff296",Ld="#fffce0",Ud="0.2s",Md="0px",Kd="2px",Bd="4px",wr="6px",zd="8px",Pd="10px",qd="12px",Hd="16px",Gd="20px",$d="24px",Fd="32px",Wd="50%",Vd="100px",Yd="0px",Tr="1px",Xd="2px",jd="4px",Qd="640px",Zd="768px",Jd="1024px",eh="1280px",th="1536px",ih="'JetBrains Mono', Consolas, monospace",rh="'Inter', Roboto, Helvetica, sans-serif",Qt="'Inter', Roboto, Helvetica, sans-serif",nh="10px",sh="12px",oh="14px",ah="16px",lh="18px",ch="20px",uh="24px",dh="32px",hh="40px",fh="48px",mh="700",ph="500",gh="400",_h="600",yh="#f50045",Rh="#828a9e",Ch="#306fff",Eh="#00a17b",bh="#ffc400",Oh="10px",wh="12px",Th="16px",vh="20px",Sh="24px",xh="32px",Ih="40px",Dh="48px",kh="normal",Nh="-0.12px",Ah="-0.24px",Lh="-0.32px",Uh="-0.4px",Mh="-0.48px",Kh="normal",Bh="12px",zh="16px",Ph="20px",qh="24px",Hh="28px",Gh="32px",$h="36px",Fh="40px",Wh="48px",Vh="56px",Yh="#f1f0ff",Xh="#ffe5e5",jh="#eefaff",Qh="#52596e",Zh="#e0e4ea",Jh="#ecfcff",ef="#ecfffb",tf="#fffce0",rf="#fff0f7",nf="#6f28ff",sf="#5e00f5",of="#d60027",af="#ad000e",lf="#0044f4",cf="#0030cc",uf="#e0e4ea",df="#afb7c5",hf="#52596e",ff="#3a3f51",mf="#00819d",pf="#00647a",gf="#007d60",_f="#005944",yf="#995c00",Rf="#804400",Cf="#d60067",Ef="#ad0053",bf="#000933",Of="rgba(255, 255, 255, 0.12)",wf="rgba(255, 255, 255, 0.12)",Tf="#00fabe",vf="rgba(255, 255, 255, 0.24)",Sf="#bee2ff",xf="#ffffff",If="#eefaff",Df="#00fabe",kf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",Nf="4px 0 0 0 #00fabe inset",Af="0 0 0 1px rgba(255, 255, 255, 0.60) inset",vr="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",Lf="0px 0px 0px 1px #e0e4ea inset",Uf="0px 0px 0px 1px #d60027 inset",Mf="0px 0px 0px 1px #ad000e inset",Kf="0px 0px 0px 1px #e0e4ea inset",Bf="0px 0px 0px 1px #0044f4 inset",zf="0px 0px 0px 1px #001466 inset",Pf="0px 0px 0px 1px #5f9aff inset",qf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Hf="0px",Gf="2px",$f="4px",Ff="6px",Wf="8px",Vf="12px",Yf="16px",Xf="20px",jf="24px",Qf="32px",Zf="40px",Jf="48px",em="56px",tm="64px",im="80px",rm="96px",nm="auto",sm="#bee2ff",om="#8fc1ff",am="#5f9aff",lm="#306fff",cm="#b5ffee",um="#00fabe",dm="#00d6a4",hm="#00a17b",fm="#007d60",mm="#005944",pm="#b5ffee",gm="#00fabe",_m="#b5ffee",ym="#00a17b",Rm="#fff296",Cm="#ffe04b",Em="#ffc400",bm="#b37600",Om="#995c00",wm="#804400",Tm="#fff296",vm="#ffe04b",Sm="#ffc2b3",xm="#ff9877",Im="#ff723c",Dm="#f75008",km="#d13500",Nm="#a31f00",Am="#ffc2b3",Lm="#ff9877",Um="#ff723c",Mm="#f75008",Km="#d13500",Bm="#a31f00",zm="#ffc2b3",Pm="#ff9877",qm="#ff723c",Hm="#f75008",Gm="#d13500",$m="#a31f00",Fm="#ffc2b3",Wm="#ff9877",Vm="#ff723c",Ym="#f75008",Xm="#d13500",jm="#a31f00",Qm="#ffc2b3",Zm="#ff9877",Jm="#ff723c",ep="#f75008",tp="#d13500",ip="#ffabab",rp="#ff7272",np="#ff3954",sp="#f50045",op="#d60027",ap="#ad000e",lp="#ffabab",cp="#ff7272",up="#ff3954",dp="#f50045",hp="#d60027",fp="#eefaff",mp="#ecfffb",pp="#fffce0",gp="#fff1ef",_p="#ffe5e5",yp="#5f9aff",Rp="#00d6a4",Cp="#ffc400",Ep="#ff723c",bp="#ff3954",Op="#eefaff",wp="#ecfffb",Tp="#fffce0",vp="#fff1ef",Sp="#ffe5e5",xp="#0044f4",Ip="#007d60",Dp="#995c00",kp="#d13500",Np="#d60027",Sr=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Ud,KUI_BORDER_RADIUS_0:Md,KUI_BORDER_RADIUS_10:Kd,KUI_BORDER_RADIUS_100:Fd,KUI_BORDER_RADIUS_20:Bd,KUI_BORDER_RADIUS_30:wr,KUI_BORDER_RADIUS_40:zd,KUI_BORDER_RADIUS_50:Pd,KUI_BORDER_RADIUS_60:qd,KUI_BORDER_RADIUS_70:Hd,KUI_BORDER_RADIUS_80:Gd,KUI_BORDER_RADIUS_90:$d,KUI_BORDER_RADIUS_CIRCLE:Wd,KUI_BORDER_RADIUS_ROUND:Vd,KUI_BORDER_WIDTH_0:Yd,KUI_BORDER_WIDTH_10:Tr,KUI_BORDER_WIDTH_20:Xd,KUI_BORDER_WIDTH_30:jd,KUI_BREAKPOINT_DESKTOP:th,KUI_BREAKPOINT_LAPTOP:eh,KUI_BREAKPOINT_MOBILE:Qd,KUI_BREAKPOINT_PHABLET:Zd,KUI_BREAKPOINT_TABLET:Jd,KUI_COLOR_BACKGROUND:br,KUI_COLOR_BACKGROUND_ACCENT:gc,KUI_COLOR_BACKGROUND_DANGER:_c,KUI_COLOR_BACKGROUND_DANGER_STRONG:yc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:Rc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:Cc,KUI_COLOR_BACKGROUND_DANGER_WEAK:Ec,KUI_COLOR_BACKGROUND_DANGER_WEAKER:bc,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:Oc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:wc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:Tc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:vc,KUI_COLOR_BACKGROUND_DISABLED:Sc,KUI_COLOR_BACKGROUND_INFO:xc,KUI_COLOR_BACKGROUND_INFO_STRONG:Ic,KUI_COLOR_BACKGROUND_INFO_STRONGER:Dc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:kc,KUI_COLOR_BACKGROUND_INFO_WEAK:Nc,KUI_COLOR_BACKGROUND_INFO_WEAKER:Ac,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Lc,KUI_COLOR_BACKGROUND_INVERSE:Uc,KUI_COLOR_BACKGROUND_NEUTRAL:Mc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Kc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:Bc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:zc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Pc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:qc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Hc,KUI_COLOR_BACKGROUND_OVERLAY:Gc,KUI_COLOR_BACKGROUND_PRIMARY:$c,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Fc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:Wc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Vc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Yc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Xc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:jc,KUI_COLOR_BACKGROUND_SUCCESS:Qc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Zc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Jc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:eu,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:tu,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:iu,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:ru,KUI_COLOR_BACKGROUND_TRANSPARENT:nu,KUI_COLOR_BACKGROUND_WARNING:su,KUI_COLOR_BACKGROUND_WARNING_STRONG:ou,KUI_COLOR_BACKGROUND_WARNING_STRONGER:au,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:lu,KUI_COLOR_BACKGROUND_WARNING_WEAK:cu,KUI_COLOR_BACKGROUND_WARNING_WEAKER:uu,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:du,KUI_COLOR_BORDER:Or,KUI_COLOR_BORDER_ACCENT:hu,KUI_COLOR_BORDER_DANGER:fu,KUI_COLOR_BORDER_DANGER_STRONG:mu,KUI_COLOR_BORDER_DANGER_STRONGER:pu,KUI_COLOR_BORDER_DANGER_STRONGEST:gu,KUI_COLOR_BORDER_DANGER_WEAK:_u,KUI_COLOR_BORDER_DANGER_WEAKER:yu,KUI_COLOR_BORDER_DANGER_WEAKEST:Ru,KUI_COLOR_BORDER_DECORATIVE_PURPLE:Cu,KUI_COLOR_BORDER_DISABLED:Eu,KUI_COLOR_BORDER_INVERSE:bu,KUI_COLOR_BORDER_NEUTRAL:Ou,KUI_COLOR_BORDER_NEUTRAL_STRONG:wu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:Tu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:vu,KUI_COLOR_BORDER_NEUTRAL_WEAK:Su,KUI_COLOR_BORDER_NEUTRAL_WEAKER:xu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:Iu,KUI_COLOR_BORDER_PRIMARY:Du,KUI_COLOR_BORDER_PRIMARY_STRONG:ku,KUI_COLOR_BORDER_PRIMARY_STRONGER:Nu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Au,KUI_COLOR_BORDER_PRIMARY_WEAK:Lu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Uu,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Mu,KUI_COLOR_BORDER_TRANSPARENT:Ku,KUI_COLOR_BRAND:Bu,KUI_COLOR_TEXT:zu,KUI_COLOR_TEXT_ACCENT:Pu,KUI_COLOR_TEXT_DANGER:qu,KUI_COLOR_TEXT_DANGER_STRONG:Hu,KUI_COLOR_TEXT_DANGER_STRONGER:Gu,KUI_COLOR_TEXT_DANGER_STRONGEST:$u,KUI_COLOR_TEXT_DANGER_WEAK:Fu,KUI_COLOR_TEXT_DANGER_WEAKER:Wu,KUI_COLOR_TEXT_DANGER_WEAKEST:Vu,KUI_COLOR_TEXT_DECORATIVE_AQUA:Yu,KUI_COLOR_TEXT_DECORATIVE_PINK:Xu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:ju,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Qu,KUI_COLOR_TEXT_DISABLED:Zu,KUI_COLOR_TEXT_INFO:Ju,KUI_COLOR_TEXT_INFO_STRONG:ed,KUI_COLOR_TEXT_INFO_STRONGER:td,KUI_COLOR_TEXT_INFO_STRONGEST:id,KUI_COLOR_TEXT_INFO_WEAK:rd,KUI_COLOR_TEXT_INFO_WEAKER:nd,KUI_COLOR_TEXT_INFO_WEAKEST:sd,KUI_COLOR_TEXT_INVERSE:od,KUI_COLOR_TEXT_NEUTRAL:ad,KUI_COLOR_TEXT_NEUTRAL_STRONG:ld,KUI_COLOR_TEXT_NEUTRAL_STRONGER:cd,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:ud,KUI_COLOR_TEXT_NEUTRAL_WEAK:dd,KUI_COLOR_TEXT_NEUTRAL_WEAKER:hd,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:fd,KUI_COLOR_TEXT_PRIMARY:md,KUI_COLOR_TEXT_PRIMARY_STRONG:pd,KUI_COLOR_TEXT_PRIMARY_STRONGER:gd,KUI_COLOR_TEXT_PRIMARY_STRONGEST:_d,KUI_COLOR_TEXT_PRIMARY_WEAK:yd,KUI_COLOR_TEXT_PRIMARY_WEAKER:Rd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:Cd,KUI_COLOR_TEXT_SUCCESS:Ed,KUI_COLOR_TEXT_SUCCESS_STRONG:bd,KUI_COLOR_TEXT_SUCCESS_STRONGER:Od,KUI_COLOR_TEXT_SUCCESS_STRONGEST:wd,KUI_COLOR_TEXT_SUCCESS_WEAK:Td,KUI_COLOR_TEXT_SUCCESS_WEAKER:vd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:Sd,KUI_COLOR_TEXT_WARNING:xd,KUI_COLOR_TEXT_WARNING_STRONG:Id,KUI_COLOR_TEXT_WARNING_STRONGER:Dd,KUI_COLOR_TEXT_WARNING_STRONGEST:kd,KUI_COLOR_TEXT_WARNING_WEAK:Nd,KUI_COLOR_TEXT_WARNING_WEAKER:Ad,KUI_COLOR_TEXT_WARNING_WEAKEST:Ld,KUI_FONT_FAMILY_CODE:ih,KUI_FONT_FAMILY_HEADING:rh,KUI_FONT_FAMILY_TEXT:Qt,KUI_FONT_SIZE_10:nh,KUI_FONT_SIZE_100:fh,KUI_FONT_SIZE_20:sh,KUI_FONT_SIZE_30:oh,KUI_FONT_SIZE_40:ah,KUI_FONT_SIZE_50:lh,KUI_FONT_SIZE_60:ch,KUI_FONT_SIZE_70:uh,KUI_FONT_SIZE_80:dh,KUI_FONT_SIZE_90:hh,KUI_FONT_WEIGHT_BOLD:mh,KUI_FONT_WEIGHT_MEDIUM:ph,KUI_FONT_WEIGHT_REGULAR:gh,KUI_FONT_WEIGHT_SEMIBOLD:_h,KUI_ICON_COLOR_DANGER:yh,KUI_ICON_COLOR_NEUTRAL:Rh,KUI_ICON_COLOR_PRIMARY:Ch,KUI_ICON_COLOR_SUCCESS:Eh,KUI_ICON_COLOR_WARNING:bh,KUI_ICON_SIZE_10:Oh,KUI_ICON_SIZE_20:wh,KUI_ICON_SIZE_30:Th,KUI_ICON_SIZE_40:vh,KUI_ICON_SIZE_50:Sh,KUI_ICON_SIZE_60:xh,KUI_ICON_SIZE_70:Ih,KUI_ICON_SIZE_80:Dh,KUI_LETTER_SPACING_0:kh,KUI_LETTER_SPACING_MINUS_10:Nh,KUI_LETTER_SPACING_MINUS_20:Ah,KUI_LETTER_SPACING_MINUS_30:Lh,KUI_LETTER_SPACING_MINUS_40:Uh,KUI_LETTER_SPACING_MINUS_50:Mh,KUI_LETTER_SPACING_NORMAL:Kh,KUI_LINE_HEIGHT_10:Bh,KUI_LINE_HEIGHT_100:Vh,KUI_LINE_HEIGHT_20:zh,KUI_LINE_HEIGHT_30:Ph,KUI_LINE_HEIGHT_40:qh,KUI_LINE_HEIGHT_50:Hh,KUI_LINE_HEIGHT_60:Gh,KUI_LINE_HEIGHT_70:$h,KUI_LINE_HEIGHT_80:Fh,KUI_LINE_HEIGHT_90:Wh,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Yh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Xh,KUI_METHOD_COLOR_BACKGROUND_GET:jh,KUI_METHOD_COLOR_BACKGROUND_HEAD:Qh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Zh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Jh,KUI_METHOD_COLOR_BACKGROUND_POST:ef,KUI_METHOD_COLOR_BACKGROUND_PUT:tf,KUI_METHOD_COLOR_BACKGROUND_TRACE:rf,KUI_METHOD_COLOR_TEXT_CONNECT:nf,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:sf,KUI_METHOD_COLOR_TEXT_DELETE:of,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:af,KUI_METHOD_COLOR_TEXT_GET:lf,KUI_METHOD_COLOR_TEXT_GET_STRONG:cf,KUI_METHOD_COLOR_TEXT_HEAD:uf,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:df,KUI_METHOD_COLOR_TEXT_OPTIONS:hf,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:ff,KUI_METHOD_COLOR_TEXT_PATCH:mf,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:pf,KUI_METHOD_COLOR_TEXT_POST:gf,KUI_METHOD_COLOR_TEXT_POST_STRONG:_f,KUI_METHOD_COLOR_TEXT_PUT:yf,KUI_METHOD_COLOR_TEXT_PUT_STRONG:Rf,KUI_METHOD_COLOR_TEXT_TRACE:Cf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:Ef,KUI_NAVIGATION_COLOR_BACKGROUND:bf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:Of,KUI_NAVIGATION_COLOR_BORDER:wf,KUI_NAVIGATION_COLOR_BORDER_CHILD:Tf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:vf,KUI_NAVIGATION_COLOR_TEXT:Sf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:xf,KUI_NAVIGATION_COLOR_TEXT_HOVER:If,KUI_NAVIGATION_COLOR_TEXT_SELECTED:Df,KUI_NAVIGATION_SHADOW_BORDER:kf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:Nf,KUI_NAVIGATION_SHADOW_FOCUS:Af,KUI_SHADOW:vr,KUI_SHADOW_BORDER:Lf,KUI_SHADOW_BORDER_DANGER:Uf,KUI_SHADOW_BORDER_DANGER_STRONG:Mf,KUI_SHADOW_BORDER_DISABLED:Kf,KUI_SHADOW_BORDER_PRIMARY:Bf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:zf,KUI_SHADOW_BORDER_PRIMARY_WEAK:Pf,KUI_SHADOW_FOCUS:qf,KUI_SPACE_0:Hf,KUI_SPACE_10:Gf,KUI_SPACE_100:Zf,KUI_SPACE_110:Jf,KUI_SPACE_120:em,KUI_SPACE_130:tm,KUI_SPACE_140:im,KUI_SPACE_150:rm,KUI_SPACE_20:$f,KUI_SPACE_30:Ff,KUI_SPACE_40:Wf,KUI_SPACE_50:Vf,KUI_SPACE_60:Yf,KUI_SPACE_70:Xf,KUI_SPACE_80:jf,KUI_SPACE_90:Qf,KUI_SPACE_AUTO:nm,KUI_STATUS_COLOR_100:sm,KUI_STATUS_COLOR_100S:yp,KUI_STATUS_COLOR_101:om,KUI_STATUS_COLOR_102:am,KUI_STATUS_COLOR_103:lm,KUI_STATUS_COLOR_1NA:fp,KUI_STATUS_COLOR_200:cm,KUI_STATUS_COLOR_200S:Rp,KUI_STATUS_COLOR_201:um,KUI_STATUS_COLOR_202:dm,KUI_STATUS_COLOR_203:hm,KUI_STATUS_COLOR_204:fm,KUI_STATUS_COLOR_205:mm,KUI_STATUS_COLOR_206:pm,KUI_STATUS_COLOR_207:gm,KUI_STATUS_COLOR_208:_m,KUI_STATUS_COLOR_226:ym,KUI_STATUS_COLOR_2NA:mp,KUI_STATUS_COLOR_300:Rm,KUI_STATUS_COLOR_300S:Cp,KUI_STATUS_COLOR_301:Cm,KUI_STATUS_COLOR_302:Em,KUI_STATUS_COLOR_303:bm,KUI_STATUS_COLOR_304:Om,KUI_STATUS_COLOR_305:wm,KUI_STATUS_COLOR_307:Tm,KUI_STATUS_COLOR_308:vm,KUI_STATUS_COLOR_3NA:pp,KUI_STATUS_COLOR_400:Sm,KUI_STATUS_COLOR_400S:Ep,KUI_STATUS_COLOR_401:xm,KUI_STATUS_COLOR_402:Im,KUI_STATUS_COLOR_403:Dm,KUI_STATUS_COLOR_404:km,KUI_STATUS_COLOR_405:Nm,KUI_STATUS_COLOR_406:Am,KUI_STATUS_COLOR_407:Lm,KUI_STATUS_COLOR_408:Um,KUI_STATUS_COLOR_409:Mm,KUI_STATUS_COLOR_410:Km,KUI_STATUS_COLOR_411:Bm,KUI_STATUS_COLOR_412:zm,KUI_STATUS_COLOR_413:Pm,KUI_STATUS_COLOR_414:qm,KUI_STATUS_COLOR_415:Hm,KUI_STATUS_COLOR_416:Gm,KUI_STATUS_COLOR_417:$m,KUI_STATUS_COLOR_418:Fm,KUI_STATUS_COLOR_421:Wm,KUI_STATUS_COLOR_422:Vm,KUI_STATUS_COLOR_423:Ym,KUI_STATUS_COLOR_424:Xm,KUI_STATUS_COLOR_425:jm,KUI_STATUS_COLOR_426:Qm,KUI_STATUS_COLOR_428:Zm,KUI_STATUS_COLOR_429:Jm,KUI_STATUS_COLOR_431:ep,KUI_STATUS_COLOR_451:tp,KUI_STATUS_COLOR_4NA:gp,KUI_STATUS_COLOR_500:ip,KUI_STATUS_COLOR_500S:bp,KUI_STATUS_COLOR_501:rp,KUI_STATUS_COLOR_502:np,KUI_STATUS_COLOR_503:sp,KUI_STATUS_COLOR_504:op,KUI_STATUS_COLOR_505:ap,KUI_STATUS_COLOR_506:lp,KUI_STATUS_COLOR_507:cp,KUI_STATUS_COLOR_508:up,KUI_STATUS_COLOR_510:dp,KUI_STATUS_COLOR_511:hp,KUI_STATUS_COLOR_5NA:_p,KUI_STATUS_COLOR_BACKGROUND_100:Op,KUI_STATUS_COLOR_BACKGROUND_200:wp,KUI_STATUS_COLOR_BACKGROUND_300:Tp,KUI_STATUS_COLOR_BACKGROUND_400:vp,KUI_STATUS_COLOR_BACKGROUND_500:Sp,KUI_STATUS_COLOR_TEXT_100:xp,KUI_STATUS_COLOR_TEXT_200:Ip,KUI_STATUS_COLOR_TEXT_300:Dp,KUI_STATUS_COLOR_TEXT_400:kp,KUI_STATUS_COLOR_TEXT_500:Np},Symbol.toStringTag,{value:"Module"})),xr=Object.keys(Sr).filter(r=>r.startsWith("KUI_COLOR")),Ir=r=>Sr[r],Ap=r=>`--${r.toLowerCase().replaceAll("_","-")}`,Dr=()=>{if(typeof window>"u")return Object.fromEntries(xr.map(t=>[t,Ir(t)]));const r=window.getComputedStyle(document.documentElement),e=(t,i)=>r.getPropertyValue(t).trim()||i;return Object.fromEntries(xr.map(t=>[t,e(Ap(t),Ir(t))]))},Zt=r=>{const e=n.ref(Dr());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=Dr()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),n.getCurrentScope()&&n.onScopeDispose(()=>t.disconnect())}return e},Lp=()=>typeof window>"u"?Qt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Qt,Up=[`background-color: var(--kui-pop-color-background, var(--kui-color-background, ${br}));`,`border: var(--kui-pop-border-width, var(--kui-border-width-10, ${Tr})) solid var(--kui-pop-color-border, var(--kui-color-border, ${Or}));`,`border-radius: var(--kui-pop-border-radius, var(--kui-border-radius-30, ${wr}));`,`box-shadow: var(--kui-pop-shadow, var(--kui-shadow, ${vr}));`].join(" "),Mp=r=>{const e=Lp(),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,padding:0,confine:!0,extraCssText:Up,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}}}},Kp=r=>n.computed(()=>Mp(r.value)),Bp={class:"kong-ui-public-echarts-tooltip"},zp={class:"tooltip-title"},Pp={class:"title"},qp={key:0,class:"subtitle"},Hp={class:"context"},Gp={class:"metric"},$p={class:"tooltip-rows"},Fp={class:"display-value"},Wp=n.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Bp,[n.createElementVNode("div",zp,[n.createElementVNode("div",Pp,n.toDisplayString(r.title),1),r.context||r.metric?(n.openBlock(),n.createElementBlock("div",qp,[n.createElementVNode("div",Hp,n.toDisplayString(r.context),1),n.createElementVNode("div",Gp,n.toDisplayString(r.metric),1)])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",$p,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.rows,(i,s)=>(n.openBlock(),n.createElementBlock("li",{key:`${i.label}-${s}`,class:n.normalizeClass({"extra-row":i.isExtra})},[n.createElementVNode("span",{class:"square-marker",style:n.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),n.createElementVNode("span",{class:n.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},n.toDisplayString(i.label),3),n.createElementVNode("span",Fp,n.toDisplayString(i.value),1)],2))),128))])]))}}),kr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},Vp=kr(Wp,[["__scopeId","data-v-ca633353"]]),Jt=r=>Array.isArray(r)?r:[r],Nr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,ei=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Yp=r=>Array.isArray(r)?r[r.length-1]:r,Xp=r=>{const e=Jt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>ei(i,i.seriesName??"",Yp(i.value)))}},jp=r=>{let e;return n.getCurrentScope()&&n.onScopeDispose(()=>{e&&n.render(null,e)}),t=>{const i=(r()??Xp)(t);return i?(e??=document.createElement("div"),n.render(n.h(Vp,i),e),e):""}},Qp={class:"kong-ui-public-echarts"},Zp=n.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){n.useCssVars(o=>({v1cecfeed:o.height})),St.use([Yr.CanvasRenderer,ut.GridComponent,ut.TooltipComponent]);const e=Zt(),t=Kp(e),i=jp(()=>r.tooltipContent),s=n.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(n.openBlock(),n.createElementBlock("div",Qp,[n.createVNode(n.unref(Vr),n.mergeProps({autoresize:!0,class:"chart",option:s.value,theme:n.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Ar=kr(Zp,[["__scopeId","data-v-68114d20"]]),Lr=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),st=(r,...e)=>{const t={...r};for(const i of e)if(i)for(const[s,o]of Object.entries(i)){if(o===void 0)continue;const a=t[s];t[s]=Lr(a)&&Lr(o)?st(a,o):o}return t},Jp=n.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){St.use([li.HeatmapChart,ut.VisualMapComponent,ut.DataZoomSliderComponent]);const e=Zt(),t=a=>{const[l]=Jt(a),[u,c,d]=l.value;return{title:r.tooltipTitle,context:Nr(u,r.xAxisLabels),metric:r.seriesName,rows:[ei(l,Nr(c,r.yAxisLabels),d,r.valueFormatter)]}},i=a=>({type:"slider",yAxisIndex:0,startValue:0,endValue:a-1,zoomLock:!0,right:10,width:8,handleSize:0,moveHandleSize:0,showDetail:!1,brushSelect:!1,showDataShadow:!1,borderColor:"transparent",backgroundColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST,fillerColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK}),s=n.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),u=r.valueFormatter?c=>r.valueFormatter(Number(c)):void 0;return{grid:{top:10,left:10,right:l?30:20,bottom:70,outerBoundsMode:"same",outerBoundsContain:"axisLabel"},xAxis:{type:"category",data:r.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:r.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:r.min??0,max:r.max??a.reduce((c,[,,d])=>Math.max(c,d),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:r.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:u},...l?{dataZoom:[i(r.visibleRows)]}:{},series:[st({name:r.seriesName,type:"heatmap",data:a,animation:!1,label:{show:r.showValues??!1,formatter:r.valueFormatter?({value:c})=>r.valueFormatter(Number(c[2])):void 0},itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{shadowBlur:5,shadowColor:e.value.KUI_COLOR_BACKGROUND_OVERLAY}}},r.seriesOption)]}}),o=n.computed(()=>st(s.value,r.option));return(a,l)=>(n.openBlock(),n.createBlock(Ar,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),eg=n.defineComponent({__name:"TreeMapChart",props:{data:{},seriesName:{},showValues:{type:Boolean},valueFormatter:{type:Function},colorPalette:{},drillDown:{type:Boolean,default:!0},leafDepth:{},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){St.use([li.TreemapChart]);const e=Zt(),t=l=>{const[u]=Jt(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:[ei(u,u.name,Number(u.value),r.valueFormatter)]}},i=()=>[e.value.KUI_COLOR_BACKGROUND_PRIMARY_WEAK,e.value.KUI_COLOR_BACKGROUND_SUCCESS_WEAK,e.value.KUI_COLOR_BACKGROUND_WARNING_WEAK,e.value.KUI_COLOR_BACKGROUND_DANGER_WEAK,e.value.KUI_COLOR_BACKGROUND_INFO_WEAK,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST],s=(l=[])=>l.reduce((u,c)=>Math.max(u,1+s(c.children)),0),o=n.computed(()=>({series:[st({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??s(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=n.computed(()=>st(o.value,r.option));return(l,u)=>(n.openBlock(),n.createBlock(Ar,{height:r.height,option:a.value,"tooltip-content":t},null,8,["height","option"]))}}),Ur=r=>{if(r==null||typeof r=="string"&&r.trim()==="")return;const e=Number(r);return Number.isFinite(e)?e:void 0},tg=(r,e,t)=>{if(!t.length)return r;const i=t.reduce((o,a)=>Math.min(o,a));if(i<=r)return i;const s=Math.ceil((i-r)/e);return i-s*e},ig=(r,e,t)=>{const i=[];for(let s=r;s<e;s+=t)i.push(s);return i},rg=(r,e,t)=>{const i=o=>ca(o,t,"yyyy-MM-dd"),s=r.length>0&&i(r[0])!==i(r[r.length-1]);return r.map(o=>Re.formatChartTicksByGranularity({tickValue:new Date(o),granularity:e,dayBoundaryCrossed:s,timezone:t}))},ng=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},sg=(r,e)=>r[e]?.name??e,og=(r,{tz:e}={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i,start:s,end:o,granularity_ms:a}=r.meta,l=i?.[0],u=t&&Object.keys(t).find(w=>w!=="time");if(!l||!u||!s||!o){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const c=a||ne.Granularities.daily,d=ne.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=r.data,m=tg(new Date(s).getTime(),c,f.map(({timestamp:w})=>new Date(w).getTime())),C=ig(m,new Date(o).getTime(),c),b=[],R=[];for(const{timestamp:w,event:U}of f){const O=Math.floor((new Date(w).getTime()-m)/c),E=Ur(U[l]);O<0||O>=C.length||E===void 0||R.push([O,ng(b,String(U[u])),E])}return{data:R,xAxisLabels:rg(C,d,h),yAxisLabels:b.map(w=>sg(t[u],w))}},ag={class:"wrapper","data-testid":"heatmap-chart"},lg=10,cg=De(n.defineComponent({__name:"HeatmapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),o=he.useMetricFormatter(),a=c=>{const d=og(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=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Be,{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:n.withCtx(({data:f})=>[n.createElementVNode("div",ag,[u(f)?(n.openBlock(),n.createBlock(n.unref(Jp),n.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":lg},u(f)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(h,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-3315f2cd"]]),Mr=(r,e,{otherLabel:t})=>({name:e===Re.OTHER_DIMENSION_ID&&t||(r?.[e]?.name??e)}),ug=(r,e,t,i)=>({...Mr(e,t,i),itemStyle:{color:Ts({dimension:r,dimensionValue:t})}}),Kr=(r,e,t)=>{const i=r.get(e)??t();return r.set(e,i),i},ti=(r,e)=>!e.includes("time")&&(!r||ne.isMetricSupported("treemap",r)),Br=(r,e)=>{r.value=Number(r.value??0)+e},dg=(r,e,t,[i,s],o)=>{const a=new Map,l=(u,c)=>String(u[c]);for(const{event:u}of r){const c=Ur(u[e]);if(c===void 0)continue;const d=l(u,i),h=Kr(a,d,()=>({node:ug(i,t[i],d,o),children:new Map}));if(!s){Br(h.node,c);continue}const f=l(u,s),m=Kr(h.children,f,()=>Mr(t[s],f,o));Br(m,c)}return a},hg=(r,e={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i}=r.meta,s=i?.[0],o=t?Object.keys(t):[];if(!s||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!ti(s,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...dg(r.data,s,t,o,e).values()].map(({node:l,children:u})=>u.size?{...l,children:[...u.values()]}:l)},fg={class:"wrapper","data-testid":"treemap-chart"},mg=De(n.defineComponent({__name:"TreemapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),o=he.useMetricFormatter(),a=n.computed(()=>ti(t.query.metrics?.[0],t.query.dimensions??[])),l=d=>{const h=hg(d,{otherLabel:s.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(d)}},u=new WeakMap,c=d=>(u.has(d)||u.set(d,l(d)),u.get(d));return(d,h)=>{const f=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:h[0]||(h[0]=m=>i("chart-data",m)),onQueryComplete:h[1]||(h[1]=m=>i("query-complete"))},{default:n.withCtx(({data:m})=>[n.createElementVNode("div",fg,[a.value?c(m)?(n.openBlock(),n.createBlock(n.unref(eg),n.mergeProps({key:1,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0},c(m)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.description")),1)]),_:1})):(n.openBlock(),n.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),pg=["data-testid"],gg={key:0,class:"group-tabs"},_g={key:1,class:"tile-header"},yg={class:"badge-container"},Rg={class:"badge-text"},Cg={class:"badge-text"},Eg={key:0,class:"metric-selector-wrapper"},bg={key:1},Og=["data-testid"],wg=["data-testid"],Tg=["data-testid"],vg={class:"delete-option"},Sg=["data-testid"],zr=De(n.defineComponent({__name:"DashboardTile",props:n.mergeModels({context:{},definition:{},fitToContent:{type:Boolean,default:!1},groupTiles:{},height:{default:()=>it},hideActions:{type:Boolean,default:!1},isFullscreen:{type:Boolean},preview:{type:Boolean,default:!1},queryReady:{type:Boolean},showRefresh:{type:Boolean,default:!1},tileId:{},tileType:{default:"chart"}},{refreshCounter:{default:0},refreshCounterModifiers:{}}),emits:n.mergeModels(["chart-data","tile-loaded","edit-tile","duplicate-tile","remove-tile","tile-time-range-zoom","tile-bounds-change"],["update:refreshCounter"]),setup(r,{expose:e,emit:t}){n.useCssVars(H=>({v7f33ad9a:`${H.height}px`}));const i=parseInt(Pi,10),s=n.ref(!1),o=n.ref(),a=n.computed(()=>r.groupTiles?.find(H=>H.id===o.value)?.id??r.groupTiles?.[0]?.id),l=n.computed(()=>a.value??r.tileId.toString()),u=n.computed(()=>r.groupTiles?.find(H=>H.id===o.value)?.definition??r.groupTiles?.[0]?.definition??r.definition),c=he.useFieldLabel(),{zoomConfiguration:d}=he.useDashboardContext({context:n.computed(()=>r.context),preview:n.computed(()=>r.preview)}),h=n.useModel(r,"refreshCounter"),f=()=>{p.value=!0,h.value++},m=t,C=n.defineAsyncComponent(()=>Promise.resolve().then(()=>Qg)),b=n.inject(Ie),R=Se.useDatasourceConfigStore(),{datasourceConfigMap:w,stripUnknownFilters:U}=Xe(R),{i18n:O}=he.useI18n(),E=n.ref(),k=n.ref({status:"loading"}),I=n.ref(!1),B=n.ref(),g=n.ref(!1),p=n.ref(!0),_=n.computed(()=>u.value.chart),M=n.computed(()=>_.value.type==="single_value"),D=n.computed(()=>("chart_title"in _.value?_.value.chart_title:void 0)||(M.value?me.value:void 0)),F=n.computed(()=>u.value.header_description),v=n.computed(()=>_.value.type==="slottable"),P=n.computed(()=>Ne(u.value)||_t(u.value)?!1:!("allow_csv_export"in _.value)||_.value.allow_csv_export!==!1),{exploreLinkKebabMenu:V,requestsLinkKebabMenu:W,canShowKebabMenu:T,canGenerateRequestsLink:x,canGenerateExploreLink:q,requestsLinkZoomActions:L,exploreLinkZoomActions:G,buildExploreQuery:N,buildExploreLink:ce,buildRequestLink:ae,buildRequestsQueryZoomActions:ue}=he.useContextLinks({queryBridge:b,chartData:n.readonly(E),definition:u,context:n.readonly(n.toRef(()=>r.context))}),{issueQuery:Q}=he.useIssueQuery();n.watch(u,async(H,re)=>{await n.nextTick(),B.value&&(g.value=B.value.scrollWidth>B.value.clientWidth);try{JSON.stringify(H?.query)!==JSON.stringify(re?.query)&&(p.value=!0)}catch{}},{immediate:!0,deep:!0});const J=n.computed(()=>O.t("csvExport.defaultFilename")),S=n.computed(()=>!!V.value||P.value||!!r.context.editable),K=n.computed(()=>!r.hideActions&&T.value&&S.value),z=n.computed(()=>K.value&&S.value&&!r.isFullscreen),Y={heatmap:cg,treemap:mg,timeseries_line:dr,timeseries_bar:dr,scatter:_l,horizontal_bar:ur,vertical_bar:ur,gauge:cr,donut:pc,golden_signals:yl,top_n:cc,top_talkers:uc,table:mc,slottable:void 0,single_value:cr,choropleth_map:C},te=n.computed(()=>({...A.value?.rendererEvents.supportsRequests?{"select-chart-range":n_}:{},...A.value?.rendererEvents.supportsZoom?{"zoom-time-range":i_}:{},...A.value?.rendererEvents.supportsBounds?{"bounds-change":r_}:{},...A.value?.rendererEvents.supportsLoadingChange?{"loading-change":Jg}:{}})),A=n.computed(()=>{const H=Y[u.value.chart.type],re=Ne(u.value),ge=!!H?.emits?.includes("select-chart-range"),Ge=!!H?.emits?.includes("zoom-time-range"),Ue=u.value.chart.type==="choropleth_map",$e=!!H?.emits?.includes("loading-change"),ni={query:u.value.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:h.value,zoomConfiguration:d.value},Fe={chartOptions:u.value.chart,activeMetric:_e.value,headerDescription:F.value,requestsLink:d.value.showRequestsAction?L.value:void 0,exploreLink:d.value.showExploreAction?G.value:void 0};return H&&{component:H,rendererProps:{...ni,...re?{}:Fe,...["top_n","single_value"].includes(u.value.chart.type)?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:ge,supportsZoom:Ge,supportsBounds:Ue,supportsLoadingChange:$e}}}),$=n.computed(()=>{if(Ne(u.value))return null;const H=u.value.query,re=H?.time_range;if(ne.isPlatformDatasource(H?.datasource)&&!H.dimensions?.includes("time"))return O.t("renderer.as_of_today");if(re?.type==="relative"){const ge=ne.TimePeriods.get(ne.TIMEFRAME_LOOKUP[re.time_range]);return ge?ge.display:(console.warn("Did not recognize the given relative time range:",re.time_range),re.time_range)}else if(re?.type==="absolute"){const ge=re.tz||"Etc/UTC";return`${ne.formatTime(re.start,{short:!0,tz:ge})} - ${ne.formatTime(re.end,{short:!0,tz:ge})}`}return null}),j=n.computed(()=>{const H=u.value.query,re=H?.datasource,ge=re?w.value[re]?.timeRangeOptions:void 0,Ue=(H&&"time_range"in H?H.time_range:void 0)??r.context.timeSpec;return Ft(Ue,ge)}),de=n.computed(()=>v.value?!1:[!!D.value,z.value,!!$.value,j.value,!!F.value,r.showRefresh,ze.value].some(Boolean)),ee=n.computed(()=>E.value?ne.msToGranularity(E.value.meta.granularity_ms):void 0),se=n.computed(()=>["timeseries_line","timeseries_bar"].includes(_.value.type)),pe=n.computed(()=>E.value?.meta.metric_names??[]),_e=n.ref();n.watch(pe,H=>{(!_e.value||!H.includes(_e.value))&&(_e.value=H[0])},{immediate:!0}),n.watch(l,()=>{E.value=void 0,_e.value=void 0,p.value=!0});const Oe=n.computed(()=>{const H=_.value;return H.type!=="timeseries_line"?!1:pe.value.some(re=>H.metric_axis_map?.[re]==="right")}),ze=n.computed(()=>se.value&&!Oe.value&&(E.value?.data.length??0)>0&&pe.value.length>1&&Object.keys(E.value?.meta.display??{}).length>0),me=n.computed(()=>{const re=("metrics"in u.value.query?u.value.query.metrics?.[0]:void 0)??pe.value[0];if(re)return c(re)}),we=n.computed(()=>(r.groupTiles??[]).map(({id:H,label:re})=>({hash:`#${H}`,title:re}))),fe=n.computed({get:()=>`#${a.value}`,set:H=>{o.value=H.slice(1)}}),ye=n.computed(()=>pe.value.map(H=>({value:H,label:c(H)}))),Te=n.computed(()=>{if(!Gt(u.value)||!se.value||!r.queryReady||p.value)return!1;const H=u.value.query.granularity;return!H||!ee.value?!1:H!==ee.value}),lt=n.computed(()=>{const H=ne.msToGranularity(E.value?.meta.granularity_ms??0)??"unknown",re=Gt(u.value)?u.value.query.granularity??"unknown":"unknown";return O.t("query_aged_out_warning",{currentGranularity:O.t(`granularities.${H}`),savedGranularity:O.t(`granularities.${re}`)})}),Tt=n.computed(()=>{const H=[...r.context.filters,...u.value.query.filters??[]],re="metrics"in u.value.query?u.value.query.metrics:void 0,ge=u.value.query.datasource??"api_usage";return U.value({datasource:ge,filters:H,queryFields:re})}),Pe=()=>{m("edit-tile",u.value,l.value)},ve=()=>{m("duplicate-tile",u.value,l.value)},He=()=>{m("remove-tile",u.value,l.value)},vt=H=>{E.value=H,p.value=!1,m("chart-data",H),m("tile-loaded")},Zg=()=>{p.value=!1,m("tile-loaded")},Jg=H=>{p.value=H,H||m("tile-loaded")},e_=()=>{I.value=!1},$r=()=>{if(_t(u.value))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const H=u.value.query.datasource?.startsWith("goap");return b?.staticConfig?.increaseCsvExportLimit!==!1&&!H?Q(u.value.query,r.context,ne.EXPORT_RECORD_LIMIT):E.value?Promise.resolve(E.value):new Promise(ge=>{const Ge=n.watch(E,Ue=>{Ue&&(ge(Ue),Ge())})})},t_=async()=>{I.value=!0,k.value={status:"loading"};try{const H=await $r();k.value={status:"success",chartData:H}}catch(H){k.value={status:"error",error:H}}},i_=H=>{const re={tileId:l.value,timeRange:H};m("tile-time-range-zoom",re)},r_=H=>{const re={tileId:l.value,bounds:H};m("tile-bounds-change",re)},n_=H=>{const re=Tt.value,ge=N(H,re);G.value=q.value?{href:ce(ge)}:void 0,L.value=x.value?{href:ae(ue(H,re))}:void 0};return e({getExportData:$r}),(H,re)=>{const ge=n.resolveComponent("KTooltip"),Ge=n.resolveComponent("KBadge"),Ue=n.resolveComponent("KButton"),$e=n.resolveComponent("KDropdownItem"),ni=n.resolveComponent("KDropdown");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["tile-boundary",{editable:r.context.editable,"fit-to-content":r.fitToContent,headless:!de.value,"compact-single_value":M.value&&r.fitToContent}]),"data-testid":`tile-${r.tileId}`},[r.groupTiles&&r.groupTiles.length>1?(n.openBlock(),n.createElementBlock("div",gg,[n.createVNode(n.unref(ai.KTabs),n.mergeProps({modelValue:fe.value,"onUpdate:modelValue":re[0]||(re[0]=Fe=>fe.value=Fe)},{hidePanels:!0},{"data-testid":"tile-group-tabs",tabs:we.value}),null,16,["modelValue","tabs"])])):n.createCommentVNode("",!0),de.value&&!v.value?(n.openBlock(),n.createElementBlock("div",_g,[n.createVNode(ge,{class:"title-tooltip",disabled:!g.value,"max-width":"500",text:D.value},{default:n.withCtx(()=>[n.createElementVNode("div",{ref_key:"titleRef",ref:B,class:"title"},n.toDisplayString(D.value),513)]),_:1},8,["disabled","text"]),n.createElementVNode("div",yg,[j.value?(n.openBlock(),n.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:n.unref(O).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:n.withCtx(()=>[n.createVNode(n.unref(oe.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(Bi)})`},null,8,["size"])]),default:n.withCtx(()=>[n.createElementVNode("span",Rg,n.toDisplayString(n.unref(O).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):n.createCommentVNode("",!0),$.value?(n.openBlock(),n.createBlock(Ge,{key:1,"data-testid":"time-range-badge",tooltip:Te.value?lt.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("span",Cg,n.toDisplayString($.value),1)]),_:2},[Te.value?{name:"icon",fn:n.withCtx(()=>[n.createVNode(n.unref(oe.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(Bi)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):n.createCommentVNode("",!0)]),ze.value?(n.openBlock(),n.createElementBlock("div",Eg,[n.createVNode(n.unref(ai.KSegmentedControl),{modelValue:_e.value,"onUpdate:modelValue":re[1]||(re[1]=Fe=>_e.value=Fe),class:"metric-selector","data-testid":"metric-selector",options:ye.value},null,8,["modelValue","options"])])):n.createCommentVNode("",!0),r.showRefresh?(n.openBlock(),n.createElementBlock("div",bg,[n.createVNode(Ue,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${r.tileId}`,disabled:p.value,icon:"",size:"small",onClick:f},{default:n.withCtx(()=>[p.value?(n.openBlock(),n.createBlock(n.unref(oe.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${n.unref(zi)})`,tabindex:"0"},null,8,["size"])):(n.openBlock(),n.createBlock(n.unref(oe.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${n.unref(zi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):n.createCommentVNode("",!0),F.value?(n.openBlock(),n.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${r.tileId}`},n.toDisplayString(F.value),9,Og)):n.createCommentVNode("",!0),K.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${r.tileId}`},[K.value&&r.context.editable&&!r.isFullscreen?(n.openBlock(),n.createBlock(Ue,{key:0,appearance:"tertiary","aria-label":n.unref(O).t("renderer.edit"),class:"edit-icon","data-testid":`edit-tile-${r.tileId}`,icon:"",size:"small",onClick:Pe},{default:n.withCtx(()=>[n.createVNode(n.unref(oe.EditIcon),{decorative:""})]),_:1},8,["aria-label","data-testid"])):n.createCommentVNode("",!0),K.value&&S.value&&!r.isFullscreen?(n.openBlock(),n.createBlock(ni,{key:1,class:"dropdown","data-testid":`chart-action-menu-${r.tileId}`,"kpop-attributes":{placement:"bottom-end"},onToggleDropdown:re[2]||(re[2]=Fe=>s.value=Fe)},{items:n.withCtx(()=>[n.unref(V)?(n.openBlock(),n.createBlock($e,{key:0,"data-testid":`chart-jump-to-explore-${r.tileId}`,item:{label:n.unref(O).t("jumpToExplore"),to:n.unref(V)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),!n.unref(Ne)(u.value)&&n.unref(W)?(n.openBlock(),n.createBlock($e,{key:1,"data-testid":`chart-jump-to-requests-${r.tileId}`,item:{label:n.unref(O).t("jumpToRequests"),to:n.unref(W)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),P.value?(n.openBlock(),n.createBlock($e,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${r.tileId}`,onClick:t_},{default:n.withCtx(()=>[n.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${r.tileId}`},n.toDisplayString(n.unref(O).t("csvExport.exportAsCsv")),9,Tg)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock($e,{key:3,"data-testid":`duplicate-tile-${r.tileId}`,onClick:ve},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(O).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock($e,{key:4,"data-testid":`remove-tile-${r.tileId}`,onClick:He},{default:n.withCtx(()=>[n.createElementVNode("span",vg,n.toDisplayString(n.unref(O).t("renderer.delete")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)]),default:n.withCtx(()=>[n.createVNode(Ue,{appearance:"tertiary","aria-expanded":s.value,"aria-haspopup":"true","aria-label":n.unref(O).t("renderer.tileActions"),class:n.normalizeClass(["kebab-action-menu",{"is-open":s.value}]),"data-testid":`kebab-action-menu-${r.tileId}`,icon:"",size:"small"},{default:n.withCtx(()=>[n.createVNode(n.unref(oe.MoreIcon),{decorative:""})]),_:1},8,["aria-expanded","aria-label","class","data-testid"])]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)],8,wg)):n.createCommentVNode("",!0),I.value?(n.openBlock(),n.createBlock(or,{key:4,"data-testid":`csv-export-modal-${r.tileId}`,"export-state":k.value,filename:J.value,onCloseModal:e_},null,8,["data-testid","export-state","filename"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["tile-content",`type-${r.tileType}-${_.value.type}`]),"data-testid":`tile-content-${r.tileId}`},[A.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(A.value.component),n.mergeProps({key:l.value},A.value.rendererProps,n.toHandlers(te.value),{onChartData:vt,onQueryComplete:Zg}),null,16)):n.createCommentVNode("",!0)],10,Sg)],10,pg)}}}),[["__scopeId","data-v-aaf55d0b"]]);function xg(r,e,t,i,s){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+s+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(r,a));return o.prototype=e.prototype,o}class 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 s=t.querySelectorAll(e);return!s.length&&e[0]!=="."&&e[0]!=="#"&&(s=t.querySelectorAll("."+e),s.length||(s=t.querySelectorAll("#"+e))),Array.from(s)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let s=t.querySelector(e);return i&&!s&&(s=i.getElementById(e)),s||(s=t.querySelector("."+e)),s}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(s=>{s&&i.classList.add(s)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return 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,s=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(s<=i)return 0;const o=e.y>t.y?e.y:t.y,a=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return a<=o?0:(s-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,o)=>{const a=t*((s.y??1e4)-(o.y??1e4));return a===0?t*((s.x??1e4)-(o.x??1e4)):a})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static createStylesheet(e,t,i){const s=document.createElement("style"),o=i?.nonce;return o&&(s.nonce=o),s.setAttribute("type","text/css"),s.setAttribute("gs-style-id",e),s.styleSheet?s.styleSheet.cssText="":s.appendChild(document.createTextNode("")),t?t.insertBefore(s,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(s)),s}static removeStylesheet(e,t){const s=(t||document).querySelector("STYLE[gs-style-id="+e+"]");s&&s.parentNode&&s.remove()}static addCSSRule(e,t,i){e.textContent+=`${t} { ${i} } `}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const s=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!s)throw new Error(`Invalid height val = ${e}`);i=s[2]||"px",t=parseFloat(s[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const s in i){if(!i.hasOwnProperty(s))return;e[s]===null||e[s]===void 0?e[s]=i[s]:typeof i[s]=="object"&&typeof e[s]=="object"&&this.defaults(e[s],i[s])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const s=e[i],o=t[i];i[0]==="_"||s===o?delete e[i]:s&&typeof s=="object"&&o!==void 0&&(y.removeInternalAndSame(s,o),Object.keys(s).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...s)=>{i||(i=!0,setTimeout(()=>{e(...s),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const s=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>o){const a=s.bottom-o,l=s.top,u=this.getScrollElement(e);if(u!==null){const c=u.scrollTop;s.top<0&&i<0?e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=a>i?i:a),t.top+=u.scrollTop-c}}}static updateScrollResize(e,t,i){const s=this.getScrollElement(t),o=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,l=e.clientY-a,u=l<i,c=l>o-i;u?s.scrollBy({behavior:"smooth",top:l-i}):c&&s.scrollBy({behavior:"smooth",top:i-(o-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=y.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(o=>o===s)&&(i[s]=y.cloneDeep(e[s]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=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(s=>{e.style[i]=s}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},s={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...s}}static simulateMouseEvent(e,t,i){const s=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:s.ctrlKey??!1,altKey:s.altKey??!1,shiftKey:s.shiftKey??!1,metaKey:s.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");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 s=e[t];e[t]=e[i],e[i]=s}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class Ae{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,s={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!s.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,s.skip));let a=!1;const l={nested:!0,pack:!1};let u=0;for(;i=i||this.collide(e,o,s.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...l};c=this._loading&&y.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&c?y.copyPos(t,e):!i.locked&&c&&s.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 s=e._id,o=i?._id;return this.nodes.find(a=>a._id!==s&&a._id!==o&&y.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==s&&a._id!==o&&y.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,o={...t.rect};o.y>s.y?(o.h+=o.y-s.y,o.y=s.y):o.h+=s.y-o.y,o.x>s.x?(o.w+=o.x-s.x,o.x=s.x):o.w+=s.x-o.x;let a,l=.5;for(let u of i){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,h=Number.MAX_VALUE;s.y<c.y?d=(o.y+o.h-c.y)/c.h:s.y+s.h>c.y+c.h&&(d=(c.y+c.h-o.y)/c.h),s.x<c.x?h=(o.x+o.w-c.x)/c.w:s.x+s.w>c.x+c.w&&(h=(c.x+c.w-o.x)/c.w);const f=Math.min(h,d);f>l&&(l=f,a=u)}return t.collide=a,a}cacheRects(e,t,i,s,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-s,h:l.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=o,e.y=a),e._dirty=t._dirty=!0,!0}let s;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(s=y.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=y.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=y.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,s){const o={x:e||0,y:t||0,w:i||1,h:s||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const s=this._inColumnResize;s||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((a,l,u)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=u[l-1])),this.addNode(a,!1,c)}),s||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=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??Ae._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const s={x:0,y:0,w:1,h:1};return y.defaults(e,s),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=s.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=s.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=s.w),isNaN(e.h)&&(e.h=s.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||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,s){const o=s?s.y*i+(s.x+s.w):0;let a=!1;for(let l=o;!a;++l){const u=l%i,c=Math.floor(l/i);if(u+e.w>i)continue;const d={x:u,y:c,w:e.w,h:e.h};t.find(h=>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 s=this.nodes.find(a=>a._id===e._id);if(s)return s;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(s=>s._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(s=>s._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(s=>s._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const s=new Ae({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const o=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return o?(s.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(u=>u._id===a._id);l&&(y.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new Ae({column:this.column,float:this.float,nodes:this.nodes.map(s=>({...s}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=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 s=e.w!==t.w||e.h!==t.h,o=y.copyPos({},e,!0);if(y.copyPos(o,t),this.nodeBoundFix(o,s),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,s=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=s?.find(c=>c._id===a._id),u={...a,...l||{}};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 s=i/this.column;e.forEach(o=>{if(!o._orig)return;const a=t.find(l=>l._id===o._id);a&&(a.y>=0&&o.y!==o._orig.y&&(a.y+=o.y-o._orig.y),o.x!==o._orig.x&&(a.x=Math.round(o.x*s)),o.w!==o._orig.w&&(a.w=Math.round(o.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const s=i==="compact"||i==="list";s&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=s?this.nodes: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&&(!s&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=!0))})),l.forEach(c=>{const d=a.findIndex(h=>h._id===c._id);if(d!==-1){const h=a[d];if(s){h.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,o),c.autoPosition||(h.x=c.x??h.x,h.y=c.y??h.y,h.w=c.w??h.w,o.push(h)),a.splice(d,1)}})}if(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=s||i==="none"?1:t/e,u=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(d=>{d.x=t===1?0:u?Math.round(d.x*l):Math.min(d.x,t-1),d.w=t===1||e===1?1:c?Math.round(d.w*l)||1:Math.min(d.w,t),o.push(d)}),a=[]}o=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,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];return e.forEach((o,a)=>{if(o._id===void 0){const l=o.id?this.nodes.find(u=>u.id===o.id):void 0;o._id=l?._id??Ae._idSeq++}s[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??Ae._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const s=this.findCacheLayout(e,t);return s===-1?this._layouts[t].push(i):this._layouts[t][s]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}Ae._idSeq=0;const be={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 Z{}const ke=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 Le{}function Rt(r,e){r.touches.length>1||(r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r.changedTouches[0],e))}function Pr(r,e){r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r,e)}function Ct(r){Le.touchHandled||(Le.touchHandled=!0,Rt(r,"mousedown"))}function Et(r){Le.touchHandled&&Rt(r,"mousemove")}function bt(r){if(!Le.touchHandled)return;Le.pointerLeaveTimeout&&(window.clearTimeout(Le.pointerLeaveTimeout),delete Le.pointerLeaveTimeout);const e=!!Z.dragElement;Rt(r,"mouseup"),e||Rt(r,"click"),Le.touchHandled=!1}function Ot(r){r.pointerType!=="mouse"&&r.target.releasePointerCapture(r.pointerId)}function qr(r){Z.dragElement&&r.pointerType!=="mouse"&&Pr(r,"mouseenter")}function Hr(r){Z.dragElement&&r.pointerType!=="mouse"&&(Le.pointerLeaveTimeout=window.setTimeout(()=>{delete Le.pointerLeaveTimeout,Pr(r,"mouseleave")},10))}class wt{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(`${wt.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),ke&&(this.el.addEventListener("touchstart",Ct),this.el.addEventListener("pointerdown",Ot)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),ke&&(this.el.removeEventListener("touchstart",Ct),this.el.removeEventListener("pointerdown",Ot)),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),ke&&(this.el.addEventListener("touchmove",Et),this.el.addEventListener("touchend",bt)),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),ke&&(this.el.removeEventListener("touchmove",Et),this.el.removeEventListener("touchend",bt)),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}}wt.prefix="ui-resizable-";class ii{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 ot extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||o;return{position:{left:(a.left-s.left)*this.rectScale.x,top:(a.top-s.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(s=>this.option[s]=e[s]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Z.overResizeElement===this&&delete Z.overResizeElement),this}_mouseOver(e){Z.overResizeElement||Z.dragElement||(Z.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){Z.overResizeElement===this&&(delete Z.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new wt(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=ot._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 ot._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let l,u;t.indexOf("e")>-1?s.width+=o:t.indexOf("w")>-1&&(s.width-=o,s.left+=o,l=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,u=!0);const c=this._constrainSize(s.width,s.height,l,u);return Math.round(s.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-c.width),s.width=c.width),Math.round(s.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-c.height),s.height=c.height),s}_constrainSize(e,t,i,s){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,u=(s?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,d=Math.min(a,Math.max(l,e)),h=Math.min(u,Math.max(c,t));return{width:d,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:s}=t.getBoundingClientRect();e={left:i,top:s,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],s=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*s+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}ot._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Ig='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class at extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),ke&&(e.addEventListener("touchstart",Ct),e.addEventListener("pointerdown",Ot))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),ke&&(t.removeEventListener("touchstart",Ct),t.removeEventListener("pointerdown",Ot))}),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(!Z.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Ig)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete Z.dragElement,delete Z.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),ke&&(e.currentTarget.addEventListener("touchmove",Et),e.currentTarget.addEventListener("touchend",bt)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),Z.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),Z.pauseDrag){const i=Number.isInteger(Z.pauseDrag)?Z.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,Z.dragElement=this;const i=this.el.gridstackNode?.grid;i?Z.dropElement=i.el.ddElement.ddDroppable:delete Z.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 s=y.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),ke&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Et,!0),e.currentTarget.removeEventListener("touchend",bt,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),Z.dropElement?.el===this.el.parentElement&&delete Z.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),Z.dropElement&&Z.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete Z.dragElement,delete Z.dropElement,delete Z.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||Z.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=at.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",at.originStyleProp.forEach(s=>t.style[s]=this.dragElementOriginStyle[s]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,s=this.dragOffset;i.left=(e.clientX+s.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+s.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let s=0,o=0;i&&(s=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-s,offsetTop:-e.clientY+a.top-o,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}at.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Dg extends ii{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),ke&&(this.el.addEventListener("pointerenter",qr),this.el.addEventListener("pointerleave",Hr)))}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),ke&&(this.el.removeEventListener("pointerenter",qr),this.el.removeEventListener("pointerleave",Hr)))}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(!Z.dragElement||!this._canDrop(Z.dragElement.el))return;e.preventDefault(),e.stopPropagation(),Z.dropElement&&Z.dropElement!==this&&Z.dropElement._mouseLeave(e,!0),Z.dropElement=this;const t=y.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(Z.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!Z.dragElement||Z.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(Z.dragElement)),this.triggerEvent("dropout",i),Z.dropElement===this&&(delete Z.dropElement,!t)){let s,o=this.el.parentElement;for(;!s&&o;)s=o.ddElement?.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const t=y.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(Z.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 ri{static init(e){return e.ddElement||(e.ddElement=new ri(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 at(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 ot(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 Dg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class kg{resizable(e,t,i,s){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:s});else{const l=o.el.gridstackNode.grid;let u=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:u,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,s){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:s});else{const a=o.el.gridstackNode.grid;o.setupDraggable({...a.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,s){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:s}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(s=>s.on(t,o=>{i(o,Z.dragElement?Z.dragElement.el:o.target,Z.dragElement?Z.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",s=y.getElements(e);return s.length?s.map(a=>a.ddElement||(i?ri.init(a):null)).filter(a=>a):[]}}const Ee=new kg;class X{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=X.getGridElement(t);return i?(i.gridstack||(i.gridstack=new X(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 ?
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});_a.saveAs(h,i.filename)}};return(d,h)=>(n.openBlock(),n.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[n.renderSlot(d.$slots,"default",{},()=>[n.createTextVNode("Download "+n.toDisplayString(r.filename),1)])],8,Ea))}}),Oa=n.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(r){const e=r,t=n.computed(()=>Object.keys(e.headers));return(i,s)=>(n.openBlock(),n.createElementBlock("div",null,[n.createVNode(ba,{data:r.rows,fields:t.value,filename:r.filename,labels:r.headers},{default:n.withCtx(()=>[n.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}}),wa={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",tileActions:"Tile actions",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",principal_group:"Principal group",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 gt(){const r=ct.createI18n("en-us",wa);return{i18n:r,i18nT:ct.i18nTComponent(r)}}const it=170,zt=6,rt=20,Ie="analytics-query-provider",$i="analytics-dashboard-coordinator",Pt="{entity-id}",Fi="{cp-id}",Wi="{timeframe}",Vi=30*1e3,Yi=3e5,Xi=36e5;function Ta(){const r=n.inject(Ie);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var qt={exports:{}},ji;function va(){return ji||(ji=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function o(u,c,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new s(d,h||u,f),C=t?t+c:c;return u._events[C]?u._events[C].fn?u._events[C]=[u._events[C],m]:u._events[C].push(m):(u._events[C]=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,C=new Array(m);f<m;f++)C[f]=h[f].fn;return C},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,C){var b=t?t+c:c;if(!this._events[b])return!1;var R=this._events[b],w=arguments.length,U,O;if(R.fn){switch(R.once&&this.removeListener(c,R.fn,void 0,!0),w){case 1:return R.fn.call(R.context),!0;case 2:return R.fn.call(R.context,d),!0;case 3:return R.fn.call(R.context,d,h),!0;case 4:return R.fn.call(R.context,d,h,f),!0;case 5:return R.fn.call(R.context,d,h,f,m),!0;case 6:return R.fn.call(R.context,d,h,f,m,C),!0}for(O=1,U=new Array(w-1);O<w;O++)U[O-1]=arguments[O];R.fn.apply(R.context,U)}else{var E=R.length,k;for(O=0;O<E;O++)switch(R[O].once&&this.removeListener(c,R[O].fn,void 0,!0),w){case 1:R[O].fn.call(R[O].context);break;case 2:R[O].fn.call(R[O].context,d);break;case 3:R[O].fn.call(R[O].context,d,h);break;case 4:R[O].fn.call(R[O].context,d,h,f);break;default:if(!U)for(k=1,U=new Array(w-1);k<w;k++)U[k-1]=arguments[k];R[O].fn.apply(R[O].context,U)}}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 C=this._events[m];if(C.fn)C.fn===d&&(!f||C.once)&&(!h||C.context===h)&&a(this,m);else{for(var b=0,R=[],w=C.length;b<w;b++)(C[b].fn!==d||f&&!C[b].once||h&&C[b].context!==h)&&R.push(C[b]);R.length?this._events[m]=R.length===1?R[0]:R: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})(qt)),qt.exports}var Sa=va();const xa=ma(Sa);class Ht extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,Ht)}}const Qi=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function Ia(r,e){const{milliseconds:t,fallback:i,message:s,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,u;const d=new Promise((h,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(a?.aborted){f(Qi(a));return}if(a&&(u=()=>{f(Qi(a))},a.addEventListener("abort",u,{once:!0})),r.then(h,f),t===Number.POSITIVE_INFINITY)return;const m=new Ht;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(C){f(C)}return}typeof r.cancel=="function"&&r.cancel(),s===!1?h():s instanceof Error?f(s):(m.message=s??`Promise timed out after ${t} milliseconds`,f(m))},t)}).finally(()=>{d.clear(),u&&a&&a.removeEventListener("abort",u)});return d.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},d}function Da(r,e,t){let i=0,s=r.length;for(;s>0;){const o=Math.trunc(s/2);let a=i+o;t(r[a],e)<=0?(i=++a,s-=o+1):s=o}return i}const ka=100;class Zi{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:s}=t??{},{size:o}=this,a={priority:i,id:s,run:e};if(o===0){this.#t.length=0,this.#e=0,this.#t.push(a);return}if(this.#t.at(-1).priority>=i){this.#t.push(a);return}this.#s();const l=Da(this.#t,a,(u,c)=>c.priority-u.priority);this.#t.splice(l,0,a)}setPriority(e,t){const i=this.#t.findIndex((o,a)=>a>=this.#e&&o.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=this.#t.splice(i,1);this.enqueue(s.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,s)=>s<this.#e?!1:typeof e=="string"?i.id===e:i.run===e);t!==-1&&this.#t.splice(t,1)}dequeue(){if(this.#e===this.#t.length)return;const e=this.#t[this.#e];return this.#e++,this.#e===this.#t.length?(this.#t.length=0,this.#e=0):this.#e>ka&&this.#e>this.#t.length/2&&this.#s(),e?.run}filter(e){const t=[];for(let i=this.#e;i<this.#t.length;i++){const s=this.#t[i];s.priority===e.priority&&t.push(s.run)}return t}get size(){return this.#t.length-this.#e}#s(){this.#e!==0&&(this.#t.splice(0,this.#e),this.#e=0)}}class Na extends xa{#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:Zi,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()}#b(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--}#O(){return this.#o.length-this.#n}get#U(){return this.#e?!0:this.#a?this.#O()<this.#f:this.#s<this.#f}get#M(){return this.#r<this.#g}#K(){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.#b(e),this.#O()>=this.#f){const i=this.#o[this.#n],s=this.#c-(e-i);return this.#S(s),!0}return!1}if(this.#l===void 0){const t=this.#C-e;if(t<0)this.#s=this.#t?this.#r:0;else return this.#S(t),!0}return!1}#S(e){this.#u===void 0&&(this.#u=setTimeout(()=>{this.#B()},e))}#w(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#x(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#y(){if(this.#i.size===0){if(this.#w(),this.emit("empty"),this.#r===0){if(this.#x(),this.#a&&this.#n>0){const t=Date.now();this.#b(t)}this.emit("idle")}return!1}let e=!1;if(!this.#d){const t=Date.now(),i=!this.#z(t);if(this.#U&&this.#M){const s=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),s(),e=!0}}return e}#I(){this.#e||this.#l!==void 0||this.#a||(this.#l=setInterval(()=>{this.#D()},this.#c),this.#C=Date.now()+this.#c)}#D(){this.#a||(this.#l!==void 0&&(this.#s===0&&this.#r===0?this.#w():this.#C=Date.now()+this.#c),this.#s=this.#t?this.#r:0),this.#T(),this.#m()}#T(){for(;this.#y(););}get concurrency(){return this.#g}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#g=e,this.#T()}setPriority(e,t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);this.#i.setPriority(e,t)}async add(e,t={}){if(t={timeout:this.timeout,...t,id:t.id??(this.#N++).toString()},t.timeout!==void 0&&!(Number.isFinite(t.timeout)&&t.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);return new Promise((i,s)=>{const o=Symbol(`task-${t.id}`);let a=()=>{};const l=async()=>{a(),this.#r++,this.#_.set(o,{id:t.id,priority:t.priority??0,startTime:Date.now(),timeout:t.timeout});let c;try{try{t.signal?.throwIfAborted()}catch(f){throw this.#q(),this.#_.delete(o),f}let d=e({signal:t.signal});if(t.timeout!==void 0&&(d=Ia(Promise.resolve(d),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#r} running, ${this.#i.size} waiting)`})),t.signal){const{signal:f}=t;d=Promise.race([d,new Promise((m,C)=>{c=()=>{C(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await d;i(h),this.emit("completed",h)}catch(d){s(d),this.emit("error",d)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#K()})}};this.#i.enqueue(l,t);const u=()=>{if(this.#i instanceof Zi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,d=()=>{a(),u(),s(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",d),this.#E.delete(a)},c.aborted){d();return}c.addEventListener("abort",d,{once:!0}),this.#E.add(a)}this.emit("add"),this.#y()})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this.#d?(this.#d=!1,this.#T(),this):this}pause(){this.#d=!0}clear(){for(const e of this.#E)e();this.#i=new this.#v,this.#w(),this.#k(),this.emit("empty"),this.#r===0&&(this.#x(),this.emit("idle")),this.emit("next")}async onEmpty(){this.#i.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#i.size<e||await this.#h(["next","active"],()=>this.#i.size<e)}async onIdle(){this.#r===0&&this.#i.size===0||await this.#h("idle")}async onPendingZero(){this.#r!==0&&await this.#h("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#h("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#h("rateLimitCleared")}onError(){return new Promise((e,t)=>{const i=s=>{this.off("error",i),t(s)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(s=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);s()}};for(const a of i)this.on(a,o)})}get size(){return this.#i.size}sizeBy(e){return this.#i.filter(e).length}get pending(){return this.#r}get isPaused(){return this.#d}#P(){this.#e||(this.on("add",()=>{this.#i.size>0&&this.#m()}),this.on("next",()=>{this.#m()}))}#m(){this.#e||this.#R||(this.#R=!0,queueMicrotask(()=>{this.#R=!1,this.#k()}))}#q(){this.#e||(this.#L(),this.#m())}#k(){const e=this.#p;if(this.#e||this.#i.size===0){e&&(this.#p=!1,this.emit("rateLimitCleared"));return}let t;if(this.#a){const s=Date.now();this.#b(s),t=this.#O()}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 Aa=()=>{const r=Se.useAnalyticsConfigStore(),e=n.inject(Ie);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 Na({carryoverConcurrencyCount:!0,concurrency:r.maxParallelRequests,interval:r.requestInterval,intervalCap:r.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,o)=>t.add(()=>e.queryFn(s,o))};n.provide(Ie,i)};function La(r){const e=`[${r.name}] ${r.message}`,t=[];return r.fix&&t.push(`fix: ${r.fix}`),r.sources?.length&&t.push(`sources: ${r.sources.join(", ")}`),r.docs&&t.push(`see: ${r.docs}`),t.length===0?e:[e,...t.map((i,s)=>`${s<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
12
+ `)}function Ji(r,...e){return typeof r=="function"?r(...e):r}function Ua({method:r="warn",formatter:e=La}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const Ma=Error.captureStackTrace;var Ka=class Fr extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=Fr){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,Ma?.(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 Ba(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function za(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const s of Object.keys(r.codes)){const o=r.codes[s],a=o.docs===!1?void 0:o.docs||Ba(i,s),l=(u={},c={})=>{const d=new Ka({code:s,why:Ji(o.why,u),fix:Ji(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[s]=l}return t}const Pa=typeof window<"u",qa=za({reporters:[Ua()],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"},PINIA_R1008:{why:r=>`"$dispose()" was called on an old instance of store "${r.id}" that has already been replaced by a new one. This also removes the new store.`,fix:"Avoid keeping references to disposed stores. Call the useStore() function again to get the current store.",docs:"https://pinia.vuejs.org/api/pinia/interfaces/StoreWithState.html#-dispose-"}}});let er;process.env.NODE_ENV;const tr=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Xe(r){const e=n.toRaw(r),t={};for(const i in e){const s=e[i];s?.effect?t[i]=n.computed({get:()=>r[i],set(o){r[i]=o}}):(n.isRef(s)||n.isReactive(s))&&(t[i]=n.toRef(r,i))}return t}const Ne=r=>r?.chart.type==="table",_t=r=>r?.query?.datasource==="requests",Gt=r=>!!r&&!Ne(r)&&!_t(r),Ha=(r,e)=>{const t=r.header_description??("description"in r.chart?r.chart.description:void 0);if(t)return t.replaceAll(Wi,e)||void 0},Ga=r=>!r||r==="basic"?"api_usage":ne.isPlatformDatasource(r)?"platform_usage":r;function $a({queryBridge:r,context:e,definition:t,chartData:i}){const s=n.ref(""),o=n.ref(""),a=n.ref(void 0),l=n.ref(void 0),u=Se.useAnalyticsConfigStore(),c=Se.useDatasourceConfigStore(),{stripUnknownFilters:d,datasourceConfigMap:h,datasourceConfigError:f,loading:m}=Xe(c),C=n.computed(()=>Ne(t.value));n.onMounted(async()=>{s.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const b=n.computed(()=>u.analytics&&u.percentiles),R=n.computed(()=>{const v=t.value.chart.type;return["golden_signals","gauge"].includes(v)?!1:v==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),w=n.computed(()=>{const v=t.value.query?.datasource??"api_usage";return v.startsWith("goap")?!f.value:!!h.value[v]?.showRequestsLink}),U=n.computed(()=>{if(_t(t.value))return!1;const v=Ga(t.value.query?.datasource);return!!h.value[v]?.showInUI}),O=n.computed(()=>o.value&&t.value.query&&!C.value&&w.value&&b.value&&!m.value),E=n.computed(()=>s.value&&t.value.query&&U.value&&b.value&&!m.value),k=n.computed(()=>i.value?ne.msToGranularity(i.value.meta.granularity_ms):void 0),I=n.computed(()=>{const v=t.value,P=[...e.value.filters,...v.query.filters??[]],V="metrics"in v.query?v.query.metrics:void 0,W=v.query?.datasource??"api_usage";return d.value({datasource:W,filters:P,queryFields:V})}),B=n.computed(()=>{if(!E.value||!R.value)return"";const v=t.value;if(Ne(v))return F({...v.query,filters:I.value});const P=v.query.time_range||e.value.timeSpec,V=D(P,I.value);return F(V)}),g=n.computed(()=>{if(!O.value||!R.value)return"";const v=I.value,P=t.value;if(Ne(P))return"";const V=_(P.query.time_range||e.value.timeSpec,v);return p(V)}),p=v=>O.value?`${o.value}?q=${JSON.stringify(v)}`:"",_=(v,P)=>{const V=i.value?.meta?.start?new Date(i.value.meta.start):void 0,W=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:P,timeframe:{timePeriodsKey:v.type==="relative"?v.time_range:"custom",start:v.type==="absolute"?V:void 0,end:v.type==="absolute"?W:void 0}}},M=(v,P)=>({filter:P,timeframe:{timePeriodsKey:v.type==="relative"?v.time_range:"custom",start:v.type==="absolute"?v.start:void 0,end:v.type==="absolute"?v.end:void 0}}),D=(v,P)=>{const V=t.value;if(!Gt(V))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const W=[...V.query.dimensions??[]],T=[...V.query.metrics??[]];return{filters:P,metrics:T,dimensions:W,time_range:v,granularity:V.query.granularity||k.value||void 0}},F=v=>{if(!E.value)return"";const P=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${s.value}?q=${JSON.stringify(v)}&d=${P}&c=${t.value.chart.type}`};return n.watch([O,E],([v,P])=>{v&&(a.value={href:""}),P&&(l.value={href:""})}),{exploreLinkKebabMenu:B,requestsLinkKebabMenu:g,canShowKebabMenu:R,canGenerateRequestsLink:O,canGenerateExploreLink:E,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:D,buildRequestsQueryZoomActions:M,buildExploreLink:F,buildRequestLink:p}}const $t=r=>r.type==="relative"?ne.TimePeriods.get(ne.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Fa=r=>r.reduce((e,t)=>{const i=ne.TimePeriods.get(ne.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Ft=(r,e)=>{if(!r||!e?.length)return;const t=$t(r),i=Fa(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},Wt=(r,e)=>{const t=Ft(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 Wa(){const r=n.inject(Ie),e=Se.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;return n.onUnmounted(()=>{s?.abort()}),{issueQuery:async(a,l,u)=>{if(!r)throw new Error("Query bridge is not defined");s?.abort();const c=new AbortController;s=c,await e.isReady();const{datasource:d,limit:h,...f}=a,m=d||"basic",C=ne.isPlatformDatasource(m),b=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:U})=>!C||!ne.requestFilterTypeEmptyV2.some(O=>O===U));let R=a.time_range;!R&&l.timeSpec?R={...l.timeSpec,tz:l.tz}:R&&!R.tz&&(R={...R,tz:l.tz}),R=Wt(R,t.value[m]?.timeRangeOptions);const w={datasource:m,query:{...f,time_range:R,filters:b,limit:u??h}};return r.queryFn(w,c)}}}const Va="24H",Ya={status_code:"response_http_status",upstream_status_code:"upstream_status"},Xa={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"},ja=r=>ne.relativeTimeRangeValuesRequestV2.includes(r),Qa=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:ja(t)?t:Va,...e}},ir=r=>Ya[r]??r,Za=r=>({metric:ir(r.metric),dimension:r.dimension?ir(r.dimension):void 0,unroll:r.unroll,metricUnit:Xa[r.metric],extraFields:r.extra_fields}),Vt="requests";function Ja(){const r=n.inject(Ie),e=Se.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;n.onUnmounted(()=>{s?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return Wt(c&&{...c,tz:c.tz??u.tz},t.value[Vt]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");s?.abort();const d=new AbortController;s=d,await e.isReady();const h=i.value({datasource:Vt,filters:[...l.filters??[],...u.filters]});return ne.fetchAllRequests(c,{datasource:Vt,query:{filters:h,time_range:Qa(o(l,u))}},d,{maxRecords:l.max_records})}}}function el({context:r,globalFilters:e=n.ref([]),isFullscreen:t=n.ref(!1),preview:i=n.ref(!1)}){const s=Se.useAnalyticsConfigStore(),o=Se.useDatasourceConfigStore(),{loading:a}=Xe(s),{loading:l}=Xe(o),u=n.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:s.defaultQueryTimeForOrg}),c=n.computed(()=>{const{tz:E}=r.value;return E||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=n.computed(()=>{const{editable:E}=r.value;return E===void 0||i.value?!1:E}),h=n.computed(()=>{const{showTileActions:E}=r.value;return i.value?!1:E===void 0?!0:E}),f=n.computed(()=>[...r.value.filters??[],...e.value]),m=n.computed(()=>{let{refreshInterval:E}=r.value;if(E===void 0&&(E=Vi),t.value){let k=!1;if(u.value.type==="relative")k=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const g=u.value.start.getTime(),p=u.value.end.getTime();k=Math.abs(p-g)<=864e5}const I=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<I||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?E=0:k?E=Yi:E=Xi}return E}),C=n.computed(()=>({...r.value,filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:m.value,editable:d.value,showTileActions:h.value})),b=n.computed(()=>!a.value&&!l.value),R=n.computed(()=>!i.value&&!!n.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),w=n.computed(()=>!i.value),U=n.computed(()=>!i.value),O=n.computed(()=>({enabled:R.value,showExploreAction:w.value,showRequestsAction:U.value,showZoomInAction:R.value}));return{editable:d,enrichedContext:C,filters:f,queryReady:b,refreshInterval:m,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:O}}const tl=6,rr=6,nr=4;function il(r,e){const{pageWidth:t,pageHeight:i,margin:s}=e,o=s+1,a=s+e.headerHeight-3,l=i-s-rr+3,u=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,s,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-s,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,s,o+nr),r.setDrawColor(220),r.line(s,a,t-s,a),r.line(s,l,t-s,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,s,u);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const d=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(d,s+c,u,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(d,s+c,u)),r.setTextColor(120),r.text(e.pageLabel,t-s,u,{align:"right"})}function rl(r){const e=r.querySelectorAll(".kong-ui-public-grid-layout, .grid-stack"),t=[];if(e.forEach(o=>{t.push(...o.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item"))}),!t.length)return[];const i=r.getBoundingClientRect().top,s=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),u=Math.round(a.bottom-i),c=s.get(l);s.set(l,c!==void 0?Math.max(c,u):u)}),[...s.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function nl(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const u=Math.min(t,e-l);a.push({startY:l,height:u}),l+=u}return a}const s=[];let o=0;for(const a of r){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(s.push({startY:o,height:l-o}),o=l):(s.push({startY:o,height:u-o}),o=u))}return o<e&&s.push({startY:o,height:e-o}),s}function sl(r){const{i18n:e}=gt(),t=n.ref({status:"idle"});async function i(s={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:u,orientation:c="landscape",pageSize:d="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:C="download",onBeforeCapture:b,onAfterCapture:R}=s,w=r.value;if(!w){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await b?.();const[{snapdom:U},{jsPDF:O}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const E={name:"kong-webgl-snapshot",beforeClone:()=>ne.prepareForCapture(),afterClone:()=>ne.restoreAfterCapture()},k=await U.toCanvas(w,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[E]}),I=rl(w),B=w.getBoundingClientRect().width,g=B?k.width/B:f;t.value={status:"generating"};const p=new Date,_=new O({orientation:c,unit:"mm",format:d}),M=_.internal.pageSize.getWidth(),D=_.internal.pageSize.getHeight(),F=tl+(l?nr:0),v=M-h*2,P=D-h*2-F-rr,V=k.width/v,W=P*V,T=nl(I,k.height,W,g),x={title:a,subtitle:l,dashboardUrl:u,generatedAt:e.t("pdfExport.generated",{timestamp:p.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:M,pageHeight:D,headerHeight:F,margin:h};for(let q=0;q<T.length;q++){q>0&&_.addPage();const{startY:L,height:G}=T[q],N=document.createElement("canvas");N.width=k.width,N.height=G,N.getContext("2d").drawImage(k,0,L,k.width,G,0,0,k.width,G),_.addImage(N.toDataURL("image/png"),"PNG",h,h+F,v,G/V),il(_,{...x,pageLabel:e.t("pdfExport.pageOf",{page:String(q+1),total:String(T.length)})})}if(C==="blob"){const q=_.output("blob");return t.value={status:"complete",pageCount:T.length},q}_.save(o),t.value={status:"complete",pageCount:T.length}}catch(U){t.value={status:"error",error:U}}finally{ne.restoreAfterCapture(),await R?.()}}return{exportPdf:i,exportState:n.readonly(t)}}const ol=r=>r.toLowerCase().endsWith("count")?"":r;function al(){const{i18n:r}=gt(),{formatUnit:e}=ne.unitFormatter({i18n:r}),t=he.useFieldLabel();return i=>{const s=i.meta?.metric_names?.[0]??"",o=i.meta?.metric_units?.[s]??"";return{seriesName:t(s),valueFormatter:a=>e(a,o,{translateUnit:ol})}}}const Yt=(r,e,t,{prefix:i="chartLabels",fallback:s=t}={})=>{const o=`${i}.${t}`;return e.get(t)||(r.te(o)?r.t(o):s)};function ll(){const{i18n:r}=gt(),e=Se.useDatasourceConfigStore();return(t,i)=>Yt(r,e.fieldTranslationMap,t,i)}const he={useContextLinks:$a,useDashboardContext:el,useEvaluateFeatureFlag:Ta,useExportPdf:sl,useFieldLabel:ll,useI18n:gt,useIssueQuery:Wa,useIssueRequestsQuery:Ja,useMetricFormatter:al,useRequestQueue:Aa},cl={class:"kong-ui-public-csv-export-modal"},ul={key:0,class:"selected-range"},dl={key:4,class:"text-muted",tag:"span"},sr=3,or=n.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=he.useI18n(),i=he.useFieldLabel(),s=r,o=e,a=`${s.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,l=n.ref(1),u=n.computed(()=>m.value.rows.length),c=n.computed(()=>s.exportState.status==="success"&&!!s.exportState.chartData?.data?.length),d=n.computed(()=>{if(s.exportState.status!=="success"||!s.exportState.chartData?.meta)return"";const{start:b,end:R}=s.exportState.chartData.meta;return!b||!R?"":new Date(b).getTime()===new Date(R).getTime()?t.t("csvExport.exportAsOf",{time:ne.formatTimestamp(new Date(b),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ne.formatTimestamp(new Date(b))} - ${ne.formatTimestamp(new Date(R),{includeTZ:!0})}`}),h=n.computed(()=>s.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(sr,u.value),rowsTotal:u.value,plural:u.value===1?"":"s"})),f=()=>{o("closeModal")},m=n.computed(()=>{if(s.exportState.status!=="success"||!c.value||!s.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const b=s.exportState.chartData,R=b.data.some(I=>I.timestamp!==b.data[0].timestamp),w=b.data.map(I=>{const B=new Date(I.timestamp);return{...Object.keys(I.event).reduce((p,_)=>{if(_ in b.meta.display){const M=I.event[_],D=b.meta.display[_],F=M&&D?.[M]?.name||I.event[_];p[_]=M===Re.OTHER_DIMENSION_ID?t.t("chartLabels.____OTHER____"):F}else p[_]=I.event[_];return p},{}),...R?{timestamp:Bt(B,"yyyy-MM-dd HH:mm:ss"),tzOffset:Bt(B,"XXX")}:{}}});let U=[];R&&(U=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const O="display"in s.exportState.chartData.meta&&s.exportState.chartData.meta.display?s.exportState.chartData.meta.display:{},E=[...U,...Object.keys(O).map(I=>({label:i(I),key:I})),...s.exportState.chartData.meta.metric_names.map(I=>({label:i(I),key:I}))],k=E.reduce((I,B)=>(I[B.key]=B.label,I),{});return{headers:E,csvHeaders:k,rows:w}}),C=async()=>{if(s.exportState.status!=="success")return{total:0,data:[]};const{rows:b}=m.value;return{total:Number(b.length)||0,data:b.slice(0,sr)}};return n.watch(m,()=>{l.value++}),(b,R)=>{const w=n.resolveComponent("KSkeleton"),U=n.resolveComponent("KEmptyState"),O=n.resolveComponent("KTableData"),E=n.resolveComponent("KTooltip"),k=n.resolveComponent("KButton"),I=n.resolveComponent("KModal");return n.openBlock(),n.createElementBlock("div",cl,[n.createVNode(I,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:n.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:f,onKeyup:n.withKeys(f,["esc"])},{default:n.withCtx(()=>[n.createElementVNode("div",null,[r.exportState.status==="success"&&c.value?(n.openBlock(),n.createElementBlock("div",ul,[n.createElementVNode("p",null,n.toDisplayString(r.modalDescription?r.modalDescription:n.unref(t).t("csvExport.exportDescription")),1),n.createElementVNode("p",null,n.toDisplayString(d.value),1)])):n.createCommentVNode("",!0),r.exportState.status==="loading"?(n.openBlock(),n.createBlock(w,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(n.openBlock(),n.createBlock(O,{key:2,class:"vitals-table",fetcher:C,"fetcher-cache-key":String(l.value),headers:m.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":n.withCtx(()=>[n.createVNode(U,{"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRange")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):r.exportState.status==="error"?(n.openBlock(),n.createBlock(U,{key:3,"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.dataError")),1)]),_:1})):n.createCommentVNode("",!0),r.exportState.status==="success"&&c.value?(n.openBlock(),n.createElementBlock("div",dl,[n.createTextVNode(n.toDisplayString(h.value)+" ",1),n.createVNode(E,{class:"preview-tooltip",placement:"right",text:n.unref(t).t("csvExport.maximumRecordAmount",{value:n.unref(ne.EXPORT_RECORD_LIMIT)})},{default:n.withCtx(()=>[n.createVNode(n.unref(oe.InfoIcon),{color:`var(--kui-color-text-neutral, ${n.unref(ua)})`,size:`var(--kui-icon-size-30, ${n.unref(ha)})`},null,8,["color","size"])]),_:1},8,["text"])])):n.createCommentVNode("",!0)])]),"footer-actions":n.withCtx(()=>[n.createVNode(k,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.cancelButton")),1)]),_:1}),n.createVNode(Oa,{class:"vitals-report-export-button",filename:a,headers:m.value.csvHeaders,rows:m.value.rows},{default:n.withCtx(()=>[n.createVNode(k,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!c.value},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}});var ar=(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))(ar||{});const hl=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 lr(r=n.ref({}),e,t,i=hl){const s=n.ref("PENDING");return n.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){s.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){s.value="VALIDATING";return}if(r.value&&e.value){s.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){s.value="PENDING";return}if(r.value&&!e.value&&o){s.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){s.value="SUCCESS";return}r.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:ar}}const Be=n.defineComponent({__name:"QueryDataProvider",props:{context:{},limitOverride:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),{issueQuery:o}=he.useIssueQuery(),a=n.inject(Ie),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=oi(l,async E=>{try{const k=await o(t.query,t.context,t.limitOverride);return l()!==E?void 0:(C.value=null,{key:E,result:k})}catch(k){if(l()!==E)return;throw C.value=Re.handleQueryError(k),k}finally{l()===E&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),h=n.computed(()=>u.value?.result),{state:f,swrvState:m}=lr(u,c,d),C=n.ref(null),b=n.computed(()=>f.value===m.ERROR||!!C.value),R=n.computed(()=>!t.queryReady||f.value===m.PENDING),w=n.ref(),U=n.computed(()=>h.value??(t.queryReady&&f.value===m.PENDING?w.value:void 0)),O=n.computed(()=>!!U.value&&u.value?.key!==l());return n.watch([()=>h.value,()=>f.value],([E,k])=>{E&&(k==="SUCCESS_HAS_DATA"||k==="SUCCESS")&&E!==w.value&&(w.value=E,i("chart-data",E))},{immediate:!0}),(E,k)=>{const I=n.resolveComponent("KSkeleton"),B=n.resolveComponent("KEmptyState");return(R.value||!h.value&&!b.value)&&!U.value?(n.openBlock(),n.createBlock(I,{key:0,class:"chart-skeleton",type:"table"})):b.value&&!R.value?(n.openBlock(),n.createBlock(B,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[C.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(oe.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(oe.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(C.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[C.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(C.value.details),1)]),key:"0"}:void 0]),1024)):U.value?(n.openBlock(),n.createBlock(n.unref(Re.LoadingOverlay),{key:2,loading:O.value},{default:n.withCtx(()=>[n.renderSlot(E.$slots,"default",{data:U.value})]),_:3},8,["loading"])):n.createCommentVNode("",!0)}}}),fl=n.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){const e=r,t=n.computed(()=>e.chartOptions.type==="single_value"),i=n.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend",compact:!!e.fitToContent,hideMetricName:!e.chartOptions.chart_title}:e.chartOptions);return(s,o)=>(n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:a})=>[n.createElementVNode("div",{class:n.normalizeClass(["analytics-chart",{"single-value":t.value,compact:t.value&&r.fitToContent}]),style:n.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[n.createVNode(n.unref(Re.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"]))}}),De=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},cr=De(fl,[["__scopeId","data-v-df5d87ad"]]),ml={class:"analytics-chart"},Xt=De(n.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),o=n.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold,metricAxisMap:t.chartOptions.metric_axis_map,yAxes:t.chartOptions.y_axes&&{left:a(t.chartOptions.y_axes.left),right:a(t.chartOptions.y_axes.right)},hideTruncationWarning:t.query.limit!==void 0&&t.query.limit>0})),a=c=>c&&{title:c.title,showGrid:c.show_grid},l=()=>{i("edit-tile")},u=c=>{i("chart-data",c)};return(c,d)=>{const h=n.resolveComponent("KDropdownItem");return n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:u},{default:n.withCtx(({data:f})=>[n.createElementVNode("div",ml,[n.createVNode(n.unref(Re.AnalyticsChart),n.mergeProps({"active-metric":r.activeMetric,"chart-data":f,"chart-options":o.value,"explore-link":r.exploreLink,"legend-position":"bottom","requests-link":r.requestsLink,"synthetics-data-key":r.chartOptions.synthetics_data_key,"timeseries-zoom":r.zoomConfiguration?.showZoomInAction,"tooltip-title":""},r.extraProps,{onSelectChartRange:d[0]||(d[0]=m=>i("select-chart-range",m)),onZoomTimeRange:d[1]||(d[1]=m=>i("zoom-time-range",m))}),n.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:n.withCtx(()=>[n.createVNode(h,{onClick:l},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["active-metric","chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-5e3d0a14"]]),ur=n.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Xt,{"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"]))}}),pl={class:"analytics-chart"},gl={key:3,class:"analytics-chart"},_l=De(n.defineComponent({__name:"ScatterChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),{issueRequestsQuery:o}=he.useIssueRequestsQuery(),a=n.computed(()=>t.query.datasource==="requests"),l=n.computed(()=>{const I=t.query,B=I.time_range??t.context.timeSpec,g=B?$t(B):void 0;if(!g)return I;const p=ne.finestGranularityForDuration(g);let _;return I.granularity&&ne.Granularities[I.granularity]>=ne.Granularities[p]?_=I.granularity:_=p,{...I,granularity:_}}),u=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=n.ref(null),{data:d,error:h,isValidating:f}=oi(u,async I=>{const B=t.query;try{const g=await o(B,t.context);return u()!==I?void 0:(c.value=null,{key:I,result:Re.requestsToScatterData(g,Za(B))})}catch(g){if(u()!==I)return;throw c.value=Re.handleQueryError(g),g}finally{u()===I&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),m=n.computed(()=>d.value?.result),{state:C,swrvState:b}=lr(d,h,f),R=n.ref(),w=n.computed(()=>m.value??R.value);n.watch(m,I=>{I&&(R.value=I)});const U=n.computed(()=>C.value===b.ERROR||!!c.value),O=n.computed(()=>!U.value&&(!t.queryReady||C.value===b.PENDING)&&!w.value),E=n.computed(()=>!!w.value&&d.value?.key!==u()),k=n.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(I=>({percentile:I.percentile,label:I.label,borderDash:I.border_dash,color:I.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(I,B)=>{const g=n.resolveComponent("KSkeleton"),p=n.resolveComponent("KEmptyState");return a.value?O.value?(n.openBlock(),n.createBlock(g,{key:1,class:"chart-skeleton",type:"table"})):U.value?(n.openBlock(),n.createBlock(p,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[c.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(oe.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(oe.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):w.value?(n.openBlock(),n.createElementBlock("div",gl,[n.createVNode(n.unref(Re.AnalyticsChart),{"chart-data":w.value,"chart-options":k.value,"legend-position":"bottom",loading:E.value,"synthetics-data-key":r.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","loading","synthetics-data-key"])])):n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Be,{key:0,context:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:B[0]||(B[0]=_=>i("chart-data",_)),onQueryComplete:B[1]||(B[1]=_=>i("query-complete"))},{default:n.withCtx(({data:_})=>[n.createElementVNode("div",pl,[n.createVNode(n.unref(Re.AnalyticsChart),{"chart-data":_,"chart-options":k.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-f6f628be"]]),dr=n.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["zoom-time-range","select-chart-range"],setup(r,{emit:e}){const t=e;return(i,s)=>(n.openBlock(),n.createBlock(Xt,{"active-metric":r.activeMetric,"chart-options":r.chartOptions,context:r.context,"explore-link":r.exploreLink,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,"requests-link":r.requestsLink,"zoom-configuration":r.zoomConfiguration,onSelectChartRange:s[0]||(s[0]=o=>t("select-chart-range",o)),onZoomTimeRange:s[1]||(s[1]=o=>t("zoom-time-range",o))},null,8,["active-metric","chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link","zoom-configuration"]))}}),yl=De(n.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>{const s=e.query?.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:e.query?.datasource,overrideTimeRange:e.context.timeSpec,additionalFilter:e.context.filters,longCardTitles:e.chartOptions.long_card_titles,percentileLatency:e.chartOptions.percentile_latency,refreshInterval:e.context.refreshInterval,queryReady:e.queryReady,refreshCounter:e.refreshCounter}}),i=n.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(s,o)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[n.createVNode(n.unref(ai.MetricsProvider),n.normalizeProps(n.guardReactiveProps(t.value)),{default:n.withCtx(()=>[n.createVNode(n.unref(ai.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]),Rl="analytics-dashboard-coordinator",Cl=({gridApi:r,headers:e,coordinator:t=n.inject(Rl,void 0)})=>{const i=crypto.randomUUID(),s=n.ref(null),o=n.computed(()=>new Set(e.value.map(C=>C.key))),a=n.ref(null),l=C=>C==null?null:String(C),u=C=>{const b=a.value,R=s.value;return!!C&&b!==null&&R!==null&&l(C[b])===R};let c,d=0,h=null;t&&n.watch([t.activeChart,t.activeDimension,t.activeDimensionValue],([C,b,R])=>{clearTimeout(c);const w=b!==null&&o.value.has(b)&&C!==i;c=setTimeout(()=>{const U=w?R:null,O=w?b:null;if(U===s.value&&O===a.value)return;s.value=U,a.value=O;const E=r.value;E&&!E.isDestroyed()&&E.redrawRows()},t.DIMENSION_DEBOUNCE_MS)});const f=(C,b,R)=>{const w=l(R);if(!t||!b||!C||w===null||!o.value.has(C))return;const U=`${C}\0${w}`;if(U===h)return;const O=Date.now();O-d<t.DIMENSION_DEBOUNCE_MS||(d=O,h=U,t.activate({chartUuid:i,dimension:C,dimensionValue:w}))},m=()=>{h=null,d=0,t?.deactivate({chartUuid:i})};return n.onBeforeUnmount(()=>{clearTimeout(c),m()}),{isHighlighted:u,onCellHover:f,onGridLeave:m}};var nt=(r=>(r.PENDING="PENDING",r.LOADING="LOADING",r.SUCCESS="SUCCESS",r.ERROR="ERROR",r))(nt||{});const El=r=>!!r?.length;function bl(r,e,t,i=El){const s=n.computed(()=>i(r.value)),o=n.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":s.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:nt,hasData:s,state:o}}const Ol=({emitState:r,fetchLifecycleState:e,hasData:t})=>{n.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:s})=>{if(s!==nt.PENDING){if(s===nt.LOADING){r({hasData:i,state:"loading"});return}if(s===nt.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},wl=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},Tl=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:s})=>{if(typeof i=="number")return i;if(s!==!0&&(s===!1||e<t))return r+e},vl=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,s=new Map,o=n.ref(0),a=n.ref(0),l=n.shallowRef(),u=n.shallowRef(),c=n.shallowRef(),d=n.ref(0),h=n.ref(!1);let f,m,C=t?.value?.sortColumnKey,b=t?.value?.sortColumnOrder;const R=v=>v===o.value&&f===r.value&&m===e?.value,w=(v,P)=>R(v)&&P===a.value&&C===t?.value?.sortColumnKey&&b===t?.value?.sortColumnOrder,U=v=>{if(!t)return!0;const P=t.value;return!P?.sortColumnKey||!P.sortColumnOrder?v.length===0:v.length===1&&v[0].colId===P.sortColumnKey&&v[0].sort===P.sortColumnOrder},O=()=>{h.value=d.value>0},E=()=>{a.value+=1,C=t?.value?.sortColumnKey,b=t?.value?.sortColumnOrder;for(const v of s.values())v.resolve(!1);i.clear(),s.clear(),u.value=void 0,c.value=void 0,d.value=0,O()},k=()=>{c.value=void 0,d.value+=1,O()},I=()=>{d.value=Math.max(0,d.value-1),O()},B=v=>{const P=s.get(v);if(P)return P;let V;const W={promise:new Promise(T=>{V=T}),resolve:T=>V(T)};return s.set(v,W),W},g=(v,P)=>{P.resolve(!1),s.get(v)===P&&s.delete(v)},p=async({blockIndex:v,currentBlockCompletion:P,datasourceId:V,requestGeneration:W})=>{if(v===0)return"ready";const T=s.get(v-1);if(!T)return g(v,P),"failed";const x=await T.promise;return w(V,W)?x?"ready":(g(v,P),"failed"):(g(v,P),"stale")},_=({blockIndex:v,currentBlockCompletion:P,getRowsParams:V,pageSize:W,result:T})=>{T.cursor!==void 0&&i.set(v,T.cursor),V.successCallback(T.data,Tl({startRow:V.startRow,rowsLength:T.data.length,pageSize:W,total:T.total,hasMore:T.hasMore})),V.startRow===0&&(u.value=T.data),P.resolve(!0)},M=({blockIndex:v,currentBlockCompletion:P,fetchError:V,getRowsParams:W})=>{c.value=V,W.failCallback(),g(v,P)},D=()=>{const v=r.value;if(!v)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=v,m=e?.value;const P=o.value+1;return o.value=P,E(),{async getRows(V){if(!R(P)||!U(V.sortModel)){V.failCallback();return}const{blockIndex:W,pageSize:T}=wl({startRow:V.startRow,endRow:V.endRow});W===0&&s.has(0)&&E();const x=a.value,q=B(W);if(await p({blockIndex:W,currentBlockCompletion:q,datasourceId:P,requestGeneration:x})!=="ready"||!w(P,x)){V.failCallback(),g(W,q);return}k();try{const L=W>0?i.get(W-1):void 0,G=await v({mode:"infinite",pageSize:T,cursor:L,sort:t?.value});if(!w(P,x)){V.failCallback(),g(W,q);return}_({blockIndex:W,currentBlockCompletion:q,getRowsParams:V,pageSize:T,result:G})}catch(L){if(!w(P,x)){V.failCallback(),g(W,q);return}M({blockIndex:W,currentBlockCompletion:q,fetchError:L,getRowsParams:V})}finally{w(P,x)&&I()}}}},F=()=>{l.value=D()};return n.watch([r,()=>e?.value],()=>{F()},{immediate:!0}),n.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>E()),{datasource:n.readonly(l),data:n.shallowReadonly(u),error:n.readonly(c),isFetching:n.readonly(h)}},Sl={title:"No Data",message:"There is no data to display."},xl={title:"An error occurred",message:"Data cannot be displayed due to an error."},Il={emptyState:Sl,errorState:xl};function hr(){const r=ct.createI18n("en-us",Il);return{i18n:r,i18nT:ct.i18nTComponent(r)}}const{i18n:Dl}=hr(),fr=(r,e)=>{const t=Reflect.get(e,r.key);return r.valueFormatter?r.valueFormatter(t,e):String(t??"")},yt=r=>typeof r!="number"?null:Number.isFinite(r)?r:null,kl=(r,e)=>r.reduce((t,i)=>{const s=yt(Reflect.get(i,e.key));return s===null?t:{sum:t.sum+s,max:Math.max(t.max,s)}},{sum:0,max:0}),Nl=(r,e)=>{const t=(e??[]).filter(s=>Number.isFinite(s.value)&&r>=s.value);if(!t.length)return;const i=Math.max(...t.map(s=>s.value));return t.filter(s=>s.value===i).some(s=>s.type==="error")?"error":"warning"},Al=(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},Ll=r=>{const e=t=>Dl.formatNumber(t,{maximumFractionDigits:2});return r>0&&r<.01?`< ${e(.01)} %`:`${e(r)} %`},mr=({value:r,stats:e,header:t})=>{if(r===null||e.sum<=0)return;const i=r/e.sum*100;return t.percentageFormatter?.(i)??Ll(i)},pr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Ul=({rows:r,header:e,stats:t})=>r.reduce((i,s)=>({value:pr(i.value,fr(e,s))??"",relative:e.showPercentage?pr(i.relative,mr({value:yt(Reflect.get(s,e.key)),stats:t,header:e})):void 0}),{value:""}),Ml=["data-threshold"],Kl={class:"table-data-grid-cell-label-track"},Bl={class:"table-data-grid-cell-label"},zl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},Pl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},ql=["data-text"],Hl=["data-text"],Gl=["data-threshold"],$l=n.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=n.shallowRef(r.params),i=n.ref(null),s=n.ref(!1),o=n.computed(()=>t.value.headerDef??{key:"",label:""}),a=n.computed(()=>t.value.context?.presentation),l=n.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),u=n.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=n.computed(()=>t.value.value),d=n.computed(()=>yt(c.value)),h=n.computed(()=>a.value?.stats[o.value.key]),f=n.computed(()=>o.value.showPercentage&&h.value?mr({value:d.value,stats:h.value,header:o.value}):void 0),m=n.computed(()=>!!o.value.bar&&!!h.value&&(d.value!==null||c.value===null||c.value===void 0)),C=n.computed(()=>m.value&&h.value?Al(d.value,h.value,o.value.bar)*100:0),b=n.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),R=n.computed(()=>o.value.thresholds?.length&&d.value!==null?Nl(d.value,o.value.thresholds):void 0),w=n.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})),U=(_,{slots:M})=>{const D=t.value.colDef?.colId,F=t.value.context?.cells?.slots;return!D||D==="cell-icon"||!F?.[D]?M.default?.():n.h("span",{class:"table-data-grid-cell-slot-content"},n.renderSlot(F,D,w.value,()=>M.default?.()??[]))},O=()=>{const _=t.value.context?.cells?.slots;return _?.["cell-icon"]?n.renderSlot(_,"cell-icon",w.value):null};let E,k,I=!1;const B=()=>{const _=i.value;s.value=!!_&&_.scrollWidth>_.clientWidth},g=()=>{I||(k!==void 0&&cancelAnimationFrame(k),k=requestAnimationFrame(()=>{k=void 0,B()}))},p=_=>{if(E?.disconnect(),_){E?.observe(_);const M=_.closest(".ag-cell");M&&E?.observe(M)}g()};return n.onMounted(()=>{E=new ResizeObserver(g),p(i.value)}),n.watch(i,p),n.onUnmounted(()=>{I=!0,E?.disconnect(),k!==void 0&&cancelAnimationFrame(k)}),e({refresh(_){return t.value=_,n.nextTick(g),!0}}),(_,M)=>{const D=n.resolveComponent("KTooltip");return n.openBlock(),n.createElementBlock("span",{class:n.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":m.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${R.value}`]:!m.value&&!!R.value}]),"data-threshold":R.value},[n.createElementVNode("span",Kl,[n.createElementVNode("span",Bl,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(O))),(n.openBlock(),n.createBlock(n.resolveDynamicComponent(U),null,{default:n.withCtx(()=>[n.createVNode(D,{class:"table-data-grid-cell-tooltip",disabled:!s.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:u.value},{default:n.withCtx(()=>[n.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},n.toDisplayString(u.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(n.openBlock(),n.createElementBlock("span",zl,"("+n.toDisplayString(f.value)+")",1)):n.createCommentVNode("",!0)]),b.value?(n.openBlock(),n.createElementBlock("span",Pl,[n.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":b.value.value},null,8,ql),b.value.relative?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${b.value.relative})`},null,8,Hl)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":R.value},[n.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:n.normalizeStyle({width:`${C.value}%`})},null,4)],8,Gl)):n.createCommentVNode("",!0)],10,Ml)}}}),Fl=({headers:r,slots:e,initialSort:t,mode:i,rows:s,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,u=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);n.watch([r,()=>s?.value],()=>{r.value.forEach(m=>{if(!u(m))return;let C;if(a==="infinite"&&(m.showPercentage||m.bar)?C="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&s?.value?.some(R=>{const w=Reflect.get(R,m.key);return w!=null&&yt(w)===null})&&(C="contains non-finite or nonnumeric values; numeric presentation skips those values"),!C)return;const b=`${m.key}:${C}`;l.has(b)||(l.add(b),console.warn(`[TableDataGrid] Column "${m.key}" ${C}.`))})},{immediate:!0});const c=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(C=>C.showPercentage||C.bar).map(C=>[C.key,kl(m,C)]))}),d=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(C=>C.bar).map(C=>[C.key,Ul({rows:m,header:C,stats:c.value[C.key]})]))}),h=n.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:d.value}})),f=m=>{const C=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,...C?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:b=>b.data?.[m.key],valueFormatter:b=>b.data?fr(m,b.data):String(b.value??""),width:m.width,cellRenderer:$l,cellRendererParams:{headerDef:m}}};return{columnDefs:n.computed(()=>r.value.map(f)),gridContext:h}},jt=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),s=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:s,sortColumnOrder:s?r?.sortColumnOrder:void 0,pageSize:r?.pageSize??t,...r?.fitToContent!==void 0?{fitToContent:r.fitToContent}:{}}},gr=(r,e)=>r.sortColumnKey===e.sortColumnKey&&r.sortColumnOrder===e.sortColumnOrder&&r.pageSize===e.pageSize&&r.fitToContent===e.fitToContent,Wl=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:s,onExternalConfigChange:o})=>{const a=n.computed(()=>t.value?jt({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=n.ref(a.value??jt({config:void 0,headers:r.value,pageSize:e.value}));n.watch(a,h=>{h&&!gr(h,l.value)&&(l.value=h,o?.(h))});const u=h=>{const f=jt({config:{...l.value,...h},headers:r.value,pageSize:e.value});gr(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,s(f))};n.watch(r,()=>{t.value||u({})},{deep:!0});const c=n.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),d=n.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:n.readonly(l),activeSort:c,activePageSize:d,patchTableConfig:u}},Vl=({cellClick:r,headers:e,rowClick:t})=>{const i=n.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),s=a=>{const l=a.event?.target;return l instanceof Element?l.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},o=a=>{const l=s(a);return!!(l&&i.value.has(l))};return{onCellClick:a=>{const l=a.colDef.colId;!a.data||!l||r({columnKey:l,row:a.data,value:a.value})},onRowClick:a=>{a.data&&!o(a)&&t(a.data,a)}}},Yl=({activeSort:r,patchTableConfig:e})=>{const t=(i,s)=>{i.applyColumnState({state:s.sortColumnKey?[{colId:s.sortColumnKey,sort:s.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const s=i.api.getColumnState().filter(l=>l.sort).sort((l,u)=>(l.sortIndex??0)-(u.sortIndex??0)),o=s[s.length-1],a=o?{sortColumnKey:o.colId,sortColumnOrder:o.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(a.sortColumnKey!==r.value.sortColumnKey||a.sortColumnOrder!==r.value.sortColumnOrder)&&e(a),s.length>1&&t(i.api,a)},applySortToGrid:t}},Xl={key:0,class:"table-error-state","data-testid":"table-error-state"},jl={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Ql=n.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(r,{emit:e}){je.ModuleRegistry.registerModules([je.AllCommunityModule,je.ClientSideRowModelModule,je.InfiniteRowModelModule]);const t=r.mode??"infinite",i=e,{i18n:s}=hr(),{t:o}=s,a=n.useSlots(),l=n.shallowRef(),u=n.useTemplateRef("rootElement"),c=n.shallowRef("body"),d=()=>{const Q=document.fullscreenElement;c.value=Q instanceof HTMLElement&&Q.contains(u.value??null)?Q:"body"};n.onMounted(()=>{d(),document.addEventListener("fullscreenchange",d)}),n.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",d)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:C}=Wl({headers:n.toRef(()=>r.headers),pageSize:n.toRef(()=>r.pageSize),tableConfig:n.toRef(()=>r.tableConfig),emitSort:Q=>i("sort",Q),emitTableConfigUpdate:Q=>i("update:tableConfig",Q),onExternalConfigChange:Q=>{l.value&&R(l.value,Q)}}),{onSortChanged:b,applySortToGrid:R}=Yl({activeSort:f,patchTableConfig:C}),w=n.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),U=je.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:O,onRowClick:E}=Vl({cellClick:Q=>i("cell:click",Q),headers:n.toRef(()=>r.headers),rowClick:(Q,J)=>i("row:click",Q,J)}),{isHighlighted:k,onCellHover:I,onGridLeave:B}=Cl({gridApi:l,headers:n.toRef(()=>r.headers)}),g={"is-coordinator-highlighted":Q=>k(Q.data)},p=Q=>I(Q.colDef.colId,Q.data,Q.value),_={resizable:!1,sortable:!1,suppressMovable:!0},M=n.computed(()=>[m.value,r.refreshKey]),D=t==="infinite"?vl({fetcher:n.toRef(()=>r.fetcher),resetKey:M,sort:f}):void 0,F=D?.datasource,v=n.computed(()=>D?D.data.value:r.rows),P=n.computed(()=>D?.isFetching.value??!1),V=n.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:W,gridContext:T}=Fl({headers:n.toRef(()=>r.headers),mode:t,rows:V,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:x,hasData:q,state:L}=bl(v,n.toRef(()=>D?.error.value),P),G=n.computed(()=>L.value===x.SUCCESS&&!q.value);D&&Ol({emitState:Q=>i("state",Q),fetchLifecycleState:L,hasData:q});const N=()=>{const Q=l.value;if(!Q||Q.isDestroyed())return;const J=f.value,S=Q.getColumnState().find(K=>K.sort);S?.colId===J.sortColumnKey&&(S?.sort??void 0)===J.sortColumnOrder||R(Q,J)};n.watch([l,f],N);const ce=n.ref(!1),ae=Q=>{Q.direction==="vertical"&&(ce.value=Q.top>0)},ue=Q=>{l.value=Q.api,i("grid:ready",Q.api)};return(Q,J)=>{const S=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"rootElement",ref:u,class:n.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":w.value,"is-scrolled":ce.value}]),"data-testid":"table-data-grid",onMouseleave:J[0]||(J[0]=(...K)=>n.unref(B)&&n.unref(B)(...K))},[r.error?(n.openBlock(),n.createElementBlock("div",Xl,[n.renderSlot(Q.$slots,"error-state",{},()=>[n.createVNode(S,{"icon-variant":"error",message:n.unref(o)("errorState.message"),title:n.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):G.value?(n.openBlock(),n.createElementBlock("div",jl,[n.renderSlot(Q.$slots,"empty-state",{},()=>[n.createVNode(S,{message:n.unref(o)("emptyState.message"),title:n.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(n.openBlock(),n.createBlock(n.unref(Wr.AgGridVue),{key:2,"cache-block-size":n.unref(t)==="infinite"?n.unref(m):void 0,class:"table-data-grid-grid","column-defs":n.unref(W),context:n.unref(T),datasource:n.unref(t)==="infinite"?n.unref(F):void 0,"default-col-def":_,"dom-layout":w.value?"autoHeight":"normal","infinite-initial-row-count":n.unref(t)==="infinite"?1:void 0,loading:P.value,"row-class-rules":g,"row-data":n.unref(t)==="unpaginated"?V.value:void 0,"row-model-type":n.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:n.unref(U),onBodyScroll:ae,onCellClicked:n.unref(O),onCellMouseOver:p,onGridReady:ue,onNewColumnsLoaded:N,onRowClicked:n.unref(E),onSortChanged:n.unref(b)},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"]))],34)}}}),Zl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},_r=Zl(Ql,[["__scopeId","data-v-47e593a5"]]),yr=3,Jl={anthropic:oe.AnthropicIcon,azure:oe.AzureIcon,bedrock:oe.AmazonBedrockIcon,cerebras:oe.CerebrasIcon,cohere:oe.CohereIcon,databricks:oe.DatabricksIcon,deepseek:oe.DeepseekIcon,gemini:oe.GeminiIcon,huggingface:oe.HuggingFaceIcon,llama2:oe.MetaLlamaIcon,mistral:oe.MistralIcon,moonshot:oe.KimiIcon,nvidia:oe.NvidiaIcon,ollama:oe.OllamaIcon,openai:oe.OpenAiIcon,vertex:oe.GoogleVertexIcon,vllm:oe.VllmIcon,xai:oe.GrokIcon},Qt=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},ec=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!(Qt(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Jl[t.toLowerCase()]},tc=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},ic=r=>r.toLocaleLowerCase().endsWith("count"),rc=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,yr),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const s={record:i};return e.forEach(o=>{s[o]=i.event[o]}),t.forEach(o=>{s[o]=tc(i.event[o])}),s})},nc=({data:r,columnOptions:e,i18n:t,fieldTranslationMap:i})=>{const{formatUnit:s}=ne.unitFormatter({i18n:t}),o=r?.data??[],a=r?.meta,l=a?.display??{},u=Object.keys(l).slice(0,yr),c=a?.metric_names??[],d=c[0],h=u.length>1,f=E=>Yt(t,i,E),m=(E,k)=>Qt(e,E)?.label||k,C=(E,k)=>{if(ic(E)||E==="requests")return"";const I=k===1?"":"s",B=`chartUnits.${E}`;return t.messages[B]?t.formatMessage({id:B},{plural:I}):E},b=E=>{const k=I=>s(I,"%",{translateUnit:C});return E>0&&E<.01?`< ${k(.01)}`:k(E)},R=(E,k)=>{const I=E.event[k];if(I==null)return"–";const B=typeof I=="number"?I:Number(I);if(Number.isNaN(B))return"–";const g=a?.metric_units?.[k]||"count";return g==="%"?b(B):s(B,g,{approximate:["count","count/minute","token count"].includes(g),isBytes1024:!0,translateUnit:C})},w=(E,k)=>{const I=String(E.record.event[k]),B=l[k]?.[I];return{id:I,label:I===Re.OTHER_DIMENSION_ID?t.t("chartLabels.____OTHER____"):B?.name||"-",deleted:!!B?.deleted}},U=u.map(E=>({key:E,label:m(E,h?f(E):Yt(t,i,E,{fallback:t.t("topNTable.nameLabel")})),type:"dimension",valueFormatter:(k,I)=>w(I,E).label,sortable:!1}));c.forEach(E=>{const k=Qt(e,E);U.push({key:E,label:k?.label||f(E),type:"metric",valueFormatter:(I,B)=>R(B.record,E),showPercentage:k?.value==="relative",percentageFormatter:b,bar:k?.bar==="max"?"absolute":k?.bar,thresholds:k?.thresholds,sortable:!1})});const O=o.length?a?u.some(E=>!Object.keys(l[E]||{}).length)?t.t("topNTable.errors.display"):d?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:U,errorMessage:O,getDimension:w}},sc={class:"fallback-entity-link","data-testid":"entity-link-parent"},Rr=n.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",sc,n.toDisplayString(r.entityLinkData.label),1))}}),oc=["data-testid"],ac={key:1},lc=De(n.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=n.inject(Ie),t=Se.useDatasourceConfigStore(),{i18n:i}=he.useI18n(),s=n.computed(()=>rc(r.data)),o=n.computed(()=>nc({data:r.data,columnOptions:r.chartOptions.column_options,i18n:i,fieldTranslationMap:t.fieldTranslationMap})),a=n.computed(()=>o.value.headers.map(R=>({...R,minWidth:R.type==="dimension"?160:R.bar?260:140}))),l=n.computed(()=>o.value.headers.filter(R=>R.type==="dimension")),u=n.computed(()=>({fitToContent:r.fitToContent})),c=n.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),d=(R,w)=>ec({columnOptions:r.chartOptions.column_options,columnKey:R,rawValue:w}),h=n.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return Rr}return Rr}),f=R=>{const w=r.chartOptions.entity_links;return w&&(w[R]||Object.entries(w).find(([U])=>U.toLowerCase()===R.toLowerCase())?.[1])||""},m=R=>f(R)||l.value[0]?.key===R&&r.chartOptions.entity_link||"",C=(R,w)=>R[w]!=="empty"&&R[w]!==Re.OTHER_DIMENSION_ID,b=(R,w)=>{const U=m(w),O=String(R[w]);if(O.includes(":")){const[E,k]=O.split(":");return U.replace(Fi,E).replace(Pt,k)}return U.replace(Pt,O)};return(R,w)=>{const U=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{class:"top-n-data-grid","data-testid":s.value.length?"top-n-table":void 0,style:n.normalizeStyle(c.value)},[n.createVNode(n.unref(_r),{error:!!o.value.errorMessage,headers:a.value,mode:"unpaginated",rows:s.value,"table-config":u.value},n.createSlots({"error-state":n.withCtx(()=>[n.createVNode(U,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:n.withCtx(()=>[n.createVNode(n.unref(oe.WarningOutlineIcon))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(o.value.errorMessage),1)]),_:1})]),"empty-state":n.withCtx(()=>[n.createVNode(U,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:n.unref(i).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":n.withCtx(({column:O,rowValue:E})=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d(O.key,E)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[n.renderList(l.value,O=>({name:O.key,fn:n.withCtx(({row:E})=>[m(O.key)&&C(E,O.key)?(n.openBlock(),n.createBlock(n.unref(h),{key:0,class:"top-n-entity-link","entity-link-data":o.value.getDimension(E,O.key),"external-link":b(E,O.key)},null,8,["entity-link-data","external-link"])):o.value.getDimension(E,O.key).label==="empty"?(n.openBlock(),n.createElementBlock("i",ac,"empty")):n.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,oc)}}}),[["__scopeId","data-v-bbc29e85"]]),cc=n.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:i})=>[n.createVNode(lc,{"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"]))}}),uc=n.defineComponent({__name:"TopTalkersRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["query-complete"],setup(r,{emit:e}){const t=r,i=e,s=n.computed(()=>t.chartOptions.columns.map(c=>({dimension:c.dimension,label:c.label}))),o=c=>({...t.query,dimensions:[c.dimension],filters:[...t.query.filters??[],...c.filters??[]]}),a=n.computed(()=>new Map(s.value.map((c,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===s.value.length&&(l.clear(),i("query-complete"))};return n.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(n.openBlock(),n.createBlock(n.unref(Re.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:s.value,"size-metric":r.chartOptions.size_metric},{column:n.withCtx(({column:h})=>[n.createVNode(Be,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>u(h)},{default:n.withCtx(({data:f})=>[n.createVNode(n.unref(Re.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"]))}}),dc=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,s])=>{if(s===null)return;const o=r.meta.display?.[i]?.[String(s)]?.name;o&&(t[i]=o)}),t}),Cr=({columns:r,fieldLabel:e})=>r.map(t=>({key:t,label:e(t)})),hc={platform:Cr,platform_usage:Cr},Er=async({abortController:r,context:e,cursor:t,pageSize:i,query:s,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const u=s.query,c=a({datasource:s.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:s.datasource,query:{columns:u.columns,cursor:t===void 0?u.cursor:String(t),entity:u.entity,filters:c,page_size:i}},r);return d.meta.columns?.length&&o?.(d.meta.columns),{data:dc(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},fc={platform:Er,platform_usage:Er},mc=De(n.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,s=n.inject(Ie),o=Se.useDatasourceConfigStore(),a=he.useFieldLabel(),l=new AbortController,u=n.ref([]),c=n.ref(!1),d=n.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=n.computed(()=>({datasource:t.query.datasource,query:{columns:t.query.columns,cursor:t.query.cursor,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size}})),f=n.computed(()=>JSON.stringify({refreshCounter:t.refreshCounter,query:{columns:t.query.columns,datasource:t.query.datasource,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size},context:{filters:t.context.filters,timeSpec:t.context.timeSpec,tz:t.context.tz}}));n.onUnmounted(()=>{l.abort()});const m=n.computed(()=>hc[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,fieldLabel:R=>a(R)})),C=n.computed(()=>async({cursor:R,pageSize:w})=>{try{await o.isReady();const U=fc[h.value.datasource];if(!U)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const O=await U({abortController:l,context:t.context,cursor:R,pageSize:w,query:h.value,onResponseColumns:E=>{u.value=E},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:s?.tabularQueryFn});return c.value=!1,O}catch(U){throw c.value=!0,U}}),b=R=>{R.state==="error"&&(c.value=!0),i("loading-change",R.state==="loading")};return(R,w)=>{const U=n.resolveComponent("KSkeleton");return n.openBlock(),n.createElementBlock("div",{class:"table-data-grid-renderer",style:n.normalizeStyle(d.value)},[r.queryReady?(n.openBlock(),n.createBlock(n.unref(_r),{key:1,error:c.value,fetcher:C.value,headers:m.value,"page-size":r.query.page_size,"refresh-key":f.value,onState:b},null,8,["error","fetcher","headers","page-size","refresh-key"])):(n.openBlock(),n.createBlock(U,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c8caabc2"]]),pc=n.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Xt,{"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"]))}}),br="#ffffff",gc="#0044f4",_c="#d60027",yc="#ad000e",Rc="#850000",Cc="#5c0000",Ec="#ff3954",bc="#ffabab",Oc="#ffe5e5",wc="#ecfcff",Tc="#6f28ff",vc="#f1f0ff",Sc="#e0e4ea",xc="#0044f4",Ic="#0030cc",Dc="#002099",kc="#001466",Nc="#5f9aff",Ac="#bee2ff",Lc="#eefaff",Uc="#0d0e14",Mc="#6c7489",Kc="#52596e",Bc="#3a3f51",zc="#232633",Pc="#afb7c5",qc="#e0e4ea",Hc="#f9fafb",Gc="rgba(13, 14, 20, 0.6)",$c="#0044f4",Fc="#0030cc",Wc="#002099",Vc="#001466",Yc="#5f9aff",Xc="#bee2ff",jc="#eefaff",Qc="#007d60",Zc="#005944",Jc="#004737",eu="#003629",tu="#00d6a4",iu="#b5ffee",ru="#ecfffb",nu="rgba(0, 0, 0, 0)",su="#995c00",ou="#804400",au="#662d00",lu="#4d1b00",cu="#ffc400",uu="#fff296",du="#fffce0",Or="#e0e4ea",hu="#0044f4",fu="#d60027",mu="#ad000e",pu="#850000",gu="#5c0000",_u="#ff3954",yu="#ffabab",Ru="#ffe5e5",Cu="#6f28ff",Eu="#e0e4ea",bu="rgba(255, 255, 255, 0.2)",Ou="#6c7489",wu="#52596e",Tu="#3a3f51",vu="#232633",Su="#afb7c5",xu="#e0e4ea",Iu="#f9fafb",Du="#0044f4",ku="#0030cc",Nu="#002099",Au="#001466",Lu="#5f9aff",Uu="#bee2ff",Mu="#eefaff",Ku="rgba(0, 0, 0, 0)",Bu="#0044f4",zu="#0d0e14",Pu="#0044f4",qu="#d60027",Hu="#ad000e",Gu="#850000",$u="#5c0000",Fu="#ff3954",Wu="#ffabab",Vu="#ffe5e5",Yu="#00abd2",Xu="#d60067",ju="#6f28ff",Qu="#5e00f5",Zu="#afb7c5",Ju="#0044f4",ed="#0030cc",td="#002099",id="#001466",rd="#5f9aff",nd="#bee2ff",sd="#eefaff",od="#ffffff",ad="#6c7489",ld="#52596e",cd="#3a3f51",ud="#232633",dd="#afb7c5",hd="#e0e4ea",fd="#f9fafb",md="#0044f4",pd="#0030cc",gd="#002099",_d="#001466",yd="#5f9aff",Rd="#bee2ff",Cd="#eefaff",Ed="#007d60",bd="#005944",Od="#004737",wd="#003629",Td="#00d6a4",vd="#b5ffee",Sd="#ecfffb",xd="#995c00",Id="#804400",Dd="#662d00",kd="#4d1b00",Nd="#ffc400",Ad="#fff296",Ld="#fffce0",Ud="0.2s",Md="0px",Kd="2px",Bd="4px",wr="6px",zd="8px",Pd="10px",qd="12px",Hd="16px",Gd="20px",$d="24px",Fd="32px",Wd="50%",Vd="100px",Yd="0px",Tr="1px",Xd="2px",jd="4px",Qd="640px",Zd="768px",Jd="1024px",eh="1280px",th="1536px",ih="'JetBrains Mono', Consolas, monospace",rh="'Inter', Roboto, Helvetica, sans-serif",Zt="'Inter', Roboto, Helvetica, sans-serif",nh="10px",sh="12px",oh="14px",ah="16px",lh="18px",ch="20px",uh="24px",dh="32px",hh="40px",fh="48px",mh="700",ph="500",gh="400",_h="600",yh="#f50045",Rh="#828a9e",Ch="#306fff",Eh="#00a17b",bh="#ffc400",Oh="10px",wh="12px",Th="16px",vh="20px",Sh="24px",xh="32px",Ih="40px",Dh="48px",kh="normal",Nh="-0.12px",Ah="-0.24px",Lh="-0.32px",Uh="-0.4px",Mh="-0.48px",Kh="normal",Bh="12px",zh="16px",Ph="20px",qh="24px",Hh="28px",Gh="32px",$h="36px",Fh="40px",Wh="48px",Vh="56px",Yh="#f1f0ff",Xh="#ffe5e5",jh="#eefaff",Qh="#52596e",Zh="#e0e4ea",Jh="#ecfcff",ef="#ecfffb",tf="#fffce0",rf="#fff0f7",nf="#6f28ff",sf="#5e00f5",of="#d60027",af="#ad000e",lf="#0044f4",cf="#0030cc",uf="#e0e4ea",df="#afb7c5",hf="#52596e",ff="#3a3f51",mf="#00819d",pf="#00647a",gf="#007d60",_f="#005944",yf="#995c00",Rf="#804400",Cf="#d60067",Ef="#ad0053",bf="#000933",Of="rgba(255, 255, 255, 0.12)",wf="rgba(255, 255, 255, 0.12)",Tf="#00fabe",vf="rgba(255, 255, 255, 0.24)",Sf="#bee2ff",xf="#ffffff",If="#eefaff",Df="#00fabe",kf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",Nf="4px 0 0 0 #00fabe inset",Af="0 0 0 1px rgba(255, 255, 255, 0.60) inset",vr="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",Lf="0px 0px 0px 1px #e0e4ea inset",Uf="0px 0px 0px 1px #d60027 inset",Mf="0px 0px 0px 1px #ad000e inset",Kf="0px 0px 0px 1px #e0e4ea inset",Bf="0px 0px 0px 1px #0044f4 inset",zf="0px 0px 0px 1px #001466 inset",Pf="0px 0px 0px 1px #5f9aff inset",qf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Hf="0px",Gf="2px",$f="4px",Ff="6px",Wf="8px",Vf="12px",Yf="16px",Xf="20px",jf="24px",Qf="32px",Zf="40px",Jf="48px",em="56px",tm="64px",im="80px",rm="96px",nm="auto",sm="#bee2ff",om="#8fc1ff",am="#5f9aff",lm="#306fff",cm="#b5ffee",um="#00fabe",dm="#00d6a4",hm="#00a17b",fm="#007d60",mm="#005944",pm="#b5ffee",gm="#00fabe",_m="#b5ffee",ym="#00a17b",Rm="#fff296",Cm="#ffe04b",Em="#ffc400",bm="#b37600",Om="#995c00",wm="#804400",Tm="#fff296",vm="#ffe04b",Sm="#ffc2b3",xm="#ff9877",Im="#ff723c",Dm="#f75008",km="#d13500",Nm="#a31f00",Am="#ffc2b3",Lm="#ff9877",Um="#ff723c",Mm="#f75008",Km="#d13500",Bm="#a31f00",zm="#ffc2b3",Pm="#ff9877",qm="#ff723c",Hm="#f75008",Gm="#d13500",$m="#a31f00",Fm="#ffc2b3",Wm="#ff9877",Vm="#ff723c",Ym="#f75008",Xm="#d13500",jm="#a31f00",Qm="#ffc2b3",Zm="#ff9877",Jm="#ff723c",ep="#f75008",tp="#d13500",ip="#ffabab",rp="#ff7272",np="#ff3954",sp="#f50045",op="#d60027",ap="#ad000e",lp="#ffabab",cp="#ff7272",up="#ff3954",dp="#f50045",hp="#d60027",fp="#eefaff",mp="#ecfffb",pp="#fffce0",gp="#fff1ef",_p="#ffe5e5",yp="#5f9aff",Rp="#00d6a4",Cp="#ffc400",Ep="#ff723c",bp="#ff3954",Op="#eefaff",wp="#ecfffb",Tp="#fffce0",vp="#fff1ef",Sp="#ffe5e5",xp="#0044f4",Ip="#007d60",Dp="#995c00",kp="#d13500",Np="#d60027",Sr=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Ud,KUI_BORDER_RADIUS_0:Md,KUI_BORDER_RADIUS_10:Kd,KUI_BORDER_RADIUS_100:Fd,KUI_BORDER_RADIUS_20:Bd,KUI_BORDER_RADIUS_30:wr,KUI_BORDER_RADIUS_40:zd,KUI_BORDER_RADIUS_50:Pd,KUI_BORDER_RADIUS_60:qd,KUI_BORDER_RADIUS_70:Hd,KUI_BORDER_RADIUS_80:Gd,KUI_BORDER_RADIUS_90:$d,KUI_BORDER_RADIUS_CIRCLE:Wd,KUI_BORDER_RADIUS_ROUND:Vd,KUI_BORDER_WIDTH_0:Yd,KUI_BORDER_WIDTH_10:Tr,KUI_BORDER_WIDTH_20:Xd,KUI_BORDER_WIDTH_30:jd,KUI_BREAKPOINT_DESKTOP:th,KUI_BREAKPOINT_LAPTOP:eh,KUI_BREAKPOINT_MOBILE:Qd,KUI_BREAKPOINT_PHABLET:Zd,KUI_BREAKPOINT_TABLET:Jd,KUI_COLOR_BACKGROUND:br,KUI_COLOR_BACKGROUND_ACCENT:gc,KUI_COLOR_BACKGROUND_DANGER:_c,KUI_COLOR_BACKGROUND_DANGER_STRONG:yc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:Rc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:Cc,KUI_COLOR_BACKGROUND_DANGER_WEAK:Ec,KUI_COLOR_BACKGROUND_DANGER_WEAKER:bc,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:Oc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:wc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:Tc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:vc,KUI_COLOR_BACKGROUND_DISABLED:Sc,KUI_COLOR_BACKGROUND_INFO:xc,KUI_COLOR_BACKGROUND_INFO_STRONG:Ic,KUI_COLOR_BACKGROUND_INFO_STRONGER:Dc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:kc,KUI_COLOR_BACKGROUND_INFO_WEAK:Nc,KUI_COLOR_BACKGROUND_INFO_WEAKER:Ac,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Lc,KUI_COLOR_BACKGROUND_INVERSE:Uc,KUI_COLOR_BACKGROUND_NEUTRAL:Mc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Kc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:Bc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:zc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Pc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:qc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Hc,KUI_COLOR_BACKGROUND_OVERLAY:Gc,KUI_COLOR_BACKGROUND_PRIMARY:$c,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Fc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:Wc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Vc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Yc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Xc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:jc,KUI_COLOR_BACKGROUND_SUCCESS:Qc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Zc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Jc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:eu,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:tu,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:iu,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:ru,KUI_COLOR_BACKGROUND_TRANSPARENT:nu,KUI_COLOR_BACKGROUND_WARNING:su,KUI_COLOR_BACKGROUND_WARNING_STRONG:ou,KUI_COLOR_BACKGROUND_WARNING_STRONGER:au,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:lu,KUI_COLOR_BACKGROUND_WARNING_WEAK:cu,KUI_COLOR_BACKGROUND_WARNING_WEAKER:uu,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:du,KUI_COLOR_BORDER:Or,KUI_COLOR_BORDER_ACCENT:hu,KUI_COLOR_BORDER_DANGER:fu,KUI_COLOR_BORDER_DANGER_STRONG:mu,KUI_COLOR_BORDER_DANGER_STRONGER:pu,KUI_COLOR_BORDER_DANGER_STRONGEST:gu,KUI_COLOR_BORDER_DANGER_WEAK:_u,KUI_COLOR_BORDER_DANGER_WEAKER:yu,KUI_COLOR_BORDER_DANGER_WEAKEST:Ru,KUI_COLOR_BORDER_DECORATIVE_PURPLE:Cu,KUI_COLOR_BORDER_DISABLED:Eu,KUI_COLOR_BORDER_INVERSE:bu,KUI_COLOR_BORDER_NEUTRAL:Ou,KUI_COLOR_BORDER_NEUTRAL_STRONG:wu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:Tu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:vu,KUI_COLOR_BORDER_NEUTRAL_WEAK:Su,KUI_COLOR_BORDER_NEUTRAL_WEAKER:xu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:Iu,KUI_COLOR_BORDER_PRIMARY:Du,KUI_COLOR_BORDER_PRIMARY_STRONG:ku,KUI_COLOR_BORDER_PRIMARY_STRONGER:Nu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Au,KUI_COLOR_BORDER_PRIMARY_WEAK:Lu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Uu,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Mu,KUI_COLOR_BORDER_TRANSPARENT:Ku,KUI_COLOR_BRAND:Bu,KUI_COLOR_TEXT:zu,KUI_COLOR_TEXT_ACCENT:Pu,KUI_COLOR_TEXT_DANGER:qu,KUI_COLOR_TEXT_DANGER_STRONG:Hu,KUI_COLOR_TEXT_DANGER_STRONGER:Gu,KUI_COLOR_TEXT_DANGER_STRONGEST:$u,KUI_COLOR_TEXT_DANGER_WEAK:Fu,KUI_COLOR_TEXT_DANGER_WEAKER:Wu,KUI_COLOR_TEXT_DANGER_WEAKEST:Vu,KUI_COLOR_TEXT_DECORATIVE_AQUA:Yu,KUI_COLOR_TEXT_DECORATIVE_PINK:Xu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:ju,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Qu,KUI_COLOR_TEXT_DISABLED:Zu,KUI_COLOR_TEXT_INFO:Ju,KUI_COLOR_TEXT_INFO_STRONG:ed,KUI_COLOR_TEXT_INFO_STRONGER:td,KUI_COLOR_TEXT_INFO_STRONGEST:id,KUI_COLOR_TEXT_INFO_WEAK:rd,KUI_COLOR_TEXT_INFO_WEAKER:nd,KUI_COLOR_TEXT_INFO_WEAKEST:sd,KUI_COLOR_TEXT_INVERSE:od,KUI_COLOR_TEXT_NEUTRAL:ad,KUI_COLOR_TEXT_NEUTRAL_STRONG:ld,KUI_COLOR_TEXT_NEUTRAL_STRONGER:cd,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:ud,KUI_COLOR_TEXT_NEUTRAL_WEAK:dd,KUI_COLOR_TEXT_NEUTRAL_WEAKER:hd,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:fd,KUI_COLOR_TEXT_PRIMARY:md,KUI_COLOR_TEXT_PRIMARY_STRONG:pd,KUI_COLOR_TEXT_PRIMARY_STRONGER:gd,KUI_COLOR_TEXT_PRIMARY_STRONGEST:_d,KUI_COLOR_TEXT_PRIMARY_WEAK:yd,KUI_COLOR_TEXT_PRIMARY_WEAKER:Rd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:Cd,KUI_COLOR_TEXT_SUCCESS:Ed,KUI_COLOR_TEXT_SUCCESS_STRONG:bd,KUI_COLOR_TEXT_SUCCESS_STRONGER:Od,KUI_COLOR_TEXT_SUCCESS_STRONGEST:wd,KUI_COLOR_TEXT_SUCCESS_WEAK:Td,KUI_COLOR_TEXT_SUCCESS_WEAKER:vd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:Sd,KUI_COLOR_TEXT_WARNING:xd,KUI_COLOR_TEXT_WARNING_STRONG:Id,KUI_COLOR_TEXT_WARNING_STRONGER:Dd,KUI_COLOR_TEXT_WARNING_STRONGEST:kd,KUI_COLOR_TEXT_WARNING_WEAK:Nd,KUI_COLOR_TEXT_WARNING_WEAKER:Ad,KUI_COLOR_TEXT_WARNING_WEAKEST:Ld,KUI_FONT_FAMILY_CODE:ih,KUI_FONT_FAMILY_HEADING:rh,KUI_FONT_FAMILY_TEXT:Zt,KUI_FONT_SIZE_10:nh,KUI_FONT_SIZE_100:fh,KUI_FONT_SIZE_20:sh,KUI_FONT_SIZE_30:oh,KUI_FONT_SIZE_40:ah,KUI_FONT_SIZE_50:lh,KUI_FONT_SIZE_60:ch,KUI_FONT_SIZE_70:uh,KUI_FONT_SIZE_80:dh,KUI_FONT_SIZE_90:hh,KUI_FONT_WEIGHT_BOLD:mh,KUI_FONT_WEIGHT_MEDIUM:ph,KUI_FONT_WEIGHT_REGULAR:gh,KUI_FONT_WEIGHT_SEMIBOLD:_h,KUI_ICON_COLOR_DANGER:yh,KUI_ICON_COLOR_NEUTRAL:Rh,KUI_ICON_COLOR_PRIMARY:Ch,KUI_ICON_COLOR_SUCCESS:Eh,KUI_ICON_COLOR_WARNING:bh,KUI_ICON_SIZE_10:Oh,KUI_ICON_SIZE_20:wh,KUI_ICON_SIZE_30:Th,KUI_ICON_SIZE_40:vh,KUI_ICON_SIZE_50:Sh,KUI_ICON_SIZE_60:xh,KUI_ICON_SIZE_70:Ih,KUI_ICON_SIZE_80:Dh,KUI_LETTER_SPACING_0:kh,KUI_LETTER_SPACING_MINUS_10:Nh,KUI_LETTER_SPACING_MINUS_20:Ah,KUI_LETTER_SPACING_MINUS_30:Lh,KUI_LETTER_SPACING_MINUS_40:Uh,KUI_LETTER_SPACING_MINUS_50:Mh,KUI_LETTER_SPACING_NORMAL:Kh,KUI_LINE_HEIGHT_10:Bh,KUI_LINE_HEIGHT_100:Vh,KUI_LINE_HEIGHT_20:zh,KUI_LINE_HEIGHT_30:Ph,KUI_LINE_HEIGHT_40:qh,KUI_LINE_HEIGHT_50:Hh,KUI_LINE_HEIGHT_60:Gh,KUI_LINE_HEIGHT_70:$h,KUI_LINE_HEIGHT_80:Fh,KUI_LINE_HEIGHT_90:Wh,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Yh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Xh,KUI_METHOD_COLOR_BACKGROUND_GET:jh,KUI_METHOD_COLOR_BACKGROUND_HEAD:Qh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Zh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Jh,KUI_METHOD_COLOR_BACKGROUND_POST:ef,KUI_METHOD_COLOR_BACKGROUND_PUT:tf,KUI_METHOD_COLOR_BACKGROUND_TRACE:rf,KUI_METHOD_COLOR_TEXT_CONNECT:nf,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:sf,KUI_METHOD_COLOR_TEXT_DELETE:of,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:af,KUI_METHOD_COLOR_TEXT_GET:lf,KUI_METHOD_COLOR_TEXT_GET_STRONG:cf,KUI_METHOD_COLOR_TEXT_HEAD:uf,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:df,KUI_METHOD_COLOR_TEXT_OPTIONS:hf,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:ff,KUI_METHOD_COLOR_TEXT_PATCH:mf,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:pf,KUI_METHOD_COLOR_TEXT_POST:gf,KUI_METHOD_COLOR_TEXT_POST_STRONG:_f,KUI_METHOD_COLOR_TEXT_PUT:yf,KUI_METHOD_COLOR_TEXT_PUT_STRONG:Rf,KUI_METHOD_COLOR_TEXT_TRACE:Cf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:Ef,KUI_NAVIGATION_COLOR_BACKGROUND:bf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:Of,KUI_NAVIGATION_COLOR_BORDER:wf,KUI_NAVIGATION_COLOR_BORDER_CHILD:Tf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:vf,KUI_NAVIGATION_COLOR_TEXT:Sf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:xf,KUI_NAVIGATION_COLOR_TEXT_HOVER:If,KUI_NAVIGATION_COLOR_TEXT_SELECTED:Df,KUI_NAVIGATION_SHADOW_BORDER:kf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:Nf,KUI_NAVIGATION_SHADOW_FOCUS:Af,KUI_SHADOW:vr,KUI_SHADOW_BORDER:Lf,KUI_SHADOW_BORDER_DANGER:Uf,KUI_SHADOW_BORDER_DANGER_STRONG:Mf,KUI_SHADOW_BORDER_DISABLED:Kf,KUI_SHADOW_BORDER_PRIMARY:Bf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:zf,KUI_SHADOW_BORDER_PRIMARY_WEAK:Pf,KUI_SHADOW_FOCUS:qf,KUI_SPACE_0:Hf,KUI_SPACE_10:Gf,KUI_SPACE_100:Zf,KUI_SPACE_110:Jf,KUI_SPACE_120:em,KUI_SPACE_130:tm,KUI_SPACE_140:im,KUI_SPACE_150:rm,KUI_SPACE_20:$f,KUI_SPACE_30:Ff,KUI_SPACE_40:Wf,KUI_SPACE_50:Vf,KUI_SPACE_60:Yf,KUI_SPACE_70:Xf,KUI_SPACE_80:jf,KUI_SPACE_90:Qf,KUI_SPACE_AUTO:nm,KUI_STATUS_COLOR_100:sm,KUI_STATUS_COLOR_100S:yp,KUI_STATUS_COLOR_101:om,KUI_STATUS_COLOR_102:am,KUI_STATUS_COLOR_103:lm,KUI_STATUS_COLOR_1NA:fp,KUI_STATUS_COLOR_200:cm,KUI_STATUS_COLOR_200S:Rp,KUI_STATUS_COLOR_201:um,KUI_STATUS_COLOR_202:dm,KUI_STATUS_COLOR_203:hm,KUI_STATUS_COLOR_204:fm,KUI_STATUS_COLOR_205:mm,KUI_STATUS_COLOR_206:pm,KUI_STATUS_COLOR_207:gm,KUI_STATUS_COLOR_208:_m,KUI_STATUS_COLOR_226:ym,KUI_STATUS_COLOR_2NA:mp,KUI_STATUS_COLOR_300:Rm,KUI_STATUS_COLOR_300S:Cp,KUI_STATUS_COLOR_301:Cm,KUI_STATUS_COLOR_302:Em,KUI_STATUS_COLOR_303:bm,KUI_STATUS_COLOR_304:Om,KUI_STATUS_COLOR_305:wm,KUI_STATUS_COLOR_307:Tm,KUI_STATUS_COLOR_308:vm,KUI_STATUS_COLOR_3NA:pp,KUI_STATUS_COLOR_400:Sm,KUI_STATUS_COLOR_400S:Ep,KUI_STATUS_COLOR_401:xm,KUI_STATUS_COLOR_402:Im,KUI_STATUS_COLOR_403:Dm,KUI_STATUS_COLOR_404:km,KUI_STATUS_COLOR_405:Nm,KUI_STATUS_COLOR_406:Am,KUI_STATUS_COLOR_407:Lm,KUI_STATUS_COLOR_408:Um,KUI_STATUS_COLOR_409:Mm,KUI_STATUS_COLOR_410:Km,KUI_STATUS_COLOR_411:Bm,KUI_STATUS_COLOR_412:zm,KUI_STATUS_COLOR_413:Pm,KUI_STATUS_COLOR_414:qm,KUI_STATUS_COLOR_415:Hm,KUI_STATUS_COLOR_416:Gm,KUI_STATUS_COLOR_417:$m,KUI_STATUS_COLOR_418:Fm,KUI_STATUS_COLOR_421:Wm,KUI_STATUS_COLOR_422:Vm,KUI_STATUS_COLOR_423:Ym,KUI_STATUS_COLOR_424:Xm,KUI_STATUS_COLOR_425:jm,KUI_STATUS_COLOR_426:Qm,KUI_STATUS_COLOR_428:Zm,KUI_STATUS_COLOR_429:Jm,KUI_STATUS_COLOR_431:ep,KUI_STATUS_COLOR_451:tp,KUI_STATUS_COLOR_4NA:gp,KUI_STATUS_COLOR_500:ip,KUI_STATUS_COLOR_500S:bp,KUI_STATUS_COLOR_501:rp,KUI_STATUS_COLOR_502:np,KUI_STATUS_COLOR_503:sp,KUI_STATUS_COLOR_504:op,KUI_STATUS_COLOR_505:ap,KUI_STATUS_COLOR_506:lp,KUI_STATUS_COLOR_507:cp,KUI_STATUS_COLOR_508:up,KUI_STATUS_COLOR_510:dp,KUI_STATUS_COLOR_511:hp,KUI_STATUS_COLOR_5NA:_p,KUI_STATUS_COLOR_BACKGROUND_100:Op,KUI_STATUS_COLOR_BACKGROUND_200:wp,KUI_STATUS_COLOR_BACKGROUND_300:Tp,KUI_STATUS_COLOR_BACKGROUND_400:vp,KUI_STATUS_COLOR_BACKGROUND_500:Sp,KUI_STATUS_COLOR_TEXT_100:xp,KUI_STATUS_COLOR_TEXT_200:Ip,KUI_STATUS_COLOR_TEXT_300:Dp,KUI_STATUS_COLOR_TEXT_400:kp,KUI_STATUS_COLOR_TEXT_500:Np},Symbol.toStringTag,{value:"Module"})),xr=Object.keys(Sr).filter(r=>r.startsWith("KUI_COLOR")),Ir=r=>Sr[r],Ap=r=>`--${r.toLowerCase().replaceAll("_","-")}`,Dr=()=>{if(typeof window>"u")return Object.fromEntries(xr.map(t=>[t,Ir(t)]));const r=window.getComputedStyle(document.documentElement),e=(t,i)=>r.getPropertyValue(t).trim()||i;return Object.fromEntries(xr.map(t=>[t,e(Ap(t),Ir(t))]))},Jt=r=>{const e=n.ref(Dr());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=Dr()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),n.getCurrentScope()&&n.onScopeDispose(()=>t.disconnect())}return e},Lp=()=>typeof window>"u"?Zt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Zt,Up=[`background-color: var(--kui-pop-color-background, var(--kui-color-background, ${br}));`,`border: var(--kui-pop-border-width, var(--kui-border-width-10, ${Tr})) solid var(--kui-pop-color-border, var(--kui-color-border, ${Or}));`,`border-radius: var(--kui-pop-border-radius, var(--kui-border-radius-30, ${wr}));`,`box-shadow: var(--kui-pop-shadow, var(--kui-shadow, ${vr}));`].join(" "),Mp=r=>{const e=Lp(),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,padding:0,confine:!0,extraCssText:Up,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}}}},Kp=r=>n.computed(()=>Mp(r.value)),Bp={class:"kong-ui-public-echarts-tooltip"},zp={class:"tooltip-title"},Pp={class:"title"},qp={key:0,class:"subtitle"},Hp={class:"context"},Gp={class:"metric"},$p={class:"tooltip-rows"},Fp={class:"display-value"},Wp=n.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Bp,[n.createElementVNode("div",zp,[n.createElementVNode("div",Pp,n.toDisplayString(r.title),1),r.context||r.metric?(n.openBlock(),n.createElementBlock("div",qp,[n.createElementVNode("div",Hp,n.toDisplayString(r.context),1),n.createElementVNode("div",Gp,n.toDisplayString(r.metric),1)])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",$p,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.rows,(i,s)=>(n.openBlock(),n.createElementBlock("li",{key:`${i.label}-${s}`,class:n.normalizeClass({"extra-row":i.isExtra})},[n.createElementVNode("span",{class:"square-marker",style:n.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),n.createElementVNode("span",{class:n.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},n.toDisplayString(i.label),3),n.createElementVNode("span",Fp,n.toDisplayString(i.value),1)],2))),128))])]))}}),kr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},Vp=kr(Wp,[["__scopeId","data-v-ca633353"]]),ei=r=>Array.isArray(r)?r:[r],Nr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,ti=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Yp=r=>Array.isArray(r)?r[r.length-1]:r,Xp=r=>{const e=ei(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>ti(i,i.seriesName??"",Yp(i.value)))}},jp=r=>{let e;return n.getCurrentScope()&&n.onScopeDispose(()=>{e&&n.render(null,e)}),t=>{const i=(r()??Xp)(t);return i?(e??=document.createElement("div"),n.render(n.h(Vp,i),e),e):""}},Qp={class:"kong-ui-public-echarts"},Zp=n.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){n.useCssVars(o=>({v1cecfeed:o.height})),St.use([Yr.CanvasRenderer,ut.GridComponent,ut.TooltipComponent]);const e=Jt(),t=Kp(e),i=jp(()=>r.tooltipContent),s=n.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(n.openBlock(),n.createElementBlock("div",Qp,[n.createVNode(n.unref(Vr),n.mergeProps({autoresize:!0,class:"chart",option:s.value,theme:n.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Ar=kr(Zp,[["__scopeId","data-v-68114d20"]]),Lr=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),st=(r,...e)=>{const t={...r};for(const i of e)if(i)for(const[s,o]of Object.entries(i)){if(o===void 0)continue;const a=t[s];t[s]=Lr(a)&&Lr(o)?st(a,o):o}return t},Jp=n.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){St.use([ci.HeatmapChart,ut.VisualMapComponent,ut.DataZoomSliderComponent]);const e=Jt(),t=a=>{const[l]=ei(a),[u,c,d]=l.value;return{title:r.tooltipTitle,context:Nr(u,r.xAxisLabels),metric:r.seriesName,rows:[ti(l,Nr(c,r.yAxisLabels),d,r.valueFormatter)]}},i=a=>({type:"slider",yAxisIndex:0,startValue:0,endValue:a-1,zoomLock:!0,right:10,width:8,handleSize:0,moveHandleSize:0,showDetail:!1,brushSelect:!1,showDataShadow:!1,borderColor:"transparent",backgroundColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST,fillerColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK}),s=n.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),u=r.valueFormatter?c=>r.valueFormatter(Number(c)):void 0;return{grid:{top:10,left:10,right:l?30:20,bottom:70,outerBoundsMode:"same",outerBoundsContain:"axisLabel"},xAxis:{type:"category",data:r.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:r.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:r.min??0,max:r.max??a.reduce((c,[,,d])=>Math.max(c,d),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:r.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:u},...l?{dataZoom:[i(r.visibleRows)]}:{},series:[st({name:r.seriesName,type:"heatmap",data:a,animation:!1,label:{show:r.showValues??!1,formatter:r.valueFormatter?({value:c})=>r.valueFormatter(Number(c[2])):void 0},itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{shadowBlur:5,shadowColor:e.value.KUI_COLOR_BACKGROUND_OVERLAY}}},r.seriesOption)]}}),o=n.computed(()=>st(s.value,r.option));return(a,l)=>(n.openBlock(),n.createBlock(Ar,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),eg=n.defineComponent({__name:"TreeMapChart",props:{data:{},seriesName:{},showValues:{type:Boolean},valueFormatter:{type:Function},colorPalette:{},drillDown:{type:Boolean,default:!0},leafDepth:{},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){St.use([ci.TreemapChart]);const e=Jt(),t=l=>{const[u]=ei(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:[ti(u,u.name,Number(u.value),r.valueFormatter)]}},i=()=>[e.value.KUI_COLOR_BACKGROUND_PRIMARY_WEAK,e.value.KUI_COLOR_BACKGROUND_SUCCESS_WEAK,e.value.KUI_COLOR_BACKGROUND_WARNING_WEAK,e.value.KUI_COLOR_BACKGROUND_DANGER_WEAK,e.value.KUI_COLOR_BACKGROUND_INFO_WEAK,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST],s=(l=[])=>l.reduce((u,c)=>Math.max(u,1+s(c.children)),0),o=n.computed(()=>({series:[st({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??s(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=n.computed(()=>st(o.value,r.option));return(l,u)=>(n.openBlock(),n.createBlock(Ar,{height:r.height,option:a.value,"tooltip-content":t},null,8,["height","option"]))}}),Ur=r=>{if(r==null||typeof r=="string"&&r.trim()==="")return;const e=Number(r);return Number.isFinite(e)?e:void 0},tg=(r,e,t)=>{if(!t.length)return r;const i=t.reduce((o,a)=>Math.min(o,a));if(i<=r)return i;const s=Math.ceil((i-r)/e);return i-s*e},ig=(r,e,t)=>{const i=[];for(let s=r;s<e;s+=t)i.push(s);return i},rg=(r,e,t)=>{const i=o=>ca(o,t,"yyyy-MM-dd"),s=r.length>0&&i(r[0])!==i(r[r.length-1]);return r.map(o=>Re.formatChartTicksByGranularity({tickValue:new Date(o),granularity:e,dayBoundaryCrossed:s,timezone:t}))},ng=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},sg=(r,e)=>r[e]?.name??e,og=(r,{tz:e}={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i,start:s,end:o,granularity_ms:a}=r.meta,l=i?.[0],u=t&&Object.keys(t).find(w=>w!=="time");if(!l||!u||!s||!o){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const c=a||ne.Granularities.daily,d=ne.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=r.data,m=tg(new Date(s).getTime(),c,f.map(({timestamp:w})=>new Date(w).getTime())),C=ig(m,new Date(o).getTime(),c),b=[],R=[];for(const{timestamp:w,event:U}of f){const O=Math.floor((new Date(w).getTime()-m)/c),E=Ur(U[l]);O<0||O>=C.length||E===void 0||R.push([O,ng(b,String(U[u])),E])}return{data:R,xAxisLabels:rg(C,d,h),yAxisLabels:b.map(w=>sg(t[u],w))}},ag={class:"wrapper","data-testid":"heatmap-chart"},lg=10,cg=De(n.defineComponent({__name:"HeatmapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),o=he.useMetricFormatter(),a=c=>{const d=og(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=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Be,{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:n.withCtx(({data:f})=>[n.createElementVNode("div",ag,[u(f)?(n.openBlock(),n.createBlock(n.unref(Jp),n.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":lg},u(f)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(h,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-3315f2cd"]]),Mr=(r,e,{otherLabel:t})=>({name:e===Re.OTHER_DIMENSION_ID&&t||(r?.[e]?.name??e)}),ug=(r,e,t,i)=>({...Mr(e,t,i),itemStyle:{color:Ts({dimension:r,dimensionValue:t})}}),Kr=(r,e,t)=>{const i=r.get(e)??t();return r.set(e,i),i},ii=(r,e)=>!e.includes("time")&&(!r||ne.isMetricSupported("treemap",r)),Br=(r,e)=>{r.value=Number(r.value??0)+e},dg=(r,e,t,[i,s],o)=>{const a=new Map,l=(u,c)=>String(u[c]);for(const{event:u}of r){const c=Ur(u[e]);if(c===void 0)continue;const d=l(u,i),h=Kr(a,d,()=>({node:ug(i,t[i],d,o),children:new Map}));if(!s){Br(h.node,c);continue}const f=l(u,s),m=Kr(h.children,f,()=>Mr(t[s],f,o));Br(m,c)}return a},hg=(r,e={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i}=r.meta,s=i?.[0],o=t?Object.keys(t):[];if(!s||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!ii(s,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...dg(r.data,s,t,o,e).values()].map(({node:l,children:u})=>u.size?{...l,children:[...u.values()]}:l)},fg={class:"wrapper","data-testid":"treemap-chart"},mg=De(n.defineComponent({__name:"TreemapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:s}=he.useI18n(),o=he.useMetricFormatter(),a=n.computed(()=>ii(t.query.metrics?.[0],t.query.dimensions??[])),l=d=>{const h=hg(d,{otherLabel:s.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(d)}},u=new WeakMap,c=d=>(u.has(d)||u.set(d,l(d)),u.get(d));return(d,h)=>{const f=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:h[0]||(h[0]=m=>i("chart-data",m)),onQueryComplete:h[1]||(h[1]=m=>i("query-complete"))},{default:n.withCtx(({data:m})=>[n.createElementVNode("div",fg,[a.value?c(m)?(n.openBlock(),n.createBlock(n.unref(eg),n.mergeProps({key:1,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0},c(m)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.description")),1)]),_:1})):(n.openBlock(),n.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),pg=["data-testid"],gg={key:0,class:"group-tabs"},_g={key:1,class:"tile-header"},yg={class:"badge-container"},Rg={class:"badge-text"},Cg={class:"badge-text"},Eg={key:0,class:"metric-selector-wrapper"},bg={key:1},Og=["data-testid"],wg=["data-testid"],Tg=["data-testid"],vg={class:"delete-option"},Sg=["data-testid"],zr=De(n.defineComponent({__name:"DashboardTile",props:n.mergeModels({context:{},definition:{},fitToContent:{type:Boolean,default:!1},groupTiles:{},height:{default:()=>it},hideActions:{type:Boolean,default:!1},isFullscreen:{type:Boolean},preview:{type:Boolean,default:!1},queryReady:{type:Boolean},showRefresh:{type:Boolean,default:!1},tileId:{},tileType:{default:"chart"}},{refreshCounter:{default:0},refreshCounterModifiers:{}}),emits:n.mergeModels(["chart-data","tile-loaded","edit-tile","duplicate-tile","remove-tile","tile-time-range-zoom","tile-bounds-change"],["update:refreshCounter"]),setup(r,{expose:e,emit:t}){n.useCssVars(H=>({v7f33ad9a:`${H.height}px`}));const i=parseInt(qi,10),s=n.ref(!1),o=n.ref(),a=n.computed(()=>r.groupTiles?.find(H=>H.id===o.value)?.id??r.groupTiles?.[0]?.id),l=n.computed(()=>a.value??r.tileId.toString()),u=n.computed(()=>r.groupTiles?.find(H=>H.id===o.value)?.definition??r.groupTiles?.[0]?.definition??r.definition),c=he.useFieldLabel(),{zoomConfiguration:d}=he.useDashboardContext({context:n.computed(()=>r.context),preview:n.computed(()=>r.preview)}),h=n.useModel(r,"refreshCounter"),f=()=>{p.value=!0,h.value++},m=t,C=n.defineAsyncComponent(()=>Promise.resolve().then(()=>Qg)),b=n.inject(Ie),R=Se.useDatasourceConfigStore(),{datasourceConfigMap:w,stripUnknownFilters:U}=Xe(R),{i18n:O}=he.useI18n(),E=n.ref(),k=n.ref({status:"loading"}),I=n.ref(!1),B=n.ref(),g=n.ref(!1),p=n.ref(!0),_=n.computed(()=>u.value.chart),M=n.computed(()=>_.value.type==="single_value"),D=n.computed(()=>("chart_title"in _.value?_.value.chart_title:void 0)||(M.value?me.value:void 0)),F=n.computed(()=>u.value.header_description),v=n.computed(()=>_.value.type==="slottable"),P=n.computed(()=>Ne(u.value)||_t(u.value)?!1:!("allow_csv_export"in _.value)||_.value.allow_csv_export!==!1),{exploreLinkKebabMenu:V,requestsLinkKebabMenu:W,canShowKebabMenu:T,canGenerateRequestsLink:x,canGenerateExploreLink:q,requestsLinkZoomActions:L,exploreLinkZoomActions:G,buildExploreQuery:N,buildExploreLink:ce,buildRequestLink:ae,buildRequestsQueryZoomActions:ue}=he.useContextLinks({queryBridge:b,chartData:n.readonly(E),definition:u,context:n.readonly(n.toRef(()=>r.context))}),{issueQuery:Q}=he.useIssueQuery();n.watch(u,async(H,re)=>{await n.nextTick(),B.value&&(g.value=B.value.scrollWidth>B.value.clientWidth);try{JSON.stringify(H?.query)!==JSON.stringify(re?.query)&&(p.value=!0)}catch{}},{immediate:!0,deep:!0});const J=n.computed(()=>O.t("csvExport.defaultFilename")),S=n.computed(()=>!!V.value||P.value||!!r.context.editable),K=n.computed(()=>!r.hideActions&&T.value&&S.value),z=n.computed(()=>K.value&&S.value&&!r.isFullscreen),Y={heatmap:cg,treemap:mg,timeseries_line:dr,timeseries_bar:dr,scatter:_l,horizontal_bar:ur,vertical_bar:ur,gauge:cr,donut:pc,golden_signals:yl,top_n:cc,top_talkers:uc,table:mc,slottable:void 0,single_value:cr,choropleth_map:C},te=n.computed(()=>({...A.value?.rendererEvents.supportsRequests?{"select-chart-range":n_}:{},...A.value?.rendererEvents.supportsZoom?{"zoom-time-range":i_}:{},...A.value?.rendererEvents.supportsBounds?{"bounds-change":r_}:{},...A.value?.rendererEvents.supportsLoadingChange?{"loading-change":Jg}:{}})),A=n.computed(()=>{const H=Y[u.value.chart.type],re=Ne(u.value),ge=!!H?.emits?.includes("select-chart-range"),Ge=!!H?.emits?.includes("zoom-time-range"),Ue=u.value.chart.type==="choropleth_map",$e=!!H?.emits?.includes("loading-change"),si={query:u.value.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:h.value,zoomConfiguration:d.value},Fe={chartOptions:u.value.chart,activeMetric:_e.value,headerDescription:F.value,requestsLink:d.value.showRequestsAction?L.value:void 0,exploreLink:d.value.showExploreAction?G.value:void 0};return H&&{component:H,rendererProps:{...si,...re?{}:Fe,...["top_n","single_value"].includes(u.value.chart.type)?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:ge,supportsZoom:Ge,supportsBounds:Ue,supportsLoadingChange:$e}}}),$=n.computed(()=>{if(Ne(u.value))return null;const H=u.value.query,re=H?.time_range;if(ne.isPlatformDatasource(H?.datasource)&&!H.dimensions?.includes("time"))return O.t("renderer.as_of_today");if(re?.type==="relative"){const ge=ne.TimePeriods.get(ne.TIMEFRAME_LOOKUP[re.time_range]);return ge?ge.display:(console.warn("Did not recognize the given relative time range:",re.time_range),re.time_range)}else if(re?.type==="absolute"){const ge=re.tz||"Etc/UTC";return`${ne.formatTime(re.start,{short:!0,tz:ge})} - ${ne.formatTime(re.end,{short:!0,tz:ge})}`}return null}),j=n.computed(()=>{const H=u.value.query,re=H?.datasource,ge=re?w.value[re]?.timeRangeOptions:void 0,Ue=(H&&"time_range"in H?H.time_range:void 0)??r.context.timeSpec;return Ft(Ue,ge)}),de=n.computed(()=>v.value?!1:[!!D.value,z.value,!!$.value,j.value,!!F.value,r.showRefresh,ze.value].some(Boolean)),ee=n.computed(()=>E.value?ne.msToGranularity(E.value.meta.granularity_ms):void 0),se=n.computed(()=>["timeseries_line","timeseries_bar"].includes(_.value.type)),pe=n.computed(()=>E.value?.meta.metric_names??[]),_e=n.ref();n.watch(pe,H=>{(!_e.value||!H.includes(_e.value))&&(_e.value=H[0])},{immediate:!0}),n.watch(l,()=>{E.value=void 0,_e.value=void 0,p.value=!0});const Oe=n.computed(()=>{const H=_.value;return H.type!=="timeseries_line"?!1:pe.value.some(re=>H.metric_axis_map?.[re]==="right")}),ze=n.computed(()=>se.value&&!Oe.value&&(E.value?.data.length??0)>0&&pe.value.length>1&&Object.keys(E.value?.meta.display??{}).length>0),me=n.computed(()=>{const re=("metrics"in u.value.query?u.value.query.metrics?.[0]:void 0)??pe.value[0];if(re)return c(re)}),we=n.computed(()=>(r.groupTiles??[]).map(({id:H,label:re})=>({hash:`#${H}`,title:re}))),fe=n.computed({get:()=>`#${a.value}`,set:H=>{o.value=H.slice(1)}}),ye=n.computed(()=>pe.value.map(H=>({value:H,label:c(H)}))),Te=n.computed(()=>{if(!Gt(u.value)||!se.value||!r.queryReady||p.value)return!1;const H=u.value.query.granularity;return!H||!ee.value?!1:H!==ee.value}),lt=n.computed(()=>{const H=ne.msToGranularity(E.value?.meta.granularity_ms??0)??"unknown",re=Gt(u.value)?u.value.query.granularity??"unknown":"unknown";return O.t("query_aged_out_warning",{currentGranularity:O.t(`granularities.${H}`),savedGranularity:O.t(`granularities.${re}`)})}),Tt=n.computed(()=>{const H=[...r.context.filters,...u.value.query.filters??[]],re="metrics"in u.value.query?u.value.query.metrics:void 0,ge=u.value.query.datasource??"api_usage";return U.value({datasource:ge,filters:H,queryFields:re})}),Pe=()=>{m("edit-tile",u.value,l.value)},ve=()=>{m("duplicate-tile",u.value,l.value)},He=()=>{m("remove-tile",u.value,l.value)},vt=H=>{E.value=H,p.value=!1,m("chart-data",H),m("tile-loaded")},Zg=()=>{p.value=!1,m("tile-loaded")},Jg=H=>{p.value=H,H||m("tile-loaded")},e_=()=>{I.value=!1},$r=()=>{if(_t(u.value))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const H=u.value.query.datasource?.startsWith("goap");return b?.staticConfig?.increaseCsvExportLimit!==!1&&!H?Q(u.value.query,r.context,ne.EXPORT_RECORD_LIMIT):E.value?Promise.resolve(E.value):new Promise(ge=>{const Ge=n.watch(E,Ue=>{Ue&&(ge(Ue),Ge())})})},t_=async()=>{I.value=!0,k.value={status:"loading"};try{const H=await $r();k.value={status:"success",chartData:H}}catch(H){k.value={status:"error",error:H}}},i_=H=>{const re={tileId:l.value,timeRange:H};m("tile-time-range-zoom",re)},r_=H=>{const re={tileId:l.value,bounds:H};m("tile-bounds-change",re)},n_=H=>{const re=Tt.value,ge=N(H,re);G.value=q.value?{href:ce(ge)}:void 0,L.value=x.value?{href:ae(ue(H,re))}:void 0};return e({getExportData:$r}),(H,re)=>{const ge=n.resolveComponent("KTooltip"),Ge=n.resolveComponent("KBadge"),Ue=n.resolveComponent("KButton"),$e=n.resolveComponent("KDropdownItem"),si=n.resolveComponent("KDropdown");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["tile-boundary",{editable:r.context.editable,"fit-to-content":r.fitToContent,headless:!de.value,"compact-single_value":M.value&&r.fitToContent}]),"data-testid":`tile-${r.tileId}`},[r.groupTiles&&r.groupTiles.length>1?(n.openBlock(),n.createElementBlock("div",gg,[n.createVNode(n.unref(li.KTabs),n.mergeProps({modelValue:fe.value,"onUpdate:modelValue":re[0]||(re[0]=Fe=>fe.value=Fe)},{hidePanels:!0},{"data-testid":"tile-group-tabs",tabs:we.value}),null,16,["modelValue","tabs"])])):n.createCommentVNode("",!0),de.value&&!v.value?(n.openBlock(),n.createElementBlock("div",_g,[n.createVNode(ge,{class:"title-tooltip",disabled:!g.value,"max-width":"500",text:D.value},{default:n.withCtx(()=>[n.createElementVNode("div",{ref_key:"titleRef",ref:B,class:"title"},n.toDisplayString(D.value),513)]),_:1},8,["disabled","text"]),n.createElementVNode("div",yg,[j.value?(n.openBlock(),n.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:n.unref(O).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:n.withCtx(()=>[n.createVNode(n.unref(oe.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(zi)})`},null,8,["size"])]),default:n.withCtx(()=>[n.createElementVNode("span",Rg,n.toDisplayString(n.unref(O).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):n.createCommentVNode("",!0),$.value?(n.openBlock(),n.createBlock(Ge,{key:1,"data-testid":"time-range-badge",tooltip:Te.value?lt.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("span",Cg,n.toDisplayString($.value),1)]),_:2},[Te.value?{name:"icon",fn:n.withCtx(()=>[n.createVNode(n.unref(oe.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(zi)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):n.createCommentVNode("",!0)]),ze.value?(n.openBlock(),n.createElementBlock("div",Eg,[n.createVNode(n.unref(li.KSegmentedControl),{modelValue:_e.value,"onUpdate:modelValue":re[1]||(re[1]=Fe=>_e.value=Fe),class:"metric-selector","data-testid":"metric-selector",options:ye.value},null,8,["modelValue","options"])])):n.createCommentVNode("",!0),r.showRefresh?(n.openBlock(),n.createElementBlock("div",bg,[n.createVNode(Ue,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${r.tileId}`,disabled:p.value,icon:"",size:"small",onClick:f},{default:n.withCtx(()=>[p.value?(n.openBlock(),n.createBlock(n.unref(oe.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${n.unref(Pi)})`,tabindex:"0"},null,8,["size"])):(n.openBlock(),n.createBlock(n.unref(oe.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${n.unref(Pi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):n.createCommentVNode("",!0),F.value?(n.openBlock(),n.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${r.tileId}`},n.toDisplayString(F.value),9,Og)):n.createCommentVNode("",!0),K.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${r.tileId}`},[K.value&&r.context.editable&&!r.isFullscreen?(n.openBlock(),n.createBlock(Ue,{key:0,appearance:"tertiary","aria-label":n.unref(O).t("renderer.edit"),class:"edit-icon","data-testid":`edit-tile-${r.tileId}`,icon:"",size:"small",onClick:Pe},{default:n.withCtx(()=>[n.createVNode(n.unref(oe.EditIcon),{decorative:""})]),_:1},8,["aria-label","data-testid"])):n.createCommentVNode("",!0),K.value&&S.value&&!r.isFullscreen?(n.openBlock(),n.createBlock(si,{key:1,class:"dropdown","data-testid":`chart-action-menu-${r.tileId}`,"kpop-attributes":{placement:"bottom-end"},onToggleDropdown:re[2]||(re[2]=Fe=>s.value=Fe)},{items:n.withCtx(()=>[n.unref(V)?(n.openBlock(),n.createBlock($e,{key:0,"data-testid":`chart-jump-to-explore-${r.tileId}`,item:{label:n.unref(O).t("jumpToExplore"),to:n.unref(V)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),!n.unref(Ne)(u.value)&&n.unref(W)?(n.openBlock(),n.createBlock($e,{key:1,"data-testid":`chart-jump-to-requests-${r.tileId}`,item:{label:n.unref(O).t("jumpToRequests"),to:n.unref(W)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),P.value?(n.openBlock(),n.createBlock($e,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${r.tileId}`,onClick:t_},{default:n.withCtx(()=>[n.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${r.tileId}`},n.toDisplayString(n.unref(O).t("csvExport.exportAsCsv")),9,Tg)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock($e,{key:3,"data-testid":`duplicate-tile-${r.tileId}`,onClick:ve},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(O).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock($e,{key:4,"data-testid":`remove-tile-${r.tileId}`,onClick:He},{default:n.withCtx(()=>[n.createElementVNode("span",vg,n.toDisplayString(n.unref(O).t("renderer.delete")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)]),default:n.withCtx(()=>[n.createVNode(Ue,{appearance:"tertiary","aria-expanded":s.value,"aria-haspopup":"true","aria-label":n.unref(O).t("renderer.tileActions"),class:n.normalizeClass(["kebab-action-menu",{"is-open":s.value}]),"data-testid":`kebab-action-menu-${r.tileId}`,icon:"",size:"small"},{default:n.withCtx(()=>[n.createVNode(n.unref(oe.MoreIcon),{decorative:""})]),_:1},8,["aria-expanded","aria-label","class","data-testid"])]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)],8,wg)):n.createCommentVNode("",!0),I.value?(n.openBlock(),n.createBlock(or,{key:4,"data-testid":`csv-export-modal-${r.tileId}`,"export-state":k.value,filename:J.value,onCloseModal:e_},null,8,["data-testid","export-state","filename"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["tile-content",`type-${r.tileType}-${_.value.type}`]),"data-testid":`tile-content-${r.tileId}`},[A.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(A.value.component),n.mergeProps({key:l.value},A.value.rendererProps,n.toHandlers(te.value),{onChartData:vt,onQueryComplete:Zg}),null,16)):n.createCommentVNode("",!0)],10,Sg)],10,pg)}}}),[["__scopeId","data-v-aaf55d0b"]]);function xg(r,e,t,i,s){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+s+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(r,a));return o.prototype=e.prototype,o}class 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 s=t.querySelectorAll(e);return!s.length&&e[0]!=="."&&e[0]!=="#"&&(s=t.querySelectorAll("."+e),s.length||(s=t.querySelectorAll("#"+e))),Array.from(s)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let s=t.querySelector(e);return i&&!s&&(s=i.getElementById(e)),s||(s=t.querySelector("."+e)),s}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(s=>{s&&i.classList.add(s)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return 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,s=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(s<=i)return 0;const o=e.y>t.y?e.y:t.y,a=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return a<=o?0:(s-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,o)=>{const a=t*((s.y??1e4)-(o.y??1e4));return a===0?t*((s.x??1e4)-(o.x??1e4)):a})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static createStylesheet(e,t,i){const s=document.createElement("style"),o=i?.nonce;return o&&(s.nonce=o),s.setAttribute("type","text/css"),s.setAttribute("gs-style-id",e),s.styleSheet?s.styleSheet.cssText="":s.appendChild(document.createTextNode("")),t?t.insertBefore(s,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(s)),s}static removeStylesheet(e,t){const s=(t||document).querySelector("STYLE[gs-style-id="+e+"]");s&&s.parentNode&&s.remove()}static addCSSRule(e,t,i){e.textContent+=`${t} { ${i} } `}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const s=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!s)throw new Error(`Invalid height val = ${e}`);i=s[2]||"px",t=parseFloat(s[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const s in i){if(!i.hasOwnProperty(s))return;e[s]===null||e[s]===void 0?e[s]=i[s]:typeof i[s]=="object"&&typeof e[s]=="object"&&this.defaults(e[s],i[s])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const s=e[i],o=t[i];i[0]==="_"||s===o?delete e[i]:s&&typeof s=="object"&&o!==void 0&&(y.removeInternalAndSame(s,o),Object.keys(s).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...s)=>{i||(i=!0,setTimeout(()=>{e(...s),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const s=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>o){const a=s.bottom-o,l=s.top,u=this.getScrollElement(e);if(u!==null){const c=u.scrollTop;s.top<0&&i<0?e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=a>i?i:a),t.top+=u.scrollTop-c}}}static updateScrollResize(e,t,i){const s=this.getScrollElement(t),o=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,l=e.clientY-a,u=l<i,c=l>o-i;u?s.scrollBy({behavior:"smooth",top:l-i}):c&&s.scrollBy({behavior:"smooth",top:i-(o-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=y.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(o=>o===s)&&(i[s]=y.cloneDeep(e[s]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=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(s=>{e.style[i]=s}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},s={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...s}}static simulateMouseEvent(e,t,i){const s=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:s.ctrlKey??!1,altKey:s.altKey??!1,shiftKey:s.shiftKey??!1,metaKey:s.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");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 s=e[t];e[t]=e[i],e[i]=s}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class Ae{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,s={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!s.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,s.skip));let a=!1;const l={nested:!0,pack:!1};let u=0;for(;i=i||this.collide(e,o,s.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...l};c=this._loading&&y.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&c?y.copyPos(t,e):!i.locked&&c&&s.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 s=e._id,o=i?._id;return this.nodes.find(a=>a._id!==s&&a._id!==o&&y.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==s&&a._id!==o&&y.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,o={...t.rect};o.y>s.y?(o.h+=o.y-s.y,o.y=s.y):o.h+=s.y-o.y,o.x>s.x?(o.w+=o.x-s.x,o.x=s.x):o.w+=s.x-o.x;let a,l=.5;for(let u of i){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,h=Number.MAX_VALUE;s.y<c.y?d=(o.y+o.h-c.y)/c.h:s.y+s.h>c.y+c.h&&(d=(c.y+c.h-o.y)/c.h),s.x<c.x?h=(o.x+o.w-c.x)/c.w:s.x+s.w>c.x+c.w&&(h=(c.x+c.w-o.x)/c.w);const f=Math.min(h,d);f>l&&(l=f,a=u)}return t.collide=a,a}cacheRects(e,t,i,s,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-s,h:l.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=o,e.y=a),e._dirty=t._dirty=!0,!0}let s;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(s=y.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=y.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=y.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,s){const o={x:e||0,y:t||0,w:i||1,h:s||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const s=this._inColumnResize;s||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((a,l,u)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=u[l-1])),this.addNode(a,!1,c)}),s||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=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??Ae._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const s={x:0,y:0,w:1,h:1};return y.defaults(e,s),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=s.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=s.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=s.w),isNaN(e.h)&&(e.h=s.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||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,s){const o=s?s.y*i+(s.x+s.w):0;let a=!1;for(let l=o;!a;++l){const u=l%i,c=Math.floor(l/i);if(u+e.w>i)continue;const d={x:u,y:c,w:e.w,h:e.h};t.find(h=>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 s=this.nodes.find(a=>a._id===e._id);if(s)return s;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(s=>s._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(s=>s._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(s=>s._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const s=new Ae({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const o=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return o?(s.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(u=>u._id===a._id);l&&(y.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new Ae({column:this.column,float:this.float,nodes:this.nodes.map(s=>({...s}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=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 s=e.w!==t.w||e.h!==t.h,o=y.copyPos({},e,!0);if(y.copyPos(o,t),this.nodeBoundFix(o,s),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,s=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=s?.find(c=>c._id===a._id),u={...a,...l||{}};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 s=i/this.column;e.forEach(o=>{if(!o._orig)return;const a=t.find(l=>l._id===o._id);a&&(a.y>=0&&o.y!==o._orig.y&&(a.y+=o.y-o._orig.y),o.x!==o._orig.x&&(a.x=Math.round(o.x*s)),o.w!==o._orig.w&&(a.w=Math.round(o.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const s=i==="compact"||i==="list";s&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=s?this.nodes: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&&(!s&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=!0))})),l.forEach(c=>{const d=a.findIndex(h=>h._id===c._id);if(d!==-1){const h=a[d];if(s){h.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,o),c.autoPosition||(h.x=c.x??h.x,h.y=c.y??h.y,h.w=c.w??h.w,o.push(h)),a.splice(d,1)}})}if(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=s||i==="none"?1:t/e,u=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(d=>{d.x=t===1?0:u?Math.round(d.x*l):Math.min(d.x,t-1),d.w=t===1||e===1?1:c?Math.round(d.w*l)||1:Math.min(d.w,t),o.push(d)}),a=[]}o=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,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];return e.forEach((o,a)=>{if(o._id===void 0){const l=o.id?this.nodes.find(u=>u.id===o.id):void 0;o._id=l?._id??Ae._idSeq++}s[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??Ae._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const s=this.findCacheLayout(e,t);return s===-1?this._layouts[t].push(i):this._layouts[t][s]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}Ae._idSeq=0;const be={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 Z{}const ke=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 Le{}function Rt(r,e){r.touches.length>1||(r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r.changedTouches[0],e))}function Pr(r,e){r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r,e)}function Ct(r){Le.touchHandled||(Le.touchHandled=!0,Rt(r,"mousedown"))}function Et(r){Le.touchHandled&&Rt(r,"mousemove")}function bt(r){if(!Le.touchHandled)return;Le.pointerLeaveTimeout&&(window.clearTimeout(Le.pointerLeaveTimeout),delete Le.pointerLeaveTimeout);const e=!!Z.dragElement;Rt(r,"mouseup"),e||Rt(r,"click"),Le.touchHandled=!1}function Ot(r){r.pointerType!=="mouse"&&r.target.releasePointerCapture(r.pointerId)}function qr(r){Z.dragElement&&r.pointerType!=="mouse"&&Pr(r,"mouseenter")}function Hr(r){Z.dragElement&&r.pointerType!=="mouse"&&(Le.pointerLeaveTimeout=window.setTimeout(()=>{delete Le.pointerLeaveTimeout,Pr(r,"mouseleave")},10))}class wt{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(`${wt.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),ke&&(this.el.addEventListener("touchstart",Ct),this.el.addEventListener("pointerdown",Ot)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),ke&&(this.el.removeEventListener("touchstart",Ct),this.el.removeEventListener("pointerdown",Ot)),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),ke&&(this.el.addEventListener("touchmove",Et),this.el.addEventListener("touchend",bt)),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),ke&&(this.el.removeEventListener("touchmove",Et),this.el.removeEventListener("touchend",bt)),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}}wt.prefix="ui-resizable-";class ri{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 ot extends ri{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||o;return{position:{left:(a.left-s.left)*this.rectScale.x,top:(a.top-s.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(s=>this.option[s]=e[s]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Z.overResizeElement===this&&delete Z.overResizeElement),this}_mouseOver(e){Z.overResizeElement||Z.dragElement||(Z.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){Z.overResizeElement===this&&(delete Z.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new wt(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=ot._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 ot._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let l,u;t.indexOf("e")>-1?s.width+=o:t.indexOf("w")>-1&&(s.width-=o,s.left+=o,l=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,u=!0);const c=this._constrainSize(s.width,s.height,l,u);return Math.round(s.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-c.width),s.width=c.width),Math.round(s.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-c.height),s.height=c.height),s}_constrainSize(e,t,i,s){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,u=(s?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,d=Math.min(a,Math.max(l,e)),h=Math.min(u,Math.max(c,t));return{width:d,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:s}=t.getBoundingClientRect();e={left:i,top:s,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],s=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*s+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}ot._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Ig='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class at extends ri{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),ke&&(e.addEventListener("touchstart",Ct),e.addEventListener("pointerdown",Ot))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),ke&&(t.removeEventListener("touchstart",Ct),t.removeEventListener("pointerdown",Ot))}),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(!Z.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Ig)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete Z.dragElement,delete Z.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),ke&&(e.currentTarget.addEventListener("touchmove",Et),e.currentTarget.addEventListener("touchend",bt)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),Z.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),Z.pauseDrag){const i=Number.isInteger(Z.pauseDrag)?Z.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,Z.dragElement=this;const i=this.el.gridstackNode?.grid;i?Z.dropElement=i.el.ddElement.ddDroppable:delete Z.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 s=y.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),ke&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Et,!0),e.currentTarget.removeEventListener("touchend",bt,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),Z.dropElement?.el===this.el.parentElement&&delete Z.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),Z.dropElement&&Z.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete Z.dragElement,delete Z.dropElement,delete Z.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||Z.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=at.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",at.originStyleProp.forEach(s=>t.style[s]=this.dragElementOriginStyle[s]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,s=this.dragOffset;i.left=(e.clientX+s.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+s.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let s=0,o=0;i&&(s=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-s,offsetTop:-e.clientY+a.top-o,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}at.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Dg extends ri{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),ke&&(this.el.addEventListener("pointerenter",qr),this.el.addEventListener("pointerleave",Hr)))}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),ke&&(this.el.removeEventListener("pointerenter",qr),this.el.removeEventListener("pointerleave",Hr)))}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(!Z.dragElement||!this._canDrop(Z.dragElement.el))return;e.preventDefault(),e.stopPropagation(),Z.dropElement&&Z.dropElement!==this&&Z.dropElement._mouseLeave(e,!0),Z.dropElement=this;const t=y.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(Z.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!Z.dragElement||Z.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(Z.dragElement)),this.triggerEvent("dropout",i),Z.dropElement===this&&(delete Z.dropElement,!t)){let s,o=this.el.parentElement;for(;!s&&o;)s=o.ddElement?.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const t=y.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(Z.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 ni{static init(e){return e.ddElement||(e.ddElement=new ni(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 at(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 ot(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 Dg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class kg{resizable(e,t,i,s){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:s});else{const l=o.el.gridstackNode.grid;let u=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:u,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,s){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:s});else{const a=o.el.gridstackNode.grid;o.setupDraggable({...a.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,s){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:s}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(s=>s.on(t,o=>{i(o,Z.dragElement?Z.dragElement.el:o.target,Z.dragElement?Z.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",s=y.getElements(e);return s.length?s.map(a=>a.ddElement||(i?ni.init(a):null)).filter(a=>a):[]}}const Ee=new kg;class X{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=X.getGridElement(t);return i?(i.gridstack||(i.gridstack=new X(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
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"||(X.getGridElements(t).forEach(s=>{s.gridstack||(s.gridstack=new X(s,y.cloneDeep(e))),i.push(s.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
15
- 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")||X.addRemoveCB)&&(X.addRemoveCB?i=X.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),X.init(t,i)}static registerEngine(e){X.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=y.createDiv([this.opts.placeholderClass,be.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 s=t.columnOpts?.breakpoints;const o=t;if(o.oneColumnModeDomSort&&(delete o.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),o.oneColumnSize||o.disableOneColumnMode===!1){const h=o.oneColumnSize||768;delete o.oneColumnSize,delete o.disableOneColumnMode,t.columnOpts=t.columnOpts||{},s=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=s.find(m=>m.c===1);f?f.w=h:(f={c:1,w:h},s.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,s=void 0):a.columnMax=a.columnMax||12),s?.length>1&&s.sort((h,f)=>(f.w||0)-(h.w||0));const l={...y.cloneDeep(be),column:y.toNumber(e.getAttribute("gs-column"))||be.column,minRow:i||y.toNumber(e.getAttribute("gs-min-row"))||be.minRow,maxRow:i||y.toNumber(e.getAttribute("gs-max-row"))||be.maxRow,staticGrid:y.toBool(e.getAttribute("gs-static"))||be.staticGrid,sizeToContent:y.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||be.draggable.handle},removableOptions:{accept:t.itemClass||be.removableOptions.accept,decline:be.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("."+be.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!==be.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=ke),this._styleSheetClass="gs-id-"+Ae._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const d=t.engineClass||X.engineClass||Ae;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 C=m.el;C&&(m._removeDOM?(C&&C.remove(),delete m._removeDOM):this._writePosAttr(C,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&&!Z.pauseDrag&&(Z.pauseDrag=!0),t.draggable?.pause!==void 0&&(Z.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:X.addRemoveCB?t=X.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const s=this._readAttr(t);return y.defaults(e,s),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(([s])=>{s.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,X.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):X.renderCB(i,e),t}makeSubGrid(e,t,i,s=!0){let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),o.subGrid?.el)return o.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;t=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(s&&(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),X.addRemoveCB?d=X.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,C=o.h+i.h,b=o.el.style;b.transition="none",this.update(o.el,{w:m,h:C}),setTimeout(()=>b.transition=null)}const f=o.subGrid=X.addGrid(c,t);return i?._moving&&(f._isTemp=!0),u&&(f._autoColumn=!0),s&&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=X.saveCB){const s=this.engine.save(e,i);if(s.forEach(o=>{if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a?.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,o.subGrid?.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=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,be),o.children=s,o}return s}load(e,t=X.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 s=0;e.forEach(c=>{s=Math.max(s,(c.x||0)+c.w)}),s>this.engine.defaultColumn&&(this.engine.defaultColumn=s),s>i&&this.engine.cacheLayout(e,s,!0);const o=X.addRemoveCB;typeof t=="function"&&(X.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)||(X.addRemoveCB&&X.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?X.addRemoveCB=o:delete X.addRemoveCB,l&&this.opts?.animate&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const s=y.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/s)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e,t=!0){if(t&&e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const s=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+s}const i=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 s=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(s/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&s<=e.breakpoints[o].w;)i=e.breakpoints[o++].c||t}if(i!==t){const o=e.breakpoints?.find(a=>a.c===i);return this.column(i,o?.layout||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+e),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),delete this.parentGridNode?.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let s;t?s={top:i.top+document.documentElement.scrollTop,left:i.left}:s={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-s.left,a=e.top-s.top,l=i.width/this.getColumn(),u=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,s){return this.engine.isAreaEmpty(e,t,i,s)}makeWidget(e,t){const i=X.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const s=i.gridstackNode;this._updateContainerHeight(),s.subGridOpts&&this.makeSubGrid(i,s.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(s=>this.on(s,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=s=>t(s):this._gsEventHandler[e]=s=>{s.detail&&t(s,s.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(X.getElements(e).forEach(s=>{if(s.parentElement&&s.parentElement!==this.el)return;let o=s.gridstackNode;o||(o=this.engine.nodes.find(a=>s===a.el)),o&&(t&&X.addRemoveCB&&X.addRemoveCB(this.el,o,!1,!1),delete s.gridstackNode,this._removeDD(s),this.engine.removeNode(o,t,i),t&&s.parentElement&&s.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&X.addRemoveCB&&X.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(s=>{this.prepareDragDrop(s.el),s.subGrid&&i&&s.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){const t=this.opts;return e.acceptWidgets!==void 0&&this._setupAcceptWidget(),e.animate!==void 0&&this.setAnimation(),e.cellHeight&&(this.cellHeight(e.cellHeight,!0),delete e.cellHeight),e.class&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),this.el.classList.add(e.class)),typeof e.column=="number"&&!e.columnOpts&&(this.column(e.column),delete e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0&&(t.minRow=t.maxRow=e.row),e.children?.length&&(this.load(e.children),delete e.children),this.opts={...this.opts,...e},this}update(e,t){return X.getElements(e).forEach(i=>{const s=i?.gridstackNode;if(!s)return;const o={...y.copyPos({},s),...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]!==s[d])&&(l={},a.forEach(d=>{l[d]=o[d]!==void 0?o[d]:s[d],delete o[d]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(s.content=o.content,X.renderCB(d,o),s.subGrid?.el&&(d.appendChild(s.subGrid.el),s.subGrid.opts.styleInHead||s.subGrid._updateStyles(!0))),delete o.content}let u=!1,c=!1;for(const d in o)d[0]!=="_"&&s[d]!==o[d]&&(s[d]=o[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(y.sanitizeMinMax(s),l){const d=l.w!==void 0&&l.w!==s.w;this.moveNode(s,l),d&&s.subGrid?s.subGrid.onResize(this.hasAnimationCSS()?s.w:void 0):this.resizeToContentCheck(d,s),delete s._orig}(l||u)&&this._writeAttr(i,s),c&&this.prepareDragDrop(s.el)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const s=i.getCellHeight(!0);if(!s)return;let o=t.h?t.h*s:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector(X.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=t.h?t.h*s-l:a.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const f=t.subGrid.el.getBoundingClientRect(),m=t.subGrid.el.parentElement.getBoundingClientRect();c+=f.top-m.top}else{if(t.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${X.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||u}}if(u===c)return;o+=c-u;let d=Math.ceil(o/s);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&d>h&&(d=h,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){X.resizeToContentCB?X.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return X.getElements(e).forEach(i=>{const s=i.gridstackNode;if(!y.canBeRotated(s))return;const o={w:s.h,h:s.w,minH:s.minW,minW:s.minH,maxH:s.maxW,maxW:s.maxH};if(t){const l=t.left>0?Math.floor(t.left/this.cellWidth()):0,u=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=s.x+l-(s.h-(u+1)),o.y=s.y+u-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=s._orig;this.update(i,o),s._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=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,s={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(s)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const e=this.opts.styleInHead?void 0:this.el.parentNode;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,s=this.opts.cellHeightUnit,o=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const a=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=y.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,y.addCSSRule(this._styles,o,`height: ${i}${s}`);const l=this.opts.marginTop+this.opts.marginUnit,u=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,d=this.opts.marginLeft+this.opts.marginUnit,h=`${o} > .grid-stack-item-content`,f=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;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+s;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,s=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=y.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===s){const a=Math.floor(o.h/i);t<a&&(t=a)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+s),e&&!e.grid.engine.batchMode&&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(be.itemClass,this.opts.itemClass);const s=y.shouldSizeToContent(i);return s?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),s&&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 s in i)t[s]?e.setAttribute(i[s],String(t[s])):e.removeAttribute(i[s]);return this}_readAttr(e,t=!0){const i={};i.x=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 s=e.getAttribute("gs-size-to-content");s&&(s==="true"||s==="false"?i.sizeToContent=y.toBool(s):i.sizeToContent=parseInt(s,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(s=>{y.shouldSizeToContent(s)&&this.resizeToContentCBCheck(s.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=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 X.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 Ee}static setupDragIn(e,t,i,s=document){t?.pause!==void 0&&(Z.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?y.getElements(e,s):e).forEach((a,l)=>{Ee.isDraggable(a)||Ee.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:(X.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noMove:s.noMove=!0,this.prepareDragDrop(s.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(X.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noResize:s.noResize=!0,this.prepareDragDrop(s.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&X._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Ee.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 Ee.droppable(this.el,"destroy"),this;let e,t;const i=(s,o,a)=>{a=a||o;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=a.getBoundingClientRect();a.style.left=f.x+(this.dragTransform.xScale-1)*(s.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(s.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:u,left:c}=a.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;const h={position:{top:u*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/t)),l.y=Math.max(0,Math.round(u/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){Ee.off(o,"drag");return}l._willFitPos&&(y.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,s,h,l,t,e)}else this._dragOrResize(a,s,h,l,t,e)};return Ee.droppable(this.el,{accept:s=>{const o=s.gridstackNode||this._readAttr(s,!1);if(o?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(s);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=s.matches(l)}if(a&&o&&this.opts.maxRow){const l={w:o.w,h:o.h,minW:o.minW,minH:o.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(s,o,a)=>{let l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(o,a),a=a||o,t=this.cellWidth(),e=this.getCellHeight(!0),!l){const d=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(d){try{l=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const u=l.w||Math.round(a.offsetWidth/t)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=l),o.gridstackNode=l={...l,w:u,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=u,l.h=c,l._temporaryRemoved=!0),X._itemRemoving(l.el,!1),Ee.on(o,"drag",i),i(s,o,a),!1}).on(this.el,"dropout",(s,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(o,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(s,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const u=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const d=u&&this.opts.animate;d&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,u&&h?.grid&&h.grid!==this){const m=h.grid;m.engine.removeNodeFromLayoutCache(h),m.engine.removedNodes.push(h),m._triggerRemoveEvent()._triggerChangeEvent(),m.parentGridNode&&!m.engine.nodes.length&&m.opts.subGridDynamic&&m.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,Ee.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||X.addRemoveCB)?(delete l.el,o=this.addWidget(l)):(this._prepareElement(o,!0,l),this.el.appendChild(o),this.resizeToContentCheck(!1,l),f&&(f.parentGridNode=l,f.opts.styleInHead||f._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...s,type:"dropped"},h&&h.grid?h:void 0,l),d&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Ee.isDroppable(e)&&Ee.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>X._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>X._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const s=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||s&&o;if((t||a)&&(i._initDD&&(this._removeDD(e),delete i._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let l,u;const c=(f,m)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,f,m,i,l,u)},d=(f,m)=>{this._dragOrResize(e,f,m,i,l,u)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const m=i.w!==i._orig.w,C=f.target;if(!(!C.gridstackNode||C.gridstackNode.grid!==this)){if(i.el=C,i._isAboutToRemove){const b=e.gridstackNode.grid;b._gsEventHandler[f.type]&&b._gsEventHandler[f.type](f,C),b.engine.nodes.push(i),b.removeWidget(e,!0,!0)}else y.removePositioningStyles(C),i._temporaryRemoved?(y.copyPos(i,i._orig),this._writePosAttr(C,i),this.engine.addNode(i)):this._writePosAttr(C,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,C);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))}};Ee.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return Ee.draggable(e,s?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,s,o,a){if(this.engine.cleanNodes().beginUpdate(s),this._writePosAttr(this.placeholder,s),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=s,s.grid?.el)this.dragTransform=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(s.el=this.placeholder,s._lastUiPosition=i.position,s._prevYPix=i.position.top,s._moving=t.type==="dragstart",delete s._lastTried,t.type==="dropover"&&s._temporaryRemoved&&(this.engine.addNode(s),s._moving=!0),this.engine.cacheRects(o,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-s.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-s.y;Ee.resizable(e,"option","minWidth",o*Math.min(s.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(s.minH||1,u)).resizable(e,"option","maxWidth",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,s.x+s.w)).resizable(e,"option","maxHeight",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,s.y+s.h))}}_dragOrResize(e,t,i,s,o,a){const l={...s._orig};let u,c=this.opts.marginLeft,d=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const m=Math.round(a*.1),C=Math.round(o*.1);if(c=Math.min(c,C),d=Math.min(d,C),h=Math.min(h,m),f=Math.min(f,m),t.type==="drag"){if(s._temporaryRemoved)return;const R=i.position.top-s._prevYPix;s._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&y.updateScrollPosition(e,i.position,R);const w=i.position.left+(i.position.left>s._lastUiPosition.left?-d:c),U=i.position.top+(i.position.top>s._lastUiPosition.top?-f:h);l.x=Math.round(w/o),l.y=Math.round(U/a);const O=this._extraDragRow;if(this.engine.collide(s,l)){const E=this.getRow();let k=Math.max(0,l.y+s.h-E);this.opts.maxRow&&E+k>this.opts.maxRow&&(k=Math.max(0,this.opts.maxRow-E)),this._extraDragRow=k}else this._extraDragRow=0;if(this._extraDragRow!==O&&this._updateContainerHeight(),s.x===l.x&&s.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),s.w===l.w&&s.h===l.h)||s._lastTried&&s._lastTried.w===l.w&&s._lastTried.h===l.h)return;const R=i.position.left+c,w=i.position.top+h;l.x=Math.round(R/o),l.y=Math.round(w/a),u=!0}s._event=t,s._lastTried=l;const b={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:s.w*o)-c-d,h:(i.size?i.size.height:s.h*a)-h-f};if(this.engine.moveNodeCheck(s,{...l,cellWidth:o,cellHeight:a,rect:b,resizing:u})){s._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,d,f,c),delete s._skipDown,u&&s.subGrid&&s.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const R=t.target;s._sidebarOrig||this._writePosAttr(R,s),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,R)}}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,Ee.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const s=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=s,this.opts.removable===!0&&X._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return xg(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}X.renderCB=(r,e)=>{r&&e?.content&&(r.textContent=e.content)},X.resizeToContentParent=".grid-stack-item-content",X.Utils=y,X.Engine=Ae,X.GDRev="11.5.1";const Ng=(r,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),u=o.layout.size.rows===1&&!!o.layout.size.fit_to_content;t=Math.max(t,a+o.layout.size.rows),l===void 0?i.set(a,u):i.set(a,l&&u)});const s=[];for(let o=0;o<t;o++)i.get(o)?s.push("auto"):s.push(`${r}px`);return s},Gr=(r,e,t)=>e.get(`${r.id}`)??r.layout.size.rows*t,Ag=(r,e,t,i)=>e.map((s,o)=>{if(s!=="auto")return i;const a=r.filter(l=>l.layout.position.row===o);return Math.max(...a.map(l=>Gr(l,t,i)))}),Lg=(r,e,t)=>{const i=[...r].sort((a,l)=>a.layout.position.row-l.layout.position.row||a.layout.position.col-l.layout.position.col),s=new Map;let o=0;return i.forEach(a=>{const l=Gr(a,e,t);s.set(`${a.id}`,{x:0,y:o,w:1,h:l}),o+=l}),s},Ug=(r,e,t,{cellsPerRow:i,columns:s})=>{if(s===1)return Lg(r,t,i);const o=[0];return Ag(r,e,t,i).forEach(a=>{o.push(o[o.length-1]+a)}),new Map(r.map(a=>{const{position:l,size:u}=a.layout,c=o[l.row],d=o[l.row+u.rows];return[`${a.id}`,{x:l.col,y:c,w:u.cols,h:d-c}]}))},Mg=["data-id","data-testid"],Kg={class:"grid-stack-item-content"},Bg=De(n.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:it},columns:{default:zt},editable:{type:Boolean,default:!1},bottomTrim:{default:0}},emits:["update-tiles"],setup(r,{expose:e,emit:t}){const i=r,s=t,o=n.ref(null),a=n.ref(new Map(i.tiles.map(T=>[`${T.id}`,T])));let l=null,u=!1;const c=T=>`[data-id="${T}"]`,d=n.computed(()=>Ng(i.tileHeight,i.tiles)),h=T=>!i.editable&&d.value[T.layout.position.row]==="auto",f=()=>i.editable?1:rt,m=parseInt(fa,10)/2,C=n.ref(new Map),b=n.ref(new Map),R=n.ref(!1),w=T=>R.value||h(T),U=n.computed(()=>Ug(i.tiles,d.value,C.value,{cellsPerRow:rt,columns:R.value?1:i.columns})),O=n.computed(()=>{if(i.editable)return 0;const x=(R.value?[...i.tiles].sort((N,ce)=>N.layout.position.row-ce.layout.position.row||N.layout.position.col-ce.layout.position.col).slice(-1):i.tiles.filter(N=>N.layout.position.row===d.value.length-1)).filter(N=>C.value.has(`${N.id}`));if(!x.length||!x.every(w))return 0;const q=Math.max(...x.map(N=>C.value.get(`${N.id}`))),L=Math.max(...x.map(N=>b.value.get(`${N.id}`))),G=q*(i.tileHeight/rt)-(L+2*m);return Math.max(0,Math.round(G*100)/100)}),E=T=>i.editable?{id:`${T.id}`,x:T.layout.position.col,y:T.layout.position.row,w:T.layout.size.cols,h:T.layout.size.rows}:{id:`${T.id}`,...U.value.get(`${T.id}`)},k=()=>({margin:m,column:i.columns,cellHeight:i.tileHeight/f(),resizable:{handles:"se, sw"},handle:".tile-header",staticGrid:!i.editable,float:!i.editable}),I=T=>T.map(x=>{const q=a.value.get(`${x.el?.getAttribute("data-id")}`);if(q)return{...q,layout:{position:{col:Number(x.x),row:Number(x.y)},size:{...q.layout.size,cols:Number(x.w),rows:Number(x.h)}}}}).filter(x=>x!==void 0),B=(T,x)=>{l&&!u&&(I(x).forEach(L=>{a.value.set(`${L.id}`,L)}),s("update-tiles",Array.from(a.value.values())))},g=(T,x)=>{x.forEach(q=>{a.value.delete(`${q.el?.getAttribute("data-id")}`)}),s("update-tiles",Array.from(a.value.values()))},p=T=>o.value?.querySelector(`${c(T)} > .grid-stack-item-content > :first-child`),_=T=>Math.ceil((T+2*m)/(i.tileHeight/rt)),M=()=>{const T=new Map,x=new Map;i.tiles.filter(w).forEach(G=>{const N=p(G.id);if(N){const{height:ce}=N.getBoundingClientRect();T.set(`${G.id}`,_(ce)),x.set(`${G.id}`,ce)}}),(T.size!==C.value.size||[...T].some(([G,N])=>C.value.get(G)!==N))&&(C.value=T),(x.size!==b.value.size||[...x].some(([G,N])=>b.value.get(G)!==N))&&(b.value=x)},D=new ResizeObserver(()=>window.requestAnimationFrame(M)),F=()=>{D.disconnect(),i.tiles.filter(w).forEach(T=>{const x=p(T.id);x&&D.observe(x)})},v=new ResizeObserver(([T])=>{R.value=!i.editable&&T.contentRect.width<=parseInt(da,10)}),P=(T,x)=>{const q=T.x===x.x&&T.y===x.y,L=T.w===x.w&&T.h===x.h;return q&&L},V=()=>{if(!l)return;const T=new Set(i.tiles.map(L=>`${L.id}`)),x=new Map(l.engine.nodes.map(L=>[`${L.id}`,L]));x.forEach((L,G)=>{!T.has(G)&&L.el&&(l.removeWidget(L.el,!1,!1),a.value.delete(G))});const q=i.tiles.filter(L=>x.has(`${L.id}`)).map(E);u=!0,q.some(L=>!P(x.get(`${L.id}`),L))&&l.load(q,!1),u=!1,i.tiles.filter(L=>!x.has(`${L.id}`)).forEach(L=>{l.makeWidget(c(L.id),{...E(L),autoPosition:i.editable})}),F()};n.onMounted(()=>{o.value&&(l=X.init(k(),o.value),l.batchUpdate(),i.tiles.forEach(T=>l.makeWidget(c(T.id),E(T))),l.batchUpdate(!1),F(),v.observe(o.value),i.editable&&(l.on("change",B),l.on("added",B),l.on("removed",g)))}),n.onUnmounted(()=>{D.disconnect(),v.disconnect(),l&&l.destroy(!1)});const W=T=>{if(l&&o.value){const x=o.value.querySelector(c(T));x&&l.removeWidget(x)}};return n.watch(R,T=>l?.column(T?1:i.columns,"none")),n.watch(()=>[i.tiles.map(T=>[T.id,T.layout]),U.value],V,{deep:!0,flush:"post"}),n.watchEffect(()=>{i.tiles.forEach(T=>{a.value.set(`${T.id}`,T)})}),e({removeWidget:W}),(T,x)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack",style:n.normalizeStyle({marginBottom:`-${r.bottomTrim+O.value}px`})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.tiles,q=>(n.openBlock(),n.createElementBlock("div",{key:q.id,"data-id":`${q.id}`,"data-testid":`grid-stack-item-${q.id}`},[n.createElementVNode("div",Kg,[n.renderSlot(T.$slots,"tile",{fitToContent:h(q),tile:q},void 0,!0)])],8,Mg))),128))],4))}}),[["__scopeId","data-v-8a2b0f6f"]]),zg=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}},Pg={key:0,class:"fullscreen-header"},qg=["id"],Hg={key:1,class:"boundary-header"},Gg={key:0,class:"boundary-title"},$g={key:1,class:"boundary-description"},Fg=De(n.defineComponent({__name:"DashboardRenderer",props:n.mergeModels({context:{},preview:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:n.mergeModels(["edit-tile","tile-time-range-zoom","tiles-loaded"],["update:modelValue"]),setup(r,{expose:e,emit:t}){if(n.useCssVars(S=>({v46ff5d3f:C.value})),r.context.disableCoordination!==!0){const S=xs();n.provide(Gi,S)}const i=t,s=n.useModel(r,"modelValue"),o=n.computed(()=>Array.isArray(s.value)?s.value:[{definition:s.value}]),a=S=>o.value[S].definition,l=n.computed(()=>{const S=K=>K.type==="slottable"||"definition"in K&&K.definition?.chart?.type==="slottable";return o.value.reduce((K,z)=>{const Y=I(z),te=new Set;return z.definition.tiles.forEach(A=>{if(S(A))return;const $=A.id?Y[A.id]:void 0;$?te.has($.groupId)||(te.add($.groupId),K++):K++}),K},0)}),{i18n:u}=he.useI18n(),c=n.ref(0),d=[],h=(S,K)=>{d[S]=K},f=n.ref(),m=n.ref(),C=n.ref("scale(1)"),b=new Set,R=n.inject(Ie);R||(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")),he.useRequestQueue();const{exportPdf:w,exportState:U}=he.useExportPdf(m),O=(S,K)=>{b.add(`${K}-${S.id}`),b.size>=l.value&&i("tiles-loaded",!0)},E=n.computed(()=>{const K=`renderer.trendRange.${Q.value.type==="absolute"?"custom":Q.value.time_range}`;return u.te(K)?u.t(K):""}),k=(S,K)=>{const z=S.layout.position.row-K.layout.position.row;return z!==0?z:S.layout.position.col-K.layout.position.col},I=S=>{const K={};return S.tileGroups?.forEach(z=>{z.tileIdLabels.forEach(([Y])=>{K[Y]=z})}),K},B=S=>{const K=S.definition.tiles.map(A=>{if(N.value&&!A.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",A),A.type==="slottable")return{layout:A.layout,type:A.type,id:A.id??crypto.randomUUID()};let $=A.definition;const j=A.type??"chart",de=Ha($,E.value);return de!==$.header_description&&($={...$,header_description:de}),{layout:A.layout,meta:$,type:j,id:A.id??crypto.randomUUID()}}),z=I(S),Y=new Map(K.map(A=>[A.id,A])),te=new Set;return K.reduce((A,$)=>{const j=z[$.id];if(!j)return A.push($),A;if(te.has(j.groupId))return A;te.add(j.groupId);const de=j.tileIdLabels.map(([se,pe])=>({id:se,label:pe,tile:Y.get(se)})).filter(({tile:se})=>!!se?.meta).map(({id:se,label:pe,tile:_e})=>({id:se,label:pe,definition:_e.meta})),ee=Y.get(de[0]?.id);return ee&&A.push({...ee,layout:j.layout,groupTiles:de}),A},[])},g=n.computed(()=>o.value.map(S=>B(S))),p=(S,K)=>{const z=S.groupTiles?.find(Y=>Y.id===K);return z&&z.id!==S.id?{...S,id:z.id,meta:z.definition}:S},_=(S,K)=>{i("edit-tile",p(S,K))},M=S=>S.type==="slottable"?!0:S.meta?.chart.type==="slottable",D=S=>S.type==="slottable",F=S=>{if(S.type==="slottable")return S.id;const K=S.meta?.chart;return K&&D(K)?K.id:void 0},v=(S,K,z)=>{const Y=a(K);try{const te=zg(p(S,z));Y.tiles.push(JSON.parse(JSON.stringify(te)))}catch(te){console.warn(te)}},P=(S,K,z)=>{const Y=S.groupTiles,te=Y?.some(A=>A.id===z)?z:S.id;if(Y&&Y.length>1){const A=a(K);A.tiles=A.tiles.filter($=>$.id!==te)}else d[K]?.removeWidget(S.id);b.delete(`${K}-${te}`)},V=()=>{b.clear(),c.value++},W=(S,K)=>{const z=a(K),Y=S.map($=>$.type==="slottable"?{id:$.id,type:$.type,layout:$.layout}:{id:$.id,type:$.type,layout:$.layout,definition:$.meta}),te=new Set(Y.map($=>$.id)),A=z.tiles.filter($=>$.id&&!te.has($.id)&&I(o.value[K])[$.id]);z.tiles=[...Y,...A].sort(k)},T=async()=>{if(C.value="scale(1)",await n.nextTick(),m.value){const{availWidth:S,availHeight:K}=window.screen,{width:z,height:Y}=m.value.getBoundingClientRect(),te=Math.min(K/Y,S/z);C.value=`scale(${te})`}},x=()=>{f.value&&(document.fullscreenElement?document.exitFullscreen():f.value.requestFullscreen())},q=n.ref(!1),L=n.computed(()=>N.value&&!q.value),G=()=>{q.value=document.fullscreenElement!==null,q.value&&T()},{editable:N,enrichedContext:ce,queryReady:ae,showTileActions:ue,timeSpec:Q}=he.useDashboardContext({globalFilters:n.computed(()=>[]),context:n.computed(()=>r.context),isFullscreen:q,preview:n.computed(()=>r.preview)}),J=S=>({...ce.value,filters:[...r.context.filters??[],...S.preset_filters??[]]});return e({refresh:V,toggleFullscreen:x,exportPdf:w,pdfExportState:U}),(S,K)=>{const z=n.resolveComponent("KAlert");return n.openBlock(),n.createElementBlock("div",{ref_key:"dashboardContainer",ref:f,class:n.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":q.value}]),onFullscreenchange:G},[n.createElementVNode("div",{ref_key:"layoutContainer",ref:m,class:"layout"},[n.unref(R)&&q.value?(n.openBlock(),n.createElementBlock("div",Pg,[n.renderSlot(S.$slots,"fullscreenHeader",{},void 0,!0)])):n.createCommentVNode("",!0),n.unref(R)?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:2},n.renderList(o.value,(Y,te)=>(n.openBlock(),n.createElementBlock("div",{key:`dash-${te}`,class:n.normalizeClass(["dashboard-boundary",{multiple:o.value.length>1}])},[Y.anchorId?(n.openBlock(),n.createElementBlock("a",{key:0,id:Y.anchorId},null,8,qg)):n.createCommentVNode("",!0),Y.title||Y.description?(n.openBlock(),n.createElementBlock("div",Hg,[Y.title?(n.openBlock(),n.createElementBlock("div",Gg,n.toDisplayString(Y.title),1)):n.createCommentVNode("",!0),Y.description?(n.openBlock(),n.createElementBlock("div",$g,n.toDisplayString(Y.description),1)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),(n.openBlock(),n.createBlock(Bg,{key:`layout-${L.value}`,ref_for:!0,ref:A=>h(te,A),"bottom-trim":o.value.length>1?4:0,columns:Y.definition.columns,editable:L.value,"tile-height":Y.definition.tile_height,tiles:g.value[te],onUpdateTiles:A=>W(A,te)},{tile:n.withCtx(({tile:A,fitToContent:$})=>[M(A)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["tile-container slottable-tile",{"fit-to-content":$}])},[n.renderSlot(S.$slots,F(A),{},void 0,!0)],2)):(n.openBlock(),n.createBlock(zr,{key:q.value?`${A.id}-tile`:`${A.id}-tile-fullscreen`,"refresh-counter":c.value,"onUpdate:refreshCounter":K[0]||(K[0]=j=>c.value=j),class:"tile-container",context:J(Y.definition),definition:A.meta,"fit-to-content":$,"group-tiles":A.groupTiles,height:A.layout.size.rows*(Y.definition.tile_height||n.unref(it))+parseInt(n.unref(Pi),10),"hide-actions":!n.unref(ue),"is-fullscreen":q.value,preview:r.preview,"query-ready":n.unref(ae),"tile-id":A.id,"tile-type":A.type,onDuplicateTile:(j,de)=>v(A,te,de),onEditTile:(j,de)=>_(A,de),onRemoveTile:(j,de)=>P(A,te,de),onTileLoaded:j=>O(A,te),onTileTimeRangeZoom:K[1]||(K[1]=j=>i("tile-time-range-zoom",j))},null,8,["refresh-counter","context","definition","fit-to-content","group-tiles","height","hide-actions","is-fullscreen","preview","query-ready","tile-id","tile-type","onDuplicateTile","onEditTile","onRemoveTile","onTileLoaded"]))]),_:2},1032,["bottom-trim","columns","editable","tile-height","tiles","onUpdateTiles"]))],2))),128)):(n.openBlock(),n.createBlock(z,{key:1,appearance:"danger"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(u).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-1df9740b"]]),Wg=n.defineComponent({__name:"DashboardTilePreview",props:{context:{},definition:{},globalFilters:{default:()=>[]},preview:{type:Boolean,default:!1}},emits:["chart-data","tile-time-range-zoom","tile-bounds-change"],setup(r,{expose:e,emit:t}){const i=n.useTemplateRef("root"),s=n.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=O=>{a("tile-time-range-zoom",O)},u=O=>{a("chart-data",O)},c=O=>{a("tile-bounds-change",O)},{i18n:d}=he.useI18n(),{enrichedContext:h,queryReady:f}=he.useDashboardContext({globalFilters:n.toRef(()=>r.globalFilters),context:n.toRef(()=>r.context),preview:n.computed(()=>r.preview)}),m=n.computed(()=>Ne(r.definition)),C=n.computed(()=>m.value?"columns"in r.definition.query&&!r.definition.query.columns?.length:!("metrics"in r.definition.query)||!r.definition.query.metrics||r.definition.query.metrics.length===0),b=n.ref(it);let R;n.onMounted(()=>{const O=i.value?.parentElement;O&&(b.value=O.getBoundingClientRect().height,R=new ResizeObserver(([E])=>{const{height:k}=E.contentRect;b.value=k}),R.observe(O))}),n.onUnmounted(()=>R?.disconnect());const w=n.ref(0);return e({refresh:()=>{w.value++},getExportData:()=>s.value?.getExportData()}),(O,E)=>{const k=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[C.value?(n.openBlock(),n.createBlock(k,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.title")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.description")),1)]),_:1})):(n.openBlock(),n.createBlock(zr,{key:1,ref:"dashboard-tile","refresh-counter":w.value,"onUpdate:refreshCounter":E[0]||(E[0]=I=>w.value=I),context:{...n.unref(h),editable:!1},definition:r.definition,height:b.value,"hide-actions":"",preview:r.preview,"query-ready":n.unref(f),"show-refresh":"","tile-id":n.unref(o),onChartData:u,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),Vg=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},Yg=r=>{if(r.type!=="chart"||Ne(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}}},Xg=(r,e=zt)=>{if(!r.length)return[];let t=0,i=0,s=0;const o=[];for(const a of r){const l=a.layout?.size?.cols??1,u=a.layout?.size?.rows??1;i+l>e&&(t+=s,i=0,s=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,s=Math.max(s,u)}return o},jg=(r,e)=>{if(e){const s=r.tiles.map(Yg);return{...r,tiles:s}}const t=r.tiles.map(Vg).filter(s=>s!==void 0),i=Xg(t,r.columns);return{...r,tiles:i}},Qg=Object.freeze(Object.defineProperty({__proto__:null,default:n.defineComponent({__name:"GeoMapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["bounds-change"],setup(r,{emit:e}){const t=r,i=n.ref(void 0),s=n.computed(()=>i.value?ci.exploreResultToCountryMetrics(i.value):{}),o=n.computed(()=>i.value?i.value?.meta.metric_names&&i.value.meta.metric_names[0]:""),a=n.computed(()=>t.query.limit!==void 0&&t.query.limit>0?t.query.limit:ne.COUNTRIES.length),l=n.computed(()=>{if(!t.query.filters?.find(({field:m,operator:C})=>m==="country_code"&&(C==="not_empty"||C==="empty"||C==="in"))){const m={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],m]}}return t.query}),u=n.computed(()=>{if(!i.value)return"";const f=i?.value?.meta.metric_units,m=i?.value?.meta?.metric_names;return f&&m&&f[m[0]]}),c=f=>{i.value=f},d=e,h=f=>{d("bounds-change",f)};return(f,m)=>(n.openBlock(),n.createBlock(Be,{context:r.context,"limit-override":a.value,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c},{default:n.withCtx(()=>[n.createVNode(n.unref(ci.AnalyticsGeoMap),{bounds:r.chartOptions.bounds,"country-metrics":s.value,"fit-to-country":r.chartOptions.fit_to_country,metric:o.value,"metric-unit":u.value,"with-legend":r.chartOptions.legend||!1,onBoundsChange:h},null,8,["bounds","country-metrics","fit-to-country","metric","metric-unit","with-legend"])]),_:1},8,["context","limit-override","query","query-ready","refresh-counter"]))}})},Symbol.toStringTag,{value:"Module"}));ie.CELLS_PER_ROW=rt,ie.CP_ID_TOKEN=$i,ie.CsvExportModal=or,ie.DASHBOARD_COLS=zt,ie.DEFAULT_TILE_HEIGHT=it,ie.DEFAULT_TILE_REFRESH_INTERVAL_MS=Wi,ie.DashboardRenderer=Fg,ie.DashboardTilePreview=Wg,ie.ENTITY_ID_TOKEN=Pt,ie.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Yi,ie.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Vi,ie.INJECT_DASHBOARD_COORDINATOR=Gi,ie.INJECT_QUERY_PROVIDER=Ie,ie.TIMEFRAME_TOKEN=Fi,ie.configureAllowedDefinition=jg,ie.getTimeRangeDurationMs=$t,ie.isTimeRangeUnsupported=Ft,ie.isTreemapCompatible=ti,ie.limitTimeRange=Wt,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})}));
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")||X.addRemoveCB)&&(X.addRemoveCB?i=X.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),X.init(t,i)}static registerEngine(e){X.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=y.createDiv([this.opts.placeholderClass,be.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 s=t.columnOpts?.breakpoints;const o=t;if(o.oneColumnModeDomSort&&(delete o.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),o.oneColumnSize||o.disableOneColumnMode===!1){const h=o.oneColumnSize||768;delete o.oneColumnSize,delete o.disableOneColumnMode,t.columnOpts=t.columnOpts||{},s=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=s.find(m=>m.c===1);f?f.w=h:(f={c:1,w:h},s.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,s=void 0):a.columnMax=a.columnMax||12),s?.length>1&&s.sort((h,f)=>(f.w||0)-(h.w||0));const l={...y.cloneDeep(be),column:y.toNumber(e.getAttribute("gs-column"))||be.column,minRow:i||y.toNumber(e.getAttribute("gs-min-row"))||be.minRow,maxRow:i||y.toNumber(e.getAttribute("gs-max-row"))||be.maxRow,staticGrid:y.toBool(e.getAttribute("gs-static"))||be.staticGrid,sizeToContent:y.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||be.draggable.handle},removableOptions:{accept:t.itemClass||be.removableOptions.accept,decline:be.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("."+be.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!==be.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=ke),this._styleSheetClass="gs-id-"+Ae._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const d=t.engineClass||X.engineClass||Ae;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 C=m.el;C&&(m._removeDOM?(C&&C.remove(),delete m._removeDOM):this._writePosAttr(C,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&&!Z.pauseDrag&&(Z.pauseDrag=!0),t.draggable?.pause!==void 0&&(Z.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:X.addRemoveCB?t=X.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const s=this._readAttr(t);return y.defaults(e,s),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(([s])=>{s.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,X.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):X.renderCB(i,e),t}makeSubGrid(e,t,i,s=!0){let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),o.subGrid?.el)return o.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;t=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(s&&(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),X.addRemoveCB?d=X.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,C=o.h+i.h,b=o.el.style;b.transition="none",this.update(o.el,{w:m,h:C}),setTimeout(()=>b.transition=null)}const f=o.subGrid=X.addGrid(c,t);return i?._moving&&(f._isTemp=!0),u&&(f._autoColumn=!0),s&&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=X.saveCB){const s=this.engine.save(e,i);if(s.forEach(o=>{if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a?.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,o.subGrid?.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=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,be),o.children=s,o}return s}load(e,t=X.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 s=0;e.forEach(c=>{s=Math.max(s,(c.x||0)+c.w)}),s>this.engine.defaultColumn&&(this.engine.defaultColumn=s),s>i&&this.engine.cacheLayout(e,s,!0);const o=X.addRemoveCB;typeof t=="function"&&(X.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)||(X.addRemoveCB&&X.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?X.addRemoveCB=o:delete X.addRemoveCB,l&&this.opts?.animate&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const s=y.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/s)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e,t=!0){if(t&&e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const s=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+s}const i=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 s=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(s/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&s<=e.breakpoints[o].w;)i=e.breakpoints[o++].c||t}if(i!==t){const o=e.breakpoints?.find(a=>a.c===i);return this.column(i,o?.layout||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+e),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),delete this.parentGridNode?.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let s;t?s={top:i.top+document.documentElement.scrollTop,left:i.left}:s={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-s.left,a=e.top-s.top,l=i.width/this.getColumn(),u=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,s){return this.engine.isAreaEmpty(e,t,i,s)}makeWidget(e,t){const i=X.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const s=i.gridstackNode;this._updateContainerHeight(),s.subGridOpts&&this.makeSubGrid(i,s.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(s=>this.on(s,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=s=>t(s):this._gsEventHandler[e]=s=>{s.detail&&t(s,s.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(X.getElements(e).forEach(s=>{if(s.parentElement&&s.parentElement!==this.el)return;let o=s.gridstackNode;o||(o=this.engine.nodes.find(a=>s===a.el)),o&&(t&&X.addRemoveCB&&X.addRemoveCB(this.el,o,!1,!1),delete s.gridstackNode,this._removeDD(s),this.engine.removeNode(o,t,i),t&&s.parentElement&&s.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&X.addRemoveCB&&X.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(s=>{this.prepareDragDrop(s.el),s.subGrid&&i&&s.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){const t=this.opts;return e.acceptWidgets!==void 0&&this._setupAcceptWidget(),e.animate!==void 0&&this.setAnimation(),e.cellHeight&&(this.cellHeight(e.cellHeight,!0),delete e.cellHeight),e.class&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),this.el.classList.add(e.class)),typeof e.column=="number"&&!e.columnOpts&&(this.column(e.column),delete e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0&&(t.minRow=t.maxRow=e.row),e.children?.length&&(this.load(e.children),delete e.children),this.opts={...this.opts,...e},this}update(e,t){return X.getElements(e).forEach(i=>{const s=i?.gridstackNode;if(!s)return;const o={...y.copyPos({},s),...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]!==s[d])&&(l={},a.forEach(d=>{l[d]=o[d]!==void 0?o[d]:s[d],delete o[d]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(s.content=o.content,X.renderCB(d,o),s.subGrid?.el&&(d.appendChild(s.subGrid.el),s.subGrid.opts.styleInHead||s.subGrid._updateStyles(!0))),delete o.content}let u=!1,c=!1;for(const d in o)d[0]!=="_"&&s[d]!==o[d]&&(s[d]=o[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(y.sanitizeMinMax(s),l){const d=l.w!==void 0&&l.w!==s.w;this.moveNode(s,l),d&&s.subGrid?s.subGrid.onResize(this.hasAnimationCSS()?s.w:void 0):this.resizeToContentCheck(d,s),delete s._orig}(l||u)&&this._writeAttr(i,s),c&&this.prepareDragDrop(s.el)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const s=i.getCellHeight(!0);if(!s)return;let o=t.h?t.h*s:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector(X.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=t.h?t.h*s-l:a.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const f=t.subGrid.el.getBoundingClientRect(),m=t.subGrid.el.parentElement.getBoundingClientRect();c+=f.top-m.top}else{if(t.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${X.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||u}}if(u===c)return;o+=c-u;let d=Math.ceil(o/s);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&d>h&&(d=h,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){X.resizeToContentCB?X.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return X.getElements(e).forEach(i=>{const s=i.gridstackNode;if(!y.canBeRotated(s))return;const o={w:s.h,h:s.w,minH:s.minW,minW:s.minH,maxH:s.maxW,maxW:s.maxH};if(t){const l=t.left>0?Math.floor(t.left/this.cellWidth()):0,u=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=s.x+l-(s.h-(u+1)),o.y=s.y+u-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=s._orig;this.update(i,o),s._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=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,s={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(s)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const e=this.opts.styleInHead?void 0:this.el.parentNode;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,s=this.opts.cellHeightUnit,o=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const a=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=y.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,y.addCSSRule(this._styles,o,`height: ${i}${s}`);const l=this.opts.marginTop+this.opts.marginUnit,u=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,d=this.opts.marginLeft+this.opts.marginUnit,h=`${o} > .grid-stack-item-content`,f=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;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+s;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,s=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=y.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===s){const a=Math.floor(o.h/i);t<a&&(t=a)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+s),e&&!e.grid.engine.batchMode&&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(be.itemClass,this.opts.itemClass);const s=y.shouldSizeToContent(i);return s?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),s&&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 s in i)t[s]?e.setAttribute(i[s],String(t[s])):e.removeAttribute(i[s]);return this}_readAttr(e,t=!0){const i={};i.x=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 s=e.getAttribute("gs-size-to-content");s&&(s==="true"||s==="false"?i.sizeToContent=y.toBool(s):i.sizeToContent=parseInt(s,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(s=>{y.shouldSizeToContent(s)&&this.resizeToContentCBCheck(s.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=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 X.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 Ee}static setupDragIn(e,t,i,s=document){t?.pause!==void 0&&(Z.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?y.getElements(e,s):e).forEach((a,l)=>{Ee.isDraggable(a)||Ee.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:(X.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noMove:s.noMove=!0,this.prepareDragDrop(s.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(X.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noResize:s.noResize=!0,this.prepareDragDrop(s.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&X._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Ee.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 Ee.droppable(this.el,"destroy"),this;let e,t;const i=(s,o,a)=>{a=a||o;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=a.getBoundingClientRect();a.style.left=f.x+(this.dragTransform.xScale-1)*(s.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(s.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:u,left:c}=a.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;const h={position:{top:u*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/t)),l.y=Math.max(0,Math.round(u/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){Ee.off(o,"drag");return}l._willFitPos&&(y.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,s,h,l,t,e)}else this._dragOrResize(a,s,h,l,t,e)};return Ee.droppable(this.el,{accept:s=>{const o=s.gridstackNode||this._readAttr(s,!1);if(o?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(s);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=s.matches(l)}if(a&&o&&this.opts.maxRow){const l={w:o.w,h:o.h,minW:o.minW,minH:o.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(s,o,a)=>{let l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(o,a),a=a||o,t=this.cellWidth(),e=this.getCellHeight(!0),!l){const d=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(d){try{l=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const u=l.w||Math.round(a.offsetWidth/t)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=l),o.gridstackNode=l={...l,w:u,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=u,l.h=c,l._temporaryRemoved=!0),X._itemRemoving(l.el,!1),Ee.on(o,"drag",i),i(s,o,a),!1}).on(this.el,"dropout",(s,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(o,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(s,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const u=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const d=u&&this.opts.animate;d&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,u&&h?.grid&&h.grid!==this){const m=h.grid;m.engine.removeNodeFromLayoutCache(h),m.engine.removedNodes.push(h),m._triggerRemoveEvent()._triggerChangeEvent(),m.parentGridNode&&!m.engine.nodes.length&&m.opts.subGridDynamic&&m.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,Ee.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||X.addRemoveCB)?(delete l.el,o=this.addWidget(l)):(this._prepareElement(o,!0,l),this.el.appendChild(o),this.resizeToContentCheck(!1,l),f&&(f.parentGridNode=l,f.opts.styleInHead||f._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...s,type:"dropped"},h&&h.grid?h:void 0,l),d&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Ee.isDroppable(e)&&Ee.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>X._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>X._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const s=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||s&&o;if((t||a)&&(i._initDD&&(this._removeDD(e),delete i._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let l,u;const c=(f,m)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,f,m,i,l,u)},d=(f,m)=>{this._dragOrResize(e,f,m,i,l,u)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const m=i.w!==i._orig.w,C=f.target;if(!(!C.gridstackNode||C.gridstackNode.grid!==this)){if(i.el=C,i._isAboutToRemove){const b=e.gridstackNode.grid;b._gsEventHandler[f.type]&&b._gsEventHandler[f.type](f,C),b.engine.nodes.push(i),b.removeWidget(e,!0,!0)}else y.removePositioningStyles(C),i._temporaryRemoved?(y.copyPos(i,i._orig),this._writePosAttr(C,i),this.engine.addNode(i)):this._writePosAttr(C,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,C);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))}};Ee.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return Ee.draggable(e,s?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,s,o,a){if(this.engine.cleanNodes().beginUpdate(s),this._writePosAttr(this.placeholder,s),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=s,s.grid?.el)this.dragTransform=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(s.el=this.placeholder,s._lastUiPosition=i.position,s._prevYPix=i.position.top,s._moving=t.type==="dragstart",delete s._lastTried,t.type==="dropover"&&s._temporaryRemoved&&(this.engine.addNode(s),s._moving=!0),this.engine.cacheRects(o,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-s.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-s.y;Ee.resizable(e,"option","minWidth",o*Math.min(s.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(s.minH||1,u)).resizable(e,"option","maxWidth",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,s.x+s.w)).resizable(e,"option","maxHeight",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,s.y+s.h))}}_dragOrResize(e,t,i,s,o,a){const l={...s._orig};let u,c=this.opts.marginLeft,d=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const m=Math.round(a*.1),C=Math.round(o*.1);if(c=Math.min(c,C),d=Math.min(d,C),h=Math.min(h,m),f=Math.min(f,m),t.type==="drag"){if(s._temporaryRemoved)return;const R=i.position.top-s._prevYPix;s._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&y.updateScrollPosition(e,i.position,R);const w=i.position.left+(i.position.left>s._lastUiPosition.left?-d:c),U=i.position.top+(i.position.top>s._lastUiPosition.top?-f:h);l.x=Math.round(w/o),l.y=Math.round(U/a);const O=this._extraDragRow;if(this.engine.collide(s,l)){const E=this.getRow();let k=Math.max(0,l.y+s.h-E);this.opts.maxRow&&E+k>this.opts.maxRow&&(k=Math.max(0,this.opts.maxRow-E)),this._extraDragRow=k}else this._extraDragRow=0;if(this._extraDragRow!==O&&this._updateContainerHeight(),s.x===l.x&&s.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),s.w===l.w&&s.h===l.h)||s._lastTried&&s._lastTried.w===l.w&&s._lastTried.h===l.h)return;const R=i.position.left+c,w=i.position.top+h;l.x=Math.round(R/o),l.y=Math.round(w/a),u=!0}s._event=t,s._lastTried=l;const b={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:s.w*o)-c-d,h:(i.size?i.size.height:s.h*a)-h-f};if(this.engine.moveNodeCheck(s,{...l,cellWidth:o,cellHeight:a,rect:b,resizing:u})){s._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,d,f,c),delete s._skipDown,u&&s.subGrid&&s.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const R=t.target;s._sidebarOrig||this._writePosAttr(R,s),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,R)}}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,Ee.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const s=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=s,this.opts.removable===!0&&X._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return xg(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}X.renderCB=(r,e)=>{r&&e?.content&&(r.textContent=e.content)},X.resizeToContentParent=".grid-stack-item-content",X.Utils=y,X.Engine=Ae,X.GDRev="11.5.1";const Ng=(r,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),u=o.layout.size.rows===1&&!!o.layout.size.fit_to_content;t=Math.max(t,a+o.layout.size.rows),l===void 0?i.set(a,u):i.set(a,l&&u)});const s=[];for(let o=0;o<t;o++)i.get(o)?s.push("auto"):s.push(`${r}px`);return s},Gr=(r,e,t)=>e.get(`${r.id}`)??r.layout.size.rows*t,Ag=(r,e,t,i)=>e.map((s,o)=>{if(s!=="auto")return i;const a=r.filter(l=>l.layout.position.row===o);return Math.max(...a.map(l=>Gr(l,t,i)))}),Lg=(r,e,t)=>{const i=[...r].sort((a,l)=>a.layout.position.row-l.layout.position.row||a.layout.position.col-l.layout.position.col),s=new Map;let o=0;return i.forEach(a=>{const l=Gr(a,e,t);s.set(`${a.id}`,{x:0,y:o,w:1,h:l}),o+=l}),s},Ug=(r,e,t,{cellsPerRow:i,columns:s})=>{if(s===1)return Lg(r,t,i);const o=[0];return Ag(r,e,t,i).forEach(a=>{o.push(o[o.length-1]+a)}),new Map(r.map(a=>{const{position:l,size:u}=a.layout,c=o[l.row],d=o[l.row+u.rows];return[`${a.id}`,{x:l.col,y:c,w:u.cols,h:d-c}]}))},Mg=["data-id","data-testid"],Kg={class:"grid-stack-item-content"},Bg=De(n.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:it},columns:{default:zt},editable:{type:Boolean,default:!1},bottomTrim:{default:0}},emits:["update-tiles"],setup(r,{expose:e,emit:t}){const i=r,s=t,o=n.ref(null),a=n.ref(new Map(i.tiles.map(T=>[`${T.id}`,T])));let l=null,u=!1;const c=T=>`[data-id="${T}"]`,d=n.computed(()=>Ng(i.tileHeight,i.tiles)),h=T=>!i.editable&&d.value[T.layout.position.row]==="auto",f=()=>i.editable?1:rt,m=parseInt(fa,10)/2,C=n.ref(new Map),b=n.ref(new Map),R=n.ref(!1),w=T=>R.value||h(T),U=n.computed(()=>Ug(i.tiles,d.value,C.value,{cellsPerRow:rt,columns:R.value?1:i.columns})),O=n.computed(()=>{if(i.editable)return 0;const x=(R.value?[...i.tiles].sort((N,ce)=>N.layout.position.row-ce.layout.position.row||N.layout.position.col-ce.layout.position.col).slice(-1):i.tiles.filter(N=>N.layout.position.row===d.value.length-1)).filter(N=>C.value.has(`${N.id}`));if(!x.length||!x.every(w))return 0;const q=Math.max(...x.map(N=>C.value.get(`${N.id}`))),L=Math.max(...x.map(N=>b.value.get(`${N.id}`))),G=q*(i.tileHeight/rt)-(L+2*m);return Math.max(0,Math.round(G*100)/100)}),E=T=>i.editable?{id:`${T.id}`,x:T.layout.position.col,y:T.layout.position.row,w:T.layout.size.cols,h:T.layout.size.rows}:{id:`${T.id}`,...U.value.get(`${T.id}`)},k=()=>({margin:m,column:i.columns,cellHeight:i.tileHeight/f(),resizable:{handles:"se, sw"},handle:".tile-header",staticGrid:!i.editable,float:!i.editable}),I=T=>T.map(x=>{const q=a.value.get(`${x.el?.getAttribute("data-id")}`);if(q)return{...q,layout:{position:{col:Number(x.x),row:Number(x.y)},size:{...q.layout.size,cols:Number(x.w),rows:Number(x.h)}}}}).filter(x=>x!==void 0),B=(T,x)=>{l&&!u&&(I(x).forEach(L=>{a.value.set(`${L.id}`,L)}),s("update-tiles",Array.from(a.value.values())))},g=(T,x)=>{x.forEach(q=>{a.value.delete(`${q.el?.getAttribute("data-id")}`)}),s("update-tiles",Array.from(a.value.values()))},p=T=>o.value?.querySelector(`${c(T)} > .grid-stack-item-content > :first-child`),_=T=>Math.ceil((T+2*m)/(i.tileHeight/rt)),M=()=>{const T=new Map,x=new Map;i.tiles.filter(w).forEach(G=>{const N=p(G.id);if(N){const{height:ce}=N.getBoundingClientRect();T.set(`${G.id}`,_(ce)),x.set(`${G.id}`,ce)}}),(T.size!==C.value.size||[...T].some(([G,N])=>C.value.get(G)!==N))&&(C.value=T),(x.size!==b.value.size||[...x].some(([G,N])=>b.value.get(G)!==N))&&(b.value=x)},D=new ResizeObserver(()=>window.requestAnimationFrame(M)),F=()=>{D.disconnect(),i.tiles.filter(w).forEach(T=>{const x=p(T.id);x&&D.observe(x)})},v=new ResizeObserver(([T])=>{R.value=!i.editable&&T.contentRect.width<=parseInt(da,10)}),P=(T,x)=>{const q=T.x===x.x&&T.y===x.y,L=T.w===x.w&&T.h===x.h;return q&&L},V=()=>{if(!l)return;const T=new Set(i.tiles.map(L=>`${L.id}`)),x=new Map(l.engine.nodes.map(L=>[`${L.id}`,L]));x.forEach((L,G)=>{!T.has(G)&&L.el&&(l.removeWidget(L.el,!1,!1),a.value.delete(G))});const q=i.tiles.filter(L=>x.has(`${L.id}`)).map(E);u=!0,q.some(L=>!P(x.get(`${L.id}`),L))&&l.load(q,!1),u=!1,i.tiles.filter(L=>!x.has(`${L.id}`)).forEach(L=>{l.makeWidget(c(L.id),{...E(L),autoPosition:i.editable})}),F()};n.onMounted(()=>{o.value&&(l=X.init(k(),o.value),l.batchUpdate(),i.tiles.forEach(T=>l.makeWidget(c(T.id),E(T))),l.batchUpdate(!1),F(),v.observe(o.value),i.editable&&(l.on("change",B),l.on("added",B),l.on("removed",g)))}),n.onUnmounted(()=>{D.disconnect(),v.disconnect(),l&&l.destroy(!1)});const W=T=>{if(l&&o.value){const x=o.value.querySelector(c(T));x&&l.removeWidget(x)}};return n.watch(R,T=>l?.column(T?1:i.columns,"none")),n.watch(()=>[i.tiles.map(T=>[T.id,T.layout]),U.value],V,{deep:!0,flush:"post"}),n.watchEffect(()=>{i.tiles.forEach(T=>{a.value.set(`${T.id}`,T)})}),e({removeWidget:W}),(T,x)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack",style:n.normalizeStyle({marginBottom:`-${r.bottomTrim+O.value}px`})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.tiles,q=>(n.openBlock(),n.createElementBlock("div",{key:q.id,"data-id":`${q.id}`,"data-testid":`grid-stack-item-${q.id}`},[n.createElementVNode("div",Kg,[n.renderSlot(T.$slots,"tile",{fitToContent:h(q),tile:q},void 0,!0)])],8,Mg))),128))],4))}}),[["__scopeId","data-v-8a2b0f6f"]]),zg=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}},Pg={key:0,class:"fullscreen-header"},qg=["id"],Hg={key:1,class:"boundary-header"},Gg={key:0,class:"boundary-title"},$g={key:1,class:"boundary-description"},Fg=De(n.defineComponent({__name:"DashboardRenderer",props:n.mergeModels({context:{},preview:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:n.mergeModels(["edit-tile","tile-time-range-zoom","tiles-loaded"],["update:modelValue"]),setup(r,{expose:e,emit:t}){if(n.useCssVars(S=>({v46ff5d3f:C.value})),r.context.disableCoordination!==!0){const S=xs();n.provide($i,S)}const i=t,s=n.useModel(r,"modelValue"),o=n.computed(()=>Array.isArray(s.value)?s.value:[{definition:s.value}]),a=S=>o.value[S].definition,l=n.computed(()=>{const S=K=>K.type==="slottable"||"definition"in K&&K.definition?.chart?.type==="slottable";return o.value.reduce((K,z)=>{const Y=I(z),te=new Set;return z.definition.tiles.forEach(A=>{if(S(A))return;const $=A.id?Y[A.id]:void 0;$?te.has($.groupId)||(te.add($.groupId),K++):K++}),K},0)}),{i18n:u}=he.useI18n(),c=n.ref(0),d=[],h=(S,K)=>{d[S]=K},f=n.ref(),m=n.ref(),C=n.ref("scale(1)"),b=new Set,R=n.inject(Ie);R||(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")),he.useRequestQueue();const{exportPdf:w,exportState:U}=he.useExportPdf(m),O=(S,K)=>{b.add(`${K}-${S.id}`),b.size>=l.value&&i("tiles-loaded",!0)},E=n.computed(()=>{const K=`renderer.trendRange.${Q.value.type==="absolute"?"custom":Q.value.time_range}`;return u.te(K)?u.t(K):""}),k=(S,K)=>{const z=S.layout.position.row-K.layout.position.row;return z!==0?z:S.layout.position.col-K.layout.position.col},I=S=>{const K={};return S.tileGroups?.forEach(z=>{z.tileIdLabels.forEach(([Y])=>{K[Y]=z})}),K},B=S=>{const K=S.definition.tiles.map(A=>{if(N.value&&!A.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",A),A.type==="slottable")return{layout:A.layout,type:A.type,id:A.id??crypto.randomUUID()};let $=A.definition;const j=A.type??"chart",de=Ha($,E.value);return de!==$.header_description&&($={...$,header_description:de}),{layout:A.layout,meta:$,type:j,id:A.id??crypto.randomUUID()}}),z=I(S),Y=new Map(K.map(A=>[A.id,A])),te=new Set;return K.reduce((A,$)=>{const j=z[$.id];if(!j)return A.push($),A;if(te.has(j.groupId))return A;te.add(j.groupId);const de=j.tileIdLabels.map(([se,pe])=>({id:se,label:pe,tile:Y.get(se)})).filter(({tile:se})=>!!se?.meta).map(({id:se,label:pe,tile:_e})=>({id:se,label:pe,definition:_e.meta})),ee=Y.get(de[0]?.id);return ee&&A.push({...ee,layout:j.layout,groupTiles:de}),A},[])},g=n.computed(()=>o.value.map(S=>B(S))),p=(S,K)=>{const z=S.groupTiles?.find(Y=>Y.id===K);return z&&z.id!==S.id?{...S,id:z.id,meta:z.definition}:S},_=(S,K)=>{i("edit-tile",p(S,K))},M=S=>S.type==="slottable"?!0:S.meta?.chart.type==="slottable",D=S=>S.type==="slottable",F=S=>{if(S.type==="slottable")return S.id;const K=S.meta?.chart;return K&&D(K)?K.id:void 0},v=(S,K,z)=>{const Y=a(K);try{const te=zg(p(S,z));Y.tiles.push(JSON.parse(JSON.stringify(te)))}catch(te){console.warn(te)}},P=(S,K,z)=>{const Y=S.groupTiles,te=Y?.some(A=>A.id===z)?z:S.id;if(Y&&Y.length>1){const A=a(K);A.tiles=A.tiles.filter($=>$.id!==te)}else d[K]?.removeWidget(S.id);b.delete(`${K}-${te}`)},V=()=>{b.clear(),c.value++},W=(S,K)=>{const z=a(K),Y=S.map($=>$.type==="slottable"?{id:$.id,type:$.type,layout:$.layout}:{id:$.id,type:$.type,layout:$.layout,definition:$.meta}),te=new Set(Y.map($=>$.id)),A=z.tiles.filter($=>$.id&&!te.has($.id)&&I(o.value[K])[$.id]);z.tiles=[...Y,...A].sort(k)},T=async()=>{if(C.value="scale(1)",await n.nextTick(),m.value){const{availWidth:S,availHeight:K}=window.screen,{width:z,height:Y}=m.value.getBoundingClientRect(),te=Math.min(K/Y,S/z);C.value=`scale(${te})`}},x=()=>{f.value&&(document.fullscreenElement?document.exitFullscreen():f.value.requestFullscreen())},q=n.ref(!1),L=n.computed(()=>N.value&&!q.value),G=()=>{q.value=document.fullscreenElement!==null,q.value&&T()},{editable:N,enrichedContext:ce,queryReady:ae,showTileActions:ue,timeSpec:Q}=he.useDashboardContext({globalFilters:n.computed(()=>[]),context:n.computed(()=>r.context),isFullscreen:q,preview:n.computed(()=>r.preview)}),J=S=>({...ce.value,filters:[...r.context.filters??[],...S.preset_filters??[]]});return e({refresh:V,toggleFullscreen:x,exportPdf:w,pdfExportState:U}),(S,K)=>{const z=n.resolveComponent("KAlert");return n.openBlock(),n.createElementBlock("div",{ref_key:"dashboardContainer",ref:f,class:n.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":q.value}]),onFullscreenchange:G},[n.createElementVNode("div",{ref_key:"layoutContainer",ref:m,class:"layout"},[n.unref(R)&&q.value?(n.openBlock(),n.createElementBlock("div",Pg,[n.renderSlot(S.$slots,"fullscreenHeader",{},void 0,!0)])):n.createCommentVNode("",!0),n.unref(R)?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:2},n.renderList(o.value,(Y,te)=>(n.openBlock(),n.createElementBlock("div",{key:`dash-${te}`,class:n.normalizeClass(["dashboard-boundary",{multiple:o.value.length>1}])},[Y.anchorId?(n.openBlock(),n.createElementBlock("a",{key:0,id:Y.anchorId},null,8,qg)):n.createCommentVNode("",!0),Y.title||Y.description?(n.openBlock(),n.createElementBlock("div",Hg,[Y.title?(n.openBlock(),n.createElementBlock("div",Gg,n.toDisplayString(Y.title),1)):n.createCommentVNode("",!0),Y.description?(n.openBlock(),n.createElementBlock("div",$g,n.toDisplayString(Y.description),1)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),(n.openBlock(),n.createBlock(Bg,{key:`layout-${L.value}`,ref_for:!0,ref:A=>h(te,A),"bottom-trim":o.value.length>1?4:0,columns:Y.definition.columns,editable:L.value,"tile-height":Y.definition.tile_height,tiles:g.value[te],onUpdateTiles:A=>W(A,te)},{tile:n.withCtx(({tile:A,fitToContent:$})=>[M(A)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["tile-container slottable-tile",{"fit-to-content":$}])},[n.renderSlot(S.$slots,F(A),{},void 0,!0)],2)):(n.openBlock(),n.createBlock(zr,{key:q.value?`${A.id}-tile`:`${A.id}-tile-fullscreen`,"refresh-counter":c.value,"onUpdate:refreshCounter":K[0]||(K[0]=j=>c.value=j),class:"tile-container",context:J(Y.definition),definition:A.meta,"fit-to-content":$,"group-tiles":A.groupTiles,height:A.layout.size.rows*(Y.definition.tile_height||n.unref(it))+parseInt(n.unref(qi),10),"hide-actions":!n.unref(ue),"is-fullscreen":q.value,preview:r.preview,"query-ready":n.unref(ae),"tile-id":A.id,"tile-type":A.type,onDuplicateTile:(j,de)=>v(A,te,de),onEditTile:(j,de)=>_(A,de),onRemoveTile:(j,de)=>P(A,te,de),onTileLoaded:j=>O(A,te),onTileTimeRangeZoom:K[1]||(K[1]=j=>i("tile-time-range-zoom",j))},null,8,["refresh-counter","context","definition","fit-to-content","group-tiles","height","hide-actions","is-fullscreen","preview","query-ready","tile-id","tile-type","onDuplicateTile","onEditTile","onRemoveTile","onTileLoaded"]))]),_:2},1032,["bottom-trim","columns","editable","tile-height","tiles","onUpdateTiles"]))],2))),128)):(n.openBlock(),n.createBlock(z,{key:1,appearance:"danger"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(u).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-1df9740b"]]),Wg=n.defineComponent({__name:"DashboardTilePreview",props:{context:{},definition:{},globalFilters:{default:()=>[]},preview:{type:Boolean,default:!1}},emits:["chart-data","tile-time-range-zoom","tile-bounds-change"],setup(r,{expose:e,emit:t}){const i=n.useTemplateRef("root"),s=n.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=O=>{a("tile-time-range-zoom",O)},u=O=>{a("chart-data",O)},c=O=>{a("tile-bounds-change",O)},{i18n:d}=he.useI18n(),{enrichedContext:h,queryReady:f}=he.useDashboardContext({globalFilters:n.toRef(()=>r.globalFilters),context:n.toRef(()=>r.context),preview:n.computed(()=>r.preview)}),m=n.computed(()=>Ne(r.definition)),C=n.computed(()=>m.value?"columns"in r.definition.query&&!r.definition.query.columns?.length:!("metrics"in r.definition.query)||!r.definition.query.metrics||r.definition.query.metrics.length===0),b=n.ref(it);let R;n.onMounted(()=>{const O=i.value?.parentElement;O&&(b.value=O.getBoundingClientRect().height,R=new ResizeObserver(([E])=>{const{height:k}=E.contentRect;b.value=k}),R.observe(O))}),n.onUnmounted(()=>R?.disconnect());const w=n.ref(0);return e({refresh:()=>{w.value++},getExportData:()=>s.value?.getExportData()}),(O,E)=>{const k=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[C.value?(n.openBlock(),n.createBlock(k,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.title")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.description")),1)]),_:1})):(n.openBlock(),n.createBlock(zr,{key:1,ref:"dashboard-tile","refresh-counter":w.value,"onUpdate:refreshCounter":E[0]||(E[0]=I=>w.value=I),context:{...n.unref(h),editable:!1},definition:r.definition,height:b.value,"hide-actions":"",preview:r.preview,"query-ready":n.unref(f),"show-refresh":"","tile-id":n.unref(o),onChartData:u,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),Vg=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},Yg=r=>{if(r.type!=="chart"||Ne(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}}},Xg=(r,e=zt)=>{if(!r.length)return[];let t=0,i=0,s=0;const o=[];for(const a of r){const l=a.layout?.size?.cols??1,u=a.layout?.size?.rows??1;i+l>e&&(t+=s,i=0,s=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,s=Math.max(s,u)}return o},jg=(r,e)=>{if(e){const s=r.tiles.map(Yg);return{...r,tiles:s}}const t=r.tiles.map(Vg).filter(s=>s!==void 0),i=Xg(t,r.columns);return{...r,tiles:i}},Qg=Object.freeze(Object.defineProperty({__proto__:null,default:n.defineComponent({__name:"GeoMapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["bounds-change"],setup(r,{emit:e}){const t=r,i=n.ref(void 0),s=n.computed(()=>i.value?ui.exploreResultToCountryMetrics(i.value):{}),o=n.computed(()=>i.value?i.value?.meta.metric_names&&i.value.meta.metric_names[0]:""),a=n.computed(()=>t.query.limit!==void 0&&t.query.limit>0?t.query.limit:ne.COUNTRIES.length),l=n.computed(()=>{if(!t.query.filters?.find(({field:m,operator:C})=>m==="country_code"&&(C==="not_empty"||C==="empty"||C==="in"))){const m={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],m]}}return t.query}),u=n.computed(()=>{if(!i.value)return"";const f=i?.value?.meta.metric_units,m=i?.value?.meta?.metric_names;return f&&m&&f[m[0]]}),c=f=>{i.value=f},d=e,h=f=>{d("bounds-change",f)};return(f,m)=>(n.openBlock(),n.createBlock(Be,{context:r.context,"limit-override":a.value,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c},{default:n.withCtx(()=>[n.createVNode(n.unref(ui.AnalyticsGeoMap),{bounds:r.chartOptions.bounds,"country-metrics":s.value,"fit-to-country":r.chartOptions.fit_to_country,metric:o.value,"metric-unit":u.value,"with-legend":r.chartOptions.legend||!1,onBoundsChange:h},null,8,["bounds","country-metrics","fit-to-country","metric","metric-unit","with-legend"])]),_:1},8,["context","limit-override","query","query-ready","refresh-counter"]))}})},Symbol.toStringTag,{value:"Module"}));ie.CELLS_PER_ROW=rt,ie.CP_ID_TOKEN=Fi,ie.CsvExportModal=or,ie.DASHBOARD_COLS=zt,ie.DEFAULT_TILE_HEIGHT=it,ie.DEFAULT_TILE_REFRESH_INTERVAL_MS=Vi,ie.DashboardRenderer=Fg,ie.DashboardTilePreview=Wg,ie.ENTITY_ID_TOKEN=Pt,ie.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Xi,ie.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Yi,ie.INJECT_DASHBOARD_COORDINATOR=$i,ie.INJECT_QUERY_PROVIDER=Ie,ie.TIMEFRAME_TOKEN=Wi,ie.configureAllowedDefinition=jg,ie.getTimeRangeDurationMs=$t,ie.isTimeRangeUnsupported=Ft,ie.isTreemapCompatible=ii,ie.limitTimeRange=Wt,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})}));