@feedmepos/mf-report 5.26.4 → 5.26.5

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.
Files changed (29) hide show
  1. package/dist/{App-swq2ECTF.js → App-CHmpxhGd.js} +4 -4
  2. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-D2CpsvxS.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-Dh50I1_J.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-_zBaKDEK.js → Default.vue_vue_type_script_setup_true_lang-kXXMkl__.js} +1 -1
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-B_8KaYnA.js +4777 -0
  5. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-Dun5PD4W.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CqFgahy6.js} +2521 -2562
  6. package/dist/{InsightView-zWCeytWt.js → InsightView-lAe5SXWQ.js} +4 -4
  7. package/dist/{Integration-DYCTpXlU.js → Integration-Bs7pmcOe.js} +3 -3
  8. package/dist/{Integrations-ClLIVRa8.js → Integrations-Cz9ERWgg.js} +2 -2
  9. package/dist/{Layout-B4fXLMaj.js → Layout-BKjFcu8Y.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-KKttveoS.js → MenuTab.vue_vue_type_script_setup_true_lang-B72_DMAf.js} +4 -4
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-CH7w1ORf.js → NavigationTab.vue_vue_type_script_setup_true_lang-D2srgJaG.js} +3 -3
  12. package/dist/{OverviewView-BhXfogDe.js → OverviewView-Dpas7tcy.js} +4 -4
  13. package/dist/{Report-BwmFIgo-.js → Report-BVoqqtaw.js} +3 -3
  14. package/dist/{ReportEditor-CTQ8vCNs.js → ReportEditor-BMRvFe7h.js} +228 -228
  15. package/dist/{ReportView-ZCaT-MkZ.js → ReportView-Cye0Wmrx.js} +6 -6
  16. package/dist/{Setting-Co8VUFhL.js → Setting-K1kk6LoR.js} +3 -3
  17. package/dist/{Template-22RXwi-V.js → Template-CKWMFBUU.js} +3 -3
  18. package/dist/TileEditor-CQTK-J6_.js +4027 -0
  19. package/dist/TransitionFade-0FAgcx5b.js +3360 -0
  20. package/dist/{app-B8enBaoM.js → app-B2OL_mKX.js} +1470 -993
  21. package/dist/app.js +1 -1
  22. package/dist/assets/{formatChartData.worker-CM3TtVoi.js → formatChartData.worker-BwOf9WPp.js} +5 -5
  23. package/dist/assets/{processTableData.worker-BTFUd91t.js → processTableData.worker-BlwP8Wjn.js} +5 -5
  24. package/dist/style.css +1 -1
  25. package/dist/{useRestaurantPermission-Bc9WzEui.js → useRestaurantPermission-BDbAD9_t.js} +1 -1
  26. package/package.json +1 -1
  27. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-BoRLpJ9M.js +0 -4924
  28. package/dist/TileEditor-Bs4LL9Bo.js +0 -3863
  29. package/dist/TransitionFade-BYmuDYSd.js +0 -2379
