import { defineComponent as Ce, onBeforeMount as xn, onBeforeUnmount as On, resolveComponent as N, createElementBlock as Q, openBlock as V, normalizeStyle as In, unref as M, renderSlot as Ge, createVNode as k, createElementVNode as be, toDisplayString as Pe, TransitionGroup as Fn, nextTick as en, h as $t, mergeModels as Nt, useModel as ze, computed as ke, Fragment as qe, renderList as tn, createBlock as Me, normalizeClass as kn, withCtx as le, createTextVNode as nn, Transition as xt, createCommentVNode as fe, ref as De, watch as pt, withModifiers as Rt } from "vue";
import { u as Pt, f as An, p as Nn, d as ht, i as Pn } from "./vue-i18n-DG0DIzwC.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 L, D as Ze, c as z, C as de, _ as Bn } from "./BaseDialog.vue_vue_type_script_setup_true_lang-BqtS2XG4.js";
import { a as Vt, _ as Yt } from "./SelectComponent.vue_vue_type_script_setup_true_lang-kzXPr73e.js";
import { R as $n } from "./DynamicWidget.vue_vue_type_script_setup_true_lang-FhZDnXkv.js";
import { useSnackbar as Rn } from "@feedmepos/ui-library";
import { a as Yn } from "./helper-C0VLdBRU.js";
const Wn = {
  key: 0,
  class: "flex gap-24 flex-col h-screen w-screen justify-center items-center"
}, Xn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, fr = /* @__PURE__ */ Ce({
  __name: "FullScreen",
  setup(t) {
    const { t: e } = Pt(), n = Ln(), { isLoading: o } = Mn(An()), r = Vn();
    return xn(() => {
      r.hideSidebarToggle(!0);
    }), On(() => {
      r.hideSidebarToggle(!1);
    }), (a, i) => {
      const u = N("FmCircularProgress");
      return V(), Q("div", {
        class: "mx-auto",
        style: In({
          height: `calc(100vh - ${M(n).query.token && M(n).query.businessId ? "0" : "64"}px)`
        })
      }, [
        M(o) ? (V(), Q("div", Wn, [
          k(u, { size: "xl" }),
          be("span", Xn, Pe(M(e)("report.common.isLoading")), 1)
        ])) : Ge(a.$slots, "default", { key: 1 })
      ], 4);
    };
  }
});
/**!
 * Sortable 1.14.0
 * @author	RubaXa   <trash@rubaxa.org>
 * @author	owenm    <owen23355@gmail.com>
 * @license MIT
 */
