import { defineComponent as Xt, ref as Rt, computed as Yt, onMounted as Lt, nextTick as ft, openBlock as Wt, createElementBlock as Ht, normalizeClass as jt, renderSlot as Gt } from "vue";
import { C as Ve } from "../Shared/base-PQGakkrl.js";
/**!
 * Sortable 1.15.0
 * @author	RubaXa   <trash@rubaxa.org>
 * @author	owenm    <owen23355@gmail.com>
 * @license MIT
 */
function ht(n, e) {
  var o = Object.keys(n);
  if (Object.getOwnPropertySymbols) {
    var t = Object.getOwnPropertySymbols(n);
    e && (t = t.filter(function(r) {
      return Object.getOwnPropertyDescriptor(n, r).enumerable;
    })), o.push.apply(o, t);
  }
  return o;
}
function q(n) {
  for (var e = 1; e < arguments.length; e++) {
    var o = arguments[e] != null ? arguments[e] : {};
    e % 2 ? ht(Object(o), !0).forEach(function(t) {
      zt(n, t, o[t]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(o)) : ht(Object(o)).forEach(function(t) {
      Object.defineProperty(n, t, Object.getOwnPropertyDescriptor(o, t));
    });
  }
  return n;
}
function Xe(n) {
  "@babel/helpers - typeof";
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Xe = function(e) {
    return typeof e;
  } : Xe = function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  }, Xe(n);
}
function zt(n, e, o) {
  return e in n ? Object.defineProperty(n, e, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : n[e] = o, n;
}
function Q() {
  return Q = Object.assign || function(n) {
    for (var e = 1; e < arguments.length; e++) {
      var o = arguments[e];
      for (var t in o)
        Object.prototype.hasOwnProperty.call(o, t) && (n[t] = o[t]);
    }
    return n;
  }, Q.apply(this, arguments);
}
function Ut(n, e) {
  if (n == null) return {};
  var o = {}, t = Object.keys(n), r, i;
  for (i = 0; i < t.length; i++)
    r = t[i], !(e.indexOf(r) >= 0) && (o[r] = n[r]);
  return o;
}
function qt(n, e) {
  if (n == null) return {};
  var o = Ut(n, e), t, r;
  if (Object.getOwnPropertySymbols) {
    var i = Object.getOwnPropertySymbols(n);
    for (r = 0; r < i.length; r++)
      t = i[r], !(e.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(n, t) && (o[t] = n[t]);
  }
  return o;
}
var Vt = "1.15.0";
function Z(n) {
  if (typeof window < "u" && window.navigator)
    return !!/* @__PURE__ */ navigator.userAgent.match(n);
}
var J = Z(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Ae = Z(/Edge/i), pt = Z(/firefox/i), Ce = Z(/safari/i) && !Z(/chrome/i) && !Z(/android/i), St = Z(/iP(ad|od|hone)/i), Dt = Z(/chrome/i) && Z(/android/i), _t = {
  capture: !1,
  passive: !1
};
function w(n, e, o) {
  n.addEventListener(e, o, !J && _t);
}
function E(n, e, o) {
  n.removeEventListener(e, o, !J && _t);
}
function He(n, e) {
  if (e) {
    if (e[0] === ">" && (e = e.substring(1)), n)
      try {
        if (n.matches)
          return n.matches(e);
        if (n.msMatchesSelector)
          return n.msMatchesSelector(e);
        if (n.webkitMatchesSelector)
          return n.webkitMatchesSelector(e);
      } catch {
        return !1;
      }
    return !1;
  }
}
function $t(n) {
  return n.host && n !== document && n.host.nodeType ? n.host : n.parentNode;
}
function z(n, e, o, t) {
  if (n) {
    o = o || document;
    do {
      if (e != null && (e[0] === ">" ? n.parentNode === o && He(n, e) : He(n, e)) || t && n === o)
        return n;
      if (n === o) break;
    } while (n = $t(n));
  }
  return null;
}
var gt = /\s+/g;
function R(n, e, o) {
  if (n && e)
    if (n.classList)
      n.classList[o ? "add" : "remove"](e);
    else {
      var t = (" " + n.className + " ").replace(gt, " ").replace(" " + e + " ", " ");
      n.className = (t + (o ? " " + e : "")).replace(gt, " ");
    }
}
function m(n, e, o) {
  var t = n && n.style;
  if (t) {
    if (o === void 0)
      return document.defaultView && document.defaultView.getComputedStyle ? o = document.defaultView.getComputedStyle(n, "") : n.currentStyle && (o = n.currentStyle), e === void 0 ? o : o[e];
    !(e in t) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), t[e] = o + (typeof o == "string" ? "" : "px");
  }
}
function ge(n, e) {
  var o = "";
  if (typeof n == "string")
    o = n;
  else
    do {
      var t = m(n, "transform");
      t && t !== "none" && (o = t + " " + o);
    } while (!e && (n = n.parentNode));
  var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
  return r && new r(o);
}
function Ct(n, e, o) {
  if (n) {
    var t = n.getElementsByTagName(e), r = 0, i = t.length;
    if (o)
      for (; r < i; r++)
        o(t[r], r);
    return t;
  }
  return [];
}
function U() {
  var n = document.scrollingElement;
  return n || document.documentElement;
}
function T(n, e, o, t, r) {
  if (!(!n.getBoundingClientRect && n !== window)) {
    var i, a, l, s, c, f, d;
    if (n !== window && n.parentNode && n !== U())
      i = n.getBoundingClientRect(), a = i.top, l = i.left, s = i.bottom, c = i.right, f = i.height, d = i.width;
    else {
      var p = document.documentElement.clientWidth || document.body.clientWidth || window.innerWidth, h = document.documentElement.clientHeight || document.body.clientHeight || window.innerHeight;
      a = 0, l = 0, s = h, c = p, f = h, d = p;
    }
    if ((e || o) && n !== window && (r = r || n.parentNode, !J))
      do
        if (r && r.getBoundingClientRect && (m(r, "transform") !== "none" || o && m(r, "position") !== "static")) {
          var b = r.getBoundingClientRect();
          a -= b.top + parseInt(m(r, "border-top-width")), l -= b.left + parseInt(m(r, "border-left-width")), s = a + i.height, c = l + i.width;
          break;
        }
      while (r = r.parentNode);
    if (t && n !== window) {
      var y = ge(r || n), A = y && y.a, P = y && y.d;
      y && (a /= P, l /= A, d /= A, f /= P, s = a + f, c = l + d);
    }
    return {
      top: a,
      left: l,
      bottom: s,
      right: c,
      width: d,
      height: f
    };
  }
}
function mt(n, e, o) {
  for (var t = re(n, !0), r = T(n)[e]; t; ) {
    var i = T(t)[o], a = void 0;
    if (a = r >= i, !a) return t;
    if (t === U()) break;
    t = re(t, !1);
  }
  return !1;
}
function me(n, e, o, t) {
  for (var r = 0, i = 0, a = n.children; i < a.length; ) {
    if (a[i].style.display !== "none" && a[i] !== g.ghostClone && (t || a[i] !== g.dragged) && z(a[i], o.draggable, n, !1)) {
      if (r === e)
        return a[i];
      r++;
    }
    i++;
  }
  return null;
}
function st(n, e) {
  for (var o = n.lastElementChild; o && (o === g.ghostClone || m(o, "display") === "none" || e && !He(o, e)); )
    o = o.previousElementSibling;
  return o || null;
}
function L(n, e) {
  var o = 0;
  if (!n || !n.parentNode)
    return -1;
  for (; n = n.previousElementSibling; )
    n.nodeName.toUpperCase() !== "TEMPLATE" && n !== g.clone && (!e || He(n, e)) && o++;
  return o;
}
function vt(n) {
  var e = 0, o = 0, t = U();
  if (n)
    do {
      var r = ge(n), i = r.a, a = r.d;
      e += n.scrollLeft * i, o += n.scrollTop * a;
    } while (n !== t && (n = n.parentNode));
  return [e, o];
}
function Kt(n, e) {
  for (var o in n)
    if (n.hasOwnProperty(o)) {
      for (var t in e)
        if (e.hasOwnProperty(t) && e[t] === n[o][t]) return Number(o);
    }
  return -1;
}
function re(n, e) {
  if (!n || !n.getBoundingClientRect) return U();
  var o = n, t = !1;
  do
    if (o.clientWidth < o.scrollWidth || o.clientHeight < o.scrollHeight) {
      var r = m(o);
      if (o.clientWidth < o.scrollWidth && (r.overflowX == "auto" || r.overflowX == "scroll") || o.clientHeight < o.scrollHeight && (r.overflowY == "auto" || r.overflowY == "scroll")) {
        if (!o.getBoundingClientRect || o === document.body) return U();
        if (t || e) return o;
        t = !0;
      }
    }
  while (o = o.parentNode);
  return U();
}
function Zt(n, e) {
  if (n && e)
    for (var o in e)
      e.hasOwnProperty(o) && (n[o] = e[o]);
  return n;
}
function $e(n, e) {
  return Math.round(n.top) === Math.round(e.top) && Math.round(n.left) === Math.round(e.left) && Math.round(n.height) === Math.round(e.height) && Math.round(n.width) === Math.round(e.width);
}
var Oe;
function Ot(n, e) {
  return function() {
    if (!Oe) {
      var o = arguments, t = this;
      o.length === 1 ? n.call(t, o[0]) : n.apply(t, o), Oe = setTimeout(function() {
        Oe = void 0;
      }, e);
    }
  };
}
function Qt() {
  clearTimeout(Oe), Oe = void 0;
}
function Tt(n, e, o) {
  n.scrollLeft += e, n.scrollTop += o;
}
function It(n) {
  var e = window.Polymer, o = window.jQuery || window.Zepto;
  return e && e.dom ? e.dom(n).cloneNode(!0) : o ? o(n).clone(!0)[0] : n.cloneNode(!0);
}
var W = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
function Jt() {
  var n = [], e;
  return {
    captureAnimationState: function() {
      if (n = [], !!this.options.animation) {
        var t = [].slice.call(this.el.children);
        t.forEach(function(r) {
          if (!(m(r, "display") === "none" || r === g.ghostClone)) {
            n.push({
              target: r,
              rect: T(r)
            });
            var i = q({}, n[n.length - 1].rect);
            if (r.thisAnimationDuration) {
              var a = ge(r, !0);
              a && (i.top -= a.f, i.left -= a.e);
            }
            r.fromRect = i;
          }
        });
      }
    },
    addAnimationState: function(t) {
      n.push(t);
    },
    removeAnimationState: function(t) {
      n.splice(Kt(n, {
        target: t
      }), 1);
    },
    animateAll: function(t) {
      var r = this;
      if (!this.options.animation) {
        clearTimeout(e), typeof t == "function" && t();
        return;
      }
      var i = !1, a = 0;
      n.forEach(function(l) {
        var s = 0, c = l.target, f = c.fromRect, d = T(c), p = c.prevFromRect, h = c.prevToRect, b = l.rect, y = ge(c, !0);
        y && (d.top -= y.f, d.left -= y.e), c.toRect = d, c.thisAnimationDuration && $e(p, d) && !$e(f, d) && // Make sure animatingRect is on line between toRect & fromRect
        (b.top - d.top) / (b.left - d.left) === (f.top - d.top) / (f.left - d.left) && (s = tn(b, p, h, r.options)), $e(d, f) || (c.prevFromRect = f, c.prevToRect = d, s || (s = r.options.animation), r.animate(c, b, d, s)), s && (i = !0, a = Math.max(a, 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), i ? e = setTimeout(function() {
        typeof t == "function" && t();
      }, a) : typeof t == "function" && t(), n = [];
    },
    animate: function(t, r, i, a) {
      if (a) {
        m(t, "transition", ""), m(t, "transform", "");
        var l = ge(this.el), s = l && l.a, c = l && l.d, f = (r.left - i.left) / (s || 1), d = (r.top - i.top) / (c || 1);
        t.animatingX = !!f, t.animatingY = !!d, m(t, "transform", "translate3d(" + f + "px," + d + "px,0)"), this.forRepaintDummy = en(t), m(t, "transition", "transform " + a + "ms" + (this.options.easing ? " " + this.options.easing : "")), m(t, "transform", "translate3d(0,0,0)"), typeof t.animated == "number" && clearTimeout(t.animated), t.animated = setTimeout(function() {
          m(t, "transition", ""), m(t, "transform", ""), t.animated = !1, t.animatingX = !1, t.animatingY = !1;
        }, a);
      }
    }
  };
}
function en(n) {
  return n.offsetWidth;
}
function tn(n, e, o, t) {
  return Math.sqrt(Math.pow(e.top - n.top, 2) + Math.pow(e.left - n.left, 2)) / Math.sqrt(Math.pow(e.top - o.top, 2) + Math.pow(e.left - o.left, 2)) * t.animation;
}
var ce = [], Ke = {
  initializeByDefault: !0
}, xe = {
  mount: function(e) {
    for (var o in Ke)
      Ke.hasOwnProperty(o) && !(o in e) && (e[o] = Ke[o]);
    ce.forEach(function(t) {
      if (t.pluginName === e.pluginName)
        throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
    }), ce.push(e);
  },
  pluginEvent: function(e, o, t) {
    var r = this;
    this.eventCanceled = !1, t.cancel = function() {
      r.eventCanceled = !0;
    };
    var i = e + "Global";
    ce.forEach(function(a) {
      o[a.pluginName] && (o[a.pluginName][i] && o[a.pluginName][i](q({
        sortable: o
      }, t)), o.options[a.pluginName] && o[a.pluginName][e] && o[a.pluginName][e](q({
        sortable: o
      }, t)));
    });
  },
  initializePlugins: function(e, o, t, r) {
    ce.forEach(function(l) {
      var s = l.pluginName;
      if (!(!e.options[s] && !l.initializeByDefault)) {
        var c = new l(e, o, e.options);
        c.sortable = e, c.options = e.options, e[s] = c, Q(t, c.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, o) {
    var t = {};
    return ce.forEach(function(r) {
      typeof r.eventProperties == "function" && Q(t, r.eventProperties.call(o[r.pluginName], e));
    }), t;
  },
  modifyOption: function(e, o, t) {
    var r;
    return ce.forEach(function(i) {
      e[i.pluginName] && i.optionListeners && typeof i.optionListeners[o] == "function" && (r = i.optionListeners[o].call(e[i.pluginName], t));
    }), r;
  }
};
function nn(n) {
  var e = n.sortable, o = n.rootEl, t = n.name, r = n.targetEl, i = n.cloneEl, a = n.toEl, l = n.fromEl, s = n.oldIndex, c = n.newIndex, f = n.oldDraggableIndex, d = n.newDraggableIndex, p = n.originalEvent, h = n.putSortable, b = n.extraEventProperties;
  if (e = e || o && o[W], !!e) {
    var y, A = e.options, P = "on" + t.charAt(0).toUpperCase() + t.substr(1);
    window.CustomEvent && !J && !Ae ? y = new CustomEvent(t, {
      bubbles: !0,
      cancelable: !0
    }) : (y = document.createEvent("Event"), y.initEvent(t, !0, !0)), y.to = a || o, y.from = l || o, y.item = r || o, y.clone = i, y.oldIndex = s, y.newIndex = c, y.oldDraggableIndex = f, y.newDraggableIndex = d, y.originalEvent = p, y.pullMode = h ? h.lastPutMode : void 0;
    var I = q(q({}, b), xe.getEventProperties(t, e));
    for (var M in I)
      y[M] = I[M];
    o && o.dispatchEvent(y), A[P] && A[P].call(e, y);
  }
}
var on = ["evt"], X = function(e, o) {
  var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = t.evt, i = qt(t, on);
  xe.pluginEvent.bind(g)(e, o, q({
    dragEl: u,
    parentEl: C,
    ghostEl: v,
    rootEl: D,
    nextEl: ue,
    lastDownEl: Re,
    cloneEl: _,
    cloneHidden: oe,
    dragStarted: Se,
    putSortable: N,
    activeSortable: g.active,
    originalEvent: r,
    oldIndex: pe,
    oldDraggableIndex: Te,
    newIndex: Y,
    newDraggableIndex: ne,
    hideGhostForTarget: Pt,
    unhideGhostForTarget: Bt,
    cloneNowHidden: function() {
      oe = !0;
    },
    cloneNowShown: function() {
      oe = !1;
    },
    dispatchSortableEvent: function(l) {
      F({
        sortable: o,
        name: l,
        originalEvent: r
      });
    }
  }, i));
};
function F(n) {
  nn(q({
    putSortable: N,
    cloneEl: _,
    targetEl: u,
    rootEl: D,
    oldIndex: pe,
    oldDraggableIndex: Te,
    newIndex: Y,
    newDraggableIndex: ne
  }, n));
}
var u, fe, C, v, we, Ee, D, ue, Re, _, oe, pe, Y, Te, ne, Be, N, he = !1, je = !1, Ge = [], le, G, Ze, Qe, bt, yt, Se, de, Ie, Ne = !1, ke = !1, Ye, x, Je = [], rt = !1, ze = [], qe = typeof document < "u", Fe = St, Et = Ae || J ? "cssFloat" : "float", rn = qe && !Dt && !St && "draggable" in document.createElement("div"), Nt = (function() {
  if (qe) {
    if (J)
      return !1;
    var n = document.createElement("x");
    return n.style.cssText = "pointer-events:auto", n.style.pointerEvents === "auto";
  }
})(), At = function(e, o) {
  var t = m(e), r = parseInt(t.width) - parseInt(t.paddingLeft) - parseInt(t.paddingRight) - parseInt(t.borderLeftWidth) - parseInt(t.borderRightWidth), i = me(e, 0, o), a = me(e, 1, o), l = i && m(i), s = a && m(a), c = l && parseInt(l.marginLeft) + parseInt(l.marginRight) + T(i).width, f = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + T(a).width;
  if (t.display === "flex")
    return t.flexDirection === "column" || t.flexDirection === "column-reverse" ? "vertical" : "horizontal";
  if (t.display === "grid")
    return t.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
  if (i && l.float && l.float !== "none") {
    var d = l.float === "left" ? "left" : "right";
    return a && (s.clear === "both" || s.clear === d) ? "vertical" : "horizontal";
  }
  return i && (l.display === "block" || l.display === "flex" || l.display === "table" || l.display === "grid" || c >= r && t[Et] === "none" || a && t[Et] === "none" && c + f > r) ? "vertical" : "horizontal";
}, an = function(e, o, t) {
  var r = t ? e.left : e.top, i = t ? e.right : e.bottom, a = t ? e.width : e.height, l = t ? o.left : o.top, s = t ? o.right : o.bottom, c = t ? o.width : o.height;
  return r === l || i === s || r + a / 2 === l + c / 2;
}, ln = function(e, o) {
  var t;
  return Ge.some(function(r) {
    var i = r[W].options.emptyInsertThreshold;
    if (!(!i || st(r))) {
      var a = T(r), l = e >= a.left - i && e <= a.right + i, s = o >= a.top - i && o <= a.bottom + i;
      if (l && s)
        return t = r;
    }
  }), t;
}, xt = function(e) {
  function o(i, a) {
    return function(l, s, c, f) {
      var d = l.options.group.name && s.options.group.name && l.options.group.name === s.options.group.name;
      if (i == null && (a || d))
        return !0;
      if (i == null || i === !1)
        return !1;
      if (a && i === "clone")
        return i;
      if (typeof i == "function")
        return o(i(l, s, c, f), a)(l, s, c, f);
      var p = (a ? l : s).options.group.name;
      return i === !0 || typeof i == "string" && i === p || i.join && i.indexOf(p) > -1;
    };
  }
  var t = {}, r = e.group;
  (!r || Xe(r) != "object") && (r = {
    name: r
  }), t.name = r.name, t.checkPull = o(r.pull, !0), t.checkPut = o(r.put), t.revertClone = r.revertClone, e.group = t;
}, Pt = function() {
  !Nt && v && m(v, "display", "none");
}, Bt = function() {
  !Nt && v && m(v, "display", "");
};
qe && !Dt && document.addEventListener("click", function(n) {
  if (je)
    return n.preventDefault(), n.stopPropagation && n.stopPropagation(), n.stopImmediatePropagation && n.stopImmediatePropagation(), je = !1, !1;
}, !0);
var se = function(e) {
  if (u) {
    e = e.touches ? e.touches[0] : e;
    var o = ln(e.clientX, e.clientY);
    if (o) {
      var t = {};
      for (var r in e)
        e.hasOwnProperty(r) && (t[r] = e[r]);
      t.target = t.rootEl = o, t.preventDefault = void 0, t.stopPropagation = void 0, o[W]._onDragOver(t);
    }
  }
}, sn = function(e) {
  u && u.parentNode[W]._isOutsideThisEl(e.target);
};
function g(n, e) {
  if (!(n && n.nodeType && n.nodeType === 1))
    throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(n));
  this.el = n, this.options = e = Q({}, e), n[W] = this;
  var o = {
    group: null,
    sort: !0,
    disabled: !1,
    store: null,
    handle: null,
    draggable: /^[uo]l$/i.test(n.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 At(n, 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, l) {
      a.setData("Text", l.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 && !Ce,
    emptyInsertThreshold: 5,
    extOption: {
      boundary: {
        isOut: !1,
        element: "",
        x: 0,
        y: 0
      },
      wrapBody: {
        isWrap: !1,
        element: ""
      },
      cross: {
        isCross: !1,
        isSameStruct: !0,
        dropEndBeforeCallback: null
      }
    }
  };
  xe.initializePlugins(this, n, o);
  for (var t in o)
    !(t in e) && (e[t] = o[t]);
  xt(e);
  for (var r in this)
    r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this));
  this.nativeDraggable = e.forceFallback ? !1 : rn, this.nativeDraggable && (this.options.touchStartThreshold = 1), e.supportPointer ? w(n, "pointerdown", this._onTapStart) : (w(n, "mousedown", this._onTapStart), w(n, "touchstart", this._onTapStart)), this.nativeDraggable && (w(n, "dragover", this), w(n, "dragenter", this)), Ge.push(this.el), e.store && e.store.get && this.sort(e.store.get(this) || []), Q(this, Jt());
}
g.prototype = /** @lends Sortable.prototype */
{
  constructor: g,
  _isOutsideThisEl: function(e) {
    !this.el.contains(e) && e !== this.el && (de = null);
  },
  _getDirection: function(e, o) {
    return typeof this.options.direction == "function" ? this.options.direction.call(this, e, o, u) : this.options.direction;
  },
  _onTapStart: function(e) {
    if (e.cancelable) {
      var o = this, t = this.el, r = this.options, i = r.preventOnFilter, a = e.type, l = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (l || e).target, c = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, f = r.filter;
      if (mn(t), !u && !(/mousedown|pointerdown/.test(a) && e.button !== 0 || r.disabled) && !c.isContentEditable && !(!this.nativeDraggable && Ce && s && s.tagName.toUpperCase() === "SELECT") && (s = z(s, r.draggable, t, !1), !(s && s.animated) && Re !== s)) {
        if (pe = L(s), Te = L(s, r.draggable), typeof f == "function") {
          if (f.call(this, e, s, this)) {
            F({
              sortable: o,
              rootEl: c,
              name: "filter",
              targetEl: s,
              toEl: t,
              fromEl: t
            }), X("filter", o, {
              evt: e
            }), i && e.cancelable && e.preventDefault();
            return;
          }
        } else if (f && (f = f.split(",").some(function(d) {
          if (d = z(c, d.trim(), t, !1), d)
            return F({
              sortable: o,
              rootEl: d,
              name: "filter",
              targetEl: s,
              fromEl: t,
              toEl: t
            }), X("filter", o, {
              evt: e
            }), !0;
        }), f)) {
          i && e.cancelable && e.preventDefault();
          return;
        }
        r.handle && !z(c, r.handle, t, !1) || this._prepareDragStart(e, l, s);
      }
    }
  },
  _prepareDragStart: function(e, o, t) {
    var r = this, i = r.el, a = r.options, l = i.ownerDocument, s;
    if (t && !u && t.parentNode === i) {
      var c = T(t);
      if (D = i, u = t, C = u.parentNode, ue = u.nextSibling, Re = t, Be = a.group, g.dragged = u, le = {
        target: u,
        clientX: (o || e).clientX,
        clientY: (o || e).clientY
      }, bt = le.clientX - c.left, yt = le.clientY - c.top, this._lastX = (o || e).clientX, this._lastY = (o || e).clientY, u.style["will-change"] = "all", s = function() {
        if (X("delayEnded", r, {
          evt: e
        }), g.eventCanceled) {
          r._onDrop();
          return;
        }
        r._disableDelayedDragEvents(), !pt && r.nativeDraggable && (u.draggable = !0), r._triggerDragStart(e, o), F({
          sortable: r,
          name: "choose",
          originalEvent: e
        }), R(u, a.chosenClass, !0);
      }, a.ignore.split(",").forEach(function(f) {
        Ct(u, f.trim(), et);
      }), w(l, "dragover", se), w(l, "mousemove", se), w(l, "touchmove", se), w(l, "mouseup", r._onDrop), w(l, "touchend", r._onDrop), w(l, "touchcancel", r._onDrop), pt && this.nativeDraggable && (this.options.touchStartThreshold = 4, u.draggable = !0), X("delayStart", this, {
        evt: e
      }), a.delay && (!a.delayOnTouchOnly || o) && (!this.nativeDraggable || !(Ae || J))) {
        if (g.eventCanceled) {
          this._onDrop();
          return;
        }
        w(l, "mouseup", r._disableDelayedDrag), w(l, "touchend", r._disableDelayedDrag), w(l, "touchcancel", r._disableDelayedDrag), w(l, "mousemove", r._delayedDragTouchMoveHandler), w(l, "touchmove", r._delayedDragTouchMoveHandler), a.supportPointer && w(l, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(s, a.delay);
      } else
        s();
    }
  },
  _delayedDragTouchMoveHandler: function(e) {
    var o = e.touches ? e.touches[0] : e;
    Math.max(Math.abs(o.clientX - this._lastX), Math.abs(o.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
  },
  _disableDelayedDrag: function() {
    u && et(u), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
  },
  _disableDelayedDragEvents: function() {
    var e = this.el.ownerDocument;
    E(e, "mouseup", this._disableDelayedDrag), E(e, "touchend", this._disableDelayedDrag), E(e, "touchcancel", this._disableDelayedDrag), E(e, "mousemove", this._delayedDragTouchMoveHandler), E(e, "touchmove", this._delayedDragTouchMoveHandler), E(e, "pointermove", this._delayedDragTouchMoveHandler);
  },
  _triggerDragStart: function(e, o) {
    o = o || e.pointerType == "touch" && e, !this.nativeDraggable || o ? this.options.supportPointer ? w(document, "pointermove", this._onTouchMove) : o ? w(document, "touchmove", this._onTouchMove) : w(document, "mousemove", this._onTouchMove) : (w(u, "dragend", this), w(D, "dragstart", this._onDragStart));
    try {
      document.selection ? Le(function() {
        document.selection.empty();
      }) : window.getSelection().removeAllRanges();
    } catch {
    }
  },
  _dragStarted: function(e, o) {
    if (he = !1, D && u) {
      X("dragStarted", this, {
        evt: o
      }), this.nativeDraggable && w(document, "dragover", sn);
      var t = this.options;
      !e && R(u, t.dragClass, !1), R(u, t.ghostClass, !0), g.active = this, e && this._appendGhost(), F({
        sortable: this,
        name: "start",
        originalEvent: o
      });
    } else
      this._nulling();
  },
  _emulateDragOver: function() {
    if (G) {
      this._lastX = G.clientX, this._lastY = G.clientY, Pt();
      for (var e = document.elementFromPoint(G.clientX, G.clientY), o = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(G.clientX, G.clientY), e !== o); )
        o = e;
      if (u.parentNode[W]._isOutsideThisEl(e), o)
        do {
          if (o[W]) {
            var t = void 0;
            if (t = o[W]._onDragOver({
              clientX: G.clientX,
              clientY: G.clientY,
              target: e,
              rootEl: o
            }), t && !this.options.dragoverBubble)
              break;
          }
          e = o;
        } while (o = o.parentNode);
      Bt();
    }
  },
  _onTouchMove: function(e) {
    if (le) {
      var o = this.options, t = o.fallbackTolerance, r = o.fallbackOffset, i = e.touches ? e.touches[0] : e, a = v && ge(v, !0), l = v && a && a.a, s = v && a && a.d, c = Fe && x && vt(x), f = (i.clientX - le.clientX + r.x) / (l || 1) + (c ? c[0] - Je[0] : 0) / (l || 1), d = (i.clientY - le.clientY + r.y) / (s || 1) + (c ? c[1] - Je[1] : 0) / (s || 1);
      if (!g.active && !he) {
        if (t && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < t)
          return;
        this._onDragStart(e, !0);
      }
      if (v) {
        const h = S.checkMoveOutBoundary(v, this.el, this.options);
        h.isOut ? Ee ? (a.e = Ee.e, a.f = Ee.f) : (h.top && (a.f = h.x * -1), h.right && (a.e = h.y), h.bottom && (a.f = h.x), h.left && (a.e = h.y * -1)) : a ? (a.e += f - (Ze || 0), a.f += d - (Qe || 0)) : a = {
          a: 1,
          b: 0,
          c: 0,
          d: 1,
          e: f,
          f: d
        };
        var p = "matrix(".concat(a.a, ",").concat(a.b, ",").concat(a.c, ",").concat(a.d, ",").concat(a.e, ",").concat(a.f, ")");
        m(v, "webkitTransform", p), m(v, "mozTransform", p), m(v, "msTransform", p), m(v, "transform", p), Ze = f, Qe = d, G = i, S.checkMoveOutBoundary(v, this.el, this.options).isOut || (Ee = a);
      }
      e.cancelable && e.preventDefault();
    }
  },
  _appendGhost: function() {
    if (!v) {
      var e = this.options.fallbackOnBody ? document.body : D, o = T(u, !0, Fe, !0, e), t = this.options;
      if (Fe) {
        for (x = e; m(x, "position") === "static" && m(x, "transform") === "none" && x !== document; )
          x = x.parentNode;
        x !== document.body && x !== document.documentElement ? (x === document && (x = U()), o.top += x.scrollTop, o.left += x.scrollLeft) : x = U(), Je = vt(x);
      }
      we = u.cloneNode(!0), v = u.cloneNode(!0), v = S.setWrapBody(v, this.el, this.options), R(v, t.ghostClass, !1), R(v, t.fallbackClass, !0), R(v, t.dragClass, !0), m(v, "transition", ""), m(v, "transform", ""), m(v, "box-sizing", "border-box"), m(v, "margin", 0), m(v, "top", o.top), m(v, "left", o.left), m(v, "width", o.width), m(v, "height", o.height), m(v, "opacity", "0.8"), m(v, "position", Fe ? "absolute" : "fixed"), m(v, "zIndex", "100000"), m(v, "pointerEvents", "none"), g.ghost = v, g.ghostClone = we, e.appendChild(v), m(v, "transform-origin", bt / parseInt(v.style.width) * 100 + "% " + yt / parseInt(v.style.height) * 100 + "%");
    }
  },
  _onDragStart: function(e, o) {
    var t = this, r = e.dataTransfer, i = t.options;
    if (X("dragStart", this, {
      evt: e
    }), g.eventCanceled) {
      this._onDrop();
      return;
    }
    X("setupClone", this), g.eventCanceled || (_ = It(u), _.removeAttribute("id"), _.draggable = !1, _.style["will-change"] = "", this._hideClone(), R(_, this.options.chosenClass, !1), g.clone = _), t.cloneId = Le(function() {
      X("clone", t), !g.eventCanceled && (t.options.removeCloneOnHide || D.insertBefore(_, u), t._hideClone(), F({
        sortable: t,
        name: "clone"
      }));
    }), !o && R(u, i.dragClass, !0), o ? (je = !0, t._loopId = setInterval(t._emulateDragOver, 50)) : (E(document, "mouseup", t._onDrop), E(document, "touchend", t._onDrop), E(document, "touchcancel", t._onDrop), r && (r.effectAllowed = "move", i.setData && i.setData.call(t, r, u)), w(document, "drop", t), m(u, "transform", "translateZ(0)")), he = !0, t._dragStartId = Le(t._dragStarted.bind(t, o, e)), w(document, "selectstart", t), Se = !0, Ce && m(document.body, "user-select", "none");
  },
  // Returns true - if no further action is needed (either inserted or another condition)
  _onDragOver: function(e) {
    var o = this.el, t = e.target, r, i, a, l = this.options, s = l.group, c = g.active, f = Be === s, d = l.sort, p = N || c, h, b = this, y = !1;
    if (rt) return;
    function A(ye, Ft) {
      X(ye, b, q({
        evt: e,
        isOwner: f,
        axis: h ? "vertical" : "horizontal",
        revert: a,
        dragRect: r,
        targetRect: i,
        canSort: d,
        fromSortable: p,
        target: t,
        completed: I,
        onMove: function(dt, Mt) {
          return Me(D, o, u, r, dt, T(dt), e, Mt);
        },
        changed: M
      }, Ft));
    }
    function P() {
      A("dragOverAnimationCapture"), b.captureAnimationState(), b !== p && p.captureAnimationState();
    }
    function I(ye) {
      return A("dragOverCompleted", {
        insertion: ye
      }), ye && (f ? c._hideClone() : c._showClone(b), b !== p && (R(u, N ? N.options.ghostClass : c.options.ghostClass, !1), R(u, l.ghostClass, !0)), N !== b && b !== g.active ? N = b : b === g.active && N && (N = null), p === b && (b._ignoreWhileAnimating = t), b.animateAll(function() {
        A("dragOverAnimationComplete"), b._ignoreWhileAnimating = null;
      }), b !== p && (p.animateAll(), p._ignoreWhileAnimating = null)), (t === u && !u.animated || t === o && !t.animated) && (de = null), !l.dragoverBubble && !e.rootEl && t !== document && (u.parentNode[W]._isOutsideThisEl(e.target), !ye && se(e)), !l.dragoverBubble && e.stopPropagation && e.stopPropagation(), y = !0;
    }
    function M() {
      Y = L(u), ne = L(u, l.draggable), F({
        sortable: b,
        name: "change",
        toEl: o,
        newIndex: Y,
        newDraggableIndex: ne,
        originalEvent: e
      });
    }
    if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), t = z(t, l.draggable, o, !0), A("dragOver"), g.eventCanceled) return y;
    if (u.contains(e.target) || t.animated && t.animatingX && t.animatingY || b._ignoreWhileAnimating === t)
      return I(!1);
    if (je = !1, c && !l.disabled && (f ? d || (a = C !== D) : N === this || (this.lastPutMode = Be.checkPull(this, c, u, e)) && s.checkPut(this, c, u, e))) {
      if (h = this._getDirection(e, t) === "vertical", r = T(u), A("dragOverValid"), g.eventCanceled) return y;
      if (a)
        return C = D, P(), this._hideClone(), A("revert"), g.eventCanceled || (S.setCrossEl(t, this.options), ue ? D.insertBefore(u, ue) : D.appendChild(u)), I(!0);
      var B = st(o, l.draggable);
      if (!B || fn(e, h, this) && !B.animated) {
        if (B === u)
          return I(!1);
        if (B && o === e.target && (t = B), t && (i = T(t)), Me(D, o, u, r, t, i, e, !!t) !== !1)
          return P(), S.setCrossEl(t, this.options), B && B.nextSibling ? o.insertBefore(u, B.nextSibling) : o.appendChild(u), C = o, M(), I(!0);
      } else if (B && dn(e, h, this)) {
        var V = me(o, 0, l, !0);
        if (V === u)
          return I(!1);
        if (t = V, i = T(t), Me(D, o, u, r, t, i, e, !1) !== !1)
          return P(), S.setCrossEl(t, this.options), o.insertBefore(u, V), C = o, M(), I(!0);
      } else if (t.parentNode === o) {
        i = T(t);
        var H = 0, $, ie = u.parentNode !== o, k = !an(u.animated && u.toRect || r, t.animated && t.toRect || i, h), j = h ? "top" : "left", ee = mt(t, "top", "top") || mt(u, "top", "top"), ve = ee ? ee.scrollTop : void 0;
        de !== t && ($ = i[j], Ne = !1, ke = !k && l.invertSwap || ie), H = hn(e, t, i, h, k ? 1 : l.swapThreshold, l.invertedSwapThreshold == null ? l.swapThreshold : l.invertedSwapThreshold, ke, de === t);
        var K;
        if (H !== 0) {
          var ae = L(u);
          do
            ae -= H, K = C.children[ae];
          while (K && (m(K, "display") === "none" || K === we));
        }
        if (H === 0 || K === t)
          return I(!1);
        de = t, Ie = H;
        var be = t.nextElementSibling, te = !1;
        te = H === 1;
        var Pe = Me(D, o, u, r, t, i, e, te);
        if (Pe !== !1)
          return (Pe === 1 || Pe === -1) && (te = Pe === 1), rt = !0, setTimeout(cn, 30), P(), S.setCrossEl(t, this.options), te && !be ? o.appendChild(u) : t.parentNode.insertBefore(u, te ? be : t), ee && Tt(ee, 0, ve - ee.scrollTop), C = u.parentNode, $ !== void 0 && !ke && (Ye = Math.abs($ - T(t)[j])), M(), I(!0);
      }
      if (o.contains(u))
        return I(!1);
    }
    return !1;
  },
  _ignoreWhileAnimating: null,
  _offMoveEvents: function() {
    E(document, "mousemove", this._onTouchMove), E(document, "touchmove", this._onTouchMove), E(document, "pointermove", this._onTouchMove), E(document, "dragover", se), E(document, "mousemove", se), E(document, "touchmove", se);
  },
  _offUpEvents: function() {
    var e = this.el.ownerDocument;
    E(e, "mouseup", this._onDrop), E(e, "touchend", this._onDrop), E(e, "pointerup", this._onDrop), E(e, "touchcancel", this._onDrop), E(document, "selectstart", this);
  },
  _onDrop: function(e) {
    S.crossDropEnd(this.options).then((o) => {
      if (o) {
        var t = this.el, r = this.options;
        if (Y = L(u), ne = L(u, r.draggable), X("drop", this, {
          evt: e
        }), C = u && u.parentNode, Y = L(u), ne = L(u, r.draggable), g.eventCanceled) {
          this._nulling();
          return;
        }
        he = !1, ke = !1, Ne = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), it(this.cloneId), it(this._dragStartId), this.nativeDraggable && (E(document, "drop", this), E(t, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Ce && m(document.body, "user-select", ""), m(u, "transform", ""), e && (Se && (e.cancelable && e.preventDefault(), !r.dropBubble && e.stopPropagation()), v && v.parentNode && v.parentNode.removeChild(v), (D === C || N && N.lastPutMode !== "clone") && _ && _.parentNode && _.parentNode.removeChild(_), u && (this.nativeDraggable && E(u, "dragend", this), et(u), u.style["will-change"] = "", Se && !he && R(u, N ? N.options.ghostClass : this.options.ghostClass, !1), R(u, this.options.chosenClass, !1), F({
          sortable: this,
          name: "unchoose",
          toEl: C,
          newIndex: null,
          newDraggableIndex: null,
          originalEvent: e
        }), D !== C ? (Y >= 0 && (F({
          rootEl: C,
          name: "add",
          toEl: C,
          fromEl: D,
          originalEvent: e
        }), F({
          sortable: this,
          name: "remove",
          toEl: C,
          originalEvent: e
        }), F({
          rootEl: C,
          name: "sort",
          toEl: C,
          fromEl: D,
          originalEvent: e
        }), F({
          sortable: this,
          name: "sort",
          toEl: C,
          originalEvent: e
        })), N && N.save()) : Y !== pe && Y >= 0 && (F({
          sortable: this,
          name: "update",
          toEl: C,
          originalEvent: e
        }), F({
          sortable: this,
          name: "sort",
          toEl: C,
          originalEvent: e
        })), g.active && ((Y == null || Y === -1) && (Y = pe, ne = Te), F({
          sortable: this,
          name: "end",
          toEl: C,
          originalEvent: e
        }), this.save()))), this._nulling();
      }
    });
  },
  _nulling: function() {
    X("nulling", this), D = u = fe = C = v = we = ue = _ = Re = oe = le = G = Se = Y = ne = pe = Te = de = Ie = N = Be = g.dragged = g.ghost = g.ghostClone = g.clone = g.active = Ee = null, ze.forEach(function(e) {
      e.checked = !0;
    }), ze.length = Ze = Qe = 0;
  },
  handleEvent: function(e) {
    switch (e.type) {
      case "drop":
      case "dragend":
        this._onDrop(e);
        break;
      case "dragenter":
      case "dragover":
        u && (this._onDragOver(e), un(e));
        break;
      case "selectstart":
        e.preventDefault();
        break;
    }
  },
  /**
   * Serializes the item into an array of string.
   * @returns {String[]}
   */
  toArray: function(e) {
    for (var o = [], t, r = this.el.children, i = 0, a = r.length, l = this.options; i < a; i++)
      t = r[i], z(t, l.draggable, this.el, !1) && o.push(t.getAttribute(l.dataIdAttr) || gn(t));
    return o;
  },
  /**
   * Sorts the elements according to the array.
   * @param  {String[]}  order  order of the items
   */
  sort: function(e, o) {
    var t = {}, r = this.el;
    this.toArray().forEach(function(i, a) {
      var l = r.children[a];
      z(l, this.options.draggable, r, !1) && (t[i] = l);
    }, this), o && this.captureAnimationState(), e.forEach(function(i) {
      t[i] && (r.removeChild(t[i]), r.appendChild(t[i]));
    }), o && 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, o) {
    return z(e, o || this.options.draggable, this.el, !1);
  },
  /**
   * Set/get option
   * @param   {string} name
   * @param   {*}      [value]
   * @returns {*}
   */
  option: function(e, o) {
    var t = this.options;
    if (o === void 0)
      return t[e];
    var r = xe.modifyOption(this, e, o);
    typeof r < "u" ? t[e] = r : t[e] = o, e === "group" && xt(t);
  },
  /**
   * Destroy
   */
  destroy: function() {
    X("destroy", this);
    var e = this.el;
    e[W] = null, E(e, "mousedown", this._onTapStart), E(e, "touchstart", this._onTapStart), E(e, "pointerdown", this._onTapStart), this.nativeDraggable && (E(e, "dragover", this), E(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(o) {
      o.removeAttribute("draggable");
    }), this._onDrop(), this._disableDelayedDragEvents(), Ge.splice(Ge.indexOf(this.el), 1), this.el = e = null;
  },
  _hideClone: function() {
    if (!oe) {
      if (X("hideClone", this), g.eventCanceled) return;
      m(_, "display", "none"), this.options.removeCloneOnHide && _.parentNode && _.parentNode.removeChild(_), oe = !0;
    }
  },
  _showClone: function(e) {
    if (e.lastPutMode !== "clone") {
      this._hideClone();
      return;
    }
    if (oe) {
      if (X("showClone", this), g.eventCanceled) return;
      u.parentNode == D && !this.options.group.revertClone ? D.insertBefore(_, u) : ue ? D.insertBefore(_, ue) : D.appendChild(_), this.options.group.revertClone && this.animate(u, _), m(_, "display", ""), oe = !1;
    }
  }
};
function un(n) {
  n.dataTransfer && (n.dataTransfer.dropEffect = "move"), n.cancelable && n.preventDefault();
}
function Me(n, e, o, t, r, i, a, l) {
  var s, c = n[W], f = c.options.onMove, d;
  return window.CustomEvent && !J && !Ae ? s = new CustomEvent("move", {
    bubbles: !0,
    cancelable: !0
  }) : (s = document.createEvent("Event"), s.initEvent("move", !0, !0)), s.to = e, s.from = n, s.dragged = o, s.draggedRect = t, s.related = r || e, s.relatedRect = i || T(e), s.willInsertAfter = l, s.originalEvent = a, n.dispatchEvent(s), f && (d = f.call(c, s, a)), d;
}
function et(n) {
  n.draggable = !1;
}
function cn() {
  rt = !1;
}
function dn(n, e, o) {
  var t = T(me(o.el, 0, o.options, !0)), r = 10;
  return e ? n.clientX < t.left - r || n.clientY < t.top && n.clientX < t.right : n.clientY < t.top - r || n.clientY < t.bottom && n.clientX < t.left;
}
function fn(n, e, o) {
  var t = T(st(o.el, o.options.draggable)), r = 10;
  return e ? n.clientX > t.right + r || n.clientX <= t.right && n.clientY > t.bottom && n.clientX >= t.left : n.clientX > t.right && n.clientY > t.top || n.clientX <= t.right && n.clientY > t.bottom + r;
}
function hn(n, e, o, t, r, i, a, l) {
  var s = t ? n.clientY : n.clientX, c = t ? o.height : o.width, f = t ? o.top : o.left, d = t ? o.bottom : o.right, p = !1;
  if (!a) {
    if (l && Ye < c * r) {
      if (!Ne && (Ie === 1 ? s > f + c * i / 2 : s < d - c * i / 2) && (Ne = !0), Ne)
        p = !0;
      else if (Ie === 1 ? s < f + Ye : s > d - Ye)
        return -Ie;
    } else if (s > f + c * (1 - r) / 2 && s < d - c * (1 - r) / 2)
      return pn(e);
  }
  return p = p || a, p && (s < f + c * i / 2 || s > d - c * i / 2) ? s > f + c / 2 ? 1 : -1 : 0;
}
function pn(n) {
  return L(u) < L(n) ? 1 : -1;
}
function gn(n) {
  for (var e = n.tagName + n.className + n.src + n.href + n.textContent, o = e.length, t = 0; o--; )
    t += e.charCodeAt(o);
  return t.toString(36);
}
function mn(n) {
  ze.length = 0;
  for (var e = n.getElementsByTagName("input"), o = e.length; o--; ) {
    var t = e[o];
    t.checked && ze.push(t);
  }
}
function Le(n) {
  return setTimeout(n, 0);
}
function it(n) {
  return clearTimeout(n);
}
qe && w(document, "touchmove", function(n) {
  (g.active || he) && n.cancelable && n.preventDefault();
});
g.utils = {
  on: w,
  off: E,
  css: m,
  find: Ct,
  is: function(e, o) {
    return !!z(e, o, e, !1);
  },
  extend: Zt,
  throttle: Ot,
  closest: z,
  toggleClass: R,
  clone: It,
  index: L,
  nextTick: Le,
  cancelNextTick: it,
  detectDirection: At,
  getChild: me
};
g.get = function(n) {
  return n[W];
};
g.mount = function() {
  for (var n = arguments.length, e = new Array(n), o = 0; o < n; o++)
    e[o] = arguments[o];
  e[0].constructor === Array && (e = e[0]), e.forEach(function(t) {
    if (!t.prototype || !t.prototype.constructor)
      throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));
    t.utils && (g.utils = q(q({}, g.utils), t.utils)), xe.mount(t);
  });
};
g.create = function(n, e) {
  return new g(n, e);
};
g.version = Vt;
var O = [], De, at, lt = !1, tt, nt, Ue, _e;
function vn() {
  function n() {
    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 n.prototype = {
    dragStarted: function(o) {
      var t = o.originalEvent;
      this.sortable.nativeDraggable ? w(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? w(document, "pointermove", this._handleFallbackAutoScroll) : t.touches ? w(document, "touchmove", this._handleFallbackAutoScroll) : w(document, "mousemove", this._handleFallbackAutoScroll);
    },
    dragOverCompleted: function(o) {
      var t = o.originalEvent;
      !this.options.dragOverBubble && !t.rootEl && this._handleAutoScroll(t);
    },
    drop: function() {
      this.sortable.nativeDraggable ? E(document, "dragover", this._handleAutoScroll) : (E(document, "pointermove", this._handleFallbackAutoScroll), E(document, "touchmove", this._handleFallbackAutoScroll), E(document, "mousemove", this._handleFallbackAutoScroll)), wt(), We(), Qt();
    },
    nulling: function() {
      Ue = at = De = lt = _e = tt = nt = null, O.length = 0;
    },
    _handleFallbackAutoScroll: function(o) {
      this._handleAutoScroll(o, !0);
    },
    _handleAutoScroll: function(o, t) {
      var r = this, i = (o.touches ? o.touches[0] : o).clientX, a = (o.touches ? o.touches[0] : o).clientY, l = document.elementFromPoint(i, a);
      if (Ue = o, t || this.options.forceAutoScrollFallback || Ae || J || Ce) {
        ot(o, this.options, l, t);
        var s = re(l, !0);
        lt && (!_e || i !== tt || a !== nt) && (_e && wt(), _e = setInterval(function() {
          var c = re(document.elementFromPoint(i, a), !0);
          c !== s && (s = c, We()), ot(o, r.options, c, t);
        }, 10), tt = i, nt = a);
      } else {
        if (!this.options.bubbleScroll || re(l, !0) === U()) {
          We();
          return;
        }
        ot(o, this.options, re(l, !1), !1);
      }
    }
  }, Q(n, {
    pluginName: "scroll",
    initializeByDefault: !0
  });
}
function We() {
  O.forEach(function(n) {
    clearInterval(n.pid);
  }), O = [];
}
function wt() {
  clearInterval(_e);
}
var ot = Ot(function(n, e, o, t) {
  if (e.scroll) {
    var r = (n.touches ? n.touches[0] : n).clientX, i = (n.touches ? n.touches[0] : n).clientY, a = e.scrollSensitivity, l = e.scrollSpeed, s = U(), c = !1, f;
    at !== o && (at = o, We(), De = e.scroll, f = e.scrollFn, De === !0 && (De = re(o, !0)));
    var d = 0, p = De;
    do {
      var h = p, b = T(h), y = b.top, A = b.bottom, P = b.left, I = b.right, M = b.width, B = b.height, V = void 0, H = void 0, $ = h.scrollWidth, ie = h.scrollHeight, k = m(h), j = h.scrollLeft, ee = h.scrollTop;
      h === s ? (V = M < $ && (k.overflowX === "auto" || k.overflowX === "scroll" || k.overflowX === "visible"), H = B < ie && (k.overflowY === "auto" || k.overflowY === "scroll" || k.overflowY === "visible")) : (V = M < $ && (k.overflowX === "auto" || k.overflowX === "scroll"), H = B < ie && (k.overflowY === "auto" || k.overflowY === "scroll"));
      var ve = V && (Math.abs(I - r) <= a && j + M < $) - (Math.abs(P - r) <= a && !!j), K = H && (Math.abs(A - i) <= a && ee + B < ie) - (Math.abs(y - i) <= a && !!ee);
      if (!O[d])
        for (var ae = 0; ae <= d; ae++)
          O[ae] || (O[ae] = {});
      (O[d].vx != ve || O[d].vy != K || O[d].el !== h) && (O[d].el = h, O[d].vx = ve, O[d].vy = K, clearInterval(O[d].pid), (ve != 0 || K != 0) && (c = !0, O[d].pid = setInterval(function() {
        t && this.layer === 0 && g.active._onTouchMove(Ue);
        var be = O[this.layer].vy ? O[this.layer].vy * l : 0, te = O[this.layer].vx ? O[this.layer].vx * l : 0;
        typeof f == "function" && f.call(g.dragged.parentNode[W], te, be, n, Ue, O[this.layer].el) !== "continue" || Tt(O[this.layer].el, te, be);
      }.bind({
        layer: d
      }), 24))), d++;
    } while (e.bubbleScroll && p !== s && (p = re(p, !1)));
    lt = c;
  }
}, 30), kt = function(e) {
  var o = e.originalEvent, t = e.putSortable, r = e.dragEl, i = e.activeSortable, a = e.dispatchSortableEvent, l = e.hideGhostForTarget, s = e.unhideGhostForTarget;
  if (o) {
    var c = t || i;
    l();
    var f = o.changedTouches && o.changedTouches.length ? o.changedTouches[0] : o, d = document.elementFromPoint(f.clientX, f.clientY);
    s(), c && !c.el.contains(d) && (a("spill"), this.onSpill({
      dragEl: r,
      putSortable: t
    }));
  }
};
function ut() {
}
ut.prototype = {
  startIndex: null,
  dragStart: function(e) {
    var o = e.oldDraggableIndex;
    this.startIndex = o;
  },
  onSpill: function(e) {
    var o = e.dragEl, t = e.putSortable;
    this.sortable.captureAnimationState(), t && t.captureAnimationState();
    var r = me(this.sortable.el, this.startIndex, this.options);
    r ? this.sortable.el.insertBefore(o, r) : this.sortable.el.appendChild(o), this.sortable.animateAll(), t && t.animateAll();
  },
  drop: kt
};
Q(ut, {
  pluginName: "revertOnSpill"
});
function ct() {
}
ct.prototype = {
  onSpill: function(e) {
    var o = e.dragEl, t = e.putSortable, r = t || this.sortable;
    r.captureAnimationState(), o.parentNode && o.parentNode.removeChild(o), r.animateAll();
  },
  drop: kt
};
Q(ct, {
  pluginName: "removeOnSpill"
});
const S = {
  isBoolean: (n) => typeof n == "boolean",
  isFunction: (n) => typeof n == "function",
  isUndefined: (n) => typeof n > "u" || n === null,
  getOffset: (n) => {
    const e = n.getBoundingClientRect(), t = (n && n.ownerDocument).documentElement;
    let r;
    if (t.toString() !== "[object Window]") {
      const i = n.ownerDocument;
      r = i && i.defaultView || window;
    } else
      r = t;
    return {
      top: e.top + (r.pageYOffset || t.scrollTop) - (t.clientTop || 0),
      left: e.left + (r.pageXOffset || t.scrollLeft) - (t.clientLeft || 0),
      width: e.width,
      height: e.height
    };
  },
  createElement: (n) => {
    if (n.substring(0, 1) === "<") {
      const o = document.createElement("div");
      return o.innerHTML = n, o.children[0];
    } else
      return document.createElement(n);
  },
  getElementData: (n, e) => {
    const o = [], t = n.children, r = t.length;
    let i;
    for (let a = 0; a < r; a++) {
      i = t[a];
      const l = i.getAttribute(e.dataIdAttr);
      l && l.length > 0 && o.push(l);
    }
    return o;
  },
  checkMoveOutBoundary: (n, e, o) => {
    let t = !0, r = {};
    const i = o.extOption.boundary;
    if (i) {
      let a = i.isOut;
      if (a = S.isBoolean(a) ? a : !0, !a) {
        let l;
        if (i.element && i.element.length > 0) {
          const s = window.document.querySelector(i.element);
          s && (l = S.getOffset(s));
        } else
          l = S.getOffset(e);
        if (l) {
          const s = S.getOffset(n);
          let c = Number(i.x);
          c === NaN && (c = 0);
          let f = Number(i.y);
          f === NaN && (f = 0);
          const d = l.top - c > s.top, p = l.left + l.width + f < s.left + s.width, h = l.top + l.height + c < s.top + s.height, b = l.left - f > s.left;
          t = !(d || p || h || b), t || (r = {
            top: d,
            right: p,
            bottom: h,
            left: b,
            x: c,
            y: f
          });
        }
      }
    }
    return r.isOut = !t, r;
  },
  setWrapBody: (n, e, o) => {
    let t = n, r = o.extOption.wrapBody;
    if (o.fallbackOnBody && (r ? o.extOption.wrapBody.isWrap = !0 : o.extOption.wrapBody = { isWrap: !0 }, r = o.extOption.wrapBody), r) {
      let i = r.isWrap;
      if (i = S.isBoolean(i) ? i : !1, i)
        if (r.element && r.element.length > 0)
          t = S.createElement(r.element), t.appendChild(n);
        else
          switch (t = e.cloneNode(), t.appendChild(n), t.tagName.toLocaleLowerCase()) {
            case "tbody":
              const a = e.parentNode.cloneNode();
              a.appendChild(t), t = a;
              break;
          }
    }
    return t;
  },
  checkCross: (n, e, o) => {
    const t = o.extOption.cross;
    let r = { newEl: null, isSameStruct: !0 };
    if (t) {
      let i = t.isCross;
      if (i = S.isBoolean(i) ? i : !1, n.parentNode === e.parentNode && (i = !1), i) {
        let a = t.isSameStruct;
        if (a = S.isBoolean(a) ? a : !0, !a) {
          const l = e.tagName.toLocaleLowerCase(), s = S.createElement(l), c = [], f = ["darg-select", "darg-placeholder"];
          switch (e.className.split(" ").forEach((d) => {
            f.indexOf(d) === -1 && c.push(d);
          }), c.push(...f), s.className = c.join(" "), m(s, "height", e.clientHeight), l) {
            case "tr":
              let d = 0;
              for (let h = 0; h < e.children.length; h++) {
                const b = e.children[h].getAttribute("colspan");
                d += S.isUndefined(b) ? 1 : Number(b);
              }
              const p = S.createElement("td");
              p.setAttribute("colspan", d), s.appendChild(p);
              break;
          }
          r.isSameStruct = !1, r.newEl = s;
        }
      }
    }
    return r;
  },
  setCrossEl: (n, e) => {
    var o = S.checkCross(u, n, e);
    if (!o.isSameStruct) {
      const t = u.cloneNode(!0);
      u.parentNode.removeChild(u), fe ? (u = fe, fe = null) : u = o.newEl, fe || (fe = t);
    }
  },
  crossDropEnd: (n) => new Promise((e, o) => {
    const t = n.extOption.cross;
    let r = !1;
    const i = u && u.parentNode;
    if (t) {
      let a = t.isCross;
      a = S.isBoolean(a) ? a : !1, a && i && D !== i && t.dropEndBeforeCallback && (r = !0);
    }
    if (r) {
      const a = we.getAttribute(n.dataIdAttr), l = S.getElementData(i, n), s = t.dropEndBeforeCallback({ data: a, inx: L(u), arrSortId: l });
      if (s && s.then && S.isFunction(s.then))
        S._crossDropLoad(!0), s.then((c) => {
          S._crossDropLoad(!1);
          const f = S._crossDropEndCb(c);
          e({ success: f });
        });
      else {
        const c = S._crossDropEndCb(s);
        e({ success: c });
      }
    } else
      e({ success: !0 });
  }),
  _crossDropLoad: (n) => {
    let e;
    const o = u.tagName.toLocaleLowerCase();
    if (u.children.length === 0)
      e = u;
    else
      switch (o) {
        case "tr":
          e = u.children[0];
          break;
      }
    if (n) {
      const t = S.createElement("div");
      t.className = "panel-darg-loading", t.innerHTML = '<div class="darg-add-loading"></div>', e.appendChild(t);
    } else {
      const t = u.querySelector(".panel-darg-loading");
      t.parentNode.removeChild(t);
    }
  },
  _crossDropEndCb: (n) => {
    var e = S.isBoolean(n) ? n : !0;
    e && u && u.parentNode && u.parentNode.removeChild(u);
  }
};
g.mount(new vn());
g.mount(ct, ut);
const wn = /* @__PURE__ */ Xt({
  name: "ClDarg",
  __name: "Index",
  props: {
    className: {},
    group: {},
    dargRegionCls: {},
    handleCls: {},
    selectCls: {},
    placeholderCls: {},
    isBoundaryOut: { type: Boolean },
    boundaryElement: {},
    isWrapBody: { type: Boolean },
    wrapBodyElement: {},
    isDisabledInner: { type: Boolean },
    isDisabledOutsideInto: { type: Boolean },
    isGroupSameStruct: { type: Boolean },
    groupDropEndBeforeCallback: { type: Function },
    keyAttrId: {}
  },
  emits: ["onChangeSort"],
  setup(n, { expose: e, emit: o }) {
    const t = n, r = o, i = Rt(null), a = {
      sortableObj: {}
    }, l = Yt(() => {
      const p = {
        "panel-darg": !0
      };
      return t.className && !Ve.isEmpty(t.className) && t.className.split(" ").forEach((h) => {
        Ve.isEmpty(h) || (p[h] = !0);
      }), p;
    }), s = () => {
      const p = a.sortableObj.toArray();
      r("onChangeSort", p);
    }, c = () => {
      ft(() => {
        const p = i.value?.querySelector(t.dargRegionCls || ".darg-region");
        if (!p) return;
        const {
          group: h,
          placeholderCls: b,
          handleCls: y,
          selectCls: A,
          isBoundaryOut: P,
          boundaryElement: I,
          isWrapBody: M,
          wrapBodyElement: B,
          isDisabledInner: V,
          isDisabledOutsideInto: H,
          isGroupSameStruct: $,
          groupDropEndBeforeCallback: ie,
          keyAttrId: k
        } = t, j = {
          sort: !V,
          forceFallback: !0,
          fallbackOnBody: M,
          fallbackTolerance: 0,
          handle: y,
          ghostClass: b,
          chosenClass: A,
          dragClass: "darg-moveing",
          animation: 150,
          dataIdAttr: k,
          extOption: {
            boundary: {
              isOut: P,
              element: I,
              x: 5,
              y: 5
            },
            wrapBody: {
              isWrap: M,
              element: B
            },
            cross: {
              isCross: !1,
              isSameStruct: $,
              dropEndBeforeCallback: ie
            }
          },
          onUpdate: () => {
            s();
          }
        };
        h && !Ve.isEmpty(h) && P && (H ? (j.group = {
          name: h,
          pull: "clone",
          put: !1
        }, j.animation = 0) : j.group = h, j.extOption.cross.isCross = !0), a.sortableObj = new g(p, j);
      });
    }, f = () => {
      c();
    };
    return Lt(() => {
      ft(() => {
        f();
      });
    }), e({
      getArrSort: () => a.sortableObj.toArray ? a.sortableObj.toArray() : []
    }), (p, h) => (Wt(), Ht("div", {
      ref_key: "refElTop",
      ref: i,
      class: jt(l.value)
    }, [
      Gt(p.$slots, "default")
    ], 2));
  }
});
export {
  wn as default
};
//# sourceMappingURL=ClDarg.js.map
