UNPKG

wui-white-board

Version:

白板设计器

1,236 lines 1.22 MB
import { reactive as nt, toRefs as qh, ref as X, inject as _e, onMounted as kt, createElementBlock as E, openBlock as C, createElementVNode as P, Fragment as ue, renderList as ye, unref as g, toDisplayString as be, normalizeClass as ne, pushScopeId as pn, popScopeId as gn, readonly as Zm, getCurrentScope as sv, onScopeDispose as Im, getCurrentInstance as Kn, nextTick as bt, shallowRef as Ho, watchEffect as Dm, watch as ee, defineComponent as De, warn as lv, computed as D, onBeforeUnmount as Oo, isRef as xn, provide as Ja, renderSlot as Be, mergeProps as la, toRef as aa, onUnmounted as av, useAttrs as uv, useSlots as Hh, normalizeStyle as tt, createCommentVNode as pe, createBlock as F, withCtx as _, resolveDynamicComponent as nn, withModifiers as ht, createVNode as v, Transition as Gh, withDirectives as Ue, vShow as qe, Text as cv, h as hv, shallowReactive as dv, isVNode as eu, render as ua, markRaw as Lf, resolveComponent as N, withKeys as nl, createTextVNode as de } from "vue"; const St = (t) => { if (typeof t == "object") { let e = JSON.stringify(t, (n, i) => typeof i > "u" ? "" : i); return JSON.parse(e); } return t; }, ki = (t, e, n) => { if (Array.isArray(t)) return e = Array.isArray(e) ? e : [], t.splice(0, t.length, ...e), !1; t = typeof t == "object" ? t : {}, e = typeof e == "object" ? e : {}; let i = Object.keys(t), r = Object.keys(e); i.forEach((s) => { r.indexOf(s) < 0 && delete t[s]; }); let o = St(e); if (n && typeof n == "object") { let s = St(n); r.forEach((l) => { if (s[l] === void 0) return !1; if (Array.isArray(o[l]) && Array.isArray(s[l])) return o[l].splice(0, t[l].length, ...s[l]), !1; o[l] = s[l]; }); } r.forEach((s) => { if (t[s] === o[s]) return !1; if (Array.isArray(t[s]) && Array.isArray(o[s])) return t[s].splice(0, t[s].length, ...o[s]), !1; t[s] = o[s]; }); }, yo = (t, e) => { let n = nt({}), i = []; return typeof t == "object" && Object.keys(t).forEach((r) => { let o = r + "Ref"; n[o] = "", i.push(o); }), e && e(i.join(",")), qh(n); }, bo = (t) => { let e = {}; return t.forEach((n, i) => { let r = typeof n.default > "u" ? "" : n.default; e[n.key] = r; }), e; }, Em = ({ designerConfig: t = !1 } = {}) => new Promise((e, n) => { let i = { configLays: [], controls: [] }; if (!t) return n("缺少入参designerConfig"); let { boardConfig: r = !1, layoutConfig: o = !1 } = t; if (!o) return n("入参designerConfig缺少layoutConfig字段"); let s = 0; o.forEach((c, h) => { l(c, !1, () => { if (s++, s == o.length) return e(a(Rc(i))); }); }); function l(c, h, f) { if (c.designer_componentType == "gridCell" ? (h ? c.parentLayId = h.layId : c.parentLayId = "0", i.configLays.push(c)) : (c.layId = h.layId, i.controls.push(c)), c.designer_children && c.designer_children.length > 0) { c.designer_children.forEach((p, d) => { d >= c.designer_children.length - 1 ? l(p, c, f) : l(p, c); }); return; } else f && f(); } function a({ configLays: c = [], controls: h = [] } = {}) { return c.forEach((f, p) => { delete f.designer_componentId, delete f.designer_componentType, delete f.designer_componentTitle, delete f.designer_children, u(f); }), h.forEach((f, p) => { delete f.designer_componentId, delete f.designer_componentType, delete f.designer_componentTitle, u(f); }), { configLays: c, controls: h }; } function u(c) { typeof c.designer_widthType < "u" && c.designer_widthType != 1 && (c.width = c.designer_widthType), typeof c.designer_heightType < "u" && c.designer_heightType != 1 && (c.height = c.designer_heightType), delete c.designer_widthType, delete c.designer_heightType; } }), fv = ({ config: t = !1 } = {}) => { return new Promise((n, i) => { let r = { boardConfig: {}, layoutConfig: [] }; if (!t) return i("缺少入参config"); let { configLays: o = !1, controls: s = !1 } = t; if (!o) return i("入参config缺少configLays字段"); if (!s) return i("入参config缺少controls字段"); let l = {}, a = []; return o.forEach((u, c) => { if (a.indexOf(u.layId) >= 0) return; let h = Rc(u); a.push(h.layId), h.designer_componentId = h.layId, h.designer_componentType = "gridCell", h.designer_componentTitle = "栅格", e(h), h.designer_children = [], l[h.layId] = h; }), s.forEach((u, c) => { if (!l[u.layId]) return; let h = Rc(u), f = Lm.get(h.controlType); f && (h.designer_componentId = h.id, h.designer_componentType = f.componentType, h.designer_componentTitle = f.componentTitle, e(h), l[u.layId].designer_children.push(h)); }), a.forEach((u, c) => { if (!l[u].parentLayId || l[u].parentLayId === "0") { r.layoutConfig.push(l[u]); return; } let h = l[u].parentLayId; l[h] && l[h].designer_children.push(l[u]); }), n(r); }); function e(n) { n.width === -1 || n.width === -2 || n.width === 0 ? n.designer_widthType = n.width : n.designer_widthType = 1, n.height === -1 || n.height === -2 || n.height === 0 ? n.designer_heightType = n.height : n.designer_heightType = 1; } }, Rc = (t) => { if (typeof t == "object") { let e = JSON.stringify(t, (n, i) => typeof i > "u" ? "" : i); return JSON.parse(e); } return t; }, Lm = /* @__PURE__ */ new Map([ ["txtView", { componentType: "txtView", componentTitle: "文本" }], ["recyclerView", { componentType: "recyclerView", componentTitle: "列表" }], ["listView", { componentType: "listView", componentTitle: "列表2" }], ["sysDataTime", { componentType: "sysDataTime", componentTitle: "系统时间" }] ]), pv = ({ designerConfig: t = !1 } = {}) => new Promise(async (e, n) => { try { if (!t) return n("缺少入参designerConfig"); let { boardConfig: i = !1, layoutConfig: r = !1 } = t; if (!r) return n("入参designerConfig缺少layoutConfig字段"); let o = await Em({ designerConfig: t }), s = []; return o.controls.forEach((l, a) => { if (l.controlType == "txtView") { let u = { cid: l.id, cType: l.controlType, cData: l.title }; s.push(u); return; } if (l.controlType == "recyclerView") { let u = { cid: l.id, cType: l.controlType, cData: [ "25,17,19,24", "35,65,2,19", "6,12,89,24,34,5", "22,18,14,84,45,46,89,21,87,801", "12,18,14,84,45,46,89,21,87,803", "322,128,74,84,45,46,89,21,87,810", "422,158,84,84,45,46,89,21,87,80" ] }; s.push(u); return; } if (l.controlType == "listView") { let u = { cid: l.id, cType: l.controlType, cData: ["62,18,14,84,45,4", "32,18,14,84,28,46", "82,128,74,84,63,12", "92,98,74,814,47,35", "36,80,23,75,13,39"] }; s.push(u); return; } }), e(s); } catch (i) { return console.warn(i), n(i); } }), hs = { designerConfigToConfig: Em, configToDesignerConfig: fv, ControlToComponentMap: Lm, getDemoDataByDesignerConfig: pv }; /**! * Sortable 1.15.6 * @author RubaXa <trash@rubaxa.org> * @author owenm <owen23355@gmail.com> * @license MIT */ function Bf(t, e) { var n = Object.keys(t); if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(t); e && (i = i.filter(function(r) { return Object.getOwnPropertyDescriptor(t, r).enumerable; })), n.push.apply(n, i); } return n; } function Jn(t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e] != null ? arguments[e] : {}; e % 2 ? Bf(Object(n), !0).forEach(function(i) { gv(t, i, n[i]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Bf(Object(n)).forEach(function(i) { Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(n, i)); }); } return t; } function Ll(t) { "@babel/helpers - typeof"; return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Ll = function(e) { return typeof e; } : Ll = function(e) { return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }, Ll(t); } function gv(t, e, n) { return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t; } function yi() { return yi = Object.assign || function(t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e]; for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); } return t; }, yi.apply(this, arguments); } function mv(t, e) { if (t == null) return {}; var n = {}, i = Object.keys(t), r, o; for (o = 0; o < i.length; o++) r = i[o], !(e.indexOf(r) >= 0) && (n[r] = t[r]); return n; } function Ov(t, e) { if (t == null) return {}; var n = mv(t, e), i, r; if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(t); for (r = 0; r < o.length; r++) i = o[r], !(e.indexOf(i) >= 0) && Object.prototype.propertyIsEnumerable.call(t, i) && (n[i] = t[i]); } return n; } var yv = "1.15.6"; function pi(t) { if (typeof window < "u" && window.navigator) return !!/* @__PURE__ */ navigator.userAgent.match(t); } var Ci = pi(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Bs = pi(/Edge/i), Xf = pi(/firefox/i), Go = pi(/safari/i) && !pi(/chrome/i) && !pi(/android/i), Kh = pi(/iP(ad|od|hone)/i), Bm = pi(/chrome/i) && pi(/android/i), Xm = { capture: !1, passive: !1 }; function xe(t, e, n) { t.addEventListener(e, n, !Ci && Xm); } function we(t, e, n) { t.removeEventListener(e, n, !Ci && Xm); } function ca(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 Nm(t) { return t.host && t !== document && t.host.nodeType ? t.host : t.parentNode; } function kn(t, e, n, i) { if (t) { n = n || document; do { if (e != null && (e[0] === ">" ? t.parentNode === n && ca(t, e) : ca(t, e)) || i && t === n) return t; if (t === n) break; } while (t = Nm(t)); } return null; } var Nf = /\s+/g; function Kt(t, e, n) { if (t && e) if (t.classList) t.classList[n ? "add" : "remove"](e); else { var i = (" " + t.className + " ").replace(Nf, " ").replace(" " + e + " ", " "); t.className = (i + (n ? " " + e : "")).replace(Nf, " "); } } function he(t, e, n) { var i = t && t.style; if (i) { 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 i) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), i[e] = n + (typeof n == "string" ? "" : "px"); } } function Gr(t, e) { var n = ""; if (typeof t == "string") n = t; else do { var i = he(t, "transform"); i && i !== "none" && (n = i + " " + n); } while (!e && (t = t.parentNode)); var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; return r && new r(n); } function Ym(t, e, n) { if (t) { var i = t.getElementsByTagName(e), r = 0, o = i.length; if (n) for (; r < o; r++) n(i[r], r); return i; } return []; } function Hn() { var t = document.scrollingElement; return t || document.documentElement; } function ot(t, e, n, i, r) { if (!(!t.getBoundingClientRect && t !== window)) { var o, s, l, a, u, c, h; if (t !== window && t.parentNode && t !== Hn() ? (o = t.getBoundingClientRect(), s = o.top, l = o.left, a = o.bottom, u = o.right, c = o.height, h = o.width) : (s = 0, l = 0, a = window.innerHeight, u = window.innerWidth, c = window.innerHeight, h = window.innerWidth), (e || n) && t !== window && (r = r || t.parentNode, !Ci)) do if (r && r.getBoundingClientRect && (he(r, "transform") !== "none" || n && he(r, "position") !== "static")) { var f = r.getBoundingClientRect(); s -= f.top + parseInt(he(r, "border-top-width")), l -= f.left + parseInt(he(r, "border-left-width")), a = s + o.height, u = l + o.width; break; } while (r = r.parentNode); if (i && t !== window) { var p = Gr(r || t), d = p && p.a, O = p && p.d; p && (s /= O, l /= d, h /= d, c /= O, a = s + c, u = l + h); } return { top: s, left: l, bottom: a, right: u, width: h, height: c }; } } function Yf(t, e, n) { for (var i = Ni(t, !0), r = ot(t)[e]; i; ) { var o = ot(i)[n], s = void 0; if (s = r >= o, !s) return i; if (i === Hn()) break; i = Ni(i, !1); } return !1; } function lo(t, e, n, i) { for (var r = 0, o = 0, s = t.children; o < s.length; ) { if (s[o].style.display !== "none" && s[o] !== le.ghost && (i || s[o] !== le.dragged) && kn(s[o], n.draggable, t, !1)) { if (r === e) return s[o]; r++; } o++; } return null; } function Jh(t, e) { for (var n = t.lastElementChild; n && (n === le.ghost || he(n, "display") === "none" || e && !ca(n, e)); ) n = n.previousElementSibling; return n || null; } function sn(t, e) { var n = 0; if (!t || !t.parentNode) return -1; for (; t = t.previousElementSibling; ) t.nodeName.toUpperCase() !== "TEMPLATE" && t !== le.clone && (!e || ca(t, e)) && n++; return n; } function Wf(t) { var e = 0, n = 0, i = Hn(); if (t) do { var r = Gr(t), o = r.a, s = r.d; e += t.scrollLeft * o, n += t.scrollTop * s; } while (t !== i && (t = t.parentNode)); return [e, n]; } function bv(t, e) { for (var n in t) if (t.hasOwnProperty(n)) { for (var i in e) if (e.hasOwnProperty(i) && e[i] === t[n][i]) return Number(n); } return -1; } function Ni(t, e) { if (!t || !t.getBoundingClientRect) return Hn(); var n = t, i = !1; do if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) { var r = he(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 Hn(); if (i || e) return n; i = !0; } } while (n = n.parentNode); return Hn(); } function vv(t, e) { if (t && e) for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]); return t; } function Du(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 Ko; function Wm(t, e) { return function() { if (!Ko) { var n = arguments, i = this; n.length === 1 ? t.call(i, n[0]) : t.apply(i, n), Ko = setTimeout(function() { Ko = void 0; }, e); } }; } function wv() { clearTimeout(Ko), Ko = void 0; } function jm(t, e, n) { t.scrollLeft += e, t.scrollTop += n; } function Fm(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); } function zm(t, e, n) { var i = {}; return Array.from(t.children).forEach(function(r) { var o, s, l, a; if (!(!kn(r, e.draggable, t, !1) || r.animated || r === n)) { var u = ot(r); i.left = Math.min((o = i.left) !== null && o !== void 0 ? o : 1 / 0, u.left), i.top = Math.min((s = i.top) !== null && s !== void 0 ? s : 1 / 0, u.top), i.right = Math.max((l = i.right) !== null && l !== void 0 ? l : -1 / 0, u.right), i.bottom = Math.max((a = i.bottom) !== null && a !== void 0 ? a : -1 / 0, u.bottom); } }), i.width = i.right - i.left, i.height = i.bottom - i.top, i.x = i.left, i.y = i.top, i; } var jt = "Sortable" + (/* @__PURE__ */ new Date()).getTime(); function Sv() { var t = [], e; return { captureAnimationState: function() { if (t = [], !!this.options.animation) { var i = [].slice.call(this.el.children); i.forEach(function(r) { if (!(he(r, "display") === "none" || r === le.ghost)) { t.push({ target: r, rect: ot(r) }); var o = Jn({}, t[t.length - 1].rect); if (r.thisAnimationDuration) { var s = Gr(r, !0); s && (o.top -= s.f, o.left -= s.e); } r.fromRect = o; } }); } }, addAnimationState: function(i) { t.push(i); }, removeAnimationState: function(i) { t.splice(bv(t, { target: i }), 1); }, animateAll: function(i) { var r = this; if (!this.options.animation) { clearTimeout(e), typeof i == "function" && i(); return; } var o = !1, s = 0; t.forEach(function(l) { var a = 0, u = l.target, c = u.fromRect, h = ot(u), f = u.prevFromRect, p = u.prevToRect, d = l.rect, O = Gr(u, !0); O && (h.top -= O.f, h.left -= O.e), u.toRect = h, u.thisAnimationDuration && Du(f, h) && !Du(c, h) && // Make sure animatingRect is on line between toRect & fromRect (d.top - h.top) / (d.left - h.left) === (c.top - h.top) / (c.left - h.left) && (a = _v(d, f, p, r.options)), Du(h, c) || (u.prevFromRect = c, u.prevToRect = h, a || (a = r.options.animation), r.animate(u, d, h, a)), a && (o = !0, s = Math.max(s, a), clearTimeout(u.animationResetTimer), u.animationResetTimer = setTimeout(function() { u.animationTime = 0, u.prevFromRect = null, u.fromRect = null, u.prevToRect = null, u.thisAnimationDuration = null; }, a), u.thisAnimationDuration = a); }), clearTimeout(e), o ? e = setTimeout(function() { typeof i == "function" && i(); }, s) : typeof i == "function" && i(), t = []; }, animate: function(i, r, o, s) { if (s) { he(i, "transition", ""), he(i, "transform", ""); var l = Gr(this.el), a = l && l.a, u = l && l.d, c = (r.left - o.left) / (a || 1), h = (r.top - o.top) / (u || 1); i.animatingX = !!c, i.animatingY = !!h, he(i, "transform", "translate3d(" + c + "px," + h + "px,0)"), this.forRepaintDummy = xv(i), he(i, "transition", "transform " + s + "ms" + (this.options.easing ? " " + this.options.easing : "")), he(i, "transform", "translate3d(0,0,0)"), typeof i.animated == "number" && clearTimeout(i.animated), i.animated = setTimeout(function() { he(i, "transition", ""), he(i, "transform", ""), i.animated = !1, i.animatingX = !1, i.animatingY = !1; }, s); } } }; } function xv(t) { return t.offsetWidth; } function _v(t, e, n, i) { 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)) * i.animation; } var Ir = [], Eu = { initializeByDefault: !0 }, Xs = { mount: function(e) { for (var n in Eu) Eu.hasOwnProperty(n) && !(n in e) && (e[n] = Eu[n]); Ir.forEach(function(i) { if (i.pluginName === e.pluginName) throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once"); }), Ir.push(e); }, pluginEvent: function(e, n, i) { var r = this; this.eventCanceled = !1, i.cancel = function() { r.eventCanceled = !0; }; var o = e + "Global"; Ir.forEach(function(s) { n[s.pluginName] && (n[s.pluginName][o] && n[s.pluginName][o](Jn({ sortable: n }, i)), n.options[s.pluginName] && n[s.pluginName][e] && n[s.pluginName][e](Jn({ sortable: n }, i))); }); }, initializePlugins: function(e, n, i, r) { Ir.forEach(function(l) { var a = l.pluginName; if (!(!e.options[a] && !l.initializeByDefault)) { var u = new l(e, n, e.options); u.sortable = e, u.options = e.options, e[a] = u, yi(i, u.defaults); } }); for (var o in e.options) if (e.options.hasOwnProperty(o)) { var s = this.modifyOption(e, o, e.options[o]); typeof s < "u" && (e.options[o] = s); } }, getEventProperties: function(e, n) { var i = {}; return Ir.forEach(function(r) { typeof r.eventProperties == "function" && yi(i, r.eventProperties.call(n[r.pluginName], e)); }), i; }, modifyOption: function(e, n, i) { var r; return Ir.forEach(function(o) { e[o.pluginName] && o.optionListeners && typeof o.optionListeners[n] == "function" && (r = o.optionListeners[n].call(e[o.pluginName], i)); }), r; } }; function kv(t) { var e = t.sortable, n = t.rootEl, i = t.name, r = t.targetEl, o = t.cloneEl, s = t.toEl, l = t.fromEl, a = t.oldIndex, u = t.newIndex, c = t.oldDraggableIndex, h = t.newDraggableIndex, f = t.originalEvent, p = t.putSortable, d = t.extraEventProperties; if (e = e || n && n[jt], !!e) { var O, y = e.options, b = "on" + i.charAt(0).toUpperCase() + i.substr(1); window.CustomEvent && !Ci && !Bs ? O = new CustomEvent(i, { bubbles: !0, cancelable: !0 }) : (O = document.createEvent("Event"), O.initEvent(i, !0, !0)), O.to = s || n, O.from = l || n, O.item = r || n, O.clone = o, O.oldIndex = a, O.newIndex = u, O.oldDraggableIndex = c, O.newDraggableIndex = h, O.originalEvent = f, O.pullMode = p ? p.lastPutMode : void 0; var x = Jn(Jn({}, d), Xs.getEventProperties(i, e)); for (var Q in x) O[Q] = x[Q]; n && n.dispatchEvent(O), y[b] && y[b].call(e, O); } } var Cv = ["evt"], Lt = function(e, n) { var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = i.evt, o = Ov(i, Cv); Xs.pluginEvent.bind(le)(e, n, Jn({ dragEl: Y, parentEl: Ge, ghostEl: fe, rootEl: We, nextEl: hr, lastDownEl: Bl, cloneEl: ze, cloneHidden: Bi, dragStarted: Xo, putSortable: Ot, activeSortable: le.active, originalEvent: r, oldIndex: Fr, oldDraggableIndex: Jo, newIndex: en, newDraggableIndex: Di, hideGhostForTarget: Gm, unhideGhostForTarget: Km, cloneNowHidden: function() { Bi = !0; }, cloneNowShown: function() { Bi = !1; }, dispatchSortableEvent: function(l) { At({ sortable: n, name: l, originalEvent: r }); } }, o)); }; function At(t) { kv(Jn({ putSortable: Ot, cloneEl: ze, targetEl: Y, rootEl: We, oldIndex: Fr, oldDraggableIndex: Jo, newIndex: en, newDraggableIndex: Di }, t)); } var Y, Ge, fe, We, hr, Bl, ze, Bi, Fr, en, Jo, Di, il, Ot, Br = !1, ha = !1, da = [], sr, vn, Lu, Bu, jf, Ff, Xo, Dr, es, ts = !1, rl = !1, Xl, Ct, Xu = [], Vc = !1, fa = [], tu = typeof document < "u", ol = Kh, zf = Bs || Ci ? "cssFloat" : "float", Qv = tu && !Bm && !Kh && "draggable" in document.createElement("div"), Um = function() { if (tu) { if (Ci) return !1; var t = document.createElement("x"); return t.style.cssText = "pointer-events:auto", t.style.pointerEvents === "auto"; } }(), qm = function(e, n) { var i = he(e), r = parseInt(i.width) - parseInt(i.paddingLeft) - parseInt(i.paddingRight) - parseInt(i.borderLeftWidth) - parseInt(i.borderRightWidth), o = lo(e, 0, n), s = lo(e, 1, n), l = o && he(o), a = s && he(s), u = l && parseInt(l.marginLeft) + parseInt(l.marginRight) + ot(o).width, c = a && parseInt(a.marginLeft) + parseInt(a.marginRight) + ot(s).width; if (i.display === "flex") return i.flexDirection === "column" || i.flexDirection === "column-reverse" ? "vertical" : "horizontal"; if (i.display === "grid") return i.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal"; if (o && l.float && l.float !== "none") { var h = l.float === "left" ? "left" : "right"; return s && (a.clear === "both" || a.clear === h) ? "vertical" : "horizontal"; } return o && (l.display === "block" || l.display === "flex" || l.display === "table" || l.display === "grid" || u >= r && i[zf] === "none" || s && i[zf] === "none" && u + c > r) ? "vertical" : "horizontal"; }, Tv = function(e, n, i) { var r = i ? e.left : e.top, o = i ? e.right : e.bottom, s = i ? e.width : e.height, l = i ? n.left : n.top, a = i ? n.right : n.bottom, u = i ? n.width : n.height; return r === l || o === a || r + s / 2 === l + u / 2; }, $v = function(e, n) { var i; return da.some(function(r) { var o = r[jt].options.emptyInsertThreshold; if (!(!o || Jh(r))) { var s = ot(r), l = e >= s.left - o && e <= s.right + o, a = n >= s.top - o && n <= s.bottom + o; if (l && a) return i = r; } }), i; }, Hm = function(e) { function n(o, s) { return function(l, a, u, c) { var h = l.options.group.name && a.options.group.name && l.options.group.name === a.options.group.name; if (o == null && (s || h)) return !0; if (o == null || o === !1) return !1; if (s && o === "clone") return o; if (typeof o == "function") return n(o(l, a, u, c), s)(l, a, u, c); var f = (s ? l : a).options.group.name; return o === !0 || typeof o == "string" && o === f || o.join && o.indexOf(f) > -1; }; } var i = {}, r = e.group; (!r || Ll(r) != "object") && (r = { name: r }), i.name = r.name, i.checkPull = n(r.pull, !0), i.checkPut = n(r.put), i.revertClone = r.revertClone, e.group = i; }, Gm = function() { !Um && fe && he(fe, "display", "none"); }, Km = function() { !Um && fe && he(fe, "display", ""); }; tu && !Bm && document.addEventListener("click", function(t) { if (ha) return t.preventDefault(), t.stopPropagation && t.stopPropagation(), t.stopImmediatePropagation && t.stopImmediatePropagation(), ha = !1, !1; }, !0); var lr = function(e) { if (Y) { e = e.touches ? e.touches[0] : e; var n = $v(e.clientX, e.clientY); if (n) { var i = {}; for (var r in e) e.hasOwnProperty(r) && (i[r] = e[r]); i.target = i.rootEl = n, i.preventDefault = void 0, i.stopPropagation = void 0, n[jt]._onDragOver(i); } } }, Pv = function(e) { Y && Y.parentNode[jt]._isOutsideThisEl(e.target); }; function le(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 = yi({}, e), t[jt] = 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 qm(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(s, l) { s.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 }, // Disabled on Safari: #1571; Enabled on Safari IOS: #2244 supportPointer: le.supportPointer !== !1 && "PointerEvent" in window && (!Go || Kh), emptyInsertThreshold: 5 }; Xs.initializePlugins(this, t, n); for (var i in n) !(i in e) && (e[i] = n[i]); Hm(e); for (var r in this) r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this)); this.nativeDraggable = e.forceFallback ? !1 : Qv, this.nativeDraggable && (this.options.touchStartThreshold = 1), e.supportPointer ? xe(t, "pointerdown", this._onTapStart) : (xe(t, "mousedown", this._onTapStart), xe(t, "touchstart", this._onTapStart)), this.nativeDraggable && (xe(t, "dragover", this), xe(t, "dragenter", this)), da.push(this.el), e.store && e.store.get && this.sort(e.store.get(this) || []), yi(this, Sv()); } le.prototype = /** @lends Sortable.prototype */ { constructor: le, _isOutsideThisEl: function(e) { !this.el.contains(e) && e !== this.el && (Dr = null); }, _getDirection: function(e, n) { return typeof this.options.direction == "function" ? this.options.direction.call(this, e, n, Y) : this.options.direction; }, _onTapStart: function(e) { if (e.cancelable) { var n = this, i = this.el, r = this.options, o = r.preventOnFilter, s = e.type, l = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, a = (l || e).target, u = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || a, c = r.filter; if (Ev(i), !Y && !(/mousedown|pointerdown/.test(s) && e.button !== 0 || r.disabled) && !u.isContentEditable && !(!this.nativeDraggable && Go && a && a.tagName.toUpperCase() === "SELECT") && (a = kn(a, r.draggable, i, !1), !(a && a.animated) && Bl !== a)) { if (Fr = sn(a), Jo = sn(a, r.draggable), typeof c == "function") { if (c.call(this, e, a, this)) { At({ sortable: n, rootEl: u, name: "filter", targetEl: a, toEl: i, fromEl: i }), Lt("filter", n, { evt: e }), o && e.preventDefault(); return; } } else if (c && (c = c.split(",").some(function(h) { if (h = kn(u, h.trim(), i, !1), h) return At({ sortable: n, rootEl: h, name: "filter", targetEl: a, fromEl: i, toEl: i }), Lt("filter", n, { evt: e }), !0; }), c)) { o && e.preventDefault(); return; } r.handle && !kn(u, r.handle, i, !1) || this._prepareDragStart(e, l, a); } } }, _prepareDragStart: function(e, n, i) { var r = this, o = r.el, s = r.options, l = o.ownerDocument, a; if (i && !Y && i.parentNode === o) { var u = ot(i); if (We = o, Y = i, Ge = Y.parentNode, hr = Y.nextSibling, Bl = i, il = s.group, le.dragged = Y, sr = { target: Y, clientX: (n || e).clientX, clientY: (n || e).clientY }, jf = sr.clientX - u.left, Ff = sr.clientY - u.top, this._lastX = (n || e).clientX, this._lastY = (n || e).clientY, Y.style["will-change"] = "all", a = function() { if (Lt("delayEnded", r, { evt: e }), le.eventCanceled) { r._onDrop(); return; } r._disableDelayedDragEvents(), !Xf && r.nativeDraggable && (Y.draggable = !0), r._triggerDragStart(e, n), At({ sortable: r, name: "choose", originalEvent: e }), Kt(Y, s.chosenClass, !0); }, s.ignore.split(",").forEach(function(c) { Ym(Y, c.trim(), Nu); }), xe(l, "dragover", lr), xe(l, "mousemove", lr), xe(l, "touchmove", lr), s.supportPointer ? (xe(l, "pointerup", r._onDrop), !this.nativeDraggable && xe(l, "pointercancel", r._onDrop)) : (xe(l, "mouseup", r._onDrop), xe(l, "touchend", r._onDrop), xe(l, "touchcancel", r._onDrop)), Xf && this.nativeDraggable && (this.options.touchStartThreshold = 4, Y.draggable = !0), Lt("delayStart", this, { evt: e }), s.delay && (!s.delayOnTouchOnly || n) && (!this.nativeDraggable || !(Bs || Ci))) { if (le.eventCanceled) { this._onDrop(); return; } s.supportPointer ? (xe(l, "pointerup", r._disableDelayedDrag), xe(l, "pointercancel", r._disableDelayedDrag)) : (xe(l, "mouseup", r._disableDelayedDrag), xe(l, "touchend", r._disableDelayedDrag), xe(l, "touchcancel", r._disableDelayedDrag)), xe(l, "mousemove", r._delayedDragTouchMoveHandler), xe(l, "touchmove", r._delayedDragTouchMoveHandler), s.supportPointer && xe(l, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(a, s.delay); } else a(); } }, _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() { Y && Nu(Y), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents(); }, _disableDelayedDragEvents: function() { var e = this.el.ownerDocument; we(e, "mouseup", this._disableDelayedDrag), we(e, "touchend", this._disableDelayedDrag), we(e, "touchcancel", this._disableDelayedDrag), we(e, "pointerup", this._disableDelayedDrag), we(e, "pointercancel", this._disableDelayedDrag), we(e, "mousemove", this._delayedDragTouchMoveHandler), we(e, "touchmove", this._delayedDragTouchMoveHandler), we(e, "pointermove", this._delayedDragTouchMoveHandler); }, _triggerDragStart: function(e, n) { n = n || e.pointerType == "touch" && e, !this.nativeDraggable || n ? this.options.supportPointer ? xe(document, "pointermove", this._onTouchMove) : n ? xe(document, "touchmove", this._onTouchMove) : xe(document, "mousemove", this._onTouchMove) : (xe(Y, "dragend", this), xe(We, "dragstart", this._onDragStart)); try { document.selection ? Nl(function() { document.selection.empty(); }) : window.getSelection().removeAllRanges(); } catch { } }, _dragStarted: function(e, n) { if (Br = !1, We && Y) { Lt("dragStarted", this, { evt: n }), this.nativeDraggable && xe(document, "dragover", Pv); var i = this.options; !e && Kt(Y, i.dragClass, !1), Kt(Y, i.ghostClass, !0), le.active = this, e && this._appendGhost(), At({ sortable: this, name: "start", originalEvent: n }); } else this._nulling(); }, _emulateDragOver: function() { if (vn) { this._lastX = vn.clientX, this._lastY = vn.clientY, Gm(); for (var e = document.elementFromPoint(vn.clientX, vn.clientY), n = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(vn.clientX, vn.clientY), e !== n); ) n = e; if (Y.parentNode[jt]._isOutsideThisEl(e), n) do { if (n[jt]) { var i = void 0; if (i = n[jt]._onDragOver({ clientX: vn.clientX, clientY: vn.clientY, target: e, rootEl: n }), i && !this.options.dragoverBubble) break; } e = n; } while (n = Nm(n)); Km(); } }, _onTouchMove: function(e) { if (sr) { var n = this.options, i = n.fallbackTolerance, r = n.fallbackOffset, o = e.touches ? e.touches[0] : e, s = fe && Gr(fe, !0), l = fe && s && s.a, a = fe && s && s.d, u = ol && Ct && Wf(Ct), c = (o.clientX - sr.clientX + r.x) / (l || 1) + (u ? u[0] - Xu[0] : 0) / (l || 1), h = (o.clientY - sr.clientY + r.y) / (a || 1) + (u ? u[1] - Xu[1] : 0) / (a || 1); if (!le.active && !Br) { if (i && Math.max(Math.abs(o.clientX - this._lastX), Math.abs(o.clientY - this._lastY)) < i) return; this._onDragStart(e, !0); } if (fe) { s ? (s.e += c - (Lu || 0), s.f += h - (Bu || 0)) : s = { a: 1, b: 0, c: 0, d: 1, e: c, f: h }; var f = "matrix(".concat(s.a, ",").concat(s.b, ",").concat(s.c, ",").concat(s.d, ",").concat(s.e, ",").concat(s.f, ")"); he(fe, "webkitTransform", f), he(fe, "mozTransform", f), he(fe, "msTransform", f), he(fe, "transform", f), Lu = c, Bu = h, vn = o; } e.cancelable && e.preventDefault(); } }, _appendGhost: function() { if (!fe) { var e = this.options.fallbackOnBody ? document.body : We, n = ot(Y, !0, ol, !0, e), i = this.options; if (ol) { for (Ct = e; he(Ct, "position") === "static" && he(Ct, "transform") === "none" && Ct !== document; ) Ct = Ct.parentNode; Ct !== document.body && Ct !== document.documentElement ? (Ct === document && (Ct = Hn()), n.top += Ct.scrollTop, n.left += Ct.scrollLeft) : Ct = Hn(), Xu = Wf(Ct); } fe = Y.cloneNode(!0), Kt(fe, i.ghostClass, !1), Kt(fe, i.fallbackClass, !0), Kt(fe, i.dragClass, !0), he(fe, "transition", ""), he(fe, "transform", ""), he(fe, "box-sizing", "border-box"), he(fe, "margin", 0), he(fe, "top", n.top), he(fe, "left", n.left), he(fe, "width", n.width), he(fe, "height", n.height), he(fe, "opacity", "0.8"), he(fe, "position", ol ? "absolute" : "fixed"), he(fe, "zIndex", "100000"), he(fe, "pointerEvents", "none"), le.ghost = fe, e.appendChild(fe), he(fe, "transform-origin", jf / parseInt(fe.style.width) * 100 + "% " + Ff / parseInt(fe.style.height) * 100 + "%"); } }, _onDragStart: function(e, n) { var i = this, r = e.dataTransfer, o = i.options; if (Lt("dragStart", this, { evt: e }), le.eventCanceled) { this._onDrop(); return; } Lt("setupClone", this), le.eventCanceled || (ze = Fm(Y), ze.removeAttribute("id"), ze.draggable = !1, ze.style["will-change"] = "", this._hideClone(), Kt(ze, this.options.chosenClass, !1), le.clone = ze), i.cloneId = Nl(function() { Lt("clone", i), !le.eventCanceled && (i.options.removeCloneOnHide || We.insertBefore(ze, Y), i._hideClone(), At({ sortable: i, name: "clone" })); }), !n && Kt(Y, o.dragClass, !0), n ? (ha = !0, i._loopId = setInterval(i._emulateDragOver, 50)) : (we(document, "mouseup", i._onDrop), we(document, "touchend", i._onDrop), we(document, "touchcancel", i._onDrop), r && (r.effectAllowed = "move", o.setData && o.setData.call(i, r, Y)), xe(document, "drop", i), he(Y, "transform", "translateZ(0)")), Br = !0, i._dragStartId = Nl(i._dragStarted.bind(i, n, e)), xe(document, "selectstart", i), Xo = !0, window.getSelection().removeAllRanges(), Go && he(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, i = e.target, r, o, s, l = this.options, a = l.group, u = le.active, c = il === a, h = l.sort, f = Ot || u, p, d = this, O = !1; if (Vc) return; function y(ce, ae) { Lt(ce, d, Jn({ evt: e, isOwner: c, axis: p ? "vertical" : "horizontal", revert: s, dragRect: r, targetRect: o, canSort: h, fromSortable: f, target: i, completed: x, onMove: function($e, me) { return sl(We, n, Y, r, $e, ot($e), e, me); }, changed: Q }, ae)); } function b() { y("dragOverAnimationCapture"), d.captureAnimationState(), d !== f && f.captureAnimationState(); } function x(ce) { return y("dragOverCompleted", { insertion: ce }), ce && (c ? u._hideClone() : u._showClone(d), d !== f && (Kt(Y, Ot ? Ot.options.ghostClass : u.options.ghostClass, !1), Kt(Y, l.ghostClass, !0)), Ot !== d && d !== le.active ? Ot = d : d === le.active && Ot && (Ot = null), f === d && (d._ignoreWhileAnimating = i), d.animateAll(function() { y("dragOverAnimationComplete"), d._ignoreWhileAnimating = null; }), d !== f && (f.animateAll(), f._ignoreWhileAnimating = null)), (i === Y && !Y.animated || i === n && !i.animated) && (Dr = null), !l.dragoverBubble && !e.rootEl && i !== document && (Y.parentNode[jt]._isOutsideThisEl(e.target), !ce && lr(e)), !l.dragoverBubble && e.stopPropagation && e.stopPropagation(), O = !0; } function Q() { en = sn(Y), Di = sn(Y, l.draggable), At({ sortable: d, name: "change", toEl: n, newIndex: en, newDraggableIndex: Di, originalEvent: e }); } if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), i = kn(i, l.draggable, n, !0), y("dragOver"), le.eventCanceled) return O; if (Y.contains(e.target) || i.animated && i.animatingX && i.animatingY || d._ignoreWhileAnimating === i) return x(!1); if (ha = !1, u && !l.disabled && (c ? h || (s = Ge !== We) : Ot === this || (this.lastPutMode = il.checkPull(this, u, Y, e)) && a.checkPut(this, u, Y, e))) { if (p = this._getDirection(e, i) === "vertical", r = ot(Y), y("dragOverValid"), le.eventCanceled) return O; if (s) return Ge = We, b(), this._hideClone(), y("revert"), le.eventCanceled || (hr ? We.insertBefore(Y, hr) : We.appendChild(Y)), x(!0); var S = Jh(n, l.draggable); if (!S || Av(e, p, this) && !S.animated) { if (S === Y) return x(!1); if (S && n === e.target && (i = S), i && (o = ot(i)), sl(We, n, Y, r, i, o, e, !!i) !== !1) return b(), S && S.nextSibling ? n.insertBefore(Y, S.nextSibling) : n.appendChild(Y), Ge = n, Q(), x(!0); } else if (S && Vv(e, p, this)) { var T = lo(n, 0, l, !0); if (T === Y) return x(!1); if (i = T, o = ot(i), sl(We, n, Y, r, i, o, e, !1) !== !1) return b(), n.insertBefore(Y, T), Ge = n, Q(), x(!0); } else if (i.parentNode === n) { o = ot(i); var $ = 0, k, R = Y.parentNode !== n, V = !Tv(Y.animated && Y.toRect || r, i.animated && i.toRect || o, p), A = p ? "top" : "left", w = Yf(i, "top", "top") || Yf(Y, "top", "top"), m = w ? w.scrollTop : void 0; Dr !== i && (k = o[A], ts = !1, rl = !V && l.invertSwap || R), $ = Zv(e, i, o, p, V ? 1 : l.swapThreshold, l.invertedSwapThreshold == null ? l.swapThreshold : l.invertedSwapThreshold, rl, Dr === i); var Z; if ($ !== 0) { var K = sn(Y); do K -= $, Z = Ge.children[K]; while (Z && (he(Z, "display") === "none" || Z === fe)); } if ($ === 0 || Z === i) return x(!1); Dr = i, es = $; var oe = i.nextElementSibling, L = !1; L = $ === 1; var te = sl(We, n, Y, r, i, o, e, L); if (te !== !1) return (te === 1 || te === -1) && (L = te === 1), Vc = !0, setTimeout(Rv, 30), b(), L && !oe ? n.appendChild(Y) : i.parentNode.insertBefore(Y, L ? oe : i), w && jm(w, 0, m - w.scrollTop), Ge = Y.parentNode, k !== void 0 && !rl && (Xl = Math.abs(k - ot(i)[A])), Q(), x(!0); } if (n.contains(Y)) return x(!1); } return !1; }, _ignoreWhileAnimating: null, _offMoveEvents: function() { we(document, "mousemove", this._onTouchMove), we(document, "touchmove", this._onTouchMove), we(document, "pointermove", this._onTouchMove), we(document, "dragover", lr), we(document, "mousemove", lr), we(document, "touchmove", lr); }, _offUpEvents: function() { var e = this.el.ownerDocument; we(e, "mouseup", this._onDrop), we(e, "touchend", this._onDrop), we(e, "pointerup", this._onDrop), we(e, "pointercancel", this._onDrop), we(e, "touchcancel", this._onDrop), we(document, "selectstart", this); }, _onDrop: function(e) { var n = this.el, i = this.options; if (en = sn(Y), Di = sn(Y, i.draggable), Lt("drop", this, { evt: e }), Ge = Y && Y.parentNode, en = sn(Y), Di = sn(Y, i.draggable), le.eventCanceled) { this._nulling(); return; } Br = !1, rl = !1, ts = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), Ac(this.cloneId), Ac(this._dragStartId), this.nativeDraggable && (we(document, "drop", this), we(n, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Go && he(document.body, "user-select", ""), he(Y, "transform", ""), e && (Xo && (e.cancelable && e.preventDefault(), !i.dropBubble && e.stopPropagation()), fe && fe.parentNode && fe.parentNode.removeChild(fe), (We === Ge || Ot && Ot.lastPutMode !== "clone") && ze && ze.parentNode && ze.parentNode.removeChild(ze), Y && (this.nativeDraggable && we(Y, "dragend", this), Nu(Y), Y.style["will-change"] = "", Xo && !Br && Kt(Y, Ot ? Ot.options.ghostClass : this.options.ghostClass, !1), Kt(Y, this.options.chosenClass, !1), At({ sortable: this, name: "unchoose", toEl: Ge, newIndex: null, newDraggableIndex: null, originalEvent: e }), We !== Ge ? (en >= 0 && (At({ rootEl: Ge, name: "add", toEl: Ge, fromEl: We, originalEvent: e }), At({ sortable: this, name: "remove", toEl: Ge, originalEvent: e }), At({ rootEl: Ge, name: "sort", toEl: Ge, fromEl: We, originalEvent: e }), At({ sortable: this, name: "sort", toEl: Ge, originalEvent: e })), Ot && Ot.save()) : en !== Fr && en >= 0 && (At({ sortable: this, name: "update", toEl: Ge, originalEvent: e }), At({ sortable: this, name: "sort", toEl: Ge, originalEvent: e })), le.active && ((en == null || en === -1) && (en = Fr, Di = Jo), At({ sortable: this, name: "end", toEl: Ge, originalEvent: e }), this.save()))), this._nulling(); }, _nulling: function() { Lt("nulling", this), We = Y = Ge = fe = hr = ze = Bl = Bi = sr = vn = Xo = en = Di = Fr = Jo = Dr = es = Ot = il = le.dragged = le.ghost = le.clone = le.active = null, fa.forEach(function(e) { e.checked = !0; }), fa.length = Lu = Bu = 0; }, handleEvent: function(e) { switch (e.type) { case "drop": case "dragend": this._onDrop(e); break; case "dragenter": case "dragover": Y && (this._onDragOver(e), Mv(e)); break; case "selectstart": e.preventDefault(); break; } }, /** * Serializes the item into an array of string. * @returns {String[]} */ toArray: function() { for (var e = [], n, i = this.el.children, r = 0, o = i.length, s = this.options; r < o; r++) n = i[r], kn(n, s.draggable, this.el, !1) && e.push(n.getAttribute(s.dataIdAttr) || Dv(n)); return e; }, /** * Sorts the elements according to the array. * @param {String[]} order order of the items */ sort: function(e, n) { var i = {}, r = this.el; this.toArray().forEach(function(o, s) { var l = r.children[s]; kn(l, this.options.draggable, r, !1) && (i[o] = l); }, this), n && this.captureAnimationState(), e.forEach(function(o) { i[o] && (r.removeChild(i[o]), r.appendChild(i[o])); }), 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 kn(e, n || this.options.draggable, this.el, !1); }, /** * Set/get option * @param {string} name * @param {*} [value] * @returns {*} */ option: function(e, n) { var i = this.options; if (n === void 0) return i[e]; var r = Xs.modifyOption(this, e, n); typeof r < "u" ? i[e] = r : i[e] = n, e === "group" && Hm(i); }, /** * Destroy */ destroy: function() { Lt("destroy", this); var e = this.el; e[jt] = null, we(e, "mousedown", this._onTapStart), we(e, "touchstart", this._onTapStart), we(e, "pointerdown", this._onTapStart), this.nativeDraggable && (we(e, "dragover", this), we(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(n) { n.removeAttribute("draggable"); }), this._onDrop(), this._disableDelayedDragEvents(), da.splice(da.indexOf(this.el), 1), this.el = e = null; }, _hideClone: function() { if (!Bi) { if (Lt("hideClone", this), le.eventCanceled) return; he(ze, "display", "none"), this.options.removeCloneOnHide && ze.parentNode && ze.parentNode.removeChild(ze), Bi = !0; } }, _showClone: function(e) { if (e.lastPutMode !== "clone") { this._hideClone(); return; } if (Bi) { if (Lt("showClone", this), le.eventCanceled) return; Y.parentNode == We && !this.options.group.revertClone ? We.insertBefore(ze, Y) : hr ? We.insertBefore(ze, hr) : We.appendChild(ze), this.options.group.revertClone && this.animate(Y, ze), he(ze, "display", ""), Bi = !1; } } }; function Mv(t) { t.dataTransfer && (t.dataTransfer.dropEffect = "move"), t.cancelable && t.preventDefault(); } function sl(t, e, n, i, r, o, s, l) { var a, u = t[jt], c = u.options.onMove, h; return window.CustomEvent && !Ci && !Bs ? a = new CustomEvent("move", { bubbles: !0, cancelable: !0 }) : (a = document.createEvent("Event"), a.initEvent("move", !0, !0)), a.to = e, a.from = t, a.dragged = n, a.draggedRect = i, a.related = r || e, a.relatedRect = o || ot(e), a.willInsertAfter = l, a.originalEvent = s, t.dispatchEvent(a), c && (h = c.call(u, a, s)), h; } function Nu(t) { t.draggable = !1; } function Rv() { Vc = !1; } function Vv(t, e, n) { var i = ot(lo(n.el, 0, n.options, !0)), r = zm(n.el, n.options, fe), o = 10; return e ? t.clientX < r.left