function Wt(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 ue(t) {
  for (var e = 1; e < arguments.length; e++) {
    var n = arguments[e] != null ? arguments[e] : {};
    e % 2 ? Wt(Object(n), !0).forEach(function(o) {
      Hn(t, o, n[o]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Wt(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 Hn(t, e, n) {
  return e in t ? Object.defineProperty(t, e, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : t[e] = n, t;
}
function pe() {
  return pe = 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;
  }, pe.apply(this, arguments);
}
function Un(t, e) {
  if (t == null) return {};
  var n = {}, o = Object.keys(t), r, a;
  for (a = 0; a < o.length; a++)
    r = o[a], !(e.indexOf(r) >= 0) && (n[r] = t[r]);
  return n;
}
function jn(t, e) {
  if (t == null) return {};
  var n = Un(t, e), o, r;
  if (Object.getOwnPropertySymbols) {
    var a = Object.getOwnPropertySymbols(t);
    for (r = 0; r < a.length; r++)
      o = a[r], !(e.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(t, o) && (n[o] = t[o]);
  }
  return n;
}
var Gn = "1.14.0";
function me(t) {
  if (typeof window < "u" && window.navigator)
    return !!/* @__PURE__ */ navigator.userAgent.match(t);
}
var he = me(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Ke = me(/Edge/i), Xt = me(/firefox/i), We = me(/safari/i) && !me(/chrome/i) && !me(/android/i), on = me(/iP(ad|od|hone)/i), zn = me(/chrome/i) && me(/android/i), rn = {
  capture: !1,
  passive: !1
};
function D(t, e, n) {
  t.addEventListener(e, n, !he && rn);
}
function S(t, e, n) {
  t.removeEventListener(e, n, !he && rn);
}
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 qn(t) {
  return t.host && t !== document && t.host.nodeType ? t.host : t.parentNode;
}
function ie(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 = qn(t));
  }
  return null;
}
var Ht = /\s+/g;
function K(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 g(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 Le(t, e) {
  var n = "";
  if (typeof t == "string")
    n = t;
  else
    do {
      var o = g(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 an(t, e, n) {
  if (t) {
    var o = t.getElementsByTagName(e), r = 0, a = o.length;
    if (n)
      for (; r < a; r++)
        n(o[r], r);
    return o;
  }
  return [];
}
function se() {
  var t = document.scrollingElement;
  return t || document.documentElement;
}
function P(t, e, n, o, r) {
  if (!(!t.getBoundingClientRect && t !== window)) {
    var a, i, u, s, c, l, f;
    if (t !== window && t.parentNode && t !== se() ? (a = t.getBoundingClientRect(), i = a.top, u = a.left, s = a.bottom, c = a.right, l = a.height, f = a.width) : (i = 0, u = 0, s = window.innerHeight, c = window.innerWidth, l = window.innerHeight, f = window.innerWidth), (e || n) && t !== window && (r = r || t.parentNode, !he))
      do
        if (r && r.getBoundingClientRect && (g(r, "transform") !== "none" || n && g(r, "position") !== "static")) {
          var h = r.getBoundingClientRect();
          i -= h.top + parseInt(g(r, "border-top-width")), u -= h.left + parseInt(g(r, "border-left-width")), s = i + a.height, c = u + a.width;
          break;
        }
      while (r = r.parentNode);
    if (o && t !== window) {
      var w = Le(r || t), b = w && w.a, y = w && w.d;
      w && (i /= y, u /= b, f /= b, l /= y, s = i + l, c = u + f);
    }
    return {
      top: i,
      left: u,
      bottom: s,
      right: c,
      width: f,
      height: l
    };
  }
}
function Ut(t, e, n) {
  for (var o = _e(t, !0), r = P(t)[e]; o; ) {
    var a = P(o)[n], i = void 0;
    if (i = r >= a, !i) return o;
    if (o === se()) break;
    o = _e(o, !1);
  }
  return !1;
}
function Be(t, e, n, o) {
  for (var r = 0, a = 0, i = t.children; a < i.length; ) {
    if (i[a].style.display !== "none" && i[a] !== v.ghost && (o || i[a] !== v.dragged) && ie(i[a], n.draggable, t, !1)) {
      if (r === e)
        return i[a];
      r++;
    }
    a++;
  }
  return null;
}
function Mt(t, e) {
  for (var n = t.lastElementChild; n && (n === v.ghost || g(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 !== v.clone && (!e || st(t, e)) && n++;
  return n;
}
function jt(t) {
  var e = 0, n = 0, o = se();
  if (t)
    do {
      var r = Le(t), a = r.a, i = r.d;
      e += t.scrollLeft * a, n += t.scrollTop * i;
    } while (t !== o && (t = t.parentNode));
  return [e, n];
}
function Kn(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 _e(t, e) {
  if (!t || !t.getBoundingClientRect) return se();
  var n = t, o = !1;
  do
    if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
      var r = g(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 se();
        if (o || e) return n;
        o = !0;
      }
    }
  while (n = n.parentNode);
  return se();
}
function Jn(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 Xe;
function ln(t, e) {
  return function() {
    if (!Xe) {
      var n = arguments, o = this;
      n.length === 1 ? t.call(o, n[0]) : t.apply(o, n), Xe = setTimeout(function() {
        Xe = void 0;
      }, e);
    }
  };
}
function Zn() {
  clearTimeout(Xe), Xe = void 0;
}
function sn(t, e, n) {
  t.scrollLeft += e, t.scrollTop += n;
}
function un(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 Z = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
function Qn() {
  var t = [], e;
  return {
    captureAnimationState: function() {
      if (t = [], !!this.options.animation) {
        var o = [].slice.call(this.el.children);
        o.forEach(function(r) {
          if (!(g(r, "display") === "none" || r === v.ghost)) {
            t.push({
              target: r,
              rect: P(r)
            });
            var a = ue({}, t[t.length - 1].rect);
            if (r.thisAnimationDuration) {
              var i = Le(r, !0);
              i && (a.top -= i.f, a.left -= i.e);
            }
            r.fromRect = a;
          }
        });
      }
    },
    addAnimationState: function(o) {
      t.push(o);
    },
    removeAnimationState: function(o) {
      t.splice(Kn(t, {
        target: o
      }), 1);
    },
    animateAll: function(o) {
      var r = this;
      if (!this.options.animation) {
        clearTimeout(e), typeof o == "function" && o();
        return;
      }
      var a = !1, i = 0;
      t.forEach(function(u) {
        var s = 0, c = u.target, l = c.fromRect, f = P(c), h = c.prevFromRect, w = c.prevToRect, b = u.rect, y = Le(c, !0);
        y && (f.top -= y.f, f.left -= y.e), c.toRect = f, c.thisAnimationDuration && gt(h, f) && !gt(l, f) && // Make sure animatingRect is on line between toRect & fromRect
        (b.top - f.top) / (b.left - f.left) === (l.top - f.top) / (l.left - f.left) && (s = to(b, h, w, r.options)), gt(f, l) || (c.prevFromRect = l, c.prevToRect = f, s || (s = r.options.animation), r.animate(c, b, f, s)), s && (a = !0, i = Math.max(i, s), clearTimeout(c.animationResetTimer), c.animationResetTimer = setTimeout(function() {
          c.animationTime = 0, c.prevFromRect = null, c.fromRect = null, c.prevToRect = null, c.thisAnimationDuration = null;
        }, s), c.thisAnimationDuration = s);
      }), clearTimeout(e), a ? e = setTimeout(function() {
        typeof o == "function" && o();
      }, i) : typeof o == "function" && o(), t = [];
    },
    animate: function(o, r, a, i) {
      if (i) {
        g(o, "transition", ""), g(o, "transform", "");
        var u = Le(this.el), s = u && u.a, c = u && u.d, l = (r.left - a.left) / (s || 1), f = (r.top - a.top) / (c || 1);
        o.animatingX = !!l, o.animatingY = !!f, g(o, "transform", "translate3d(" + l + "px," + f + "px,0)"), this.forRepaintDummy = eo(o), g(o, "transition", "transform " + i + "ms" + (this.options.easing ? " " + this.options.easing : "")), g(o, "transform", "translate3d(0,0,0)"), typeof o.animated == "number" && clearTimeout(o.animated), o.animated = setTimeout(function() {
          g(o, "transition", ""), g(o, "transform", ""), o.animated = !1, o.animatingX = !1, o.animatingY = !1;
        }, i);
      }
    }
  };
}
function eo(t) {
  return t.offsetWidth;
}
function to(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 Ie = [], vt = {
  initializeByDefault: !0
}, Je = {
  mount: function(e) {
    for (var n in vt)
      vt.hasOwnProperty(n) && !(n in e) && (e[n] = vt[n]);
    Ie.forEach(function(o) {
      if (o.pluginName === e.pluginName)
        throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
    }), Ie.push(e);
  },
  pluginEvent: function(e, n, o) {
    var r = this;
    this.eventCanceled = !1, o.cancel = function() {
      r.eventCanceled = !0;
    };
    var a = e + "Global";
    Ie.forEach(function(i) {
      n[i.pluginName] && (n[i.pluginName][a] && n[i.pluginName][a](ue({
        sortable: n
      }, o)), n.options[i.pluginName] && n[i.pluginName][e] && n[i.pluginName][e](ue({
        sortable: n
      }, o)));
    });
  },
  initializePlugins: function(e, n, o, r) {
    Ie.forEach(function(u) {
      var s = u.pluginName;
      if (!(!e.options[s] && !u.initializeByDefault)) {
        var c = new u(e, n, e.options);
        c.sortable = e, c.options = e.options, e[s] = c, pe(o, c.defaults);
      }
    });
    for (var a in e.options)
      if (e.options.hasOwnProperty(a)) {
        var i = this.modifyOption(e, a, e.options[a]);
        typeof i < "u" && (e.options[a] = i);
      }
  },
  getEventProperties: function(e, n) {
    var o = {};
    return Ie.forEach(function(r) {
      typeof r.eventProperties == "function" && pe(o, r.eventProperties.call(n[r.pluginName], e));
    }), o;
  },
  modifyOption: function(e, n, o) {
    var r;
    return Ie.forEach(function(a) {
      e[a.pluginName] && a.optionListeners && typeof a.optionListeners[n] == "function" && (r = a.optionListeners[n].call(e[a.pluginName], o));
    }), r;
  }
};
function no(t) {
  var e = t.sortable, n = t.rootEl, o = t.name, r = t.targetEl, a = t.cloneEl, i = t.toEl, u = t.fromEl, s = t.oldIndex, c = t.newIndex, l = t.oldDraggableIndex, f = t.newDraggableIndex, h = t.originalEvent, w = t.putSortable, b = t.extraEventProperties;
  if (e = e || n && n[Z], !!e) {
    var y, Y = e.options, B = "on" + o.charAt(0).toUpperCase() + o.substr(1);
    window.CustomEvent && !he && !Ke ? y = new CustomEvent(o, {
      bubbles: !0,
      cancelable: !0
    }) : (y = document.createEvent("Event"), y.initEvent(o, !0, !0)), y.to = i || n, y.from = u || n, y.item = r || n, y.clone = a, y.oldIndex = s, y.newIndex = c, y.oldDraggableIndex = l, y.newDraggableIndex = f, y.originalEvent = h, y.pullMode = w ? w.lastPutMode : void 0;
    var I = ue(ue({}, b), Je.getEventProperties(o, e));
    for (var W in I)
      y[W] = I[W];
    n && n.dispatchEvent(y), Y[B] && Y[B].call(e, y);
  }
}
var oo = ["evt"], G = function(e, n) {
  var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = o.evt, a = jn(o, oo);
  Je.pluginEvent.bind(v)(e, n, ue({
    dragEl: d,
    parentEl: C,
    ghostEl: _,
    rootEl: T,
    nextEl: Te,
    lastDownEl: rt,
    cloneEl: x,
    cloneHidden: ye,
    dragStarted: $e,
    putSortable: R,
    activeSortable: v.active,
    originalEvent: r,
    oldIndex: Ve,
    oldDraggableIndex: He,
    newIndex: J,
    newDraggableIndex: ve,
    hideGhostForTarget: mn,
    unhideGhostForTarget: pn,
    cloneNowHidden: function() {
      ye = !0;
    },
    cloneNowShown: function() {
      ye = !1;
    },
    dispatchSortableEvent: function(u) {
      j({
        sortable: n,
        name: u,
        originalEvent: r
      });
    }
  }, a));
};
function j(t) {
  no(ue({
    putSortable: R,
    cloneEl: x,
    targetEl: d,
    rootEl: T,
    oldIndex: Ve,
    oldDraggableIndex: He,
    newIndex: J,
    newDraggableIndex: ve
  }, t));
}
var d, C, _, T, Te, rt, x, ye, Ve, J, He, ve, Qe, R, Ae = !1, ut = !1, ct = [], Ee, ae, bt, yt, Gt, zt, $e, Fe, Ue, je = !1, et = !1, at, H, _t = [], Ot = !1, dt = [], mt = typeof document < "u", tt = on, qt = Ke || he ? "cssFloat" : "float", ro = mt && !zn && !on && "draggable" in document.createElement("div"), cn = function() {
  if (mt) {
    if (he)
      return !1;
    var t = document.createElement("x");
    return t.style.cssText = "pointer-events:auto", t.style.pointerEvents === "auto";
  }
}(), dn = function(e, n) {
  var o = g(e), r = parseInt(o.width) - parseInt(o.paddingLeft) - parseInt(o.paddingRight) - parseInt(o.borderLeftWidth) - parseInt(o.borderRightWidth), a = Be(e, 0, n), i = Be(e, 1, n), u = a && g(a), s = i && g(i), c = u && parseInt(u.marginLeft) + parseInt(u.marginRight) + P(a).width, l = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + P(i).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 (a && u.float && u.float !== "none") {
    var f = u.float === "left" ? "left" : "right";
    return i && (s.clear === "both" || s.clear === f) ? "vertical" : "horizontal";
  }
  return a && (u.display === "block" || u.display === "flex" || u.display === "table" || u.display === "grid" || c >= r && o[qt] === "none" || i && o[qt] === "none" && c + l > r) ? "vertical" : "horizontal";
}, ao = function(e, n, o) {
  var r = o ? e.left : e.top, a = o ? e.right : e.bottom, i = o ? e.width : e.height, u = o ? n.left : n.top, s = o ? n.right : n.bottom, c = o ? n.width : n.height;
  return r === u || a === s || r + i / 2 === u + c / 2;
}, io = function(e, n) {
  var o;
  return ct.some(function(r) {
    var a = r[Z].options.emptyInsertThreshold;
    if (!(!a || Mt(r))) {
      var i = P(r), u = e >= i.left - a && e <= i.right + a, s = n >= i.top - a && n <= i.bottom + a;
      if (u && s)
        return o = r;
    }
  }), o;
}, fn = function(e) {
  function n(a, i) {
    return function(u, s, c, l) {
      var f = u.options.group.name && s.options.group.name && u.options.group.name === s.options.group.name;
      if (a == null && (i || f))
        return !0;
      if (a == null || a === !1)
        return !1;
      if (i && a === "clone")
        return a;
      if (typeof a == "function")
        return n(a(u, s, c, l), i)(u, s, c, l);
      var h = (i ? u : s).options.group.name;
      return a === !0 || typeof a == "string" && a === h || a.join && a.indexOf(h) > -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;
}, mn = function() {
  !cn && _ && g(_, "display", "none");
}, pn = function() {
  !cn && _ && g(_, "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 Se = function(e) {
  if (d) {
    e = e.touches ? e.touches[0] : e;
    var n = io(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[Z]._onDragOver(o);
    }
  }
}, lo = function(e) {
  d && d.parentNode[Z]._isOutsideThisEl(e.target);
};
function v(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 = pe({}, e), t[Z] = 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 dn(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(i, u) {
      i.setData("Text", u.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: v.supportPointer !== !1 && "PointerEvent" in window && !We,
    emptyInsertThreshold: 5
  };
  Je.initializePlugins(this, t, n);
  for (var o in n)
    !(o in e) && (e[o] = n[o]);
  fn(e);
  for (var r in this)
    r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this));
  this.nativeDraggable = e.forceFallback ? !1 : ro, 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) || []), pe(this, Qn());
}
v.prototype = /** @lends Sortable.prototype */
{
  constructor: v,
  _isOutsideThisEl: function(e) {
    !this.el.contains(e) && e !== this.el && (Fe = 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, a = r.preventOnFilter, i = e.type, u = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (u || e).target, c = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, l = r.filter;
      if (go(o), !d && !(/mousedown|pointerdown/.test(i) && e.button !== 0 || r.disabled) && !c.isContentEditable && !(!this.nativeDraggable && We && s && s.tagName.toUpperCase() === "SELECT") && (s = ie(s, r.draggable, o, !1), !(s && s.animated) && rt !== s)) {
        if (Ve = ne(s), He = ne(s, r.draggable), typeof l == "function") {
          if (l.call(this, e, s, this)) {
            j({
              sortable: n,
              rootEl: c,
              name: "filter",
              targetEl: s,
              toEl: o,
              fromEl: o
            }), G("filter", n, {
              evt: e
            }), a && e.cancelable && e.preventDefault();
            return;
          }
        } else if (l && (l = l.split(",").some(function(f) {
          if (f = ie(c, f.trim(), o, !1), f)
            return j({
              sortable: n,
              rootEl: f,
              name: "filter",
              targetEl: s,
              fromEl: o,
              toEl: o
            }), G("filter", n, {
              evt: e
            }), !0;
        }), l)) {
          a && e.cancelable && e.preventDefault();
          return;
        }
        r.handle && !ie(c, r.handle, o, !1) || this._prepareDragStart(e, u, s);
      }
    }
  },
  _prepareDragStart: function(e, n, o) {
    var r = this, a = r.el, i = r.options, u = a.ownerDocument, s;
    if (o && !d && o.parentNode === a) {
      var c = P(o);
      if (T = a, d = o, C = d.parentNode, Te = d.nextSibling, rt = o, Qe = i.group, v.dragged = d, Ee = {
        target: d,
        clientX: (n || e).clientX,
        clientY: (n || e).clientY
      }, Gt = Ee.clientX - c.left, zt = Ee.clientY - c.top, this._lastX = (n || e).clientX, this._lastY = (n || e).clientY, d.style["will-change"] = "all", s = function() {
        if (G("delayEnded", r, {
          evt: e
        }), v.eventCanceled) {
          r._onDrop();
          return;
        }
        r._disableDelayedDragEvents(), !Xt && r.nativeDraggable && (d.draggable = !0), r._triggerDragStart(e, n), j({
          sortable: r,
          name: "choose",
          originalEvent: e
        }), K(d, i.chosenClass, !0);
      }, i.ignore.split(",").forEach(function(l) {
        an(d, l.trim(), wt);
      }), D(u, "dragover", Se), D(u, "mousemove", Se), D(u, "touchmove", Se), D(u, "mouseup", r._onDrop), D(u, "touchend", r._onDrop), D(u, "touchcancel", r._onDrop), Xt && this.nativeDraggable && (this.options.touchStartThreshold = 4, d.draggable = !0), G("delayStart", this, {
        evt: e
      }), i.delay && (!i.delayOnTouchOnly || n) && (!this.nativeDraggable || !(Ke || he))) {
        if (v.eventCanceled) {
          this._onDrop();
          return;
        }
        D(u, "mouseup", r._disableDelayedDrag), D(u, "touchend", r._disableDelayedDrag), D(u, "touchcancel", r._disableDelayedDrag), D(u, "mousemove", r._delayedDragTouchMoveHandler), D(u, "touchmove", r._delayedDragTouchMoveHandler), i.supportPointer && D(u, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(s, i.delay);
      } else
        s();
    }
  },
  _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(T, "dragstart", this._onDragStart));
    try {
      document.selection ? it(function() {
        document.selection.empty();
      }) : window.getSelection().removeAllRanges();
    } catch {
    }
  },
  _dragStarted: function(e, n) {
    if (Ae = !1, T && d) {
      G("dragStarted", this, {
        evt: n
      }), this.nativeDraggable && D(document, "dragover", lo);
      var o = this.options;
      !e && K(d, o.dragClass, !1), K(d, o.ghostClass, !0), v.active = this, e && this._appendGhost(), j({
        sortable: this,
        name: "start",
        originalEvent: n
      });
    } else
      this._nulling();
  },
  _emulateDragOver: function() {
    if (ae) {
      this._lastX = ae.clientX, this._lastY = ae.clientY, mn();
      for (var e = document.elementFromPoint(ae.clientX, ae.clientY), n = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(ae.clientX, ae.clientY), e !== n); )
        n = e;
      if (d.parentNode[Z]._isOutsideThisEl(e), n)
        do {
          if (n[Z]) {
            var o = void 0;
            if (o = n[Z]._onDragOver({
              clientX: ae.clientX,
              clientY: ae.clientY,
              target: e,
              rootEl: n
            }), o && !this.options.dragoverBubble)
              break;
          }
          e = n;
        } while (n = n.parentNode);
      pn();
    }
  },
  _onTouchMove: function(e) {
    if (Ee) {
      var n = this.options, o = n.fallbackTolerance, r = n.fallbackOffset, a = e.touches ? e.touches[0] : e, i = _ && Le(_, !0), u = _ && i && i.a, s = _ && i && i.d, c = tt && H && jt(H), l = (a.clientX - Ee.clientX + r.x) / (u || 1) + (c ? c[0] - _t[0] : 0) / (u || 1), f = (a.clientY - Ee.clientY + r.y) / (s || 1) + (c ? c[1] - _t[1] : 0) / (s || 1);
      if (!v.active && !Ae) {
        if (o && Math.max(Math.abs(a.clientX - this._lastX), Math.abs(a.clientY - this._lastY)) < o)
          return;
        this._onDragStart(e, !0);
      }
      if (_) {
        i ? (i.e += l - (bt || 0), i.f += f - (yt || 0)) : i = {
          a: 1,
          b: 0,
          c: 0,
          d: 1,
          e: l,
          f
        };
        var h = "matrix(".concat(i.a, ",").concat(i.b, ",").concat(i.c, ",").concat(i.d, ",").concat(i.e, ",").concat(i.f, ")");
        g(_, "webkitTransform", h), g(_, "mozTransform", h), g(_, "msTransform", h), g(_, "transform", h), bt = l, yt = f, ae = a;
      }
      e.cancelable && e.preventDefault();
    }
  },
  _appendGhost: function() {
    if (!_) {
      var e = this.options.fallbackOnBody ? document.body : T, n = P(d, !0, tt, !0, e), o = this.options;
      if (tt) {
        for (H = e; g(H, "position") === "static" && g(H, "transform") === "none" && H !== document; )
          H = H.parentNode;
        H !== document.body && H !== document.documentElement ? (H === document && (H = se()), n.top += H.scrollTop, n.left += H.scrollLeft) : H = se(), _t = jt(H);
      }
      _ = d.cloneNode(!0), K(_, o.ghostClass, !1), K(_, o.fallbackClass, !0), K(_, o.dragClass, !0), g(_, "transition", ""), g(_, "transform", ""), g(_, "box-sizing", "border-box"), g(_, "margin", 0), g(_, "top", n.top), g(_, "left", n.left), g(_, "width", n.width), g(_, "height", n.height), g(_, "opacity", "0.8"), g(_, "position", tt ? "absolute" : "fixed"), g(_, "zIndex", "100000"), g(_, "pointerEvents", "none"), v.ghost = _, e.appendChild(_), g(_, "transform-origin", Gt / parseInt(_.style.width) * 100 + "% " + zt / parseInt(_.style.height) * 100 + "%");
    }
  },
  _onDragStart: function(e, n) {
    var o = this, r = e.dataTransfer, a = o.options;
    if (G("dragStart", this, {
      evt: e
    }), v.eventCanceled) {
      this._onDrop();
      return;
    }
    G("setupClone", this), v.eventCanceled || (x = un(d), x.draggable = !1, x.style["will-change"] = "", this._hideClone(), K(x, this.options.chosenClass, !1), v.clone = x), o.cloneId = it(function() {
      G("clone", o), !v.eventCanceled && (o.options.removeCloneOnHide || T.insertBefore(x, d), o._hideClone(), j({
        sortable: o,
        name: "clone"
      }));
    }), !n && K(d, a.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", a.setData && a.setData.call(o, r, d)), D(document, "drop", o), g(d, "transform", "translateZ(0)")), Ae = !0, o._dragStartId = it(o._dragStarted.bind(o, n, e)), D(document, "selectstart", o), $e = !0, We && g(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, a, i, u = this.options, s = u.group, c = v.active, l = Qe === s, f = u.sort, h = R || c, w, b = this, y = !1;
    if (Ot) return;
    function Y(we, ge) {
      G(we, b, ue({
        evt: e,
        isOwner: l,
        axis: w ? "vertical" : "horizontal",
        revert: i,
        dragRect: r,
        targetRect: a,
        canSort: f,
        fromSortable: h,
        target: o,
        completed: I,
        onMove: function(A, Cn) {
          return nt(T, n, d, r, A, P(A), e, Cn);
        },
        changed: W
      }, ge));
    }
    function B() {
      Y("dragOverAnimationCapture"), b.captureAnimationState(), b !== h && h.captureAnimationState();
    }
    function I(we) {
      return Y("dragOverCompleted", {
        insertion: we
      }), we && (l ? c._hideClone() : c._showClone(b), b !== h && (K(d, R ? R.options.ghostClass : c.options.ghostClass, !1), K(d, u.ghostClass, !0)), R !== b && b !== v.active ? R = b : b === v.active && R && (R = null), h === b && (b._ignoreWhileAnimating = o), b.animateAll(function() {
        Y("dragOverAnimationComplete"), b._ignoreWhileAnimating = null;
      }), b !== h && (h.animateAll(), h._ignoreWhileAnimating = null)), (o === d && !d.animated || o === n && !o.animated) && (Fe = null), !u.dragoverBubble && !e.rootEl && o !== document && (d.parentNode[Z]._isOutsideThisEl(e.target), !we && Se(e)), !u.dragoverBubble && e.stopPropagation && e.stopPropagation(), y = !0;
    }
    function W() {
      J = ne(d), ve = ne(d, u.draggable), j({
        sortable: b,
        name: "change",
        toEl: n,
        newIndex: J,
        newDraggableIndex: ve,
        originalEvent: e
      });
    }
    if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), o = ie(o, u.draggable, n, !0), Y("dragOver"), v.eventCanceled) return y;
    if (d.contains(e.target) || o.animated && o.animatingX && o.animatingY || b._ignoreWhileAnimating === o)
      return I(!1);
    if (ut = !1, c && !u.disabled && (l ? f || (i = C !== T) : R === this || (this.lastPutMode = Qe.checkPull(this, c, d, e)) && s.checkPut(this, c, d, e))) {
      if (w = this._getDirection(e, o) === "vertical", r = P(d), Y("dragOverValid"), v.eventCanceled) return y;
      if (i)
        return C = T, B(), this._hideClone(), Y("revert"), v.eventCanceled || (Te ? T.insertBefore(d, Te) : T.appendChild(d)), I(!0);
      var U = Mt(n, u.draggable);
      if (!U || fo(e, w, this) && !U.animated) {
        if (U === d)
          return I(!1);
        if (U && n === e.target && (o = U), o && (a = P(o)), nt(T, n, d, r, o, a, e, !!o) !== !1)
          return B(), n.appendChild(d), C = n, W(), I(!0);
      } else if (U && co(e, w, this)) {
        var X = Be(n, 0, u, !0);
        if (X === d)
          return I(!1);
        if (o = X, a = P(o), nt(T, n, d, r, o, a, e, !1) !== !1)
          return B(), n.insertBefore(d, X), C = n, W(), I(!0);
      } else if (o.parentNode === n) {
        a = P(o);
        var ee = 0, ce, m = d.parentNode !== n, p = !ao(d.animated && d.toRect || r, o.animated && o.toRect || a, w), E = w ? "top" : "left", O = Ut(o, "top", "top") || Ut(d, "top", "top"), oe = O ? O.scrollTop : void 0;
        Fe !== o && (ce = a[E], je = !1, et = !p && u.invertSwap || m), ee = mo(e, o, a, w, p ? 1 : u.swapThreshold, u.invertedSwapThreshold == null ? u.swapThreshold : u.invertedSwapThreshold, et, Fe === o);
        var q;
        if (ee !== 0) {
          var re = ne(d);
          do
            re -= ee, q = C.children[re];
          while (q && (g(q, "display") === "none" || q === _));
        }
        if (ee === 0 || q === o)
          return I(!1);
        Fe = o, Ue = ee;
        var $ = o.nextElementSibling, te = !1;
        te = ee === 1;
        var xe = nt(T, n, d, r, o, a, e, te);
        if (xe !== !1)
          return (xe === 1 || xe === -1) && (te = xe === 1), Ot = !0, setTimeout(uo, 30), B(), te && !$ ? n.appendChild(d) : o.parentNode.insertBefore(d, te ? $ : o), O && sn(O, 0, oe - O.scrollTop), C = d.parentNode, ce !== void 0 && !et && (at = Math.abs(ce - P(o)[E])), W(), I(!0);
      }
      if (n.contains(d))
        return I(!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", Se), S(document, "mousemove", Se), S(document, "touchmove", Se);
  },
  _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 (J = ne(d), ve = ne(d, o.draggable), G("drop", this, {
      evt: e
    }), C = d && d.parentNode, J = ne(d), ve = ne(d, o.draggable), v.eventCanceled) {
      this._nulling();
      return;
    }
    Ae = !1, et = !1, je = !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(), We && g(document.body, "user-select", ""), g(d, "transform", ""), e && ($e && (e.cancelable && e.preventDefault(), !o.dropBubble && e.stopPropagation()), _ && _.parentNode && _.parentNode.removeChild(_), (T === C || R && R.lastPutMode !== "clone") && x && x.parentNode && x.parentNode.removeChild(x), d && (this.nativeDraggable && S(d, "dragend", this), wt(d), d.style["will-change"] = "", $e && !Ae && K(d, R ? R.options.ghostClass : this.options.ghostClass, !1), K(d, this.options.chosenClass, !1), j({
      sortable: this,
      name: "unchoose",
      toEl: C,
      newIndex: null,
      newDraggableIndex: null,
      originalEvent: e
    }), T !== C ? (J >= 0 && (j({
      rootEl: C,
      name: "add",
      toEl: C,
      fromEl: T,
      originalEvent: e
    }), j({
      sortable: this,
      name: "remove",
      toEl: C,
      originalEvent: e
    }), j({
      rootEl: C,
      name: "sort",
      toEl: C,
      fromEl: T,
      originalEvent: e
    }), j({
      sortable: this,
      name: "sort",
      toEl: C,
      originalEvent: e
    })), R && R.save()) : J !== Ve && J >= 0 && (j({
      sortable: this,
      name: "update",
      toEl: C,
      originalEvent: e
    }), j({
      sortable: this,
      name: "sort",
      toEl: C,
      originalEvent: e
    })), v.active && ((J == null || J === -1) && (J = Ve, ve = He), j({
      sortable: this,
      name: "end",
      toEl: C,
      originalEvent: e
    }), this.save()))), this._nulling();
  },
  _nulling: function() {
    G("nulling", this), T = d = C = _ = Te = x = rt = ye = Ee = ae = $e = J = ve = Ve = He = Fe = Ue = R = Qe = v.dragged = v.ghost = v.clone = v.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), so(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, a = o.length, i = this.options; r < a; r++)
      n = o[r], ie(n, i.draggable, this.el, !1) && e.push(n.getAttribute(i.dataIdAttr) || ho(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(a, i) {
      var u = r.children[i];
      ie(u, this.options.draggable, r, !1) && (o[a] = u);
    }, this), n && this.captureAnimationState(), e.forEach(function(a) {
      o[a] && (r.removeChild(o[a]), r.appendChild(o[a]));
    }), 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 ie(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" && fn(o);
  },
  /**
   * Destroy
   */
  destroy: function() {
    G("destroy", this);
    var e = this.el;
    e[Z] = 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 (!ye) {
      if (G("hideClone", this), v.eventCanceled) return;
      g(x, "display", "none"), this.options.removeCloneOnHide && x.parentNode && x.parentNode.removeChild(x), ye = !0;
    }
  },
  _showClone: function(e) {
    if (e.lastPutMode !== "clone") {
      this._hideClone();
      return;
    }
    if (ye) {
      if (G("showClone", this), v.eventCanceled) return;
      d.parentNode == T && !this.options.group.revertClone ? T.insertBefore(x, d) : Te ? T.insertBefore(x, Te) : T.appendChild(x), this.options.group.revertClone && this.animate(d, x), g(x, "display", ""), ye = !1;
    }
  }
};
function so(t) {
  t.dataTransfer && (t.dataTransfer.dropEffect = "move"), t.cancelable && t.preventDefault();
}
function nt(t, e, n, o, r, a, i, u) {
  var s, c = t[Z], l = c.options.onMove, f;
  return window.CustomEvent && !he && !Ke ? s = new CustomEvent("move", {
    bubbles: !0,
    cancelable: !0
  }) : (s = document.createEvent("Event"), s.initEvent("move", !0, !0)), s.to = e, s.from = t, s.dragged = n, s.draggedRect = o, s.related = r || e, s.relatedRect = a || P(e), s.willInsertAfter = u, s.originalEvent = i, t.dispatchEvent(s), l && (f = l.call(c, s, i)), f;
}
function wt(t) {
  t.draggable = !1;
}
function uo() {
  Ot = !1;
}
function co(t, e, n) {
  var o = P(Be(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 fo(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 mo(t, e, n, o, r, a, i, u) {
  var s = o ? t.clientY : t.clientX, c = o ? n.height : n.width, l = o ? n.top : n.left, f = o ? n.bottom : n.right, h = !1;
  if (!i) {
    if (u && at < c * r) {
      if (!je && (Ue === 1 ? s > l + c * a / 2 : s < f - c * a / 2) && (je = !0), je)
        h = !0;
      else if (Ue === 1 ? s < l + at : s > f - at)
        return -Ue;
    } else if (s > l + c * (1 - r) / 2 && s < f - c * (1 - r) / 2)
      return po(e);
  }
  return h = h || i, h && (s < l + c * a / 2 || s > f - c * a / 2) ? s > l + c / 2 ? 1 : -1 : 0;
}
function po(t) {
  return ne(d) < ne(t) ? 1 : -1;
}
function ho(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 go(t) {
  dt.length = 0;
  for (var e = t.getElementsByTagName("input"), n = e.length; n--; ) {
    var o = e[n];
    o.checked && dt.push(o);
  }
}
function it(t) {
  return setTimeout(t, 0);
}
function It(t) {
  return clearTimeout(t);
}
mt && D(document, "touchmove", function(t) {
  (v.active || Ae) && t.cancelable && t.preventDefault();
});
v.utils = {
  on: D,
  off: S,
  css: g,
  find: an,
  is: function(e, n) {
    return !!ie(e, n, e, !1);
  },
  extend: Jn,
  throttle: ln,
  closest: ie,
  toggleClass: K,
  clone: un,
  index: ne,
  nextTick: it,
  cancelNextTick: It,
  detectDirection: dn,
  getChild: Be
};
v.get = function(t) {
  return t[Z];
};
v.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 && (v.utils = ue(ue({}, v.utils), o.utils)), Je.mount(o);
  });
};
v.create = function(t, e) {
  return new v(t, e);
};
v.version = Gn;
var F = [], Re, Ft, kt = !1, Et, St, ft, Ye;
function vo() {
  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)), Kt(), lt(), Zn();
    },
    nulling: function() {
      ft = Ft = Re = kt = Ye = Et = St = null, F.length = 0;
    },
    _handleFallbackAutoScroll: function(n) {
      this._handleAutoScroll(n, !0);
    },
    _handleAutoScroll: function(n, o) {
      var r = this, a = (n.touches ? n.touches[0] : n).clientX, i = (n.touches ? n.touches[0] : n).clientY, u = document.elementFromPoint(a, i);
      if (ft = n, o || this.options.forceAutoScrollFallback || Ke || he || We) {
        Dt(n, this.options, u, o);
        var s = _e(u, !0);
        kt && (!Ye || a !== Et || i !== St) && (Ye && Kt(), Ye = setInterval(function() {
          var c = _e(document.elementFromPoint(a, i), !0);
          c !== s && (s = c, lt()), Dt(n, r.options, c, o);
        }, 10), Et = a, St = i);
      } else {
        if (!this.options.bubbleScroll || _e(u, !0) === se()) {
          lt();
          return;
        }
        Dt(n, this.options, _e(u, !1), !1);
      }
    }
  }, pe(t, {
    pluginName: "scroll",
    initializeByDefault: !0
  });
}
function lt() {
  F.forEach(function(t) {
    clearInterval(t.pid);
  }), F = [];
}
function Kt() {
  clearInterval(Ye);
}
var Dt = ln(function(t, e, n, o) {
  if (e.scroll) {
    var r = (t.touches ? t.touches[0] : t).clientX, a = (t.touches ? t.touches[0] : t).clientY, i = e.scrollSensitivity, u = e.scrollSpeed, s = se(), c = !1, l;
    Ft !== n && (Ft = n, lt(), Re = e.scroll, l = e.scrollFn, Re === !0 && (Re = _e(n, !0)));
    var f = 0, h = Re;
    do {
      var w = h, b = P(w), y = b.top, Y = b.bottom, B = b.left, I = b.right, W = b.width, U = b.height, X = void 0, ee = void 0, ce = w.scrollWidth, m = w.scrollHeight, p = g(w), E = w.scrollLeft, O = w.scrollTop;
      w === s ? (X = W < ce && (p.overflowX === "auto" || p.overflowX === "scroll" || p.overflowX === "visible"), ee = U < m && (p.overflowY === "auto" || p.overflowY === "scroll" || p.overflowY === "visible")) : (X = W < ce && (p.overflowX === "auto" || p.overflowX === "scroll"), ee = U < m && (p.overflowY === "auto" || p.overflowY === "scroll"));
      var oe = X && (Math.abs(I - r) <= i && E + W < ce) - (Math.abs(B - r) <= i && !!E), q = ee && (Math.abs(Y - a) <= i && O + U < m) - (Math.abs(y - a) <= i && !!O);
      if (!F[f])
        for (var re = 0; re <= f; re++)
          F[re] || (F[re] = {});
      (F[f].vx != oe || F[f].vy != q || F[f].el !== w) && (F[f].el = w, F[f].vx = oe, F[f].vy = q, clearInterval(F[f].pid), (oe != 0 || q != 0) && (c = !0, F[f].pid = setInterval((function() {
        o && this.layer === 0 && v.active._onTouchMove(ft);
        var $ = F[this.layer].vy ? F[this.layer].vy * u : 0, te = F[this.layer].vx ? F[this.layer].vx * u : 0;
        typeof l == "function" && l.call(v.dragged.parentNode[Z], te, $, t, ft, F[this.layer].el) !== "continue" || sn(F[this.layer].el, te, $);
      }).bind({
        layer: f
      }), 24))), f++;
    } while (e.bubbleScroll && h !== s && (h = _e(h, !1)));
    kt = c;
  }
}, 30), hn = function(e) {
  var n = e.originalEvent, o = e.putSortable, r = e.dragEl, a = e.activeSortable, i = e.dispatchSortableEvent, u = e.hideGhostForTarget, s = e.unhideGhostForTarget;
  if (n) {
    var c = o || a;
    u();
    var l = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, f = document.elementFromPoint(l.clientX, l.clientY);
    s(), c && !c.el.contains(f) && (i("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 = Be(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: hn
};
pe(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: hn
};
pe(Bt, {
  pluginName: "removeOnSpill"
});
v.mount(new vo());
v.mount(Bt, Lt);
function Tt(t) {
  t.parentElement !== null && t.parentElement.removeChild(t);
}
function Jt(t, e, n) {
  const o = n === 0 ? t.children[0] : t.children[n - 1].nextSibling;
  t.insertBefore(e, o);
}
function bo() {
  return typeof window < "u" ? window.console : global.console;
}
const yo = bo();
function _o(t) {
  const e = /* @__PURE__ */ Object.create(null);
  return function(o) {
    return e[o] || (e[o] = t(o));
  };
}
const wo = /-(\w)/g, Eo = _o((t) => t.replace(wo, (e, n) => n.toUpperCase())), gn = ["Start", "Add", "Remove", "Update", "End"], vn = ["Choose", "Unchoose", "Sort", "Filter", "Clone"], bn = ["Move"], So = [bn, gn, vn].flatMap((t) => t).map((t) => `on${t}`), At = {
  manage: bn,
  manageAndEmit: gn,
  emit: vn
};
function Do(t) {
  return So.indexOf(t) !== -1;
}
const To = [
  "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 Co(t) {
  return To.includes(t);
}
function xo(t) {
  return ["transition-group", "TransitionGroup"].includes(t);
}
function yn(t) {
  return ["id", "class", "role", "style"].includes(t) || t.startsWith("data-") || t.startsWith("aria-") || t.startsWith("on");
}
function _n(t) {
  return t.reduce((e, [n, o]) => (e[n] = o, e), {});
}
function Oo({ $attrs: t, componentData: e = {} }) {
  return {
    ..._n(
      Object.entries(t).filter(([o, r]) => yn(o))
    ),
    ...e
  };
}
function Io({ $attrs: t, callBackBuilder: e }) {
  const n = _n(wn(t));
  Object.entries(e).forEach(([r, a]) => {
    At[r].forEach((i) => {
      n[`on${i}`] = a(i);
    });
  });
  const o = `[data-draggable]${n.draggable || ""}`;
  return {
    ...n,
    draggable: o
  };
}
function wn(t) {
  return Object.entries(t).filter(([e, n]) => !yn(e)).map(([e, n]) => [Eo(e), n]).filter(([e, n]) => !Do(e));
}
const Zt = ({ el: t }) => t, Fo = (t, e) => t.__draggable_context = e, Qt = (t) => t.__draggable_context;
class ko {
  constructor({
    nodes: { header: e, default: n, footer: o },
    root: r,
    realList: a
  }) {
    this.defaultNodes = n, this.children = [...e, ...n, ...o], this.externalComponent = r.externalComponent, this.rootTransition = r.transition, this.tag = r.tag, this.realList = a;
  }
  get _isRootComponent() {
    return this.externalComponent || this.rootTransition;
  }
  render(e, n) {
    const { tag: o, children: r, _isRootComponent: a } = this;
    return e(o, n, a ? { default: () => r } : r);
  }
  updated() {
    const { defaultNodes: e, realList: n } = this;
    e.forEach((o, r) => {
      Fo(Zt(o), {
        element: n[r],
        index: r
      });
    });
  }
  getUnderlyingVm(e) {
    return Qt(e);
  }
  getVmIndexFromDomIndex(e, n) {
    const { defaultNodes: o } = this, { length: r } = o, a = n.children, i = a.item(e);
    if (i === null)
      return r;
    const u = Qt(i);
    if (u)
      return u.index;
    if (r === 0)
      return 0;
    const s = Zt(o[0]), c = [...a].findIndex(
      (l) => l === s
    );
    return e < c ? 0 : r;
  }
}
function Ao(t, e) {
  const n = t[e];
  return n ? n() : [];
}
function No({ $slots: t, realList: e, getKey: n }) {
  const o = e || [], [r, a] = ["header", "footer"].map(
    (s) => Ao(t, s)
  ), { item: i } = t;
  if (!i)
    throw new Error("draggable element must have an item slot");
  const u = o.flatMap(
    (s, c) => i({ element: s, index: c }).map((l) => (l.key = n(s), l.props = { ...l.props || {}, "data-draggable": !0 }, l))
  );
  if (u.length !== o.length)
    throw new Error("Item slot must have only one child");
  return {
    header: r,
    footer: a,
    default: u
  };
}
function Po(t) {
  const e = xo(t), n = !Co(t) && !e;
  return {
    transition: e,
    externalComponent: n,
    tag: n ? N(t) : e ? Fn : t
  };
}
function Vo({ $slots: t, tag: e, realList: n, getKey: o }) {
  const r = No({ $slots: t, realList: n, getKey: o }), a = Po(e);
  return new ko({ nodes: r, root: a, realList: n });
}
function En(t, e) {
  en(() => this.$emit(t.toLowerCase(), e));
}
function Sn(t) {
  return (e, n) => {
    if (this.realList !== null)
      return this[`onDrag${t}`](e, n);
  };
}
function Mo(t) {
  const e = Sn.call(this, t);
  return (n, o) => {
    e.call(this, n, o), En.call(this, t, n);
  };
}
let Ct = null;
const Lo = {
  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
  }
}, Bo = [
  "update:modelValue",
  "change",
  ...[...At.manageAndEmit, ...At.emit].map((t) => t.toLowerCase())
], $o = Ce({
  name: "draggable",
  inheritAttrs: !1,
  props: Lo,
  emits: Bo,
  data() {
    return {
      error: !1
    };
  },
  render() {
    try {
      this.error = !1;
      const { $slots: t, $attrs: e, tag: n, componentData: o, realList: r, getKey: a } = this, i = Vo({
        $slots: t,
        tag: n,
        realList: r,
        getKey: a
      });
      this.componentStructure = i;
      const u = Oo({ $attrs: e, componentData: o });
      return i.render($t, u);
    } catch (t) {
      return this.error = !0, $t("pre", { style: { color: "red" } }, t.stack);
    }
  },
  created() {
    this.list !== null && this.modelValue !== null && yo.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 = Io({
      $attrs: t,
      callBackBuilder: {
        manageAndEmit: (a) => Mo.call(this, a),
        emit: (a) => En.bind(this, a),
        manage: (a) => Sn.call(this, a)
      }
    }), r = e.nodeType === 1 ? e : e.parentElement;
    this._sortable = new v(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 && wn(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) {
      en(() => 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), Ct = t.item;
    },
    onDragAdd(t) {
      const e = t.item._underlying_vm_;
      if (e === void 0)
        return;
      Tt(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 (Jt(this.$el, t.item, t.oldIndex), t.pullMode === "clone") {
        Tt(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) {
      Tt(t.item), Jt(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(
        (i) => i.style.display !== "none"
      ), o = n.indexOf(e.related), r = t.component.getVmIndexFromDomIndex(
        o
      );
      return n.indexOf(Ct) !== -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), a = this.computeFutureIndex(r, t), i = {
        ...this.context,
        futureIndex: a
      }, u = {
        ...t,
        relatedContext: r,
        draggedContext: i
      };
      return n(u, e);
    },
    onDragEnd() {
      Ct = null;
    }
  }
}), Ro = Object.entries(L).map((t) => {
  let e = "";
  switch (t[1]) {
    case L.BarChart:
      e = "bar_chart";
      break;
    case L.Table:
      e = "table";
      break;
    case L.Circular:
      e = "pie_chart";
      break;
    case L.LineChart:
      e = "show_chart";
      break;
    case L.Scorecard:
      e = "money";
      break;
    case L.Spacer:
      e = "space_bar";
      break;
    case L.StackBarChart:
      e = "stacked_bar_chart";
      break;
    case L.StackLineChart:
      e = "stacked_line_chart";
      break;
  }
  return {
    label: Nn(t[0]),
    icon: e,
    value: t[1]
  };
}), Yo = /* @__PURE__ */ Ce({
  __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 = ze(t, "modelValue"), o = t, r = ke(
      () => Ro.map((a) => ({
        ...a,
        label: e(`report.widget.types.${a.value.toLowerCase()}`)
      }))
    );
    return (a, i) => {
      const u = N("FmIcon"), s = N("FmCard");
      return V(), Q("div", null, [
        (V(!0), Q(qe, null, tn(r.value.filter(
          (c) => o.excludeWidgeType.indexOf(c.value) === -1
        ), (c, l) => (V(), Me(s, {
          key: l,
          class: kn(`items-center  ${o.childClass} cursor-pointer rounded-[8px] ${o.isList ? "" : "gap-[16px]"} ${n.value === c.value ? "selected-widget" : ""}`),
          variant: "outlined",
          onClick: (f) => n.value = c.value
        }, {
          default: le(() => [
            k(u, {
              name: c.icon,
              size: o.isList ? "md" : "lg",
              outline: !0
            }, null, 8, ["name", "size"]),
            nn(" " + Pe(c.label), 1)
          ]),
          _: 2
        }, 1032, ["class", "onClick"]))), 128))
      ]);
    };
  }
}), mr = /* @__PURE__ */ Vt(Yo, [["__scopeId", "data-v-7c1916a3"]]);
function Wo(t) {
  let e, n, o;
  switch (t) {
    case L.Table:
      e = [], n = !1, o = $n.top;
      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,
    columnIds: [],
    rowIds: [],
    joinDatasources: e
  };
}
function pr(t, e) {
  let n = 1, o = 1;
  switch (t) {
    case L.Scorecard:
      n = 1, o = 2;
      break;
    case L.BarChart:
    case L.StackBarChart:
    case L.LineChart:
    case L.StackLineChart:
      n = 4, o = 6;
      break;
    case L.Table:
      n = 4, o = 12;
      break;
    case L.Circular:
      n = 4, o = 4;
      break;
    case L.Spacer:
      n = 0, o = 12;
      break;
  }
  return {
    size: {
      width: o,
      height: n
    },
    widget: {
      title: e || "New widget",
      type: t,
      config: Wo(t)
    }
  };
}
function hr(t, e) {
  return t.filter((n, o) => o !== e);
}
const Xo = {
  key: 0,
  class: "flex flex-col gap-5"
}, Ho = /* @__PURE__ */ Ce({
  __name: "Section",
  props: {
    isOpen: { type: Boolean, default: !0 },
    isOpenModifiers: {}
  },
  emits: ["update:isOpen"],
  setup(t) {
    const e = ze(t, "isOpen");
    return (n, o) => {
      const r = N("FmIcon"), a = N("FmMenuDivider");
      return V(), Q(qe, null, [
        be("div", {
          class: "flex items-center cursor-pointer fm-typo-en-body-lg-600",
          onClick: o[0] || (o[0] = (i) => e.value = !e.value)
        }, [
          Ge(n.$slots, "header", {}, void 0, !0),
          k(r, {
            name: e.value ? "keyboard_arrow_up" : "keyboard_arrow_down"
          }, null, 8, ["name"])
        ]),
        k(xt, { name: "slide-fade" }, {
          default: le(() => [
            e.value ? (V(), Q("div", Xo, [
              Ge(n.$slots, "content", {}, void 0, !0)
            ])) : fe("", !0)
          ]),
          _: 3
        }),
        k(a)
      ], 64);
    };
  }
}), gr = /* @__PURE__ */ Vt(Ho, [["__scopeId", "data-v-fa67a3a4"]]);
var Ne = /* @__PURE__ */ ((t) => (t.Select = "Select", t.TextField = "TextField", t.Timestamp = "Timestamp", t))(Ne || {});
function Uo(t) {
  let e = !1, n = 1;
  switch (t) {
    case de.Equal:
    case de.NotEqual:
    case de.Like:
    case de.NotLike:
      e = !1, n = 1;
      break;
    case de.GreaterThan:
    case de.GreaterThanOrEqual:
    case de.LessThan:
    case de.LessThanOrEqual:
      e = !0, n = 1;
      break;
    case de.Between:
      e = !0, n = 2;
      break;
  }
  return {
    fixed: e,
    count: n
  };
}
function jo({
  operator: t,
  dimensionOption: e,
  dataType: n,
  t: o
}) {
  const { fixed: r, count: a } = Uo(t);
  switch (n) {
    case Ze.String:
      return {
        type: "TextField",
        fixed: r,
        count: a,
        dataType: void 0,
        default: ""
      };
    case Ze.Numeric:
      return {
        type: "TextField",
        fixed: r,
        count: a,
        dataType: "number",
        default: 0
      };
    case Ze.Bool:
      return {
        type: "Select",
        fixed: r,
        count: a,
        options: [
          { label: o("report.common.yes"), value: !0 },
          { label: o("report.common.no"), value: !1 }
        ],
        default: !0
      };
    case Ze.Timestamp:
      switch (e) {
        case z.HourOfDay:
          return {
            type: "TextField",
            fixed: r,
            count: a,
            dataType: "number",
            default: "0"
          };
        case z.DayOfWeek:
          return {
            type: "Select",
            fixed: r,
            count: a,
            options: [
              { label: o("report.days.sunday"), value: "1" },
              { label: o("report.days.monday"), value: "2" },
              { label: o("report.days.tuesday"), value: "3" },
              { label: o("report.days.wednesday"), value: "4" },
              { label: o("report.days.thursday"), value: "5" },
              { label: o("report.days.friday"), value: "6" },
              { label: o("report.days.saturday"), value: "7" }
            ],
            default: "1"
          };
        case z.DayOfMonth:
          return {
            type: "TextField",
            fixed: r,
            count: a,
            dataType: "number",
            default: "1"
          };
        case z.MonthOfYear:
          return {
            type: "Select",
            fixed: r,
            count: a,
            options: [
              { label: o("report.months.january"), value: "1" },
              { label: o("report.months.february"), value: "2" },
              { label: o("report.months.march"), value: "3" },
              { label: o("report.months.april"), value: "4" },
              { label: o("report.months.may"), value: "5" },
              { label: o("report.months.june"), value: "6" },
              { label: o("report.months.july"), value: "7" },
              { label: o("report.months.august"), value: "8" },
              { label: o("report.months.september"), value: "9" },
              { label: o("report.months.october"), value: "10" },
              { label: o("report.months.november"), value: "11" },
              { label: o("report.months.december"), value: "12" }
            ],
            default: "1"
          };
        case z.TimeOfDay:
          return {
            type: "Timestamp",
            fixed: r,
            count: a,
            default: (/* @__PURE__ */ new Date()).toISOString()
          };
      }
  }
  return {
    type: "TextField",
    fixed: r,
    count: a,
    dataType: void 0,
    default: ""
  };
}
function Dn(t) {
  switch (t) {
    case z.HourOfDay:
      return 0;
    case z.DayOfMonth:
      return 1;
    default:
      return;
  }
}
function Tn(t) {
  switch (t) {
    case z.HourOfDay:
      return 23;
    case z.DayOfMonth:
      return 31;
    default:
      return;
  }
}
const Go = { class: "grow" }, zo = {
  key: 2,
  class: "w-full"
}, qo = { key: 0 }, Ko = /* @__PURE__ */ Ce({
  __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 = ze(t, "modelValue"), n = t, o = De([]);
    function r(s) {
      return (s ? ht(s) : ht()).format("HH:mm");
    }
    function a({ hour: s, minute: c }) {
      return ht().set("hour", s).set("minute", c).toISOString();
    }
    function i(s, c) {
      var w, b;
      const l = Dn(n.option), f = Tn(n.option);
      ((w = n.config) == null ? void 0 : w.type) === Ne.TextField && (l !== void 0 && c < l || f !== void 0 && c > f) && (o.value[s] = `Value must be between ${l} and ${f}`);
      const h = [...e.value];
      ((b = n.config) == null ? void 0 : b.type) === Ne.Timestamp ? h[s] = a({
        hour: Number(c.split(":")[0]),
        minute: Number(c.split(":")[1])
      }) : h[s] = c, e.value = h;
    }
    function u(s) {
      var c;
      if (s === 0)
        e.value = [(c = n.config) == null ? void 0 : c.default, ...e.value];
      else {
        const l = [...e.value];
        l.splice(s, 1), e.value = l;
      }
    }
    return (s, c) => {
      const l = N("FmSelect"), f = N("FmTextField"), h = N("FmTimePicker"), w = N("FmButton");
      return V(!0), Q(qe, null, tn(new Array(e.value.length !== 0 ? e.value.length : 1), (b, y) => {
        var Y, B, I, W, U;
        return V(), Q("div", {
          key: y,
          class: "flex flex-row align-center gap-2 w-full"
        }, [
          be("div", Go, [
            ((Y = n.config) == null ? void 0 : Y.type) === M(Ne).Select ? (V(), Me(l, {
              key: 0,
              "model-value": e.value[y],
              items: n.config.options,
              "onUpdate:modelValue": (X) => i(y, X)
            }, null, 8, ["model-value", "items", "onUpdate:modelValue"])) : ((B = n.config) == null ? void 0 : B.type) === M(Ne).TextField ? (V(), Me(f, {
              key: 1,
              "model-value": e.value[y],
              type: ((I = n.config) == null ? void 0 : I.dataType) === "number" ? "number" : "text",
              "helper-text": o.value[y] || void 0,
              "helper-state": "error",
              "onUpdate:modelValue": (X) => i(y, X)
            }, null, 8, ["model-value", "type", "helper-text", "onUpdate:modelValue"])) : ((W = n.config) == null ? void 0 : W.type) === M(Ne).Timestamp ? (V(), Q("div", zo, [
              k(h, {
                "model-value": r(e.value[y]),
                "onUpdate:modelValue": (X) => i(y, X)
              }, null, 8, ["model-value", "onUpdate:modelValue"])
            ])) : fe("", !0)
          ]),
          ((U = n.config) == null ? void 0 : U.fixed) === !1 ? (V(), Q("div", qo, [
            k(w, {
              icon: y === 0 ? "add" : "remove",
              onClick: (X) => u(y)
            }, null, 8, ["icon", "onClick"])
          ])) : fe("", !0)
        ]);
      }), 128);
    };
  }
}), Jo = { class: "flex flex-col my-2 gap-8" }, Zo = { class: "fm-typo-en-body-lg-600" }, Qo = { class: "fm-typo-en-body-sm-600 text-fm-color-neutral-gray-400" }, er = { class: "fm-typo-en-body-lg-400 text-ellipsis overflow-hidden line-clamp-1" }, vr = /* @__PURE__ */ Ce({
  __name: "FilterSection",
  props: /* @__PURE__ */ Nt({
    options: {
      type: Array,
      default: () => []
    },
    label: {
      type: String,
      default: "Filter"
    }
  }, {
    modelValue: { required: !1, default: () => [] },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(t) {
    const { t: e } = Pt(), n = ze(t, "modelValue"), o = t, r = ke(() => e(`report.section.filter.${o.label}`)), a = De(!1), i = Rn(), u = ke(
      () => n.value.map((m, p) => {
        const E = o.options.find(
          (O) => O.schemaName === m.schemaName && O.name === m.name
        );
        return {
          index: p,
          labels: (E == null ? void 0 : E.labels) || [m.schemaName, m.name],
          value: m
        };
      })
    ), s = De(n.value.length > 0 ? 0 : void 0);
    function c(m) {
      var p;
      a.value = !0, b.value = [], l.value = m != null && m.value ? JSON.parse(JSON.stringify(m.value)) : void 0, s.value = m == null ? void 0 : m.index, f.value = !!((p = l.value) != null && p.dataFormula), B();
    }
    const l = De(void 0), f = De(!1), h = De(void 0), w = ke(
      () => o.options.find(
        (m) => {
          var p, E;
          return m.schemaName === ((p = l.value) == null ? void 0 : p.schemaName) && m.name === ((E = l.value) == null ? void 0 : E.name);
        }
      ) ?? {}
    ), b = De([]);
    function y(m) {
      var p;
      return (p = b.value.find((E) => E.option === m)) == null ? void 0 : p.value;
    }
    const Y = Yn(
      (m, p) => {
        const E = b.value.find((O) => O.option === m);
        E ? E.value = p : b.value.push({ option: m, value: p });
      },
      300
    );
    pt(
      [() => {
        var m;
        return (m = l.value) == null ? void 0 : m.option;
      }, () => {
        var m;
        return (m = l.value) == null ? void 0 : m.values;
      }],
      ([m, p]) => {
        m !== void 0 && Array.isArray(p) && Y(m, p);
      },
      { deep: !0 }
    ), pt(
      () => {
        var m;
        return (m = l.value) == null ? void 0 : m.option;
      },
      (m, p) => {
        if (p !== void 0 && m !== p && l.value) {
          if (B(), !h.value) return;
          const E = y(m);
          l.value = {
            ...l.value,
            values: Array.isArray(E) ? E : [h.value.default]
          };
        }
      }
    ), pt(
      () => {
        var m;
        return (m = l.value) == null ? void 0 : m.operator;
      },
      (m, p) => {
        if (m !== p && w.value && l.value) {
          if (B(), !h.value) return;
          const E = l.value.values.length - h.value.count;
          E > 0 && h.value.fixed ? l.value = {
            ...l.value,
            values: l.value.values.slice(0, h.value.count)
          } : E < 0 && (l.value = {
            ...l.value,
            values: [
              ...l.value.values,
              ...Array(Math.abs(E)).fill(h.value.default)
            ]
          });
        }
      },
      {
        deep: !0
      }
    );
    function B() {
      w.value && l.value && (h.value = jo({
        operator: l.value.operator,
        dataType: w.value.type,
        dimensionOption: l.value.option,
        t: e
      }));
    }
    function I(m) {
      var p, E, O;
      (m.schemaName !== ((p = l.value) == null ? void 0 : p.schemaName) || m.name !== ((E = l.value) == null ? void 0 : E.name)) && (l.value = {
        schemaName: m.schemaName,
        name: m.name,
        operator: m.filterOperators[0],
        option: m.filterDimensionOptions[0],
        values: []
      }, B(), l.value.values = [(O = h.value) == null ? void 0 : O.default]);
    }
    function W() {
      var p, E, O;
      const m = [...u.value.map((oe) => oe.value)];
      if (l.value) {
        const oe = Dn((p = l.value) == null ? void 0 : p.option), q = Tn((E = l.value) == null ? void 0 : E.option), re = (O = l.value.values) == null ? void 0 : O.map(
          ($, te) => $ == null || $ === "" || !ce($, oe, q) ? te : null
        ).filter(($) => $ !== null);
        if (!l.value.values || re.length > 0) {
          i.open({ message: "One or more values are invalid", type: "error" });
          return;
        }
        l.value.values = l.value.values.filter(
          ($) => $ !== "" && $ !== null
        ), s.value !== void 0 ? m[Number(s.value)] = l.value : m.push(l.value), n.value = m;
      }
      a.value = !1;
    }
    function U(m) {
      const p = [...u.value.map((E) => E.value)];
      p.splice(m, 1), n.value = p, a.value = !1;
    }
    const X = ke(
      () => o.options.map((m) => ({
        label: m.labels.join(" "),
        value: m
      }))
    ), ee = ke(() => [
      { label: e("report.section.filter.hourOfDay"), value: z.HourOfDay },
      { label: e("report.section.filter.dayOfMonth"), value: z.DayOfMonth },
      { label: e("report.section.filter.dayOfWeek"), value: z.DayOfWeek },
      { label: e("report.section.filter.monthOfYear"), value: z.MonthOfYear },
      { label: e("report.section.filter.timeOfDay"), value: z.TimeOfDay }
    ]);
    function ce(m, p, E) {
      return !(p !== void 0 && m < p || E !== void 0 && m > E);
    }
    return (m, p) => {
      const E = N("FmCheckbox"), O = N("FmTextarea"), oe = N("FmSelect"), q = N("FmForm"), re = N("FmIcon"), $ = N("FmButton"), te = N("FmListItem"), xe = N("FmList"), we = N("FmField");
      return V(), Q("div", Jo, [
        k(Bn, {
          modelValue: a.value,
          "onUpdate:modelValue": p[6] || (p[6] = (ge) => a.value = ge),
          title: r.value,
          "primary-button-label": M(e)("report.common.confirm"),
          "secondary-button-label": M(e)("report.common.cancel"),
          onConfirm: W
        }, {
          content: le(() => [
            k(q, {
              ref: "form",
              class: "flex flex-col gap-2 w-[490px]"
            }, {
              default: le(() => {
                var ge, Oe;
                return [
                  k(Yt, {
                    "model-value": w.value,
                    items: X.value,
                    placeholder: r.value,
                    label: r.value,
                    "onUpdate:modelValue": p[0] || (p[0] = (A) => I(A))
                  }, null, 8, ["model-value", "items", "placeholder", "label"]),
                  l.value ? (V(), Q(qe, { key: 0 }, [
                    k(E, {
                      modelValue: f.value,
                      "onUpdate:modelValue": p[1] || (p[1] = (A) => f.value = A),
                      label: M(e)("report.section.filter.advance"),
                      value: !0
                    }, null, 8, ["modelValue", "label"]),
                    f.value ? (V(), Me(O, {
                      key: 0,
                      modelValue: l.value.dataFormula,
                      "onUpdate:modelValue": p[2] || (p[2] = (A) => l.value.dataFormula = A),
                      placeholder: M(e)("report.section.filter.dataFormula")
                    }, null, 8, ["modelValue", "placeholder"])) : fe("", !0),
                    k(oe, {
                      modelValue: l.value.option,
                      "onUpdate:modelValue": p[3] || (p[3] = (A) => l.value.option = A),
                      items: ee.value,
                      placeholder: M(e)("report.section.filter.timeFormatter"),
                      label: M(e)("report.section.filter.timeFormatter")
                    }, null, 8, ["modelValue", "items", "placeholder", "label"]),
                    (((ge = w.value) == null ? void 0 : ge.filterOperators) || []).length > 0 ? (V(), Me(Yt, {
                      key: 1,
                      modelValue: l.value.operator,
                      "onUpdate:modelValue": p[4] || (p[4] = (A) => l.value.operator = A),
                      items: (((Oe = w.value) == null ? void 0 : Oe.filterOperators) ?? []).map((A) => ({
                        label: M(e)("report.section.comparisonOperator." + A),
                        value: A
                      }))
                    }, null, 8, ["modelValue", "items"])) : fe("", !0),
                    h.value ? (V(), Me(Ko, {
                      key: l.value.option ?? "",
                      modelValue: l.value.values,
                      "onUpdate:modelValue": p[5] || (p[5] = (A) => l.value.values = A),
                      config: h.value,
                      option: l.value.option
                    }, null, 8, ["modelValue", "config", "option"])) : fe("", !0)
                  ], 64)) : fe("", !0)
                ];
              }),
              _: 1
            }, 512)
          ]),
          _: 1
        }, 8, ["modelValue", "title", "primary-button-label", "secondary-button-label"]),
        be("div", null, [
          be("p", Zo, Pe(r.value), 1),
          be("p", Qo, Pe(M(e)("report.section.filter.description")), 1)
        ]),
        k(xe, null, {
          default: le(() => [
            k(M($o), {
              list: n.value,
              "item-key": "id",
              class: "flex flex-col gap-2 w-full"
            }, {
              item: le(({ element: ge, index: Oe }) => [
                k(te, {
                  class: "!cursor-grab border rounded-md border-neutral-300 h-[40px] !p-[8px]",
                  onClick: Rt((A) => c(u.value[Oe]), ["stop"])
                }, {
                  default: le(() => [
                    k(re, { name: "drag_handle" }),
                    be("p", er, Pe(M(Pn)(ge.name)), 1),
                    p[8] || (p[8] = be("div", { class: "grow" }, null, -1)),
                    k($, {
                      icon: "close",
                      size: "md",
                      variant: "tertiary",
                      onClick: Rt((A) => U(Oe), ["stop"])
                    }, null, 8, ["onClick"])
                  ]),
                  _: 2
                }, 1032, ["onClick"])
              ]),
              _: 1
            }, 8, ["list"])
          ]),
          _: 1
        }),
        k(we, {
          class: "text-fm-color-typo-tertiary",
          onClick: p[7] || (p[7] = () => {
            c();
          })
        }, {
          default: le(() => [
            nn(Pe(M(e)("report.section.filter.add")), 1)
          ]),
          _: 1
        })
      ]);
    };
  }
}), tr = /* @__PURE__ */ Ce({
  __name: "TransitionFade",
  props: {
    modelValue: { type: Boolean, required: !0, default: !0 },
    modelModifiers: {}
  },
  emits: ["update:modelValue"],
  setup(t) {
    const e = ze(t, "modelValue");
    return (n, o) => (V(), Q(qe, null, [
      k(xt, { name: "slide-fade-right" }, {
        default: le(() => [
          e.value ? Ge(n.$slots, "right", { key: 0 }, void 0, !0) : fe("", !0)
        ]),
        _: 3
      }),
      k(xt, { name: "slide-fade-left" }, {
        default: le(() => [
          e.value ? fe("", !0) : Ge(n.$slots, "left", { key: 0 }, void 0, !0)
        ]),
        _: 3
      })
    ], 64));
  }
}), br = /* @__PURE__ */ Vt(tr, [["__scopeId", "data-v-a98ca9bc"]]);
export {
  gr as S,
  br as T,
  mr as W,
  vr as _,
  fr as a,
  Wo as b,
  $o as d,
  hr as h,
  pr as i
};