@@ -0,0 +1,3360 @@
1
+ import { defineComponent as Xe, onBeforeMount as no, onBeforeUnmount as oo, resolveComponent as j, createElementBlock as k, openBlock as D, normalizeStyle as Zt, unref as V, renderSlot as ht, createVNode as G, createElementVNode as A, toDisplayString as Q, TransitionGroup as ro, nextTick as an, h as dn, mergeModels as Mt, useModel as ot, computed as R, Fragment as Ae, renderList as Ct, createBlock as _e, normalizeClass as St, withCtx as pe, Transition as Jt, createCommentVNode as U, ref as oe, withDirectives as ao, withKeys as io, withModifiers as Rt, vModelText as lo, watch as qe, createTextVNode as so } from "vue";
2
+ import { u as Pt, a as uo } from "./vue-i18n-DVWuTfed.js";
3
+ import { useCoreStore as co } from "@feedmepos/mf-common";
4
+ import { storeToRefs as In } from "pinia";
5
+ import { useRoute as fo } from "vue-router";
6
+ import { W as z, Q as po, I as it, h as On, i as Cn, c as je, g as mo, f as ho } from "./GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CqFgahy6.js";
7
+ import { p as go, d as Sn, a as Rn } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-Dh50I1_J.js";
8
+ import { b as ln, a as fn } from "./SelectComponent.vue_vue_type_script_setup_true_lang-BL1jpiXN.js";
9
+ import { R as vo } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-B_8KaYnA.js";
10
+ import { u as bo, F as yo, r as Eo, d as $t } from "./app-B2OL_mKX.js";
11
+ import { r as pn } from "./i18n-CI_sQ5d_.js";
12
+ import { useSnackbar as _o } from "@feedmepos/ui-library";
13
+ const To = {
14
+ key: 0,
15
+ class: "flex gap-24 flex-col h-screen w-screen justify-center items-center"
16
+ }, wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ba = /* @__PURE__ */ Xe({
17
+ __name: "FullScreen",
18
+ setup(t) {
19
+ const { t: e } = Pt(), n = fo(), { isLoading: o } = In(uo()), r = co();
20
+ return no(() => {
21
+ r.hideSidebarToggle(!0);
22
+ }), oo(() => {
23
+ r.hideSidebarToggle(!1);
24
+ }), (a, i) => {
25
+ const c = j("FmCircularProgress");
26
+ return D(), k("div", {
27
+ class: "mx-auto",
28
+ style: Zt({
29
+ height: `calc(100vh - ${V(n).query.token && V(n).query.businessId ? "0" : "64"}px)`
30
+ })
31
+ }, [
32
+ V(o) ? (D(), k("div", To, [
33
+ G(c, { size: "xl" }),
34
+ A("span", wo, Q(V(e)("report.common.isLoading")), 1)
35
+ ])) : ht(a.$slots, "default", { key: 1 })
36
+ ], 4);
37
+ };
38
+ }
39
+ });
40
+ /**!
41
+ * Sortable 1.14.0
42
+ * @author RubaXa <trash@rubaxa.org>
43
+ * @author owenm <owen23355@gmail.com>
44
+ * @license MIT
45
+ */
46
+ function mn(t, e) {
47
+ var n = Object.keys(t);
48
+ if (Object.getOwnPropertySymbols) {
49
+ var o = Object.getOwnPropertySymbols(t);
50
+ e && (o = o.filter(function(r) {
51
+ return Object.getOwnPropertyDescriptor(t, r).enumerable;
52
+ })), n.push.apply(n, o);
53
+ }
54
+ return n;
55
+ }
56
+ function Ce(t) {
57
+ for (var e = 1; e < arguments.length; e++) {
58
+ var n = arguments[e] != null ? arguments[e] : {};
59
+ e % 2 ? mn(Object(n), !0).forEach(function(o) {
60
+ xo(t, o, n[o]);
61
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : mn(Object(n)).forEach(function(o) {
62
+ Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
63
+ });
64
+ }
65
+ return t;
66
+ }
67
+ function wt(t) {
68
+ "@babel/helpers - typeof";
69
+ return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? wt = function(e) {
70
+ return typeof e;
71
+ } : wt = function(e) {
72
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
73
+ }, wt(t);
74
+ }
75
+ function xo(t, e, n) {
76
+ return e in t ? Object.defineProperty(t, e, {
77
+ value: n,
78
+ enumerable: !0,
79
+ configurable: !0,
80
+ writable: !0
81
+ }) : t[e] = n, t;
82
+ }
83
+ function Le() {
84
+ return Le = Object.assign || function(t) {
85
+ for (var e = 1; e < arguments.length; e++) {
86
+ var n = arguments[e];
87
+ for (var o in n)
88
+ Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
89
+ }
90
+ return t;
91
+ }, Le.apply(this, arguments);
92
+ }
93
+ function Do(t, e) {
94
+ if (t == null) return {};
95
+ var n = {}, o = Object.keys(t), r, a;
96
+ for (a = 0; a < o.length; a++)
97
+ r = o[a], !(e.indexOf(r) >= 0) && (n[r] = t[r]);
98
+ return n;
99
+ }
100
+ function Io(t, e) {
101
+ if (t == null) return {};
102
+ var n = Do(t, e), o, r;
103
+ if (Object.getOwnPropertySymbols) {
104
+ var a = Object.getOwnPropertySymbols(t);
105
+ for (r = 0; r < a.length; r++)
106
+ o = a[r], !(e.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(t, o) && (n[o] = t[o]);
107
+ }
108
+ return n;
109
+ }
110
+ var Oo = "1.14.0";
111
+ function ke(t) {
112
+ if (typeof window < "u" && window.navigator)
113
+ return !!/* @__PURE__ */ navigator.userAgent.match(t);
114
+ }
115
+ var Me = ke(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), gt = ke(/Edge/i), hn = ke(/firefox/i), ct = ke(/safari/i) && !ke(/chrome/i) && !ke(/android/i), Fn = ke(/iP(ad|od|hone)/i), Co = ke(/chrome/i) && ke(/android/i), Nn = {
116
+ capture: !1,
117
+ passive: !1
118
+ };
119
+ function S(t, e, n) {
120
+ t.addEventListener(e, n, !Me && Nn);
121
+ }
122
+ function C(t, e, n) {
123
+ t.removeEventListener(e, n, !Me && Nn);
124
+ }
125
+ function Ft(t, e) {
126
+ if (e) {
127
+ if (e[0] === ">" && (e = e.substring(1)), t)
128
+ try {
129
+ if (t.matches)
130
+ return t.matches(e);
131
+ if (t.msMatchesSelector)
132
+ return t.msMatchesSelector(e);
133
+ if (t.webkitMatchesSelector)
134
+ return t.webkitMatchesSelector(e);
135
+ } catch {
136
+ return !1;
137
+ }
138
+ return !1;
139
+ }
140
+ }
141
+ function So(t) {
142
+ return t.host && t !== document && t.host.nodeType ? t.host : t.parentNode;
143
+ }
144
+ function Ie(t, e, n, o) {
145
+ if (t) {
146
+ n = n || document;
147
+ do {
148
+ if (e != null && (e[0] === ">" ? t.parentNode === n && Ft(t, e) : Ft(t, e)) || o && t === n)
149
+ return t;
150
+ if (t === n) break;
151
+ } while (t = So(t));
152
+ }
153
+ return null;
154
+ }
155
+ var gn = /\s+/g;
156
+ function ve(t, e, n) {
157
+ if (t && e)
158
+ if (t.classList)
159
+ t.classList[n ? "add" : "remove"](e);
160
+ else {
161
+ var o = (" " + t.className + " ").replace(gn, " ").replace(" " + e + " ", " ");
162
+ t.className = (o + (n ? " " + e : "")).replace(gn, " ");
163
+ }
164
+ }
165
+ function _(t, e, n) {
166
+ var o = t && t.style;
167
+ if (o) {
168
+ if (n === void 0)
169
+ return document.defaultView && document.defaultView.getComputedStyle ? n = document.defaultView.getComputedStyle(t, "") : t.currentStyle && (n = t.currentStyle), e === void 0 ? n : n[e];
170
+ !(e in o) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), o[e] = n + (typeof n == "string" ? "" : "px");
171
+ }
172
+ }
173
+ function tt(t, e) {
174
+ var n = "";
175
+ if (typeof t == "string")
176
+ n = t;
177
+ else
178
+ do {
179
+ var o = _(t, "transform");
180
+ o && o !== "none" && (n = o + " " + n);
181
+ } while (!e && (t = t.parentNode));
182
+ var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
183
+ return r && new r(n);
184
+ }
185
+ function An(t, e, n) {
186
+ if (t) {
187
+ var o = t.getElementsByTagName(e), r = 0, a = o.length;
188
+ if (n)
189
+ for (; r < a; r++)
190
+ n(o[r], r);
191
+ return o;
192
+ }
193
+ return [];
194
+ }
195
+ function Oe() {
196
+ var t = document.scrollingElement;
197
+ return t || document.documentElement;
198
+ }
199
+ function ee(t, e, n, o, r) {
200
+ if (!(!t.getBoundingClientRect && t !== window)) {
201
+ var a, i, c, u, s, f, l;
202
+ if (t !== window && t.parentNode && t !== Oe() ? (a = t.getBoundingClientRect(), i = a.top, c = a.left, u = a.bottom, s = a.right, f = a.height, l = a.width) : (i = 0, c = 0, u = window.innerHeight, s = window.innerWidth, f = window.innerHeight, l = window.innerWidth), (e || n) && t !== window && (r = r || t.parentNode, !Me))
203
+ do
204
+ if (r && r.getBoundingClientRect && (_(r, "transform") !== "none" || n && _(r, "position") !== "static")) {
205
+ var E = r.getBoundingClientRect();
206
+ i -= E.top + parseInt(_(r, "border-top-width")), c -= E.left + parseInt(_(r, "border-left-width")), u = i + a.height, s = c + a.width;
207
+ break;
208
+ }
209
+ while (r = r.parentNode);
210
+ if (o && t !== window) {
211
+ var y = tt(r || t), b = y && y.a, g = y && y.d;
212
+ y && (i /= g, c /= b, l /= b, f /= g, u = i + f, s = c + l);
213
+ }
214
+ return {
215
+ top: i,
216
+ left: c,
217
+ bottom: u,
218
+ right: s,
219
+ width: l,
220
+ height: f
221
+ };
222
+ }
223
+ }
224
+ function vn(t, e, n) {
225
+ for (var o = He(t, !0), r = ee(t)[e]; o; ) {
226
+ var a = ee(o)[n], i = void 0;
227
+ if (i = r >= a, !i) return o;
228
+ if (o === Oe()) break;
229
+ o = He(o, !1);
230
+ }
231
+ return !1;
232
+ }
233
+ function nt(t, e, n, o) {
234
+ for (var r = 0, a = 0, i = t.children; a < i.length; ) {
235
+ if (i[a].style.display !== "none" && i[a] !== T.ghost && (o || i[a] !== T.dragged) && Ie(i[a], n.draggable, t, !1)) {
236
+ if (r === e)
237
+ return i[a];
238
+ r++;
239
+ }
240
+ a++;
241
+ }
242
+ return null;
243
+ }
244
+ function sn(t, e) {
245
+ for (var n = t.lastElementChild; n && (n === T.ghost || _(n, "display") === "none" || e && !Ft(n, e)); )
246
+ n = n.previousElementSibling;
247
+ return n || null;
248
+ }
249
+ function Ee(t, e) {
250
+ var n = 0;
251
+ if (!t || !t.parentNode)
252
+ return -1;
253
+ for (; t = t.previousElementSibling; )
254
+ t.nodeName.toUpperCase() !== "TEMPLATE" && t !== T.clone && (!e || Ft(t, e)) && n++;
255
+ return n;
256
+ }
257
+ function bn(t) {
258
+ var e = 0, n = 0, o = Oe();
259
+ if (t)
260
+ do {
261
+ var r = tt(t), a = r.a, i = r.d;
262
+ e += t.scrollLeft * a, n += t.scrollTop * i;
263
+ } while (t !== o && (t = t.parentNode));
264
+ return [e, n];
265
+ }
266
+ function Ro(t, e) {
267
+ for (var n in t)
268
+ if (t.hasOwnProperty(n)) {
269
+ for (var o in e)
270
+ if (e.hasOwnProperty(o) && e[o] === t[n][o]) return Number(n);
271
+ }
272
+ return -1;
273
+ }
274
+ function He(t, e) {
275
+ if (!t || !t.getBoundingClientRect) return Oe();
276
+ var n = t, o = !1;
277
+ do
278
+ if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
279
+ var r = _(n);
280
+ if (n.clientWidth < n.scrollWidth && (r.overflowX == "auto" || r.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (r.overflowY == "auto" || r.overflowY == "scroll")) {
281
+ if (!n.getBoundingClientRect || n === document.body) return Oe();
282
+ if (o || e) return n;
283
+ o = !0;
284
+ }
285
+ }
286
+ while (n = n.parentNode);
287
+ return Oe();
288
+ }
289
+ function Fo(t, e) {
290
+ if (t && e)
291
+ for (var n in e)
292
+ e.hasOwnProperty(n) && (t[n] = e[n]);
293
+ return t;
294
+ }
295
+ function Bt(t, e) {
296
+ return Math.round(t.top) === Math.round(e.top) && Math.round(t.left) === Math.round(e.left) && Math.round(t.height) === Math.round(e.height) && Math.round(t.width) === Math.round(e.width);
297
+ }
298
+ var dt;
299
+ function kn(t, e) {
300
+ return function() {
301
+ if (!dt) {
302
+ var n = arguments, o = this;
303
+ n.length === 1 ? t.call(o, n[0]) : t.apply(o, n), dt = setTimeout(function() {
304
+ dt = void 0;
305
+ }, e);
306
+ }
307
+ };
308
+ }
309
+ function No() {
310
+ clearTimeout(dt), dt = void 0;
311
+ }
312
+ function Ln(t, e, n) {
313
+ t.scrollLeft += e, t.scrollTop += n;
314
+ }
315
+ function Mn(t) {
316
+ var e = window.Polymer, n = window.jQuery || window.Zepto;
317
+ return e && e.dom ? e.dom(t).cloneNode(!0) : n ? n(t).clone(!0)[0] : t.cloneNode(!0);
318
+ }
319
+ var ye = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
320
+ function Ao() {
321
+ var t = [], e;
322
+ return {
323
+ captureAnimationState: function() {
324
+ if (t = [], !!this.options.animation) {
325
+ var o = [].slice.call(this.el.children);
326
+ o.forEach(function(r) {
327
+ if (!(_(r, "display") === "none" || r === T.ghost)) {
328
+ t.push({
329
+ target: r,
330
+ rect: ee(r)
331
+ });
332
+ var a = Ce({}, t[t.length - 1].rect);
333
+ if (r.thisAnimationDuration) {
334
+ var i = tt(r, !0);
335
+ i && (a.top -= i.f, a.left -= i.e);
336
+ }
337
+ r.fromRect = a;
338
+ }
339
+ });
340
+ }
341
+ },
342
+ addAnimationState: function(o) {
343
+ t.push(o);
344
+ },
345
+ removeAnimationState: function(o) {
346
+ t.splice(Ro(t, {
347
+ target: o
348
+ }), 1);
349
+ },
350
+ animateAll: function(o) {
351
+ var r = this;
352
+ if (!this.options.animation) {
353
+ clearTimeout(e), typeof o == "function" && o();
354
+ return;
355
+ }
356
+ var a = !1, i = 0;
357
+ t.forEach(function(c) {
358
+ var u = 0, s = c.target, f = s.fromRect, l = ee(s), E = s.prevFromRect, y = s.prevToRect, b = c.rect, g = tt(s, !0);
359
+ g && (l.top -= g.f, l.left -= g.e), s.toRect = l, s.thisAnimationDuration && Bt(E, l) && !Bt(f, l) && // Make sure animatingRect is on line between toRect & fromRect
360
+ (b.top - l.top) / (b.left - l.left) === (f.top - l.top) / (f.left - l.left) && (u = Lo(b, E, y, r.options)), Bt(l, f) || (s.prevFromRect = f, s.prevToRect = l, u || (u = r.options.animation), r.animate(s, b, l, u)), u && (a = !0, i = Math.max(i, u), clearTimeout(s.animationResetTimer), s.animationResetTimer = setTimeout(function() {
361
+ s.animationTime = 0, s.prevFromRect = null, s.fromRect = null, s.prevToRect = null, s.thisAnimationDuration = null;
362
+ }, u), s.thisAnimationDuration = u);
363
+ }), clearTimeout(e), a ? e = setTimeout(function() {
364
+ typeof o == "function" && o();
365
+ }, i) : typeof o == "function" && o(), t = [];
366
+ },
367
+ animate: function(o, r, a, i) {
368
+ if (i) {
369
+ _(o, "transition", ""), _(o, "transform", "");
370
+ var c = tt(this.el), u = c && c.a, s = c && c.d, f = (r.left - a.left) / (u || 1), l = (r.top - a.top) / (s || 1);
371
+ o.animatingX = !!f, o.animatingY = !!l, _(o, "transform", "translate3d(" + f + "px," + l + "px,0)"), this.forRepaintDummy = ko(o), _(o, "transition", "transform " + i + "ms" + (this.options.easing ? " " + this.options.easing : "")), _(o, "transform", "translate3d(0,0,0)"), typeof o.animated == "number" && clearTimeout(o.animated), o.animated = setTimeout(function() {
372
+ _(o, "transition", ""), _(o, "transform", ""), o.animated = !1, o.animatingX = !1, o.animatingY = !1;
373
+ }, i);
374
+ }
375
+ }
376
+ };
377
+ }
378
+ function ko(t) {
379
+ return t.offsetWidth;
380
+ }
381
+ function Lo(t, e, n, o) {
382
+ return Math.sqrt(Math.pow(e.top - t.top, 2) + Math.pow(e.left - t.left, 2)) / Math.sqrt(Math.pow(e.top - n.top, 2) + Math.pow(e.left - n.left, 2)) * o.animation;
383
+ }
384
+ var Qe = [], Wt = {
385
+ initializeByDefault: !0
386
+ }, vt = {
387
+ mount: function(e) {
388
+ for (var n in Wt)
389
+ Wt.hasOwnProperty(n) && !(n in e) && (e[n] = Wt[n]);
390
+ Qe.forEach(function(o) {
391
+ if (o.pluginName === e.pluginName)
392
+ throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
393
+ }), Qe.push(e);
394
+ },
395
+ pluginEvent: function(e, n, o) {
396
+ var r = this;
397
+ this.eventCanceled = !1, o.cancel = function() {
398
+ r.eventCanceled = !0;
399
+ };
400
+ var a = e + "Global";
401
+ Qe.forEach(function(i) {
402
+ n[i.pluginName] && (n[i.pluginName][a] && n[i.pluginName][a](Ce({
403
+ sortable: n
404
+ }, o)), n.options[i.pluginName] && n[i.pluginName][e] && n[i.pluginName][e](Ce({
405
+ sortable: n
406
+ }, o)));
407
+ });
408
+ },
409
+ initializePlugins: function(e, n, o, r) {
410
+ Qe.forEach(function(c) {
411
+ var u = c.pluginName;
412
+ if (!(!e.options[u] && !c.initializeByDefault)) {
413
+ var s = new c(e, n, e.options);
414
+ s.sortable = e, s.options = e.options, e[u] = s, Le(o, s.defaults);
415
+ }
416
+ });
417
+ for (var a in e.options)
418
+ if (e.options.hasOwnProperty(a)) {
419
+ var i = this.modifyOption(e, a, e.options[a]);
420
+ typeof i < "u" && (e.options[a] = i);
421
+ }
422
+ },
423
+ getEventProperties: function(e, n) {
424
+ var o = {};
425
+ return Qe.forEach(function(r) {
426
+ typeof r.eventProperties == "function" && Le(o, r.eventProperties.call(n[r.pluginName], e));
427
+ }), o;
428
+ },
429
+ modifyOption: function(e, n, o) {
430
+ var r;
431
+ return Qe.forEach(function(a) {
432
+ e[a.pluginName] && a.optionListeners && typeof a.optionListeners[n] == "function" && (r = a.optionListeners[n].call(e[a.pluginName], o));
433
+ }), r;
434
+ }
435
+ };
436
+ function Mo(t) {
437
+ var e = t.sortable, n = t.rootEl, o = t.name, r = t.targetEl, a = t.cloneEl, i = t.toEl, c = t.fromEl, u = t.oldIndex, s = t.newIndex, f = t.oldDraggableIndex, l = t.newDraggableIndex, E = t.originalEvent, y = t.putSortable, b = t.extraEventProperties;
438
+ if (e = e || n && n[ye], !!e) {
439
+ var g, L = e.options, H = "on" + o.charAt(0).toUpperCase() + o.substr(1);
440
+ window.CustomEvent && !Me && !gt ? g = new CustomEvent(o, {
441
+ bubbles: !0,
442
+ cancelable: !0
443
+ }) : (g = document.createEvent("Event"), g.initEvent(o, !0, !0)), g.to = i || n, g.from = c || n, g.item = r || n, g.clone = a, g.oldIndex = u, g.newIndex = s, g.oldDraggableIndex = f, g.newDraggableIndex = l, g.originalEvent = E, g.pullMode = y ? y.lastPutMode : void 0;
444
+ var N = Ce(Ce({}, b), vt.getEventProperties(o, e));
445
+ for (var $ in N)
446
+ g[$] = N[$];
447
+ n && n.dispatchEvent(g), L[H] && L[H].call(e, g);
448
+ }
449
+ }
450
+ var Po = ["evt"], fe = function(e, n) {
451
+ var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = o.evt, a = Io(o, Po);
452
+ vt.pluginEvent.bind(T)(e, n, Ce({
453
+ dragEl: m,
454
+ parentEl: W,
455
+ ghostEl: w,
456
+ rootEl: P,
457
+ nextEl: Ke,
458
+ lastDownEl: xt,
459
+ cloneEl: Y,
460
+ cloneHidden: Ye,
461
+ dragStarted: lt,
462
+ putSortable: ie,
463
+ activeSortable: T.active,
464
+ originalEvent: r,
465
+ oldIndex: et,
466
+ oldDraggableIndex: ft,
467
+ newIndex: be,
468
+ newDraggableIndex: We,
469
+ hideGhostForTarget: $n,
470
+ unhideGhostForTarget: Bn,
471
+ cloneNowHidden: function() {
472
+ Ye = !0;
473
+ },
474
+ cloneNowShown: function() {
475
+ Ye = !1;
476
+ },
477
+ dispatchSortableEvent: function(c) {
478
+ ue({
479
+ sortable: n,
480
+ name: c,
481
+ originalEvent: r
482
+ });
483
+ }
484
+ }, a));
485
+ };
486
+ function ue(t) {
487
+ Mo(Ce({
488
+ putSortable: ie,
489
+ cloneEl: Y,
490
+ targetEl: m,
491
+ rootEl: P,
492
+ oldIndex: et,
493
+ oldDraggableIndex: ft,
494
+ newIndex: be,
495
+ newDraggableIndex: We
496
+ }, t));
497
+ }
498
+ var m, W, w, P, Ke, xt, Y, Ye, et, be, ft, We, yt, ie, Je = !1, Nt = !1, At = [], Ge, De, Yt, Ht, yn, En, lt, Ze, pt, mt = !1, Et = !1, Dt, se, Xt = [], en = !1, kt = [], Vt = typeof document < "u", _t = Fn, _n = gt || Me ? "cssFloat" : "float", Vo = Vt && !Co && !Fn && "draggable" in document.createElement("div"), Pn = function() {
499
+ if (Vt) {
500
+ if (Me)
501
+ return !1;
502
+ var t = document.createElement("x");
503
+ return t.style.cssText = "pointer-events:auto", t.style.pointerEvents === "auto";
504
+ }
505
+ }(), Vn = function(e, n) {
506
+ var o = _(e), r = parseInt(o.width) - parseInt(o.paddingLeft) - parseInt(o.paddingRight) - parseInt(o.borderLeftWidth) - parseInt(o.borderRightWidth), a = nt(e, 0, n), i = nt(e, 1, n), c = a && _(a), u = i && _(i), s = c && parseInt(c.marginLeft) + parseInt(c.marginRight) + ee(a).width, f = u && parseInt(u.marginLeft) + parseInt(u.marginRight) + ee(i).width;
507
+ if (o.display === "flex")
508
+ return o.flexDirection === "column" || o.flexDirection === "column-reverse" ? "vertical" : "horizontal";
509
+ if (o.display === "grid")
510
+ return o.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
511
+ if (a && c.float && c.float !== "none") {
512
+ var l = c.float === "left" ? "left" : "right";
513
+ return i && (u.clear === "both" || u.clear === l) ? "vertical" : "horizontal";
514
+ }
515
+ return a && (c.display === "block" || c.display === "flex" || c.display === "table" || c.display === "grid" || s >= r && o[_n] === "none" || i && o[_n] === "none" && s + f > r) ? "vertical" : "horizontal";
516
+ }, Uo = function(e, n, o) {
517
+ var r = o ? e.left : e.top, a = o ? e.right : e.bottom, i = o ? e.width : e.height, c = o ? n.left : n.top, u = o ? n.right : n.bottom, s = o ? n.width : n.height;
518
+ return r === c || a === u || r + i / 2 === c + s / 2;
519
+ }, $o = function(e, n) {
520
+ var o;
521
+ return At.some(function(r) {
522
+ var a = r[ye].options.emptyInsertThreshold;
523
+ if (!(!a || sn(r))) {
524
+ var i = ee(r), c = e >= i.left - a && e <= i.right + a, u = n >= i.top - a && n <= i.bottom + a;
525
+ if (c && u)
526
+ return o = r;
527
+ }
528
+ }), o;
529
+ }, Un = function(e) {
530
+ function n(a, i) {
531
+ return function(c, u, s, f) {
532
+ var l = c.options.group.name && u.options.group.name && c.options.group.name === u.options.group.name;
533
+ if (a == null && (i || l))
534
+ return !0;
535
+ if (a == null || a === !1)
536
+ return !1;
537
+ if (i && a === "clone")
538
+ return a;
539
+ if (typeof a == "function")
540
+ return n(a(c, u, s, f), i)(c, u, s, f);
541
+ var E = (i ? c : u).options.group.name;
542
+ return a === !0 || typeof a == "string" && a === E || a.join && a.indexOf(E) > -1;
543
+ };
544
+ }
545
+ var o = {}, r = e.group;
546
+ (!r || wt(r) != "object") && (r = {
547
+ name: r
548
+ }), o.name = r.name, o.checkPull = n(r.pull, !0), o.checkPut = n(r.put), o.revertClone = r.revertClone, e.group = o;
549
+ }, $n = function() {
550
+ !Pn && w && _(w, "display", "none");
551
+ }, Bn = function() {
552
+ !Pn && w && _(w, "display", "");
553
+ };
554
+ Vt && document.addEventListener("click", function(t) {
555
+ if (Nt)
556
+ return t.preventDefault(), t.stopPropagation && t.stopPropagation(), t.stopImmediatePropagation && t.stopImmediatePropagation(), Nt = !1, !1;
557
+ }, !0);
558
+ var ze = function(e) {
559
+ if (m) {
560
+ e = e.touches ? e.touches[0] : e;
561
+ var n = $o(e.clientX, e.clientY);
562
+ if (n) {
563
+ var o = {};
564
+ for (var r in e)
565
+ e.hasOwnProperty(r) && (o[r] = e[r]);
566
+ o.target = o.rootEl = n, o.preventDefault = void 0, o.stopPropagation = void 0, n[ye]._onDragOver(o);
567
+ }
568
+ }
569
+ }, Bo = function(e) {
570
+ m && m.parentNode[ye]._isOutsideThisEl(e.target);
571
+ };
572
+ function T(t, e) {
573
+ if (!(t && t.nodeType && t.nodeType === 1))
574
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));
575
+ this.el = t, this.options = e = Le({}, e), t[ye] = this;
576
+ var n = {
577
+ group: null,
578
+ sort: !0,
579
+ disabled: !1,
580
+ store: null,
581
+ handle: null,
582
+ draggable: /^[uo]l$/i.test(t.nodeName) ? ">li" : ">*",
583
+ swapThreshold: 1,
584
+ // percentage; 0 <= x <= 1
585
+ invertSwap: !1,
586
+ // invert always
587
+ invertedSwapThreshold: null,
588
+ // will be set to same as swapThreshold if default
589
+ removeCloneOnHide: !0,
590
+ direction: function() {
591
+ return Vn(t, this.options);
592
+ },
593
+ ghostClass: "sortable-ghost",
594
+ chosenClass: "sortable-chosen",
595
+ dragClass: "sortable-drag",
596
+ ignore: "a, img",
597
+ filter: null,
598
+ preventOnFilter: !0,
599
+ animation: 0,
600
+ easing: null,
601
+ setData: function(i, c) {
602
+ i.setData("Text", c.textContent);
603
+ },
604
+ dropBubble: !1,
605
+ dragoverBubble: !1,
606
+ dataIdAttr: "data-id",
607
+ delay: 0,
608
+ delayOnTouchOnly: !1,
609
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
610
+ forceFallback: !1,
611
+ fallbackClass: "sortable-fallback",
612
+ fallbackOnBody: !1,
613
+ fallbackTolerance: 0,
614
+ fallbackOffset: {
615
+ x: 0,
616
+ y: 0
617
+ },
618
+ supportPointer: T.supportPointer !== !1 && "PointerEvent" in window && !ct,
619
+ emptyInsertThreshold: 5
620
+ };
621
+ vt.initializePlugins(this, t, n);
622
+ for (var o in n)
623
+ !(o in e) && (e[o] = n[o]);
624
+ Un(e);
625
+ for (var r in this)
626
+ r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this));
627
+ this.nativeDraggable = e.forceFallback ? !1 : Vo, this.nativeDraggable && (this.options.touchStartThreshold = 1), e.supportPointer ? S(t, "pointerdown", this._onTapStart) : (S(t, "mousedown", this._onTapStart), S(t, "touchstart", this._onTapStart)), this.nativeDraggable && (S(t, "dragover", this), S(t, "dragenter", this)), At.push(this.el), e.store && e.store.get && this.sort(e.store.get(this) || []), Le(this, Ao());
628
+ }
629
+ T.prototype = /** @lends Sortable.prototype */
630
+ {
631
+ constructor: T,
632
+ _isOutsideThisEl: function(e) {
633
+ !this.el.contains(e) && e !== this.el && (Ze = null);
634
+ },
635
+ _getDirection: function(e, n) {
636
+ return typeof this.options.direction == "function" ? this.options.direction.call(this, e, n, m) : this.options.direction;
637
+ },
638
+ _onTapStart: function(e) {
639
+ if (e.cancelable) {
640
+ var n = this, o = this.el, r = this.options, a = r.preventOnFilter, i = e.type, c = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, u = (c || e).target, s = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || u, f = r.filter;
641
+ if (Ko(o), !m && !(/mousedown|pointerdown/.test(i) && e.button !== 0 || r.disabled) && !s.isContentEditable && !(!this.nativeDraggable && ct && u && u.tagName.toUpperCase() === "SELECT") && (u = Ie(u, r.draggable, o, !1), !(u && u.animated) && xt !== u)) {
642
+ if (et = Ee(u), ft = Ee(u, r.draggable), typeof f == "function") {
643
+ if (f.call(this, e, u, this)) {
644
+ ue({
645
+ sortable: n,
646
+ rootEl: s,
647
+ name: "filter",
648
+ targetEl: u,
649
+ toEl: o,
650
+ fromEl: o
651
+ }), fe("filter", n, {
652
+ evt: e
653
+ }), a && e.cancelable && e.preventDefault();
654
+ return;
655
+ }
656
+ } else if (f && (f = f.split(",").some(function(l) {
657
+ if (l = Ie(s, l.trim(), o, !1), l)
658
+ return ue({
659
+ sortable: n,
660
+ rootEl: l,
661
+ name: "filter",
662
+ targetEl: u,
663
+ fromEl: o,
664
+ toEl: o
665
+ }), fe("filter", n, {
666
+ evt: e
667
+ }), !0;
668
+ }), f)) {
669
+ a && e.cancelable && e.preventDefault();
670
+ return;
671
+ }
672
+ r.handle && !Ie(s, r.handle, o, !1) || this._prepareDragStart(e, c, u);
673
+ }
674
+ }
675
+ },
676
+ _prepareDragStart: function(e, n, o) {
677
+ var r = this, a = r.el, i = r.options, c = a.ownerDocument, u;
678
+ if (o && !m && o.parentNode === a) {
679
+ var s = ee(o);
680
+ if (P = a, m = o, W = m.parentNode, Ke = m.nextSibling, xt = o, yt = i.group, T.dragged = m, Ge = {
681
+ target: m,
682
+ clientX: (n || e).clientX,
683
+ clientY: (n || e).clientY
684
+ }, yn = Ge.clientX - s.left, En = Ge.clientY - s.top, this._lastX = (n || e).clientX, this._lastY = (n || e).clientY, m.style["will-change"] = "all", u = function() {
685
+ if (fe("delayEnded", r, {
686
+ evt: e
687
+ }), T.eventCanceled) {
688
+ r._onDrop();
689
+ return;
690
+ }
691
+ r._disableDelayedDragEvents(), !hn && r.nativeDraggable && (m.draggable = !0), r._triggerDragStart(e, n), ue({
692
+ sortable: r,
693
+ name: "choose",
694
+ originalEvent: e
695
+ }), ve(m, i.chosenClass, !0);
696
+ }, i.ignore.split(",").forEach(function(f) {
697
+ An(m, f.trim(), Gt);
698
+ }), S(c, "dragover", ze), S(c, "mousemove", ze), S(c, "touchmove", ze), S(c, "mouseup", r._onDrop), S(c, "touchend", r._onDrop), S(c, "touchcancel", r._onDrop), hn && this.nativeDraggable && (this.options.touchStartThreshold = 4, m.draggable = !0), fe("delayStart", this, {
699
+ evt: e
700
+ }), i.delay && (!i.delayOnTouchOnly || n) && (!this.nativeDraggable || !(gt || Me))) {
701
+ if (T.eventCanceled) {
702
+ this._onDrop();
703
+ return;
704
+ }
705
+ S(c, "mouseup", r._disableDelayedDrag), S(c, "touchend", r._disableDelayedDrag), S(c, "touchcancel", r._disableDelayedDrag), S(c, "mousemove", r._delayedDragTouchMoveHandler), S(c, "touchmove", r._delayedDragTouchMoveHandler), i.supportPointer && S(c, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(u, i.delay);
706
+ } else
707
+ u();
708
+ }
709
+ },
710
+ _delayedDragTouchMoveHandler: function(e) {
711
+ var n = e.touches ? e.touches[0] : e;
712
+ Math.max(Math.abs(n.clientX - this._lastX), Math.abs(n.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
713
+ },
714
+ _disableDelayedDrag: function() {
715
+ m && Gt(m), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
716
+ },
717
+ _disableDelayedDragEvents: function() {
718
+ var e = this.el.ownerDocument;
719
+ C(e, "mouseup", this._disableDelayedDrag), C(e, "touchend", this._disableDelayedDrag), C(e, "touchcancel", this._disableDelayedDrag), C(e, "mousemove", this._delayedDragTouchMoveHandler), C(e, "touchmove", this._delayedDragTouchMoveHandler), C(e, "pointermove", this._delayedDragTouchMoveHandler);
720
+ },
721
+ _triggerDragStart: function(e, n) {
722
+ n = n || e.pointerType == "touch" && e, !this.nativeDraggable || n ? this.options.supportPointer ? S(document, "pointermove", this._onTouchMove) : n ? S(document, "touchmove", this._onTouchMove) : S(document, "mousemove", this._onTouchMove) : (S(m, "dragend", this), S(P, "dragstart", this._onDragStart));
723
+ try {
724
+ document.selection ? It(function() {
725
+ document.selection.empty();
726
+ }) : window.getSelection().removeAllRanges();
727
+ } catch {
728
+ }
729
+ },
730
+ _dragStarted: function(e, n) {
731
+ if (Je = !1, P && m) {
732
+ fe("dragStarted", this, {
733
+ evt: n
734
+ }), this.nativeDraggable && S(document, "dragover", Bo);
735
+ var o = this.options;
736
+ !e && ve(m, o.dragClass, !1), ve(m, o.ghostClass, !0), T.active = this, e && this._appendGhost(), ue({
737
+ sortable: this,
738
+ name: "start",
739
+ originalEvent: n
740
+ });
741
+ } else
742
+ this._nulling();
743
+ },
744
+ _emulateDragOver: function() {
745
+ if (De) {
746
+ this._lastX = De.clientX, this._lastY = De.clientY, $n();
747
+ for (var e = document.elementFromPoint(De.clientX, De.clientY), n = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(De.clientX, De.clientY), e !== n); )
748
+ n = e;
749
+ if (m.parentNode[ye]._isOutsideThisEl(e), n)
750
+ do {
751
+ if (n[ye]) {
752
+ var o = void 0;
753
+ if (o = n[ye]._onDragOver({
754
+ clientX: De.clientX,
755
+ clientY: De.clientY,
756
+ target: e,
757
+ rootEl: n
758
+ }), o && !this.options.dragoverBubble)
759
+ break;
760
+ }
761
+ e = n;
762
+ } while (n = n.parentNode);
763
+ Bn();
764
+ }
765
+ },
766
+ _onTouchMove: function(e) {
767
+ if (Ge) {
768
+ var n = this.options, o = n.fallbackTolerance, r = n.fallbackOffset, a = e.touches ? e.touches[0] : e, i = w && tt(w, !0), c = w && i && i.a, u = w && i && i.d, s = _t && se && bn(se), f = (a.clientX - Ge.clientX + r.x) / (c || 1) + (s ? s[0] - Xt[0] : 0) / (c || 1), l = (a.clientY - Ge.clientY + r.y) / (u || 1) + (s ? s[1] - Xt[1] : 0) / (u || 1);
769
+ if (!T.active && !Je) {
770
+ if (o && Math.max(Math.abs(a.clientX - this._lastX), Math.abs(a.clientY - this._lastY)) < o)
771
+ return;
772
+ this._onDragStart(e, !0);
773
+ }
774
+ if (w) {
775
+ i ? (i.e += f - (Yt || 0), i.f += l - (Ht || 0)) : i = {
776
+ a: 1,
777
+ b: 0,
778
+ c: 0,
779
+ d: 1,
780
+ e: f,
781
+ f: l
782
+ };
783
+ var E = "matrix(".concat(i.a, ",").concat(i.b, ",").concat(i.c, ",").concat(i.d, ",").concat(i.e, ",").concat(i.f, ")");
784
+ _(w, "webkitTransform", E), _(w, "mozTransform", E), _(w, "msTransform", E), _(w, "transform", E), Yt = f, Ht = l, De = a;
785
+ }
786
+ e.cancelable && e.preventDefault();
787
+ }
788
+ },
789
+ _appendGhost: function() {
790
+ if (!w) {
791
+ var e = this.options.fallbackOnBody ? document.body : P, n = ee(m, !0, _t, !0, e), o = this.options;
792
+ if (_t) {
793
+ for (se = e; _(se, "position") === "static" && _(se, "transform") === "none" && se !== document; )
794
+ se = se.parentNode;
795
+ se !== document.body && se !== document.documentElement ? (se === document && (se = Oe()), n.top += se.scrollTop, n.left += se.scrollLeft) : se = Oe(), Xt = bn(se);
796
+ }
797
+ w = m.cloneNode(!0), ve(w, o.ghostClass, !1), ve(w, o.fallbackClass, !0), ve(w, o.dragClass, !0), _(w, "transition", ""), _(w, "transform", ""), _(w, "box-sizing", "border-box"), _(w, "margin", 0), _(w, "top", n.top), _(w, "left", n.left), _(w, "width", n.width), _(w, "height", n.height), _(w, "opacity", "0.8"), _(w, "position", _t ? "absolute" : "fixed"), _(w, "zIndex", "100000"), _(w, "pointerEvents", "none"), T.ghost = w, e.appendChild(w), _(w, "transform-origin", yn / parseInt(w.style.width) * 100 + "% " + En / parseInt(w.style.height) * 100 + "%");
798
+ }
799
+ },
800
+ _onDragStart: function(e, n) {
801
+ var o = this, r = e.dataTransfer, a = o.options;
802
+ if (fe("dragStart", this, {
803
+ evt: e
804
+ }), T.eventCanceled) {
805
+ this._onDrop();
806
+ return;
807
+ }
808
+ fe("setupClone", this), T.eventCanceled || (Y = Mn(m), Y.draggable = !1, Y.style["will-change"] = "", this._hideClone(), ve(Y, this.options.chosenClass, !1), T.clone = Y), o.cloneId = It(function() {
809
+ fe("clone", o), !T.eventCanceled && (o.options.removeCloneOnHide || P.insertBefore(Y, m), o._hideClone(), ue({
810
+ sortable: o,
811
+ name: "clone"
812
+ }));
813
+ }), !n && ve(m, a.dragClass, !0), n ? (Nt = !0, o._loopId = setInterval(o._emulateDragOver, 50)) : (C(document, "mouseup", o._onDrop), C(document, "touchend", o._onDrop), C(document, "touchcancel", o._onDrop), r && (r.effectAllowed = "move", a.setData && a.setData.call(o, r, m)), S(document, "drop", o), _(m, "transform", "translateZ(0)")), Je = !0, o._dragStartId = It(o._dragStarted.bind(o, n, e)), S(document, "selectstart", o), lt = !0, ct && _(document.body, "user-select", "none");
814
+ },
815
+ // Returns true - if no further action is needed (either inserted or another condition)
816
+ _onDragOver: function(e) {
817
+ var n = this.el, o = e.target, r, a, i, c = this.options, u = c.group, s = T.active, f = yt === u, l = c.sort, E = ie || s, y, b = this, g = !1;
818
+ if (en) return;
819
+ function L(d, v) {
820
+ fe(d, b, Ce({
821
+ evt: e,
822
+ isOwner: f,
823
+ axis: y ? "vertical" : "horizontal",
824
+ revert: i,
825
+ dragRect: r,
826
+ targetRect: a,
827
+ canSort: l,
828
+ fromSortable: E,
829
+ target: o,
830
+ completed: N,
831
+ onMove: function(K, le) {
832
+ return Tt(P, n, m, r, K, ee(K), e, le);
833
+ },
834
+ changed: $
835
+ }, v));
836
+ }
837
+ function H() {
838
+ L("dragOverAnimationCapture"), b.captureAnimationState(), b !== E && E.captureAnimationState();
839
+ }
840
+ function N(d) {
841
+ return L("dragOverCompleted", {
842
+ insertion: d
843
+ }), d && (f ? s._hideClone() : s._showClone(b), b !== E && (ve(m, ie ? ie.options.ghostClass : s.options.ghostClass, !1), ve(m, c.ghostClass, !0)), ie !== b && b !== T.active ? ie = b : b === T.active && ie && (ie = null), E === b && (b._ignoreWhileAnimating = o), b.animateAll(function() {
844
+ L("dragOverAnimationComplete"), b._ignoreWhileAnimating = null;
845
+ }), b !== E && (E.animateAll(), E._ignoreWhileAnimating = null)), (o === m && !m.animated || o === n && !o.animated) && (Ze = null), !c.dragoverBubble && !e.rootEl && o !== document && (m.parentNode[ye]._isOutsideThisEl(e.target), !d && ze(e)), !c.dragoverBubble && e.stopPropagation && e.stopPropagation(), g = !0;
846
+ }
847
+ function $() {
848
+ be = Ee(m), We = Ee(m, c.draggable), ue({
849
+ sortable: b,
850
+ name: "change",
851
+ toEl: n,
852
+ newIndex: be,
853
+ newDraggableIndex: We,
854
+ originalEvent: e
855
+ });
856
+ }
857
+ if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), o = Ie(o, c.draggable, n, !0), L("dragOver"), T.eventCanceled) return g;
858
+ if (m.contains(e.target) || o.animated && o.animatingX && o.animatingY || b._ignoreWhileAnimating === o)
859
+ return N(!1);
860
+ if (Nt = !1, s && !c.disabled && (f ? l || (i = W !== P) : ie === this || (this.lastPutMode = yt.checkPull(this, s, m, e)) && u.checkPut(this, s, m, e))) {
861
+ if (y = this._getDirection(e, o) === "vertical", r = ee(m), L("dragOverValid"), T.eventCanceled) return g;
862
+ if (i)
863
+ return W = P, H(), this._hideClone(), L("revert"), T.eventCanceled || (Ke ? P.insertBefore(m, Ke) : P.appendChild(m)), N(!0);
864
+ var B = sn(n, c.draggable);
865
+ if (!B || Xo(e, y, this) && !B.animated) {
866
+ if (B === m)
867
+ return N(!1);
868
+ if (B && n === e.target && (o = B), o && (a = ee(o)), Tt(P, n, m, r, o, a, e, !!o) !== !1)
869
+ return H(), n.appendChild(m), W = n, $(), N(!0);
870
+ } else if (B && Ho(e, y, this)) {
871
+ var M = nt(n, 0, c, !0);
872
+ if (M === m)
873
+ return N(!1);
874
+ if (o = M, a = ee(o), Tt(P, n, m, r, o, a, e, !1) !== !1)
875
+ return H(), n.insertBefore(m, M), W = n, $(), N(!0);
876
+ } else if (o.parentNode === n) {
877
+ a = ee(o);
878
+ var X = 0, me, Se = m.parentNode !== n, te = !Uo(m.animated && m.toRect || r, o.animated && o.toRect || a, y), Te = y ? "top" : "left", he = vn(o, "top", "top") || vn(m, "top", "top"), Re = he ? he.scrollTop : void 0;
879
+ Ze !== o && (me = a[Te], mt = !1, Et = !te && c.invertSwap || Se), X = Go(e, o, a, y, te ? 1 : c.swapThreshold, c.invertedSwapThreshold == null ? c.swapThreshold : c.invertedSwapThreshold, Et, Ze === o);
880
+ var Z;
881
+ if (X !== 0) {
882
+ var we = Ee(m);
883
+ do
884
+ we -= X, Z = W.children[we];
885
+ while (Z && (_(Z, "display") === "none" || Z === w));
886
+ }
887
+ if (X === 0 || Z === o)
888
+ return N(!1);
889
+ Ze = o, pt = X;
890
+ var Fe = o.nextElementSibling, ce = !1;
891
+ ce = X === 1;
892
+ var re = Tt(P, n, m, r, o, a, e, ce);
893
+ if (re !== !1)
894
+ return (re === 1 || re === -1) && (ce = re === 1), en = !0, setTimeout(Yo, 30), H(), ce && !Fe ? n.appendChild(m) : o.parentNode.insertBefore(m, ce ? Fe : o), he && Ln(he, 0, Re - he.scrollTop), W = m.parentNode, me !== void 0 && !Et && (Dt = Math.abs(me - ee(o)[Te])), $(), N(!0);
895
+ }
896
+ if (n.contains(m))
897
+ return N(!1);
898
+ }
899
+ return !1;
900
+ },
901
+ _ignoreWhileAnimating: null,
902
+ _offMoveEvents: function() {
903
+ C(document, "mousemove", this._onTouchMove), C(document, "touchmove", this._onTouchMove), C(document, "pointermove", this._onTouchMove), C(document, "dragover", ze), C(document, "mousemove", ze), C(document, "touchmove", ze);
904
+ },
905
+ _offUpEvents: function() {
906
+ var e = this.el.ownerDocument;
907
+ C(e, "mouseup", this._onDrop), C(e, "touchend", this._onDrop), C(e, "pointerup", this._onDrop), C(e, "touchcancel", this._onDrop), C(document, "selectstart", this);
908
+ },
909
+ _onDrop: function(e) {
910
+ var n = this.el, o = this.options;
911
+ if (be = Ee(m), We = Ee(m, o.draggable), fe("drop", this, {
912
+ evt: e
913
+ }), W = m && m.parentNode, be = Ee(m), We = Ee(m, o.draggable), T.eventCanceled) {
914
+ this._nulling();
915
+ return;
916
+ }
917
+ Je = !1, Et = !1, mt = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), tn(this.cloneId), tn(this._dragStartId), this.nativeDraggable && (C(document, "drop", this), C(n, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), ct && _(document.body, "user-select", ""), _(m, "transform", ""), e && (lt && (e.cancelable && e.preventDefault(), !o.dropBubble && e.stopPropagation()), w && w.parentNode && w.parentNode.removeChild(w), (P === W || ie && ie.lastPutMode !== "clone") && Y && Y.parentNode && Y.parentNode.removeChild(Y), m && (this.nativeDraggable && C(m, "dragend", this), Gt(m), m.style["will-change"] = "", lt && !Je && ve(m, ie ? ie.options.ghostClass : this.options.ghostClass, !1), ve(m, this.options.chosenClass, !1), ue({
918
+ sortable: this,
919
+ name: "unchoose",
920
+ toEl: W,
921
+ newIndex: null,
922
+ newDraggableIndex: null,
923
+ originalEvent: e
924
+ }), P !== W ? (be >= 0 && (ue({
925
+ rootEl: W,
926
+ name: "add",
927
+ toEl: W,
928
+ fromEl: P,
929
+ originalEvent: e
930
+ }), ue({
931
+ sortable: this,
932
+ name: "remove",
933
+ toEl: W,
934
+ originalEvent: e
935
+ }), ue({
936
+ rootEl: W,
937
+ name: "sort",
938
+ toEl: W,
939
+ fromEl: P,
940
+ originalEvent: e
941
+ }), ue({
942
+ sortable: this,
943
+ name: "sort",
944
+ toEl: W,
945
+ originalEvent: e
946
+ })), ie && ie.save()) : be !== et && be >= 0 && (ue({
947
+ sortable: this,
948
+ name: "update",
949
+ toEl: W,
950
+ originalEvent: e
951
+ }), ue({
952
+ sortable: this,
953
+ name: "sort",
954
+ toEl: W,
955
+ originalEvent: e
956
+ })), T.active && ((be == null || be === -1) && (be = et, We = ft), ue({
957
+ sortable: this,
958
+ name: "end",
959
+ toEl: W,
960
+ originalEvent: e
961
+ }), this.save()))), this._nulling();
962
+ },
963
+ _nulling: function() {
964
+ fe("nulling", this), P = m = W = w = Ke = Y = xt = Ye = Ge = De = lt = be = We = et = ft = Ze = pt = ie = yt = T.dragged = T.ghost = T.clone = T.active = null, kt.forEach(function(e) {
965
+ e.checked = !0;
966
+ }), kt.length = Yt = Ht = 0;
967
+ },
968
+ handleEvent: function(e) {
969
+ switch (e.type) {
970
+ case "drop":
971
+ case "dragend":
972
+ this._onDrop(e);
973
+ break;
974
+ case "dragenter":
975
+ case "dragover":
976
+ m && (this._onDragOver(e), Wo(e));
977
+ break;
978
+ case "selectstart":
979
+ e.preventDefault();
980
+ break;
981
+ }
982
+ },
983
+ /**
984
+ * Serializes the item into an array of string.
985
+ * @returns {String[]}
986
+ */
987
+ toArray: function() {
988
+ for (var e = [], n, o = this.el.children, r = 0, a = o.length, i = this.options; r < a; r++)
989
+ n = o[r], Ie(n, i.draggable, this.el, !1) && e.push(n.getAttribute(i.dataIdAttr) || jo(n));
990
+ return e;
991
+ },
992
+ /**
993
+ * Sorts the elements according to the array.
994
+ * @param {String[]} order order of the items
995
+ */
996
+ sort: function(e, n) {
997
+ var o = {}, r = this.el;
998
+ this.toArray().forEach(function(a, i) {
999
+ var c = r.children[i];
1000
+ Ie(c, this.options.draggable, r, !1) && (o[a] = c);
1001
+ }, this), n && this.captureAnimationState(), e.forEach(function(a) {
1002
+ o[a] && (r.removeChild(o[a]), r.appendChild(o[a]));
1003
+ }), n && this.animateAll();
1004
+ },
1005
+ /**
1006
+ * Save the current sorting
1007
+ */
1008
+ save: function() {
1009
+ var e = this.options.store;
1010
+ e && e.set && e.set(this);
1011
+ },
1012
+ /**
1013
+ * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
1014
+ * @param {HTMLElement} el
1015
+ * @param {String} [selector] default: `options.draggable`
1016
+ * @returns {HTMLElement|null}
1017
+ */
1018
+ closest: function(e, n) {
1019
+ return Ie(e, n || this.options.draggable, this.el, !1);
1020
+ },
1021
+ /**
1022
+ * Set/get option
1023
+ * @param {string} name
1024
+ * @param {*} [value]
1025
+ * @returns {*}
1026
+ */
1027
+ option: function(e, n) {
1028
+ var o = this.options;
1029
+ if (n === void 0)
1030
+ return o[e];
1031
+ var r = vt.modifyOption(this, e, n);
1032
+ typeof r < "u" ? o[e] = r : o[e] = n, e === "group" && Un(o);
1033
+ },
1034
+ /**
1035
+ * Destroy
1036
+ */
1037
+ destroy: function() {
1038
+ fe("destroy", this);
1039
+ var e = this.el;
1040
+ e[ye] = null, C(e, "mousedown", this._onTapStart), C(e, "touchstart", this._onTapStart), C(e, "pointerdown", this._onTapStart), this.nativeDraggable && (C(e, "dragover", this), C(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(n) {
1041
+ n.removeAttribute("draggable");
1042
+ }), this._onDrop(), this._disableDelayedDragEvents(), At.splice(At.indexOf(this.el), 1), this.el = e = null;
1043
+ },
1044
+ _hideClone: function() {
1045
+ if (!Ye) {
1046
+ if (fe("hideClone", this), T.eventCanceled) return;
1047
+ _(Y, "display", "none"), this.options.removeCloneOnHide && Y.parentNode && Y.parentNode.removeChild(Y), Ye = !0;
1048
+ }
1049
+ },
1050
+ _showClone: function(e) {
1051
+ if (e.lastPutMode !== "clone") {
1052
+ this._hideClone();
1053
+ return;
1054
+ }
1055
+ if (Ye) {
1056
+ if (fe("showClone", this), T.eventCanceled) return;
1057
+ m.parentNode == P && !this.options.group.revertClone ? P.insertBefore(Y, m) : Ke ? P.insertBefore(Y, Ke) : P.appendChild(Y), this.options.group.revertClone && this.animate(m, Y), _(Y, "display", ""), Ye = !1;
1058
+ }
1059
+ }
1060
+ };
1061
+ function Wo(t) {
1062
+ t.dataTransfer && (t.dataTransfer.dropEffect = "move"), t.cancelable && t.preventDefault();
1063
+ }
1064
+ function Tt(t, e, n, o, r, a, i, c) {
1065
+ var u, s = t[ye], f = s.options.onMove, l;
1066
+ return window.CustomEvent && !Me && !gt ? u = new CustomEvent("move", {
1067
+ bubbles: !0,
1068
+ cancelable: !0
1069
+ }) : (u = document.createEvent("Event"), u.initEvent("move", !0, !0)), u.to = e, u.from = t, u.dragged = n, u.draggedRect = o, u.related = r || e, u.relatedRect = a || ee(e), u.willInsertAfter = c, u.originalEvent = i, t.dispatchEvent(u), f && (l = f.call(s, u, i)), l;
1070
+ }
1071
+ function Gt(t) {
1072
+ t.draggable = !1;
1073
+ }
1074
+ function Yo() {
1075
+ en = !1;
1076
+ }
1077
+ function Ho(t, e, n) {
1078
+ var o = ee(nt(n.el, 0, n.options, !0)), r = 10;
1079
+ return e ? t.clientX < o.left - r || t.clientY < o.top && t.clientX < o.right : t.clientY < o.top - r || t.clientY < o.bottom && t.clientX < o.left;
1080
+ }
1081
+ function Xo(t, e, n) {
1082
+ var o = ee(sn(n.el, n.options.draggable)), r = 10;
1083
+ return e ? t.clientX > o.right + r || t.clientX <= o.right && t.clientY > o.bottom && t.clientX >= o.left : t.clientX > o.right && t.clientY > o.top || t.clientX <= o.right && t.clientY > o.bottom + r;
1084
+ }
1085
+ function Go(t, e, n, o, r, a, i, c) {
1086
+ var u = o ? t.clientY : t.clientX, s = o ? n.height : n.width, f = o ? n.top : n.left, l = o ? n.bottom : n.right, E = !1;
1087
+ if (!i) {
1088
+ if (c && Dt < s * r) {
1089
+ if (!mt && (pt === 1 ? u > f + s * a / 2 : u < l - s * a / 2) && (mt = !0), mt)
1090
+ E = !0;
1091
+ else if (pt === 1 ? u < f + Dt : u > l - Dt)
1092
+ return -pt;
1093
+ } else if (u > f + s * (1 - r) / 2 && u < l - s * (1 - r) / 2)
1094
+ return zo(e);
1095
+ }
1096
+ return E = E || i, E && (u < f + s * a / 2 || u > l - s * a / 2) ? u > f + s / 2 ? 1 : -1 : 0;
1097
+ }
1098
+ function zo(t) {
1099
+ return Ee(m) < Ee(t) ? 1 : -1;
1100
+ }
1101
+ function jo(t) {
1102
+ for (var e = t.tagName + t.className + t.src + t.href + t.textContent, n = e.length, o = 0; n--; )
1103
+ o += e.charCodeAt(n);
1104
+ return o.toString(36);
1105
+ }
1106
+ function Ko(t) {
1107
+ kt.length = 0;
1108
+ for (var e = t.getElementsByTagName("input"), n = e.length; n--; ) {
1109
+ var o = e[n];
1110
+ o.checked && kt.push(o);
1111
+ }
1112
+ }
1113
+ function It(t) {
1114
+ return setTimeout(t, 0);
1115
+ }
1116
+ function tn(t) {
1117
+ return clearTimeout(t);
1118
+ }
1119
+ Vt && S(document, "touchmove", function(t) {
1120
+ (T.active || Je) && t.cancelable && t.preventDefault();
1121
+ });
1122
+ T.utils = {
1123
+ on: S,
1124
+ off: C,
1125
+ css: _,
1126
+ find: An,
1127
+ is: function(e, n) {
1128
+ return !!Ie(e, n, e, !1);
1129
+ },
1130
+ extend: Fo,
1131
+ throttle: kn,
1132
+ closest: Ie,
1133
+ toggleClass: ve,
1134
+ clone: Mn,
1135
+ index: Ee,
1136
+ nextTick: It,
1137
+ cancelNextTick: tn,
1138
+ detectDirection: Vn,
1139
+ getChild: nt
1140
+ };
1141
+ T.get = function(t) {
1142
+ return t[ye];
1143
+ };
1144
+ T.mount = function() {
1145
+ for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
1146
+ e[n] = arguments[n];
1147
+ e[0].constructor === Array && (e = e[0]), e.forEach(function(o) {
1148
+ if (!o.prototype || !o.prototype.constructor)
1149
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));
1150
+ o.utils && (T.utils = Ce(Ce({}, T.utils), o.utils)), vt.mount(o);
1151
+ });
1152
+ };
1153
+ T.create = function(t, e) {
1154
+ return new T(t, e);
1155
+ };
1156
+ T.version = Oo;
1157
+ var q = [], st, nn, on = !1, zt, jt, Lt, ut;
1158
+ function qo() {
1159
+ function t() {
1160
+ this.defaults = {
1161
+ scroll: !0,
1162
+ forceAutoScrollFallback: !1,
1163
+ scrollSensitivity: 30,
1164
+ scrollSpeed: 10,
1165
+ bubbleScroll: !0
1166
+ };
1167
+ for (var e in this)
1168
+ e.charAt(0) === "_" && typeof this[e] == "function" && (this[e] = this[e].bind(this));
1169
+ }
1170
+ return t.prototype = {
1171
+ dragStarted: function(n) {
1172
+ var o = n.originalEvent;
1173
+ this.sortable.nativeDraggable ? S(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? S(document, "pointermove", this._handleFallbackAutoScroll) : o.touches ? S(document, "touchmove", this._handleFallbackAutoScroll) : S(document, "mousemove", this._handleFallbackAutoScroll);
1174
+ },
1175
+ dragOverCompleted: function(n) {
1176
+ var o = n.originalEvent;
1177
+ !this.options.dragOverBubble && !o.rootEl && this._handleAutoScroll(o);
1178
+ },
1179
+ drop: function() {
1180
+ this.sortable.nativeDraggable ? C(document, "dragover", this._handleAutoScroll) : (C(document, "pointermove", this._handleFallbackAutoScroll), C(document, "touchmove", this._handleFallbackAutoScroll), C(document, "mousemove", this._handleFallbackAutoScroll)), Tn(), Ot(), No();
1181
+ },
1182
+ nulling: function() {
1183
+ Lt = nn = st = on = ut = zt = jt = null, q.length = 0;
1184
+ },
1185
+ _handleFallbackAutoScroll: function(n) {
1186
+ this._handleAutoScroll(n, !0);
1187
+ },
1188
+ _handleAutoScroll: function(n, o) {
1189
+ var r = this, a = (n.touches ? n.touches[0] : n).clientX, i = (n.touches ? n.touches[0] : n).clientY, c = document.elementFromPoint(a, i);
1190
+ if (Lt = n, o || this.options.forceAutoScrollFallback || gt || Me || ct) {
1191
+ Kt(n, this.options, c, o);
1192
+ var u = He(c, !0);
1193
+ on && (!ut || a !== zt || i !== jt) && (ut && Tn(), ut = setInterval(function() {
1194
+ var s = He(document.elementFromPoint(a, i), !0);
1195
+ s !== u && (u = s, Ot()), Kt(n, r.options, s, o);
1196
+ }, 10), zt = a, jt = i);
1197
+ } else {
1198
+ if (!this.options.bubbleScroll || He(c, !0) === Oe()) {
1199
+ Ot();
1200
+ return;
1201
+ }
1202
+ Kt(n, this.options, He(c, !1), !1);
1203
+ }
1204
+ }
1205
+ }, Le(t, {
1206
+ pluginName: "scroll",
1207
+ initializeByDefault: !0
1208
+ });
1209
+ }
1210
+ function Ot() {
1211
+ q.forEach(function(t) {
1212
+ clearInterval(t.pid);
1213
+ }), q = [];
1214
+ }
1215
+ function Tn() {
1216
+ clearInterval(ut);
1217
+ }
1218
+ var Kt = kn(function(t, e, n, o) {
1219
+ if (e.scroll) {
1220
+ var r = (t.touches ? t.touches[0] : t).clientX, a = (t.touches ? t.touches[0] : t).clientY, i = e.scrollSensitivity, c = e.scrollSpeed, u = Oe(), s = !1, f;
1221
+ nn !== n && (nn = n, Ot(), st = e.scroll, f = e.scrollFn, st === !0 && (st = He(n, !0)));
1222
+ var l = 0, E = st;
1223
+ do {
1224
+ var y = E, b = ee(y), g = b.top, L = b.bottom, H = b.left, N = b.right, $ = b.width, B = b.height, M = void 0, X = void 0, me = y.scrollWidth, Se = y.scrollHeight, te = _(y), Te = y.scrollLeft, he = y.scrollTop;
1225
+ y === u ? (M = $ < me && (te.overflowX === "auto" || te.overflowX === "scroll" || te.overflowX === "visible"), X = B < Se && (te.overflowY === "auto" || te.overflowY === "scroll" || te.overflowY === "visible")) : (M = $ < me && (te.overflowX === "auto" || te.overflowX === "scroll"), X = B < Se && (te.overflowY === "auto" || te.overflowY === "scroll"));
1226
+ var Re = M && (Math.abs(N - r) <= i && Te + $ < me) - (Math.abs(H - r) <= i && !!Te), Z = X && (Math.abs(L - a) <= i && he + B < Se) - (Math.abs(g - a) <= i && !!he);
1227
+ if (!q[l])
1228
+ for (var we = 0; we <= l; we++)
1229
+ q[we] || (q[we] = {});
1230
+ (q[l].vx != Re || q[l].vy != Z || q[l].el !== y) && (q[l].el = y, q[l].vx = Re, q[l].vy = Z, clearInterval(q[l].pid), (Re != 0 || Z != 0) && (s = !0, q[l].pid = setInterval((function() {
1231
+ o && this.layer === 0 && T.active._onTouchMove(Lt);
1232
+ var Fe = q[this.layer].vy ? q[this.layer].vy * c : 0, ce = q[this.layer].vx ? q[this.layer].vx * c : 0;
1233
+ typeof f == "function" && f.call(T.dragged.parentNode[ye], ce, Fe, t, Lt, q[this.layer].el) !== "continue" || Ln(q[this.layer].el, ce, Fe);
1234
+ }).bind({
1235
+ layer: l
1236
+ }), 24))), l++;
1237
+ } while (e.bubbleScroll && E !== u && (E = He(E, !1)));
1238
+ on = s;
1239
+ }
1240
+ }, 30), Wn = function(e) {
1241
+ var n = e.originalEvent, o = e.putSortable, r = e.dragEl, a = e.activeSortable, i = e.dispatchSortableEvent, c = e.hideGhostForTarget, u = e.unhideGhostForTarget;
1242
+ if (n) {
1243
+ var s = o || a;
1244
+ c();
1245
+ var f = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, l = document.elementFromPoint(f.clientX, f.clientY);
1246
+ u(), s && !s.el.contains(l) && (i("spill"), this.onSpill({
1247
+ dragEl: r,
1248
+ putSortable: o
1249
+ }));
1250
+ }
1251
+ };
1252
+ function un() {
1253
+ }
1254
+ un.prototype = {
1255
+ startIndex: null,
1256
+ dragStart: function(e) {
1257
+ var n = e.oldDraggableIndex;
1258
+ this.startIndex = n;
1259
+ },
1260
+ onSpill: function(e) {
1261
+ var n = e.dragEl, o = e.putSortable;
1262
+ this.sortable.captureAnimationState(), o && o.captureAnimationState();
1263
+ var r = nt(this.sortable.el, this.startIndex, this.options);
1264
+ r ? this.sortable.el.insertBefore(n, r) : this.sortable.el.appendChild(n), this.sortable.animateAll(), o && o.animateAll();
1265
+ },
1266
+ drop: Wn
1267
+ };
1268
+ Le(un, {
1269
+ pluginName: "revertOnSpill"
1270
+ });
1271
+ function cn() {
1272
+ }
1273
+ cn.prototype = {
1274
+ onSpill: function(e) {
1275
+ var n = e.dragEl, o = e.putSortable, r = o || this.sortable;
1276
+ r.captureAnimationState(), n.parentNode && n.parentNode.removeChild(n), r.animateAll();
1277
+ },
1278
+ drop: Wn
1279
+ };
1280
+ Le(cn, {
1281
+ pluginName: "removeOnSpill"
1282
+ });
1283
+ T.mount(new qo());
1284
+ T.mount(cn, un);
1285
+ function qt(t) {
1286
+ t.parentElement !== null && t.parentElement.removeChild(t);
1287
+ }
1288
+ function wn(t, e, n) {
1289
+ const o = n === 0 ? t.children[0] : t.children[n - 1].nextSibling;
1290
+ t.insertBefore(e, o);
1291
+ }
1292
+ function Qo() {
1293
+ return typeof window < "u" ? window.console : globalThis.console;
1294
+ }
1295
+ const Zo = Qo();
1296
+ function Jo(t) {
1297
+ const e = /* @__PURE__ */ Object.create(null);
1298
+ return function(o) {
1299
+ return e[o] || (e[o] = t(o));
1300
+ };
1301
+ }
1302
+ const er = /-(\w)/g, tr = Jo((t) => t.replace(er, (e, n) => n.toUpperCase())), Yn = ["Start", "Add", "Remove", "Update", "End"], Hn = ["Choose", "Unchoose", "Sort", "Filter", "Clone"], Xn = ["Move"], nr = [Xn, Yn, Hn].flatMap((t) => t).map((t) => `on${t}`), rn = {
1303
+ manage: Xn,
1304
+ manageAndEmit: Yn,
1305
+ emit: Hn
1306
+ };
1307
+ function or(t) {
1308
+ return nr.indexOf(t) !== -1;
1309
+ }
1310
+ const rr = [
1311
+ "a",
1312
+ "abbr",
1313
+ "address",
1314
+ "area",
1315
+ "article",
1316
+ "aside",
1317
+ "audio",
1318
+ "b",
1319
+ "base",
1320
+ "bdi",
1321
+ "bdo",
1322
+ "blockquote",
1323
+ "body",
1324
+ "br",
1325
+ "button",
1326
+ "canvas",
1327
+ "caption",
1328
+ "cite",
1329
+ "code",
1330
+ "col",
1331
+ "colgroup",
1332
+ "data",
1333
+ "datalist",
1334
+ "dd",
1335
+ "del",
1336
+ "details",
1337
+ "dfn",
1338
+ "dialog",
1339
+ "div",
1340
+ "dl",
1341
+ "dt",
1342
+ "em",
1343
+ "embed",
1344
+ "fieldset",
1345
+ "figcaption",
1346
+ "figure",
1347
+ "footer",
1348
+ "form",
1349
+ "h1",
1350
+ "h2",
1351
+ "h3",
1352
+ "h4",
1353
+ "h5",
1354
+ "h6",
1355
+ "head",
1356
+ "header",
1357
+ "hgroup",
1358
+ "hr",
1359
+ "html",
1360
+ "i",
1361
+ "iframe",
1362
+ "img",
1363
+ "input",
1364
+ "ins",
1365
+ "kbd",
1366
+ "label",
1367
+ "legend",
1368
+ "li",
1369
+ "link",
1370
+ "main",
1371
+ "map",
1372
+ "mark",
1373
+ "math",
1374
+ "menu",
1375
+ "menuitem",
1376
+ "meta",
1377
+ "meter",
1378
+ "nav",
1379
+ "noscript",
1380
+ "object",
1381
+ "ol",
1382
+ "optgroup",
1383
+ "option",
1384
+ "output",
1385
+ "p",
1386
+ "param",
1387
+ "picture",
1388
+ "pre",
1389
+ "progress",
1390
+ "q",
1391
+ "rb",
1392
+ "rp",
1393
+ "rt",
1394
+ "rtc",
1395
+ "ruby",
1396
+ "s",
1397
+ "samp",
1398
+ "script",
1399
+ "section",
1400
+ "select",
1401
+ "slot",
1402
+ "small",
1403
+ "source",
1404
+ "span",
1405
+ "strong",
1406
+ "style",
1407
+ "sub",
1408
+ "summary",
1409
+ "sup",
1410
+ "svg",
1411
+ "table",
1412
+ "tbody",
1413
+ "td",
1414
+ "template",
1415
+ "textarea",
1416
+ "tfoot",
1417
+ "th",
1418
+ "thead",
1419
+ "time",
1420
+ "title",
1421
+ "tr",
1422
+ "track",
1423
+ "u",
1424
+ "ul",
1425
+ "var",
1426
+ "video",
1427
+ "wbr"
1428
+ ];
1429
+ function ar(t) {
1430
+ return rr.includes(t);
1431
+ }
1432
+ function ir(t) {
1433
+ return ["transition-group", "TransitionGroup"].includes(t);
1434
+ }
1435
+ function Gn(t) {
1436
+ return ["id", "class", "role", "style"].includes(t) || t.startsWith("data-") || t.startsWith("aria-") || t.startsWith("on");
1437
+ }
1438
+ function zn(t) {
1439
+ return t.reduce((e, [n, o]) => (e[n] = o, e), {});
1440
+ }
1441
+ function lr({ $attrs: t, componentData: e = {} }) {
1442
+ return {
1443
+ ...zn(
1444
+ Object.entries(t).filter(([o, r]) => Gn(o))
1445
+ ),
1446
+ ...e
1447
+ };
1448
+ }
1449
+ function sr({ $attrs: t, callBackBuilder: e }) {
1450
+ const n = zn(jn(t));
1451
+ Object.entries(e).forEach(([r, a]) => {
1452
+ rn[r].forEach((i) => {
1453
+ n[`on${i}`] = a(i);
1454
+ });
1455
+ });
1456
+ const o = `[data-draggable]${n.draggable || ""}`;
1457
+ return {
1458
+ ...n,
1459
+ draggable: o
1460
+ };
1461
+ }
1462
+ function jn(t) {
1463
+ return Object.entries(t).filter(([e, n]) => !Gn(e)).map(([e, n]) => [tr(e), n]).filter(([e, n]) => !or(e));
1464
+ }
1465
+ const xn = ({ el: t }) => t, ur = (t, e) => t.__draggable_context = e, Dn = (t) => t.__draggable_context;
1466
+ class cr {
1467
+ constructor({
1468
+ nodes: { header: e, default: n, footer: o },
1469
+ root: r,
1470
+ realList: a
1471
+ }) {
1472
+ this.defaultNodes = n, this.children = [...e, ...n, ...o], this.externalComponent = r.externalComponent, this.rootTransition = r.transition, this.tag = r.tag, this.realList = a;
1473
+ }
1474
+ get _isRootComponent() {
1475
+ return this.externalComponent || this.rootTransition;
1476
+ }
1477
+ render(e, n) {
1478
+ const { tag: o, children: r, _isRootComponent: a } = this;
1479
+ return e(o, n, a ? { default: () => r } : r);
1480
+ }
1481
+ updated() {
1482
+ const { defaultNodes: e, realList: n } = this;
1483
+ e.forEach((o, r) => {
1484
+ ur(xn(o), {
1485
+ element: n[r],
1486
+ index: r
1487
+ });
1488
+ });
1489
+ }
1490
+ getUnderlyingVm(e) {
1491
+ return Dn(e);
1492
+ }
1493
+ getVmIndexFromDomIndex(e, n) {
1494
+ const { defaultNodes: o } = this, { length: r } = o, a = n.children, i = a.item(e);
1495
+ if (i === null)
1496
+ return r;
1497
+ const c = Dn(i);
1498
+ if (c)
1499
+ return c.index;
1500
+ if (r === 0)
1501
+ return 0;
1502
+ const u = xn(o[0]), s = [...a].findIndex(
1503
+ (f) => f === u
1504
+ );
1505
+ return e < s ? 0 : r;
1506
+ }
1507
+ }
1508
+ function dr(t, e) {
1509
+ const n = t[e];
1510
+ return n ? n() : [];
1511
+ }
1512
+ function fr({ $slots: t, realList: e, getKey: n }) {
1513
+ const o = e || [], [r, a] = ["header", "footer"].map(
1514
+ (u) => dr(t, u)
1515
+ ), { item: i } = t;
1516
+ if (!i)
1517
+ throw new Error("draggable element must have an item slot");
1518
+ const c = o.flatMap(
1519
+ (u, s) => i({ element: u, index: s }).map((f) => (f.key = n(u), f.props = { ...f.props || {}, "data-draggable": !0 }, f))
1520
+ );
1521
+ if (c.length !== o.length)
1522
+ throw new Error("Item slot must have only one child");
1523
+ return {
1524
+ header: r,
1525
+ footer: a,
1526
+ default: c
1527
+ };
1528
+ }
1529
+ function pr(t) {
1530
+ const e = ir(t), n = !ar(t) && !e;
1531
+ return {
1532
+ transition: e,
1533
+ externalComponent: n,
1534
+ tag: n ? j(t) : e ? ro : t
1535
+ };
1536
+ }
1537
+ function mr({ $slots: t, tag: e, realList: n, getKey: o }) {
1538
+ const r = fr({ $slots: t, realList: n, getKey: o }), a = pr(e);
1539
+ return new cr({ nodes: r, root: a, realList: n });
1540
+ }
1541
+ function Kn(t, e) {
1542
+ an(() => this.$emit(t.toLowerCase(), e));
1543
+ }
1544
+ function qn(t) {
1545
+ return (e, n) => {
1546
+ if (this.realList !== null)
1547
+ return this[`onDrag${t}`](e, n);
1548
+ };
1549
+ }
1550
+ function hr(t) {
1551
+ const e = qn.call(this, t);
1552
+ return (n, o) => {
1553
+ e.call(this, n, o), Kn.call(this, t, n);
1554
+ };
1555
+ }
1556
+ let Qt = null;
1557
+ const gr = {
1558
+ list: {
1559
+ type: Array,
1560
+ required: !1,
1561
+ default: null
1562
+ },
1563
+ modelValue: {
1564
+ type: Array,
1565
+ required: !1,
1566
+ default: null
1567
+ },
1568
+ itemKey: {
1569
+ type: [String, Function],
1570
+ required: !0
1571
+ },
1572
+ clone: {
1573
+ type: Function,
1574
+ default: (t) => t
1575
+ },
1576
+ tag: {
1577
+ type: String,
1578
+ default: "div"
1579
+ },
1580
+ move: {
1581
+ type: Function,
1582
+ default: null
1583
+ },
1584
+ componentData: {
1585
+ type: Object,
1586
+ required: !1,
1587
+ default: null
1588
+ }
1589
+ }, vr = [
1590
+ "update:modelValue",
1591
+ "change",
1592
+ ...[...rn.manageAndEmit, ...rn.emit].map((t) => t.toLowerCase())
1593
+ ], br = Xe({
1594
+ name: "draggable",
1595
+ inheritAttrs: !1,
1596
+ props: gr,
1597
+ emits: vr,
1598
+ data() {
1599
+ return {
1600
+ error: !1
1601
+ };
1602
+ },
1603
+ render() {
1604
+ try {
1605
+ this.error = !1;
1606
+ const { $slots: t, $attrs: e, tag: n, componentData: o, realList: r, getKey: a } = this, i = mr({
1607
+ $slots: t,
1608
+ tag: n,
1609
+ realList: r,
1610
+ getKey: a
1611
+ });
1612
+ this.componentStructure = i;
1613
+ const c = lr({ $attrs: e, componentData: o });
1614
+ return i.render(dn, c);
1615
+ } catch (t) {
1616
+ return this.error = !0, dn("pre", { style: { color: "red" } }, t.stack);
1617
+ }
1618
+ },
1619
+ created() {
1620
+ this.list !== null && this.modelValue !== null && Zo.error(
1621
+ "modelValue and list props are mutually exclusive! Please set one or another."
1622
+ );
1623
+ },
1624
+ mounted() {
1625
+ if (this.error)
1626
+ return;
1627
+ const { $attrs: t, $el: e, componentStructure: n } = this;
1628
+ n.updated();
1629
+ const o = sr({
1630
+ $attrs: t,
1631
+ callBackBuilder: {
1632
+ manageAndEmit: (a) => hr.call(this, a),
1633
+ emit: (a) => Kn.bind(this, a),
1634
+ manage: (a) => qn.call(this, a)
1635
+ }
1636
+ }), r = e.nodeType === 1 ? e : e.parentElement;
1637
+ this._sortable = new T(r, o), this.targetDomElement = r, r.__draggable_component__ = this;
1638
+ },
1639
+ updated() {
1640
+ this.componentStructure.updated();
1641
+ },
1642
+ beforeUnmount() {
1643
+ this._sortable !== void 0 && this._sortable.destroy();
1644
+ },
1645
+ computed: {
1646
+ realList() {
1647
+ const { list: t } = this;
1648
+ return t || this.modelValue;
1649
+ },
1650
+ getKey() {
1651
+ const { itemKey: t } = this;
1652
+ return typeof t == "function" ? t : (e) => e[t];
1653
+ }
1654
+ },
1655
+ watch: {
1656
+ $attrs: {
1657
+ handler(t) {
1658
+ const { _sortable: e } = this;
1659
+ e && jn(t).forEach(([n, o]) => {
1660
+ e.option(n, o);
1661
+ });
1662
+ },
1663
+ deep: !0
1664
+ }
1665
+ },
1666
+ methods: {
1667
+ getUnderlyingVm(t) {
1668
+ return this.componentStructure.getUnderlyingVm(t) || null;
1669
+ },
1670
+ getUnderlyingPotencialDraggableComponent(t) {
1671
+ return t.__draggable_component__;
1672
+ },
1673
+ emitChanges(t) {
1674
+ an(() => this.$emit("change", t));
1675
+ },
1676
+ alterList(t) {
1677
+ if (this.list) {
1678
+ t(this.list);
1679
+ return;
1680
+ }
1681
+ const e = [...this.modelValue];
1682
+ t(e), this.$emit("update:modelValue", e);
1683
+ },
1684
+ spliceList() {
1685
+ const t = (e) => e.splice(...arguments);
1686
+ this.alterList(t);
1687
+ },
1688
+ updatePosition(t, e) {
1689
+ const n = (o) => o.splice(e, 0, o.splice(t, 1)[0]);
1690
+ this.alterList(n);
1691
+ },
1692
+ getRelatedContextFromMoveEvent({ to: t, related: e }) {
1693
+ const n = this.getUnderlyingPotencialDraggableComponent(t);
1694
+ if (!n)
1695
+ return { component: n };
1696
+ const o = n.realList, r = { list: o, component: n };
1697
+ return t !== e && o ? { ...n.getUnderlyingVm(e) || {}, ...r } : r;
1698
+ },
1699
+ getVmIndexFromDomIndex(t) {
1700
+ return this.componentStructure.getVmIndexFromDomIndex(
1701
+ t,
1702
+ this.targetDomElement
1703
+ );
1704
+ },
1705
+ onDragStart(t) {
1706
+ this.context = this.getUnderlyingVm(t.item), t.item._underlying_vm_ = this.clone(this.context.element), Qt = t.item;
1707
+ },
1708
+ onDragAdd(t) {
1709
+ const e = t.item._underlying_vm_;
1710
+ if (e === void 0)
1711
+ return;
1712
+ qt(t.item);
1713
+ const n = this.getVmIndexFromDomIndex(t.newIndex);
1714
+ this.spliceList(n, 0, e);
1715
+ const o = { element: e, newIndex: n };
1716
+ this.emitChanges({ added: o });
1717
+ },
1718
+ onDragRemove(t) {
1719
+ if (wn(this.$el, t.item, t.oldIndex), t.pullMode === "clone") {
1720
+ qt(t.clone);
1721
+ return;
1722
+ }
1723
+ const { index: e, element: n } = this.context;
1724
+ this.spliceList(e, 1);
1725
+ const o = { element: n, oldIndex: e };
1726
+ this.emitChanges({ removed: o });
1727
+ },
1728
+ onDragUpdate(t) {
1729
+ qt(t.item), wn(t.from, t.item, t.oldIndex);
1730
+ const e = this.context.index, n = this.getVmIndexFromDomIndex(t.newIndex);
1731
+ this.updatePosition(e, n);
1732
+ const o = { element: this.context.element, oldIndex: e, newIndex: n };
1733
+ this.emitChanges({ moved: o });
1734
+ },
1735
+ computeFutureIndex(t, e) {
1736
+ if (!t.element)
1737
+ return 0;
1738
+ const n = [...e.to.children].filter(
1739
+ (i) => i.style.display !== "none"
1740
+ ), o = n.indexOf(e.related), r = t.component.getVmIndexFromDomIndex(
1741
+ o
1742
+ );
1743
+ return n.indexOf(Qt) !== -1 || !e.willInsertAfter ? r : r + 1;
1744
+ },
1745
+ onDragMove(t, e) {
1746
+ const { move: n, realList: o } = this;
1747
+ if (!n || !o)
1748
+ return !0;
1749
+ const r = this.getRelatedContextFromMoveEvent(t), a = this.computeFutureIndex(r, t), i = {
1750
+ ...this.context,
1751
+ futureIndex: a
1752
+ }, c = {
1753
+ ...t,
1754
+ relatedContext: r,
1755
+ draggedContext: i
1756
+ };
1757
+ return n(c, e);
1758
+ },
1759
+ onDragEnd() {
1760
+ Qt = null;
1761
+ }
1762
+ }
1763
+ }), yr = Object.entries(z).map((t) => {
1764
+ let e = "";
1765
+ switch (t[1]) {
1766
+ case z.BarChart:
1767
+ e = "bar_chart";
1768
+ break;
1769
+ case z.Table:
1770
+ e = "table";
1771
+ break;
1772
+ case z.Circular:
1773
+ e = "pie_chart";
1774
+ break;
1775
+ case z.LineChart:
1776
+ e = "show_chart";
1777
+ break;
1778
+ case z.Scorecard:
1779
+ e = "money";
1780
+ break;
1781
+ case z.Spacer:
1782
+ e = "space_bar";
1783
+ break;
1784
+ case z.StackBarChart:
1785
+ e = "stacked_bar_chart";
1786
+ break;
1787
+ case z.ClusteredStackBarChart:
1788
+ e = "stacked_bar_chart";
1789
+ break;
1790
+ case z.StackLineChart:
1791
+ e = "stacked_line_chart";
1792
+ break;
1793
+ }
1794
+ return {
1795
+ label: go(t[0]),
1796
+ icon: e,
1797
+ value: t[1]
1798
+ };
1799
+ }), Er = /* @__PURE__ */ Xe({
1800
+ __name: "WidgetTypeList",
1801
+ props: /* @__PURE__ */ Mt({
1802
+ childClass: {
1803
+ type: String,
1804
+ default: ""
1805
+ },
1806
+ excludeWidgeType: {
1807
+ type: Array,
1808
+ default: () => []
1809
+ },
1810
+ isList: {
1811
+ type: Boolean,
1812
+ required: !1,
1813
+ default: !1
1814
+ }
1815
+ }, {
1816
+ modelValue: {
1817
+ default: ""
1818
+ },
1819
+ modelModifiers: {}
1820
+ }),
1821
+ emits: ["update:modelValue"],
1822
+ setup(t) {
1823
+ const { t: e } = Pt(), n = ot(t, "modelValue"), o = t, r = R(
1824
+ () => yr.map((a) => ({
1825
+ ...a,
1826
+ label: e(`report.widget.types.${a.value.toLowerCase()}`)
1827
+ }))
1828
+ );
1829
+ return (a, i) => {
1830
+ const c = j("FmIcon"), u = j("FmCard");
1831
+ return D(), k("div", null, [
1832
+ (D(!0), k(Ae, null, Ct(r.value.filter(
1833
+ (s) => o.excludeWidgeType.indexOf(s.value) === -1
1834
+ ), (s, f) => (D(), _e(u, {
1835
+ key: f,
1836
+ class: St(`items-center ${o.childClass} cursor-pointer rounded-[8px] ${o.isList ? "" : "gap-[16px] h-[120px] justify-center"} ${n.value === s.value ? "selected-widget" : ""}`),
1837
+ variant: "outlined",
1838
+ onClick: (l) => n.value = s.value
1839
+ }, {
1840
+ default: pe(() => [
1841
+ G(c, {
1842
+ name: s.icon,
1843
+ size: o.isList ? "md" : "lg",
1844
+ outline: !0
1845
+ }, null, 8, ["name", "size"]),
1846
+ A("span", {
1847
+ class: St(o.isList ? "" : "flex items-center text-center leading-[24px] h-[48px]")
1848
+ }, Q(s.label), 3)
1849
+ ]),
1850
+ _: 2
1851
+ }, 1032, ["class", "onClick"]))), 128))
1852
+ ]);
1853
+ };
1854
+ }
1855
+ }), ya = /* @__PURE__ */ ln(Er, [["__scopeId", "data-v-0535b07b"]]);
1856
+ function _r(t) {
1857
+ let e, n, o, r;
1858
+ switch (t) {
1859
+ case z.Table:
1860
+ e = [], n = !1, o = vo.top;
1861
+ break;
1862
+ case z.ClusteredStackBarChart:
1863
+ r = !0;
1864
+ break;
1865
+ }
1866
+ return {
1867
+ schemaNames: [],
1868
+ dimensions: [],
1869
+ metrics: [],
1870
+ filters: [],
1871
+ sorts: [],
1872
+ breakdownDimension: void 0,
1873
+ sparklineDimension: void 0,
1874
+ limit: null,
1875
+ showGrandTotal: !1,
1876
+ rollupPosition: o,
1877
+ showSearchBar: n,
1878
+ isTransposed: !1,
1879
+ isDrillable: !1,
1880
+ stackBarOverlap: r,
1881
+ columnIds: [],
1882
+ rowIds: [],
1883
+ joinDatasources: e
1884
+ };
1885
+ }
1886
+ function Ea(t, e) {
1887
+ let n = 1, o = 1;
1888
+ switch (t) {
1889
+ case z.Scorecard:
1890
+ n = 1, o = 2;
1891
+ break;
1892
+ case z.BarChart:
1893
+ case z.StackBarChart:
1894
+ case z.ClusteredStackBarChart:
1895
+ case z.LineChart:
1896
+ case z.StackLineChart:
1897
+ n = 4, o = 6;
1898
+ break;
1899
+ case z.Table:
1900
+ n = 4, o = 12;
1901
+ break;
1902
+ case z.Circular:
1903
+ n = 4, o = 4;
1904
+ break;
1905
+ case z.Spacer:
1906
+ n = 0, o = 12;
1907
+ break;
1908
+ }
1909
+ return {
1910
+ size: {
1911
+ width: o,
1912
+ height: n
1913
+ },
1914
+ widget: {
1915
+ title: e || "New widget",
1916
+ type: t,
1917
+ config: _r(t)
1918
+ }
1919
+ };
1920
+ }
1921
+ function _a(t, e) {
1922
+ return t.filter((n, o) => o !== e);
1923
+ }
1924
+ const Tr = {
1925
+ key: 0,
1926
+ class: "flex flex-col gap-5"
1927
+ }, wr = /* @__PURE__ */ Xe({
1928
+ __name: "Section",
1929
+ props: {
1930
+ isOpen: { type: Boolean, default: !0 },
1931
+ isOpenModifiers: {}
1932
+ },
1933
+ emits: ["update:isOpen"],
1934
+ setup(t) {
1935
+ const e = ot(t, "isOpen");
1936
+ return (n, o) => {
1937
+ const r = j("FmIcon"), a = j("FmMenuDivider");
1938
+ return D(), k(Ae, null, [
1939
+ A("div", {
1940
+ class: "flex items-center cursor-pointer fm-typo-en-body-lg-600",
1941
+ onClick: o[0] || (o[0] = (i) => e.value = !e.value)
1942
+ }, [
1943
+ ht(n.$slots, "header", {}, void 0, !0),
1944
+ G(r, {
1945
+ name: e.value ? "keyboard_arrow_up" : "keyboard_arrow_down"
1946
+ }, null, 8, ["name"])
1947
+ ]),
1948
+ G(Jt, { name: "slide-fade" }, {
1949
+ default: pe(() => [
1950
+ e.value ? (D(), k("div", Tr, [
1951
+ ht(n.$slots, "content", {}, void 0, !0)
1952
+ ])) : U("", !0)
1953
+ ]),
1954
+ _: 3
1955
+ }),
1956
+ G(a)
1957
+ ], 64);
1958
+ };
1959
+ }
1960
+ }), Ta = /* @__PURE__ */ ln(wr, [["__scopeId", "data-v-fa67a3a4"]]);
1961
+ var J = /* @__PURE__ */ ((t) => (t.Dimension = "DIMENSION", t.Metric = "METRIC", t))(J || {});
1962
+ const xr = { class: "relative" }, Dr = ["placeholder", "onKeydown"], Ir = { class: "flex items-center gap-1 px-3 py-1" }, Or = {
1963
+ key: 1,
1964
+ class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300"
1965
+ }, Cr = {
1966
+ key: 2,
1967
+ class: "fm-typo-en-body-sm-400 text-fm-color-system-success-300"
1968
+ }, Sr = {
1969
+ key: 0,
1970
+ class: "m-2 mb-0 rounded-lg border border-neutral-200 bg-neutral-50 px-4 py-3"
1971
+ }, Rr = { class: "flex items-center gap-2" }, Fr = { class: "fm-typo-en-title-md-400 text-fm-color-typo-primary" }, Nr = { class: "fm-typo-en-body-sm-400" }, Ar = { class: "mt-3 border-l-2 border-fm-color-system-info-100 pl-3 fm-typo-en-body-md-400 text-fm-color-typo-primary leading-relaxed" }, kr = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400 mt-3 uppercase tracking-wide" }, Lr = { class: "mt-1 rounded-md bg-fm-color-neutral-white px-3 py-2 fm-typo-en-body-md-400 text-fm-color-typo-primary leading-relaxed break-words" }, Mr = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400 mt-3 uppercase tracking-wide" }, Pr = { class: "mt-1 rounded-md bg-fm-color-neutral-white px-3 py-2 fm-typo-en-body-md-400 text-fm-color-typo-primary leading-relaxed break-words" }, Vr = { key: 2 }, Ur = ["onMousedown", "onMouseenter"], $r = { class: "min-w-0 flex-1" }, Br = { class: "flex items-start gap-2 min-w-0" }, Wr = { class: "min-w-0 overflow-hidden text-ellipsis line-clamp-3 fm-typo-en-body-md-400" }, Yr = {
1972
+ key: 0,
1973
+ class: "shrink-0 fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
1974
+ }, Hr = { class: "fm-typo-en-body-sm-400" }, Xr = {
1975
+ key: 0,
1976
+ class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-300 leading-relaxed whitespace-normal"
1977
+ }, Gr = /* @__PURE__ */ Xe({
1978
+ __name: "FormulaInput",
1979
+ props: /* @__PURE__ */ Mt({
1980
+ placeholder: {},
1981
+ fieldDataList: {},
1982
+ functionList: {},
1983
+ formulaField: {},
1984
+ validationResult: {},
1985
+ isValidating: { type: Boolean },
1986
+ validFormulaLabel: {}
1987
+ }, {
1988
+ modelValue: { required: !0 },
1989
+ modelModifiers: {}
1990
+ }),
1991
+ emits: ["update:modelValue"],
1992
+ setup(t) {
1993
+ function e(h) {
1994
+ switch (h) {
1995
+ case "FUNCTION":
1996
+ return r("report.formulaInput.badge.function");
1997
+ case "FIELD":
1998
+ return r("report.formulaInput.badge.field");
1999
+ case "KEYWORD":
2000
+ return r("report.formulaInput.badge.keyword");
2001
+ }
2002
+ }
2003
+ function n(h) {
2004
+ switch (h) {
2005
+ case "FIELD":
2006
+ return "bg-fm-color-primary text-fm-color-typo-white";
2007
+ case "FUNCTION":
2008
+ return "bg-fm-color-system-info-100 text-fm-color-typo-info";
2009
+ case "KEYWORD":
2010
+ return "text-fm-color-typo-secondary";
2011
+ }
2012
+ }
2013
+ const o = ot(t, "modelValue"), { t: r } = Pt();
2014
+ function a(h) {
2015
+ const I = [h.toLowerCase(), e(h).toLowerCase()];
2016
+ return h === "KEYWORD" && I.push("expr", "expression"), I;
2017
+ }
2018
+ function i(h, I) {
2019
+ return h ? a(I).some((x) => x.includes(h)) : !1;
2020
+ }
2021
+ function c(h, I, x) {
2022
+ return h ? i(h, I) || x.some((F) => F == null ? void 0 : F.toLowerCase().includes(h)) : !0;
2023
+ }
2024
+ const u = t, s = oe(null), f = oe(null), l = oe(!1), E = oe({ top: 0, left: 0 }), y = oe(0), b = oe(!1), g = oe(null), L = R(() => u.formulaField), H = R(() => [
2025
+ {
2026
+ value: "AVG",
2027
+ description: r("report.formulaInput.functionDescription.avg"),
2028
+ example: "AVG(sales_total)",
2029
+ exampleResult: r("report.formulaInput.functionResult.avg"),
2030
+ insertText: "AVG()",
2031
+ cursorOffset: 4,
2032
+ allowedFields: [J.Metric]
2033
+ },
2034
+ {
2035
+ value: "SUM",
2036
+ description: r("report.formulaInput.functionDescription.sum"),
2037
+ example: "SUM(sales_total)",
2038
+ exampleResult: r("report.formulaInput.functionResult.sum"),
2039
+ insertText: "SUM()",
2040
+ cursorOffset: 4,
2041
+ allowedFields: [J.Metric]
2042
+ },
2043
+ {
2044
+ value: "COUNT",
2045
+ description: r("report.formulaInput.functionDescription.count"),
2046
+ example: "COUNT(order_id)",
2047
+ exampleResult: r("report.formulaInput.functionResult.count"),
2048
+ insertText: "COUNT()",
2049
+ cursorOffset: 6
2050
+ },
2051
+ {
2052
+ value: "MAX",
2053
+ description: r("report.formulaInput.functionDescription.max"),
2054
+ example: "MAX(sales_total)",
2055
+ exampleResult: r("report.formulaInput.functionResult.max"),
2056
+ insertText: "MAX()",
2057
+ cursorOffset: 4
2058
+ },
2059
+ {
2060
+ value: "MIN",
2061
+ description: r("report.formulaInput.functionDescription.min"),
2062
+ example: "MIN(sales_total)",
2063
+ exampleResult: r("report.formulaInput.functionResult.min"),
2064
+ insertText: "MIN()",
2065
+ cursorOffset: 4
2066
+ },
2067
+ {
2068
+ value: "ABS",
2069
+ description: r("report.formulaInput.functionDescription.abs"),
2070
+ example: "ABS(net_change)",
2071
+ exampleResult: r("report.formulaInput.functionResult.abs"),
2072
+ insertText: "ABS()",
2073
+ cursorOffset: 4
2074
+ },
2075
+ {
2076
+ value: "ROUND",
2077
+ description: r("report.formulaInput.functionDescription.round"),
2078
+ example: "ROUND(sales_total, 2)",
2079
+ exampleResult: r("report.formulaInput.functionResult.round"),
2080
+ insertText: "ROUND()",
2081
+ cursorOffset: 6
2082
+ },
2083
+ {
2084
+ value: "REPLACE",
2085
+ description: r("report.formulaInput.functionDescription.replace"),
2086
+ example: "REPLACE(customer_phone, '-', '')",
2087
+ exampleResult: r("report.formulaInput.functionResult.replace"),
2088
+ insertText: "REPLACE()",
2089
+ cursorOffset: 8,
2090
+ allowedFields: [J.Dimension]
2091
+ },
2092
+ {
2093
+ value: "RIGHT",
2094
+ description: r("report.formulaInput.functionDescription.right"),
2095
+ example: "RIGHT(order_code, 4)",
2096
+ exampleResult: r("report.formulaInput.functionResult.right"),
2097
+ insertText: "RIGHT()",
2098
+ cursorOffset: 6,
2099
+ allowedFields: [J.Dimension]
2100
+ },
2101
+ {
2102
+ value: "SUBSTR",
2103
+ description: r("report.formulaInput.functionDescription.substr"),
2104
+ example: "SUBSTR(customer_code, 1, 3)",
2105
+ exampleResult: r("report.formulaInput.functionResult.substr"),
2106
+ insertText: "SUBSTR()",
2107
+ cursorOffset: 7,
2108
+ allowedFields: [J.Dimension]
2109
+ },
2110
+ {
2111
+ value: "REGEXP_MATCH",
2112
+ description: r("report.formulaInput.functionDescription.regexpMatch"),
2113
+ example: "REGEXP_MATCH(customer_email, '@gmail\\.com$')",
2114
+ exampleResult: r("report.formulaInput.functionResult.regexpMatch"),
2115
+ insertText: "REGEXP_MATCH()",
2116
+ cursorOffset: 13,
2117
+ allowedFields: [J.Dimension]
2118
+ },
2119
+ {
2120
+ value: "REGEXP_REPLACE",
2121
+ description: r("report.formulaInput.functionDescription.regexpReplace"),
2122
+ example: "REGEXP_REPLACE(customer_phone, '[^0-9]', '', 'g')",
2123
+ exampleResult: r("report.formulaInput.functionResult.regexpReplace"),
2124
+ insertText: "REGEXP_REPLACE()",
2125
+ cursorOffset: 15,
2126
+ allowedFields: [J.Dimension]
2127
+ },
2128
+ {
2129
+ value: "TRIM",
2130
+ description: r("report.formulaInput.functionDescription.trim"),
2131
+ example: "TRIM(customer_name)",
2132
+ exampleResult: r("report.formulaInput.functionResult.trim"),
2133
+ insertText: "TRIM()",
2134
+ cursorOffset: 5,
2135
+ allowedFields: [J.Dimension]
2136
+ },
2137
+ {
2138
+ value: "COALESCE",
2139
+ description: r("report.formulaInput.functionDescription.coalesce"),
2140
+ example: "COALESCE(sales_discount, 0)",
2141
+ exampleResult: r("report.formulaInput.functionResult.coalesce"),
2142
+ insertText: "COALESCE()",
2143
+ cursorOffset: 9
2144
+ },
2145
+ {
2146
+ value: "NULLIF",
2147
+ description: r("report.formulaInput.functionDescription.nullif"),
2148
+ example: "NULLIF(sales_total, 0)",
2149
+ exampleResult: r("report.formulaInput.functionResult.nullif"),
2150
+ insertText: "NULLIF()",
2151
+ cursorOffset: 7
2152
+ },
2153
+ {
2154
+ value: "CONCAT",
2155
+ description: r("report.formulaInput.functionDescription.concat"),
2156
+ example: "CONCAT(customer_firstname, ' ', customer_lastname)",
2157
+ exampleResult: r("report.formulaInput.functionResult.concat"),
2158
+ insertText: "CONCAT()",
2159
+ cursorOffset: 7,
2160
+ allowedFields: [J.Dimension]
2161
+ },
2162
+ {
2163
+ value: "DATE_TRUNC",
2164
+ description: r("report.formulaInput.functionDescription.dateTrunc"),
2165
+ example: "DATE_TRUNC('month', sales_createdat)",
2166
+ exampleResult: r("report.formulaInput.functionResult.dateTrunc"),
2167
+ insertText: "DATE_TRUNC()",
2168
+ cursorOffset: 11,
2169
+ allowedFields: [J.Dimension]
2170
+ },
2171
+ {
2172
+ value: "TO_CHAR",
2173
+ description: r("report.formulaInput.functionDescription.toChar"),
2174
+ example: "TO_CHAR(sales_createdat, 'YYYY-MM-DD')",
2175
+ exampleResult: r("report.formulaInput.functionResult.toChar"),
2176
+ insertText: "TO_CHAR()",
2177
+ cursorOffset: 8,
2178
+ allowedFields: [J.Dimension]
2179
+ },
2180
+ {
2181
+ value: "TO_TIMESTAMP",
2182
+ description: r("report.formulaInput.functionDescription.toTimestamp"),
2183
+ example: "TO_TIMESTAMP(order_created_epoch)",
2184
+ exampleResult: r("report.formulaInput.functionResult.toTimestamp"),
2185
+ insertText: "TO_TIMESTAMP()",
2186
+ cursorOffset: 13
2187
+ },
2188
+ {
2189
+ value: "LOWER",
2190
+ description: r("report.formulaInput.functionDescription.lower"),
2191
+ example: "LOWER(customer_email)",
2192
+ exampleResult: r("report.formulaInput.functionResult.lower"),
2193
+ insertText: "LOWER()",
2194
+ cursorOffset: 6,
2195
+ allowedFields: [J.Dimension]
2196
+ },
2197
+ {
2198
+ value: "UPPER",
2199
+ description: r("report.formulaInput.functionDescription.upper"),
2200
+ example: "UPPER(customer_code)",
2201
+ exampleResult: r("report.formulaInput.functionResult.upper"),
2202
+ insertText: "UPPER()",
2203
+ cursorOffset: 6,
2204
+ allowedFields: [J.Dimension]
2205
+ },
2206
+ {
2207
+ value: "EXTRACT",
2208
+ description: r("report.formulaInput.functionDescription.extract"),
2209
+ example: "EXTRACT(MONTH FROM sales_createdat)",
2210
+ exampleResult: r("report.formulaInput.functionResult.extract"),
2211
+ insertText: "EXTRACT()",
2212
+ cursorOffset: 8,
2213
+ allowedFields: [J.Dimension]
2214
+ },
2215
+ {
2216
+ value: "FIRST_VALUE",
2217
+ description: r("report.formulaInput.functionDescription.firstValue"),
2218
+ example: "FIRST_VALUE(sales_total_sum) OVER (PARTITION BY sales_store ORDER BY sales_createdat)",
2219
+ exampleResult: r("report.formulaInput.functionResult.firstValue"),
2220
+ insertText: "FIRST_VALUE() OVER ()",
2221
+ cursorOffset: 12,
2222
+ allowedFields: [J.Metric]
2223
+ },
2224
+ {
2225
+ value: "LAST_VALUE",
2226
+ description: r("report.formulaInput.functionDescription.lastValue"),
2227
+ example: "LAST_VALUE(sales_total_sum) OVER (PARTITION BY sales_store ORDER BY sales_createdat ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)",
2228
+ exampleResult: r("report.formulaInput.functionResult.lastValue"),
2229
+ insertText: "LAST_VALUE() OVER ()",
2230
+ cursorOffset: 11,
2231
+ allowedFields: [J.Metric]
2232
+ }
2233
+ ]), N = R(
2234
+ () => [
2235
+ {
2236
+ value: "PARTITION BY ",
2237
+ label: "PARTITION BY",
2238
+ description: r("report.formulaInput.keywordDescription.partitionBy")
2239
+ },
2240
+ {
2241
+ value: "ORDER BY ",
2242
+ label: "ORDER BY",
2243
+ description: r("report.formulaInput.keywordDescription.orderBy")
2244
+ },
2245
+ {
2246
+ value: "ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW",
2247
+ label: "ROWS BETWEEN",
2248
+ description: r("report.formulaInput.keywordDescription.rowsBetween")
2249
+ }
2250
+ ]
2251
+ ), $ = R(() => [
2252
+ {
2253
+ value: "CASE",
2254
+ label: "CASE WHEN THEN ELSE END",
2255
+ description: r("report.formulaInput.keywordDescription.caseWhen"),
2256
+ insertText: "CASE WHEN THEN ELSE END",
2257
+ cursorOffset: 10,
2258
+ aliases: ["when", "then", "else"]
2259
+ },
2260
+ {
2261
+ value: "AT TIME ZONE",
2262
+ label: "AT TIME ZONE",
2263
+ description: r("report.formulaInput.keywordDescription.atTimeZone"),
2264
+ insertText: "AT TIME ZONE ''",
2265
+ cursorOffset: 14
2266
+ },
2267
+ {
2268
+ value: "INTERVAL",
2269
+ label: "INTERVAL",
2270
+ description: r("report.formulaInput.keywordDescription.interval"),
2271
+ insertText: "INTERVAL ''",
2272
+ cursorOffset: 10
2273
+ },
2274
+ {
2275
+ value: "::",
2276
+ label: ":: cast",
2277
+ description: r("report.formulaInput.keywordDescription.cast"),
2278
+ insertText: "::",
2279
+ cursorOffset: 2,
2280
+ aliases: ["cast"]
2281
+ },
2282
+ {
2283
+ value: "DOW",
2284
+ label: "DOW",
2285
+ description: r("report.formulaInput.keywordDescription.dow"),
2286
+ insertText: "DOW",
2287
+ cursorOffset: 3,
2288
+ aliases: ["day of week", "weekday"]
2289
+ },
2290
+ {
2291
+ value: "IYYY-IW",
2292
+ label: "IYYY-IW",
2293
+ description: r("report.formulaInput.keywordDescription.iyyyIw"),
2294
+ insertText: "IYYY-IW",
2295
+ cursorOffset: 7,
2296
+ aliases: ["iso week", "week format"]
2297
+ },
2298
+ {
2299
+ value: "LIKE",
2300
+ label: "LIKE",
2301
+ description: r("report.formulaInput.keywordDescription.like"),
2302
+ insertText: " LIKE ''",
2303
+ cursorOffset: 7,
2304
+ aliases: ["like", "pattern"]
2305
+ },
2306
+ {
2307
+ value: "NOT LIKE",
2308
+ label: "NOT LIKE",
2309
+ description: r("report.formulaInput.keywordDescription.notLike"),
2310
+ insertText: " NOT LIKE ''",
2311
+ cursorOffset: 11,
2312
+ aliases: ["notlike", "exclude pattern"]
2313
+ },
2314
+ {
2315
+ value: "=",
2316
+ label: "EQUAL",
2317
+ description: r("report.formulaInput.keywordDescription.equal"),
2318
+ insertText: " = ",
2319
+ cursorOffset: 3,
2320
+ aliases: ["equal"]
2321
+ },
2322
+ {
2323
+ value: "!=",
2324
+ label: "NOT EQUAL",
2325
+ description: r("report.formulaInput.keywordDescription.notEqual"),
2326
+ insertText: " != ",
2327
+ cursorOffset: 4,
2328
+ aliases: ["not equal", "<>"]
2329
+ },
2330
+ {
2331
+ value: "IS NOT NULL",
2332
+ label: "IS NOT NULL",
2333
+ description: r("report.formulaInput.keywordDescription.isNotNull"),
2334
+ insertText: " IS NOT NULL",
2335
+ cursorOffset: 12,
2336
+ aliases: ["null", "not null"]
2337
+ },
2338
+ {
2339
+ value: "EPOCH",
2340
+ label: "EPOCH",
2341
+ description: r("report.formulaInput.keywordDescription.epoch"),
2342
+ insertText: "EPOCH",
2343
+ cursorOffset: 5
2344
+ },
2345
+ {
2346
+ value: "SECOND",
2347
+ label: "SECOND",
2348
+ description: r("report.formulaInput.keywordDescription.second"),
2349
+ insertText: "SECOND",
2350
+ cursorOffset: 6
2351
+ },
2352
+ {
2353
+ value: "MINUTE",
2354
+ label: "MINUTE",
2355
+ description: r("report.formulaInput.keywordDescription.minute"),
2356
+ insertText: "MINUTE",
2357
+ cursorOffset: 6
2358
+ },
2359
+ {
2360
+ value: "HOUR",
2361
+ label: "HOUR",
2362
+ description: r("report.formulaInput.keywordDescription.hour"),
2363
+ insertText: "HOUR",
2364
+ cursorOffset: 4
2365
+ },
2366
+ {
2367
+ value: "DAY",
2368
+ label: "DAY",
2369
+ description: r("report.formulaInput.keywordDescription.day"),
2370
+ insertText: "DAY",
2371
+ cursorOffset: 3
2372
+ },
2373
+ {
2374
+ value: "WEEK",
2375
+ label: "WEEK",
2376
+ description: r("report.formulaInput.keywordDescription.week"),
2377
+ insertText: "WEEK",
2378
+ cursorOffset: 4
2379
+ },
2380
+ {
2381
+ value: "MONTH",
2382
+ label: "MONTH",
2383
+ description: r("report.formulaInput.keywordDescription.month"),
2384
+ insertText: "MONTH",
2385
+ cursorOffset: 5
2386
+ },
2387
+ {
2388
+ value: "QUARTER",
2389
+ label: "QUARTER",
2390
+ description: r("report.formulaInput.keywordDescription.quarter"),
2391
+ insertText: "QUARTER",
2392
+ cursorOffset: 7
2393
+ },
2394
+ {
2395
+ value: "YEAR",
2396
+ label: "YEAR",
2397
+ description: r("report.formulaInput.keywordDescription.year"),
2398
+ insertText: "YEAR",
2399
+ cursorOffset: 4
2400
+ }
2401
+ ]), B = R(() => [
2402
+ ...H.value,
2403
+ ...u.functionList || []
2404
+ ]), M = R(
2405
+ () => B.value.filter(
2406
+ (h) => !h.allowedFields || h.allowedFields.length === 0 || h.allowedFields.includes(L.value)
2407
+ )
2408
+ ), X = /* @__PURE__ */ new Set([
2409
+ "LOWER",
2410
+ "UPPER",
2411
+ "TO_CHAR",
2412
+ "DATE_TRUNC",
2413
+ "EXTRACT",
2414
+ "TO_TIMESTAMP"
2415
+ ]), me = R(() => re.value ? X.has(re.value.value.toUpperCase()) : !1), Se = R(() => {
2416
+ const h = o.value || "";
2417
+ return Math.max(h.split(`
2418
+ `).length, 1);
2419
+ }), te = R(() => Array.from({ length: Se.value }, (h, I) => I + 1));
2420
+ function Te(h, I) {
2421
+ let x = I;
2422
+ for (; x > 0 && /\w/.test(h[x - 1]); ) x--;
2423
+ let F = I;
2424
+ for (; F < h.length && /\w/.test(h[F]); ) F++;
2425
+ return { start: x, end: F };
2426
+ }
2427
+ const he = R(() => {
2428
+ const h = o.value || "", I = y.value;
2429
+ if (!h) return "";
2430
+ const { start: x, end: F } = Te(h, I);
2431
+ return h.substring(x, F);
2432
+ }), Re = R(() => he.value.trim().length > 0);
2433
+ R(
2434
+ () => Re.value || Z.value.insideParens
2435
+ );
2436
+ const Z = R(() => {
2437
+ var ae;
2438
+ const h = o.value || "", I = y.value, x = h.substring(0, I), F = [];
2439
+ for (let p = 0; p < x.length; p++)
2440
+ h[p] === "(" ? F.push(p) : h[p] === ")" && F.pop();
2441
+ const de = F.length > 0 ? F[F.length - 1] : -1;
2442
+ if (de !== -1) {
2443
+ const p = x.substring(de + 1), xe = x.substring(0, de).trimEnd(), $e = xe.match(/(\w+)$/), Be = $e ? $e[1].toUpperCase() : "", at = xe.match(/(\w+)\([^()]*\)\s+OVER$/i), Ut = Be === "OVER" ? ((ae = at == null ? void 0 : at[1]) == null ? void 0 : ae.toUpperCase()) || "OVER" : Be;
2444
+ return {
2445
+ insideParens: !0,
2446
+ functionName: Be,
2447
+ guideFunctionName: Ut,
2448
+ hasText: p.trim().length > 0
2449
+ };
2450
+ }
2451
+ return {
2452
+ insideParens: !1,
2453
+ functionName: "",
2454
+ guideFunctionName: "",
2455
+ hasText: !1
2456
+ };
2457
+ }), we = R(() => [
2458
+ {
2459
+ value: "TEXT",
2460
+ label: "::text",
2461
+ description: r("report.formulaInput.keywordDescription.castText"),
2462
+ insertText: "text",
2463
+ cursorOffset: 4,
2464
+ aliases: ["::text"]
2465
+ },
2466
+ {
2467
+ value: "NUMERIC",
2468
+ label: "::numeric",
2469
+ description: r("report.formulaInput.keywordDescription.castNumeric"),
2470
+ insertText: "numeric",
2471
+ cursorOffset: 7,
2472
+ aliases: ["::numeric"]
2473
+ },
2474
+ {
2475
+ value: "BOOL",
2476
+ label: "::bool",
2477
+ description: r("report.formulaInput.keywordDescription.castBool"),
2478
+ insertText: "bool",
2479
+ cursorOffset: 4,
2480
+ aliases: ["::bool", "::boolean"]
2481
+ },
2482
+ {
2483
+ value: "TIMESTAMPTZ",
2484
+ label: "::timestamptz",
2485
+ description: r("report.formulaInput.keywordDescription.castTimestamptz"),
2486
+ insertText: "timestamptz",
2487
+ cursorOffset: 11,
2488
+ aliases: ["::timestampz", "::timestamptz"]
2489
+ },
2490
+ {
2491
+ value: "JSON",
2492
+ label: "::json",
2493
+ description: r("report.formulaInput.keywordDescription.castJson"),
2494
+ insertText: "json",
2495
+ cursorOffset: 4,
2496
+ aliases: ["::json"]
2497
+ }
2498
+ ]), Fe = R(() => {
2499
+ const h = o.value || "", I = y.value, { start: x } = Te(h, I), F = h.substring(0, x);
2500
+ return /::\s*$/.test(F);
2501
+ }), ce = R(() => {
2502
+ const h = he.value.toLowerCase(), I = me.value;
2503
+ if (Fe.value)
2504
+ return we.value.filter(
2505
+ (p) => c(h, "KEYWORD", [
2506
+ p.label,
2507
+ p.value,
2508
+ ...p.aliases || []
2509
+ ])
2510
+ ).map((p) => ({
2511
+ value: p.value,
2512
+ label: p.label || p.value,
2513
+ type: "KEYWORD",
2514
+ description: p.description,
2515
+ insertText: p.insertText,
2516
+ cursorOffset: p.cursorOffset
2517
+ }));
2518
+ const x = u.fieldDataList.filter(
2519
+ (p) => c(h, "FIELD", [
2520
+ p.label,
2521
+ p.value,
2522
+ p.badge,
2523
+ p.meta
2524
+ ])
2525
+ ).map((p) => ({
2526
+ value: p.value,
2527
+ label: p.label,
2528
+ type: "FIELD",
2529
+ badge: p.badge,
2530
+ meta: p.meta
2531
+ })), F = I ? [] : M.value.filter(
2532
+ (p) => c(h, "FUNCTION", [
2533
+ p.value,
2534
+ ...p.aliases || []
2535
+ ])
2536
+ ).map((p) => ({
2537
+ value: p.value,
2538
+ label: p.label || p.insertText || `${p.value}()`,
2539
+ type: "FUNCTION",
2540
+ description: p.description,
2541
+ insertText: p.insertText,
2542
+ cursorOffset: p.cursorOffset
2543
+ })), de = I ? [] : $.value.filter(
2544
+ (p) => c(h, "KEYWORD", [
2545
+ p.label,
2546
+ p.value,
2547
+ ...p.aliases || []
2548
+ ])
2549
+ ).map((p) => ({
2550
+ value: p.value,
2551
+ label: p.label || p.value,
2552
+ type: "KEYWORD",
2553
+ description: p.description,
2554
+ insertText: p.insertText,
2555
+ cursorOffset: p.cursorOffset
2556
+ })), ae = Z.value.insideParens && Z.value.functionName === "OVER" ? N.value.filter(
2557
+ (p) => c(h, "KEYWORD", [p.label])
2558
+ ).map((p) => ({
2559
+ ...p,
2560
+ type: "KEYWORD"
2561
+ /* Keyword */
2562
+ })) : [];
2563
+ return [...F, ...de, ...ae, ...x];
2564
+ }), re = R(() => {
2565
+ if (!Z.value.insideParens) return null;
2566
+ const h = Z.value.guideFunctionName;
2567
+ return h && M.value.find((I) => I.value.toUpperCase() === h) || null;
2568
+ }), d = R(() => re.value ? "FUNCTION" : void 0), v = R(
2569
+ () => ce.value.find((h) => h.value === g.value)
2570
+ ), O = R(() => l.value && ce.value.length > 0), K = R(
2571
+ () => l.value && Z.value.insideParens && !Z.value.hasText && re.value !== null
2572
+ ), le = R(
2573
+ () => l.value && (K.value || O.value)
2574
+ );
2575
+ function Pe(h) {
2576
+ const I = h.getBoundingClientRect(), x = window.getComputedStyle(h), F = parseFloat(x.lineHeight) || 24, de = h.value.substring(0, h.selectionStart), ae = document.createElement("div");
2577
+ ae.style.cssText = `
2578
+ position: fixed;
2579
+ top: ${I.top}px;
2580
+ left: ${I.left}px;
2581
+ width: ${h.clientWidth}px;
2582
+ height: ${h.clientHeight}px;
2583
+ padding: ${x.padding};
2584
+ border: ${x.border};
2585
+ box-sizing: ${x.boxSizing};
2586
+ overflow: hidden;
2587
+ white-space: pre-wrap;
2588
+ overflow-wrap: break-word;
2589
+ word-break: break-word;
2590
+ font-family: ${x.fontFamily};
2591
+ font-size: ${x.fontSize};
2592
+ font-weight: ${x.fontWeight};
2593
+ font-style: ${x.fontStyle};
2594
+ font-variant: ${x.fontVariant};
2595
+ line-height: ${x.lineHeight};
2596
+ letter-spacing: ${x.letterSpacing};
2597
+ word-spacing: ${x.wordSpacing};
2598
+ text-transform: ${x.textTransform};
2599
+ text-indent: ${x.textIndent};
2600
+ text-rendering: ${x.textRendering};
2601
+ tab-size: ${x.tabSize};
2602
+ visibility: hidden;
2603
+ pointer-events: none;
2604
+ `, ae.textContent = de;
2605
+ const p = document.createElement("span");
2606
+ p.textContent = "​", ae.appendChild(p), document.body.appendChild(ae), ae.scrollTop = h.scrollTop, ae.scrollLeft = h.scrollLeft;
2607
+ const xe = p.getBoundingClientRect();
2608
+ document.body.removeChild(ae);
2609
+ const $e = 8, Be = 12, at = 320, Ut = 360, Zn = xe.top + F + $e, Jn = xe.left + $e, eo = window.innerHeight - Ut - Be, to = window.innerWidth - at - Be;
2610
+ return {
2611
+ top: Math.max(Be, Math.min(Zn, eo)),
2612
+ left: Math.max(Be, Math.min(Jn, to))
2613
+ };
2614
+ }
2615
+ function rt() {
2616
+ b.value = !0, l.value = !0, Ne();
2617
+ }
2618
+ function ge() {
2619
+ setTimeout(() => {
2620
+ b.value = !1, l.value = !1;
2621
+ }, 150);
2622
+ }
2623
+ function Ne() {
2624
+ s.value && (y.value = s.value.selectionStart, E.value = Pe(s.value));
2625
+ }
2626
+ function bt(h) {
2627
+ const I = h.type === "FIELD" ? h.value : h.insertText || (h.type === "FUNCTION" ? `${h.value}()` : h.value), x = o.value || "", F = y.value, { start: de, end: ae } = Te(x, F);
2628
+ o.value = x.substring(0, de) + I + x.substring(ae), an(() => {
2629
+ var xe, $e;
2630
+ (xe = s.value) == null || xe.focus();
2631
+ const p = h.type === "FUNCTION" || h.type === "KEYWORD" ? de + (h.cursorOffset ?? h.value.length + 1) : de + I.length;
2632
+ ($e = s.value) == null || $e.setSelectionRange(p, p), l.value = !0, Ne();
2633
+ });
2634
+ }
2635
+ function Ve(h) {
2636
+ g.value = h;
2637
+ }
2638
+ function Ue() {
2639
+ !O.value || !v.value || bt(v.value);
2640
+ }
2641
+ function ne() {
2642
+ s.value && f.value && (f.value.scrollTop = s.value.scrollTop);
2643
+ }
2644
+ return (h, I) => {
2645
+ var ae;
2646
+ const x = j("FmCircularProgress"), F = j("FmChip"), de = j("FmMenuDivider");
2647
+ return D(), k("div", xr, [
2648
+ A("div", {
2649
+ class: "flex rounded-md overflow-hidden",
2650
+ style: Zt({
2651
+ outline: "none",
2652
+ border: b.value ? "2px solid var(--fm-color-primary)" : "1px solid rgb(212 212 216)",
2653
+ boxShadow: b.value ? "0 0 0 2px #fff4e4" : "none"
2654
+ })
2655
+ }, [
2656
+ A("div", {
2657
+ ref_key: "lineNumberRef",
2658
+ ref: f,
2659
+ class: "select-none text-right min-w-[32px] px-2 py-1 text-fm-color-neutral-gray-300 fm-typo-en-body-lg-400 border-r leading-normal"
2660
+ }, [
2661
+ (D(!0), k(Ae, null, Ct(te.value, (p) => (D(), k("div", { key: p }, Q(p), 1))), 128))
2662
+ ], 512),
2663
+ ao(A("textarea", {
2664
+ ref_key: "textareaRef",
2665
+ ref: s,
2666
+ "onUpdate:modelValue": I[0] || (I[0] = (p) => o.value = p),
2667
+ placeholder: h.placeholder,
2668
+ class: "fm-typo-en-body-lg-400 px-3 py-1 w-full resize-none h-[120px] border-0 flex-1 leading-normal focus:outline-none fm-color-typo-primary",
2669
+ onFocus: rt,
2670
+ onBlur: ge,
2671
+ onInput: Ne,
2672
+ onClick: Ne,
2673
+ onKeyup: Ne,
2674
+ onKeydown: io(Rt(Ue, ["prevent"]), ["tab"]),
2675
+ onScroll: ne
2676
+ }, null, 40, Dr), [
2677
+ [lo, o.value]
2678
+ ])
2679
+ ], 4),
2680
+ A("div", Ir, [
2681
+ h.isValidating ? (D(), _e(x, {
2682
+ key: 0,
2683
+ size: "md"
2684
+ })) : U("", !0),
2685
+ !h.isValidating && h.validationResult && !h.validationResult.valid ? (D(), k("p", Or, Q((ae = h.validationResult.error) == null ? void 0 : ae.message), 1)) : U("", !0),
2686
+ !h.isValidating && h.validationResult && h.validationResult.valid ? (D(), k("p", Cr, Q(h.validFormulaLabel), 1)) : U("", !0)
2687
+ ]),
2688
+ le.value ? (D(), k("div", {
2689
+ key: 0,
2690
+ class: "fixed z-[999] bg-fm-color-neutral-white shadow-light-300 rounded-md border border-neutral-200 min-w-[260px] max-w-[320px] max-h-[360px] overflow-x-hidden overflow-y-auto",
2691
+ style: Zt({
2692
+ top: E.value.top + "px",
2693
+ left: E.value.left + "px"
2694
+ })
2695
+ }, [
2696
+ K.value ? (D(), k("div", Sr, [
2697
+ A("div", Rr, [
2698
+ A("p", Fr, Q(re.value.value) + "() ", 1),
2699
+ d.value ? (D(), _e(F, {
2700
+ key: 0,
2701
+ compact: !0,
2702
+ class: St(n(d.value))
2703
+ }, {
2704
+ default: pe(() => [
2705
+ A("p", Nr, Q(e(d.value)), 1)
2706
+ ]),
2707
+ _: 1
2708
+ }, 8, ["class"])) : U("", !0)
2709
+ ]),
2710
+ A("p", Ar, Q(re.value.description), 1),
2711
+ re.value.example ? (D(), k(Ae, { key: 0 }, [
2712
+ A("p", kr, Q(V(r)("report.formulaInput.section.example")), 1),
2713
+ A("p", Lr, Q(re.value.example), 1),
2714
+ re.value.exampleResult ? (D(), k(Ae, { key: 0 }, [
2715
+ A("p", Mr, Q(V(r)("report.formulaInput.section.result")), 1),
2716
+ A("p", Pr, Q(re.value.exampleResult), 1)
2717
+ ], 64)) : U("", !0)
2718
+ ], 64)) : U("", !0)
2719
+ ])) : U("", !0),
2720
+ K.value && O.value ? (D(), _e(de, { key: 1 })) : U("", !0),
2721
+ O.value ? (D(), k("div", Vr, [
2722
+ (D(!0), k(Ae, null, Ct(ce.value, (p) => (D(), k("div", {
2723
+ key: p.value,
2724
+ class: St([
2725
+ "flex items-start gap-2 px-3 py-1 cursor-pointer transition-colors fm-typo-en-body-lg-400",
2726
+ g.value === p.value ? "bg-fm-color-primary-50 ring-1 ring-inset ring-fm-color-primary/20" : "hover:bg-fm-color-primary-50"
2727
+ ]),
2728
+ onMousedown: Rt((xe) => bt(p), ["prevent"]),
2729
+ onMouseenter: (xe) => Ve(p.value),
2730
+ onMouseleave: I[1] || (I[1] = (xe) => Ve(null))
2731
+ }, [
2732
+ A("div", $r, [
2733
+ A("div", Br, [
2734
+ A("span", Wr, Q(p.label), 1),
2735
+ p.type === "FIELD" && p.meta ? (D(), k("span", Yr, Q(p.meta), 1)) : U("", !0),
2736
+ p.type === "FIELD" && p.badge ? (D(), _e(F, {
2737
+ key: 1,
2738
+ compact: !0,
2739
+ class: "shrink-0 bg-fm-color-primary text-fm-color-typo-white"
2740
+ }, {
2741
+ default: pe(() => [
2742
+ A("p", Hr, Q(p.badge), 1)
2743
+ ]),
2744
+ _: 2
2745
+ }, 1024)) : U("", !0),
2746
+ p.type === "FUNCTION" ? (D(), _e(F, {
2747
+ key: 2,
2748
+ compact: !0,
2749
+ class: "shrink-0 bg-fm-color-system-info-100 text-fm-color-typo-info"
2750
+ }, {
2751
+ default: pe(() => I[2] || (I[2] = [
2752
+ A("p", { class: "fm-typo-en-body-sm-400" }, "FUNCTION", -1)
2753
+ ])),
2754
+ _: 1
2755
+ })) : U("", !0),
2756
+ p.type === "KEYWORD" ? (D(), _e(F, {
2757
+ key: 3,
2758
+ compact: !0,
2759
+ class: "shrink-0 text-fm-color-typo-secondary"
2760
+ }, {
2761
+ default: pe(() => I[3] || (I[3] = [
2762
+ A("p", { class: "fm-typo-en-body-sm-400" }, "EXPR", -1)
2763
+ ])),
2764
+ _: 1
2765
+ })) : U("", !0)
2766
+ ]),
2767
+ p.type !== "FIELD" ? (D(), k("p", Xr, Q(p.description), 1)) : U("", !0),
2768
+ G(de)
2769
+ ])
2770
+ ], 42, Ur))), 128))
2771
+ ])) : U("", !0)
2772
+ ], 4)) : U("", !0)
2773
+ ]);
2774
+ };
2775
+ }
2776
+ }), zr = async (t, e, n = []) => {
2777
+ const { businessId: o } = In(bo());
2778
+ if (!t || !t.trim())
2779
+ return { valid: !1, queryDatasource: e, error: { message: "Formula is empty" } };
2780
+ if (!o.value)
2781
+ return { valid: !1, queryDatasource: e, error: { message: "Business ID is not defined" } };
2782
+ const r = {
2783
+ fetchType: yo.Post,
2784
+ url: `/${o.value}/formula/validate`,
2785
+ data: { formula: t, queryDatasource: e, allowedFields: n }
2786
+ };
2787
+ return Eo.fetch(r);
2788
+ };
2789
+ function jr(t) {
2790
+ const { getDataFormula: e, getDisplayFormula: n, getIsAdvance: o } = t, r = t.getAllowedFields || (() => []), a = t.getDatasource || (() => po.Postgres), i = t.immediate ?? !1, c = oe(), u = oe(), s = oe(!1), f = oe(!1);
2791
+ function l() {
2792
+ return r().map((g) => `${g.fieldId}:${g.type}`).sort().join("|");
2793
+ }
2794
+ function E(g) {
2795
+ let L = 0;
2796
+ const H = Sn(
2797
+ async (M, X) => {
2798
+ if (!(!o() || X !== L)) {
2799
+ if (!M) {
2800
+ g.setValidation(void 0);
2801
+ return;
2802
+ }
2803
+ try {
2804
+ const me = await zr(M, a(), r());
2805
+ if (!o() || X !== L)
2806
+ return;
2807
+ g.setValidation(me);
2808
+ } catch {
2809
+ if (!o() || X !== L)
2810
+ return;
2811
+ g.setValidation(void 0);
2812
+ } finally {
2813
+ X === L && g.setIsValidating(!1);
2814
+ }
2815
+ }
2816
+ },
2817
+ 2500
2818
+ );
2819
+ function N(M) {
2820
+ L += 1;
2821
+ const X = L;
2822
+ if (!o()) {
2823
+ H.cancel(), g.setIsValidating(!1), g.setValidation(void 0);
2824
+ return;
2825
+ }
2826
+ if (!M) {
2827
+ H.cancel(), g.setValidation(void 0), g.setIsValidating(!1);
2828
+ return;
2829
+ }
2830
+ g.setIsValidating(!0), H(M, X);
2831
+ }
2832
+ function $() {
2833
+ L += 1, H.cancel(), g.setValidation(void 0), g.setIsValidating(!1);
2834
+ }
2835
+ function B() {
2836
+ N(g.getFormula());
2837
+ }
2838
+ return {
2839
+ trigger: N,
2840
+ clearAndCancel: $,
2841
+ revalidate: B
2842
+ };
2843
+ }
2844
+ const y = E({
2845
+ getFormula: e,
2846
+ setValidation: (g) => {
2847
+ c.value = g;
2848
+ },
2849
+ setIsValidating: (g) => {
2850
+ s.value = g;
2851
+ }
2852
+ }), b = E({
2853
+ getFormula: n,
2854
+ setValidation: (g) => {
2855
+ u.value = g;
2856
+ },
2857
+ setIsValidating: (g) => {
2858
+ f.value = g;
2859
+ }
2860
+ });
2861
+ return qe(
2862
+ () => e(),
2863
+ (g) => {
2864
+ y.trigger(g);
2865
+ },
2866
+ { immediate: i }
2867
+ ), qe(
2868
+ () => n(),
2869
+ (g) => {
2870
+ b.trigger(g);
2871
+ },
2872
+ { immediate: i }
2873
+ ), qe(
2874
+ () => o(),
2875
+ (g) => {
2876
+ g ? (y.revalidate(), b.revalidate()) : (y.clearAndCancel(), b.clearAndCancel());
2877
+ },
2878
+ { immediate: i }
2879
+ ), qe(
2880
+ () => l(),
2881
+ () => {
2882
+ o() && (y.revalidate(), b.revalidate());
2883
+ }
2884
+ ), {
2885
+ dataValidation: c,
2886
+ displayValidation: u,
2887
+ isDataValidating: s,
2888
+ isDisplayValidating: f
2889
+ };
2890
+ }
2891
+ const Kr = { class: "grow" }, qr = {
2892
+ key: 2,
2893
+ class: "w-full"
2894
+ }, Qr = { key: 0 }, Zr = /* @__PURE__ */ Xe({
2895
+ __name: "FilterValueInput",
2896
+ props: /* @__PURE__ */ Mt({
2897
+ config: {
2898
+ type: Object,
2899
+ default: () => {
2900
+ }
2901
+ },
2902
+ option: {
2903
+ type: [String, null],
2904
+ default: () => {
2905
+ }
2906
+ }
2907
+ }, {
2908
+ modelValue: { required: !0, default: () => [] },
2909
+ modelModifiers: {}
2910
+ }),
2911
+ emits: ["update:modelValue"],
2912
+ setup(t) {
2913
+ const e = ot(t, "modelValue"), n = t, o = oe([]);
2914
+ function r(u) {
2915
+ return (u ? $t(u) : $t()).format("HH:mm");
2916
+ }
2917
+ function a({ hour: u, minute: s }) {
2918
+ return $t().set("hour", u).set("minute", s).toISOString();
2919
+ }
2920
+ function i(u, s) {
2921
+ var y, b;
2922
+ const f = On(n.option), l = Cn(n.option);
2923
+ ((y = n.config) == null ? void 0 : y.type) === it.TextField && (f !== void 0 && s < f || l !== void 0 && s > l) && (o.value[u] = `Value must be between ${f} and ${l}`);
2924
+ const E = [...e.value];
2925
+ ((b = n.config) == null ? void 0 : b.type) === it.Timestamp ? E[u] = a({
2926
+ hour: Number(s.split(":")[0]),
2927
+ minute: Number(s.split(":")[1])
2928
+ }) : E[u] = s, e.value = E;
2929
+ }
2930
+ function c(u) {
2931
+ var s;
2932
+ if (u === 0)
2933
+ e.value = [(s = n.config) == null ? void 0 : s.default, ...e.value];
2934
+ else {
2935
+ const f = [...e.value];
2936
+ f.splice(u, 1), e.value = f;
2937
+ }
2938
+ }
2939
+ return (u, s) => {
2940
+ const f = j("FmSelect"), l = j("FmTextField"), E = j("FmTimePicker"), y = j("FmButton");
2941
+ return D(!0), k(Ae, null, Ct(new Array(e.value.length !== 0 ? e.value.length : 1), (b, g) => {
2942
+ var L, H, N, $, B;
2943
+ return D(), k("div", {
2944
+ key: g,
2945
+ class: "flex flex-row align-center gap-2 w-full"
2946
+ }, [
2947
+ A("div", Kr, [
2948
+ ((L = n.config) == null ? void 0 : L.type) === V(it).Select ? (D(), _e(f, {
2949
+ key: 0,
2950
+ "model-value": e.value[g],
2951
+ items: n.config.options,
2952
+ "onUpdate:modelValue": (M) => i(g, M)
2953
+ }, null, 8, ["model-value", "items", "onUpdate:modelValue"])) : ((H = n.config) == null ? void 0 : H.type) === V(it).TextField ? (D(), _e(l, {
2954
+ key: 1,
2955
+ "model-value": e.value[g],
2956
+ type: ((N = n.config) == null ? void 0 : N.dataType) === "number" ? "number" : "text",
2957
+ "helper-text": o.value[g] || void 0,
2958
+ "helper-state": "error",
2959
+ "onUpdate:modelValue": (M) => i(g, M)
2960
+ }, null, 8, ["model-value", "type", "helper-text", "onUpdate:modelValue"])) : (($ = n.config) == null ? void 0 : $.type) === V(it).Timestamp ? (D(), k("div", qr, [
2961
+ G(E, {
2962
+ "model-value": r(e.value[g]),
2963
+ "onUpdate:modelValue": (M) => i(g, M)
2964
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
2965
+ ])) : U("", !0)
2966
+ ]),
2967
+ ((B = n.config) == null ? void 0 : B.fixed) === !1 ? (D(), k("div", Qr, [
2968
+ G(y, {
2969
+ icon: g === 0 ? "add" : "remove",
2970
+ onClick: (M) => c(g)
2971
+ }, null, 8, ["icon", "onClick"])
2972
+ ])) : U("", !0)
2973
+ ]);
2974
+ }), 128);
2975
+ };
2976
+ }
2977
+ }), Qn = [
2978
+ je.HourOfDay,
2979
+ je.DayOfMonth,
2980
+ je.DayOfWeek,
2981
+ je.MonthOfYear,
2982
+ je.TimeOfDay,
2983
+ je.DateTime
2984
+ ], Jr = Qn.filter(
2985
+ (t) => t !== je.DateTime
2986
+ );
2987
+ function wa(t) {
2988
+ return Qn.map((e) => ({
2989
+ label: t(`report.section.filter.${Rn(e)}`),
2990
+ value: e
2991
+ }));
2992
+ }
2993
+ function ea(t) {
2994
+ return Jr.map((e) => ({
2995
+ label: t(`report.section.filter.${Rn(e)}`),
2996
+ value: e
2997
+ }));
2998
+ }
2999
+ const ta = { class: "flex flex-col my-2 gap-8" }, na = { class: "fm-typo-en-body-lg-600" }, oa = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, ra = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, xa = /* @__PURE__ */ Xe({
3000
+ __name: "FilterSection",
3001
+ props: /* @__PURE__ */ Mt({
3002
+ options: {
3003
+ type: Array,
3004
+ default: () => []
3005
+ },
3006
+ label: {
3007
+ type: String,
3008
+ default: "title"
3009
+ }
3010
+ }, {
3011
+ modelValue: { required: !1, default: () => [] },
3012
+ modelModifiers: {}
3013
+ }),
3014
+ emits: ["update:modelValue"],
3015
+ setup(t) {
3016
+ const { t: e, te: n } = Pt(), o = ot(t, "modelValue"), r = t, a = R(() => e(`report.section.filter.${r.label}`)), i = oe(!1), c = _o(), u = R(
3017
+ () => o.value.map((d, v) => {
3018
+ const O = r.options.find(
3019
+ (le) => le.schemaName === d.schemaName && le.name === d.name
3020
+ ), K = (O == null ? void 0 : O.labels) || [d.schemaName, d.name];
3021
+ return {
3022
+ index: v,
3023
+ label: K.map((le) => pn(e, n, le, "other")).join(" "),
3024
+ value: d
3025
+ };
3026
+ })
3027
+ ), s = oe(o.value.length > 0 ? 0 : void 0);
3028
+ function f(d) {
3029
+ var v;
3030
+ i.value = !0, g.value = [], l.value = d != null && d.value ? JSON.parse(JSON.stringify(d.value)) : void 0, s.value = d == null ? void 0 : d.index, E.value = !!((v = l.value) != null && v.dataFormula), B();
3031
+ }
3032
+ const l = oe(void 0), E = oe(!1), y = oe(void 0), b = R(
3033
+ () => r.options.find(
3034
+ (d) => {
3035
+ var v, O;
3036
+ return d.schemaName === ((v = l.value) == null ? void 0 : v.schemaName) && d.name === ((O = l.value) == null ? void 0 : O.name);
3037
+ }
3038
+ ) ?? {}
3039
+ ), g = oe([]);
3040
+ function L(d) {
3041
+ var v;
3042
+ return (v = g.value.find((O) => O.option === d)) == null ? void 0 : v.value;
3043
+ }
3044
+ const H = Sn(
3045
+ (d, v) => {
3046
+ const O = g.value.find((K) => K.option === d);
3047
+ O ? O.value = v : g.value.push({ option: d, value: v });
3048
+ },
3049
+ 300
3050
+ );
3051
+ qe(
3052
+ [() => {
3053
+ var d;
3054
+ return (d = l.value) == null ? void 0 : d.option;
3055
+ }, () => {
3056
+ var d;
3057
+ return (d = l.value) == null ? void 0 : d.values;
3058
+ }],
3059
+ ([d, v]) => {
3060
+ d !== void 0 && Array.isArray(v) && H(d, v);
3061
+ },
3062
+ { deep: !0 }
3063
+ ), qe(
3064
+ () => {
3065
+ var d;
3066
+ return (d = l.value) == null ? void 0 : d.option;
3067
+ },
3068
+ (d, v) => {
3069
+ v !== void 0 && d !== v && l.value && (B(), N(d), $());
3070
+ }
3071
+ ), qe(
3072
+ () => {
3073
+ var d;
3074
+ return (d = l.value) == null ? void 0 : d.operator;
3075
+ },
3076
+ (d, v) => {
3077
+ d !== v && b.value && l.value && (B(), N(l.value.option), $());
3078
+ },
3079
+ {
3080
+ deep: !0
3081
+ }
3082
+ );
3083
+ function N(d) {
3084
+ var Pe;
3085
+ if (!l.value || !y.value) return;
3086
+ const v = s.value !== void 0 && o.value[s.value] && Array.isArray(o.value[s.value].values) ? [...o.value[s.value].values] : [], O = L(d);
3087
+ let K;
3088
+ const le = s.value !== void 0 ? (Pe = o.value[s.value]) == null ? void 0 : Pe.option : void 0;
3089
+ Array.isArray(O) ? K = O : v.length > 0 && d === le ? K = v : K = [y.value.default], l.value = {
3090
+ ...l.value,
3091
+ values: K
3092
+ };
3093
+ }
3094
+ function $() {
3095
+ if (!y.value || !l.value) return;
3096
+ const d = l.value.values.length - y.value.count;
3097
+ d > 0 && y.value.fixed ? l.value = {
3098
+ ...l.value,
3099
+ values: l.value.values.slice(0, y.value.count)
3100
+ } : d < 0 && (l.value = {
3101
+ ...l.value,
3102
+ values: [...l.value.values, ...Array(Math.abs(d)).fill(y.value.default)]
3103
+ });
3104
+ }
3105
+ function B() {
3106
+ b.value && l.value && (y.value = mo({
3107
+ operator: l.value.operator,
3108
+ dataType: b.value.type,
3109
+ dimensionOption: l.value.option,
3110
+ t: e
3111
+ }));
3112
+ }
3113
+ function M(d) {
3114
+ var v, O;
3115
+ (d.schemaName !== ((v = l.value) == null ? void 0 : v.schemaName) || d.name !== ((O = l.value) == null ? void 0 : O.name)) && (l.value = {
3116
+ schemaName: d.schemaName,
3117
+ name: d.name,
3118
+ operator: d.filterOperators[0],
3119
+ option: d.filterDimensionOptions[0],
3120
+ values: []
3121
+ }, B(), N(l.value.option), $());
3122
+ }
3123
+ function X() {
3124
+ var v, O, K;
3125
+ const d = [...u.value.map((le) => le.value)];
3126
+ if (l.value) {
3127
+ E.value || (l.value.dataFormula = void 0);
3128
+ const le = On((v = l.value) == null ? void 0 : v.option), Pe = Cn((O = l.value) == null ? void 0 : O.option), rt = (K = l.value.values) == null ? void 0 : K.map(
3129
+ (ge, Ne) => ge == null || ge === "" || !re(ge, le, Pe) ? Ne : null
3130
+ ).filter((ge) => ge !== null);
3131
+ if (!l.value.values || rt.length > 0) {
3132
+ c.open({ message: "One or more values are invalid", type: "error" });
3133
+ return;
3134
+ }
3135
+ l.value.values = l.value.values.filter(
3136
+ (ge) => ge !== "" && ge !== null
3137
+ ), s.value !== void 0 ? d[Number(s.value)] = l.value : d.push(l.value), o.value = d;
3138
+ }
3139
+ i.value = !1;
3140
+ }
3141
+ function me(d) {
3142
+ const v = [...u.value.map((O) => O.value)];
3143
+ v.splice(d, 1), o.value = v, i.value = !1;
3144
+ }
3145
+ const Se = R(
3146
+ () => r.options.map((d) => ({
3147
+ label: d.labels.join(" "),
3148
+ value: d
3149
+ }))
3150
+ );
3151
+ function te(d) {
3152
+ return `${d.schemaName}_${d.name}`.toLowerCase();
3153
+ }
3154
+ function Te(d) {
3155
+ return [d.schemaName, d.name, pn(e, n, d.label, "other")].join(" ");
3156
+ }
3157
+ const he = R(
3158
+ () => {
3159
+ var d;
3160
+ return !l.value || !((d = b.value) != null && d.name) ? [] : [
3161
+ {
3162
+ label: `@self (${Te(b.value)})`,
3163
+ value: "@self"
3164
+ }
3165
+ ];
3166
+ }
3167
+ ), Re = R(
3168
+ () => {
3169
+ var d, v;
3170
+ return !((d = b.value) != null && d.name) || !((v = b.value) != null && v.type) ? [] : [
3171
+ {
3172
+ fieldId: te(b.value),
3173
+ type: b.value.type
3174
+ }
3175
+ ];
3176
+ }
3177
+ );
3178
+ function Z(d) {
3179
+ var O;
3180
+ const v = (O = b.value) != null && O.name ? te(b.value) : void 0;
3181
+ return v ? d == null ? void 0 : d.replace(/@self/g, v) : d;
3182
+ }
3183
+ const { dataValidation: we, isDataValidating: Fe } = jr({
3184
+ getDataFormula: () => {
3185
+ var d;
3186
+ return Z((d = l.value) == null ? void 0 : d.dataFormula);
3187
+ },
3188
+ getDisplayFormula: () => {
3189
+ },
3190
+ getIsAdvance: () => E.value,
3191
+ getAllowedFields: () => Re.value
3192
+ }), ce = R(() => ea(e));
3193
+ function re(d, v, O) {
3194
+ return !(v !== void 0 && d < v || O !== void 0 && d > O);
3195
+ }
3196
+ return (d, v) => {
3197
+ const O = j("FmCheckbox"), K = j("FmSelect"), le = j("FmForm"), Pe = j("FmIcon"), rt = j("FmButton"), ge = j("FmListItem"), Ne = j("FmList"), bt = j("FmField");
3198
+ return D(), k("div", ta, [
3199
+ G(ho, {
3200
+ modelValue: i.value,
3201
+ "onUpdate:modelValue": v[6] || (v[6] = (Ve) => i.value = Ve),
3202
+ title: a.value,
3203
+ "primary-button-label": V(e)("report.common.confirm"),
3204
+ "secondary-button-label": V(e)("report.common.cancel"),
3205
+ onConfirm: X
3206
+ }, {
3207
+ content: pe(() => [
3208
+ G(le, {
3209
+ ref: "form",
3210
+ class: "flex flex-col gap-2 w-[490px]"
3211
+ }, {
3212
+ default: pe(() => {
3213
+ var Ve, Ue;
3214
+ return [
3215
+ G(fn, {
3216
+ "model-value": b.value,
3217
+ items: Se.value,
3218
+ placeholder: a.value,
3219
+ label: a.value,
3220
+ "onUpdate:modelValue": v[0] || (v[0] = (ne) => M(ne))
3221
+ }, null, 8, ["model-value", "items", "placeholder", "label"]),
3222
+ l.value ? (D(), k(Ae, { key: 0 }, [
3223
+ G(O, {
3224
+ modelValue: E.value,
3225
+ "onUpdate:modelValue": v[1] || (v[1] = (ne) => E.value = ne),
3226
+ label: V(e)("report.section.filter.advance"),
3227
+ value: !0
3228
+ }, null, 8, ["modelValue", "label"]),
3229
+ E.value ? (D(), _e(Gr, {
3230
+ key: 0,
3231
+ modelValue: l.value.dataFormula,
3232
+ "onUpdate:modelValue": v[2] || (v[2] = (ne) => l.value.dataFormula = ne),
3233
+ placeholder: V(e)("report.section.filter.dataFormula"),
3234
+ "field-data-list": he.value,
3235
+ "formula-field": b.value.type === "NUMERIC" ? V(J).Metric : V(J).Dimension,
3236
+ "validation-result": V(we),
3237
+ "is-validating": V(Fe),
3238
+ "valid-formula-label": V(e)("report.common.validFormula")
3239
+ }, null, 8, ["modelValue", "placeholder", "field-data-list", "formula-field", "validation-result", "is-validating", "valid-formula-label"])) : U("", !0),
3240
+ G(K, {
3241
+ modelValue: l.value.option,
3242
+ "onUpdate:modelValue": v[3] || (v[3] = (ne) => l.value.option = ne),
3243
+ items: ce.value,
3244
+ placeholder: V(e)("report.section.filter.timeFormatter"),
3245
+ label: V(e)("report.section.filter.timeFormatter")
3246
+ }, null, 8, ["modelValue", "items", "placeholder", "label"]),
3247
+ (((Ve = b.value) == null ? void 0 : Ve.filterOperators) || []).length > 0 ? (D(), _e(fn, {
3248
+ key: 1,
3249
+ modelValue: l.value.operator,
3250
+ "onUpdate:modelValue": v[4] || (v[4] = (ne) => l.value.operator = ne),
3251
+ items: (((Ue = b.value) == null ? void 0 : Ue.filterOperators) ?? []).map((ne) => ({
3252
+ label: V(e)("report.section.comparisonOperator." + ne),
3253
+ value: ne
3254
+ }))
3255
+ }, null, 8, ["modelValue", "items"])) : U("", !0),
3256
+ y.value ? (D(), _e(Zr, {
3257
+ key: l.value.option ?? "",
3258
+ modelValue: l.value.values,
3259
+ "onUpdate:modelValue": v[5] || (v[5] = (ne) => l.value.values = ne),
3260
+ config: y.value,
3261
+ option: l.value.option
3262
+ }, null, 8, ["modelValue", "config", "option"])) : U("", !0)
3263
+ ], 64)) : U("", !0)
3264
+ ];
3265
+ }),
3266
+ _: 1
3267
+ }, 512)
3268
+ ]),
3269
+ _: 1
3270
+ }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
3271
+ A("div", null, [
3272
+ A("p", na, Q(a.value), 1),
3273
+ A("p", oa, Q(V(e)("report.section.filter.description")), 1)
3274
+ ]),
3275
+ G(Ne, null, {
3276
+ default: pe(() => [
3277
+ G(V(br), {
3278
+ list: o.value,
3279
+ "item-key": "id",
3280
+ class: "flex flex-col gap-2 w-full"
3281
+ }, {
3282
+ item: pe(({ element: Ve, index: Ue }) => [
3283
+ G(ge, {
3284
+ class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
3285
+ onClick: Rt((ne) => f(u.value[Ue]), ["stop"])
3286
+ }, {
3287
+ default: pe(() => [
3288
+ G(Pe, { name: "drag_handle" }),
3289
+ A("p", ra, Q(u.value[Ue].label), 1),
3290
+ v[8] || (v[8] = A("div", { class: "grow" }, null, -1)),
3291
+ G(rt, {
3292
+ icon: "close",
3293
+ size: "md",
3294
+ variant: "tertiary",
3295
+ onClick: Rt((ne) => me(Ue), ["stop"])
3296
+ }, null, 8, ["onClick"])
3297
+ ]),
3298
+ _: 2
3299
+ }, 1032, ["onClick"])
3300
+ ]),
3301
+ _: 1
3302
+ }, 8, ["list"])
3303
+ ]),
3304
+ _: 1
3305
+ }),
3306
+ G(bt, {
3307
+ class: "text-fm-color-typo-tertiary",
3308
+ onClick: v[7] || (v[7] = () => {
3309
+ f();
3310
+ })
3311
+ }, {
3312
+ default: pe(() => [
3313
+ so(Q(V(e)("report.section.filter.add")), 1)
3314
+ ]),
3315
+ _: 1
3316
+ })
3317
+ ]);
3318
+ };
3319
+ }
3320
+ }), aa = /* @__PURE__ */ Xe({
3321
+ __name: "TransitionFade",
3322
+ props: {
3323
+ modelValue: { type: Boolean, required: !0, default: !0 },
3324
+ modelModifiers: {}
3325
+ },
3326
+ emits: ["update:modelValue"],
3327
+ setup(t) {
3328
+ const e = ot(t, "modelValue");
3329
+ return (n, o) => (D(), k(Ae, null, [
3330
+ G(Jt, { name: "slide-fade-right" }, {
3331
+ default: pe(() => [
3332
+ e.value ? ht(n.$slots, "right", { key: 0 }, void 0, !0) : U("", !0)
3333
+ ]),
3334
+ _: 3
3335
+ }),
3336
+ G(Jt, { name: "slide-fade-left" }, {
3337
+ default: pe(() => [
3338
+ e.value ? U("", !0) : ht(n.$slots, "left", { key: 0 }, void 0, !0)
3339
+ ]),
3340
+ _: 3
3341
+ })
3342
+ ], 64));
3343
+ }
3344
+ }), Da = /* @__PURE__ */ ln(aa, [["__scopeId", "data-v-a98ca9bc"]]);
3345
+ export {
3346
+ J as F,
3347
+ Ta as S,
3348
+ Da as T,
3349
+ ya as W,
3350
+ Zr as _,
3351
+ xa as a,
3352
+ ba as b,
3353
+ Gr as c,
3354
+ br as d,
3355
+ _r as e,
3356
+ wa as g,
3357
+ _a as h,
3358
+ Ea as i,
3359
+ jr as u
3360
+ };