import { defineComponent as Te, onBeforeMount as In, onBeforeUnmount as Fn, resolveComponent as N, createElementBlock as ee, openBlock as V, normalizeStyle as kn, unref as X, renderSlot as ze, createVNode as A, createElementVNode as ue, toDisplayString as Ae, TransitionGroup as An, nextTick as nn, h as Rt, mergeModels as Nt, useModel as Ge, computed as Fe, Fragment as qe, renderList as on, createBlock as Pe, normalizeClass as Xt, withCtx as ie, Transition as xt, createCommentVNode as ce, ref as Se, watch as pt, withModifiers as Yt, createTextVNode as Nn } from "vue";
import { u as Pt, a as Pn } from "./vue-i18n-DVWuTfed.js";
import { useCoreStore as Vn } from "@feedmepos/mf-common";
import { storeToRefs as Mn } from "pinia";
import { useRoute as Ln } from "vue-router";
import { W as F, b as De, c as Bn } from "./BaseDialog.vue_vue_type_script_setup_true_lang-B2CdeeFj.js";
import { p as $n, d as ht, j as rn } from "./app-C2vt2B-i.js";
import { _ as Vt, a as Wt } from "./SelectComponent.vue_vue_type_script_setup_true_lang-Df40itH5.js";
import { R as Rn, I as Be, h as an, i as ln, g as Xn } from "./FilterSelector.vue_vue_type_script_setup_true_lang-jDZZAdUQ.js";
import { r as Yn } from "./i18n-CI_sQ5d_.js";
import { useSnackbar as Wn } from "@feedmepos/ui-library";
import { d as Un } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-DlpbyWWd.js";
const jn = {
  key: 0,
  class: "flex gap-24 flex-col h-screen w-screen justify-center items-center"
}, Hn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vr = /* @__PURE__ */ Te({
  __name: "FullScreen",
  setup(t) {
    const { t: e } = Pt(), n = Ln(), { isLoading: o } = Mn(Pn()), r = Vn();
    return In(() => {
      r.hideSidebarToggle(!0);
    }), Fn(() => {
      r.hideSidebarToggle(!1);
    }), (i, a) => {
      const c = N("FmCircularProgress");
      return V(), ee("div", {
        class: "mx-auto",
        style: kn({
          height: `calc(100vh - ${X(n).query.token && X(n).query.businessId ? "0" : "64"}px)`
        })
      }, [
        X(o) ? (V(), ee("div", jn, [
          A(c, { size: "xl" }),
          ue("span", Hn, Ae(X(e)("report.common.isLoading")), 1)
        ])) : ze(i.$slots, "default", { key: 1 })
      ], 4);
    };
  }
});
/**!
 * Sortable 1.14.0
 * @author	RubaXa   <trash@rubaxa.org>
 * @author	owenm    <owen23355@gmail.com>
 * @license MIT
 */
