@kong-ui-public/dashboard-renderer 6.4.3 → 6.4.4
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.
|
@@ -661,7 +661,8 @@ const qi = () => {
|
|
|
661
661
|
}
|
|
662
662
|
}, {
|
|
663
663
|
refreshInterval: t.context.refreshInterval,
|
|
664
|
-
revalidateOnFocus: !1
|
|
664
|
+
revalidateOnFocus: !1,
|
|
665
|
+
shouldRetryOnError: !1
|
|
665
666
|
}), { state: f, swrvState: p } = yi(h, l, a), g = U(null), v = N(() => f.value === p.ERROR || !!g.value), m = N(() => !t.queryReady || f.value === p.PENDING);
|
|
666
667
|
return Ye(h, (T) => {
|
|
667
668
|
T && i("chart-data", T);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(E,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong-ui-public/analytics-chart"),require("swrv"),require("axios"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong-ui-public/analytics-metric-provider"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/analytics-utilities","@kong-ui-public/analytics-chart","swrv","axios","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong-ui-public/analytics-metric-provider","@kong/icons"],o):(E=typeof globalThis<"u"?globalThis:E||self,o(E["kong-ui-public-dashboard-renderer"]={},E.Vue,E["kong-ui-public-analytics-utilities"],E["kong-ui-public-analytics-chart"],E.swrv,E.axios,E["kong-ui-public-i18n"],E["kong-ui-public-analytics-config-store"],E["kong-ui-public-analytics-metric-provider"],E.KongIcons))})(this,function(E,o,S,X,ze,mi,Fe,Ge,Ue,Ae){"use strict";var ui=Object.defineProperty;var ft=E=>{throw TypeError(E)};var fi=(E,o,S)=>o in E?ui(E,o,{enumerable:!0,configurable:!0,writable:!0,value:S}):E[o]=S;var mt=(E,o,S)=>fi(E,typeof o!="symbol"?o+"":o,S),qe=(E,o,S)=>o.has(E)||ft("Cannot "+S);var w=(E,o,S)=>(qe(E,o,"read from private field"),S?S.call(E):o.get(E)),I=(E,o,S)=>o.has(E)?ft("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(E):o.set(E,S),O=(E,o,S,X)=>(qe(E,o,"write to private field"),X?X.call(E,S):o.set(E,S),S),q=(E,o,S)=>(qe(E,o,"access private method"),S);var ye=(E,o,S,X)=>({set _(ze){O(E,o,ze,S)},get _(){return w(E,o,X)}});var G,re,ne,J,fe,oe,me,U,ae,$,ge,W,le,Q,pe,xe,D,gt,pt,yt,_t,vt,De,Pe,$e,Se,wt,Ne;var We=(f=>(f.VALIDATING="VALIDATING",f.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",f.PENDING="PENDING",f.SUCCESS="SUCCESS",f.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",f.ERROR="ERROR",f.STALE_IF_ERROR="STALE_IF_ERROR",f))(We||{});const bt=f=>{var e,t,i,s,r;return f?!!((e=Object.keys(f))!=null&&e.length||(t=f.data)!=null&&t.length||(s=(i=f.data)==null?void 0:i.data)!=null&&s.length||!((r=f.data)!=null&&r.data)&&typeof f.data=="object"&&Object.keys(f==null?void 0:f.data).length):!1};function Et(f=o.ref({}),e,t,i=bt){const s=o.ref("PENDING");return o.watchEffect(()=>{const r=i(f.value);if(f.value&&r&&t.value){s.value="VALIDATING_HAS_DATA";return}if(f.value&&t.value){s.value="VALIDATING";return}if(f.value&&e.value){s.value="STALE_IF_ERROR";return}if(f.value===void 0&&!e.value){s.value="PENDING";return}if(f.value&&!e.value&&r){s.value="SUCCESS_HAS_DATA";return}if(f.value&&!e.value){s.value="SUCCESS";return}f.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:We}}const Ct={renderer:{noQueryBridge:"No query bridge provided. Unable to render dashboard.",trendRange:{"24h":"Last 24-hour summary","7d":"Last 7-day summary","30d":"Last 30-day summary"},edit:"Edit",duplicateTile:"Duplicate",remove:"Remove",delete:"Delete"},queryDataProvider:{forbidden:"You do not have permission to query this data.",timeRangeExceeded:"The time range for this report is outside of your organization's data retention period",timeout:"Query timed out. Consider querying a shorter time range."},csvExport:{defaultFilename:"Chart export",exportAsCsv:"Export as CSV"},jumpToExplore:"Explore",jumpToRequests:"View requests",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"}};function xt(){const f=Fe.createI18n("en-us",Ct);return{i18n:f,i18nT:Fe.i18nTComponent(f)}}const de=170,He=6,Z="analytics-query-provider",Oe="{entity-id}",Ve="{cp-id}",Ke="{timeframe}",Ye=30*1e3;function Rt(){const f=o.inject(Z);return{evaluateFeatureFlag:(t,i)=>f?f.evaluateFeatureFlagFn(t,i):i}}function kt(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var je={exports:{}};(function(f){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(c,d,h){this.fn=c,this.context=d,this.once=h||!1}function r(c,d,h,l,m){if(typeof h!="function")throw new TypeError("The listener must be a function");var y=new s(h,l||c,m),g=t?t+d:d;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],y]:c._events[g].push(y):(c._events[g]=y,c._eventsCount++),c}function a(c,d){--c._eventsCount===0?c._events=new i:delete c._events[d]}function n(){this._events=new i,this._eventsCount=0}n.prototype.eventNames=function(){var d=[],h,l;if(this._eventsCount===0)return d;for(l in h=this._events)e.call(h,l)&&d.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(h)):d},n.prototype.listeners=function(d){var h=t?t+d:d,l=this._events[h];if(!l)return[];if(l.fn)return[l.fn];for(var m=0,y=l.length,g=new Array(y);m<y;m++)g[m]=l[m].fn;return g},n.prototype.listenerCount=function(d){var h=t?t+d:d,l=this._events[h];return l?l.fn?1:l.length:0},n.prototype.emit=function(d,h,l,m,y,g){var v=t?t+d:d;if(!this._events[v])return!1;var p=this._events[v],T=arguments.length,N,k;if(p.fn){switch(p.once&&this.removeListener(d,p.fn,void 0,!0),T){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,h),!0;case 3:return p.fn.call(p.context,h,l),!0;case 4:return p.fn.call(p.context,h,l,m),!0;case 5:return p.fn.call(p.context,h,l,m,y),!0;case 6:return p.fn.call(p.context,h,l,m,y,g),!0}for(k=1,N=new Array(T-1);k<T;k++)N[k-1]=arguments[k];p.fn.apply(p.context,N)}else{var M=p.length,R;for(k=0;k<M;k++)switch(p[k].once&&this.removeListener(d,p[k].fn,void 0,!0),T){case 1:p[k].fn.call(p[k].context);break;case 2:p[k].fn.call(p[k].context,h);break;case 3:p[k].fn.call(p[k].context,h,l);break;case 4:p[k].fn.call(p[k].context,h,l,m);break;default:if(!N)for(R=1,N=new Array(T-1);R<T;R++)N[R-1]=arguments[R];p[k].fn.apply(p[k].context,N)}}return!0},n.prototype.on=function(d,h,l){return r(this,d,h,l,!1)},n.prototype.once=function(d,h,l){return r(this,d,h,l,!0)},n.prototype.removeListener=function(d,h,l,m){var y=t?t+d:d;if(!this._events[y])return this;if(!h)return a(this,y),this;var g=this._events[y];if(g.fn)g.fn===h&&(!m||g.once)&&(!l||g.context===l)&&a(this,y);else{for(var v=0,p=[],T=g.length;v<T;v++)(g[v].fn!==h||m&&!g[v].once||l&&g[v].context!==l)&&p.push(g[v]);p.length?this._events[y]=p.length===1?p[0]:p:a(this,y)}return this},n.prototype.removeAllListeners=function(d){var h;return d?(h=t?t+d:d,this._events[h]&&a(this,h)):(this._events=new i,this._eventsCount=0),this},n.prototype.off=n.prototype.removeListener,n.prototype.addListener=n.prototype.on,n.prefixed=t,n.EventEmitter=n,f.exports=n})(je);var Tt=je.exports;const Dt=kt(Tt);class Xe extends Error{constructor(e){super(e),this.name="TimeoutError"}}class St extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const Qe=f=>globalThis.DOMException===void 0?new St(f):new DOMException(f),Ze=f=>{const e=f.reason===void 0?Qe("This operation was aborted."):f.reason;return e instanceof Error?e:Qe(e)};function Nt(f,e){const{milliseconds:t,fallback:i,message:s,customTimers:r={setTimeout,clearTimeout}}=e;let a,n;const d=new Promise((h,l)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){const{signal:y}=e;y.aborted&&l(Ze(y)),n=()=>{l(Ze(y))},y.addEventListener("abort",n,{once:!0})}if(t===Number.POSITIVE_INFINITY){f.then(h,l);return}const m=new Xe;a=r.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(y){l(y)}return}typeof f.cancel=="function"&&f.cancel(),s===!1?h():s instanceof Error?l(s):(m.message=s??`Promise timed out after ${t} milliseconds`,l(m))},t),(async()=>{try{h(await f)}catch(y){l(y)}})()}).finally(()=>{d.clear(),n&&e.signal&&e.signal.removeEventListener("abort",n)});return d.clear=()=>{r.clearTimeout.call(void 0,a),a=void 0},d}function zt(f,e,t){let i=0,s=f.length;for(;s>0;){const r=Math.trunc(s/2);let a=i+r;t(f[a],e)<=0?(i=++a,s-=r+1):s=r}return i}class At{constructor(){I(this,G,[])}enqueue(e,t){t={priority:0,...t};const i={priority:t.priority,id:t.id,run:e};if(this.size===0||w(this,G)[this.size-1].priority>=t.priority){w(this,G).push(i);return}const s=zt(w(this,G),i,(r,a)=>a.priority-r.priority);w(this,G).splice(s,0,i)}setPriority(e,t){const i=w(this,G).findIndex(r=>r.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=w(this,G).splice(i,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){const e=w(this,G).shift();return e==null?void 0:e.run}filter(e){return w(this,G).filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return w(this,G).length}}G=new WeakMap;class Ht extends Dt{constructor(t){var i,s;super();I(this,D);I(this,re);I(this,ne);I(this,J,0);I(this,fe);I(this,oe);I(this,me,0);I(this,U);I(this,ae);I(this,$);I(this,ge);I(this,W,0);I(this,le);I(this,Q);I(this,pe);I(this,xe,1n);mt(this,"timeout");if(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:At,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i=t.intervalCap)==null?void 0:i.toString())??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s=t.interval)==null?void 0:s.toString())??""}\` (${typeof t.interval})`);O(this,re,t.carryoverConcurrencyCount),O(this,ne,t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0),O(this,fe,t.intervalCap),O(this,oe,t.interval),O(this,$,new t.queueClass),O(this,ge,t.queueClass),this.concurrency=t.concurrency,this.timeout=t.timeout,O(this,pe,t.throwOnTimeout===!0),O(this,Q,t.autoStart===!1)}get concurrency(){return w(this,le)}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);O(this,le,t),q(this,D,Se).call(this)}setPriority(t,i){w(this,$).setPriority(t,i)}async add(t,i={}){return i.id??(i.id=(ye(this,xe)._++).toString()),i={timeout:this.timeout,throwOnTimeout:w(this,pe),...i},new Promise((s,r)=>{w(this,$).enqueue(async()=>{var a;ye(this,W)._++,ye(this,J)._++;try{(a=i.signal)==null||a.throwIfAborted();let n=t({signal:i.signal});i.timeout&&(n=Nt(Promise.resolve(n),{milliseconds:i.timeout})),i.signal&&(n=Promise.race([n,q(this,D,wt).call(this,i.signal)]));const c=await n;s(c),this.emit("completed",c)}catch(n){if(n instanceof Xe&&!i.throwOnTimeout){s();return}r(n),this.emit("error",n)}finally{q(this,D,yt).call(this)}},i),this.emit("add"),q(this,D,De).call(this)})}async addAll(t,i){return Promise.all(t.map(async s=>this.add(s,i)))}start(){return w(this,Q)?(O(this,Q,!1),q(this,D,Se).call(this),this):this}pause(){O(this,Q,!0)}clear(){O(this,$,new(w(this,ge)))}async onEmpty(){w(this,$).size!==0&&await q(this,D,Ne).call(this,"empty")}async onSizeLessThan(t){w(this,$).size<t||await q(this,D,Ne).call(this,"next",()=>w(this,$).size<t)}async onIdle(){w(this,W)===0&&w(this,$).size===0||await q(this,D,Ne).call(this,"idle")}get size(){return w(this,$).size}sizeBy(t){return w(this,$).filter(t).length}get pending(){return w(this,W)}get isPaused(){return w(this,Q)}}re=new WeakMap,ne=new WeakMap,J=new WeakMap,fe=new WeakMap,oe=new WeakMap,me=new WeakMap,U=new WeakMap,ae=new WeakMap,$=new WeakMap,ge=new WeakMap,W=new WeakMap,le=new WeakMap,Q=new WeakMap,pe=new WeakMap,xe=new WeakMap,D=new WeakSet,gt=function(){return w(this,ne)||w(this,J)<w(this,fe)},pt=function(){return w(this,W)<w(this,le)},yt=function(){ye(this,W)._--,q(this,D,De).call(this),this.emit("next")},_t=function(){q(this,D,$e).call(this),q(this,D,Pe).call(this),O(this,ae,void 0)},vt=function(){const t=Date.now();if(w(this,U)===void 0){const i=w(this,me)-t;if(i<0)O(this,J,w(this,re)?w(this,W):0);else return w(this,ae)===void 0&&O(this,ae,setTimeout(()=>{q(this,D,_t).call(this)},i)),!0}return!1},De=function(){if(w(this,$).size===0)return w(this,U)&&clearInterval(w(this,U)),O(this,U,void 0),this.emit("empty"),w(this,W)===0&&this.emit("idle"),!1;if(!w(this,Q)){const t=!w(this,D,vt);if(w(this,D,gt)&&w(this,D,pt)){const i=w(this,$).dequeue();return i?(this.emit("active"),i(),t&&q(this,D,Pe).call(this),!0):!1}}return!1},Pe=function(){w(this,ne)||w(this,U)!==void 0||(O(this,U,setInterval(()=>{q(this,D,$e).call(this)},w(this,oe))),O(this,me,Date.now()+w(this,oe)))},$e=function(){w(this,J)===0&&w(this,W)===0&&w(this,U)&&(clearInterval(w(this,U)),O(this,U,void 0)),O(this,J,w(this,re)?w(this,W):0),q(this,D,Se).call(this)},Se=function(){for(;q(this,D,De).call(this););},wt=async function(t){return new Promise((i,s)=>{t.addEventListener("abort",()=>{s(t.reason)},{once:!0})})},Ne=async function(t,i){return new Promise(s=>{const r=()=>{i&&!i()||(this.off(t,r),s())};this.on(t,r)})};const se={useI18n:xt,useEvaluateFeatureFlag:Rt,useRequestQueue:()=>{const f=Ge.useAnalyticsConfigStore(),e=o.inject(Z);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 Ht({carryoverConcurrencyCount:!0,concurrency:f.maxParallelRequests,interval:f.requestInterval,intervalCap:f.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,r)=>t.add(()=>e.queryFn(s,r),{throwOnTimeout:!0})};o.provide(Z,i)}},Le=o.defineComponent({__name:"QueryDataProvider",props:{context:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","queryComplete"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),r=o.inject(Z),a=()=>t.queryReady&&r?JSON.stringify([t.query,t.context,t.refreshCounter]):null,n=new AbortController;o.onUnmounted(()=>{n.abort()});const c=(T,N,k)=>{const M=[];return N&&M.push(...N),M.push(...S.stripUnknownFilters(T,k)),M},{data:d,error:h,isValidating:l}=ze(a,async()=>{var T,N,k,M;try{let{datasource:R,...x}=t.query;R||(R="basic");const A=c(R,t.query.filters,t.context.filters);let z=t.query.time_range;z?z.tz||(z={...z,tz:t.context.tz}):z={...t.context.timeSpec,tz:t.context.tz};const B={datasource:R,query:{...x,time_range:z,filters:A}},K=await(r==null?void 0:r.queryFn(B,n));return g.value=null,K}catch(R){throw(R==null?void 0:R.status)===403?g.value=s.t("queryDataProvider.forbidden"):(R==null?void 0:R.status)===408?g.value=s.t("queryDataProvider.timeout"):((N=(T=R==null?void 0:R.response)==null?void 0:T.data)==null?void 0:N.message)==="Range not allowed for this tier"?g.value=s.t("queryDataProvider.timeRangeExceeded"):g.value=((M=(k=R==null?void 0:R.response)==null?void 0:k.data)==null?void 0:M.message)||(R==null?void 0:R.message),R}finally{i("queryComplete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1}),{state:m,swrvState:y}=Et(d,h,l),g=o.ref(null),v=o.computed(()=>m.value===y.ERROR||!!g.value),p=o.computed(()=>!t.queryReady||m.value===y.PENDING);return o.watch(d,T=>{T&&i("chart-data",T)}),(T,N)=>{const k=o.resolveComponent("KSkeleton"),M=o.resolveComponent("KEmptyState");return p.value||!o.unref(d)&&!v.value?(o.openBlock(),o.createBlock(k,{key:0,class:"chart-skeleton",type:"table"})):v.value?(o.openBlock(),o.createBlock(M,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state","icon-variant":"error"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(g.value),1)]),_:1})):o.unref(d)?o.renderSlot(T.$slots,"default",{key:2,data:o.unref(d)}):o.createCommentVNode("",!0)}}}),Ot=o.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){o.useCssVars(i=>({"088169ae":`${i.height}px`}));const e=f,t=o.computed(()=>e.chartOptions.type==="single_value");return(i,s)=>(o.openBlock(),o.createBlock(Le,{context:i.context,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter},{default:o.withCtx(({data:r})=>[o.createElementVNode("div",{class:o.normalizeClass(["analytics-chart",{"single-value":t.value}])},[o.createVNode(o.unref(X.SimpleChart),{"chart-data":r,"chart-options":i.chartOptions,"synthetics-data-key":t.value?void 0:i.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],2)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),ee=(f,e)=>{const t=f.__vccOpts||f;for(const[i,s]of e)t[i]=s;return t},Je=ee(Ot,[["__scopeId","data-v-1e9ff912"]]),Lt={class:"analytics-chart"},Me=ee(o.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),{evaluateFeatureFlag:r}=se.useEvaluateFeatureFlag(),a=r("explore-v4-fine-granularity",!1),n=o.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold})),c=o.computed(()=>a&&t.context.zoomable&&!t.query.time_range),d=()=>{i("edit-tile")},h=l=>{i("chart-data",l)};return(l,m)=>{const y=o.resolveComponent("KDropdownItem");return o.openBlock(),o.createBlock(Le,{context:l.context,query:l.query,"query-ready":l.queryReady,"refresh-counter":l.refreshCounter,onChartData:h},{default:o.withCtx(({data:g})=>[o.createElementVNode("div",Lt,[o.createVNode(o.unref(X.AnalyticsChart),o.mergeProps({"allow-csv-export":l.chartOptions.allow_csv_export,"chart-data":g,"chart-options":n.value,"legend-position":"bottom","show-menu":l.context.editable,"synthetics-data-key":l.chartOptions.synthetics_data_key,"timeseries-zoom":c.value,"tooltip-title":""},l.extraProps,{onViewRequests:m[0]||(m[0]=v=>i("view-requests",v)),onZoomTimeRange:m[1]||(m[1]=v=>i("zoom-time-range",v))}),o.createSlots({_:2},[l.context.editable?{name:"menu-items",fn:o.withCtx(()=>[o.createVNode(y,{onClick:d},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["allow-csv-export","chart-data","chart-options","show-menu","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-9195a528"]]),et=o.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){return(e,t)=>(o.openBlock(),o.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,"extra-props":{showAnnotations:!1},height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),tt=o.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},emits:["zoom-time-range"],setup(f,{emit:e}){const t=e;return(i,s)=>(o.openBlock(),o.createBlock(Me,{"chart-options":i.chartOptions,context:i.context,height:i.height,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter,onZoomTimeRange:s[0]||(s[0]=r=>t("zoom-time-range",r))},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),Mt={class:"metric-card-tile-wrapper"},It=ee(o.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){const e=f,t=o.computed(()=>{const s=e.context.timeSpec;if(s.type==="absolute")return new S.Timeframe({key:"custom",timeframeText:"custom",display:"custom",startCustom:s.start,endCustom:s.end,timeframeLength:()=>s.end.getTime()-s.start.getTime(),defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["free","plus","enterprise"]});const r=S.TimePeriods.get(s.time_range);if(!r)throw new Error("Unknown time range");return r}),i=o.computed(()=>{var r,a;const s=(r=e.query)==null?void 0:r.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:(a=e.query)==null?void 0:a.datasource,overrideTimeframe:t.value,tz:e.context.tz,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}});return(s,r)=>(o.openBlock(),o.createElementBlock("div",Mt,[o.createVNode(o.unref(Ue.MetricsProvider),o.normalizeProps(o.guardReactiveProps(i.value)),{default:o.withCtx(()=>[o.createVNode(o.unref(Ue.MetricsConsumer))]),_:1},16)]))}}),[["__scopeId","data-v-7e1b1cc1"]]),it="#6c7489",Bt="12px",st="20px",rt="20px",qt={class:"fallback-entity-link","data-testid":"entity-link-parent"},nt=o.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(f){return(e,t)=>(o.openBlock(),o.createElementBlock("div",qt,o.toDisplayString(e.entityLinkData.label),1))}}),Pt=o.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){const e=f,t=o.inject(Z),i=o.defineAsyncComponent(async()=>{if(t!=null&&t.fetchComponent)try{return await t.fetchComponent("EntityLink")}catch{return nt}return nt}),s=r=>{var a;if((a=e.chartOptions)!=null&&a.entity_link)if(r.id.includes(":")){const[n,c]=r.id.split(":");return e.chartOptions.entity_link.replace(Ve,n).replace(Oe,c)}else return e.chartOptions.entity_link.replace(Oe,r.id);return""};return(r,a)=>(o.openBlock(),o.createBlock(Le,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:o.withCtx(({data:n})=>[o.createVNode(o.unref(X.TopNTable),{data:n,"synthetics-data-key":r.chartOptions.synthetics_data_key},o.createSlots({_:2},[e.chartOptions.entity_link?{name:"name",fn:o.withCtx(({record:c})=>[o.createVNode(o.unref(i),{"entity-link-data":{id:c.id,label:c.name,deleted:c.deleted},"external-link":s(c)},null,8,["entity-link-data","external-link"])]),key:"0"}:void 0]),1032,["data","synthetics-data-key"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),$t=o.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){return(e,t)=>(o.openBlock(),o.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),Ft=["data-testid"],Gt={key:0,class:"tile-header"},Ut=["data-testid"],Wt={class:"badge-text"},Vt=["data-testid"],Kt={class:"delete-option"},Yt=["data-testid"],jt=["data-testid"],Xt=ee(o.defineComponent({__name:"DashboardTile",props:{definition:{},context:{},height:{default:de},queryReady:{type:Boolean},refreshCounter:{},tileId:{}},emits:["edit-tile","duplicate-tile","remove-tile","zoom-time-range"],setup(f,{emit:e}){o.useCssVars(_=>({"1f620390":`${_.height}px`}));const t=parseInt(rt,10),i=f,s=e,r=o.inject(Z),{i18n:a}=se.useI18n(),n=o.ref(),c=o.ref(!1),d=o.ref(),h=o.ref(!1),l=o.ref(""),m=o.ref(""),y=r==null?void 0:r.evaluateFeatureFlagFn("analytics-chart-zoom-actions",!1);o.onMounted(async()=>{var _,H;l.value=await((_=r==null?void 0:r.exploreBaseUrl)==null?void 0:_.call(r))??"",m.value=await((H=r==null?void 0:r.requestsBaseUrl)==null?void 0:H.call(r))??""}),o.watch(()=>i.definition,async()=>{await o.nextTick(),d.value&&(h.value=d.value.scrollWidth>d.value.clientWidth)},{immediate:!0,deep:!0});const g=o.computed(()=>{if(!l.value||!i.definition.query||!N.value)return"";const _=te.value,H=i.definition.query.dimensions??[],L={filters:_,metrics:i.definition.query.metrics??[],dimensions:H,time_range:i.definition.query.time_range||i.context.timeSpec,granularity:i.definition.query.granularity||A.value},he=["api_usage","llm_usage"].includes(i.definition.query.datasource)?i.definition.query.datasource:"api_usage";return`${l.value}?q=${JSON.stringify(L)}&d=${he}&c=${i.definition.chart.type}`}),v=o.computed(()=>{if(!m.value||!i.definition.query||!N.value)return"";const _=[...i.context.filters,...i.definition.query.filters??[]],H=ct(i.definition.query.time_range||i.context.timeSpec,_);return`${m.value}?q=${JSON.stringify(H)}`}),p=o.computed(()=>a.t("csvExport.defaultFilename")),T=o.computed(()=>N.value&&(k.value||i.context.editable)||!!x.value),N=o.computed(()=>!["golden_signals","top_n","gauge"].includes(i.definition.chart.type)),k=o.computed(()=>!!g.value||"allow_csv_export"in i.definition.chart&&i.definition.chart.allow_csv_export||i.context.editable),M={timeseries_line:tt,timeseries_bar:tt,horizontal_bar:et,vertical_bar:et,gauge:Je,donut:$t,golden_signals:It,top_n:Pt,slottable:void 0,single_value:Je},R=o.computed(()=>{const _=M[i.definition.chart.type];return _&&{component:_,rendererProps:{query:i.definition.query,context:i.context,queryReady:i.queryReady,chartOptions:i.definition.chart,height:i.height-t*2,refreshCounter:i.refreshCounter}}}),x=o.computed(()=>{var H;const _=(H=i.definition.query)==null?void 0:H.time_range;if((_==null?void 0:_.type)==="relative"){const L=S.TimePeriods.get(S.TIMEFRAME_LOOKUP[_.time_range]);return L?L.display:(console.warn("Did not recognize the given relative time range:",_.time_range),_.time_range)}else if((_==null?void 0:_.type)==="absolute"){const L=_.tz||"Etc/UTC";return`${S.formatTime(_.start,{short:!0,tz:L})} - ${S.formatTime(_.end,{short:!0,tz:L})}`}return null}),A=o.computed(()=>n.value?S.msToGranularity(n.value.meta.granularity_ms):void 0),z=o.computed(()=>["timeseries_line","timeseries_bar"].includes(i.definition.chart.type)),B=o.computed(()=>{var L;const _=i.definition.query.granularity,H=S.msToGranularity(((L=n.value)==null?void 0:L.meta.granularity_ms)||0);return z.value&&_!==H}),K=o.computed(()=>{var L;const _=S.msToGranularity(((L=n.value)==null?void 0:L.meta.granularity_ms)||0),H=i.definition.query.granularity;return a.t("query_aged_out_warning",{currentGranularity:a.t(`granularities.${_}`),savedGranularity:a.t(`granularities.${H}`)})}),te=o.computed(()=>{var L,he;const _=[...i.context.filters,...i.definition.query.filters??[]],H=((he=(L=i.definition)==null?void 0:L.query)==null?void 0:he.datasource)??"api_usage";return _.filter(ie=>S.getFieldDataSources(ie.field).some(Te=>H===Te))}),Re=()=>{s("edit-tile",i.definition)},ke=()=>{s("duplicate-tile",i.definition)},li=()=>{s("remove-tile",i.definition)},hi=_=>{n.value=_},dt=_=>{c.value=_},di=()=>{dt(!0)},ct=(_,H)=>({filter:H,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),ci=_=>{if(!m.value||!i.definition.query)return;const H=[...i.context.filters,...i.definition.query.filters??[]],L=ct(_,H);window.location.assign(`${m.value}?q=${JSON.stringify(L)}`)};return(_,H)=>{const L=o.resolveComponent("KTooltip"),he=o.resolveComponent("KBadge"),ie=o.resolveComponent("KDropdownItem"),ut=o.resolveComponent("KDropdown");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["tile-boundary",{editable:_.context.editable}]),"data-testid":`tile-${_.tileId}`},[_.definition.chart.type!=="slottable"?(o.openBlock(),o.createElementBlock("div",Gt,[o.createVNode(L,{class:"title-tooltip",disabled:!h.value,"max-width":"500",text:_.definition.chart.chart_title},{default:o.withCtx(()=>[o.createElementVNode("div",{ref_key:"titleRef",ref:d,class:"title"},o.toDisplayString(_.definition.chart.chart_title),513)]),_:1},8,["disabled","text"]),T.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"tile-actions","data-testid":`tile-actions-${_.tileId}`},[x.value?(o.openBlock(),o.createBlock(he,{key:0,"data-testid":"time-range-badge",tooltip:B.value?K.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},o.createSlots({default:o.withCtx(()=>[o.createElementVNode("span",Wt,o.toDisplayString(x.value),1)]),_:2},[B.value?{name:"icon",fn:o.withCtx(()=>[o.createVNode(o.unref(Ae.WarningIcon),{size:o.unref(Bt)},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):o.createCommentVNode("",!0),N.value&&_.context.editable?(o.openBlock(),o.createBlock(o.unref(Ae.EditIcon),{key:1,class:"edit-icon",color:o.unref(it),"data-testid":`edit-tile-${_.tileId}`,size:o.unref(st),onClick:Re},null,8,["color","data-testid","size"])):o.createCommentVNode("",!0),N.value&&k.value?(o.openBlock(),o.createBlock(ut,{key:2,class:"dropdown","data-testid":`chart-action-menu-${_.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:o.withCtx(()=>[g.value?(o.openBlock(),o.createBlock(ie,{key:0,"data-testid":`chart-jump-to-explore-${_.tileId}`,item:{label:o.unref(a).t("jumpToExplore"),to:g.value}},null,8,["data-testid","item"])):o.createCommentVNode("",!0),o.unref(y)&&v.value?(o.openBlock(),o.createBlock(ie,{key:1,"data-testid":`chart-jump-to-requests-${_.tileId}`,item:{label:o.unref(a).t("jumpToRequests"),to:v.value}},null,8,["data-testid","item"])):o.createCommentVNode("",!0),!("allowCsvExport"in _.definition.chart)||_.definition.chart.allowCsvExport?(o.openBlock(),o.createBlock(ie,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${_.tileId}`,onClick:H[0]||(H[0]=Te=>di())},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${_.tileId}`},o.toDisplayString(o.unref(a).t("csvExport.exportAsCsv")),9,Vt)]),_:1},8,["data-testid"])):o.createCommentVNode("",!0),_.context.editable?(o.openBlock(),o.createBlock(ie,{key:3,"data-testid":`duplicate-tile-${_.tileId}`,onClick:ke},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):o.createCommentVNode("",!0),_.context.editable?(o.openBlock(),o.createBlock(ie,{key:4,"data-testid":`remove-tile-${_.tileId}`,onClick:li},{default:o.withCtx(()=>[o.createElementVNode("span",Kt,o.toDisplayString(o.unref(a).t("renderer.delete")),1)]),_:1},8,["data-testid"])):o.createCommentVNode("",!0)]),default:o.withCtx(()=>[o.createVNode(o.unref(Ae.MoreIcon),{class:"kebab-action-menu",color:o.unref(it),"data-testid":`kebab-action-menu-${_.tileId}`,size:o.unref(st)},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):o.createCommentVNode("",!0)],8,Ut)):"description"in _.definition.chart?(o.openBlock(),o.createElementBlock("div",{key:1,class:"header-description","data-testid":`tile-description-${_.tileId}`},o.toDisplayString(_.definition.chart.description),9,Yt)):o.createCommentVNode("",!0),c.value?(o.openBlock(),o.createBlock(o.unref(X.CsvExportModal),{key:2,"chart-data":n.value,"data-testid":`csv-export-modal-${_.tileId}`,filename:p.value,onToggleModal:dt},null,8,["chart-data","data-testid","filename"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"tile-content","data-testid":`tile-content-${_.tileId}`},[R.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(R.value.component),o.mergeProps({key:0},R.value.rendererProps,{onChartData:hi,onViewRequests:ci,onZoomTimeRange:H[1]||(H[1]=Te=>s("zoom-time-range",Te))}),null,16)):o.createCommentVNode("",!0)],8,jt)],10,Ft)}}}),[["__scopeId","data-v-cfd4ef10"]]),Qt=(f,e)=>{let t=0;const i=new Map;e.forEach(r=>{const a=r.layout.position.row,n=i.get(a),c=r.layout.size.rows===1&&!!r.layout.size.fit_to_content;t=Math.max(t,a+r.layout.size.rows),n===void 0?i.set(a,c):i.set(a,n&&c)});const s=[];for(let r=0;r<t;r++)i.get(r)?s.push("auto"):s.push(`${f}px`);return s},ot=ee(o.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>de},tiles:{type:Array,required:!0}},setup(f){o.useCssVars(n=>({"2a38e79e":o.unref(He),"4cc71de6":r.value}));const e=f,t=o.ref(null),i=o.ref(0),s=new ResizeObserver(n=>{window.requestAnimationFrame(()=>{!Array.isArray(n)||!n.length||(i.value=n[0].contentRect.width)})});o.onMounted(()=>{t.value&&s.observe(t.value)}),o.onUnmounted(()=>{t.value&&s.unobserve(t.value)});const r=o.computed(()=>Qt(e.tileHeight,e.tiles).join(" ")),a=o.computed(()=>e.tiles.map((n,c)=>({key:`tile-${c}`,tile:n,style:{"grid-column-start":n.layout.position.col+1,"grid-column-end":n.layout.position.col+1+n.layout.size.cols,"grid-row-start":n.layout.position.row+1,"grid-row-end":n.layout.position.row+1+n.layout.size.rows}})));return(n,c)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"gridContainer",ref:t,class:"kong-ui-public-grid-layout"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,d=>(o.openBlock(),o.createElementBlock("div",{key:d.key,class:o.normalizeClass(["grid-cell",{"empty-cell":!d.tile}]),style:o.normalizeStyle(d.style)},[o.renderSlot(n.$slots,"tile",{style:o.normalizeStyle(d.style),tile:d.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-354b7177"]]);function Zt(f,e,t,i,s){const r=(...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(f,a));return r.prototype=e.prototype,r}class u{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const r=i.getElementById(e);return r?[r]:[]}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 createWidgetDivs(e,t){var a,n;const i=u.createDiv(["grid-stack-item",e]),s=u.createDiv(["grid-stack-item-content"],i);return t.lazyLoad||((n=(a=t.grid)==null?void 0:a.opts)==null?void 0:n.lazyLoad)&&t.lazyLoad!==!1?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([c])=>{var d;c.isIntersecting&&((d=t.visibleObservable)==null||d.disconnect(),delete t.visibleObservable,b.renderCB(s,t))}),window.setTimeout(()=>{var c;return(c=t.visibleObservable)==null?void 0:c.observe(i)})):b.renderCB(s,t),i}static createDiv(e,t){const i=document.createElement("div");return e.forEach(s=>{s&&i.classList.add(s)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0: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 u.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 r=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<=r?0:(s-i)*(a-r)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,r)=>{const a=t*((s.y??1e4)-(r.y??1e4));return a===0?t*((s.x??1e4)-(r.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"),r=i==null?void 0:i.nonce;return r&&(s.nonce=r),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],r=t[i];i[0]==="_"||s===r?delete e[i]:s&&typeof s=="object"&&r!==void 0&&(u.removeInternalAndSame(s,r),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(),r=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>r){const a=s.bottom-r,n=s.top,c=this.getScrollElement(e);if(c!==null){const d=c.scrollTop;s.top<0&&i<0?e.offsetHeight>r?c.scrollTop+=i:c.scrollTop+=Math.abs(n)>Math.abs(i)?i:n:i>0&&(e.offsetHeight>r?c.scrollTop+=i:c.scrollTop+=a>i?i:a),t.top+=c.scrollTop-d}}}static updateScrollResize(e,t,i){const s=this.getScrollElement(t),r=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,n=e.clientY-a,c=n<i,d=n>r-i;c?s.scrollBy({behavior:"smooth",top:n-i}):d&&s.scrollBy({behavior:"smooth",top:i-(r-n)})}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=u.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(r=>r===s)&&(i[s]=u.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=u.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(r=>i[r]=e[r]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(r=>i[r]=e[r]),{...i,...s}}static simulateMouseEvent(e,t,i){const s=document.createEvent("MouseEvents");s.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,e.target),(i||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const t=document.createElement("div");u.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){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class Y{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 r=t;!this._loading&&this._useEntireRowArea(e,t)&&(r={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,r,s.skip));let a=!1;const n={nested:!0,pack:!1};let c=0;for(;i=i||this.collide(e,r,s.skip);){if(c++>this.nodes.length*2)throw new Error("Infinite collide check");let d;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 h={...t,y:i.y+i.h,...n};d=this._loading&&u.samePos(e,h)?!0:this.moveNode(e,h),(i.locked||this._loading)&&d?u.copyPos(t,e):!i.locked&&d&&s.pack&&(this._packNodes(),t.y=i.y+i.h,u.copyPos(e,t)),a=a||d}else d=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...n});if(!d)return a;i=void 0}return a}collide(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.find(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.filter(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,r={...t.rect};r.y>s.y?(r.h+=r.y-s.y,r.y=s.y):r.h+=s.y-r.y,r.x>s.x?(r.w+=r.x-s.x,r.x=s.x):r.w+=s.x-r.x;let a,n=.5;for(let c of i){if(c.locked||!c._rect)break;const d=c._rect;let h=Number.MAX_VALUE,l=Number.MAX_VALUE;s.y<d.y?h=(r.y+r.h-d.y)/d.h:s.y+s.h>d.y+d.h&&(h=(d.y+d.h-r.y)/d.h),s.x<d.x?l=(r.x+r.w-d.x)/d.w:s.x+s.w>d.x+d.w&&(l=(d.x+d.w-r.x)/d.w);const m=Math.min(l,h);m>n&&(n=m,a=c)}return t.collide=a,a}cacheRects(e,t,i,s,r,a){return this.nodes.forEach(n=>n._rect={y:n.y*t+i,x:n.x*e+a,w:n.w*e-a-s,h:n.h*t-i-r}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const r=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=r,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=r,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=u.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=u.isTouching(e,t)))){if(t.y<e.y){const r=e;e=t,t=r}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=u.isTouching(e,t)))){if(t.x<e.x){const r=e;e=t,t=r}return i()}return!1}}}isAreaEmpty(e,t,i,s){const r={x:e||0,y:t||0,w:i||1,h:s||1};return!this.collide(r)}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 r=this.nodes;return this.nodes=[],r.forEach((a,n,c)=>{let d;a.locked||(a.autoPosition=!0,e==="list"&&n&&(d=c[n-1])),this.addNode(a,!1,d)}),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=u.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??Y._idSeq++;const i=e.id;if(i){let r=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+r++}(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 u.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,u.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||u.copyPos({},e);if(e.maxW&&e.w&&(e.w=Math.min(e.w,e.maxW)),e.maxH&&e.h&&(e.h=Math.min(e.h,e.maxH)),e.minW&&e.w&&e.minW<=this.column&&(e.w=Math.max(e.w,e.minW)),e.minH&&e.h&&(e.h=Math.max(e.h,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 r={...e};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,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),u.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!u.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=u.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||u.samePos(e,e._orig)||(u.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){const r=s?s.y*i+(s.x+s.w):0;let a=!1;for(let n=r;!a;++n){const c=n%i,d=Math.floor(n/i);if(c+e.w>i)continue;const h={x:c,y:d,w:e.w,h:e.h};t.find(l=>u.isIntercepted(h,l))||((e.x!==c||e.y!==d)&&(e._dirty=!0),e.x=c,e.y=d,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 r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,r=!0),this.nodes.push(e),t&&this.addedNodes.push(e),r||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 Y({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const r=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return r?(s.nodes.filter(a=>a._dirty).forEach(a=>{const n=this.nodes.find(c=>c._id===a._id);n&&(u.copyPos(n,a),n._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new Y({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=u.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){var d,h;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,r=u.copyPos({},e,!0);if(u.copyPos(r,t),this.nodeBoundFix(r,s),u.copyPos(t,r),!t.forceCollide&&u.samePos(e,t))return!1;const a=u.copyPos({},e),n=this.collideAll(e,r,t.skip);let c=!0;if(n.length){const l=e._moving&&!t.nested;let m=l?this.directionCollideCoverage(e,t,n):n[0];if(l&&m&&((h=(d=e.grid)==null?void 0:d.opts)!=null&&h.subGridDynamic)&&!e.grid._isTemp){const y=u.areaIntercept(t.rect,m._rect),g=u.area(t.rect),v=u.area(m._rect);y/(g<v?g:v)>.8&&(m.grid.makeSubGrid(m.el,void 0,e),m=void 0)}m?c=!this._fixCollisions(e,r,m,t):(c=!1,i&&delete t.pack)}return c&&!u.samePos(e,r)&&(e._dirty=!0,u.copyPos(e,r)),t.pack&&this._packNodes()._notify(),!u.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){var a;const i=(a=this._layouts)==null?void 0:a.length,s=i&&this.column!==i-1?this._layouts[i-1]:null,r=[];return this.sortNodes(),this.nodes.forEach(n=>{const c=s==null?void 0:s.find(h=>h._id===n._id),d={...n,...c||{}};u.removeInternalForSave(d,!e),t&&t(n,d),r.push(d)}),r}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(r=>{if(!r._orig)return;const a=t.find(n=>n._id===r._id);a&&(a.y>=0&&r.y!==r._orig.y&&(a.y+=r.y-r._orig.y),r.x!==r._orig.x&&(a.x=Math.round(r.x*s)),r.w!==r._orig.w&&(a.w=Math.round(r.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){var n;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 r=[],a=s?this.nodes:u.sort(this.nodes,-1);if(t>e&&this._layouts){const c=this._layouts[t]||[],d=this._layouts.length-1;!c.length&&e!==d&&((n=this._layouts[d])!=null&&n.length)&&(e=d,this._layouts[d].forEach(h=>{const l=a.find(m=>m._id===h._id);l&&(!s&&!h.autoPosition&&(l.x=h.x??l.x,l.y=h.y??l.y),l.w=h.w??l.w,(h.x==null||h.y===void 0)&&(l.autoPosition=!0))})),c.forEach(h=>{const l=a.findIndex(m=>m._id===h._id);if(l!==-1){const m=a[l];if(s){m.w=h.w;return}(h.autoPosition||isNaN(h.x)||isNaN(h.y))&&this.findEmptyPosition(h,r),h.autoPosition||(m.x=h.x??m.x,m.y=h.y??m.y,m.w=h.w??m.w,r.push(m)),a.splice(l,1)}})}if(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,r,a);else{const c=s||i==="none"?1:t/e,d=i==="move"||i==="moveScale",h=i==="scale"||i==="moveScale";a.forEach(l=>{l.x=t===1?0:d?Math.round(l.x*c):Math.min(l.x,t-1),l.w=t===1||e===1?1:h?Math.round(l.w*c)||1:Math.min(l.w,t),r.push(l)}),a=[]}r=u.sort(r,-1),this._inColumnResize=!0,this.nodes=[],r.forEach(c=>{this.addNode(c,!1),delete c._orig})}return this.nodes.forEach(c=>delete c._orig),this.batchUpdate(!1,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];return e.forEach((r,a)=>{if(r._id===void 0){const n=r.id?this.nodes.find(c=>c.id===r.id):void 0;r._id=(n==null?void 0:n._id)??Y._idSeq++}s[a]={x:r.x,y:r.y,w:r.w,_id:r._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??Y._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){var i,s;return((s=(i=this._layouts)==null?void 0:i[t])==null?void 0:s.findIndex(r=>r._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}}Y._idSeq=0;const F={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 C{}const V=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 j{}function _e(f,e){if(f.touches.length>1)return;f.cancelable&&f.preventDefault();const t=f.changedTouches[0],i=document.createEvent("MouseEvents");i.initMouseEvent(e,!0,!0,window,1,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,null),f.target.dispatchEvent(i)}function at(f,e){f.cancelable&&f.preventDefault();const t=document.createEvent("MouseEvents");t.initMouseEvent(e,!0,!0,window,1,f.screenX,f.screenY,f.clientX,f.clientY,!1,!1,!1,!1,0,null),f.target.dispatchEvent(t)}function ve(f){j.touchHandled||(j.touchHandled=!0,_e(f,"mousedown"))}function we(f){j.touchHandled&&_e(f,"mousemove")}function be(f){if(!j.touchHandled)return;j.pointerLeaveTimeout&&(window.clearTimeout(j.pointerLeaveTimeout),delete j.pointerLeaveTimeout);const e=!!C.dragElement;_e(f,"mouseup"),e||_e(f,"click"),j.touchHandled=!1}function Ee(f){f.pointerType!=="mouse"&&f.target.releasePointerCapture(f.pointerId)}function lt(f){C.dragElement&&f.pointerType!=="mouse"&&at(f,"mouseenter")}function ht(f){C.dragElement&&f.pointerType!=="mouse"&&(j.pointerLeaveTimeout=window.setTimeout(()=>{delete j.pointerLeaveTimeout,at(f,"mouseleave")},10))}class Ce{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(`${Ce.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),V&&(this.el.addEventListener("touchstart",ve),this.el.addEventListener("pointerdown",Ee)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),V&&(this.el.removeEventListener("touchstart",ve),this.el.removeEventListener("pointerdown",Ee)),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),V&&(this.el.addEventListener("touchmove",we),this.el.addEventListener("touchend",be)),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),V&&(this.el.removeEventListener("touchmove",we),this.el.removeEventListener("touchend",be)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ce.prefix="ui-resizable-";class Ie{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 ce extends Ie{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||r;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),C.overResizeElement===this&&delete C.overResizeElement),this}_mouseOver(e){C.overResizeElement||C.dragElement||(C.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){C.overResizeElement===this&&(delete C.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ce(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=u.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=u.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=u.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=u.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=u.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=ce._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=u.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 ce._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},r=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let n,c;t.indexOf("e")>-1?s.width+=r:t.indexOf("w")>-1&&(s.width-=r,s.left+=r,n=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,c=!0);const d=this._constrainSize(s.width,s.height,n,c);return Math.round(s.width)!==Math.round(d.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-d.width),s.width=d.width),Math.round(s.height)!==Math.round(d.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-d.height),s.height=d.height),s}_constrainSize(e,t,i,s){const r=this.option,a=(i?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,n=r.minWidth/this.rectScale.x||e,c=(s?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,d=r.minHeight/this.rectScale.y||t,h=Math.min(a,Math.max(n,e)),l=Math.min(c,Math.max(d,t));return{width:h,height:l}}_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}}ce._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Jt='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ue extends Ie{constructor(e,t={}){var r;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(r=t==null?void 0:t.handle)==null?void 0:r.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s!=null&&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),V&&(e.addEventListener("touchstart",ve),e.addEventListener("pointerdown",Ee))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),V&&(t.removeEventListener("touchstart",ve),t.removeEventListener("pointerdown",Ee))}),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(!C.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Jt)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete C.dragElement,delete C.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),V&&(e.currentTarget.addEventListener("touchmove",we),e.currentTarget.addEventListener("touchend",be)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),C.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=u.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),C.pauseDrag){const s=Number.isInteger(C.pauseDrag)?C.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),s)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,C.dragElement=this;const s=(i=this.el.gridstackNode)==null?void 0:i.grid;s?C.dropElement=s.el.ddElement.ddDroppable:delete C.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=u.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=u.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),V&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",we,!0),e.currentTarget.removeEventListener("touchend",be,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=C.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete C.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const s=u.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(s),this.triggerEvent("dragstop",s),C.dropElement&&C.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete C.dragElement,delete C.dropElement,delete C.mouseHandled,e.preventDefault()}_keyEvent(e){var s,r;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((r=(s=C.dropElement)==null?void 0:s.el)==null?void 0:r.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!u.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",u.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=u.cloneNode(this.el)),document.body.contains(e)||u.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ue.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(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,s=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",ue.originStyleProp.forEach(r=>i.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>i.style.transition=s,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,r=0;i&&(s=this.dragTransform.xOffset,r=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-r,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}}}}ue.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class ei extends Ie{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),V&&(this.el.addEventListener("pointerenter",lt),this.el.addEventListener("pointerleave",ht)))}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),V&&(this.el.removeEventListener("pointerenter",lt),this.el.removeEventListener("pointerleave",ht)))}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(!C.dragElement||!this._canDrop(C.dragElement.el))return;e.preventDefault(),e.stopPropagation(),C.dropElement&&C.dropElement!==this&&C.dropElement._mouseLeave(e,!0),C.dropElement=this;const t=u.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(C.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var s;if(!C.dragElement||C.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=u.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(C.dragElement)),this.triggerEvent("dropout",i),C.dropElement===this&&(delete C.dropElement,!t)){let r,a=this.el.parentElement;for(;!r&&a;)r=(s=a.ddElement)==null?void 0:s.ddDroppable,a=a.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=u.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(C.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 Be{static init(e){return e.ddElement||(e.ddElement=new Be(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 ue(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 ce(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 ei(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class ti{resizable(e,t,i,s){return this._getDDElements(e).forEach(r=>{if(t==="disable"||t==="enable")r.ddResizable&&r.ddResizable[t]();else if(t==="destroy")r.ddResizable&&r.cleanResizable();else if(t==="option")r.setupResizable({[i]:s});else{const n=r.el.gridstackNode.grid;let c=r.el.getAttribute("gs-resize-handles")||n.opts.resizable.handles||"e,s,se";c==="all"&&(c="n,e,s,w,se,sw,ne,nw");const d=!n.opts.alwaysShowResizeHandle;r.setupResizable({...n.opts.resizable,handles:c,autoHide:d,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,s){return this._getDDElements(e).forEach(r=>{if(t==="disable"||t==="enable")r.ddDraggable&&r.ddDraggable[t]();else if(t==="destroy")r.ddDraggable&&r.cleanDraggable();else if(t==="option")r.setupDraggable({[i]:s});else{const a=r.el.gridstackNode.grid;r.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=r=>t._accept(r)),this._getDDElements(e).forEach(r=>{t==="disable"||t==="enable"?r.ddDroppable&&r.ddDroppable[t]():t==="destroy"?r.ddDroppable&&r.cleanDroppable():t==="option"?r.setupDroppable({[i]:s}):r.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(s=>s.on(t,r=>{i(r,C.dragElement?C.dragElement.el:r.target,C.dragElement?C.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t=!0){const i=u.getElements(e);if(!i.length)return[];const s=i.map(r=>r.ddElement||(t?Be.init(r):null));return t||s.filter(r=>r),s}}/*!
|
|
1
|
+
(function(E,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong-ui-public/analytics-chart"),require("swrv"),require("axios"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong-ui-public/analytics-metric-provider"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/analytics-utilities","@kong-ui-public/analytics-chart","swrv","axios","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong-ui-public/analytics-metric-provider","@kong/icons"],o):(E=typeof globalThis<"u"?globalThis:E||self,o(E["kong-ui-public-dashboard-renderer"]={},E.Vue,E["kong-ui-public-analytics-utilities"],E["kong-ui-public-analytics-chart"],E.swrv,E.axios,E["kong-ui-public-i18n"],E["kong-ui-public-analytics-config-store"],E["kong-ui-public-analytics-metric-provider"],E.KongIcons))})(this,function(E,o,S,X,ze,mi,Fe,Ge,Ue,Ae){"use strict";var ui=Object.defineProperty;var ft=E=>{throw TypeError(E)};var fi=(E,o,S)=>o in E?ui(E,o,{enumerable:!0,configurable:!0,writable:!0,value:S}):E[o]=S;var mt=(E,o,S)=>fi(E,typeof o!="symbol"?o+"":o,S),qe=(E,o,S)=>o.has(E)||ft("Cannot "+S);var w=(E,o,S)=>(qe(E,o,"read from private field"),S?S.call(E):o.get(E)),I=(E,o,S)=>o.has(E)?ft("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(E):o.set(E,S),H=(E,o,S,X)=>(qe(E,o,"write to private field"),X?X.call(E,S):o.set(E,S),S),q=(E,o,S)=>(qe(E,o,"access private method"),S);var ye=(E,o,S,X)=>({set _(ze){H(E,o,ze,S)},get _(){return w(E,o,X)}});var G,re,ne,J,fe,oe,me,U,ae,$,ge,W,le,Q,pe,xe,D,gt,pt,yt,_t,vt,De,Pe,$e,Se,wt,Ne;var We=(f=>(f.VALIDATING="VALIDATING",f.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",f.PENDING="PENDING",f.SUCCESS="SUCCESS",f.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",f.ERROR="ERROR",f.STALE_IF_ERROR="STALE_IF_ERROR",f))(We||{});const bt=f=>{var e,t,i,s,r;return f?!!((e=Object.keys(f))!=null&&e.length||(t=f.data)!=null&&t.length||(s=(i=f.data)==null?void 0:i.data)!=null&&s.length||!((r=f.data)!=null&&r.data)&&typeof f.data=="object"&&Object.keys(f==null?void 0:f.data).length):!1};function Et(f=o.ref({}),e,t,i=bt){const s=o.ref("PENDING");return o.watchEffect(()=>{const r=i(f.value);if(f.value&&r&&t.value){s.value="VALIDATING_HAS_DATA";return}if(f.value&&t.value){s.value="VALIDATING";return}if(f.value&&e.value){s.value="STALE_IF_ERROR";return}if(f.value===void 0&&!e.value){s.value="PENDING";return}if(f.value&&!e.value&&r){s.value="SUCCESS_HAS_DATA";return}if(f.value&&!e.value){s.value="SUCCESS";return}f.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:We}}const Ct={renderer:{noQueryBridge:"No query bridge provided. Unable to render dashboard.",trendRange:{"24h":"Last 24-hour summary","7d":"Last 7-day summary","30d":"Last 30-day summary"},edit:"Edit",duplicateTile:"Duplicate",remove:"Remove",delete:"Delete"},queryDataProvider:{forbidden:"You do not have permission to query this data.",timeRangeExceeded:"The time range for this report is outside of your organization's data retention period",timeout:"Query timed out. Consider querying a shorter time range."},csvExport:{defaultFilename:"Chart export",exportAsCsv:"Export as CSV"},jumpToExplore:"Explore",jumpToRequests:"View requests",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"}};function xt(){const f=Fe.createI18n("en-us",Ct);return{i18n:f,i18nT:Fe.i18nTComponent(f)}}const de=170,Oe=6,Z="analytics-query-provider",He="{entity-id}",Ve="{cp-id}",Ke="{timeframe}",Ye=30*1e3;function Rt(){const f=o.inject(Z);return{evaluateFeatureFlag:(t,i)=>f?f.evaluateFeatureFlagFn(t,i):i}}function kt(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var je={exports:{}};(function(f){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(c,d,h){this.fn=c,this.context=d,this.once=h||!1}function r(c,d,h,l,m){if(typeof h!="function")throw new TypeError("The listener must be a function");var y=new s(h,l||c,m),g=t?t+d:d;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],y]:c._events[g].push(y):(c._events[g]=y,c._eventsCount++),c}function a(c,d){--c._eventsCount===0?c._events=new i:delete c._events[d]}function n(){this._events=new i,this._eventsCount=0}n.prototype.eventNames=function(){var d=[],h,l;if(this._eventsCount===0)return d;for(l in h=this._events)e.call(h,l)&&d.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(h)):d},n.prototype.listeners=function(d){var h=t?t+d:d,l=this._events[h];if(!l)return[];if(l.fn)return[l.fn];for(var m=0,y=l.length,g=new Array(y);m<y;m++)g[m]=l[m].fn;return g},n.prototype.listenerCount=function(d){var h=t?t+d:d,l=this._events[h];return l?l.fn?1:l.length:0},n.prototype.emit=function(d,h,l,m,y,g){var v=t?t+d:d;if(!this._events[v])return!1;var p=this._events[v],T=arguments.length,N,k;if(p.fn){switch(p.once&&this.removeListener(d,p.fn,void 0,!0),T){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,h),!0;case 3:return p.fn.call(p.context,h,l),!0;case 4:return p.fn.call(p.context,h,l,m),!0;case 5:return p.fn.call(p.context,h,l,m,y),!0;case 6:return p.fn.call(p.context,h,l,m,y,g),!0}for(k=1,N=new Array(T-1);k<T;k++)N[k-1]=arguments[k];p.fn.apply(p.context,N)}else{var M=p.length,R;for(k=0;k<M;k++)switch(p[k].once&&this.removeListener(d,p[k].fn,void 0,!0),T){case 1:p[k].fn.call(p[k].context);break;case 2:p[k].fn.call(p[k].context,h);break;case 3:p[k].fn.call(p[k].context,h,l);break;case 4:p[k].fn.call(p[k].context,h,l,m);break;default:if(!N)for(R=1,N=new Array(T-1);R<T;R++)N[R-1]=arguments[R];p[k].fn.apply(p[k].context,N)}}return!0},n.prototype.on=function(d,h,l){return r(this,d,h,l,!1)},n.prototype.once=function(d,h,l){return r(this,d,h,l,!0)},n.prototype.removeListener=function(d,h,l,m){var y=t?t+d:d;if(!this._events[y])return this;if(!h)return a(this,y),this;var g=this._events[y];if(g.fn)g.fn===h&&(!m||g.once)&&(!l||g.context===l)&&a(this,y);else{for(var v=0,p=[],T=g.length;v<T;v++)(g[v].fn!==h||m&&!g[v].once||l&&g[v].context!==l)&&p.push(g[v]);p.length?this._events[y]=p.length===1?p[0]:p:a(this,y)}return this},n.prototype.removeAllListeners=function(d){var h;return d?(h=t?t+d:d,this._events[h]&&a(this,h)):(this._events=new i,this._eventsCount=0),this},n.prototype.off=n.prototype.removeListener,n.prototype.addListener=n.prototype.on,n.prefixed=t,n.EventEmitter=n,f.exports=n})(je);var Tt=je.exports;const Dt=kt(Tt);class Xe extends Error{constructor(e){super(e),this.name="TimeoutError"}}class St extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const Qe=f=>globalThis.DOMException===void 0?new St(f):new DOMException(f),Ze=f=>{const e=f.reason===void 0?Qe("This operation was aborted."):f.reason;return e instanceof Error?e:Qe(e)};function Nt(f,e){const{milliseconds:t,fallback:i,message:s,customTimers:r={setTimeout,clearTimeout}}=e;let a,n;const d=new Promise((h,l)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){const{signal:y}=e;y.aborted&&l(Ze(y)),n=()=>{l(Ze(y))},y.addEventListener("abort",n,{once:!0})}if(t===Number.POSITIVE_INFINITY){f.then(h,l);return}const m=new Xe;a=r.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(y){l(y)}return}typeof f.cancel=="function"&&f.cancel(),s===!1?h():s instanceof Error?l(s):(m.message=s??`Promise timed out after ${t} milliseconds`,l(m))},t),(async()=>{try{h(await f)}catch(y){l(y)}})()}).finally(()=>{d.clear(),n&&e.signal&&e.signal.removeEventListener("abort",n)});return d.clear=()=>{r.clearTimeout.call(void 0,a),a=void 0},d}function zt(f,e,t){let i=0,s=f.length;for(;s>0;){const r=Math.trunc(s/2);let a=i+r;t(f[a],e)<=0?(i=++a,s-=r+1):s=r}return i}class At{constructor(){I(this,G,[])}enqueue(e,t){t={priority:0,...t};const i={priority:t.priority,id:t.id,run:e};if(this.size===0||w(this,G)[this.size-1].priority>=t.priority){w(this,G).push(i);return}const s=zt(w(this,G),i,(r,a)=>a.priority-r.priority);w(this,G).splice(s,0,i)}setPriority(e,t){const i=w(this,G).findIndex(r=>r.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=w(this,G).splice(i,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){const e=w(this,G).shift();return e==null?void 0:e.run}filter(e){return w(this,G).filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return w(this,G).length}}G=new WeakMap;class Ot extends Dt{constructor(t){var i,s;super();I(this,D);I(this,re);I(this,ne);I(this,J,0);I(this,fe);I(this,oe);I(this,me,0);I(this,U);I(this,ae);I(this,$);I(this,ge);I(this,W,0);I(this,le);I(this,Q);I(this,pe);I(this,xe,1n);mt(this,"timeout");if(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:At,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i=t.intervalCap)==null?void 0:i.toString())??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s=t.interval)==null?void 0:s.toString())??""}\` (${typeof t.interval})`);H(this,re,t.carryoverConcurrencyCount),H(this,ne,t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0),H(this,fe,t.intervalCap),H(this,oe,t.interval),H(this,$,new t.queueClass),H(this,ge,t.queueClass),this.concurrency=t.concurrency,this.timeout=t.timeout,H(this,pe,t.throwOnTimeout===!0),H(this,Q,t.autoStart===!1)}get concurrency(){return w(this,le)}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);H(this,le,t),q(this,D,Se).call(this)}setPriority(t,i){w(this,$).setPriority(t,i)}async add(t,i={}){return i.id??(i.id=(ye(this,xe)._++).toString()),i={timeout:this.timeout,throwOnTimeout:w(this,pe),...i},new Promise((s,r)=>{w(this,$).enqueue(async()=>{var a;ye(this,W)._++,ye(this,J)._++;try{(a=i.signal)==null||a.throwIfAborted();let n=t({signal:i.signal});i.timeout&&(n=Nt(Promise.resolve(n),{milliseconds:i.timeout})),i.signal&&(n=Promise.race([n,q(this,D,wt).call(this,i.signal)]));const c=await n;s(c),this.emit("completed",c)}catch(n){if(n instanceof Xe&&!i.throwOnTimeout){s();return}r(n),this.emit("error",n)}finally{q(this,D,yt).call(this)}},i),this.emit("add"),q(this,D,De).call(this)})}async addAll(t,i){return Promise.all(t.map(async s=>this.add(s,i)))}start(){return w(this,Q)?(H(this,Q,!1),q(this,D,Se).call(this),this):this}pause(){H(this,Q,!0)}clear(){H(this,$,new(w(this,ge)))}async onEmpty(){w(this,$).size!==0&&await q(this,D,Ne).call(this,"empty")}async onSizeLessThan(t){w(this,$).size<t||await q(this,D,Ne).call(this,"next",()=>w(this,$).size<t)}async onIdle(){w(this,W)===0&&w(this,$).size===0||await q(this,D,Ne).call(this,"idle")}get size(){return w(this,$).size}sizeBy(t){return w(this,$).filter(t).length}get pending(){return w(this,W)}get isPaused(){return w(this,Q)}}re=new WeakMap,ne=new WeakMap,J=new WeakMap,fe=new WeakMap,oe=new WeakMap,me=new WeakMap,U=new WeakMap,ae=new WeakMap,$=new WeakMap,ge=new WeakMap,W=new WeakMap,le=new WeakMap,Q=new WeakMap,pe=new WeakMap,xe=new WeakMap,D=new WeakSet,gt=function(){return w(this,ne)||w(this,J)<w(this,fe)},pt=function(){return w(this,W)<w(this,le)},yt=function(){ye(this,W)._--,q(this,D,De).call(this),this.emit("next")},_t=function(){q(this,D,$e).call(this),q(this,D,Pe).call(this),H(this,ae,void 0)},vt=function(){const t=Date.now();if(w(this,U)===void 0){const i=w(this,me)-t;if(i<0)H(this,J,w(this,re)?w(this,W):0);else return w(this,ae)===void 0&&H(this,ae,setTimeout(()=>{q(this,D,_t).call(this)},i)),!0}return!1},De=function(){if(w(this,$).size===0)return w(this,U)&&clearInterval(w(this,U)),H(this,U,void 0),this.emit("empty"),w(this,W)===0&&this.emit("idle"),!1;if(!w(this,Q)){const t=!w(this,D,vt);if(w(this,D,gt)&&w(this,D,pt)){const i=w(this,$).dequeue();return i?(this.emit("active"),i(),t&&q(this,D,Pe).call(this),!0):!1}}return!1},Pe=function(){w(this,ne)||w(this,U)!==void 0||(H(this,U,setInterval(()=>{q(this,D,$e).call(this)},w(this,oe))),H(this,me,Date.now()+w(this,oe)))},$e=function(){w(this,J)===0&&w(this,W)===0&&w(this,U)&&(clearInterval(w(this,U)),H(this,U,void 0)),H(this,J,w(this,re)?w(this,W):0),q(this,D,Se).call(this)},Se=function(){for(;q(this,D,De).call(this););},wt=async function(t){return new Promise((i,s)=>{t.addEventListener("abort",()=>{s(t.reason)},{once:!0})})},Ne=async function(t,i){return new Promise(s=>{const r=()=>{i&&!i()||(this.off(t,r),s())};this.on(t,r)})};const se={useI18n:xt,useEvaluateFeatureFlag:Rt,useRequestQueue:()=>{const f=Ge.useAnalyticsConfigStore(),e=o.inject(Z);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 Ot({carryoverConcurrencyCount:!0,concurrency:f.maxParallelRequests,interval:f.requestInterval,intervalCap:f.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,r)=>t.add(()=>e.queryFn(s,r),{throwOnTimeout:!0})};o.provide(Z,i)}},Le=o.defineComponent({__name:"QueryDataProvider",props:{context:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","queryComplete"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),r=o.inject(Z),a=()=>t.queryReady&&r?JSON.stringify([t.query,t.context,t.refreshCounter]):null,n=new AbortController;o.onUnmounted(()=>{n.abort()});const c=(T,N,k)=>{const M=[];return N&&M.push(...N),M.push(...S.stripUnknownFilters(T,k)),M},{data:d,error:h,isValidating:l}=ze(a,async()=>{var T,N,k,M;try{let{datasource:R,...x}=t.query;R||(R="basic");const A=c(R,t.query.filters,t.context.filters);let z=t.query.time_range;z?z.tz||(z={...z,tz:t.context.tz}):z={...t.context.timeSpec,tz:t.context.tz};const B={datasource:R,query:{...x,time_range:z,filters:A}},K=await(r==null?void 0:r.queryFn(B,n));return g.value=null,K}catch(R){throw(R==null?void 0:R.status)===403?g.value=s.t("queryDataProvider.forbidden"):(R==null?void 0:R.status)===408?g.value=s.t("queryDataProvider.timeout"):((N=(T=R==null?void 0:R.response)==null?void 0:T.data)==null?void 0:N.message)==="Range not allowed for this tier"?g.value=s.t("queryDataProvider.timeRangeExceeded"):g.value=((M=(k=R==null?void 0:R.response)==null?void 0:k.data)==null?void 0:M.message)||(R==null?void 0:R.message),R}finally{i("queryComplete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:y}=Et(d,h,l),g=o.ref(null),v=o.computed(()=>m.value===y.ERROR||!!g.value),p=o.computed(()=>!t.queryReady||m.value===y.PENDING);return o.watch(d,T=>{T&&i("chart-data",T)}),(T,N)=>{const k=o.resolveComponent("KSkeleton"),M=o.resolveComponent("KEmptyState");return p.value||!o.unref(d)&&!v.value?(o.openBlock(),o.createBlock(k,{key:0,class:"chart-skeleton",type:"table"})):v.value?(o.openBlock(),o.createBlock(M,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state","icon-variant":"error"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(g.value),1)]),_:1})):o.unref(d)?o.renderSlot(T.$slots,"default",{key:2,data:o.unref(d)}):o.createCommentVNode("",!0)}}}),Ht=o.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){o.useCssVars(i=>({"088169ae":`${i.height}px`}));const e=f,t=o.computed(()=>e.chartOptions.type==="single_value");return(i,s)=>(o.openBlock(),o.createBlock(Le,{context:i.context,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter},{default:o.withCtx(({data:r})=>[o.createElementVNode("div",{class:o.normalizeClass(["analytics-chart",{"single-value":t.value}])},[o.createVNode(o.unref(X.SimpleChart),{"chart-data":r,"chart-options":i.chartOptions,"synthetics-data-key":t.value?void 0:i.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],2)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),ee=(f,e)=>{const t=f.__vccOpts||f;for(const[i,s]of e)t[i]=s;return t},Je=ee(Ht,[["__scopeId","data-v-1e9ff912"]]),Lt={class:"analytics-chart"},Me=ee(o.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),{evaluateFeatureFlag:r}=se.useEvaluateFeatureFlag(),a=r("explore-v4-fine-granularity",!1),n=o.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold})),c=o.computed(()=>a&&t.context.zoomable&&!t.query.time_range),d=()=>{i("edit-tile")},h=l=>{i("chart-data",l)};return(l,m)=>{const y=o.resolveComponent("KDropdownItem");return o.openBlock(),o.createBlock(Le,{context:l.context,query:l.query,"query-ready":l.queryReady,"refresh-counter":l.refreshCounter,onChartData:h},{default:o.withCtx(({data:g})=>[o.createElementVNode("div",Lt,[o.createVNode(o.unref(X.AnalyticsChart),o.mergeProps({"allow-csv-export":l.chartOptions.allow_csv_export,"chart-data":g,"chart-options":n.value,"legend-position":"bottom","show-menu":l.context.editable,"synthetics-data-key":l.chartOptions.synthetics_data_key,"timeseries-zoom":c.value,"tooltip-title":""},l.extraProps,{onViewRequests:m[0]||(m[0]=v=>i("view-requests",v)),onZoomTimeRange:m[1]||(m[1]=v=>i("zoom-time-range",v))}),o.createSlots({_:2},[l.context.editable?{name:"menu-items",fn:o.withCtx(()=>[o.createVNode(y,{onClick:d},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["allow-csv-export","chart-data","chart-options","show-menu","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-9195a528"]]),et=o.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){return(e,t)=>(o.openBlock(),o.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,"extra-props":{showAnnotations:!1},height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),tt=o.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},emits:["zoom-time-range"],setup(f,{emit:e}){const t=e;return(i,s)=>(o.openBlock(),o.createBlock(Me,{"chart-options":i.chartOptions,context:i.context,height:i.height,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter,onZoomTimeRange:s[0]||(s[0]=r=>t("zoom-time-range",r))},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),Mt={class:"metric-card-tile-wrapper"},It=ee(o.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){const e=f,t=o.computed(()=>{const s=e.context.timeSpec;if(s.type==="absolute")return new S.Timeframe({key:"custom",timeframeText:"custom",display:"custom",startCustom:s.start,endCustom:s.end,timeframeLength:()=>s.end.getTime()-s.start.getTime(),defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["free","plus","enterprise"]});const r=S.TimePeriods.get(s.time_range);if(!r)throw new Error("Unknown time range");return r}),i=o.computed(()=>{var r,a;const s=(r=e.query)==null?void 0:r.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:(a=e.query)==null?void 0:a.datasource,overrideTimeframe:t.value,tz:e.context.tz,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}});return(s,r)=>(o.openBlock(),o.createElementBlock("div",Mt,[o.createVNode(o.unref(Ue.MetricsProvider),o.normalizeProps(o.guardReactiveProps(i.value)),{default:o.withCtx(()=>[o.createVNode(o.unref(Ue.MetricsConsumer))]),_:1},16)]))}}),[["__scopeId","data-v-7e1b1cc1"]]),it="#6c7489",Bt="12px",st="20px",rt="20px",qt={class:"fallback-entity-link","data-testid":"entity-link-parent"},nt=o.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(f){return(e,t)=>(o.openBlock(),o.createElementBlock("div",qt,o.toDisplayString(e.entityLinkData.label),1))}}),Pt=o.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){const e=f,t=o.inject(Z),i=o.defineAsyncComponent(async()=>{if(t!=null&&t.fetchComponent)try{return await t.fetchComponent("EntityLink")}catch{return nt}return nt}),s=r=>{var a;if((a=e.chartOptions)!=null&&a.entity_link)if(r.id.includes(":")){const[n,c]=r.id.split(":");return e.chartOptions.entity_link.replace(Ve,n).replace(He,c)}else return e.chartOptions.entity_link.replace(He,r.id);return""};return(r,a)=>(o.openBlock(),o.createBlock(Le,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:o.withCtx(({data:n})=>[o.createVNode(o.unref(X.TopNTable),{data:n,"synthetics-data-key":r.chartOptions.synthetics_data_key},o.createSlots({_:2},[e.chartOptions.entity_link?{name:"name",fn:o.withCtx(({record:c})=>[o.createVNode(o.unref(i),{"entity-link-data":{id:c.id,label:c.name,deleted:c.deleted},"external-link":s(c)},null,8,["entity-link-data","external-link"])]),key:"0"}:void 0]),1032,["data","synthetics-data-key"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),$t=o.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{}},setup(f){return(e,t)=>(o.openBlock(),o.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),Ft=["data-testid"],Gt={key:0,class:"tile-header"},Ut=["data-testid"],Wt={class:"badge-text"},Vt=["data-testid"],Kt={class:"delete-option"},Yt=["data-testid"],jt=["data-testid"],Xt=ee(o.defineComponent({__name:"DashboardTile",props:{definition:{},context:{},height:{default:de},queryReady:{type:Boolean},refreshCounter:{},tileId:{}},emits:["edit-tile","duplicate-tile","remove-tile","zoom-time-range"],setup(f,{emit:e}){o.useCssVars(_=>({"1f620390":`${_.height}px`}));const t=parseInt(rt,10),i=f,s=e,r=o.inject(Z),{i18n:a}=se.useI18n(),n=o.ref(),c=o.ref(!1),d=o.ref(),h=o.ref(!1),l=o.ref(""),m=o.ref(""),y=r==null?void 0:r.evaluateFeatureFlagFn("analytics-chart-zoom-actions",!1);o.onMounted(async()=>{var _,O;l.value=await((_=r==null?void 0:r.exploreBaseUrl)==null?void 0:_.call(r))??"",m.value=await((O=r==null?void 0:r.requestsBaseUrl)==null?void 0:O.call(r))??""}),o.watch(()=>i.definition,async()=>{await o.nextTick(),d.value&&(h.value=d.value.scrollWidth>d.value.clientWidth)},{immediate:!0,deep:!0});const g=o.computed(()=>{if(!l.value||!i.definition.query||!N.value)return"";const _=te.value,O=i.definition.query.dimensions??[],L={filters:_,metrics:i.definition.query.metrics??[],dimensions:O,time_range:i.definition.query.time_range||i.context.timeSpec,granularity:i.definition.query.granularity||A.value},he=["api_usage","llm_usage"].includes(i.definition.query.datasource)?i.definition.query.datasource:"api_usage";return`${l.value}?q=${JSON.stringify(L)}&d=${he}&c=${i.definition.chart.type}`}),v=o.computed(()=>{if(!m.value||!i.definition.query||!N.value)return"";const _=[...i.context.filters,...i.definition.query.filters??[]],O=ct(i.definition.query.time_range||i.context.timeSpec,_);return`${m.value}?q=${JSON.stringify(O)}`}),p=o.computed(()=>a.t("csvExport.defaultFilename")),T=o.computed(()=>N.value&&(k.value||i.context.editable)||!!x.value),N=o.computed(()=>!["golden_signals","top_n","gauge"].includes(i.definition.chart.type)),k=o.computed(()=>!!g.value||"allow_csv_export"in i.definition.chart&&i.definition.chart.allow_csv_export||i.context.editable),M={timeseries_line:tt,timeseries_bar:tt,horizontal_bar:et,vertical_bar:et,gauge:Je,donut:$t,golden_signals:It,top_n:Pt,slottable:void 0,single_value:Je},R=o.computed(()=>{const _=M[i.definition.chart.type];return _&&{component:_,rendererProps:{query:i.definition.query,context:i.context,queryReady:i.queryReady,chartOptions:i.definition.chart,height:i.height-t*2,refreshCounter:i.refreshCounter}}}),x=o.computed(()=>{var O;const _=(O=i.definition.query)==null?void 0:O.time_range;if((_==null?void 0:_.type)==="relative"){const L=S.TimePeriods.get(S.TIMEFRAME_LOOKUP[_.time_range]);return L?L.display:(console.warn("Did not recognize the given relative time range:",_.time_range),_.time_range)}else if((_==null?void 0:_.type)==="absolute"){const L=_.tz||"Etc/UTC";return`${S.formatTime(_.start,{short:!0,tz:L})} - ${S.formatTime(_.end,{short:!0,tz:L})}`}return null}),A=o.computed(()=>n.value?S.msToGranularity(n.value.meta.granularity_ms):void 0),z=o.computed(()=>["timeseries_line","timeseries_bar"].includes(i.definition.chart.type)),B=o.computed(()=>{var L;const _=i.definition.query.granularity,O=S.msToGranularity(((L=n.value)==null?void 0:L.meta.granularity_ms)||0);return z.value&&_!==O}),K=o.computed(()=>{var L;const _=S.msToGranularity(((L=n.value)==null?void 0:L.meta.granularity_ms)||0),O=i.definition.query.granularity;return a.t("query_aged_out_warning",{currentGranularity:a.t(`granularities.${_}`),savedGranularity:a.t(`granularities.${O}`)})}),te=o.computed(()=>{var L,he;const _=[...i.context.filters,...i.definition.query.filters??[]],O=((he=(L=i.definition)==null?void 0:L.query)==null?void 0:he.datasource)??"api_usage";return _.filter(ie=>S.getFieldDataSources(ie.field).some(Te=>O===Te))}),Re=()=>{s("edit-tile",i.definition)},ke=()=>{s("duplicate-tile",i.definition)},li=()=>{s("remove-tile",i.definition)},hi=_=>{n.value=_},dt=_=>{c.value=_},di=()=>{dt(!0)},ct=(_,O)=>({filter:O,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),ci=_=>{if(!m.value||!i.definition.query)return;const O=[...i.context.filters,...i.definition.query.filters??[]],L=ct(_,O);window.location.assign(`${m.value}?q=${JSON.stringify(L)}`)};return(_,O)=>{const L=o.resolveComponent("KTooltip"),he=o.resolveComponent("KBadge"),ie=o.resolveComponent("KDropdownItem"),ut=o.resolveComponent("KDropdown");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["tile-boundary",{editable:_.context.editable}]),"data-testid":`tile-${_.tileId}`},[_.definition.chart.type!=="slottable"?(o.openBlock(),o.createElementBlock("div",Gt,[o.createVNode(L,{class:"title-tooltip",disabled:!h.value,"max-width":"500",text:_.definition.chart.chart_title},{default:o.withCtx(()=>[o.createElementVNode("div",{ref_key:"titleRef",ref:d,class:"title"},o.toDisplayString(_.definition.chart.chart_title),513)]),_:1},8,["disabled","text"]),T.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"tile-actions","data-testid":`tile-actions-${_.tileId}`},[x.value?(o.openBlock(),o.createBlock(he,{key:0,"data-testid":"time-range-badge",tooltip:B.value?K.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},o.createSlots({default:o.withCtx(()=>[o.createElementVNode("span",Wt,o.toDisplayString(x.value),1)]),_:2},[B.value?{name:"icon",fn:o.withCtx(()=>[o.createVNode(o.unref(Ae.WarningIcon),{size:o.unref(Bt)},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):o.createCommentVNode("",!0),N.value&&_.context.editable?(o.openBlock(),o.createBlock(o.unref(Ae.EditIcon),{key:1,class:"edit-icon",color:o.unref(it),"data-testid":`edit-tile-${_.tileId}`,size:o.unref(st),onClick:Re},null,8,["color","data-testid","size"])):o.createCommentVNode("",!0),N.value&&k.value?(o.openBlock(),o.createBlock(ut,{key:2,class:"dropdown","data-testid":`chart-action-menu-${_.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:o.withCtx(()=>[g.value?(o.openBlock(),o.createBlock(ie,{key:0,"data-testid":`chart-jump-to-explore-${_.tileId}`,item:{label:o.unref(a).t("jumpToExplore"),to:g.value}},null,8,["data-testid","item"])):o.createCommentVNode("",!0),o.unref(y)&&v.value?(o.openBlock(),o.createBlock(ie,{key:1,"data-testid":`chart-jump-to-requests-${_.tileId}`,item:{label:o.unref(a).t("jumpToRequests"),to:v.value}},null,8,["data-testid","item"])):o.createCommentVNode("",!0),!("allowCsvExport"in _.definition.chart)||_.definition.chart.allowCsvExport?(o.openBlock(),o.createBlock(ie,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${_.tileId}`,onClick:O[0]||(O[0]=Te=>di())},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${_.tileId}`},o.toDisplayString(o.unref(a).t("csvExport.exportAsCsv")),9,Vt)]),_:1},8,["data-testid"])):o.createCommentVNode("",!0),_.context.editable?(o.openBlock(),o.createBlock(ie,{key:3,"data-testid":`duplicate-tile-${_.tileId}`,onClick:ke},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):o.createCommentVNode("",!0),_.context.editable?(o.openBlock(),o.createBlock(ie,{key:4,"data-testid":`remove-tile-${_.tileId}`,onClick:li},{default:o.withCtx(()=>[o.createElementVNode("span",Kt,o.toDisplayString(o.unref(a).t("renderer.delete")),1)]),_:1},8,["data-testid"])):o.createCommentVNode("",!0)]),default:o.withCtx(()=>[o.createVNode(o.unref(Ae.MoreIcon),{class:"kebab-action-menu",color:o.unref(it),"data-testid":`kebab-action-menu-${_.tileId}`,size:o.unref(st)},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):o.createCommentVNode("",!0)],8,Ut)):"description"in _.definition.chart?(o.openBlock(),o.createElementBlock("div",{key:1,class:"header-description","data-testid":`tile-description-${_.tileId}`},o.toDisplayString(_.definition.chart.description),9,Yt)):o.createCommentVNode("",!0),c.value?(o.openBlock(),o.createBlock(o.unref(X.CsvExportModal),{key:2,"chart-data":n.value,"data-testid":`csv-export-modal-${_.tileId}`,filename:p.value,onToggleModal:dt},null,8,["chart-data","data-testid","filename"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"tile-content","data-testid":`tile-content-${_.tileId}`},[R.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(R.value.component),o.mergeProps({key:0},R.value.rendererProps,{onChartData:hi,onViewRequests:ci,onZoomTimeRange:O[1]||(O[1]=Te=>s("zoom-time-range",Te))}),null,16)):o.createCommentVNode("",!0)],8,jt)],10,Ft)}}}),[["__scopeId","data-v-cfd4ef10"]]),Qt=(f,e)=>{let t=0;const i=new Map;e.forEach(r=>{const a=r.layout.position.row,n=i.get(a),c=r.layout.size.rows===1&&!!r.layout.size.fit_to_content;t=Math.max(t,a+r.layout.size.rows),n===void 0?i.set(a,c):i.set(a,n&&c)});const s=[];for(let r=0;r<t;r++)i.get(r)?s.push("auto"):s.push(`${f}px`);return s},ot=ee(o.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>de},tiles:{type:Array,required:!0}},setup(f){o.useCssVars(n=>({"2a38e79e":o.unref(Oe),"4cc71de6":r.value}));const e=f,t=o.ref(null),i=o.ref(0),s=new ResizeObserver(n=>{window.requestAnimationFrame(()=>{!Array.isArray(n)||!n.length||(i.value=n[0].contentRect.width)})});o.onMounted(()=>{t.value&&s.observe(t.value)}),o.onUnmounted(()=>{t.value&&s.unobserve(t.value)});const r=o.computed(()=>Qt(e.tileHeight,e.tiles).join(" ")),a=o.computed(()=>e.tiles.map((n,c)=>({key:`tile-${c}`,tile:n,style:{"grid-column-start":n.layout.position.col+1,"grid-column-end":n.layout.position.col+1+n.layout.size.cols,"grid-row-start":n.layout.position.row+1,"grid-row-end":n.layout.position.row+1+n.layout.size.rows}})));return(n,c)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"gridContainer",ref:t,class:"kong-ui-public-grid-layout"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,d=>(o.openBlock(),o.createElementBlock("div",{key:d.key,class:o.normalizeClass(["grid-cell",{"empty-cell":!d.tile}]),style:o.normalizeStyle(d.style)},[o.renderSlot(n.$slots,"tile",{style:o.normalizeStyle(d.style),tile:d.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-354b7177"]]);function Zt(f,e,t,i,s){const r=(...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(f,a));return r.prototype=e.prototype,r}class u{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const r=i.getElementById(e);return r?[r]:[]}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 createWidgetDivs(e,t){var a,n;const i=u.createDiv(["grid-stack-item",e]),s=u.createDiv(["grid-stack-item-content"],i);return t.lazyLoad||((n=(a=t.grid)==null?void 0:a.opts)==null?void 0:n.lazyLoad)&&t.lazyLoad!==!1?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([c])=>{var d;c.isIntersecting&&((d=t.visibleObservable)==null||d.disconnect(),delete t.visibleObservable,b.renderCB(s,t))}),window.setTimeout(()=>{var c;return(c=t.visibleObservable)==null?void 0:c.observe(i)})):b.renderCB(s,t),i}static createDiv(e,t){const i=document.createElement("div");return e.forEach(s=>{s&&i.classList.add(s)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0: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 u.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 r=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<=r?0:(s-i)*(a-r)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,r)=>{const a=t*((s.y??1e4)-(r.y??1e4));return a===0?t*((s.x??1e4)-(r.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"),r=i==null?void 0:i.nonce;return r&&(s.nonce=r),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],r=t[i];i[0]==="_"||s===r?delete e[i]:s&&typeof s=="object"&&r!==void 0&&(u.removeInternalAndSame(s,r),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(),r=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>r){const a=s.bottom-r,n=s.top,c=this.getScrollElement(e);if(c!==null){const d=c.scrollTop;s.top<0&&i<0?e.offsetHeight>r?c.scrollTop+=i:c.scrollTop+=Math.abs(n)>Math.abs(i)?i:n:i>0&&(e.offsetHeight>r?c.scrollTop+=i:c.scrollTop+=a>i?i:a),t.top+=c.scrollTop-d}}}static updateScrollResize(e,t,i){const s=this.getScrollElement(t),r=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,n=e.clientY-a,c=n<i,d=n>r-i;c?s.scrollBy({behavior:"smooth",top:n-i}):d&&s.scrollBy({behavior:"smooth",top:i-(r-n)})}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=u.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(r=>r===s)&&(i[s]=u.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=u.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(r=>i[r]=e[r]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(r=>i[r]=e[r]),{...i,...s}}static simulateMouseEvent(e,t,i){const s=document.createEvent("MouseEvents");s.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,e.target),(i||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const t=document.createElement("div");u.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){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class Y{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 r=t;!this._loading&&this._useEntireRowArea(e,t)&&(r={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,r,s.skip));let a=!1;const n={nested:!0,pack:!1};let c=0;for(;i=i||this.collide(e,r,s.skip);){if(c++>this.nodes.length*2)throw new Error("Infinite collide check");let d;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 h={...t,y:i.y+i.h,...n};d=this._loading&&u.samePos(e,h)?!0:this.moveNode(e,h),(i.locked||this._loading)&&d?u.copyPos(t,e):!i.locked&&d&&s.pack&&(this._packNodes(),t.y=i.y+i.h,u.copyPos(e,t)),a=a||d}else d=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...n});if(!d)return a;i=void 0}return a}collide(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.find(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.filter(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,r={...t.rect};r.y>s.y?(r.h+=r.y-s.y,r.y=s.y):r.h+=s.y-r.y,r.x>s.x?(r.w+=r.x-s.x,r.x=s.x):r.w+=s.x-r.x;let a,n=.5;for(let c of i){if(c.locked||!c._rect)break;const d=c._rect;let h=Number.MAX_VALUE,l=Number.MAX_VALUE;s.y<d.y?h=(r.y+r.h-d.y)/d.h:s.y+s.h>d.y+d.h&&(h=(d.y+d.h-r.y)/d.h),s.x<d.x?l=(r.x+r.w-d.x)/d.w:s.x+s.w>d.x+d.w&&(l=(d.x+d.w-r.x)/d.w);const m=Math.min(l,h);m>n&&(n=m,a=c)}return t.collide=a,a}cacheRects(e,t,i,s,r,a){return this.nodes.forEach(n=>n._rect={y:n.y*t+i,x:n.x*e+a,w:n.w*e-a-s,h:n.h*t-i-r}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const r=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=r,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=r,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=u.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=u.isTouching(e,t)))){if(t.y<e.y){const r=e;e=t,t=r}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=u.isTouching(e,t)))){if(t.x<e.x){const r=e;e=t,t=r}return i()}return!1}}}isAreaEmpty(e,t,i,s){const r={x:e||0,y:t||0,w:i||1,h:s||1};return!this.collide(r)}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 r=this.nodes;return this.nodes=[],r.forEach((a,n,c)=>{let d;a.locked||(a.autoPosition=!0,e==="list"&&n&&(d=c[n-1])),this.addNode(a,!1,d)}),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=u.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??Y._idSeq++;const i=e.id;if(i){let r=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+r++}(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 u.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,u.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||u.copyPos({},e);if(e.maxW&&e.w&&(e.w=Math.min(e.w,e.maxW)),e.maxH&&e.h&&(e.h=Math.min(e.h,e.maxH)),e.minW&&e.w&&e.minW<=this.column&&(e.w=Math.max(e.w,e.minW)),e.minH&&e.h&&(e.h=Math.max(e.h,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 r={...e};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,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),u.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!u.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=u.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||u.samePos(e,e._orig)||(u.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){const r=s?s.y*i+(s.x+s.w):0;let a=!1;for(let n=r;!a;++n){const c=n%i,d=Math.floor(n/i);if(c+e.w>i)continue;const h={x:c,y:d,w:e.w,h:e.h};t.find(l=>u.isIntercepted(h,l))||((e.x!==c||e.y!==d)&&(e._dirty=!0),e.x=c,e.y=d,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 r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,r=!0),this.nodes.push(e),t&&this.addedNodes.push(e),r||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 Y({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const r=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return r?(s.nodes.filter(a=>a._dirty).forEach(a=>{const n=this.nodes.find(c=>c._id===a._id);n&&(u.copyPos(n,a),n._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new Y({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=u.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){var d,h;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,r=u.copyPos({},e,!0);if(u.copyPos(r,t),this.nodeBoundFix(r,s),u.copyPos(t,r),!t.forceCollide&&u.samePos(e,t))return!1;const a=u.copyPos({},e),n=this.collideAll(e,r,t.skip);let c=!0;if(n.length){const l=e._moving&&!t.nested;let m=l?this.directionCollideCoverage(e,t,n):n[0];if(l&&m&&((h=(d=e.grid)==null?void 0:d.opts)!=null&&h.subGridDynamic)&&!e.grid._isTemp){const y=u.areaIntercept(t.rect,m._rect),g=u.area(t.rect),v=u.area(m._rect);y/(g<v?g:v)>.8&&(m.grid.makeSubGrid(m.el,void 0,e),m=void 0)}m?c=!this._fixCollisions(e,r,m,t):(c=!1,i&&delete t.pack)}return c&&!u.samePos(e,r)&&(e._dirty=!0,u.copyPos(e,r)),t.pack&&this._packNodes()._notify(),!u.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){var a;const i=(a=this._layouts)==null?void 0:a.length,s=i&&this.column!==i-1?this._layouts[i-1]:null,r=[];return this.sortNodes(),this.nodes.forEach(n=>{const c=s==null?void 0:s.find(h=>h._id===n._id),d={...n,...c||{}};u.removeInternalForSave(d,!e),t&&t(n,d),r.push(d)}),r}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(r=>{if(!r._orig)return;const a=t.find(n=>n._id===r._id);a&&(a.y>=0&&r.y!==r._orig.y&&(a.y+=r.y-r._orig.y),r.x!==r._orig.x&&(a.x=Math.round(r.x*s)),r.w!==r._orig.w&&(a.w=Math.round(r.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){var n;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 r=[],a=s?this.nodes:u.sort(this.nodes,-1);if(t>e&&this._layouts){const c=this._layouts[t]||[],d=this._layouts.length-1;!c.length&&e!==d&&((n=this._layouts[d])!=null&&n.length)&&(e=d,this._layouts[d].forEach(h=>{const l=a.find(m=>m._id===h._id);l&&(!s&&!h.autoPosition&&(l.x=h.x??l.x,l.y=h.y??l.y),l.w=h.w??l.w,(h.x==null||h.y===void 0)&&(l.autoPosition=!0))})),c.forEach(h=>{const l=a.findIndex(m=>m._id===h._id);if(l!==-1){const m=a[l];if(s){m.w=h.w;return}(h.autoPosition||isNaN(h.x)||isNaN(h.y))&&this.findEmptyPosition(h,r),h.autoPosition||(m.x=h.x??m.x,m.y=h.y??m.y,m.w=h.w??m.w,r.push(m)),a.splice(l,1)}})}if(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,r,a);else{const c=s||i==="none"?1:t/e,d=i==="move"||i==="moveScale",h=i==="scale"||i==="moveScale";a.forEach(l=>{l.x=t===1?0:d?Math.round(l.x*c):Math.min(l.x,t-1),l.w=t===1||e===1?1:h?Math.round(l.w*c)||1:Math.min(l.w,t),r.push(l)}),a=[]}r=u.sort(r,-1),this._inColumnResize=!0,this.nodes=[],r.forEach(c=>{this.addNode(c,!1),delete c._orig})}return this.nodes.forEach(c=>delete c._orig),this.batchUpdate(!1,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];return e.forEach((r,a)=>{if(r._id===void 0){const n=r.id?this.nodes.find(c=>c.id===r.id):void 0;r._id=(n==null?void 0:n._id)??Y._idSeq++}s[a]={x:r.x,y:r.y,w:r.w,_id:r._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??Y._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){var i,s;return((s=(i=this._layouts)==null?void 0:i[t])==null?void 0:s.findIndex(r=>r._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}}Y._idSeq=0;const F={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 C{}const V=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 j{}function _e(f,e){if(f.touches.length>1)return;f.cancelable&&f.preventDefault();const t=f.changedTouches[0],i=document.createEvent("MouseEvents");i.initMouseEvent(e,!0,!0,window,1,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,null),f.target.dispatchEvent(i)}function at(f,e){f.cancelable&&f.preventDefault();const t=document.createEvent("MouseEvents");t.initMouseEvent(e,!0,!0,window,1,f.screenX,f.screenY,f.clientX,f.clientY,!1,!1,!1,!1,0,null),f.target.dispatchEvent(t)}function ve(f){j.touchHandled||(j.touchHandled=!0,_e(f,"mousedown"))}function we(f){j.touchHandled&&_e(f,"mousemove")}function be(f){if(!j.touchHandled)return;j.pointerLeaveTimeout&&(window.clearTimeout(j.pointerLeaveTimeout),delete j.pointerLeaveTimeout);const e=!!C.dragElement;_e(f,"mouseup"),e||_e(f,"click"),j.touchHandled=!1}function Ee(f){f.pointerType!=="mouse"&&f.target.releasePointerCapture(f.pointerId)}function lt(f){C.dragElement&&f.pointerType!=="mouse"&&at(f,"mouseenter")}function ht(f){C.dragElement&&f.pointerType!=="mouse"&&(j.pointerLeaveTimeout=window.setTimeout(()=>{delete j.pointerLeaveTimeout,at(f,"mouseleave")},10))}class Ce{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(`${Ce.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),V&&(this.el.addEventListener("touchstart",ve),this.el.addEventListener("pointerdown",Ee)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),V&&(this.el.removeEventListener("touchstart",ve),this.el.removeEventListener("pointerdown",Ee)),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),V&&(this.el.addEventListener("touchmove",we),this.el.addEventListener("touchend",be)),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),V&&(this.el.removeEventListener("touchmove",we),this.el.removeEventListener("touchend",be)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ce.prefix="ui-resizable-";class Ie{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 ce extends Ie{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||r;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),C.overResizeElement===this&&delete C.overResizeElement),this}_mouseOver(e){C.overResizeElement||C.dragElement||(C.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){C.overResizeElement===this&&(delete C.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ce(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=u.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=u.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=u.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=u.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=u.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=ce._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=u.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 ce._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},r=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let n,c;t.indexOf("e")>-1?s.width+=r:t.indexOf("w")>-1&&(s.width-=r,s.left+=r,n=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,c=!0);const d=this._constrainSize(s.width,s.height,n,c);return Math.round(s.width)!==Math.round(d.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-d.width),s.width=d.width),Math.round(s.height)!==Math.round(d.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-d.height),s.height=d.height),s}_constrainSize(e,t,i,s){const r=this.option,a=(i?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,n=r.minWidth/this.rectScale.x||e,c=(s?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,d=r.minHeight/this.rectScale.y||t,h=Math.min(a,Math.max(n,e)),l=Math.min(c,Math.max(d,t));return{width:h,height:l}}_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}}ce._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Jt='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ue extends Ie{constructor(e,t={}){var r;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(r=t==null?void 0:t.handle)==null?void 0:r.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s!=null&&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),V&&(e.addEventListener("touchstart",ve),e.addEventListener("pointerdown",Ee))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),V&&(t.removeEventListener("touchstart",ve),t.removeEventListener("pointerdown",Ee))}),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(!C.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Jt)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete C.dragElement,delete C.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),V&&(e.currentTarget.addEventListener("touchmove",we),e.currentTarget.addEventListener("touchend",be)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),C.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=u.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),C.pauseDrag){const s=Number.isInteger(C.pauseDrag)?C.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),s)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,C.dragElement=this;const s=(i=this.el.gridstackNode)==null?void 0:i.grid;s?C.dropElement=s.el.ddElement.ddDroppable:delete C.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=u.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=u.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),V&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",we,!0),e.currentTarget.removeEventListener("touchend",be,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=C.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete C.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const s=u.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(s),this.triggerEvent("dragstop",s),C.dropElement&&C.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete C.dragElement,delete C.dropElement,delete C.mouseHandled,e.preventDefault()}_keyEvent(e){var s,r;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((r=(s=C.dropElement)==null?void 0:s.el)==null?void 0:r.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!u.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",u.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=u.cloneNode(this.el)),document.body.contains(e)||u.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ue.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(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,s=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",ue.originStyleProp.forEach(r=>i.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>i.style.transition=s,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,r=0;i&&(s=this.dragTransform.xOffset,r=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-r,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}}}}ue.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class ei extends Ie{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),V&&(this.el.addEventListener("pointerenter",lt),this.el.addEventListener("pointerleave",ht)))}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),V&&(this.el.removeEventListener("pointerenter",lt),this.el.removeEventListener("pointerleave",ht)))}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(!C.dragElement||!this._canDrop(C.dragElement.el))return;e.preventDefault(),e.stopPropagation(),C.dropElement&&C.dropElement!==this&&C.dropElement._mouseLeave(e,!0),C.dropElement=this;const t=u.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(C.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var s;if(!C.dragElement||C.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=u.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(C.dragElement)),this.triggerEvent("dropout",i),C.dropElement===this&&(delete C.dropElement,!t)){let r,a=this.el.parentElement;for(;!r&&a;)r=(s=a.ddElement)==null?void 0:s.ddDroppable,a=a.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=u.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(C.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 Be{static init(e){return e.ddElement||(e.ddElement=new Be(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 ue(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 ce(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 ei(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class ti{resizable(e,t,i,s){return this._getDDElements(e).forEach(r=>{if(t==="disable"||t==="enable")r.ddResizable&&r.ddResizable[t]();else if(t==="destroy")r.ddResizable&&r.cleanResizable();else if(t==="option")r.setupResizable({[i]:s});else{const n=r.el.gridstackNode.grid;let c=r.el.getAttribute("gs-resize-handles")||n.opts.resizable.handles||"e,s,se";c==="all"&&(c="n,e,s,w,se,sw,ne,nw");const d=!n.opts.alwaysShowResizeHandle;r.setupResizable({...n.opts.resizable,handles:c,autoHide:d,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,s){return this._getDDElements(e).forEach(r=>{if(t==="disable"||t==="enable")r.ddDraggable&&r.ddDraggable[t]();else if(t==="destroy")r.ddDraggable&&r.cleanDraggable();else if(t==="option")r.setupDraggable({[i]:s});else{const a=r.el.gridstackNode.grid;r.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=r=>t._accept(r)),this._getDDElements(e).forEach(r=>{t==="disable"||t==="enable"?r.ddDroppable&&r.ddDroppable[t]():t==="destroy"?r.ddDroppable&&r.cleanDroppable():t==="option"?r.setupDroppable({[i]:s}):r.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(s=>s.on(t,r=>{i(r,C.dragElement?C.dragElement.el:r.target,C.dragElement?C.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t=!0){const i=u.getElements(e);if(!i.length)return[];const s=i.map(r=>r.ddElement||(t?Be.init(r):null));return t||s.filter(r=>r),s}}/*!
|
|
2
2
|
* GridStack 11.3.0
|
|
3
3
|
* https://gridstackjs.com/
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
7
7
|
*/const P=new ti;class b{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=b.getGridElement(t);return i?(i.gridstack||(i.gridstack=new b(i,u.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
8
8
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||(b.getGridElements(t).forEach(s=>{s.gridstack||(s.gridstack=new b(s,u.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 ?
|
|
9
|
-
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const a=i.gridstack;return t&&(a.opts={...a.opts,...t}),t.children!==void 0&&a.load(t.children),a}return(!e.classList.contains("grid-stack")||b.addRemoveCB)&&(b.addRemoveCB?i=b.addRemoveCB(e,t,!0,!0):i=u.createDiv(["grid-stack",t.class],e)),b.init(t,i)}static registerEngine(e){b.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=u.createDiv([this.opts.placeholderClass,F.itemClass,this.opts.itemClass]);const e=u.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var l,m,y;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=u.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let s=(l=t.columnOpts)==null?void 0:l.breakpoints;const r=t;if(r.oneColumnModeDomSort&&(delete r.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),r.oneColumnSize||r.disableOneColumnMode===!1){const g=r.oneColumnSize||768;delete r.oneColumnSize,delete r.disableOneColumnMode,t.columnOpts=t.columnOpts||{},s=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let v=s.find(p=>p.c===1);v?v.w=g:(v={c:1,w:g},s.push(v,{c:12,w:g+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!((m=a.breakpoints)!=null&&m.length)?(delete t.columnOpts,s=void 0):a.columnMax=a.columnMax||12),(s==null?void 0:s.length)>1&&s.sort((g,v)=>(v.w||0)-(g.w||0));const n={...u.cloneDeep(F),column:u.toNumber(e.getAttribute("gs-column"))||F.column,minRow:i||u.toNumber(e.getAttribute("gs-min-row"))||F.minRow,maxRow:i||u.toNumber(e.getAttribute("gs-max-row"))||F.maxRow,staticGrid:u.toBool(e.getAttribute("gs-static"))||F.staticGrid,sizeToContent:u.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||F.draggable.handle},removableOptions:{accept:t.itemClass||F.removableOptions.accept,decline:F.removableOptions.decline}};e.getAttribute("gs-animate")&&(n.animate=u.toBool(e.getAttribute("gs-animate"))),t=u.defaults(t,n),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("."+F.itemClass),d=c==null?void 0:c.gridstackNode;d&&(d.subGrid=this,this.parentGridNode=d,this.el.classList.add("grid-stack-nested"),d.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!==F.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=V),this._styleSheetClass="gs-id-"+Y._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const h=t.engineClass||b.engineClass||Y;if(this.engine=new h({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:g=>{let v=0;this.engine.nodes.forEach(p=>{v=Math.max(v,p.y+p.h)}),g.forEach(p=>{const T=p.el;T&&(p._removeDOM?(T&&T.remove(),delete p._removeDOM):this._writePosAttr(T,p))}),this._updateStyles(!1,v)}}),this._updateStyles(!1,0),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(g=>this._prepareElement(g)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const g=t.children;delete t.children,g.length&&this.load(g)}this.setAnimation(),t.subGridDynamic&&!C.pauseDrag&&(C.pauseDrag=!0),((y=t.draggable)==null?void 0:y.pause)!==void 0&&(C.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!=null&&i.el?t=i.el:b.addRemoveCB?t=b.addRemoveCB(this.el,e,!0,!1):t=u.createWidgetDivs(this.opts.itemClass,i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(r=>r._id===i._id))return t;const s=this._readAttr(t);return u.defaults(e,s),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}makeSubGrid(e,t,i,s=!0){var y,g,v;let r=e.gridstackNode;if(r||(r=this.makeWidget(e).gridstackNode),(y=r.subGrid)!=null&&y.el)return r.subGrid;let a,n=this;for(;n&&!a;)a=(g=n.opts)==null?void 0:g.subGridOpts,n=(v=n.parentGridNode)==null?void 0:v.grid;t=u.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...t||r.subGridOpts||{}}),r.subGridOpts=t;let c;t.column==="auto"&&(c=!0,t.column=Math.max(r.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let d=r.el.querySelector(".grid-stack-item-content"),h,l;if(s&&(this._removeDD(r.el),l={...r,x:0,y:0},u.removeInternalForSave(l),delete l.subGridOpts,r.content&&(l.content=r.content,delete r.content),b.addRemoveCB?h=b.addRemoveCB(this.el,l,!0,!1):(h=u.createDiv(["grid-stack-item"]),h.appendChild(d),d=u.createDiv(["grid-stack-item-content"],r.el)),this._prepareDragDropByNode(r)),i){const p=c?t.column:r.w,T=r.h+i.h,N=r.el.style;N.transition="none",this.update(r.el,{w:p,h:T}),setTimeout(()=>N.transition=null)}const m=r.subGrid=b.addGrid(d,t);return i!=null&&i._moving&&(m._isTemp=!0),c&&(m._autoColumn=!0),s&&m.makeWidget(h,l),i&&(i._moving?window.setTimeout(()=>u.simulateMouseEvent(i._event,"mouseenter",m.el),0):m.makeWidget(r.el,r)),this.resizeToContentCheck(!1,r),m}removeAsSubGrid(e){var i;const t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(s=>{s.x+=this.parentGridNode.x,s.y+=this.parentGridNode.y,t.makeWidget(s.el,s)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>u.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=b.saveCB){const s=this.engine.save(e,i);if(s.forEach(r=>{var a;if(e&&r.el&&!r.subGrid&&!i){const n=r.el.querySelector(".grid-stack-item-content");r.content=n==null?void 0:n.innerHTML,r.content||delete r.content}else if(!e&&!i&&delete r.content,(a=r.subGrid)!=null&&a.el){const n=r.subGrid.save(e,t,i);r.subGridOpts=t?n:{children:n},delete r.subGrid}delete r.el}),t){const r=u.cloneDeep(this.opts);r.marginBottom===r.marginTop&&r.marginRight===r.marginLeft&&r.marginTop===r.marginRight&&(r.margin=r.marginTop,delete r.marginTop,delete r.marginRight,delete r.marginBottom,delete r.marginLeft),r.rtl===(this.el.style.direction==="rtl")&&(r.rtl="auto"),this._isAutoCellHeight&&(r.cellHeight="auto"),this._autoColumn&&(r.column="auto");const a=r._alwaysShowResizeHandle;return delete r._alwaysShowResizeHandle,a!==void 0?r.alwaysShowResizeHandle=a:delete r.alwaysShowResizeHandle,u.removeInternalAndSame(r,F),r.children=s,r}return s}load(e,t=b.addRemoveCB||!0){var d;e=u.cloneDeep(e);const i=this.getColumn();e.forEach(h=>{h.w=h.w||1,h.h=h.h||1}),e=u.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let s=0;e.forEach(h=>{s=Math.max(s,(h.x||0)+h.w)}),s>this.engine.defaultColumn&&(this.engine.defaultColumn=s),s>i&&this.engine.cacheLayout(e,s,!0);const r=b.addRemoveCB;typeof t=="function"&&(b.addRemoveCB=t);const a=[];this.batchUpdate();const n=!this.engine.nodes.length;n&&this.setAnimation(!1),!n&&t&&[...this.engine.nodes].forEach(l=>{if(!l.id)return;u.find(e,l.id)||(b.addRemoveCB&&b.addRemoveCB(this.el,l,!1,!1),a.push(l),this.removeWidget(l.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(h=>u.find(e,h.id)?(c.push(h),!1):!0),e.forEach(h=>{var m;const l=u.find(c,h.id);if(l){if(u.shouldSizeToContent(l)&&(h.h=l.h),this.engine.nodeBoundFix(h),(h.autoPosition||h.x===void 0||h.y===void 0)&&(h.w=h.w||l.w,h.h=h.h||l.h,this.engine.findEmptyPosition(h)),this.engine.nodes.push(l),u.samePos(l,h)&&this.engine.nodes.length>1&&(this.moveNode(l,{...h,forceCollide:!0}),u.copyPos(h,l)),this.update(l.el,h),(m=h.subGridOpts)!=null&&m.children){const y=l.el.querySelector(".grid-stack");y&&y.gridstack&&y.gridstack.load(h.subGridOpts.children)}}else t&&this.addWidget(h)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,r?b.addRemoveCB=r:delete b.addRemoveCB,n&&((d=this.opts)!=null&&d.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=u.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=u.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){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var r,a;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((r=e.breakpoints)!=null&&r.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 n=0;for(;n<e.breakpoints.length&&s<=e.breakpoints[n].w;)i=e.breakpoints[n++].c||t}if(i!==t){const n=(a=e.breakpoints)==null?void 0:a.find(c=>c.c===i);return this.column(i,(n==null?void 0:n.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){var t,i;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(),(t=this.parentGridNode)==null||delete t.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.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 r=e.left-s.left,a=e.top-s.top,n=i.width/this.getColumn(),c=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(r/n),y:Math.floor(a/c)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,s){return this.engine.isAreaEmpty(e,t,i,s)}makeWidget(e,t){const i=b.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const s=i.gridstackNode;this._updateContainerHeight(),s.subGridOpts&&this.makeSubGrid(i,s.subGridOpts,void 0,!1);let r;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(r=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),r&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(s=>this.on(s,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=s=>t(s):this._gsEventHandler[e]=s=>{s.detail&&t(s,s.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(b.getElements(e).forEach(s=>{if(s.parentElement&&s.parentElement!==this.el)return;let r=s.gridstackNode;r||(r=this.engine.nodes.find(a=>s===a.el)),r&&(t&&b.addRemoveCB&&b.addRemoveCB(this.el,r,!1,!1),delete s.gridstackNode,this._removeDD(s),this.engine.removeNode(r,t,i),t&&s.parentElement&&s.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&b.addRemoveCB&&b.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(s=>{this._prepareDragDropByNode(s),s.subGrid&&i&&s.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}update(e,t){if(arguments.length>2){console.warn("gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon");const i=arguments;let s=1;return t={x:i[s++],y:i[s++],w:i[s++],h:i[s++]},this.update(e,t)}return b.getElements(e).forEach(i=>{var h;const s=i==null?void 0:i.gridstackNode;if(!s)return;const r=u.cloneDeep(t);this.engine.nodeBoundFix(r),delete r.autoPosition;const a=["x","y","w","h"];let n;if(a.some(l=>r[l]!==void 0&&r[l]!==s[l])&&(n={},a.forEach(l=>{n[l]=r[l]!==void 0?r[l]:s[l],delete r[l]})),!n&&(r.minW||r.minH||r.maxW||r.maxH)&&(n={}),r.content!==void 0){const l=i.querySelector(".grid-stack-item-content");l&&l.textContent!==r.content&&(s.content=r.content,b.renderCB(l,r),(h=s.subGrid)!=null&&h.el&&(l.appendChild(s.subGrid.el),s.subGrid.opts.styleInHead||s.subGrid._updateStyles(!0))),delete r.content}let c=!1,d=!1;for(const l in r)l[0]!=="_"&&s[l]!==r[l]&&(s[l]=r[l],c=!0,d=d||!this.opts.staticGrid&&(l==="noResize"||l==="noMove"||l==="locked"));if(u.sanitizeMinMax(s),n){const l=n.w!==void 0&&n.w!==s.w;this.moveNode(s,n),l&&s.subGrid?s.subGrid.onResize(this.hasAnimationCSS()?s.w:void 0):this.resizeToContentCheck(l,s),delete s._orig}(n||c)&&this._writeAttr(i,s),d&&this._prepareDragDropByNode(s)}),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){var m,y;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 r=t.h?t.h*s:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector(b.resizeToContentParent)),!a)return;const n=e.clientHeight-a.clientHeight,c=t.h?t.h*s-n:a.clientHeight;let d;if(t.subGrid){d=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const g=t.subGrid.el.getBoundingClientRect(),v=t.subGrid.el.parentElement.getBoundingClientRect();d+=g.top-v.top}else{if((y=(m=t.subGridOpts)==null?void 0:m.children)!=null&&y.length)return;{const g=a.firstElementChild;if(!g){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${b.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}d=g.getBoundingClientRect().height||c}}if(c===d)return;r+=d-c;let h=Math.ceil(r/s);const l=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;l&&h>l&&(h=l,e.classList.add("size-to-content-max")),t.minH&&h<t.minH?h=t.minH:t.maxH&&h>t.maxH&&(h=t.maxH),h!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){b.resizeToContentCB?b.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return b.getElements(e).forEach(i=>{const s=i.gridstackNode;if(!u.canBeRotated(s))return;const r={w:s.h,h:s.w,minH:s.minW,minW:s.minH,maxH:s.maxW,maxW:s.maxH};if(t){const n=t.left>0?Math.floor(t.left/this.cellWidth()):0,c=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;r.x=s.x+n-(s.h-(c+1)),r.y=s.y+c-n}Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]});const a=s._orig;this.update(i,r),s._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=u.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(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}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;u.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,r=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const a=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=u.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,u.addCSSRule(this._styles,r,`height: ${i}${s}`);const n=this.opts.marginTop+this.opts.marginUnit,c=this.opts.marginBottom+this.opts.marginUnit,d=this.opts.marginRight+this.opts.marginUnit,h=this.opts.marginLeft+this.opts.marginUnit,l=`${r} > .grid-stack-item-content`,m=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;u.addCSSRule(this._styles,l,`top: ${n}; right: ${d}; bottom: ${c}; left: ${h};`),u.addCSSRule(this._styles,m,`top: ${n}; right: ${d}; bottom: ${c}; left: ${h};`),u.addCSSRule(this._styles,`${r} > .ui-resizable-n`,`top: ${n};`),u.addCSSRule(this._styles,`${r} > .ui-resizable-s`,`bottom: ${c}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-ne`,`right: ${d}; top: ${n}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-e`,`right: ${d}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-se`,`right: ${d}; bottom: ${c}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-nw`,`left: ${h}; top: ${n}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-w`,`left: ${h}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-sw`,`left: ${h}; bottom: ${c}`)}if(t=t||this._styles._max,t>this._styles._max){const a=n=>i*n+s;for(let n=this._styles._max+1;n<=t;n++)u.addCSSRule(this._styles,`${r}[gs-y="${n}"]`,`top: ${a(n)}`),u.addCSSRule(this._styles,`${r}[gs-h="${n+1}"]`,`height: ${a(n+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 r=u.parseHeight(getComputedStyle(this.el).minHeight);if(r.h>0&&r.unit===s){const a=Math.floor(r.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&&u.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(F.itemClass,this.opts.itemClass);const s=u.shouldSizeToContent(i);return s?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),s&&this.resizeToContentCheck(!1,i),this._prepareDragDropByNode(i),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=u.toNumber(e.getAttribute("gs-x")),i.y=u.toNumber(e.getAttribute("gs-y")),i.w=u.toNumber(e.getAttribute("gs-w")),i.h=u.toNumber(e.getAttribute("gs-h")),i.autoPosition=u.toBool(e.getAttribute("gs-auto-position")),i.noResize=u.toBool(e.getAttribute("gs-no-resize")),i.noMove=u.toBool(e.getAttribute("gs-no-move")),i.locked=u.toBool(e.getAttribute("gs-locked")),i.sizeToContent=u.toBool(e.getAttribute("gs-size-to-content")),i.id=e.getAttribute("gs-id"),i.maxW=u.toNumber(e.getAttribute("gs-max-w")),i.minW=u.toNumber(e.getAttribute("gs-min-w")),i.maxH=u.toNumber(e.getAttribute("gs-max-h")),i.minH=u.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 s in i){if(!i.hasOwnProperty(s))return;!i[s]&&i[s]!==0&&delete i[s]}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=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(s=>{s.subGrid&&s.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),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)u.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>u.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(s=>{u.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=u.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 u.getElement(e)}static getElements(e=".grid-stack-item"){return u.getElements(e)}static getGridElement(e){return b.getElement(e)}static getGridElements(e){return u.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=u.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=u.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=u.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=u.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=u.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 P}static setupDragIn(e,t,i,s=document){(t==null?void 0:t.pause)!==void 0&&(C.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?u.getElements(e,s):e).forEach((a,n)=>{P.isDraggable(a)||P.dragIn(a,t),i!=null&&i[n]&&(a.gridstackNode=i[n])})}movable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noMove:s.noMove=!0,this._prepareDragDropByNode(s))}),this)}resizable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noResize:s.noResize=!0,this._prepareDragDropByNode(s))}),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._prepareDragDropByNode(i),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._prepareDragDropByNode(i),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;const e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&b._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return P.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 P.droppable(this.el,"destroy"),this;let e,t;const i=(s,r,a)=>{var m;a=a||r;const n=a.gridstackNode;if(!n)return;if(!((m=n.grid)!=null&&m.el)){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const y=a.getBoundingClientRect();a.style.left=y.x+(this.dragTransform.xScale-1)*(s.clientX-y.x)/this.dragTransform.xScale+"px",a.style.top=y.y+(this.dragTransform.yScale-1)*(s.clientY-y.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:c,left:d}=a.getBoundingClientRect();const h=this.el.getBoundingClientRect();d-=h.left,c-=h.top;const l={position:{top:c*this.dragTransform.xScale,left:d*this.dragTransform.yScale}};if(n._temporaryRemoved){if(n.x=Math.max(0,Math.round(d/t)),n.y=Math.max(0,Math.round(c/e)),delete n.autoPosition,this.engine.nodeBoundFix(n),!this.engine.willItFit(n)){if(n.autoPosition=!0,!this.engine.willItFit(n)){P.off(r,"drag");return}n._willFitPos&&(u.copyPos(n,n._willFitPos),delete n._willFitPos)}this._onStartMoving(a,s,l,n,t,e)}else this._dragOrResize(a,s,l,n,t,e)};return P.droppable(this.el,{accept:s=>{const r=s.gridstackNode||this._readAttr(s,!1);if((r==null?void 0:r.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 n=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=s.matches(n)}if(a&&r&&this.opts.maxRow){const n={w:r.w,h:r.h,minW:r.minW,minH:r.minH};a=this.engine.willItFit(n)}return a}}).on(this.el,"dropover",(s,r,a)=>{let n=(a==null?void 0:a.gridstackNode)||r.gridstackNode;if((n==null?void 0:n.grid)===this&&!n._temporaryRemoved)return!1;if(n!=null&&n.grid&&n.grid!==this&&!n._temporaryRemoved&&n.grid._leave(r,a),a=a||r,t=this.cellWidth(),e=this.getCellHeight(!0),!n){const h=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(h){try{n=JSON.parse(h)}catch{console.error("Gridstack dropover: Bad JSON format: ",h)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}n||(n=this._readAttr(a))}n.grid||(n.el||(n={...n}),n._isExternal=!0,a.gridstackNode=n);const c=n.w||Math.round(a.offsetWidth/t)||1,d=n.h||Math.round(a.offsetHeight/e)||1;return n.grid&&n.grid!==this?(r._gridstackNodeOrig||(r._gridstackNodeOrig=n),r.gridstackNode=n={...n,w:c,h:d,grid:this},delete n.x,delete n.y,this.engine.cleanupNode(n).nodeBoundFix(n),n._initDD=n._isExternal=n._temporaryRemoved=!0):(n.w=c,n.h=d,n._temporaryRemoved=!0),b._itemRemoving(n.el,!1),P.on(r,"drag",i),i(s,r,a),!1}).on(this.el,"dropout",(s,r,a)=>{const n=(a==null?void 0:a.gridstackNode)||r.gridstackNode;return n&&(!n.grid||n.grid===this)&&(this._leave(r,a),this._isTemp&&this.removeAsSubGrid(n)),!1}).on(this.el,"drop",(s,r,a)=>{var y,g,v;const n=(a==null?void 0:a.gridstackNode)||r.gridstackNode;if((n==null?void 0:n.grid)===this&&!n._isExternal)return!1;const c=!!this.placeholder.parentElement,d=r!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const h=c&&this.opts.animate;h&&this.setAnimation(!1);const l=r._gridstackNodeOrig;if(delete r._gridstackNodeOrig,c&&(l!=null&&l.grid)&&l.grid!==this){const p=l.grid;p.engine.removeNodeFromLayoutCache(l),p.engine.removedNodes.push(l),p._triggerRemoveEvent()._triggerChangeEvent(),p.parentGridNode&&!p.engine.nodes.length&&p.opts.subGridDynamic&&p.removeAsSubGrid()}if(!n||(c&&(this.engine.cleanupNode(n),n.grid=this),(y=n.grid)==null||delete y._isTemp,P.off(r,"drag"),a!==r?(a.remove(),r=a):r.remove(),this._removeDD(r),!c))return!1;const m=(v=(g=n.subGrid)==null?void 0:g.el)==null?void 0:v.gridstack;return u.copyPos(n,this._readAttr(this.placeholder)),u.removePositioningStyles(r),d&&(n.content||n.subGridOpts||b.addRemoveCB)?(delete n.el,r=this.addWidget(n)):(this._prepareElement(r,!0,n),this.el.appendChild(r),this.resizeToContentCheck(!1,n),m&&(m.parentGridNode=n,m.opts.styleInHead||m._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(n),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...s,type:"dropped"},l&&l.grid?l:void 0,n),h&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!(i!=null&&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&&!P.isDroppable(e)&&P.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>b._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>b._itemRemoving(i,!1)),this):this}_prepareDragDropByNode(e){const t=e.el,i=e.noMove||this.opts.disableDrag,s=e.noResize||this.opts.disableResize;if(this.opts.staticGrid||i&&s)return e._initDD&&(this._removeDD(t),delete e._initDD),t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!e._initDD){let r,a;const n=(h,l)=>{this._gsEventHandler[h.type]&&this._gsEventHandler[h.type](h,h.target),r=this.cellWidth(),a=this.getCellHeight(!0),this._onStartMoving(t,h,l,e,r,a)},c=(h,l)=>{this._dragOrResize(t,h,l,e,r,a)},d=h=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete e._moving,delete e._event,delete e._lastTried;const l=e.w!==e._orig.w,m=h.target;if(!(!m.gridstackNode||m.gridstackNode.grid!==this)){if(e.el=m,e._isAboutToRemove){const y=t.gridstackNode.grid;y._gsEventHandler[h.type]&&y._gsEventHandler[h.type](h,m),y.engine.nodes.push(e),y.removeWidget(t,!0,!0)}else u.removePositioningStyles(m),e._temporaryRemoved?(u.copyPos(e,e._orig),this._writePosAttr(m,e),this.engine.addNode(e)):this._writePosAttr(m,e),this._gsEventHandler[h.type]&&this._gsEventHandler[h.type](h,m);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),h.type==="resizestop"&&(Number.isInteger(e.sizeToContent)&&(e.sizeToContent=e.h),this.resizeToContentCheck(l,e))}};P.draggable(t,{start:n,stop:d,drag:c}).resizable(t,{start:n,stop:d,resize:c}),e._initDD=!0}return P.draggable(t,i?"disable":"enable").resizable(t,s?"disable":"enable"),this}_onStartMoving(e,t,i,s,r,a){var n;if(this.engine.cleanNodes().beginUpdate(s),this._writePosAttr(this.placeholder,s),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=s,(n=s.grid)!=null&&n.el)this.dragTransform=u.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const c=this.placeholder.closest(".grid-stack");this.dragTransform=u.getValuesFromTransformedElement(c)}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(r,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const c=this.getColumn()-s.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-s.y;P.resizable(e,"option","minWidth",r*Math.min(s.minW||1,c)).resizable(e,"option","minHeight",a*Math.min(s.minH||1,d)).resizable(e,"option","maxWidth",r*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,c)).resizable(e,"option","maxWidthMoveLeft",r*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,d)).resizable(e,"option","maxHeightMoveUp",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,s.y+s.h))}}_dragOrResize(e,t,i,s,r,a){const n={...s._orig};let c,d=this.opts.marginLeft,h=this.opts.marginRight,l=this.opts.marginTop,m=this.opts.marginBottom;const y=Math.round(a*.1),g=Math.round(r*.1);if(d=Math.min(d,g),h=Math.min(h,g),l=Math.min(l,y),m=Math.min(m,y),t.type==="drag"){if(s._temporaryRemoved)return;const p=i.position.top-s._prevYPix;s._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&u.updateScrollPosition(e,i.position,p);const T=i.position.left+(i.position.left>s._lastUiPosition.left?-h:d),N=i.position.top+(i.position.top>s._lastUiPosition.top?-m:l);n.x=Math.round(T/r),n.y=Math.round(N/a);const k=this._extraDragRow;if(this.engine.collide(s,n)){const M=this.getRow();let R=Math.max(0,n.y+s.h-M);this.opts.maxRow&&M+R>this.opts.maxRow&&(R=Math.max(0,this.opts.maxRow-M)),this._extraDragRow=R}else this._extraDragRow=0;if(this._extraDragRow!==k&&this._updateContainerHeight(),s.x===n.x&&s.y===n.y)return}else if(t.type==="resize"){if(n.x<0||(u.updateScrollResize(t,e,a),n.w=Math.round((i.size.width-d)/r),n.h=Math.round((i.size.height-l)/a),s.w===n.w&&s.h===n.h)||s._lastTried&&s._lastTried.w===n.w&&s._lastTried.h===n.h)return;const p=i.position.left+d,T=i.position.top+l;n.x=Math.round(p/r),n.y=Math.round(T/a),c=!0}s._event=t,s._lastTried=n;const v={x:i.position.left+d,y:i.position.top+l,w:(i.size?i.size.width:s.w*r)-d-h,h:(i.size?i.size.height:s.h*a)-l-m};if(this.engine.moveNodeCheck(s,{...n,cellWidth:r,cellHeight:a,rect:v,resizing:c})){s._lastUiPosition=i.position,this.engine.cacheRects(r,a,l,h,m,d),delete s._skipDown,c&&s.subGrid&&s.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const p=t.target;this._writePosAttr(p,s),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,p)}}_leave(e,t){t=t||e;const i=t.gridstackNode;i&&(t.style.transform=t.style.transformOrigin=null,P.off(e,"drag"),!i._temporaryRemoved&&(i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e,i._isExternal&&this.engine.cleanupNode(i),this.opts.removable===!0&&b._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()))}commit(){return Zt(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}b.renderCB=(f,e)=>{f&&(e!=null&&e.content)&&(f.textContent=e.content)},b.resizeToContentParent=".grid-stack-item-content",b.Utils=u,b.Engine=Y,b.GDRev="11.3.0";const ii=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],si={class:"grid-stack-item-content"},ri=ee(o.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:de}},emits:["update-tiles"],setup(f,{expose:e,emit:t}){const i=f,s=t,r=o.ref(null),a=o.ref(new Map(i.tiles.map(y=>[`${y.id}`,y])));let n=null;const c=y=>`[data-id="${y}"]`,d=y=>y.map(g=>{var p;const v=a.value.get(`${(p=g.el)==null?void 0:p.getAttribute("data-id")}`);if(v)return{...v,layout:{position:{col:Number(g.x),row:Number(g.y)},size:{cols:Number(g.w),rows:Number(g.h)}}}}).filter(g=>g!==void 0),h=(y,g)=>{n&&(d(g).forEach(p=>{a.value.set(`${p.id}`,p)}),s("update-tiles",Array.from(a.value.values())))},l=(y,g)=>{g.forEach(v=>{var p;a.value.delete(`${(p=v.el)==null?void 0:p.getAttribute("data-id")}`)}),s("update-tiles",Array.from(a.value.values()))};o.onMounted(()=>{r.value&&(n=b.init({margin:10,column:He,cellHeight:i.tileHeight,resizable:{handles:"se, sw"},handle:".tile-header"},r.value),n.on("change",h),n.on("added",h),n.on("removed",l))}),o.onUnmounted(()=>{n&&n.destroy(!1)});const m=y=>{if(n&&r.value){const g=r.value.querySelector(c(y));g&&n.removeWidget(g)}};return o.watch(()=>i.tiles.length,async(y,g)=>{if(y>g&&n){const v=i.tiles.slice(g);for(const p of v)a.value.set(`${p.id}`,p),await o.nextTick(),n.makeWidget(c(p.id),{autoPosition:!0,w:p.layout.size.cols,h:p.layout.size.rows})}}),o.watchEffect(()=>{i.tiles.forEach(y=>{a.value.set(`${y.id}`,y)})}),e({removeWidget:m}),(y,g)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"gridContainer",ref:r,class:"grid-stack"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.tiles,v=>(o.openBlock(),o.createElementBlock("div",{key:v.id,class:"grid-stack-item","data-id":`${v.id}`,"data-testid":`grid-stack-item-${v.id}`,"gs-h":v.layout.size.rows,"gs-lazy-load":!0,"gs-w":v.layout.size.cols,"gs-x":v.layout.position.col,"gs-y":v.layout.position.row},[o.createElementVNode("div",si,[o.renderSlot(y.$slots,"tile",{tile:v},void 0,!0)])],8,ii))),128))],512))}}),[["__scopeId","data-v-a68d6821"]]),ni={class:"kong-ui-public-dashboard-renderer"},oi={key:0,class:"tile-container slottable-tile"},ai=ee(o.defineComponent({__name:"DashboardRenderer",props:o.mergeModels({context:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:o.mergeModels(["edit-tile","zoom-time-range"],["update:modelValue"]),setup(f,{expose:e,emit:t}){const i=f,s=t,r=o.useModel(f,"modelValue"),{i18n:a}=se.useI18n(),n=o.ref(0),c=o.ref(null),d=o.inject(Z);d||(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")),se.useRequestQueue();const h=Ge.useAnalyticsConfigStore(),l=o.computed(()=>i.context.timeSpec?i.context.timeSpec:{type:"relative",time_range:h.defaultQueryTimeForOrg}),m=o.computed(()=>!!i.context.timeSpec||!h.loading),y=(x,A)=>{const z=x.layout.position.row-A.layout.position.row;return z!==0?z:x.layout.position.col-A.layout.position.col},g=o.computed(()=>r.value.tiles.map(x=>{var z;let A=x.definition;if("description"in A.chart){const B=(z=A.chart.description)==null?void 0:z.replace(Ke,()=>{const te=`renderer.trendRange.${l.value.type==="absolute"?"custom":l.value.time_range}`;return a.te(te)?a.t(te):""});A={...A,chart:{...A.chart,description:B}}}return i.context.editable&&!x.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",x),{layout:x.layout,meta:A,type:x.type,id:x.id??crypto.randomUUID()}})),v=o.computed(()=>{var te,Re,ke;let{tz:x,refreshInterval:A,editable:z}=i.context;const B=[...i.context.filters??[],...r.value.preset_filters??[]];x||(x=new Intl.DateTimeFormat().resolvedOptions().timeZone),A===void 0&&(A=Ye),z===void 0&&(z=!1);const K=!!((ke=(Re=(te=o.getCurrentInstance())==null?void 0:te.vnode)==null?void 0:Re.props)!=null&&ke.onZoomTimeRange);return{filters:B,tz:x,timeSpec:l.value,refreshInterval:A,editable:z,zoomable:K}}),p=x=>{s("edit-tile",x)},T=x=>x.type==="slottable",N=x=>{const A=T(x.meta.chart)?{...x.meta.chart}:{...x.meta.chart,chart_title:x.meta.chart.chart_title?`Copy of ${x.meta.chart.chart_title}`:""},z={id:crypto.randomUUID(),type:"chart",definition:{...x.meta,chart:A},layout:{position:{col:0,row:0},size:x.layout.size}};r.value.tiles.push(z)},k=x=>{c.value&&c.value.removeWidget(x.id)},M=()=>{n.value++},R=x=>{const A=x.map(z=>({id:z.id,type:z.type,layout:z.layout,definition:z.meta}));r.value.tiles=A.sort(y)};return e({refresh:M}),(x,A)=>{const z=o.resolveComponent("KAlert");return o.openBlock(),o.createElementBlock("div",ni,[o.unref(d)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x.context.editable?ri:ot),{key:1,ref_key:"gridLayoutRef",ref:c,"tile-height":r.value.tile_height,tiles:g.value,onUpdateTiles:R},{tile:o.withCtx(({tile:B})=>[B.meta.chart.type==="slottable"?(o.openBlock(),o.createElementBlock("div",oi,[o.renderSlot(x.$slots,B.meta.chart.id,{},void 0,!0)])):(o.openBlock(),o.createBlock(Xt,{key:1,class:"tile-container",context:v.value,definition:B.meta,height:B.layout.size.rows*(r.value.tile_height||o.unref(de))+parseInt(o.unref(rt),10),"query-ready":m.value,"refresh-counter":n.value,"tile-id":B.id,onDuplicateTile:K=>N(B),onEditTile:K=>p(B),onRemoveTile:K=>k(B),onZoomTimeRange:A[0]||(A[0]=K=>s("zoom-time-range",K))},null,8,["context","definition","height","query-ready","refresh-counter","tile-id","onDuplicateTile","onEditTile","onRemoveTile"]))]),_:3},40,["tile-height","tiles"])):(o.openBlock(),o.createBlock(z,{key:0,appearance:"danger"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a).t("renderer.noQueryBridge")),1)]),_:1}))])}}}),[["__scopeId","data-v-b36476ce"]]);E.CP_ID_TOKEN=Ve,E.DASHBOARD_COLS=He,E.DEFAULT_TILE_HEIGHT=de,E.DEFAULT_TILE_REFRESH_INTERVAL_MS=Ye,E.DashboardRenderer=ai,E.ENTITY_ID_TOKEN=Oe,E.GridLayout=ot,E.INJECT_QUERY_PROVIDER=Z,E.TIMEFRAME_TOKEN=Ke,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const a=i.gridstack;return t&&(a.opts={...a.opts,...t}),t.children!==void 0&&a.load(t.children),a}return(!e.classList.contains("grid-stack")||b.addRemoveCB)&&(b.addRemoveCB?i=b.addRemoveCB(e,t,!0,!0):i=u.createDiv(["grid-stack",t.class],e)),b.init(t,i)}static registerEngine(e){b.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=u.createDiv([this.opts.placeholderClass,F.itemClass,this.opts.itemClass]);const e=u.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var l,m,y;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=u.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let s=(l=t.columnOpts)==null?void 0:l.breakpoints;const r=t;if(r.oneColumnModeDomSort&&(delete r.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),r.oneColumnSize||r.disableOneColumnMode===!1){const g=r.oneColumnSize||768;delete r.oneColumnSize,delete r.disableOneColumnMode,t.columnOpts=t.columnOpts||{},s=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let v=s.find(p=>p.c===1);v?v.w=g:(v={c:1,w:g},s.push(v,{c:12,w:g+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!((m=a.breakpoints)!=null&&m.length)?(delete t.columnOpts,s=void 0):a.columnMax=a.columnMax||12),(s==null?void 0:s.length)>1&&s.sort((g,v)=>(v.w||0)-(g.w||0));const n={...u.cloneDeep(F),column:u.toNumber(e.getAttribute("gs-column"))||F.column,minRow:i||u.toNumber(e.getAttribute("gs-min-row"))||F.minRow,maxRow:i||u.toNumber(e.getAttribute("gs-max-row"))||F.maxRow,staticGrid:u.toBool(e.getAttribute("gs-static"))||F.staticGrid,sizeToContent:u.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||F.draggable.handle},removableOptions:{accept:t.itemClass||F.removableOptions.accept,decline:F.removableOptions.decline}};e.getAttribute("gs-animate")&&(n.animate=u.toBool(e.getAttribute("gs-animate"))),t=u.defaults(t,n),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("."+F.itemClass),d=c==null?void 0:c.gridstackNode;d&&(d.subGrid=this,this.parentGridNode=d,this.el.classList.add("grid-stack-nested"),d.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!==F.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=V),this._styleSheetClass="gs-id-"+Y._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const h=t.engineClass||b.engineClass||Y;if(this.engine=new h({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:g=>{let v=0;this.engine.nodes.forEach(p=>{v=Math.max(v,p.y+p.h)}),g.forEach(p=>{const T=p.el;T&&(p._removeDOM?(T&&T.remove(),delete p._removeDOM):this._writePosAttr(T,p))}),this._updateStyles(!1,v)}}),this._updateStyles(!1,0),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(g=>this._prepareElement(g)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const g=t.children;delete t.children,g.length&&this.load(g)}this.setAnimation(),t.subGridDynamic&&!C.pauseDrag&&(C.pauseDrag=!0),((y=t.draggable)==null?void 0:y.pause)!==void 0&&(C.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!=null&&i.el?t=i.el:b.addRemoveCB?t=b.addRemoveCB(this.el,e,!0,!1):t=u.createWidgetDivs(this.opts.itemClass,i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(r=>r._id===i._id))return t;const s=this._readAttr(t);return u.defaults(e,s),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}makeSubGrid(e,t,i,s=!0){var y,g,v;let r=e.gridstackNode;if(r||(r=this.makeWidget(e).gridstackNode),(y=r.subGrid)!=null&&y.el)return r.subGrid;let a,n=this;for(;n&&!a;)a=(g=n.opts)==null?void 0:g.subGridOpts,n=(v=n.parentGridNode)==null?void 0:v.grid;t=u.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...t||r.subGridOpts||{}}),r.subGridOpts=t;let c;t.column==="auto"&&(c=!0,t.column=Math.max(r.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let d=r.el.querySelector(".grid-stack-item-content"),h,l;if(s&&(this._removeDD(r.el),l={...r,x:0,y:0},u.removeInternalForSave(l),delete l.subGridOpts,r.content&&(l.content=r.content,delete r.content),b.addRemoveCB?h=b.addRemoveCB(this.el,l,!0,!1):(h=u.createDiv(["grid-stack-item"]),h.appendChild(d),d=u.createDiv(["grid-stack-item-content"],r.el)),this._prepareDragDropByNode(r)),i){const p=c?t.column:r.w,T=r.h+i.h,N=r.el.style;N.transition="none",this.update(r.el,{w:p,h:T}),setTimeout(()=>N.transition=null)}const m=r.subGrid=b.addGrid(d,t);return i!=null&&i._moving&&(m._isTemp=!0),c&&(m._autoColumn=!0),s&&m.makeWidget(h,l),i&&(i._moving?window.setTimeout(()=>u.simulateMouseEvent(i._event,"mouseenter",m.el),0):m.makeWidget(r.el,r)),this.resizeToContentCheck(!1,r),m}removeAsSubGrid(e){var i;const t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(s=>{s.x+=this.parentGridNode.x,s.y+=this.parentGridNode.y,t.makeWidget(s.el,s)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>u.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=b.saveCB){const s=this.engine.save(e,i);if(s.forEach(r=>{var a;if(e&&r.el&&!r.subGrid&&!i){const n=r.el.querySelector(".grid-stack-item-content");r.content=n==null?void 0:n.innerHTML,r.content||delete r.content}else if(!e&&!i&&delete r.content,(a=r.subGrid)!=null&&a.el){const n=r.subGrid.save(e,t,i);r.subGridOpts=t?n:{children:n},delete r.subGrid}delete r.el}),t){const r=u.cloneDeep(this.opts);r.marginBottom===r.marginTop&&r.marginRight===r.marginLeft&&r.marginTop===r.marginRight&&(r.margin=r.marginTop,delete r.marginTop,delete r.marginRight,delete r.marginBottom,delete r.marginLeft),r.rtl===(this.el.style.direction==="rtl")&&(r.rtl="auto"),this._isAutoCellHeight&&(r.cellHeight="auto"),this._autoColumn&&(r.column="auto");const a=r._alwaysShowResizeHandle;return delete r._alwaysShowResizeHandle,a!==void 0?r.alwaysShowResizeHandle=a:delete r.alwaysShowResizeHandle,u.removeInternalAndSame(r,F),r.children=s,r}return s}load(e,t=b.addRemoveCB||!0){var d;e=u.cloneDeep(e);const i=this.getColumn();e.forEach(h=>{h.w=h.w||1,h.h=h.h||1}),e=u.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let s=0;e.forEach(h=>{s=Math.max(s,(h.x||0)+h.w)}),s>this.engine.defaultColumn&&(this.engine.defaultColumn=s),s>i&&this.engine.cacheLayout(e,s,!0);const r=b.addRemoveCB;typeof t=="function"&&(b.addRemoveCB=t);const a=[];this.batchUpdate();const n=!this.engine.nodes.length;n&&this.setAnimation(!1),!n&&t&&[...this.engine.nodes].forEach(l=>{if(!l.id)return;u.find(e,l.id)||(b.addRemoveCB&&b.addRemoveCB(this.el,l,!1,!1),a.push(l),this.removeWidget(l.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(h=>u.find(e,h.id)?(c.push(h),!1):!0),e.forEach(h=>{var m;const l=u.find(c,h.id);if(l){if(u.shouldSizeToContent(l)&&(h.h=l.h),this.engine.nodeBoundFix(h),(h.autoPosition||h.x===void 0||h.y===void 0)&&(h.w=h.w||l.w,h.h=h.h||l.h,this.engine.findEmptyPosition(h)),this.engine.nodes.push(l),u.samePos(l,h)&&this.engine.nodes.length>1&&(this.moveNode(l,{...h,forceCollide:!0}),u.copyPos(h,l)),this.update(l.el,h),(m=h.subGridOpts)!=null&&m.children){const y=l.el.querySelector(".grid-stack");y&&y.gridstack&&y.gridstack.load(h.subGridOpts.children)}}else t&&this.addWidget(h)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,r?b.addRemoveCB=r:delete b.addRemoveCB,n&&((d=this.opts)!=null&&d.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=u.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=u.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){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var r,a;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((r=e.breakpoints)!=null&&r.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 n=0;for(;n<e.breakpoints.length&&s<=e.breakpoints[n].w;)i=e.breakpoints[n++].c||t}if(i!==t){const n=(a=e.breakpoints)==null?void 0:a.find(c=>c.c===i);return this.column(i,(n==null?void 0:n.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){var t,i;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(),(t=this.parentGridNode)==null||delete t.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.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 r=e.left-s.left,a=e.top-s.top,n=i.width/this.getColumn(),c=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(r/n),y:Math.floor(a/c)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,s){return this.engine.isAreaEmpty(e,t,i,s)}makeWidget(e,t){const i=b.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const s=i.gridstackNode;this._updateContainerHeight(),s.subGridOpts&&this.makeSubGrid(i,s.subGridOpts,void 0,!1);let r;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(r=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),r&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(s=>this.on(s,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=s=>t(s):this._gsEventHandler[e]=s=>{s.detail&&t(s,s.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(b.getElements(e).forEach(s=>{if(s.parentElement&&s.parentElement!==this.el)return;let r=s.gridstackNode;r||(r=this.engine.nodes.find(a=>s===a.el)),r&&(t&&b.addRemoveCB&&b.addRemoveCB(this.el,r,!1,!1),delete s.gridstackNode,this._removeDD(s),this.engine.removeNode(r,t,i),t&&s.parentElement&&s.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&b.addRemoveCB&&b.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(s=>{this._prepareDragDropByNode(s),s.subGrid&&i&&s.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}update(e,t){if(arguments.length>2){console.warn("gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon");const i=arguments;let s=1;return t={x:i[s++],y:i[s++],w:i[s++],h:i[s++]},this.update(e,t)}return b.getElements(e).forEach(i=>{var h;const s=i==null?void 0:i.gridstackNode;if(!s)return;const r=u.cloneDeep(t);this.engine.nodeBoundFix(r),delete r.autoPosition;const a=["x","y","w","h"];let n;if(a.some(l=>r[l]!==void 0&&r[l]!==s[l])&&(n={},a.forEach(l=>{n[l]=r[l]!==void 0?r[l]:s[l],delete r[l]})),!n&&(r.minW||r.minH||r.maxW||r.maxH)&&(n={}),r.content!==void 0){const l=i.querySelector(".grid-stack-item-content");l&&l.textContent!==r.content&&(s.content=r.content,b.renderCB(l,r),(h=s.subGrid)!=null&&h.el&&(l.appendChild(s.subGrid.el),s.subGrid.opts.styleInHead||s.subGrid._updateStyles(!0))),delete r.content}let c=!1,d=!1;for(const l in r)l[0]!=="_"&&s[l]!==r[l]&&(s[l]=r[l],c=!0,d=d||!this.opts.staticGrid&&(l==="noResize"||l==="noMove"||l==="locked"));if(u.sanitizeMinMax(s),n){const l=n.w!==void 0&&n.w!==s.w;this.moveNode(s,n),l&&s.subGrid?s.subGrid.onResize(this.hasAnimationCSS()?s.w:void 0):this.resizeToContentCheck(l,s),delete s._orig}(n||c)&&this._writeAttr(i,s),d&&this._prepareDragDropByNode(s)}),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){var m,y;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 r=t.h?t.h*s:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector(b.resizeToContentParent)),!a)return;const n=e.clientHeight-a.clientHeight,c=t.h?t.h*s-n:a.clientHeight;let d;if(t.subGrid){d=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const g=t.subGrid.el.getBoundingClientRect(),v=t.subGrid.el.parentElement.getBoundingClientRect();d+=g.top-v.top}else{if((y=(m=t.subGridOpts)==null?void 0:m.children)!=null&&y.length)return;{const g=a.firstElementChild;if(!g){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${b.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}d=g.getBoundingClientRect().height||c}}if(c===d)return;r+=d-c;let h=Math.ceil(r/s);const l=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;l&&h>l&&(h=l,e.classList.add("size-to-content-max")),t.minH&&h<t.minH?h=t.minH:t.maxH&&h>t.maxH&&(h=t.maxH),h!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){b.resizeToContentCB?b.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return b.getElements(e).forEach(i=>{const s=i.gridstackNode;if(!u.canBeRotated(s))return;const r={w:s.h,h:s.w,minH:s.minW,minW:s.minH,maxH:s.maxW,maxW:s.maxH};if(t){const n=t.left>0?Math.floor(t.left/this.cellWidth()):0,c=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;r.x=s.x+n-(s.h-(c+1)),r.y=s.y+c-n}Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]});const a=s._orig;this.update(i,r),s._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=u.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(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}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;u.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,r=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const a=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=u.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,u.addCSSRule(this._styles,r,`height: ${i}${s}`);const n=this.opts.marginTop+this.opts.marginUnit,c=this.opts.marginBottom+this.opts.marginUnit,d=this.opts.marginRight+this.opts.marginUnit,h=this.opts.marginLeft+this.opts.marginUnit,l=`${r} > .grid-stack-item-content`,m=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;u.addCSSRule(this._styles,l,`top: ${n}; right: ${d}; bottom: ${c}; left: ${h};`),u.addCSSRule(this._styles,m,`top: ${n}; right: ${d}; bottom: ${c}; left: ${h};`),u.addCSSRule(this._styles,`${r} > .ui-resizable-n`,`top: ${n};`),u.addCSSRule(this._styles,`${r} > .ui-resizable-s`,`bottom: ${c}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-ne`,`right: ${d}; top: ${n}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-e`,`right: ${d}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-se`,`right: ${d}; bottom: ${c}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-nw`,`left: ${h}; top: ${n}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-w`,`left: ${h}`),u.addCSSRule(this._styles,`${r} > .ui-resizable-sw`,`left: ${h}; bottom: ${c}`)}if(t=t||this._styles._max,t>this._styles._max){const a=n=>i*n+s;for(let n=this._styles._max+1;n<=t;n++)u.addCSSRule(this._styles,`${r}[gs-y="${n}"]`,`top: ${a(n)}`),u.addCSSRule(this._styles,`${r}[gs-h="${n+1}"]`,`height: ${a(n+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 r=u.parseHeight(getComputedStyle(this.el).minHeight);if(r.h>0&&r.unit===s){const a=Math.floor(r.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&&u.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(F.itemClass,this.opts.itemClass);const s=u.shouldSizeToContent(i);return s?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),s&&this.resizeToContentCheck(!1,i),this._prepareDragDropByNode(i),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=u.toNumber(e.getAttribute("gs-x")),i.y=u.toNumber(e.getAttribute("gs-y")),i.w=u.toNumber(e.getAttribute("gs-w")),i.h=u.toNumber(e.getAttribute("gs-h")),i.autoPosition=u.toBool(e.getAttribute("gs-auto-position")),i.noResize=u.toBool(e.getAttribute("gs-no-resize")),i.noMove=u.toBool(e.getAttribute("gs-no-move")),i.locked=u.toBool(e.getAttribute("gs-locked")),i.sizeToContent=u.toBool(e.getAttribute("gs-size-to-content")),i.id=e.getAttribute("gs-id"),i.maxW=u.toNumber(e.getAttribute("gs-max-w")),i.minW=u.toNumber(e.getAttribute("gs-min-w")),i.maxH=u.toNumber(e.getAttribute("gs-max-h")),i.minH=u.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 s in i){if(!i.hasOwnProperty(s))return;!i[s]&&i[s]!==0&&delete i[s]}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=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(s=>{s.subGrid&&s.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),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)u.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>u.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(s=>{u.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=u.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 u.getElement(e)}static getElements(e=".grid-stack-item"){return u.getElements(e)}static getGridElement(e){return b.getElement(e)}static getGridElements(e){return u.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=u.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=u.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=u.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=u.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=u.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 P}static setupDragIn(e,t,i,s=document){(t==null?void 0:t.pause)!==void 0&&(C.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?u.getElements(e,s):e).forEach((a,n)=>{P.isDraggable(a)||P.dragIn(a,t),i!=null&&i[n]&&(a.gridstackNode=i[n])})}movable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noMove:s.noMove=!0,this._prepareDragDropByNode(s))}),this)}resizable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noResize:s.noResize=!0,this._prepareDragDropByNode(s))}),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._prepareDragDropByNode(i),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._prepareDragDropByNode(i),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;const e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&b._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return P.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 P.droppable(this.el,"destroy"),this;let e,t;const i=(s,r,a)=>{var m;a=a||r;const n=a.gridstackNode;if(!n)return;if(!((m=n.grid)!=null&&m.el)){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const y=a.getBoundingClientRect();a.style.left=y.x+(this.dragTransform.xScale-1)*(s.clientX-y.x)/this.dragTransform.xScale+"px",a.style.top=y.y+(this.dragTransform.yScale-1)*(s.clientY-y.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:c,left:d}=a.getBoundingClientRect();const h=this.el.getBoundingClientRect();d-=h.left,c-=h.top;const l={position:{top:c*this.dragTransform.xScale,left:d*this.dragTransform.yScale}};if(n._temporaryRemoved){if(n.x=Math.max(0,Math.round(d/t)),n.y=Math.max(0,Math.round(c/e)),delete n.autoPosition,this.engine.nodeBoundFix(n),!this.engine.willItFit(n)){if(n.autoPosition=!0,!this.engine.willItFit(n)){P.off(r,"drag");return}n._willFitPos&&(u.copyPos(n,n._willFitPos),delete n._willFitPos)}this._onStartMoving(a,s,l,n,t,e)}else this._dragOrResize(a,s,l,n,t,e)};return P.droppable(this.el,{accept:s=>{const r=s.gridstackNode||this._readAttr(s,!1);if((r==null?void 0:r.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 n=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=s.matches(n)}if(a&&r&&this.opts.maxRow){const n={w:r.w,h:r.h,minW:r.minW,minH:r.minH};a=this.engine.willItFit(n)}return a}}).on(this.el,"dropover",(s,r,a)=>{let n=(a==null?void 0:a.gridstackNode)||r.gridstackNode;if((n==null?void 0:n.grid)===this&&!n._temporaryRemoved)return!1;if(n!=null&&n.grid&&n.grid!==this&&!n._temporaryRemoved&&n.grid._leave(r,a),a=a||r,t=this.cellWidth(),e=this.getCellHeight(!0),!n){const h=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(h){try{n=JSON.parse(h)}catch{console.error("Gridstack dropover: Bad JSON format: ",h)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}n||(n=this._readAttr(a))}n.grid||(n.el||(n={...n}),n._isExternal=!0,a.gridstackNode=n);const c=n.w||Math.round(a.offsetWidth/t)||1,d=n.h||Math.round(a.offsetHeight/e)||1;return n.grid&&n.grid!==this?(r._gridstackNodeOrig||(r._gridstackNodeOrig=n),r.gridstackNode=n={...n,w:c,h:d,grid:this},delete n.x,delete n.y,this.engine.cleanupNode(n).nodeBoundFix(n),n._initDD=n._isExternal=n._temporaryRemoved=!0):(n.w=c,n.h=d,n._temporaryRemoved=!0),b._itemRemoving(n.el,!1),P.on(r,"drag",i),i(s,r,a),!1}).on(this.el,"dropout",(s,r,a)=>{const n=(a==null?void 0:a.gridstackNode)||r.gridstackNode;return n&&(!n.grid||n.grid===this)&&(this._leave(r,a),this._isTemp&&this.removeAsSubGrid(n)),!1}).on(this.el,"drop",(s,r,a)=>{var y,g,v;const n=(a==null?void 0:a.gridstackNode)||r.gridstackNode;if((n==null?void 0:n.grid)===this&&!n._isExternal)return!1;const c=!!this.placeholder.parentElement,d=r!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const h=c&&this.opts.animate;h&&this.setAnimation(!1);const l=r._gridstackNodeOrig;if(delete r._gridstackNodeOrig,c&&(l!=null&&l.grid)&&l.grid!==this){const p=l.grid;p.engine.removeNodeFromLayoutCache(l),p.engine.removedNodes.push(l),p._triggerRemoveEvent()._triggerChangeEvent(),p.parentGridNode&&!p.engine.nodes.length&&p.opts.subGridDynamic&&p.removeAsSubGrid()}if(!n||(c&&(this.engine.cleanupNode(n),n.grid=this),(y=n.grid)==null||delete y._isTemp,P.off(r,"drag"),a!==r?(a.remove(),r=a):r.remove(),this._removeDD(r),!c))return!1;const m=(v=(g=n.subGrid)==null?void 0:g.el)==null?void 0:v.gridstack;return u.copyPos(n,this._readAttr(this.placeholder)),u.removePositioningStyles(r),d&&(n.content||n.subGridOpts||b.addRemoveCB)?(delete n.el,r=this.addWidget(n)):(this._prepareElement(r,!0,n),this.el.appendChild(r),this.resizeToContentCheck(!1,n),m&&(m.parentGridNode=n,m.opts.styleInHead||m._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(n),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...s,type:"dropped"},l&&l.grid?l:void 0,n),h&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!(i!=null&&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&&!P.isDroppable(e)&&P.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>b._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>b._itemRemoving(i,!1)),this):this}_prepareDragDropByNode(e){const t=e.el,i=e.noMove||this.opts.disableDrag,s=e.noResize||this.opts.disableResize;if(this.opts.staticGrid||i&&s)return e._initDD&&(this._removeDD(t),delete e._initDD),t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!e._initDD){let r,a;const n=(h,l)=>{this._gsEventHandler[h.type]&&this._gsEventHandler[h.type](h,h.target),r=this.cellWidth(),a=this.getCellHeight(!0),this._onStartMoving(t,h,l,e,r,a)},c=(h,l)=>{this._dragOrResize(t,h,l,e,r,a)},d=h=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete e._moving,delete e._event,delete e._lastTried;const l=e.w!==e._orig.w,m=h.target;if(!(!m.gridstackNode||m.gridstackNode.grid!==this)){if(e.el=m,e._isAboutToRemove){const y=t.gridstackNode.grid;y._gsEventHandler[h.type]&&y._gsEventHandler[h.type](h,m),y.engine.nodes.push(e),y.removeWidget(t,!0,!0)}else u.removePositioningStyles(m),e._temporaryRemoved?(u.copyPos(e,e._orig),this._writePosAttr(m,e),this.engine.addNode(e)):this._writePosAttr(m,e),this._gsEventHandler[h.type]&&this._gsEventHandler[h.type](h,m);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),h.type==="resizestop"&&(Number.isInteger(e.sizeToContent)&&(e.sizeToContent=e.h),this.resizeToContentCheck(l,e))}};P.draggable(t,{start:n,stop:d,drag:c}).resizable(t,{start:n,stop:d,resize:c}),e._initDD=!0}return P.draggable(t,i?"disable":"enable").resizable(t,s?"disable":"enable"),this}_onStartMoving(e,t,i,s,r,a){var n;if(this.engine.cleanNodes().beginUpdate(s),this._writePosAttr(this.placeholder,s),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=s,(n=s.grid)!=null&&n.el)this.dragTransform=u.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const c=this.placeholder.closest(".grid-stack");this.dragTransform=u.getValuesFromTransformedElement(c)}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(r,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const c=this.getColumn()-s.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-s.y;P.resizable(e,"option","minWidth",r*Math.min(s.minW||1,c)).resizable(e,"option","minHeight",a*Math.min(s.minH||1,d)).resizable(e,"option","maxWidth",r*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,c)).resizable(e,"option","maxWidthMoveLeft",r*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,d)).resizable(e,"option","maxHeightMoveUp",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,s.y+s.h))}}_dragOrResize(e,t,i,s,r,a){const n={...s._orig};let c,d=this.opts.marginLeft,h=this.opts.marginRight,l=this.opts.marginTop,m=this.opts.marginBottom;const y=Math.round(a*.1),g=Math.round(r*.1);if(d=Math.min(d,g),h=Math.min(h,g),l=Math.min(l,y),m=Math.min(m,y),t.type==="drag"){if(s._temporaryRemoved)return;const p=i.position.top-s._prevYPix;s._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&u.updateScrollPosition(e,i.position,p);const T=i.position.left+(i.position.left>s._lastUiPosition.left?-h:d),N=i.position.top+(i.position.top>s._lastUiPosition.top?-m:l);n.x=Math.round(T/r),n.y=Math.round(N/a);const k=this._extraDragRow;if(this.engine.collide(s,n)){const M=this.getRow();let R=Math.max(0,n.y+s.h-M);this.opts.maxRow&&M+R>this.opts.maxRow&&(R=Math.max(0,this.opts.maxRow-M)),this._extraDragRow=R}else this._extraDragRow=0;if(this._extraDragRow!==k&&this._updateContainerHeight(),s.x===n.x&&s.y===n.y)return}else if(t.type==="resize"){if(n.x<0||(u.updateScrollResize(t,e,a),n.w=Math.round((i.size.width-d)/r),n.h=Math.round((i.size.height-l)/a),s.w===n.w&&s.h===n.h)||s._lastTried&&s._lastTried.w===n.w&&s._lastTried.h===n.h)return;const p=i.position.left+d,T=i.position.top+l;n.x=Math.round(p/r),n.y=Math.round(T/a),c=!0}s._event=t,s._lastTried=n;const v={x:i.position.left+d,y:i.position.top+l,w:(i.size?i.size.width:s.w*r)-d-h,h:(i.size?i.size.height:s.h*a)-l-m};if(this.engine.moveNodeCheck(s,{...n,cellWidth:r,cellHeight:a,rect:v,resizing:c})){s._lastUiPosition=i.position,this.engine.cacheRects(r,a,l,h,m,d),delete s._skipDown,c&&s.subGrid&&s.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const p=t.target;this._writePosAttr(p,s),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,p)}}_leave(e,t){t=t||e;const i=t.gridstackNode;i&&(t.style.transform=t.style.transformOrigin=null,P.off(e,"drag"),!i._temporaryRemoved&&(i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e,i._isExternal&&this.engine.cleanupNode(i),this.opts.removable===!0&&b._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()))}commit(){return Zt(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}b.renderCB=(f,e)=>{f&&(e!=null&&e.content)&&(f.textContent=e.content)},b.resizeToContentParent=".grid-stack-item-content",b.Utils=u,b.Engine=Y,b.GDRev="11.3.0";const ii=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],si={class:"grid-stack-item-content"},ri=ee(o.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:de}},emits:["update-tiles"],setup(f,{expose:e,emit:t}){const i=f,s=t,r=o.ref(null),a=o.ref(new Map(i.tiles.map(y=>[`${y.id}`,y])));let n=null;const c=y=>`[data-id="${y}"]`,d=y=>y.map(g=>{var p;const v=a.value.get(`${(p=g.el)==null?void 0:p.getAttribute("data-id")}`);if(v)return{...v,layout:{position:{col:Number(g.x),row:Number(g.y)},size:{cols:Number(g.w),rows:Number(g.h)}}}}).filter(g=>g!==void 0),h=(y,g)=>{n&&(d(g).forEach(p=>{a.value.set(`${p.id}`,p)}),s("update-tiles",Array.from(a.value.values())))},l=(y,g)=>{g.forEach(v=>{var p;a.value.delete(`${(p=v.el)==null?void 0:p.getAttribute("data-id")}`)}),s("update-tiles",Array.from(a.value.values()))};o.onMounted(()=>{r.value&&(n=b.init({margin:10,column:Oe,cellHeight:i.tileHeight,resizable:{handles:"se, sw"},handle:".tile-header"},r.value),n.on("change",h),n.on("added",h),n.on("removed",l))}),o.onUnmounted(()=>{n&&n.destroy(!1)});const m=y=>{if(n&&r.value){const g=r.value.querySelector(c(y));g&&n.removeWidget(g)}};return o.watch(()=>i.tiles.length,async(y,g)=>{if(y>g&&n){const v=i.tiles.slice(g);for(const p of v)a.value.set(`${p.id}`,p),await o.nextTick(),n.makeWidget(c(p.id),{autoPosition:!0,w:p.layout.size.cols,h:p.layout.size.rows})}}),o.watchEffect(()=>{i.tiles.forEach(y=>{a.value.set(`${y.id}`,y)})}),e({removeWidget:m}),(y,g)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"gridContainer",ref:r,class:"grid-stack"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.tiles,v=>(o.openBlock(),o.createElementBlock("div",{key:v.id,class:"grid-stack-item","data-id":`${v.id}`,"data-testid":`grid-stack-item-${v.id}`,"gs-h":v.layout.size.rows,"gs-lazy-load":!0,"gs-w":v.layout.size.cols,"gs-x":v.layout.position.col,"gs-y":v.layout.position.row},[o.createElementVNode("div",si,[o.renderSlot(y.$slots,"tile",{tile:v},void 0,!0)])],8,ii))),128))],512))}}),[["__scopeId","data-v-a68d6821"]]),ni={class:"kong-ui-public-dashboard-renderer"},oi={key:0,class:"tile-container slottable-tile"},ai=ee(o.defineComponent({__name:"DashboardRenderer",props:o.mergeModels({context:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:o.mergeModels(["edit-tile","zoom-time-range"],["update:modelValue"]),setup(f,{expose:e,emit:t}){const i=f,s=t,r=o.useModel(f,"modelValue"),{i18n:a}=se.useI18n(),n=o.ref(0),c=o.ref(null),d=o.inject(Z);d||(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")),se.useRequestQueue();const h=Ge.useAnalyticsConfigStore(),l=o.computed(()=>i.context.timeSpec?i.context.timeSpec:{type:"relative",time_range:h.defaultQueryTimeForOrg}),m=o.computed(()=>!!i.context.timeSpec||!h.loading),y=(x,A)=>{const z=x.layout.position.row-A.layout.position.row;return z!==0?z:x.layout.position.col-A.layout.position.col},g=o.computed(()=>r.value.tiles.map(x=>{var z;let A=x.definition;if("description"in A.chart){const B=(z=A.chart.description)==null?void 0:z.replace(Ke,()=>{const te=`renderer.trendRange.${l.value.type==="absolute"?"custom":l.value.time_range}`;return a.te(te)?a.t(te):""});A={...A,chart:{...A.chart,description:B}}}return i.context.editable&&!x.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",x),{layout:x.layout,meta:A,type:x.type,id:x.id??crypto.randomUUID()}})),v=o.computed(()=>{var te,Re,ke;let{tz:x,refreshInterval:A,editable:z}=i.context;const B=[...i.context.filters??[],...r.value.preset_filters??[]];x||(x=new Intl.DateTimeFormat().resolvedOptions().timeZone),A===void 0&&(A=Ye),z===void 0&&(z=!1);const K=!!((ke=(Re=(te=o.getCurrentInstance())==null?void 0:te.vnode)==null?void 0:Re.props)!=null&&ke.onZoomTimeRange);return{filters:B,tz:x,timeSpec:l.value,refreshInterval:A,editable:z,zoomable:K}}),p=x=>{s("edit-tile",x)},T=x=>x.type==="slottable",N=x=>{const A=T(x.meta.chart)?{...x.meta.chart}:{...x.meta.chart,chart_title:x.meta.chart.chart_title?`Copy of ${x.meta.chart.chart_title}`:""},z={id:crypto.randomUUID(),type:"chart",definition:{...x.meta,chart:A},layout:{position:{col:0,row:0},size:x.layout.size}};r.value.tiles.push(z)},k=x=>{c.value&&c.value.removeWidget(x.id)},M=()=>{n.value++},R=x=>{const A=x.map(z=>({id:z.id,type:z.type,layout:z.layout,definition:z.meta}));r.value.tiles=A.sort(y)};return e({refresh:M}),(x,A)=>{const z=o.resolveComponent("KAlert");return o.openBlock(),o.createElementBlock("div",ni,[o.unref(d)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x.context.editable?ri:ot),{key:1,ref_key:"gridLayoutRef",ref:c,"tile-height":r.value.tile_height,tiles:g.value,onUpdateTiles:R},{tile:o.withCtx(({tile:B})=>[B.meta.chart.type==="slottable"?(o.openBlock(),o.createElementBlock("div",oi,[o.renderSlot(x.$slots,B.meta.chart.id,{},void 0,!0)])):(o.openBlock(),o.createBlock(Xt,{key:1,class:"tile-container",context:v.value,definition:B.meta,height:B.layout.size.rows*(r.value.tile_height||o.unref(de))+parseInt(o.unref(rt),10),"query-ready":m.value,"refresh-counter":n.value,"tile-id":B.id,onDuplicateTile:K=>N(B),onEditTile:K=>p(B),onRemoveTile:K=>k(B),onZoomTimeRange:A[0]||(A[0]=K=>s("zoom-time-range",K))},null,8,["context","definition","height","query-ready","refresh-counter","tile-id","onDuplicateTile","onEditTile","onRemoveTile"]))]),_:3},40,["tile-height","tiles"])):(o.openBlock(),o.createBlock(z,{key:0,appearance:"danger"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a).t("renderer.noQueryBridge")),1)]),_:1}))])}}}),[["__scopeId","data-v-b36476ce"]]);E.CP_ID_TOKEN=Ve,E.DASHBOARD_COLS=Oe,E.DEFAULT_TILE_HEIGHT=de,E.DEFAULT_TILE_REFRESH_INTERVAL_MS=Ye,E.DashboardRenderer=ai,E.ENTITY_ID_TOKEN=He,E.GridLayout=ot,E.INJECT_QUERY_PROVIDER=Z,E.TIMEFRAME_TOKEN=Ke,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryDataProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QueryDataProvider.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QueryDataProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QueryDataProvider.vue"],"names":[],"mappings":"AAqMA,OAAO,KAAK,EAMV,eAAe,EAIf,mBAAmB,EACpB,MAAM,qCAAqC,CAAA;AAG5C,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAA;AA+IhE,iBAAS,cAAc;;;;YAkDO,GAAG;;;WASnB,OAAO,IAA6B;EAEjD;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;aAxNV,gCAAgC;WAClC,mBAAmB;gBACd,OAAO;oBACH,MAAM;;;;;aAHb,gCAAgC;WAClC,mBAAmB;gBACd,OAAO;oBACH,MAAM;;;;kFA+NtB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/dashboard-renderer",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/dashboard-renderer.umd.js",
|
|
6
6
|
"module": "./dist/dashboard-renderer.es.js",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"pinia": ">= 2.1.7 < 3",
|
|
29
29
|
"swrv": "^1.0.4",
|
|
30
30
|
"vue": "^3.5.13",
|
|
31
|
+
"@kong-ui-public/analytics-metric-provider": "^9.1.3",
|
|
32
|
+
"@kong-ui-public/analytics-chart": "^9.3.4",
|
|
31
33
|
"@kong-ui-public/analytics-config-store": "^1.1.3",
|
|
32
34
|
"@kong-ui-public/analytics-utilities": "^10.1.3",
|
|
35
|
+
"@kong-ui-public/i18n": "^2.4.0",
|
|
33
36
|
"@kong-ui-public/entities-shared": "^3.27.2",
|
|
34
|
-
"@kong-ui-public/
|
|
35
|
-
"@kong-ui-public/analytics-metric-provider": "^9.1.3",
|
|
36
|
-
"@kong-ui-public/sandbox-layout": "^2.2.0",
|
|
37
|
-
"@kong-ui-public/i18n": "^2.4.0"
|
|
37
|
+
"@kong-ui-public/sandbox-layout": "^2.2.0"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"@kong/kongponents": "^9.37.2",
|
|
58
58
|
"swrv": "^1.0.4",
|
|
59
59
|
"vue": "^3.5.13",
|
|
60
|
-
"@kong-ui-public/analytics-
|
|
60
|
+
"@kong-ui-public/analytics-metric-provider": "^9.1.3",
|
|
61
61
|
"@kong-ui-public/analytics-utilities": "^10.1.3",
|
|
62
62
|
"@kong-ui-public/analytics-chart": "^9.3.4",
|
|
63
|
-
"@kong-ui-public/
|
|
64
|
-
"@kong-ui-public/
|
|
63
|
+
"@kong-ui-public/i18n": "^2.4.0",
|
|
64
|
+
"@kong-ui-public/analytics-config-store": "^1.1.3"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"gridstack": "^11.3.0",
|