function Ut(t, e) {
  var n = Object.keys(t);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(t);
    e && (o = o.filter(function(r) {
      return Object.getOwnPropertyDescriptor(t, r).enumerable;
    })), n.push.apply(n, o);
  }
  return n;
}
function le(t) {
  for (var e = 1; e < arguments.length; e++) {
    var n = arguments[e] != null ? arguments[e] : {};
    e % 2 ? Ut(Object(n), !0).forEach(function(o) {
      zn(t, o, n[o]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Ut(Object(n)).forEach(function(o) {
      Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
    });
  }
  return t;
}
function ot(t) {
  "@babel/helpers - typeof";
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? ot = function(e) {
    return typeof e;
  } : ot = function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  }, ot(t);
}
function zn(t, e, n) {
  return e in t ? Object.defineProperty(t, e, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : t[e] = n, t;
}
function fe() {
  return fe = Object.assign || function(t) {
    for (var e = 1; e < arguments.length; e++) {
      var n = arguments[e];
      for (var o in n)
        Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
    }
    return t;
  }, fe.apply(this, arguments);
}
function Gn(t, e) {
  if (t == null) return {};
  var n = {}, o = Object.keys(t), r, i;
  for (i = 0; i < o.length; i++)
    r = o[i], !(e.indexOf(r) >= 0) && (n[r] = t[r]);
  return n;
}
function qn(t, e) {
  if (t == null) return {};
  var n = Gn(t, e), o, r;
  if (Object.getOwnPropertySymbols) {
    var i = Object.getOwnPropertySymbols(t);
    for (r = 0; r < i.length; r++)
      o = i[r], !(e.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(t, o) && (n[o] = t[o]);
  }
  return n;
}
var Kn = "1.14.0";
function de(t) {
  if (typeof window < "u" && window.navigator)
    return !!/* @__PURE__ */ navigator.userAgent.match(t);
}
var me = de(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Ke = de(/Edge/i), jt = de(/firefox/i), Ye = de(/safari/i) && !de(/chrome/i) && !de(/android/i), sn = de(/iP(ad|od|hone)/i), Jn = de(/chrome/i) && de(/android/i), un = {
  capture: !1,
  passive: !1
};
function D(t, e, n) {
  t.addEventListener(e, n, !me && un);
}
function S(t, e, n) {
  t.removeEventListener(e, n, !me && un);
}
function st(t, e) {
  if (e) {
    if (e[0] === ">" && (e = e.substring(1)), t)
      try {
        if (t.matches)
          return t.matches(e);
        if (t.msMatchesSelector)
          return t.msMatchesSelector(e);
        if (t.webkitMatchesSelector)
          return t.webkitMatchesSelector(e);
      } catch {
        return !1;
      }
    return !1;
  }
}
function Zn(t) {
  return t.host && t !== document && t.host.nodeType ? t.host : t.parentNode;
}
function re(t, e, n, o) {
  if (t) {
    n = n || document;
    do {
      if (e != null && (e[0] === ">" ? t.parentNode === n && st(t, e) : st(t, e)) || o && t === n)
        return t;
      if (t === n) break;
    } while (t = Zn(t));
  }
  return null;
}
var Ht = /\s+/g;
function J(t, e, n) {
  if (t && e)
    if (t.classList)
      t.classList[n ? "add" : "remove"](e);
    else {
      var o = (" " + t.className + " ").replace(Ht, " ").replace(" " + e + " ", " ");
      t.className = (o + (n ? " " + e : "")).replace(Ht, " ");
    }
}
function h(t, e, n) {
  var o = t && t.style;
  if (o) {
    if (n === void 0)
      return document.defaultView && document.defaultView.getComputedStyle ? n = document.defaultView.getComputedStyle(t, "") : t.currentStyle && (n = t.currentStyle), e === void 0 ? n : n[e];
    !(e in o) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), o[e] = n + (typeof n == "string" ? "" : "px");
  }
}
function Ve(t, e) {
  var n = "";
  if (typeof t == "string")
    n = t;
  else
    do {
      var o = h(t, "transform");
      o && o !== "none" && (n = o + " " + n);
    } while (!e && (t = t.parentNode));
  var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
  return r && new r(n);
}
function cn(t, e, n) {
  if (t) {
    var o = t.getElementsByTagName(e), r = 0, i = o.length;
    if (n)
      for (; r < i; r++)
        n(o[r], r);
    return o;
  }
  return [];
}
function ae() {
  var t = document.scrollingElement;
  return t || document.documentElement;
}
function P(t, e, n, o, r) {
  if (!(!t.getBoundingClientRect && t !== window)) {
    var i, a, c, l, u, f, s;
    if (t !== window && t.parentNode && t !== ae() ? (i = t.getBoundingClientRect(), a = i.top, c = i.left, l = i.bottom, u = i.right, f = i.height, s = i.width) : (a = 0, c = 0, l = window.innerHeight, u = window.innerWidth, f = window.innerHeight, s = window.innerWidth), (e || n) && t !== window && (r = r || t.parentNode, !me))
      do
        if (r && r.getBoundingClientRect && (h(r, "transform") !== "none" || n && h(r, "position") !== "static")) {
          var v = r.getBoundingClientRect();
          a -= v.top + parseInt(h(r, "border-top-width")), c -= v.left + parseInt(h(r, "border-left-width")), l = a + i.height, u = c + i.width;
          break;
        }
      while (r = r.parentNode);
    if (o && t !== window) {
      var y = Ve(r || t), _ = y && y.a, b = y && y.d;
      y && (a /= b, c /= _, s /= _, f /= b, l = a + f, u = c + s);
    }
    return {
      top: a,
      left: c,
      bottom: l,
      right: u,
      width: s,
      height: f
    };
  }
}
function zt(t, e, n) {
  for (var o = ve(t, !0), r = P(t)[e]; o; ) {
    var i = P(o)[n], a = void 0;
    if (a = r >= i, !a) return o;
    if (o === ae()) break;
    o = ve(o, !1);
  }
  return !1;
}
function Me(t, e, n, o) {
  for (var r = 0, i = 0, a = t.children; i < a.length; ) {
    if (a[i].style.display !== "none" && a[i] !== g.ghost && (o || a[i] !== g.dragged) && re(a[i], n.draggable, t, !1)) {
      if (r === e)
        return a[i];
      r++;
    }
    i++;
  }
  return null;
}
function Mt(t, e) {
  for (var n = t.lastElementChild; n && (n === g.ghost || h(n, "display") === "none" || e && !st(n, e)); )
    n = n.previousElementSibling;
  return n || null;
}
function ne(t, e) {
  var n = 0;
  if (!t || !t.parentNode)
    return -1;
  for (; t = t.previousElementSibling; )
    t.nodeName.toUpperCase() !== "TEMPLATE" && t !== g.clone && (!e || st(t, e)) && n++;
  return n;
}
function Gt(t) {
  var e = 0, n = 0, o = ae();
  if (t)
    do {
      var r = Ve(t), i = r.a, a = r.d;
      e += t.scrollLeft * i, n += t.scrollTop * a;
    } while (t !== o && (t = t.parentNode));
  return [e, n];
}
function Qn(t, e) {
  for (var n in t)
    if (t.hasOwnProperty(n)) {
      for (var o in e)
        if (e.hasOwnProperty(o) && e[o] === t[n][o]) return Number(n);
    }
  return -1;
}
function ve(t, e) {
  if (!t || !t.getBoundingClientRect) return ae();
  var n = t, o = !1;
  do
    if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
      var r = h(n);
      if (n.clientWidth < n.scrollWidth && (r.overflowX == "auto" || r.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (r.overflowY == "auto" || r.overflowY == "scroll")) {
        if (!n.getBoundingClientRect || n === document.body) return ae();
        if (o || e) return n;
        o = !0;
      }
    }
  while (n = n.parentNode);
  return ae();
}
function eo(t, e) {
  if (t && e)
    for (var n in e)
      e.hasOwnProperty(n) && (t[n] = e[n]);
  return t;
}
function gt(t, e) {
  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);
}
var We;
function dn(t, e) {
  return function() {
    if (!We) {
      var n = arguments, o = this;
      n.length === 1 ? t.call(o, n[0]) : t.apply(o, n), We = setTimeout(function() {
        We = void 0;
      }, e);
    }
  };
}
function to() {
  clearTimeout(We), We = void 0;
}
function fn(t, e, n) {
  t.scrollLeft += e, t.scrollTop += n;
}
function mn(t) {
  var e = window.Polymer, n = window.jQuery || window.Zepto;
  return e && e.dom ? e.dom(t).cloneNode(!0) : n ? n(t).clone(!0)[0] : t.cloneNode(!0);
}
var Q = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
function no() {
  var t = [], e;
  return {
    captureAnimationState: function() {
      if (t = [], !!this.options.animation) {
        var o = [].slice.call(this.el.children);
        o.forEach(function(r) {
          if (!(h(r, "display") === "none" || r === g.ghost)) {
            t.push({
              target: r,
              rect: P(r)
            });
            var i = le({}, t[t.length - 1].rect);
            if (r.thisAnimationDuration) {
              var a = Ve(r, !0);
              a && (i.top -= a.f, i.left -= a.e);
            }
            r.fromRect = i;
          }
        });
      }
    },
    addAnimationState: function(o) {
      t.push(o);
    },
    removeAnimationState: function(o) {
      t.splice(Qn(t, {
        target: o
      }), 1);
    },
    animateAll: function(o) {
      var r = this;
      if (!this.options.animation) {
        clearTimeout(e), typeof o == "function" && o();
        return;
      }
      var i = !1, a = 0;
      t.forEach(function(c) {
        var l = 0, u = c.target, f = u.fromRect, s = P(u), v = u.prevFromRect, y = u.prevToRect, _ = c.rect, b = Ve(u, !0);
        b && (s.top -= b.f, s.left -= b.e), u.toRect = s, u.thisAnimationDuration && gt(v, s) && !gt(f, s) && // Make sure animatingRect is on line between toRect & fromRect
        (_.top - s.top) / (_.left - s.left) === (f.top - s.top) / (f.left - s.left) && (l = ro(_, v, y, r.options)), gt(s, f) || (u.prevFromRect = f, u.prevToRect = s, l || (l = r.options.animation), r.animate(u, _, s, l)), l && (i = !0, a = Math.max(a, l), clearTimeout(u.animationResetTimer), u.animationResetTimer = setTimeout(function() {
          u.animationTime = 0, u.prevFromRect = null, u.fromRect = null, u.prevToRect = null, u.thisAnimationDuration = null;
        }, l), u.thisAnimationDuration = l);
      }), clearTimeout(e), i ? e = setTimeout(function() {
        typeof o == "function" && o();
      }, a) : typeof o == "function" && o(), t = [];
    },
    animate: function(o, r, i, a) {
      if (a) {
        h(o, "transition", ""), h(o, "transform", "");
        var c = Ve(this.el), l = c && c.a, u = c && c.d, f = (r.left - i.left) / (l || 1), s = (r.top - i.top) / (u || 1);
        o.animatingX = !!f, o.animatingY = !!s, h(o, "transform", "translate3d(" + f + "px," + s + "px,0)"), this.forRepaintDummy = oo(o), h(o, "transition", "transform " + a + "ms" + (this.options.easing ? " " + this.options.easing : "")), h(o, "transform", "translate3d(0,0,0)"), typeof o.animated == "number" && clearTimeout(o.animated), o.animated = setTimeout(function() {
          h(o, "transition", ""), h(o, "transform", ""), o.animated = !1, o.animatingX = !1, o.animatingY = !1;
        }, a);
      }
    }
  };
}
function oo(t) {
  return t.offsetWidth;
}
function ro(t, e, n, o) {
  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;
}
var Oe = [], vt = {
  initializeByDefault: !0
}, Je = {
  mount: function(e) {
    for (var n in vt)
      vt.hasOwnProperty(n) && !(n in e) && (e[n] = vt[n]);
    Oe.forEach(function(o) {
      if (o.pluginName === e.pluginName)
        throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
    }), Oe.push(e);
  },
  pluginEvent: function(e, n, o) {
    var r = this;
    this.eventCanceled = !1, o.cancel = function() {
      r.eventCanceled = !0;
    };
    var i = e + "Global";
    Oe.forEach(function(a) {
      n[a.pluginName] && (n[a.pluginName][i] && n[a.pluginName][i](le({
        sortable: n
      }, o)), n.options[a.pluginName] && n[a.pluginName][e] && n[a.pluginName][e](le({
        sortable: n
      }, o)));
    });
  },
  initializePlugins: function(e, n, o, r) {
    Oe.forEach(function(c) {
      var l = c.pluginName;
      if (!(!e.options[l] && !c.initializeByDefault)) {
        var u = new c(e, n, e.options);
        u.sortable = e, u.options = e.options, e[l] = u, fe(o, u.defaults);
      }
    });
    for (var i in e.options)
      if (e.options.hasOwnProperty(i)) {
        var a = this.modifyOption(e, i, e.options[i]);
        typeof a < "u" && (e.options[i] = a);
      }
  },
  getEventProperties: function(e, n) {
    var o = {};
    return Oe.forEach(function(r) {
      typeof r.eventProperties == "function" && fe(o, r.eventProperties.call(n[r.pluginName], e));
    }), o;
  },
  modifyOption: function(e, n, o) {
    var r;
    return Oe.forEach(function(i) {
      e[i.pluginName] && i.optionListeners && typeof i.optionListeners[n] == "function" && (r = i.optionListeners[n].call(e[i.pluginName], o));
    }), r;
  }
};
function io(t) {
  var e = t.sortable, n = t.rootEl, o = t.name, r = t.targetEl, i = t.cloneEl, a = t.toEl, c = t.fromEl, l = t.oldIndex, u = t.newIndex, f = t.oldDraggableIndex, s = t.newDraggableIndex, v = t.originalEvent, y = t.putSortable, _ = t.extraEventProperties;
  if (e = e || n && n[Q], !!e) {
    var b, Y = e.options, q = "on" + o.charAt(0).toUpperCase() + o.substr(1);
    window.CustomEvent && !me && !Ke ? b = new CustomEvent(o, {
      bubbles: !0,
      cancelable: !0
    }) : (b = document.createEvent("Event"), b.initEvent(o, !0, !0)), b.to = a || n, b.from = c || n, b.item = r || n, b.clone = i, b.oldIndex = l, b.newIndex = u, b.oldDraggableIndex = f, b.newDraggableIndex = s, b.originalEvent = v, b.pullMode = y ? y.lastPutMode : void 0;
    var T = le(le({}, _), Je.getEventProperties(o, e));
    for (var M in T)
      b[M] = T[M];
    n && n.dispatchEvent(b), Y[q] && Y[q].call(e, b);
  }
}
var ao = ["evt"], K = function(e, n) {
  var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = o.evt, i = qn(o, ao);
  Je.pluginEvent.bind(g)(e, n, le({
    dragEl: d,
    parentEl: x,
    ghostEl: w,
    rootEl: C,
    nextEl: Ce,
    lastDownEl: rt,
    cloneEl: O,
    cloneHidden: ge,
    dragStarted: $e,
    putSortable: R,
    activeSortable: g.active,
    originalEvent: r,
    oldIndex: Ne,
    oldDraggableIndex: Ue,
    newIndex: Z,
    newDraggableIndex: he,
    hideGhostForTarget: vn,
    unhideGhostForTarget: bn,
    cloneNowHidden: function() {
      ge = !0;
    },
    cloneNowShown: function() {
      ge = !1;
    },
    dispatchSortableEvent: function(c) {
      G({
        sortable: n,
        name: c,
        originalEvent: r
      });
    }
  }, i));
};
function G(t) {
  io(le({
    putSortable: R,
    cloneEl: O,
    targetEl: d,
    rootEl: C,
    oldIndex: Ne,
    oldDraggableIndex: Ue,
    newIndex: Z,
    newDraggableIndex: he
  }, t));
}
var d, x, w, C, Ce, rt, O, ge, Ne, Z, Ue, he, Qe, R, ke = !1, ut = !1, ct = [], we, oe, bt, yt, qt, Kt, $e, Ie, je, He = !1, et = !1, it, j, _t = [], Ot = !1, dt = [], mt = typeof document < "u", tt = sn, Jt = Ke || me ? "cssFloat" : "float", lo = mt && !Jn && !sn && "draggable" in document.createElement("div"), pn = function() {
  if (mt) {
    if (me)
      return !1;
    var t = document.createElement("x");
    return t.style.cssText = "pointer-events:auto", t.style.pointerEvents === "auto";
  }
}(), hn = function(e, n) {
  var o = h(e), r = parseInt(o.width) - parseInt(o.paddingLeft) - parseInt(o.paddingRight) - parseInt(o.borderLeftWidth) - parseInt(o.borderRightWidth), i = Me(e, 0, n), a = Me(e, 1, n), c = i && h(i), l = a && h(a), u = c && parseInt(c.marginLeft) + parseInt(c.marginRight) + P(i).width, f = l && parseInt(l.marginLeft) + parseInt(l.marginRight) + P(a).width;
  if (o.display === "flex")
    return o.flexDirection === "column" || o.flexDirection === "column-reverse" ? "vertical" : "horizontal";
  if (o.display === "grid")
    return o.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
  if (i && c.float && c.float !== "none") {
    var s = c.float === "left" ? "left" : "right";
    return a && (l.clear === "both" || l.clear === s) ? "vertical" : "horizontal";
  }
  return i && (c.display === "block" || c.display === "flex" || c.display === "table" || c.display === "grid" || u >= r && o[Jt] === "none" || a && o[Jt] === "none" && u + f > r) ? "vertical" : "horizontal";
}, so = function(e, n, o) {
  var r = o ? e.left : e.top, i = o ? e.right : e.bottom, a = o ? e.width : e.height, c = o ? n.left : n.top, l = o ? n.right : n.bottom, u = o ? n.width : n.height;
  return r === c || i === l || r + a / 2 === c + u / 2;
}, uo = function(e, n) {
  var o;
  return ct.some(function(r) {
    var i = r[Q].options.emptyInsertThreshold;
    if (!(!i || Mt(r))) {
      var a = P(r), c = e >= a.left - i && e <= a.right + i, l = n >= a.top - i && n <= a.bottom + i;
      if (c && l)
        return o = r;
    }
  }), o;
}, gn = function(e) {
  function n(i, a) {
    return function(c, l, u, f) {
      var s = c.options.group.name && l.options.group.name && c.options.group.name === l.options.group.name;
      if (i == null && (a || s))
        return !0;
      if (i == null || i === !1)
        return !1;
      if (a && i === "clone")
        return i;
      if (typeof i == "function")
        return n(i(c, l, u, f), a)(c, l, u, f);
      var v = (a ? c : l).options.group.name;
      return i === !0 || typeof i == "string" && i === v || i.join && i.indexOf(v) > -1;
    };
  }
  var o = {}, r = e.group;
  (!r || ot(r) != "object") && (r = {
    name: r
  }), o.name = r.name, o.checkPull = n(r.pull, !0), o.checkPut = n(r.put), o.revertClone = r.revertClone, e.group = o;
}, vn = function() {
  !pn && w && h(w, "display", "none");
}, bn = function() {
  !pn && w && h(w, "display", "");
};
mt && document.addEventListener("click", function(t) {
  if (ut)
    return t.preventDefault(), t.stopPropagation && t.stopPropagation(), t.stopImmediatePropagation && t.stopImmediatePropagation(), ut = !1, !1;
}, !0);
var Ee = function(e) {
  if (d) {
    e = e.touches ? e.touches[0] : e;
    var n = uo(e.clientX, e.clientY);
    if (n) {
      var o = {};
      for (var r in e)
        e.hasOwnProperty(r) && (o[r] = e[r]);
      o.target = o.rootEl = n, o.preventDefault = void 0, o.stopPropagation = void 0, n[Q]._onDragOver(o);
    }
  }
}, co = function(e) {
  d && d.parentNode[Q]._isOutsideThisEl(e.target);
};
function g(t, e) {
  if (!(t && t.nodeType && t.nodeType === 1))
    throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));
  this.el = t, this.options = e = fe({}, e), t[Q] = this;
  var n = {
    group: null,
    sort: !0,
    disabled: !1,
    store: null,
    handle: null,
    draggable: /^[uo]l$/i.test(t.nodeName) ? ">li" : ">*",
    swapThreshold: 1,
    // percentage; 0 <= x <= 1
    invertSwap: !1,
    // invert always
    invertedSwapThreshold: null,
    // will be set to same as swapThreshold if default
    removeCloneOnHide: !0,
    direction: function() {
      return hn(t, this.options);
    },
    ghostClass: "sortable-ghost",
    chosenClass: "sortable-chosen",
    dragClass: "sortable-drag",
    ignore: "a, img",
    filter: null,
    preventOnFilter: !0,
    animation: 0,
    easing: null,
    setData: function(a, c) {
      a.setData("Text", c.textContent);
    },
    dropBubble: !1,
    dragoverBubble: !1,
    dataIdAttr: "data-id",
    delay: 0,
    delayOnTouchOnly: !1,
    touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
    forceFallback: !1,
    fallbackClass: "sortable-fallback",
    fallbackOnBody: !1,
    fallbackTolerance: 0,
    fallbackOffset: {
      x: 0,
      y: 0
    },
    supportPointer: g.supportPointer !== !1 && "PointerEvent" in window && !Ye,
    emptyInsertThreshold: 5
  };
  Je.initializePlugins(this, t, n);
  for (var o in n)
    !(o in e) && (e[o] = n[o]);
  gn(e);
  for (var r in this)
    r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this));
  this.nativeDraggable = e.forceFallback ? !1 : lo, this.nativeDraggable && (this.options.touchStartThreshold = 1), e.supportPointer ? D(t, "pointerdown", this._onTapStart) : (D(t, "mousedown", this._onTapStart), D(t, "touchstart", this._onTapStart)), this.nativeDraggable && (D(t, "dragover", this), D(t, "dragenter", this)), ct.push(this.el), e.store && e.store.get && this.sort(e.store.get(this) || []), fe(this, no());
}
g.prototype = /** @lends Sortable.prototype */
{
  constructor: g,
  _isOutsideThisEl: function(e) {
    !this.el.contains(e) && e !== this.el && (Ie = null);
  },
  _getDirection: function(e, n) {
    return typeof this.options.direction == "function" ? this.options.direction.call(this, e, n, d) : this.options.direction;
  },
  _onTapStart: function(e) {
    if (e.cancelable) {
      var n = this, o = this.el, r = this.options, i = r.preventOnFilter, a = e.type, c = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, l = (c || e).target, u = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || l, f = r.filter;
      if (yo(o), !d && !(/mousedown|pointerdown/.test(a) && e.button !== 0 || r.disabled) && !u.isContentEditable && !(!this.nativeDraggable && Ye && l && l.tagName.toUpperCase() === "SELECT") && (l = re(l, r.draggable, o, !1), !(l && l.animated) && rt !== l)) {
        if (Ne = ne(l), Ue = ne(l, r.draggable), typeof f == "function") {
          if (f.call(this, e, l, this)) {
            G({
              sortable: n,
              rootEl: u,
              name: "filter",
              targetEl: l,
              toEl: o,
              fromEl: o
            }), K("filter", n, {
              evt: e
            }), i && e.cancelable && e.preventDefault();
            return;
          }
        } else if (f && (f = f.split(",").some(function(s) {
          if (s = re(u, s.trim(), o, !1), s)
            return G({
              sortable: n,
              rootEl: s,
              name: "filter",
              targetEl: l,
              fromEl: o,
              toEl: o
            }), K("filter", n, {
              evt: e
            }), !0;
        }), f)) {
          i && e.cancelable && e.preventDefault();
          return;
        }
        r.handle && !re(u, r.handle, o, !1) || this._prepareDragStart(e, c, l);
      }
    }
  },
  _prepareDragStart: function(e, n, o) {
    var r = this, i = r.el, a = r.options, c = i.ownerDocument, l;
    if (o && !d && o.parentNode === i) {
      var u = P(o);
      if (C = i, d = o, x = d.parentNode, Ce = d.nextSibling, rt = o, Qe = a.group, g.dragged = d, we = {
        target: d,
        clientX: (n || e).clientX,
        clientY: (n || e).clientY
      }, qt = we.clientX - u.left, Kt = we.clientY - u.top, this._lastX = (n || e).clientX, this._lastY = (n || e).clientY, d.style["will-change"] = "all", l = function() {
        if (K("delayEnded", r, {
          evt: e
        }), g.eventCanceled) {
          r._onDrop();
          return;
        }
        r._disableDelayedDragEvents(), !jt && r.nativeDraggable && (d.draggable = !0), r._triggerDragStart(e, n), G({
          sortable: r,
          name: "choose",
          originalEvent: e
        }), J(d, a.chosenClass, !0);
      }, a.ignore.split(",").forEach(function(f) {
        cn(d, f.trim(), wt);
      }), D(c, "dragover", Ee), D(c, "mousemove", Ee), D(c, "touchmove", Ee), D(c, "mouseup", r._onDrop), D(c, "touchend", r._onDrop), D(c, "touchcancel", r._onDrop), jt && this.nativeDraggable && (this.options.touchStartThreshold = 4, d.draggable = !0), K("delayStart", this, {
        evt: e
      }), a.delay && (!a.delayOnTouchOnly || n) && (!this.nativeDraggable || !(Ke || me))) {
        if (g.eventCanceled) {
          this._onDrop();
          return;
        }
        D(c, "mouseup", r._disableDelayedDrag), D(c, "touchend", r._disableDelayedDrag), D(c, "touchcancel", r._disableDelayedDrag), D(c, "mousemove", r._delayedDragTouchMoveHandler), D(c, "touchmove", r._delayedDragTouchMoveHandler), a.supportPointer && D(c, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(l, a.delay);
      } else
        l();
    }
  },
  _delayedDragTouchMoveHandler: function(e) {
    var n = e.touches ? e.touches[0] : e;
    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();
  },
  _disableDelayedDrag: function() {
    d && wt(d), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
  },
  _disableDelayedDragEvents: function() {
    var e = this.el.ownerDocument;
    S(e, "mouseup", this._disableDelayedDrag), S(e, "touchend", this._disableDelayedDrag), S(e, "touchcancel", this._disableDelayedDrag), S(e, "mousemove", this._delayedDragTouchMoveHandler), S(e, "touchmove", this._delayedDragTouchMoveHandler), S(e, "pointermove", this._delayedDragTouchMoveHandler);
  },
  _triggerDragStart: function(e, n) {
    n = n || e.pointerType == "touch" && e, !this.nativeDraggable || n ? this.options.supportPointer ? D(document, "pointermove", this._onTouchMove) : n ? D(document, "touchmove", this._onTouchMove) : D(document, "mousemove", this._onTouchMove) : (D(d, "dragend", this), D(C, "dragstart", this._onDragStart));
    try {
      document.selection ? at(function() {
        document.selection.empty();
      }) : window.getSelection().removeAllRanges();
    } catch {
    }
  },
  _dragStarted: function(e, n) {
    if (ke = !1, C && d) {
      K("dragStarted", this, {
        evt: n
      }), this.nativeDraggable && D(document, "dragover", co);
      var o = this.options;
      !e && J(d, o.dragClass, !1), J(d, o.ghostClass, !0), g.active = this, e && this._appendGhost(), G({
        sortable: this,
        name: "start",
        originalEvent: n
      });
    } else
      this._nulling();
  },
  _emulateDragOver: function() {
    if (oe) {
      this._lastX = oe.clientX, this._lastY = oe.clientY, vn();
      for (var e = document.elementFromPoint(oe.clientX, oe.clientY), n = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(oe.clientX, oe.clientY), e !== n); )
        n = e;
      if (d.parentNode[Q]._isOutsideThisEl(e), n)
        do {
          if (n[Q]) {
            var o = void 0;
            if (o = n[Q]._onDragOver({
              clientX: oe.clientX,
              clientY: oe.clientY,
              target: e,
              rootEl: n
            }), o && !this.options.dragoverBubble)
              break;
          }
          e = n;
        } while (n = n.parentNode);
      bn();
    }
  },
  _onTouchMove: function(e) {
    if (we) {
      var n = this.options, o = n.fallbackTolerance, r = n.fallbackOffset, i = e.touches ? e.touches[0] : e, a = w && Ve(w, !0), c = w && a && a.a, l = w && a && a.d, u = tt && j && Gt(j), f = (i.clientX - we.clientX + r.x) / (c || 1) + (u ? u[0] - _t[0] : 0) / (c || 1), s = (i.clientY - we.clientY + r.y) / (l || 1) + (u ? u[1] - _t[1] : 0) / (l || 1);
      if (!g.active && !ke) {
        if (o && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < o)
          return;
        this._onDragStart(e, !0);
      }
      if (w) {
        a ? (a.e += f - (bt || 0), a.f += s - (yt || 0)) : a = {
          a: 1,
          b: 0,
          c: 0,
          d: 1,
          e: f,
          f: s
        };
        var v = "matrix(".concat(a.a, ",").concat(a.b, ",").concat(a.c, ",").concat(a.d, ",").concat(a.e, ",").concat(a.f, ")");
        h(w, "webkitTransform", v), h(w, "mozTransform", v), h(w, "msTransform", v), h(w, "transform", v), bt = f, yt = s, oe = i;
      }
      e.cancelable && e.preventDefault();
    }
  },
  _appendGhost: function() {
    if (!w) {
      var e = this.options.fallbackOnBody ? document.body : C, n = P(d, !0, tt, !0, e), o = this.options;
      if (tt) {
        for (j = e; h(j, "position") === "static" && h(j, "transform") === "none" && j !== document; )
          j = j.parentNode;
        j !== document.body && j !== document.documentElement ? (j === document && (j = ae()), n.top += j.scrollTop, n.left += j.scrollLeft) : j = ae(), _t = Gt(j);
      }
      w = d.cloneNode(!0), J(w, o.ghostClass, !1), J(w, o.fallbackClass, !0), J(w, o.dragClass, !0), h(w, "transition", ""), h(w, "transform", ""), h(w, "box-sizing", "border-box"), h(w, "margin", 0), h(w, "top", n.top), h(w, "left", n.left), h(w, "width", n.width), h(w, "height", n.height), h(w, "opacity", "0.8"), h(w, "position", tt ? "absolute" : "fixed"), h(w, "zIndex", "100000"), h(w, "pointerEvents", "none"), g.ghost = w, e.appendChild(w), h(w, "transform-origin", qt / parseInt(w.style.width) * 100 + "% " + Kt / parseInt(w.style.height) * 100 + "%");
    }
  },
  _onDragStart: function(e, n) {
    var o = this, r = e.dataTransfer, i = o.options;
    if (K("dragStart", this, {
      evt: e
    }), g.eventCanceled) {
      this._onDrop();
      return;
    }
    K("setupClone", this), g.eventCanceled || (O = mn(d), O.draggable = !1, O.style["will-change"] = "", this._hideClone(), J(O, this.options.chosenClass, !1), g.clone = O), o.cloneId = at(function() {
      K("clone", o), !g.eventCanceled && (o.options.removeCloneOnHide || C.insertBefore(O, d), o._hideClone(), G({
        sortable: o,
        name: "clone"
      }));
    }), !n && J(d, i.dragClass, !0), n ? (ut = !0, o._loopId = setInterval(o._emulateDragOver, 50)) : (S(document, "mouseup", o._onDrop), S(document, "touchend", o._onDrop), S(document, "touchcancel", o._onDrop), r && (r.effectAllowed = "move", i.setData && i.setData.call(o, r, d)), D(document, "drop", o), h(d, "transform", "translateZ(0)")), ke = !0, o._dragStartId = at(o._dragStarted.bind(o, n, e)), D(document, "selectstart", o), $e = !0, Ye && h(document.body, "user-select", "none");
  },
  // Returns true - if no further action is needed (either inserted or another condition)
  _onDragOver: function(e) {
    var n = this.el, o = e.target, r, i, a, c = this.options, l = c.group, u = g.active, f = Qe === l, s = c.sort, v = R || u, y, _ = this, b = !1;
    if (Ot) return;
    function Y($, Le) {
      K($, _, le({
        evt: e,
        isOwner: f,
        axis: y ? "vertical" : "horizontal",
        revert: a,
        dragRect: r,
        targetRect: i,
        canSort: s,
        fromSortable: v,
        target: o,
        completed: T,
        onMove: function(Ze, _e) {
          return nt(C, n, d, r, Ze, P(Ze), e, _e);
        },
        changed: M
      }, Le));
    }
    function q() {
      Y("dragOverAnimationCapture"), _.captureAnimationState(), _ !== v && v.captureAnimationState();
    }
    function T($) {
      return Y("dragOverCompleted", {
        insertion: $
      }), $ && (f ? u._hideClone() : u._showClone(_), _ !== v && (J(d, R ? R.options.ghostClass : u.options.ghostClass, !1), J(d, c.ghostClass, !0)), R !== _ && _ !== g.active ? R = _ : _ === g.active && R && (R = null), v === _ && (_._ignoreWhileAnimating = o), _.animateAll(function() {
        Y("dragOverAnimationComplete"), _._ignoreWhileAnimating = null;
      }), _ !== v && (v.animateAll(), v._ignoreWhileAnimating = null)), (o === d && !d.animated || o === n && !o.animated) && (Ie = null), !c.dragoverBubble && !e.rootEl && o !== document && (d.parentNode[Q]._isOutsideThisEl(e.target), !$ && Ee(e)), !c.dragoverBubble && e.stopPropagation && e.stopPropagation(), b = !0;
    }
    function M() {
      Z = ne(d), he = ne(d, c.draggable), G({
        sortable: _,
        name: "change",
        toEl: n,
        newIndex: Z,
        newDraggableIndex: he,
        originalEvent: e
      });
    }
    if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), o = re(o, c.draggable, n, !0), Y("dragOver"), g.eventCanceled) return b;
    if (d.contains(e.target) || o.animated && o.animatingX && o.animatingY || _._ignoreWhileAnimating === o)
      return T(!1);
    if (ut = !1, u && !c.disabled && (f ? s || (a = x !== C) : R === this || (this.lastPutMode = Qe.checkPull(this, u, d, e)) && l.checkPut(this, u, d, e))) {
      if (y = this._getDirection(e, o) === "vertical", r = P(d), Y("dragOverValid"), g.eventCanceled) return b;
      if (a)
        return x = C, q(), this._hideClone(), Y("revert"), g.eventCanceled || (Ce ? C.insertBefore(d, Ce) : C.appendChild(d)), T(!0);
      var L = Mt(n, c.draggable);
      if (!L || ho(e, y, this) && !L.animated) {
        if (L === d)
          return T(!1);
        if (L && n === e.target && (o = L), o && (i = P(o)), nt(C, n, d, r, o, i, e, !!o) !== !1)
          return q(), n.appendChild(d), x = n, M(), T(!0);
      } else if (L && po(e, y, this)) {
        var W = Me(n, 0, c, !0);
        if (W === d)
          return T(!1);
        if (o = W, i = P(o), nt(C, n, d, r, o, i, e, !1) !== !1)
          return q(), n.insertBefore(d, W), x = n, M(), T(!0);
      } else if (o.parentNode === n) {
        i = P(o);
        var te = 0, se, be = d.parentNode !== n, H = !so(d.animated && d.toRect || r, o.animated && o.toRect || i, y), ye = y ? "top" : "left", m = zt(o, "top", "top") || zt(d, "top", "top"), p = m ? m.scrollTop : void 0;
        Ie !== o && (se = i[ye], He = !1, et = !H && c.invertSwap || be), te = go(e, o, i, y, H ? 1 : c.swapThreshold, c.invertedSwapThreshold == null ? c.swapThreshold : c.invertedSwapThreshold, et, Ie === o);
        var E;
        if (te !== 0) {
          var I = ne(d);
          do
            I -= te, E = x.children[I];
          while (E && (h(E, "display") === "none" || E === w));
        }
        if (te === 0 || E === o)
          return T(!1);
        Ie = o, je = te;
        var B = o.nextElementSibling, z = !1;
        z = te === 1;
        var pe = nt(C, n, d, r, o, i, e, z);
        if (pe !== !1)
          return (pe === 1 || pe === -1) && (z = pe === 1), Ot = !0, setTimeout(mo, 30), q(), z && !B ? n.appendChild(d) : o.parentNode.insertBefore(d, z ? B : o), m && fn(m, 0, p - m.scrollTop), x = d.parentNode, se !== void 0 && !et && (it = Math.abs(se - P(o)[ye])), M(), T(!0);
      }
      if (n.contains(d))
        return T(!1);
    }
    return !1;
  },
  _ignoreWhileAnimating: null,
  _offMoveEvents: function() {
    S(document, "mousemove", this._onTouchMove), S(document, "touchmove", this._onTouchMove), S(document, "pointermove", this._onTouchMove), S(document, "dragover", Ee), S(document, "mousemove", Ee), S(document, "touchmove", Ee);
  },
  _offUpEvents: function() {
    var e = this.el.ownerDocument;
    S(e, "mouseup", this._onDrop), S(e, "touchend", this._onDrop), S(e, "pointerup", this._onDrop), S(e, "touchcancel", this._onDrop), S(document, "selectstart", this);
  },
  _onDrop: function(e) {
    var n = this.el, o = this.options;
    if (Z = ne(d), he = ne(d, o.draggable), K("drop", this, {
      evt: e
    }), x = d && d.parentNode, Z = ne(d), he = ne(d, o.draggable), g.eventCanceled) {
      this._nulling();
      return;
    }
    ke = !1, et = !1, He = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), It(this.cloneId), It(this._dragStartId), this.nativeDraggable && (S(document, "drop", this), S(n, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Ye && h(document.body, "user-select", ""), h(d, "transform", ""), e && ($e && (e.cancelable && e.preventDefault(), !o.dropBubble && e.stopPropagation()), w && w.parentNode && w.parentNode.removeChild(w), (C === x || R && R.lastPutMode !== "clone") && O && O.parentNode && O.parentNode.removeChild(O), d && (this.nativeDraggable && S(d, "dragend", this), wt(d), d.style["will-change"] = "", $e && !ke && J(d, R ? R.options.ghostClass : this.options.ghostClass, !1), J(d, this.options.chosenClass, !1), G({
      sortable: this,
      name: "unchoose",
      toEl: x,
      newIndex: null,
      newDraggableIndex: null,
      originalEvent: e
    }), C !== x ? (Z >= 0 && (G({
      rootEl: x,
      name: "add",
      toEl: x,
      fromEl: C,
      originalEvent: e
    }), G({
      sortable: this,
      name: "remove",
      toEl: x,
      originalEvent: e
    }), G({
      rootEl: x,
      name: "sort",
      toEl: x,
      fromEl: C,
      originalEvent: e
    }), G({
      sortable: this,
      name: "sort",
      toEl: x,
      originalEvent: e
    })), R && R.save()) : Z !== Ne && Z >= 0 && (G({
      sortable: this,
      name: "update",
      toEl: x,
      originalEvent: e
    }), G({
      sortable: this,
      name: "sort",
      toEl: x,
      originalEvent: e
    })), g.active && ((Z == null || Z === -1) && (Z = Ne, he = Ue), G({
      sortable: this,
      name: "end",
      toEl: x,
      originalEvent: e
    }), this.save()))), this._nulling();
  },
  _nulling: function() {
    K("nulling", this), C = d = x = w = Ce = O = rt = ge = we = oe = $e = Z = he = Ne = Ue = Ie = je = R = Qe = g.dragged = g.ghost = g.clone = g.active = null, dt.forEach(function(e) {
      e.checked = !0;
    }), dt.length = bt = yt = 0;
  },
  handleEvent: function(e) {
    switch (e.type) {
      case "drop":
      case "dragend":
        this._onDrop(e);
        break;
      case "dragenter":
      case "dragover":
        d && (this._onDragOver(e), fo(e));
        break;
      case "selectstart":
        e.preventDefault();
        break;
    }
  },
  /**
   * Serializes the item into an array of string.
   * @returns {String[]}
   */
  toArray: function() {
    for (var e = [], n, o = this.el.children, r = 0, i = o.length, a = this.options; r < i; r++)
      n = o[r], re(n, a.draggable, this.el, !1) && e.push(n.getAttribute(a.dataIdAttr) || bo(n));
    return e;
  },
  /**
   * Sorts the elements according to the array.
   * @param  {String[]}  order  order of the items
   */
  sort: function(e, n) {
    var o = {}, r = this.el;
    this.toArray().forEach(function(i, a) {
      var c = r.children[a];
      re(c, this.options.draggable, r, !1) && (o[i] = c);
    }, this), n && this.captureAnimationState(), e.forEach(function(i) {
      o[i] && (r.removeChild(o[i]), r.appendChild(o[i]));
    }), n && this.animateAll();
  },
  /**
   * Save the current sorting
   */
  save: function() {
    var e = this.options.store;
    e && e.set && e.set(this);
  },
  /**
   * 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.
   * @param   {HTMLElement}  el
   * @param   {String}       [selector]  default: `options.draggable`
   * @returns {HTMLElement|null}
   */
  closest: function(e, n) {
    return re(e, n || this.options.draggable, this.el, !1);
  },
  /**
   * Set/get option
   * @param   {string} name
   * @param   {*}      [value]
   * @returns {*}
   */
  option: function(e, n) {
    var o = this.options;
    if (n === void 0)
      return o[e];
    var r = Je.modifyOption(this, e, n);
    typeof r < "u" ? o[e] = r : o[e] = n, e === "group" && gn(o);
  },
  /**
   * Destroy
   */
  destroy: function() {
    K("destroy", this);
    var e = this.el;
    e[Q] = null, S(e, "mousedown", this._onTapStart), S(e, "touchstart", this._onTapStart), S(e, "pointerdown", this._onTapStart), this.nativeDraggable && (S(e, "dragover", this), S(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(n) {
      n.removeAttribute("draggable");
    }), this._onDrop(), this._disableDelayedDragEvents(), ct.splice(ct.indexOf(this.el), 1), this.el = e = null;
  },
  _hideClone: function() {
    if (!ge) {
      if (K("hideClone", this), g.eventCanceled) return;
      h(O, "display", "none"), this.options.removeCloneOnHide && O.parentNode && O.parentNode.removeChild(O), ge = !0;
    }
  },
  _showClone: function(e) {
    if (e.lastPutMode !== "clone") {
      this._hideClone();
      return;
    }
    if (ge) {
      if (K("showClone", this), g.eventCanceled) return;
      d.parentNode == C && !this.options.group.revertClone ? C.insertBefore(O, d) : Ce ? C.insertBefore(O, Ce) : C.appendChild(O), this.options.group.revertClone && this.animate(d, O), h(O, "display", ""), ge = !1;
    }
  }
};
function fo(t) {
  t.dataTransfer && (t.dataTransfer.dropEffect = "move"), t.cancelable && t.preventDefault();
}
function nt(t, e, n, o, r, i, a, c) {
  var l, u = t[Q], f = u.options.onMove, s;
  return window.CustomEvent && !me && !Ke ? l = new CustomEvent("move", {
    bubbles: !0,
    cancelable: !0
  }) : (l = document.createEvent("Event"), l.initEvent("move", !0, !0)), l.to = e, l.from = t, l.dragged = n, l.draggedRect = o, l.related = r || e, l.relatedRect = i || P(e), l.willInsertAfter = c, l.originalEvent = a, t.dispatchEvent(l), f && (s = f.call(u, l, a)), s;
}
function wt(t) {
  t.draggable = !1;
}
function mo() {
  Ot = !1;
}
function po(t, e, n) {
  var o = P(Me(n.el, 0, n.options, !0)), r = 10;
  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;
}
function ho(t, e, n) {
  var o = P(Mt(n.el, n.options.draggable)), r = 10;
  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;
}
function go(t, e, n, o, r, i, a, c) {
  var l = o ? t.clientY : t.clientX, u = o ? n.height : n.width, f = o ? n.top : n.left, s = o ? n.bottom : n.right, v = !1;
  if (!a) {
    if (c && it < u * r) {
      if (!He && (je === 1 ? l > f + u * i / 2 : l < s - u * i / 2) && (He = !0), He)
        v = !0;
      else if (je === 1 ? l < f + it : l > s - it)
        return -je;
    } else if (l > f + u * (1 - r) / 2 && l < s - u * (1 - r) / 2)
      return vo(e);
  }
  return v = v || a, v && (l < f + u * i / 2 || l > s - u * i / 2) ? l > f + u / 2 ? 1 : -1 : 0;
}
function vo(t) {
  return ne(d) < ne(t) ? 1 : -1;
}
function bo(t) {
  for (var e = t.tagName + t.className + t.src + t.href + t.textContent, n = e.length, o = 0; n--; )
    o += e.charCodeAt(n);
  return o.toString(36);
}
function yo(t) {
  dt.length = 0;
  for (var e = t.getElementsByTagName("input"), n = e.length; n--; ) {
    var o = e[n];
    o.checked && dt.push(o);
  }
}
function at(t) {
  return setTimeout(t, 0);
}
function It(t) {
  return clearTimeout(t);
}
mt && D(document, "touchmove", function(t) {
  (g.active || ke) && t.cancelable && t.preventDefault();
});
g.utils = {
  on: D,
  off: S,
  css: h,
  find: cn,
  is: function(e, n) {
    return !!re(e, n, e, !1);
  },
  extend: eo,
  throttle: dn,
  closest: re,
  toggleClass: J,
  clone: mn,
  index: ne,
  nextTick: at,
  cancelNextTick: It,
  detectDirection: hn,
  getChild: Me
};
g.get = function(t) {
  return t[Q];
};
g.mount = function() {
  for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
    e[n] = arguments[n];
  e[0].constructor === Array && (e = e[0]), e.forEach(function(o) {
    if (!o.prototype || !o.prototype.constructor)
      throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));
    o.utils && (g.utils = le(le({}, g.utils), o.utils)), Je.mount(o);
  });
};
g.create = function(t, e) {
  return new g(t, e);
};
g.version = Kn;
var k = [], Re, Ft, kt = !1, Et, St, ft, Xe;
function _o() {
  function t() {
    this.defaults = {
      scroll: !0,
      forceAutoScrollFallback: !1,
      scrollSensitivity: 30,
      scrollSpeed: 10,
      bubbleScroll: !0
    };
    for (var e in this)
      e.charAt(0) === "_" && typeof this[e] == "function" && (this[e] = this[e].bind(this));
  }
  return t.prototype = {
    dragStarted: function(n) {
      var o = n.originalEvent;
      this.sortable.nativeDraggable ? D(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? D(document, "pointermove", this._handleFallbackAutoScroll) : o.touches ? D(document, "touchmove", this._handleFallbackAutoScroll) : D(document, "mousemove", this._handleFallbackAutoScroll);
    },
    dragOverCompleted: function(n) {
      var o = n.originalEvent;
      !this.options.dragOverBubble && !o.rootEl && this._handleAutoScroll(o);
    },
    drop: function() {
      this.sortable.nativeDraggable ? S(document, "dragover", this._handleAutoScroll) : (S(document, "pointermove", this._handleFallbackAutoScroll), S(document, "touchmove", this._handleFallbackAutoScroll), S(document, "mousemove", this._handleFallbackAutoScroll)), Zt(), lt(), to();
    },
    nulling: function() {
      ft = Ft = Re = kt = Xe = Et = St = null, k.length = 0;
    },
    _handleFallbackAutoScroll: function(n) {
      this._handleAutoScroll(n, !0);
    },
    _handleAutoScroll: function(n, o) {
      var r = this, i = (n.touches ? n.touches[0] : n).clientX, a = (n.touches ? n.touches[0] : n).clientY, c = document.elementFromPoint(i, a);
      if (ft = n, o || this.options.forceAutoScrollFallback || Ke || me || Ye) {
        Dt(n, this.options, c, o);
        var l = ve(c, !0);
        kt && (!Xe || i !== Et || a !== St) && (Xe && Zt(), Xe = setInterval(function() {
          var u = ve(document.elementFromPoint(i, a), !0);
          u !== l && (l = u, lt()), Dt(n, r.options, u, o);
        }, 10), Et = i, St = a);
      } else {
        if (!this.options.bubbleScroll || ve(c, !0) === ae()) {
          lt();
          return;
        }
        Dt(n, this.options, ve(c, !1), !1);
      }
    }
  }, fe(t, {
    pluginName: "scroll",
    initializeByDefault: !0
  });
}
function lt() {
  k.forEach(function(t) {
    clearInterval(t.pid);
  }), k = [];
}
function Zt() {
  clearInterval(Xe);
}
var Dt = dn(function(t, e, n, o) {
  if (e.scroll) {
    var r = (t.touches ? t.touches[0] : t).clientX, i = (t.touches ? t.touches[0] : t).clientY, a = e.scrollSensitivity, c = e.scrollSpeed, l = ae(), u = !1, f;
    Ft !== n && (Ft = n, lt(), Re = e.scroll, f = e.scrollFn, Re === !0 && (Re = ve(n, !0)));
    var s = 0, v = Re;
    do {
      var y = v, _ = P(y), b = _.top, Y = _.bottom, q = _.left, T = _.right, M = _.width, L = _.height, W = void 0, te = void 0, se = y.scrollWidth, be = y.scrollHeight, H = h(y), ye = y.scrollLeft, m = y.scrollTop;
      y === l ? (W = M < se && (H.overflowX === "auto" || H.overflowX === "scroll" || H.overflowX === "visible"), te = L < be && (H.overflowY === "auto" || H.overflowY === "scroll" || H.overflowY === "visible")) : (W = M < se && (H.overflowX === "auto" || H.overflowX === "scroll"), te = L < be && (H.overflowY === "auto" || H.overflowY === "scroll"));
      var p = W && (Math.abs(T - r) <= a && ye + M < se) - (Math.abs(q - r) <= a && !!ye), E = te && (Math.abs(Y - i) <= a && m + L < be) - (Math.abs(b - i) <= a && !!m);
      if (!k[s])
        for (var I = 0; I <= s; I++)
          k[I] || (k[I] = {});
      (k[s].vx != p || k[s].vy != E || k[s].el !== y) && (k[s].el = y, k[s].vx = p, k[s].vy = E, clearInterval(k[s].pid), (p != 0 || E != 0) && (u = !0, k[s].pid = setInterval((function() {
        o && this.layer === 0 && g.active._onTouchMove(ft);
        var B = k[this.layer].vy ? k[this.layer].vy * c : 0, z = k[this.layer].vx ? k[this.layer].vx * c : 0;
        typeof f == "function" && f.call(g.dragged.parentNode[Q], z, B, t, ft, k[this.layer].el) !== "continue" || fn(k[this.layer].el, z, B);
      }).bind({
        layer: s
      }), 24))), s++;
    } while (e.bubbleScroll && v !== l && (v = ve(v, !1)));
    kt = u;
  }
}, 30), yn = function(e) {
  var n = e.originalEvent, o = e.putSortable, r = e.dragEl, i = e.activeSortable, a = e.dispatchSortableEvent, c = e.hideGhostForTarget, l = e.unhideGhostForTarget;
  if (n) {
    var u = o || i;
    c();
    var f = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, s = document.elementFromPoint(f.clientX, f.clientY);
    l(), u && !u.el.contains(s) && (a("spill"), this.onSpill({
      dragEl: r,
      putSortable: o
    }));
  }
};
function Lt() {
}
Lt.prototype = {
  startIndex: null,
  dragStart: function(e) {
    var n = e.oldDraggableIndex;
    this.startIndex = n;
  },
  onSpill: function(e) {
    var n = e.dragEl, o = e.putSortable;
    this.sortable.captureAnimationState(), o && o.captureAnimationState();
    var r = Me(this.sortable.el, this.startIndex, this.options);
    r ? this.sortable.el.insertBefore(n, r) : this.sortable.el.appendChild(n), this.sortable.animateAll(), o && o.animateAll();
  },
  drop: yn
};
fe(Lt, {
  pluginName: "revertOnSpill"
});
function Bt() {
}
Bt.prototype = {
  onSpill: function(e) {
    var n = e.dragEl, o = e.putSortable, r = o || this.sortable;
    r.captureAnimationState(), n.parentNode && n.parentNode.removeChild(n), r.animateAll();
  },
  drop: yn
};
fe(Bt, {
  pluginName: "removeOnSpill"
});
g.mount(new _o());
g.mount(Bt, Lt);
function Ct(t) {
  t.parentElement !== null && t.parentElement.removeChild(t);
}
function Qt(t, e, n) {
  const o = n === 0 ? t.children[0] : t.children[n - 1].nextSibling;
  t.insertBefore(e, o);
}
function wo() {
  return typeof window < "u" ? window.console : globalThis.console;
}
const Eo = wo();
function So(t) {
  const e = /* @__PURE__ */ Object.create(null);
  return function(o) {
    return e[o] || (e[o] = t(o));
  };
}
const Do = /-(\w)/g, Co = So((t) => t.replace(Do, (e, n) => n.toUpperCase())), _n = ["Start", "Add", "Remove", "Update", "End"], wn = ["Choose", "Unchoose", "Sort", "Filter", "Clone"], En = ["Move"], To = [En, _n, wn].flatMap((t) => t).map((t) => `on${t}`), At = {
  manage: En,
  manageAndEmit: _n,
  emit: wn
};
function xo(t) {
  return To.indexOf(t) !== -1;
}
const Oo = [
  "a",
  "abbr",
  "address",
  "area",
  "article",
  "aside",
  "audio",
  "b",
  "base",
  "bdi",
  "bdo",
  "blockquote",
  "body",
  "br",
  "button",
  "canvas",
  "caption",
  "cite",
  "code",
  "col",
  "colgroup",
  "data",
  "datalist",
  "dd",
  "del",
  "details",
  "dfn",
  "dialog",
  "div",
  "dl",
  "dt",
  "em",
  "embed",
  "fieldset",
  "figcaption",
  "figure",
  "footer",
  "form",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hgroup",
  "hr",
  "html",
  "i",
  "iframe",
  "img",
  "input",
  "ins",
  "kbd",
  "label",
  "legend",
  "li",
  "link",
  "main",
  "map",
  "mark",
  "math",
  "menu",
  "menuitem",
  "meta",
  "meter",
  "nav",
  "noscript",
  "object",
  "ol",
  "optgroup",
  "option",
  "output",
  "p",
  "param",
  "picture",
  "pre",
  "progress",
  "q",
  "rb",
  "rp",
  "rt",
  "rtc",
  "ruby",
  "s",
  "samp",
  "script",
  "section",
  "select",
  "slot",
  "small",
  "source",
  "span",
  "strong",
  "style",
  "sub",
  "summary",
  "sup",
  "svg",
  "table",
  "tbody",
  "td",
  "template",
  "textarea",
  "tfoot",
  "th",
  "thead",
  "time",
  "title",
  "tr",
  "track",
  "u",
  "ul",
  "var",
  "video",
  "wbr"
];
function Io(t) {
  return Oo.includes(t);
}
function Fo(t) {
  return ["transition-group", "TransitionGroup"].includes(t);
}
function Sn(t) {
  return ["id", "class", "role", "style"].includes(t) || t.startsWith("data-") || t.startsWith("aria-") || t.startsWith("on");
}
function Dn(t) {
  return t.reduce((e, [n, o]) => (e[n] = o, e), {});
}
function ko({ $attrs: t, componentData: e = {} }) {
  return {
    ...Dn(
      Object.entries(t).filter(([o, r]) => Sn(o))
    ),
    ...e
  };
}
function Ao({ $attrs: t, callBackBuilder: e }) {
  const n = Dn(Cn(t));
  Object.entries(e).forEach(([r, i]) => {
    At[r].forEach((a) => {
      n[`on${a}`] = i(a);
    });
  });
  const o = `[data-draggable]${n.draggable || ""}`;
  return {
    ...n,
    draggable: o
  };
}
function Cn(t) {
  return Object.entries(t).filter(([e, n]) => !Sn(e)).map(([e, n]) => [Co(e), n]).filter(([e, n]) => !xo(e));
}
const en = ({ el: t }) => t, No = (t, e) => t.__draggable_context = e, tn = (t) => t.__draggable_context;
class Po {
  constructor({
    nodes: { header: e, default: n, footer: o },
    root: r,
    realList: i
  }) {
    this.defaultNodes = n, this.children = [...e, ...n, ...o], this.externalComponent = r.externalComponent, this.rootTransition = r.transition, this.tag = r.tag, this.realList = i;
  }
  get _isRootComponent() {
    return this.externalComponent || this.rootTransition;
  }
  render(e, n) {
    const { tag: o, children: r, _isRootComponent: i } = this;
    return e(o, n, i ? { default: () => r } : r);
  }
  updated() {
    const { defaultNodes: e, realList: n } = this;
    e.forEach((o, r) => {
      No(en(o), {
        element: n[r],
        index: r
      });
    });
  }
  getUnderlyingVm(e) {
    return tn(e);
  }
  getVmIndexFromDomIndex(e, n) {
    const { defaultNodes: o } = this, { length: r } = o, i = n.children, a = i.item(e);
    if (a === null)
      return r;
    const c = tn(a);
    if (c)
      return c.index;
    if (r === 0)
      return 0;
    const l = en(o[0]), u = [...i].findIndex(
      (f) => f === l
    );
    return e < u ? 0 : r;
  }
}
function Vo(t, e) {
  const n = t[e];
  return n ? n() : [];
}
function Mo({ $slots: t, realList: e, getKey: n }) {
  const o = e || [], [r, i] = ["header", "footer"].map(
    (l) => Vo(t, l)
  ), { item: a } = t;
  if (!a)
    throw new Error("draggable element must have an item slot");
  const c = o.flatMap(
    (l, u) => a({ element: l, index: u }).map((f) => (f.key = n(l), f.props = { ...f.props || {}, "data-draggable": !0 }, f))
  );
  if (c.length !== o.length)
    throw new Error("Item slot must have only one child");
  return {
    header: r,
    footer: i,
    default: c
  };
}
function Lo(t) {
  const e = Fo(t), n = !Io(t) && !e;
  return {
    transition: e,
    externalComponent: n,
    tag: n ? N(t) : e ? An : t
  };
}
function Bo({ $slots: t, tag: e, realList: n, getKey: o }) {
  const r = Mo({ $slots: t, realList: n, getKey: o }), i = Lo(e);
  return new Po({ nodes: r, root: i, realList: n });
}
function Tn(t, e) {
  nn(() => this.$emit(t.toLowerCase(), e));
}
function xn(t) {
  return (e, n) => {
    if (this.realList !== null)
      return this[`onDrag${t}`](e, n);
  };
}
function $o(t) {
  const e = xn.call(this, t);
  return (n, o) => {
    e.call(this, n, o), Tn.call(this, t, n);
  };
}
let Tt = null;
const Ro = {
  list: {
    type: Array,
    required: !1,
    default: null
  },
  modelValue: {
    type: Array,
    required: !1,
    default: null
  },
  itemKey: {
    type: [String, Function],
    required: !0
  },
  clone: {
    type: Function,
    default: (t) => t
  },
  tag: {
    type: String,
    default: "div"
  },
  move: {
    type: Function,
    default: null
  },
  componentData: {
    type: Object,
    required: !1,
    default: null
  }
}, Xo = [
  "update:modelValue",
  "change",
  ...[...At.manageAndEmit, ...At.emit].map((t) => t.toLowerCase())
], Yo = Te({
  name: "draggable",
  inheritAttrs: !1,
  props: Ro,
  emits: Xo,
  data() {
    return {
      error: !1
    };
  },
  render() {
    try {
      this.error = !1;
      const { $slots: t, $attrs: e, tag: n, componentData: o, realList: r, getKey: i } = this, a = Bo({
        $slots: t,
        tag: n,
        realList: r,
        getKey: i
      });
      this.componentStructure = a;
      const c = ko({ $attrs: e, componentData: o });
      return a.render(Rt, c);
    } catch (t) {
      return this.error = !0, Rt("pre", { style: { color: "red" } }, t.stack);
    }
  },
  created() {
    this.list !== null && this.modelValue !== null && Eo.error(
      "modelValue and list props are mutually exclusive! Please set one or another."
    );
  },
  mounted() {
    if (this.error)
      return;
    const { $attrs: t, $el: e, componentStructure: n } = this;
    n.updated();
    const o = Ao({
      $attrs: t,
      callBackBuilder: {
        manageAndEmit: (i) => $o.call(this, i),
        emit: (i) => Tn.bind(this, i),
        manage: (i) => xn.call(this, i)
      }
    }), r = e.nodeType === 1 ? e : e.parentElement;
    this._sortable = new g(r, o), this.targetDomElement = r, r.__draggable_component__ = this;
  },
  updated() {
    this.componentStructure.updated();
  },
  beforeUnmount() {
    this._sortable !== void 0 && this._sortable.destroy();
  },
  computed: {
    realList() {
      const { list: t } = this;
      return t || this.modelValue;
    },
    getKey() {
      const { itemKey: t } = this;
      return typeof t == "function" ? t : (e) => e[t];
    }
  },
  watch: {
    $attrs: {
      handler(t) {
        const { _sortable: e } = this;
        e && Cn(t).forEach(([n, o]) => {
          e.option(n, o);
        });
      },
      deep: !0
    }
  },
  methods: {
    getUnderlyingVm(t) {
      return this.componentStructure.getUnderlyingVm(t) || null;
    },
    getUnderlyingPotencialDraggableComponent(t) {
      return t.__draggable_component__;
    },
    emitChanges(t) {
      nn(() => this.$emit("change", t));
    },
    alterList(t) {
      if (this.list) {
        t(this.list);
        return;
      }
      const e = [...this.modelValue];
      t(e), this.$emit("update:modelValue", e);
    },
    spliceList() {
      const t = (e) => e.splice(...arguments);
      this.alterList(t);
    },
    updatePosition(t, e) {
      const n = (o) => o.splice(e, 0, o.splice(t, 1)[0]);
      this.alterList(n);
    },
    getRelatedContextFromMoveEvent({ to: t, related: e }) {
      const n = this.getUnderlyingPotencialDraggableComponent(t);
      if (!n)
        return { component: n };
      const o = n.realList, r = { list: o, component: n };
      return t !== e && o ? { ...n.getUnderlyingVm(e) || {}, ...r } : r;
    },
    getVmIndexFromDomIndex(t) {
      return this.componentStructure.getVmIndexFromDomIndex(
        t,
        this.targetDomElement
      );
    },
    onDragStart(t) {
      this.context = this.getUnderlyingVm(t.item), t.item._underlying_vm_ = this.clone(this.context.element), Tt = t.item;
    },
    onDragAdd(t) {
      const e = t.item._underlying_vm_;
      if (e === void 0)
        return;
      Ct(t.item);
      const n = this.getVmIndexFromDomIndex(t.newIndex);
      this.spliceList(n, 0, e);
      const o = { element: e, newIndex: n };
      this.emitChanges({ added: o });
    },
    onDragRemove(t) {
      if (Qt(this.$el, t.item, t.oldIndex), t.pullMode === "clone") {
        Ct(t.clone);
        return;
      }
      const { index: e, element: n } = this.context;
      this.spliceList(e, 1);
      const o = { element: n, oldIndex: e };
      this.emitChanges({ removed: o });
    },
    onDragUpdate(t) {
      Ct(t.item), Qt(t.from, t.item, t.oldIndex);
      const e = this.context.index, n = this.getVmIndexFromDomIndex(t.newIndex);
      this.updatePosition(e, n);
      const o = { element: this.context.element, oldIndex: e, newIndex: n };
      this.emitChanges({ moved: o });
    },
    computeFutureIndex(t, e) {
      if (!t.element)
        return 0;
      const n = [...e.to.children].filter(
        (a) => a.style.display !== "none"
      ), o = n.indexOf(e.related), r = t.component.getVmIndexFromDomIndex(
        o
      );
      return n.indexOf(Tt) !== -1 || !e.willInsertAfter ? r : r + 1;
    },
    onDragMove(t, e) {
      const { move: n, realList: o } = this;
      if (!n || !o)
        return !0;
      const r = this.getRelatedContextFromMoveEvent(t), i = this.computeFutureIndex(r, t), a = {
        ...this.context,
        futureIndex: i
      }, c = {
        ...t,
        relatedContext: r,
        draggedContext: a
      };
      return n(c, e);
    },
    onDragEnd() {
      Tt = null;
    }
  }
}), Wo = Object.entries(F).map((t) => {
  let e = "";
  switch (t[1]) {
    case F.BarChart:
      e = "bar_chart";
      break;
    case F.Table:
      e = "table";
      break;
    case F.Circular:
      e = "pie_chart";
      break;
    case F.LineChart:
      e = "show_chart";
      break;
    case F.Scorecard:
      e = "money";
      break;
    case F.Spacer:
      e = "space_bar";
      break;
    case F.StackBarChart:
      e = "stacked_bar_chart";
      break;
    case F.ClusteredStackBarChart:
      e = "stacked_bar_chart";
      break;
    case F.StackLineChart:
      e = "stacked_line_chart";
      break;
  }
  return {
    label: $n(t[0]),
    icon: e,
    value: t[1]
  };
}), Uo = /* @__PURE__ */ Te({
  __name: "WidgetTypeList",
  props: /* @__PURE__ */ Nt({
    childClass: {
      type: String,
      default: ""
    },
    excludeWidgeType: {
      type: Array,
      default: () => []
    },
    isList: {
      type: Boolean,
      required: !1,
      default: !1
    }
  }, {
    modelValue: {
      default: ""
    },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(t) {
    const { t: e } = Pt(), n = Ge(t, "modelValue"), o = t, r = Fe(
      () => Wo.map((i) => ({
        ...i,
        label: e(`report.widget.types.${i.value.toLowerCase()}`)
      }))
    );
    return (i, a) => {
      const c = N("FmIcon"), l = N("FmCard");
      return V(), ee("div", null, [
        (V(!0), ee(qe, null, on(r.value.filter(
          (u) => o.excludeWidgeType.indexOf(u.value) === -1
        ), (u, f) => (V(), Pe(l, {
          key: f,
          class: Xt(`items-center  ${o.childClass} cursor-pointer rounded-[8px] ${o.isList ? "" : "gap-[16px] h-[120px] justify-center"} ${n.value === u.value ? "selected-widget" : ""}`),
          variant: "outlined",
          onClick: (s) => n.value = u.value
        }, {
          default: ie(() => [
            A(c, {
              name: u.icon,
              size: o.isList ? "md" : "lg",
              outline: !0
            }, null, 8, ["name", "size"]),
            ue("span", {
              class: Xt(o.isList ? "" : "flex items-center text-center leading-[24px] h-[48px]")
            }, Ae(u.label), 3)
          ]),
          _: 2
        }, 1032, ["class", "onClick"]))), 128))
      ]);
    };
  }
}), br = /* @__PURE__ */ Vt(Uo, [["__scopeId", "data-v-0535b07b"]]);
function jo(t) {
  let e, n, o, r;
  switch (t) {
    case F.Table:
      e = [], n = !1, o = Rn.top;
      break;
    case F.ClusteredStackBarChart:
      r = !0;
      break;
  }
  return {
    schemaNames: [],
    dimensions: [],
    metrics: [],
    filters: [],
    sorts: [],
    breakdownDimension: void 0,
    sparklineDimension: void 0,
    limit: null,
    showGrandTotal: !1,
    rollupPosition: o,
    showSearchBar: n,
    isTransposed: !1,
    isDrillable: !1,
    stackBarOverlap: r,
    columnIds: [],
    rowIds: [],
    joinDatasources: e
  };
}
function yr(t, e) {
  let n = 1, o = 1;
  switch (t) {
    case F.Scorecard:
      n = 1, o = 2;
      break;
    case F.BarChart:
    case F.StackBarChart:
    case F.ClusteredStackBarChart:
    case F.LineChart:
    case F.StackLineChart:
      n = 4, o = 6;
      break;
    case F.Table:
      n = 4, o = 12;
      break;
    case F.Circular:
      n = 4, o = 4;
      break;
    case F.Spacer:
      n = 0, o = 12;
      break;
  }
  return {
    size: {
      width: o,
      height: n
    },
    widget: {
      title: e || "New widget",
      type: t,
      config: jo(t)
    }
  };
}
function _r(t, e) {
  return t.filter((n, o) => o !== e);
}
const Ho = {
  key: 0,
  class: "flex flex-col gap-5"
}, zo = /* @__PURE__ */ Te({
  __name: "Section",
  props: {
    isOpen: { type: Boolean, default: !0 },
    isOpenModifiers: {}
  },
  emits: ["update:isOpen"],
  setup(t) {
    const e = Ge(t, "isOpen");
    return (n, o) => {
      const r = N("FmIcon"), i = N("FmMenuDivider");
      return V(), ee(qe, null, [
        ue("div", {
          class: "flex items-center cursor-pointer fm-typo-en-body-lg-600",
          onClick: o[0] || (o[0] = (a) => e.value = !e.value)
        }, [
          ze(n.$slots, "header", {}, void 0, !0),
          A(r, {
            name: e.value ? "keyboard_arrow_up" : "keyboard_arrow_down"
          }, null, 8, ["name"])
        ]),
        A(xt, { name: "slide-fade" }, {
          default: ie(() => [
            e.value ? (V(), ee("div", Ho, [
              ze(n.$slots, "content", {}, void 0, !0)
            ])) : ce("", !0)
          ]),
          _: 3
        }),
        A(i)
      ], 64);
    };
  }
}), wr = /* @__PURE__ */ Vt(zo, [["__scopeId", "data-v-fa67a3a4"]]), Go = { class: "grow" }, qo = {
  key: 2,
  class: "w-full"
}, Ko = { key: 0 }, Jo = /* @__PURE__ */ Te({
  __name: "FilterValueInput",
  props: /* @__PURE__ */ Nt({
    config: {
      type: Object,
      default: () => {
      }
    },
    option: {
      type: [String, null],
      default: () => {
      }
    }
  }, {
    modelValue: { required: !0, default: () => [] },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(t) {
    const e = Ge(t, "modelValue"), n = t, o = Se([]);
    function r(l) {
      return (l ? ht(l) : ht()).format("HH:mm");
    }
    function i({ hour: l, minute: u }) {
      return ht().set("hour", l).set("minute", u).toISOString();
    }
    function a(l, u) {
      var y, _;
      const f = an(n.option), s = ln(n.option);
      ((y = n.config) == null ? void 0 : y.type) === Be.TextField && (f !== void 0 && u < f || s !== void 0 && u > s) && (o.value[l] = `Value must be between ${f} and ${s}`);
      const v = [...e.value];
      ((_ = n.config) == null ? void 0 : _.type) === Be.Timestamp ? v[l] = i({
        hour: Number(u.split(":")[0]),
        minute: Number(u.split(":")[1])
      }) : v[l] = u, e.value = v;
    }
    function c(l) {
      var u;
      if (l === 0)
        e.value = [(u = n.config) == null ? void 0 : u.default, ...e.value];
      else {
        const f = [...e.value];
        f.splice(l, 1), e.value = f;
      }
    }
    return (l, u) => {
      const f = N("FmSelect"), s = N("FmTextField"), v = N("FmTimePicker"), y = N("FmButton");
      return V(!0), ee(qe, null, on(new Array(e.value.length !== 0 ? e.value.length : 1), (_, b) => {
        var Y, q, T, M, L;
        return V(), ee("div", {
          key: b,
          class: "flex flex-row align-center gap-2 w-full"
        }, [
          ue("div", Go, [
            ((Y = n.config) == null ? void 0 : Y.type) === X(Be).Select ? (V(), Pe(f, {
              key: 0,
              "model-value": e.value[b],
              items: n.config.options,
              "onUpdate:modelValue": (W) => a(b, W)
            }, null, 8, ["model-value", "items", "onUpdate:modelValue"])) : ((q = n.config) == null ? void 0 : q.type) === X(Be).TextField ? (V(), Pe(s, {
              key: 1,
              "model-value": e.value[b],
              type: ((T = n.config) == null ? void 0 : T.dataType) === "number" ? "number" : "text",
              "helper-text": o.value[b] || void 0,
              "helper-state": "error",
              "onUpdate:modelValue": (W) => a(b, W)
            }, null, 8, ["model-value", "type", "helper-text", "onUpdate:modelValue"])) : ((M = n.config) == null ? void 0 : M.type) === X(Be).Timestamp ? (V(), ee("div", qo, [
              A(v, {
                "model-value": r(e.value[b]),
                "onUpdate:modelValue": (W) => a(b, W)
              }, null, 8, ["model-value", "onUpdate:modelValue"])
            ])) : ce("", !0)
          ]),
          ((L = n.config) == null ? void 0 : L.fixed) === !1 ? (V(), ee("div", Ko, [
            A(y, {
              icon: b === 0 ? "add" : "remove",
              onClick: (W) => c(b)
            }, null, 8, ["icon", "onClick"])
          ])) : ce("", !0)
        ]);
      }), 128);
    };
  }
}), On = [
  De.HourOfDay,
  De.DayOfMonth,
  De.DayOfWeek,
  De.MonthOfYear,
  De.TimeOfDay,
  De.DateTime
], Zo = On.filter(
  (t) => t !== De.DateTime
);
function Er(t) {
  return On.map((e) => ({
    label: t(`report.section.filter.${rn(e)}`),
    value: e
  }));
}
function Qo(t) {
  return Zo.map((e) => ({
    label: t(`report.section.filter.${rn(e)}`),
    value: e
  }));
}
const er = { class: "flex flex-col my-2 gap-8" }, tr = { class: "fm-typo-en-body-lg-600" }, nr = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, or = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, Sr = /* @__PURE__ */ Te({
  __name: "FilterSection",
  props: /* @__PURE__ */ Nt({
    options: {
      type: Array,
      default: () => []
    },
    label: {
      type: String,
      default: "title"
    }
  }, {
    modelValue: { required: !1, default: () => [] },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(t) {
    const { t: e, te: n } = Pt(), o = Ge(t, "modelValue"), r = t, i = Fe(() => e(`report.section.filter.${r.label}`)), a = Se(!1), c = Wn(), l = Fe(
      () => o.value.map((m, p) => {
        const E = r.options.find(
          (B) => B.schemaName === m.schemaName && B.name === m.name
        ), I = (E == null ? void 0 : E.labels) || [m.schemaName, m.name];
        return {
          index: p,
          label: I.map((B) => Yn(e, n, B, "other")).join(" "),
          value: m
        };
      })
    ), u = Se(o.value.length > 0 ? 0 : void 0);
    function f(m) {
      var p;
      a.value = !0, b.value = [], s.value = m != null && m.value ? JSON.parse(JSON.stringify(m.value)) : void 0, u.value = m == null ? void 0 : m.index, v.value = !!((p = s.value) != null && p.dataFormula), L();
    }
    const s = Se(void 0), v = Se(!1), y = Se(void 0), _ = Fe(
      () => r.options.find(
        (m) => {
          var p, E;
          return m.schemaName === ((p = s.value) == null ? void 0 : p.schemaName) && m.name === ((E = s.value) == null ? void 0 : E.name);
        }
      ) ?? {}
    ), b = Se([]);
    function Y(m) {
      var p;
      return (p = b.value.find((E) => E.option === m)) == null ? void 0 : p.value;
    }
    const q = Un(
      (m, p) => {
        const E = b.value.find((I) => I.option === m);
        E ? E.value = p : b.value.push({ option: m, value: p });
      },
      300
    );
    pt(
      [() => {
        var m;
        return (m = s.value) == null ? void 0 : m.option;
      }, () => {
        var m;
        return (m = s.value) == null ? void 0 : m.values;
      }],
      ([m, p]) => {
        m !== void 0 && Array.isArray(p) && q(m, p);
      },
      { deep: !0 }
    ), pt(
      () => {
        var m;
        return (m = s.value) == null ? void 0 : m.option;
      },
      (m, p) => {
        p !== void 0 && m !== p && s.value && (L(), T(m), M());
      }
    ), pt(
      () => {
        var m;
        return (m = s.value) == null ? void 0 : m.operator;
      },
      (m, p) => {
        m !== p && _.value && s.value && (L(), T(s.value.option), M());
      },
      {
        deep: !0
      }
    );
    function T(m) {
      var z;
      if (!s.value || !y.value) return;
      const p = u.value !== void 0 && o.value[u.value] && Array.isArray(o.value[u.value].values) ? [...o.value[u.value].values] : [], E = Y(m);
      let I;
      const B = u.value !== void 0 ? (z = o.value[u.value]) == null ? void 0 : z.option : void 0;
      Array.isArray(E) ? I = E : p.length > 0 && m === B ? I = p : I = [y.value.default], s.value = {
        ...s.value,
        values: I
      };
    }
    function M() {
      if (!y.value || !s.value) return;
      const m = s.value.values.length - y.value.count;
      m > 0 && y.value.fixed ? s.value = {
        ...s.value,
        values: s.value.values.slice(0, y.value.count)
      } : m < 0 && (s.value = {
        ...s.value,
        values: [...s.value.values, ...Array(Math.abs(m)).fill(y.value.default)]
      });
    }
    function L() {
      _.value && s.value && (y.value = Xn({
        operator: s.value.operator,
        dataType: _.value.type,
        dimensionOption: s.value.option,
        t: e
      }));
    }
    function W(m) {
      var p, E;
      (m.schemaName !== ((p = s.value) == null ? void 0 : p.schemaName) || m.name !== ((E = s.value) == null ? void 0 : E.name)) && (s.value = {
        schemaName: m.schemaName,
        name: m.name,
        operator: m.filterOperators[0],
        option: m.filterDimensionOptions[0],
        values: []
      }, L(), T(s.value.option), M());
    }
    function te() {
      var p, E, I;
      const m = [...l.value.map((B) => B.value)];
      if (s.value) {
        v.value || (s.value.dataFormula = void 0);
        const B = an((p = s.value) == null ? void 0 : p.option), z = ln((E = s.value) == null ? void 0 : E.option), pe = (I = s.value.values) == null ? void 0 : I.map(
          ($, Le) => $ == null || $ === "" || !ye($, B, z) ? Le : null
        ).filter(($) => $ !== null);
        if (!s.value.values || pe.length > 0) {
          c.open({ message: "One or more values are invalid", type: "error" });
          return;
        }
        s.value.values = s.value.values.filter(
          ($) => $ !== "" && $ !== null
        ), u.value !== void 0 ? m[Number(u.value)] = s.value : m.push(s.value), o.value = m;
      }
      a.value = !1;
    }
    function se(m) {
      const p = [...l.value.map((E) => E.value)];
      p.splice(m, 1), o.value = p, a.value = !1;
    }
    const be = Fe(
      () => r.options.map((m) => ({
        label: m.labels.join(" "),
        value: m
      }))
    ), H = Fe(() => Qo(e));
    function ye(m, p, E) {
      return !(p !== void 0 && m < p || E !== void 0 && m > E);
    }
    return (m, p) => {
      const E = N("FmCheckbox"), I = N("FmTextarea"), B = N("FmSelect"), z = N("FmForm"), pe = N("FmIcon"), $ = N("FmButton"), Le = N("FmListItem"), $t = N("FmList"), Ze = N("FmField");
      return V(), ee("div", er, [
        A(Bn, {
          modelValue: a.value,
          "onUpdate:modelValue": p[6] || (p[6] = (_e) => a.value = _e),
          title: i.value,
          "primary-button-label": X(e)("report.common.confirm"),
          "secondary-button-label": X(e)("report.common.cancel"),
          onConfirm: te
        }, {
          content: ie(() => [
            A(z, {
              ref: "form",
              class: "flex flex-col gap-2 w-[490px]"
            }, {
              default: ie(() => {
                var _e, xe;
                return [
                  A(Wt, {
                    "model-value": _.value,
                    items: be.value,
                    placeholder: i.value,
                    label: i.value,
                    "onUpdate:modelValue": p[0] || (p[0] = (U) => W(U))
                  }, null, 8, ["model-value", "items", "placeholder", "label"]),
                  s.value ? (V(), ee(qe, { key: 0 }, [
                    A(E, {
                      modelValue: v.value,
                      "onUpdate:modelValue": p[1] || (p[1] = (U) => v.value = U),
                      label: X(e)("report.section.filter.advance"),
                      value: !0
                    }, null, 8, ["modelValue", "label"]),
                    v.value ? (V(), Pe(I, {
                      key: 0,
                      modelValue: s.value.dataFormula,
                      "onUpdate:modelValue": p[2] || (p[2] = (U) => s.value.dataFormula = U),
                      placeholder: X(e)("report.section.filter.dataFormula")
                    }, null, 8, ["modelValue", "placeholder"])) : ce("", !0),
                    A(B, {
                      modelValue: s.value.option,
                      "onUpdate:modelValue": p[3] || (p[3] = (U) => s.value.option = U),
                      items: H.value,
                      placeholder: X(e)("report.section.filter.timeFormatter"),
                      label: X(e)("report.section.filter.timeFormatter")
                    }, null, 8, ["modelValue", "items", "placeholder", "label"]),
                    (((_e = _.value) == null ? void 0 : _e.filterOperators) || []).length > 0 ? (V(), Pe(Wt, {
                      key: 1,
                      modelValue: s.value.operator,
                      "onUpdate:modelValue": p[4] || (p[4] = (U) => s.value.operator = U),
                      items: (((xe = _.value) == null ? void 0 : xe.filterOperators) ?? []).map((U) => ({
                        label: X(e)("report.section.comparisonOperator." + U),
                        value: U
                      }))
                    }, null, 8, ["modelValue", "items"])) : ce("", !0),
                    y.value ? (V(), Pe(Jo, {
                      key: s.value.option ?? "",
                      modelValue: s.value.values,
                      "onUpdate:modelValue": p[5] || (p[5] = (U) => s.value.values = U),
                      config: y.value,
                      option: s.value.option
                    }, null, 8, ["modelValue", "config", "option"])) : ce("", !0)
                  ], 64)) : ce("", !0)
                ];
              }),
              _: 1
            }, 512)
          ]),
          _: 1
        }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
        ue("div", null, [
          ue("p", tr, Ae(i.value), 1),
          ue("p", nr, Ae(X(e)("report.section.filter.description")), 1)
        ]),
        A($t, null, {
          default: ie(() => [
            A(X(Yo), {
              list: o.value,
              "item-key": "id",
              class: "flex flex-col gap-2 w-full"
            }, {
              item: ie(({ element: _e, index: xe }) => [
                A(Le, {
                  class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
                  onClick: Yt((U) => f(l.value[xe]), ["stop"])
                }, {
                  default: ie(() => [
                    A(pe, { name: "drag_handle" }),
                    ue("p", or, Ae(l.value[xe].label), 1),
                    p[8] || (p[8] = ue("div", { class: "grow" }, null, -1)),
                    A($, {
                      icon: "close",
                      size: "md",
                      variant: "tertiary",
                      onClick: Yt((U) => se(xe), ["stop"])
                    }, null, 8, ["onClick"])
                  ]),
                  _: 2
                }, 1032, ["onClick"])
              ]),
              _: 1
            }, 8, ["list"])
          ]),
          _: 1
        }),
        A(Ze, {
          class: "text-fm-color-typo-tertiary",
          onClick: p[7] || (p[7] = () => {
            f();
          })
        }, {
          default: ie(() => [
            Nn(Ae(X(e)("report.section.filter.add")), 1)
          ]),
          _: 1
        })
      ]);
    };
  }
}), rr = /* @__PURE__ */ Te({
  __name: "TransitionFade",
  props: {
    modelValue: { type: Boolean, required: !0, default: !0 },
    modelModifiers: {}
  },
  emits: ["update:modelValue"],
  setup(t) {
    const e = Ge(t, "modelValue");
    return (n, o) => (V(), ee(qe, null, [
      A(xt, { name: "slide-fade-right" }, {
        default: ie(() => [
          e.value ? ze(n.$slots, "right", { key: 0 }, void 0, !0) : ce("", !0)
        ]),
        _: 3
      }),
      A(xt, { name: "slide-fade-left" }, {
        default: ie(() => [
          e.value ? ce("", !0) : ze(n.$slots, "left", { key: 0 }, void 0, !0)
        ]),
        _: 3
      })
    ], 64));
  }
}), Dr = /* @__PURE__ */ Vt(rr, [["__scopeId", "data-v-a98ca9bc"]]);
export {
  wr as S,
  Dr as T,
  br as W,
  Jo as _,
  Sr as a,
  vr as b,
  jo as c,
  Yo as d,
  Er as g,
  _r as h,
  yr as i
};
